hk_report.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_REPORT
00012 #define HK_REPORT
00013 #include "hk_definitions.h"
00014 #include "hk_presentation.h"
00015 #include <list>
00016 #include <vector>
00017 //#include <iostream>
00018 //#include <fstream>
00019 #include <time.h>
00020 #include <map>
00021 using namespace std;
00022 
00023 class hk_reportsection;
00024 class hk_reportsectionpair;
00025 class hk_reportdata;
00026 class hk_report;
00027 class hk_column;
00028 
00029 class hk_reportprivate;
00030 
00052 class hk_report :public hk_presentation
00053 {
00054     friend class hk_reportsectionpair;
00055     friend class hk_reportsection;
00056     public:
00057         hk_report(void);
00058         virtual       ~hk_report(void);
00066         void          set_filename(const hk_string&,bool registerchange=true);
00067         hk_string     filename(void);
00073         void          set_use_standard_storagepath(bool s=true);
00074         bool          use_standard_storagepath(void);
00079         hk_string     outputfile(void);
00080 
00085         void          set_begin(const hk_string&,bool registerchange=true);
00086         hk_string     begin(void);
00091         void          set_end(const hk_string&,bool registerchange=true);
00092         hk_string     end(void);
00096         hk_reportsection* page_header(void);
00100         hk_reportsection* page_footer(void);
00104         hk_reportsection* report_header(void);
00108         hk_reportsection* report_footer(void);
00109 
00114         hk_reportsection* datasection(void);
00115 
00120         hk_reportsectionpair* new_sectionpair(bool registerchange=true);
00125         hk_reportsectionpair* new_sectionpair_at(unsigned int position,bool registerchange=true);
00131         bool move_sectionpair(unsigned int actualposition,int steps);
00132 
00137         bool          execute(void);
00138         bool    while_executing(void) const;
00139        virtual bool            set_mode(enum_mode s);
00140 
00146         void        set_recodefunction(const hk_string& r,bool registerchange=true);
00147         recodefunctiontype* recodefunction(void);
00148         hk_string       recodefunctionstring(void);
00149 
00150         static void add_recodetype(const hk_string& name,recodefunctiontype* f);
00151         static list<hk_string>* recodelist(void);
00156         static list<hk_string>* fontencodinglist(void);
00157         static bool set_fontencoding(int );
00158         static bool set_fontencoding(const hk_string&);
00159         static hk_string   fontencodingstring(void);
00160         static int      fontencoding(void);
00161 
00162         void        new_page(void);
00163 
00168         void        set_pagedelimiter(const hk_string& d,bool registerchange=true);
00169         hk_string   pagedelimiter(void);
00173         vector<hk_reportsectionpair*>* sectionpairs(void);
00178         virtual void    set_multiplefiles(bool m=true,bool registerchange=true);
00179         bool    multiplefiles(void);
00183         void        set_fileextension(const hk_string& ext,bool registerchange=true);
00184         hk_string   fileextension(void);
00188         void        set_firstpagenumber(long int f,bool registerchange=true);
00189         long int    firstpagenumber(void);
00195         void        set_pagenamecolumn(const hk_string& c,bool registerchange=true);
00196         hk_string   pagenamecolumn(void);
00200         void        set_filebegin(const hk_string& b,bool registerchange=true);
00201         hk_string   filebegin(void);
00205         void        set_fileend(const hk_string& e,bool registerchange=true);
00206         hk_string   fileend(void);
00214         void        set_periodic(unsigned long when, const hk_string& what="",bool newpage=false,bool registerchange=true);
00215         unsigned long   periodic_when(void);
00216         hk_string   periodic_what(void);
00217         bool        periodic_newpage(void);
00218 
00222         ostream*    outputstream(void);
00228         void    set_masterreport(hk_report* m);
00229         hk_report* masterreport(void);
00230         bool is_subreport(void) const;
00231         bool is_subpresentation(void);
00232 
00236         void        rowcount(unsigned long);
00237         virtual hk_font font(void);
00244         long pagenumber(void);
00245         long absolutepagenumber(void);
00246         unsigned long rownumber(void);
00247 
00248         virtual bool        set_presentationdatasource(long n, bool registerchange=true);
00249 
00250         virtual bool save_report(const hk_string& name="",bool ask=true);
00251         virtual bool load_report(const hk_string& name="");
00252         virtual void  savedata(ostream& s);
00253         virtual void  loaddata(const hk_string& definition);
00254 
00259         hk_string   default_reportdata(void);
00260         void        set_default_reportdata(const hk_string& v,bool registerchange=true);
00264         hk_string   default_beforereportdata(void);
00265         void        set_default_beforereportdata(const hk_string& v,bool registerchange=true);
00269         hk_string   default_afterreportdata(void);
00270         void        set_default_afterreportdata(const hk_string& v,bool registerchange=true);
00271 
00272         int         default_reportprecision(void);
00273         void        set_default_reportprecision(int, bool registerchange=true);
00274 
00275         bool        default_use_reportseparator(void);
00276         void        set_default_use_reportseparator(bool, bool registerchange=true);
00277 
00281         void            set_default_reportdataconfigurefunction(const hk_string& f,bool registerchange=true);
00282         hk_string   default_reportdataconfigurefunction(void);
00288         void set_default_reportsectionbegin(const hk_string& e,bool registerchange=true);
00289         hk_string default_reportsectionbegin(void);
00290 
00296         void set_default_reportsectionend(const hk_string& e,bool registerchange=true);
00297         hk_string default_reportsectionend(void);
00303         void set_default_reportsectionbetweendata(const hk_string& b,bool registerchange=true);
00304         hk_string default_reportsectionbetweendata(void);
00310         void set_default_reportsectioncountfunction(const hk_string& f,bool registerchange=true);
00311         hk_string default_reportsectioncountfunction(void);
00312 
00316         void    set_topline(bool l=true,bool registerchange=true);
00317         bool    topline(void);
00321         void    set_bottomline(bool l=true,bool registerchange=true);
00322         bool    bottomline(void);
00327         void    set_leftline(bool l=true,bool registerchange=true);
00328         bool    leftline(void);
00329 
00333         void    set_rightline(bool l=true,bool registerchange=true);
00334         bool    rightline(void);
00338         void    set_diagonalluro(bool l=true,bool registerchange=true);
00339         bool    diagonalluro(void);
00343         void    set_diagonalloru(bool l=true,bool registerchange=true);
00344         bool    diagonalloru(void);
00349         void    set_frame(bool l=true,bool registerchange=true);
00350 
00354         void    set_borders(unsigned int left=200,unsigned  int right=200,unsigned  int top=200,unsigned  int bottom=300,bool registerchange=true);
00355         unsigned int    border_left(void);
00356         unsigned int    border_right(void);
00357         unsigned int    border_top(void);
00358         unsigned int    border_bottom(void);
00359         enum    orientationtype{landscape,portrait};
00363         void    set_orientation(orientationtype o=portrait,bool registerchange=true);
00364         orientationtype orientation(void);
00365         enum    pageformattype {A0=0,A1=1,A2=2,A3=3,A4=4,A5=5,A6=6,A7=7,A8=8,A9=9,A10=10,letter=11,legal=12,executive=13,tabloid=14,userdefined=15}
00366         ;
00370         void    set_pageformat(pageformattype t=A4,bool registerchange=true);
00374         void    set_pageformat(unsigned int width ,unsigned int height,bool registerchange);
00375         pageformattype pageformat(void);
00379         unsigned int    formatwidth(pageformattype t=A4) ;
00383         unsigned int    formatheight(pageformattype t=A4);
00384         void    set_reportconfigurefunction(const hk_string& f,bool registerchange);
00385 
00386         void    set_reporttype(const hk_string&,bool registerchange=true);
00387         hk_string reporttype(void);
00388 
00389         static void add_reporttype(const hk_string& name,reporttypefunction* f);
00390         static list<hk_string>* reporttypelist(void);
00391 
00392         void    configure_page(void);
00393         void    neutralize_definition(bool registerchange);
00397         void    init_report(void);
00398         static void add_configurefunctiontype(const hk_string& name,report_configurefunction* f);
00399         static list<hk_string>* configurefunctionlist(void);
00400 
00401         void   remove_sectionpair(hk_reportsectionpair*,bool registerchange=true);
00402         list<hk_string>* neededfonts(void);
00403         list<hk_string>* usedfonts(void);
00407         static void set_printcommand(const hk_string& printcommand);
00408         static hk_string printcommand(void);
00409 
00413         bool print_report(bool execute_before_printing=true);
00414 
00415         unsigned int    designwidth(void);
00416         unsigned int    designheight(void);
00417         unsigned int        horizontal2relativ(unsigned int h);
00418         unsigned int        vertical2relativ(unsigned int v);
00419         unsigned int        relativ2horizontal(unsigned int r);
00420         unsigned int        relativ2vertical(unsigned int r);
00421         virtual void bulk_operation(enum_bulkoperation bulkoperation);
00422 static  void setup_reportbasics(void);
00423 hk_reportdata* get_reportdatavisible(long nr);
00424 hk_reportdata* get_reportdatavisible(const hk_string& identifier);
00425 
00426 void set_on_new_page_action(const hk_string&,bool registerchange=true);
00427 hk_string on_new_page_action(void);
00428 void stop_execution(void);
00429 bool execution_stopped(void);
00430 
00431         hk_string filelocale(void);
00432         hk_string filecharset(void);
00433         void set_filelocale(const hk_string&);
00434         void set_filecharset(const hk_string&);
00435 
00436     protected:
00437         void set_progressdialog(progress_dialogtype* progressdialog);
00438         progress_dialogtype* progressdialog(void)const;
00439         void   remove_section(hk_reportsection*);
00440         virtual hk_string replace(const hk_string& where);
00441         virtual bool datasource_disable(void);
00442         virtual bool before_columns_deleted(void);
00443 
00447         virtual bool widget_specific_before_new_page(void);
00448 
00452         virtual bool widget_specific_after_new_page(void);
00453 
00454         virtual hk_reportsection* widget_specific_new_section(void);
00455         virtual void    widget_specific_after_loadreport(void){}
00456         virtual void    widget_specific_before_execute(void){}
00457         virtual void    widget_specific_after_first_outstream_created(void){}
00458         virtual void    widget_specific_before_last_outstream_closed(void){}
00459         virtual void    widget_specific_after_execute(void){}
00460         virtual bool     widget_specific_row_change(void);
00461         virtual void     widget_specific_batch_next(void);
00462         virtual void     widget_specific_batch_previous(void);
00463         void remove_all_sections(void);
00464 
00465         bool        p_multiplefiles;
00466         vector<hk_reportsectionpair*> p_sectionpairs;
00467 
00468         hk_string p_default_data;
00469         hk_string p_default_beforedata;
00470         hk_string p_default_afterdata;
00471         hk_string p_default_dataconfigurefunction;
00472         virtual void sizetype_changed(void);
00473         void        database_delete(void);
00474 
00475         virtual bool action_on_new_page(void);
00476 
00477     private:
00478         void init_section(hk_reportsection*);
00479         bool internal_execute();
00480         void    new_outputstream(void);
00481         void    set_pagenumber(long int f);
00482         void    create_fontslists(void);
00483         bool    is_newfont(const hk_string&);
00484         void    search_sectionfonts(hk_reportsection*);
00485         hk_reportprivate* p_private;
00486 //      bool            p_lastpage;
00487 
00488         typedef  map<hk_string,reporttypefunction*,less<hk_string> >  reporttypelisttype ;
00489         static    reporttypelisttype  p_reporttypefunctions;
00490         static  list<hk_string> p_reporttypelist;
00491 
00492         typedef  map<hk_string,recodefunctiontype*,less<hk_string> >  recodefunctionlisttype ;
00493         static    recodefunctionlisttype  p_recodefunctions;
00494         static  list<hk_string> p_recodelist;
00495         static list<hk_string> p_fontencodinglist;
00496 
00497         typedef  map<hk_string,report_configurefunction*,less<hk_string> >  reportconfigurelisttype ;
00498         static    reportconfigurelisttype  p_reportconfigurefunctions;
00499         static  list<hk_string> p_reportconfigurelist;
00500         static int p_fontencoding;
00501 
00502         static int p_defaultfilenumber;
00503         static hk_string p_printcommand;
00504 
00505 }
00506 
00507 
00508 ;
00509 #endif

Generated on Tue May 2 09:15:35 2006 for Databaseconnectionclasses by  doxygen 1.4.6