hk_reportutils.h

00001 // ****************************************************************************
00002 // copyright (c) 2000-2005 Horst Knorr <hk_classes@knoda.org>  
00003 // This file is part of the hk_classes library.
00004 // This file may be distributed and/or modified under the terms of the
00005 // GNU Library Public License version 2 as published by the Free Software
00006 // Foundation and appearing in the file COPYING included in the
00007 // packaging of this file.
00008 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00009 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00010 // ****************************************************************************
00011 #ifndef HK_REPORTUTILS
00012 #define HK_REPORTUTILS
00013 #include "hk_report.h"
00014 #include "hk_reportsection.h"
00015 #include "hk_reportdata.h"
00016 using namespace std;
00083 class hk_reporthtml:public hk_report
00084 {
00085 
00086     public:
00087         hk_reporthtml(void);
00088         virtual ~hk_reporthtml(void);
00092         void    set_tabletag(const hk_string& t="");
00099         void    set_beforetable(const hk_string& value="%VALUE%",const hk_string& columnname="");
00104         void    set_aftertable(const hk_string& value="%VALUE%",const hk_string& columnname="");
00108         void    set_trtag(const hk_string& t);
00112         void    set_thtag(const hk_string& t);
00116         void    set_tdtag(const hk_string& t);
00123         void    set_beforehtmltag(const hk_string& b);
00129         void    set_betweenheadtags(const hk_string& b,const hk_string& colname="");
00134         void    set_groupcolumn(const hk_string& c);
00138         void    set_multiplefiles(bool m=true);
00142         void    set_title(const hk_string& t);
00146         void    set_author(const hk_string& a);
00147 
00148     protected:
00149 
00150         void    configure_page(void);
00151         void    configure_table(void);
00152     private:
00153         bool p_withheader;
00154         hk_string p_pagehead;
00155         hk_string p_bodytag;
00156         hk_string p_tabletag;
00157         hk_string p_trtag;
00158         hk_string p_thtag;
00159         hk_string p_tdtag;
00160         hk_string p_header;
00161         hk_string p_groupcolumn;
00162         hk_string p_columnbefore;
00163         hk_string p_columnafter;
00164         hk_string p_textafter;
00165         hk_string p_beforevalue;
00166         hk_string p_aftervalue;
00167         hk_string p_head;
00168         hk_string p_title;
00169         hk_string p_author;
00170         hk_reportsection* p_beforetablesection;
00171         hk_reportsection* p_tableheadersection;
00172         hk_reportsection* p_tableendsection;
00173         hk_reportsection* p_datasection;
00174         hk_reportdata*    p_pageheaddata;
00175         hk_reportdata*    p_beforetabledata;
00176         hk_reportdata*    p_aftertabledata;
00177 
00178 };
00179 
00180 hk_string  recode_html(const hk_string& where,hk_report*);
00181 hk_string  recode_postscript(const hk_string& where,hk_report*);
00182 hk_string  fullpagereplace_postscript(const hk_string& where,hk_report*);
00183 hk_string  recode_utf8(const hk_string& where,hk_report*);
00184 
00185 unsigned long recount_postscript(hk_reportsection* s);
00186 void   configure_postscriptdata(hk_reportdata* d);
00187 bool   configure_postscriptreport(hk_report*,int);
00188 bool set_reporttype_postscript(hk_report*,bool);
00189 hk_string replacepsdatafunction(hk_reportdata* rd,const hk_string& value);
00190 
00220 class hk_reportcsv:public hk_report
00221 {
00222     public:
00223 
00224         hk_reportcsv(void);
00225 virtual ~hk_reportcsv(void);
00226         void    set_groupcolumn(const hk_string& c);
00227         void    set_multiplefiles(bool m=true);
00232         void    set_filedefinition(const hk_string& textdelimiter="\"",const hk_string& betweenfields=",", const hk_string& rowdelimiter="\n",const hk_string& datetimeformat="",const hk_string& dateformat="",const hk_string& timeformat="", const hk_string& charset="",const hk_string& locale="");
00236         void    set_withheader(bool with);
00237         hk_string textdelimiter(void){return p_delimiter;}
00238         hk_string between(void) {return p_between;}
00239     protected:
00240         hk_reportsection* p_datasection;
00241         hk_reportsection* p_footsection;
00242         void configure_page(void);
00243         virtual void    widget_specific_before_execute(void);
00244         virtual void    widget_specific_after_execute(void);
00245 
00246     private:
00247         hk_string p_groupcolumn;
00248         hk_string p_between;
00249         hk_string p_delimiter;
00250         bool p_withheader;
00251 
00252 
00253 };
00254 hk_string encodefilecharsetfunction(hk_reportdata*,const hk_string&);
00255 void automatic_create_csvfields(hk_reportsection*);
00256 
00257 unsigned long zmm2ps(unsigned long);
00258 unsigned long ps2zmm(unsigned long);
00259 
00260 class hk_reportxml: public hk_report
00261 {
00262     public:
00263         hk_reportxml(void);
00264 virtual ~hk_reportxml(void);
00265         bool set_maindocumenttag(const hk_string& t);
00266         hk_string maindocumenttag(void);
00267         bool set_rowtag(const hk_string& t);
00268         hk_string rowtag(void);
00269         void set_includetableschema(bool);
00270         void set_excelxml(bool);
00271         bool excelxml(void);
00272         bool includetableschema(void);
00273         enum enum_fieldtag {fieldname,fieldnameattribute};
00274         void set_fieldname_as_attribute(enum_fieldtag tag);
00275         enum_fieldtag fieldname_as_attribute(void);
00276     protected:
00277         void configure_page(void);
00278         void configure_excelpage(void);
00279         virtual void    widget_specific_before_execute(void);
00280         virtual void    widget_specific_after_execute(void);
00281         virtual void    widget_specific_before_last_outstream_closed(void);
00282 
00283     private:
00284         hk_string p_maindocumenttag;
00285         hk_string p_rowtag;
00286         bool p_include_tableschema;
00287         bool p_excelxml;
00288         enum_fieldtag p_fieldtag;
00289 
00290 };
00291 
00292 hk_string  fullpagereplace_excelxml(const hk_string& where,hk_report* report);
00293 hk_string replaceexcelxmldatafunction(hk_reportdata* rd,const hk_string& value);
00294 void   configure_excelxmldata(hk_reportdata* d);
00295 
00296 #endif

Generated on Tue Nov 28 02:48:08 2006 for Databaseconnectionclasses by  doxygen 1.5.0