00001
00002
00003
00004
00005
00006
00007
00008
00009
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 recode_utf8(const hk_string& where,hk_report*);
00183
00184 unsigned long recount_postscript(hk_reportsection* s);
00185 void configure_postscriptdata(hk_reportdata* d);
00186 bool configure_postscriptreport(hk_report*,int);
00187 bool set_reporttype_postscript(hk_report*,bool);
00188
00218 class hk_reportcsv:public hk_report
00219 {
00220 public:
00221
00222 hk_reportcsv(void);
00223 virtual ~hk_reportcsv(void);
00224 void set_groupcolumn(const hk_string& c);
00225 void set_multiplefiles(bool m=true);
00230 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="");
00234 void set_withheader(bool with);
00235 hk_string textdelimiter(void){return p_delimiter;}
00236 hk_string between(void) {return p_between;}
00237 protected:
00238 hk_reportsection* p_datasection;
00239 hk_reportsection* p_footsection;
00240 void configure_page(void);
00241 virtual void widget_specific_before_execute(void);
00242 virtual void widget_specific_after_execute(void);
00243
00244 private:
00245 hk_string p_groupcolumn;
00246 hk_string p_between;
00247 hk_string p_delimiter;
00248 bool p_withheader;
00249
00250
00251 };
00252 hk_string encodefilecharsetfunction(hk_reportdata*,const hk_string&);
00253 void automatic_create_csvfields(hk_reportsection*);
00254
00255 unsigned long zmm2ps(unsigned long);
00256 unsigned long ps2zmm(unsigned long);
00257
00258 class hk_reportxml: public hk_report
00259 {
00260 public:
00261 hk_reportxml(void);
00262 virtual ~hk_reportxml(void);
00263 bool set_maindocumenttag(const hk_string& t);
00264 hk_string maindocumenttag(void);
00265 bool set_rowtag(const hk_string& t);
00266 hk_string rowtag(void);
00267 void set_includetableschema(bool);
00268 bool includetableschema(void);
00269 enum enum_fieldtag {fieldname,fieldnameattribute};
00270 void set_fieldname_as_attribute(enum_fieldtag tag);
00271 enum_fieldtag fieldname_as_attribute(void);
00272 protected:
00273 void configure_page(void);
00274 virtual void widget_specific_before_execute(void);
00275 virtual void widget_specific_after_execute(void);
00276 virtual void widget_specific_before_last_outstream_closed(void);
00277
00278 private:
00279 hk_string p_maindocumenttag;
00280 hk_string p_rowtag;
00281 bool p_include_tableschema;
00282 enum_fieldtag p_fieldtag;
00283
00284 };
00285 #endif