hk_reportsection Class Reference

represents a section of the report. More...

#include <hk_reportsection.h>

Inheritance diagram for hk_reportsection:

Inheritance graph
[legend]
Collaboration diagram for hk_reportsection:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void set_unique (bool unique=true, bool endsection=false, bool registerchange=true)
bool unique (void)
hk_reportdatanew_data (void)
hk_reportdatadata_at (unsigned int)
vector< hk_reportdata * > * datalist (void)
virtual bool actual_string (void)
hk_string sectionbegin (void)
void set_sectionbegin (const hk_string &b, bool registerchange=true)
hk_string sectionend (void)
void set_sectionend (const hk_string &e, bool registerchange=true)
hk_string betweendata (void)
void set_betweendata (const hk_string &b, bool registerchange=true)
bool new_uniquevalue (bool justcheck=false)
bool endsection (void)
void set_automatic_create_data (bool d=true, bool registerchange=true)
bool new_page_after_section (void)
void set_new_page_after_section (bool p, bool registerchange=true)
bool section_was_printed (void)
void set_subreport (const hk_string &subreport="", bool before_data=false, bool registerchange=true)
hk_string subreportname (void)
hk_reportsubreport (void)
void add_depending_fields (const hk_string &thisreport_field, const hk_string &subreport_field, bool registerchange=true)
void clear_depending_fields (void)
list< hk_string > * depending_on_thisreportfields (void)
list< hk_string > * depending_on_subreportfields (void)
bool print_subreport_before_data (void)
bool print_subreport (void)
void set_replacefunction (const hk_string &f, bool registerchange=true)
virtual hk_string replace (const hk_string &where)
void reset_count (void)
virtual hk_font font (void)
virtual unsigned long counts_as (void)
void set_sectioncountfunction (const hk_string &f, bool registerchange=true)
hk_string sectioncountfunctionstring (void)
reportsectioncounttype * sectioncountfunction (void)
virtual void savedata (ostream &s, bool userdefined=false)
virtual void loaddata (xmlNodePtr definition, bool userdefined=false)
virtual void set_datasource (hk_datasource *d)
virtual bool set_presentationdatasource (long n, bool registerchange=true)
hk_string default_reportdata (void)
void set_default_reportdata (const hk_string &v, bool registerchange=true)
hk_string default_beforereportdata (void)
void set_default_beforereportdata (const hk_string &v, bool registerchange=true)
hk_string default_afterreportdata (void)
void set_default_afterreportdata (const hk_string &v, bool registerchange=true)
void set_default_reportdataconfigurefunction (const hk_string &f, bool registerchange=true)
hk_string default_reportdataconfigurefunction (void)
int default_reportprecision (void)
void set_default_reportprecision (int, bool registerchange=true)
bool default_use_reportseparator (void)
void set_default_use_reportseparator (bool, bool registerchange=true)
void neutralize_definition (bool registerchange)
virtual void reset (void)
void clear_countingfields (void)
void remove_data (hk_reportdata *)
hk_reportreport (void)
unsigned int horizontal2relativ (unsigned int h)
unsigned int vertical2relativ (unsigned int v)
unsigned int relativ2horizontal (unsigned int r)
unsigned int relativ2vertical (unsigned int r)
hk_reportsectionpairreportsectionpair (void)
bool set_offset (unsigned int o, bool registerchange=true)
unsigned int offset (void)
void bulk_operation (hk_presentation::enum_bulkoperation bulkoperation)
void set_automaticcreatedatafunction (reportsectionautomaticcreatedatatype *)
reportsectionautomaticcreatedatatype * automaticcreatedatafunction (void)
hk_reportdataget_reportdatavisible (long nr)
hk_reportdataget_reportdatavisible (const hk_string &identifier)
bool is_fully_printed (void)
void set_print_section (bool)
bool print_section (void)

Static Public Member Functions

static void add_sectionreplacefunctiontype (const hk_string &name, section_replacefunctiontype *f)
static list< hk_string > * sectionreplacefunctionlist (void)
static void add_sectioncountfunctiontype (const hk_string &name, reportsectioncounttype *f)
static list< hk_string > * sectioncountfunctionlist (void)

Protected Member Functions

 hk_reportsection (hk_report *)
virtual void before_datasource_enables (void)
void remove_all_datas (void)
virtual hk_reportdatawidget_specific_new_data (void)
virtual void widget_specific_after_loaddata (void)
virtual void widget_specific_offset_changed (void)
virtual void sizetype_changed (void)
virtual bool presentationmode_changed (void)
void automatic_create_datafields (void)
void force_new_section (void)
void raise_widget (hk_reportdata *)
void lower_widget (hk_reportdata *)

Protected Attributes

bool p_already_automaticcreated_data
vector< hk_reportdata * > p_data
bool p_unique
hk_string p_lastuniquevalue
hk_string p_sectionbegin
hk_string p_sectionend
hk_string p_betweendata
hk_reportp_report
hk_reportp_subreport
hk_string p_subreportstring
bool p_print_subreport_before_data
bool p_uniqueendsection
bool p_automatic_create_datas
bool p_newpageaftersection
bool p_sectionwasprinted
section_replacefunctiontype * p_replacefunction
hk_string p_replacefunctionstring
hk_string p_default_data
hk_string p_default_beforedata
hk_string p_default_afterdata
hk_string p_default_dataconfigurefunction
int p_default_precision
bool p_default_use_thousandsseparator
unsigned int p_offset

Friends

class hk_report
class hk_reportsectionpair
class hk_reportdata

