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

hk_classes/hk_classes/hk_reportsection.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_REPORTSECTION
00012 #define HK_REPORTSECTION
00013 #include "hk_definitions.h"
00014 #include "hk_dsdatavisible.h"
00015 #include <list>
00016 #include <vector>
00017 #include <map>
00018 #include <iostream>
00019 #include <fstream>
00020 #include <time.h>
00021 #include "hk_presentation.h"
00022 
00023 using namespace std;
00024 
00025 class hk_reportsection;
00026 class hk_reportsectionpair;
00027 class hk_reportdata;
00028 class hk_report;
00029 class hk_column;
00035 typedef hk_string   section_replacefunctiontype(hk_reportsection*,const hk_string& );
00036 
00037 typedef struct
00038 {
00039     number sum;
00040     number min;
00041     number max;
00042     number value;
00043     unsigned long count;
00044     longnumber squaresum;
00045     char colname[75];
00046 //  enum_fieldtype fieldtype;
00047 } struct_countnumbers;
00048 
00092 class hk_reportsection : public hk_dsdatavisible
00093 {
00094     friend class hk_report;
00095     friend class hk_reportsectionpair;
00096     friend class hk_reportdata;
00097     public:
00105         void        set_unique(bool unique=true, bool endsection=false,bool registerchange=true);
00106 //hk_string             unique_column(void){return p_uniquecolumnname;}
00107         bool        unique(void);
00111         hk_reportdata*  new_data(void);
00112 //hk_reportdata*  new_data_at(unsigned int);
00113         hk_reportdata*  data_at(unsigned int);
00114 //void          delete_at(unsigned int);
00115         vector<hk_reportdata*>* datalist(void);
00119         virtual bool        actual_string(void);
00123         hk_string       sectionbegin(void);
00124         void        set_sectionbegin(const hk_string& b,bool registerchange=true);
00129         hk_string   sectionend(void);
00130         void        set_sectionend(const hk_string& e,bool registerchange=true);
00135         hk_string   betweendata(void);
00136         void        set_betweendata(const hk_string& b,bool registerchange=true);
00142         bool        new_uniquevalue(bool justcheck=false);
00146         bool        endsection(void);
00147 
00152         void        set_automatic_create_data(bool d=true,bool registerchange=true);
00157         bool        new_page_after_section(void);
00158         void        set_new_page_after_section(bool p,bool registerchange=true);
00162         bool        section_was_printed(void);
00169         void        set_subreport(const hk_string& subreport="",bool before_data=false,bool registerchange=true);
00170         hk_string   subreportname(void);
00171         hk_report*  subreport(void);
00175         void        add_depending_fields(const hk_string& thisreport_field, const hk_string& subreport_field,bool registerchange=true);
00176         void        clear_depending_fields(void);
00177         list<hk_string>* depending_on_thisreportfields(void);
00178         list<hk_string>* depending_on_subreportfields(void);
00179 
00180         bool        print_subreport_before_data(void){return p_print_subreport_before_data;}
00181         bool        print_subreport(void);
00187         void        set_replacefunction(const hk_string& f,bool registerchange=true);
00188         virtual hk_string replace(const hk_string& where);
00189 
00190         static void add_sectionreplacefunctiontype(const hk_string& name,section_replacefunctiontype* f);
00191         static list<hk_string>* sectionreplacefunctionlist(void);
00192 
00197         void        reset_count(void);
00198         virtual hk_font font(void);
00199         virtual unsigned long counts_as(void);
00204         static void add_sectioncountfunctiontype(const hk_string& name,reportsectioncounttype* f);
00205         static list<hk_string>* sectioncountfunctionlist(void);
00206 
00207         void set_sectioncountfunction(const hk_string& f,bool registerchange=true);
00208         hk_string sectioncountfunctionstring(void);
00209         reportsectioncounttype* sectioncountfunction(void);
00210         virtual void  savedata(ostream& s,bool userdefined=false);
00211         virtual void  loaddata(const hk_string& definition,bool userdefined=false);
00212         virtual void set_datasource(hk_datasource* d);
00213         virtual bool        set_presentationdatasource(long n, bool registerchange=true);
00218         hk_string   default_reportdata(void){return p_default_data;}
00219         void        set_default_reportdata(const hk_string& v,bool registerchange=true);
00220         hk_string   default_beforereportdata(void){return p_default_beforedata;}
00221         void        set_default_beforereportdata(const hk_string& v,bool registerchange=true);
00222         hk_string   default_afterreportdata(void){return p_default_afterdata;}
00223         void        set_default_afterreportdata(const hk_string& v,bool registerchange=true);
00224         void            set_default_reportdataconfigurefunction(const hk_string& f,bool registerchange=true);
00225         hk_string   default_reportdataconfigurefunction(void);
00226         int         default_reportprecision(void);
00227         void        set_default_reportprecision(int, bool registerchange=true);
00228 
00229         bool        default_use_reportseparator(void);
00230         void        set_default_use_reportseparator(bool, bool registerchange=true);
00231 
00232         void    neutralize_definition(bool registerchange);
00233         virtual void    reset(void);
00234         void clear_countingfields(void);
00235         void    remove_data(hk_reportdata*);
00236         hk_report* report(void);
00240         unsigned int        horizontal2relativ(unsigned int h);
00244         unsigned int        vertical2relativ(unsigned int v);
00248         unsigned int        relativ2horizontal(unsigned int r);
00252         unsigned int        relativ2vertical(unsigned int r);
00253         hk_reportsectionpair*   reportsectionpair(void){return p_pair;}
00257         bool set_offset(unsigned int o,bool registerchange=true);
00258         unsigned int offset(void);
00259         void bulk_operation(hk_presentation::enum_bulkoperation bulkoperation);
00260         void set_automaticcreatedatafunction(reportsectionautomaticcreatedatatype*);
00261         reportsectionautomaticcreatedatatype* automaticcreatedatafunction(void){ return p_automaticreatedatafunction;}
00262 hk_reportdata* get_reportdatavisible(long nr);
00263 hk_reportdata* get_reportdatavisible(const hk_string& identifier);
00264          bool is_fully_printed(void);
00265          void set_print_section(bool);
00266          bool print_section(void);
00267 
00268 
00269     protected:
00270         hk_reportsection(hk_report*);
00271         virtual     ~hk_reportsection(void);
00272         virtual void    before_datasource_enables(void);
00273         void    remove_all_datas(void);
00274         virtual hk_reportdata* widget_specific_new_data(void);
00275         virtual void widget_specific_after_loaddata(void){}
00276         virtual void widget_specific_offset_changed(void){}
00277         virtual void sizetype_changed(void);
00278         virtual bool    presentationmode_changed(void);
00279         void    automatic_create_datafields(void);
00280         void force_new_section(void);
00281 
00282         bool p_already_automaticcreated_data;
00283 
00284         vector<hk_reportdata*> p_data;
00285 //        hk_string     p_uniquecolumnname;
00286         bool   p_unique;
00287         hk_string p_lastuniquevalue;
00288         hk_string p_sectionbegin;
00289         hk_string p_sectionend;
00290         hk_string p_betweendata;
00291         hk_report* p_report;
00292         hk_report* p_subreport;
00293         hk_string  p_subreportstring;
00294         bool       p_print_subreport_before_data;
00295         bool p_uniqueendsection;
00296         bool p_automatic_create_datas;
00297         bool p_newpageaftersection;
00298         bool p_sectionwasprinted;
00299         section_replacefunctiontype* p_replacefunction;
00300         hk_string   p_replacefunctionstring;
00301         hk_string p_default_data;
00302         hk_string p_default_beforedata;
00303         hk_string p_default_afterdata;
00304         hk_string p_default_dataconfigurefunction;
00305         int     p_default_precision;
00306         bool    p_default_use_thousandsseparator;
00307         unsigned int p_offset;
00308         void raise_widget(hk_reportdata*);
00309         void lower_widget(hk_reportdata*);
00310 
00311     private:
00312         void create_countingfields(void);
00313         void count_countingfields(void);
00314         void clear_counting(void);
00315         reportsectioncounttype* p_sectioncountfunction;
00316         hk_string  p_sectioncountfunctionstring;
00317         hk_datasource* p_subreportdatasource;
00318         bool p_automatic_created_datasource;
00319         vector<struct_countnumbers> p_countings;
00320 
00321         typedef  map<hk_string,reportsectioncounttype*,less<hk_string> >  sectioncountlisttype ;
00322         static    sectioncountlisttype  p_sectioncountfunctions;
00323         static  list<hk_string> p_sectioncountfunctionlist;
00324 
00325         typedef  map<hk_string,section_replacefunctiontype*,less<hk_string> >  sectionreplacelisttype ;
00326         static    sectionreplacelisttype  p_sectionreplacefunctions;
00327         static  list<hk_string> p_sectionreplacefunctionlist;
00328         list<hk_string> p_depending_thisreport_fields;
00329         list<hk_string> p_depending_subreport_fields;
00330         hk_reportsectionpair* p_pair;
00331         bool p_forcenewsection;
00332         reportsectionautomaticcreatedatatype* p_automaticreatedatafunction;
00333         bool p_printsection;
00334 };
00335 #endif

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