Databaseconnectionclasses  0.5.3
hk_reportutils.h
1 // ****************************************************************************
2 // copyright (c) 2000-2005 Horst Knorr <hk_classes@knoda.org>
3 // This file is part of the hk_classes library.
4 // This file may be distributed and/or modified under the terms of the
5 // GNU Library Public License version 2 as published by the Free Software
6 // Foundation and appearing in the file COPYING included in the
7 // packaging of this file.
8 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 // ****************************************************************************
11 #ifndef HK_REPORTUTILS
12 #define HK_REPORTUTILS
13 #include "hk_report.h"
14 #include "hk_reportsection.h"
15 #include "hk_reportdata.h"
16 using namespace std;
84 {
85 
86  public:
87  hk_reporthtml(void);
88  virtual ~hk_reporthtml(void);
92  void set_tabletag(const hk_string& t="");
99  void set_beforetable(const hk_string& value="%VALUE%",const hk_string& columnname="");
104  void set_aftertable(const hk_string& value="%VALUE%",const hk_string& columnname="");
108  void set_trtag(const hk_string& t);
112  void set_thtag(const hk_string& t);
116  void set_tdtag(const hk_string& t);
123  void set_beforehtmltag(const hk_string& b);
129  void set_betweenheadtags(const hk_string& b,const hk_string& colname="");
134  void set_groupcolumn(const hk_string& c);
138  void set_multiplefiles(bool m=true);
142  void set_title(const hk_string& t);
146  void set_author(const hk_string& a);
147 
148  protected:
149 
150  void configure_page(void);
151  void configure_table(void);
152  private:
153  bool p_withheader;
154  hk_string p_pagehead;
155  hk_string p_bodytag;
156  hk_string p_tabletag;
157  hk_string p_trtag;
158  hk_string p_thtag;
159  hk_string p_tdtag;
160  hk_string p_header;
161  hk_string p_groupcolumn;
162  hk_string p_columnbefore;
163  hk_string p_columnafter;
164  hk_string p_textafter;
165  hk_string p_beforevalue;
166  hk_string p_aftervalue;
167  hk_string p_head;
168  hk_string p_title;
169  hk_string p_author;
170  hk_reportsection* p_beforetablesection;
171  hk_reportsection* p_tableheadersection;
172  hk_reportsection* p_tableendsection;
173  hk_reportsection* p_datasection;
174  hk_reportdata* p_pageheaddata;
175  hk_reportdata* p_beforetabledata;
176  hk_reportdata* p_aftertabledata;
177 
178 };
179 
180 hk_string recode_html(const hk_string& where,hk_report*);
181 hk_string recode_postscript(const hk_string& where,hk_report*);
182 hk_string fullpagereplace_postscript(const hk_string& where,hk_report*);
183 hk_string recode_utf8(const hk_string& where,hk_report*);
184 
185 unsigned long recount_postscript(hk_reportsection* s);
186 void configure_postscriptdata(hk_reportdata* d);
187 bool configure_postscriptreport(hk_report*,int);
188 bool set_reporttype_postscript(hk_report*,bool);
189 hk_string replacepsdatafunction(hk_reportdata* rd,const hk_string& value);
190 
221 {
222  public:
223 
224  hk_reportcsv(void);
225 virtual ~hk_reportcsv(void);
226  void set_groupcolumn(const hk_string& c);
227  void set_multiplefiles(bool m=true);
232  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="");
236  void set_withheader(bool with);
237  hk_string textdelimiter(void){return p_delimiter;}
238  hk_string between(void) {return p_between;}
239  protected:
240  hk_reportsection* p_datasection;
241  hk_reportsection* p_footsection;
242  void configure_page(void);
243  virtual void widget_specific_before_execute(void);
244  virtual void widget_specific_after_execute(void);
245 
246  private:
247  hk_string p_groupcolumn;
248  hk_string p_between;
249  hk_string p_delimiter;
250  bool p_withheader;
251 
252 
253 };
254 hk_string encodefilecharsetfunction(hk_reportdata*,const hk_string&);
255 void automatic_create_csvfields(hk_reportsection*);
256 
257 unsigned long zmm2ps(unsigned long);
258 unsigned long ps2zmm(unsigned long);
259 
260 class hk_reportxml: public hk_report
261 {
262  public:
263  hk_reportxml(void);
264 virtual ~hk_reportxml(void);
265  bool set_maindocumenttag(const hk_string& t);
266  hk_string maindocumenttag(void);
267  bool set_rowtag(const hk_string& t);
268  hk_string rowtag(void);
269  void set_includetableschema(bool);
270  void set_excelxml(bool);
271  bool excelxml(void);
272  bool includetableschema(void);
273  enum enum_fieldtag {fieldname,fieldnameattribute};
274  void set_fieldname_as_attribute(enum_fieldtag tag);
275  enum_fieldtag fieldname_as_attribute(void);
276  protected:
277  void configure_page(void);
278  void configure_excelpage(void);
279  virtual void widget_specific_before_execute(void);
280  virtual void widget_specific_after_execute(void);
281  virtual void widget_specific_before_last_outstream_closed(void);
282 
283  private:
284  hk_string p_maindocumenttag;
285  hk_string p_rowtag;
286  bool p_include_tableschema;
287  bool p_excelxml;
288  enum_fieldtag p_fieldtag;
289 
290 };
291 
292 hk_string fullpagereplace_excelxml(const hk_string& where,hk_report* report);
293 hk_string replaceexcelxmldatafunction(hk_reportdata* rd,const hk_string& value);
294 void configure_excelxmldata(hk_reportdata* d);
295 
296 #endif
Definition: hk_reportutils.h:260
A predefined report that prints your data in a html table.
Definition: hk_reportutils.h:83
A predefined report that exports your data as cvs.
Definition: hk_reportutils.h:220
represents a section of the report.
Definition: hk_reportsection.h:92
represents the data of a field within a section.
Definition: hk_reportdata.h:75
basic class to create reports
Definition: hk_report.h:52