Detailed Description

represents a section of the report.

hk_reportsection represents a section in a hk_report element. Within a section you can define the outputdata,use it as headers for your data and so in If it is needed as a section header or footer use set_unique in combination with set_uniquecolumn It also can contain subreports. Usually section come as "twins", a header section and a footer section belonging to each other, see hk_reportsectionpair for details

Example: Defining a CVS output (no first row with columnnames)
 //
 // first define a datasource
 //
hk_drivermanager p_driver;
hk_connection* connect=p_driver.new_connection("mysql");
connect->set_user("root");
connect->set_host("localhost");
connect->set_password("my_password");
connect->connect();
hk_database* database=connect->new_database("vokabeltrainer");
 //
 //now start defining the report
 //
hk_report e;
 long int datasrc =e.new_datasource("reportabfrage",true);//loads an existing query
 e.set_presentationdatasource(datasrc);
hk_reportsection* s=e.datasection();
s->set_default_data("\"VALUE%\""); // define " before and after the value of a column
s->set_betweendata(" , "); // a comma separated list
s->set_sectionend("\n"); // one row per datarow
e.execute();
you can use the variables

PAGENUMBER%         the number of the page
ABSOLUTEPAGENUMBER% physical number of the page in file

Version:
Revision
1.46
Author:
Horst Knorr (hk_classes@knoda.org)


Member Function Documentation

void hk_reportsection::set_unique ( bool  unique = true,
bool  endsection = false,
bool  registerchange = true 
)

If the section should be printed just once per block and not for each datarow use this function

Parameters:
unique true if this section should be printed once interesting four grouped data
endsection true if this section should not be printed as a header. Instead it will be printed at the end of the block. Sections created with hk_reportsectionpair are already set correctly.

hk_reportdata * hk_reportsection::new_data ( void   ) 

the printed data. See hk_reportdata and default_data for details

bool hk_reportsection::actual_string ( void   )  [virtual]

will send the actual data to the outputstream hk_report::outputstream

hk_string hk_reportsection::sectionbegin ( void   ) 

The sectionbegin will be printed as a header of the section (before the data)

hk_string hk_reportsection::sectionend ( void   ) 

The sectionend will be printed as a footer of the section (after the data) i.e. a
at the end of a datarow

hk_string hk_reportsection::betweendata ( void   ) 

A string that will be printed between two datasegments defined with new_data i.e. If you want a comma separated list you would need set_betweendata(" , ");

bool hk_reportsection::new_uniquevalue ( bool  justcheck = false  ) 

Parameters:
justcheck if true no variables(lastvalue) will be changed
Returns:
true if this section is a unique section and this section has to be printed

bool hk_reportsection::endsection ( void   ) 

Returns:
true if this section is a unique section and will be printed behind the data

void hk_reportsection::set_automatic_create_data ( bool  d = true,
bool  registerchange = true 
)

If set true and you haven't defined any data with new_data it will automatically create the data set with default_data

bool hk_reportsection::new_page_after_section ( void   ) 

true if a new page will be started after printing this section. Usually this function should only be used in combination with set_unique as an endsection

bool hk_reportsection::section_was_printed ( void   ) 

Returns:
true if this section has been printed (unique sections will not be printed for every row) else false

void hk_reportsection::set_subreport ( const hk_string &  subreport = "",
bool  before_data = false,
bool  registerchange = true 
)

A complete other report can be printed within a section

Parameters:
subreport the subreport
before_data if true the subreport will be printed before the data of this section will be printed, else it will be printed after the data

void hk_reportsection::add_depending_fields ( const hk_string &  thisreport_field,
const hk_string &  subreport_field,
bool  registerchange = true 
)

If you set a subreport with set_subreport add the fields which are connected between the reports

void hk_reportsection::set_replacefunction ( const hk_string &  f,
bool  registerchange = true 
)

You can enhance the possibilities of the section by writing your own function.This function could for example handle your own variables.

void hk_reportsection::reset_count ( void   ) 

Will set all COUNT, SUM, AVERAGE and so on variables to 0, if they are not "running counts" (which mean global for the whole report).See hk_reportdata for details. Usually you dont't have to call this function

void hk_reportsection::add_sectioncountfunctiontype ( const hk_string &  name,
reportsectioncounttype *  f 
) [static]

needed by hk_report::set_periodic. It is possible to compute as how much a section counts.

Parameters:
f is a userdefined function that will be called whenever counts_as is called.

void hk_reportsection::set_datasource ( hk_datasource d  )  [virtual]

the datasource

Reimplemented from hk_dsdatavisible.

hk_string hk_reportsection::default_reportdata ( void   )  [inline]

the default column value will be used as a default when a new data will be created with new_data default is @

unsigned int hk_reportsection::horizontal2relativ ( unsigned int  h  ) 

100% is report width - left border - right border

unsigned int hk_reportsection::vertical2relativ ( unsigned int  v  ) 

100% is report height - top border - bottom border

unsigned int hk_reportsection::relativ2horizontal ( unsigned int  r  ) 

100% is report width - left border - right border

unsigned int hk_reportsection::relativ2vertical ( unsigned int  r  ) 

100% is report height - top border - bottom border

bool hk_reportsection::set_offset ( unsigned int  o,
bool  registerchange = true 
)

The offset is additional space at the end of the section (totalsectionsize= size needed by reportdata + offset)


The documentation for this class was generated from the following files:
Generated on Tue Nov 28 02:48:45 2006 for Databaseconnectionclasses by  doxygen 1.5.0