Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

hk_classes/hk_classes/hk_report.h

Go to the documentation of this file.
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         bool    while_load_report(void) const;
00140         virtual bool while_loading(void);
00141        virtual bool            set_mode(enum_mode s);
00142 
00148         void        set_recodefunction(const hk_string& r,bool registerchange=true);
00149         recodefunctiontype* recodefunction(void);
00150         hk_string       recodefunctionstring(void);
00151 
00152         static void add_recodetype(const hk_string& name,recodefunctiontype* f);
00153         static list<hk_string>* recodelist(void);
00154 
00155         void        new_page(void);
00156 
00161         void        set_pagedelimiter(const hk_string& d,bool registerchange=true);
00162         hk_string   pagedelimiter(void);
00166         vector<hk_reportsectionpair*>* sectionpairs(void);
00171         virtual void    set_multiplefiles(bool m=true,bool registerchange=true);
00172         bool    multiplefiles(void);
00176         void        set_fileextension(const hk_string& ext,bool registerchange=true);
00177         hk_string   fileextension(void);
00181         void        set_firstpagenumber(long int f,bool registerchange=true);
00182         long int    firstpagenumber(void);
00188         void        set_pagenamecolumn(const hk_string& c,bool registerchange=true);
00189         hk_string   pagenamecolumn(void);
00193         void        set_filebegin(const hk_string& b,bool registerchange=true);
00194         hk_string   filebegin(void);
00198         void        set_fileend(const hk_string& e,bool registerchange=true);
00199         hk_string   fileend(void);
00207         void        set_periodic(unsigned long when, const hk_string& what="",bool newpage=false,bool registerchange=true);
00208         unsigned long   periodic_when(void);
00209         hk_string   periodic_what(void);
00210         bool        periodic_newpage(void);
00211 
00215         ostream*    outputstream(void);
00221         void    set_masterreport(hk_report* m);
00222         hk_report* masterreport(void);
00223         bool is_subreport(void) const;
00224         bool is_subpresentation(void);
00225 
00229         void        rowcount(unsigned long);
00230         unsigned long   current_rowcount(void);
00231         virtual hk_font font(void);
00238         long pagenumber(void);
00239         long absolutepagenumber(void);
00240         unsigned long rownumber(void);
00241 
00242         virtual bool        set_presentationdatasource(long n, bool registerchange=true);
00243 
00244         virtual bool save_report(const hk_string& name="",bool ask=true);
00245         virtual bool load_report(const hk_string& name="");
00246         virtual void  savedata(ostream& s);
00247         virtual void  loaddata(const hk_string& definition);
00248 
00253         hk_string   default_reportdata(void);
00254         void        set_default_reportdata(const hk_string& v,bool registerchange=true);
00258         hk_string   default_beforereportdata(void);
00259         void        set_default_beforereportdata(const hk_string& v,bool registerchange=true);
00263         hk_string   default_afterreportdata(void);
00264         void        set_default_afterreportdata(const hk_string& v,bool registerchange=true);
00265 
00266         int         default_reportprecision(void);
00267         void        set_default_reportprecision(int, bool registerchange=true);
00268 
00269         bool        default_use_reportseparator(void);
00270         void        set_default_use_reportseparator(bool, bool registerchange=true);
00271 
00275         void            set_default_reportdataconfigurefunction(const hk_string& f,bool registerchange=true);
00276         hk_string   default_reportdataconfigurefunction(void);
00282         void set_default_reportsectionbegin(const hk_string& e,bool registerchange=true);
00283         hk_string default_reportsectionbegin(void);
00284 
00290         void set_default_reportsectionend(const hk_string& e,bool registerchange=true);
00291         hk_string default_reportsectionend(void);
00297         void set_default_reportsectionbetweendata(const hk_string& b,bool registerchange=true);
00298         hk_string default_reportsectionbetweendata(void);
00304         void set_default_reportsectioncountfunction(const hk_string& f,bool registerchange=true);
00305         hk_string default_reportsectioncountfunction(void);
00306 
00310         void    set_topline(bool l=true,bool registerchange=true);
00311         bool    topline(void);
00315         void    set_bottomline(bool l=true,bool registerchange=true);
00316         bool    bottomline(void);
00321         void    set_leftline(bool l=true,bool registerchange=true);
00322         bool    leftline(void);
00323 
00327         void    set_rightline(bool l=true,bool registerchange=true);
00328         bool    rightline(void);
00332         void    set_diagonalluro(bool l=true,bool registerchange=true);
00333         bool    diagonalluro(void);
00337         void    set_diagonalloru(bool l=true,bool registerchange=true);
00338         bool    diagonalloru(void);
00343         void    set_frame(bool l=true,bool registerchange=true);
00344 
00348         void    set_borders(unsigned int left=200,unsigned  int right=200,unsigned  int top=200,unsigned  int bottom=300,bool registerchange=true);
00349         unsigned int    border_left(void);
00350         unsigned int    border_right(void);
00351         unsigned int    border_top(void);
00352         unsigned int    border_bottom(void);
00353         enum    orientationtype{landscape,portrait};
00357         void    set_orientation(orientationtype o=portrait,bool registerchange=true);
00358         orientationtype orientation(void);
00359         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}
00360         ;
00364         void    set_pageformat(pageformattype t=A4,bool registerchange=true);
00368         void    set_pageformat(unsigned int width ,unsigned int height,bool registerchange);
00369         pageformattype pageformat(void);
00373         unsigned int    formatwidth(pageformattype t=A4) ;
00377         unsigned int    formatheight(pageformattype t=A4);
00378         void    set_reportconfigurefunction(const hk_string& f,bool registerchange);
00379 
00380         void    set_reporttype(const hk_string&,bool registerchange=true);
00381         hk_string reporttype(void);
00382 
00383         static void add_reporttype(const hk_string& name,reporttypefunction* f);
00384         static list<hk_string>* reporttypelist(void);
00385 
00386         void    configure_page(void);
00387         void    neutralize_definition(bool registerchange);
00391         void    init_report(void);
00392         static void add_configurefunctiontype(const hk_string& name,report_configurefunction* f);
00393         static list<hk_string>* configurefunctionlist(void);
00394 
00395         void   remove_sectionpair(hk_reportsectionpair*,bool registerchange=true);
00396         list<hk_string>* neededfonts(void);
00397         list<hk_string>* usedfonts(void);
00398         list<hk_string>* usedpsfonts(void);
00402         static void set_printcommand(const hk_string& printcommand);
00403         static hk_string printcommand(void);
00404 
00408         bool print_report(bool execute_before_printing=true);
00409 
00410         unsigned int    designwidth(void);
00411         unsigned int    designheight(void);
00412         unsigned int        horizontal2relativ(unsigned int h);
00413         unsigned int        vertical2relativ(unsigned int v);
00414         unsigned int        relativ2horizontal(unsigned int r);
00415         unsigned int        relativ2vertical(unsigned int r);
00416         virtual void bulk_operation(enum_bulkoperation bulkoperation);
00417 static  void setup_reportbasics(void);
00418 hk_reportdata* get_reportdatavisible(long nr);
00419 hk_reportdata* get_reportdatavisible(const hk_string& identifier);
00420 
00421 void set_on_new_page_action(const hk_string&,bool registerchange=true);
00422 hk_string on_new_page_action(void);
00423 void stop_execution(void);
00424 bool execution_stopped(void);
00425 
00426         hk_string filelocale(void);
00427         hk_string filecharset(void);
00428         void set_filelocale(const hk_string&);
00429         void set_filecharset(const hk_string&);
00430         void set_useencodingtab(bool);
00431         bool useencodingtab(void);
00432         hk_encodingtab* encodingtab(void) const;
00436         void set_print_full_pages_only(bool, bool registerchange);
00437         bool print_full_pages_only(void);
00438 
00439 
00440         void        set_fullpagereplacefunction(const hk_string& r,bool registerchange=true);
00441         recodefunctiontype* fullpagereplacefunction(void);
00442         hk_string      fullpagereplacefunctionstring(void);
00443 
00444         static void add_fullpagereplacefunctiontype(const hk_string& name,recodefunctiontype* f);
00445         static list<hk_string>* fullpagereplacefunctionlist(void);
00446         static void set_embedfonts(bool);
00447         static bool embedfonts(void);
00448 virtual hk_string tag_value(int tagnumber, bool& ok);
00449 
00450     protected:
00451         void set_progressdialog(progress_dialogtype* progressdialog);
00452         progress_dialogtype* progressdialog(void)const;
00453         void   remove_section(hk_reportsection*);
00454 //         virtual hk_string replace(const hk_string& where);
00455         virtual bool datasource_disable(void);
00456         virtual bool before_columns_deleted(void);
00457 
00461         virtual bool widget_specific_before_new_page(void);
00462 
00466         virtual bool widget_specific_after_new_page(void);
00467 
00468         virtual hk_reportsection* widget_specific_new_section(void);
00469         virtual void    widget_specific_after_loadreport(void){}
00470         virtual void    widget_specific_before_execute(void){}
00471         virtual void    widget_specific_after_first_outstream_created(void){}
00472         virtual void    widget_specific_before_last_outstream_closed(void){}
00473         virtual void    widget_specific_after_execute(void){}
00474         virtual bool     widget_specific_row_change(void);
00475         virtual void     widget_specific_batch_next(void);
00476         virtual void     widget_specific_batch_previous(void);
00477         void remove_all_sections(void);
00478 
00479         bool        p_multiplefiles;
00480         vector<hk_reportsectionpair*> p_sectionpairs;
00481 
00482         hk_string p_default_data;
00483         hk_string p_default_beforedata;
00484         hk_string p_default_afterdata;
00485         hk_string p_default_dataconfigurefunction;
00486         virtual void sizetype_changed(void);
00487         void        database_delete(void);
00488 
00489         virtual bool action_on_new_page(void);
00490 
00491     private:
00492         void init_section(hk_reportsection*);
00493         bool internal_execute();
00494         void    new_outputstream(void);
00495         void    set_pagenumber(long int f);
00496         void    create_fontslists(void);
00497         bool    is_newfont(const hk_string&);
00498         void    search_sectionfonts(hk_reportsection*);
00499         void    write_bufferedpage(void);
00500         void    registerfont(hk_font*);
00501         hk_reportprivate* p_private;
00502 //      bool            p_lastpage;
00503 
00504         typedef  map<hk_string,reporttypefunction*,less<hk_string> >  reporttypelisttype ;
00505         static    reporttypelisttype  p_reporttypefunctions;
00506         static  list<hk_string> p_reporttypelist;
00507 
00508         typedef  map<hk_string,recodefunctiontype*,less<hk_string> >  recodefunctionlisttype ;
00509         static    recodefunctionlisttype  p_recodefunctions;
00510         static  list<hk_string> p_recodelist;
00511 
00512         static    recodefunctionlisttype  p_fullpagereplacefunctions;
00513         static  list<hk_string> p_fullpagereplacelist;
00514 
00515         typedef  map<hk_string,report_configurefunction*,less<hk_string> >  reportconfigurelisttype ;
00516         static    reportconfigurelisttype  p_reportconfigurefunctions;
00517         static  list<hk_string> p_reportconfigurelist;
00518 
00519         static int p_defaultfilenumber;
00520         static hk_string p_printcommand;
00521         static bool p_embedfonts;
00522 
00523 }
00524 
00525 
00526 ;
00527 #endif

Generated on Thu Mar 9 18:40:40 2006 for hk_classes by  doxygen 1.4.1