hk_report Class Reference

basic class to create reports More...

#include <hk_report.h>

Inheritance diagram for hk_report:

Inheritance graph
[legend]
Collaboration diagram for hk_report:

Collaboration graph
[legend]
List of all members.

Public Types

enum  orientationtype { landscape, portrait }
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
}

Public Member Functions

void set_filename (const hk_string &, bool registerchange=true)
hk_string filename (void)
void set_use_standard_storagepath (bool s=true)
bool use_standard_storagepath (void)
hk_string outputfile (void)
void set_begin (const hk_string &, bool registerchange=true)
hk_string begin (void)
void set_end (const hk_string &, bool registerchange=true)
hk_string end (void)
hk_reportsectionpage_header (void)
hk_reportsectionpage_footer (void)
hk_reportsectionreport_header (void)
hk_reportsectionreport_footer (void)
hk_reportsectiondatasection (void)
hk_reportsectionpairnew_sectionpair (bool registerchange=true)
hk_reportsectionpairnew_sectionpair_at (unsigned int position, bool registerchange=true)
bool move_sectionpair (unsigned int actualposition, int steps)
bool execute (void)
bool while_executing (void) const
bool while_load_report (void) const
virtual bool while_loading (void)
virtual bool set_mode (enum_mode s)
void set_recodefunction (const hk_string &r, bool registerchange=true)
recodefunctiontype * recodefunction (void)
hk_string recodefunctionstring (void)
void new_page (void)
void set_pagedelimiter (const hk_string &d, bool registerchange=true)
hk_string pagedelimiter (void)
vector< hk_reportsectionpair * > * sectionpairs (void)
virtual void set_multiplefiles (bool m=true, bool registerchange=true)
bool multiplefiles (void)
void set_fileextension (const hk_string &ext, bool registerchange=true)
hk_string fileextension (void)
void set_firstpagenumber (long int f, bool registerchange=true)
long int firstpagenumber (void)
void set_pagenamecolumn (const hk_string &c, bool registerchange=true)
hk_string pagenamecolumn (void)
void set_filebegin (const hk_string &b, bool registerchange=true)
hk_string filebegin (void)
void set_fileend (const hk_string &e, bool registerchange=true)
hk_string fileend (void)
void set_periodic (unsigned long when, const hk_string &what="", bool newpage=false, bool registerchange=true)
unsigned long periodic_when (void)
hk_string periodic_what (void)
bool periodic_newpage (void)
ostream * outputstream (void)
void set_masterreport (hk_report *m)
hk_reportmasterreport (void)
bool is_subreport (void) const
bool is_subpresentation (void)
void rowcount (unsigned long)
unsigned long current_rowcount (void)
virtual hk_font font (void)
long pagenumber (void)
long absolutepagenumber (void)
unsigned long rownumber (void)
virtual bool set_presentationdatasource (long n, bool registerchange=true)
virtual bool save_report (const hk_string &name="", bool ask=true)
virtual bool load_report (const hk_string &name="")
virtual void savedata (ostream &s)
virtual void loaddata (xmlNodePtr definition)
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)
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 set_default_reportdataconfigurefunction (const hk_string &f, bool registerchange=true)
hk_string default_reportdataconfigurefunction (void)
void set_default_reportsectionbegin (const hk_string &e, bool registerchange=true)
hk_string default_reportsectionbegin (void)
void set_default_reportsectionend (const hk_string &e, bool registerchange=true)
hk_string default_reportsectionend (void)
void set_default_reportsectionbetweendata (const hk_string &b, bool registerchange=true)
hk_string default_reportsectionbetweendata (void)
void set_default_reportsectioncountfunction (const hk_string &f, bool registerchange=true)
hk_string default_reportsectioncountfunction (void)
void set_topline (bool l=true, bool registerchange=true)
bool topline (void)
void set_bottomline (bool l=true, bool registerchange=true)
bool bottomline (void)
void set_leftline (bool l=true, bool registerchange=true)
bool leftline (void)
void set_rightline (bool l=true, bool registerchange=true)
bool rightline (void)
void set_diagonalluro (bool l=true, bool registerchange=true)
bool diagonalluro (void)
void set_diagonalloru (bool l=true, bool registerchange=true)
bool diagonalloru (void)
void set_frame (bool l=true, bool registerchange=true)
void set_borders (unsigned int left=200, unsigned int right=200, unsigned int top=200, unsigned int bottom=300, bool registerchange=true)
unsigned int border_left (void)
unsigned int border_right (void)
unsigned int border_top (void)
unsigned int border_bottom (void)
void set_orientation (orientationtype o=portrait, bool registerchange=true)
orientationtype orientation (void)
void set_pageformat (pageformattype t=A4, bool registerchange=true)
void set_pageformat (unsigned int width, unsigned int height, bool registerchange)
pageformattype pageformat (void)
unsigned int formatwidth (pageformattype t=A4)
unsigned int formatheight (pageformattype t=A4)
void set_reportconfigurefunction (const hk_string &f, bool registerchange)
void set_reporttype (const hk_string &, bool registerchange=true)
hk_string reporttype (void)
void configure_page (void)
void neutralize_definition (bool registerchange)
void init_report (void)
void remove_sectionpair (hk_reportsectionpair *, bool registerchange=true)
list< hk_string > * neededfonts (void)
list< hk_string > * usedfonts (void)
list< hk_string > * usedpsfonts (void)
bool print_report (bool execute_before_printing=true)
unsigned int designwidth (void)
unsigned int designheight (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)
virtual void bulk_operation (enum_bulkoperation bulkoperation)
hk_reportdataget_reportdatavisible (long nr)
hk_reportdataget_reportdatavisible (const hk_string &identifier)
void set_on_new_page_action (const hk_string &, bool registerchange=true)
hk_string on_new_page_action (void)
void stop_execution (void)
bool execution_stopped (void)
hk_string filelocale (void)
hk_string filecharset (void)
void set_filelocale (const hk_string &)
void set_filecharset (const hk_string &)
void set_useencodingtab (bool)
bool useencodingtab (void)
hk_encodingtab * encodingtab (void) const
void set_print_full_pages_only (bool, bool registerchange)
bool print_full_pages_only (void)
void set_fullpagereplacefunction (const hk_string &r, bool registerchange=true)
recodefunctiontype * fullpagereplacefunction (void)
hk_string fullpagereplacefunctionstring (void)
virtual hk_string tag_value (int tagnumber, bool &ok)

Static Public Member Functions

static void add_recodetype (const hk_string &name, recodefunctiontype *f)
static list< hk_string > * recodelist (void)
static void add_reporttype (const hk_string &name, reporttypefunction *f)
static list< hk_string > * reporttypelist (void)
static void add_configurefunctiontype (const hk_string &name, report_configurefunction *f)
static list< hk_string > * configurefunctionlist (void)
static void set_printcommand (const hk_string &printcommand)
static hk_string printcommand (void)
static void setup_reportbasics (void)
static void add_fullpagereplacefunctiontype (const hk_string &name, recodefunctiontype *f)
static list< hk_string > * fullpagereplacefunctionlist (void)
static void set_embedfonts (bool)
static bool embedfonts (void)

Protected Member Functions

void set_progressdialog (progress_dialogtype *progressdialog)
progress_dialogtype * progressdialog (void) const
void remove_section (hk_reportsection *)
virtual bool datasource_disable (void)
virtual bool before_columns_deleted (void)
virtual bool widget_specific_before_new_page (void)
virtual bool widget_specific_after_new_page (void)
virtual hk_reportsectionwidget_specific_new_section (void)
virtual void widget_specific_after_loadreport (void)
virtual void widget_specific_before_execute (void)
virtual void widget_specific_after_first_outstream_created (void)
virtual void widget_specific_before_last_outstream_closed (void)
virtual void widget_specific_after_execute (void)
virtual bool widget_specific_row_change (void)
virtual void widget_specific_batch_next (void)
virtual void widget_specific_batch_previous (void)
void remove_all_sections (void)
virtual void sizetype_changed (void)
void database_delete (void)
virtual bool action_on_new_page (void)

Protected Attributes

bool p_multiplefiles
vector< hk_reportsectionpair * > p_sectionpairs
hk_string p_default_data
hk_string p_default_beforedata
hk_string p_default_afterdata
hk_string p_default_dataconfigurefunction

Friends

class hk_reportsectionpair
class hk_reportsection

Detailed Description

basic class to create reports

With hk_report you can create reports to print all your database data in all userdefined, textbased formats, such as CVS, HTML, XML, Postscript etc. It has all functions you need to create reports in any kind and any format. See also the convenience class hk_reportcvs.

Version:
Revision
1.66
Author:
Horst Knorr (hk_classes@knoda.org)
you can use the variables

PTIME%              the time in seconds used to create the report output.
PAGENUMBER%         the number of the page
ABSOLUTEPAGENUMBER% physical number of the page in file
PSNEEDEDFONTS%      adds the Postscript-style %DocumentNeededFonts section


Member Function Documentation

void hk_report::set_filename ( const hk_string &  ,
bool  registerchange = true 
)

Sets the filename of the report. If you don't give the report a name the report and use_standard_storagepath is false will be printed at the standard output.

See also:
set_fileextension

set_pagenamecolumn

void hk_report::set_use_standard_storagepath ( bool  s = true  ) 

if true the report output will be written in a file in the .hk_classes directory (~/.hk_classes/driver/host/database/output)

hk_string hk_report::outputfile ( void   ) 

path and name of the file which contains the output of the report (if not set with set_filename) will be set while executing the report.

void hk_report::set_begin ( const hk_string &  ,
bool  registerchange = true 
)

Here you can set a string which will be printed at the very beginning of the report (report header) Can be used for initialisation of the report. To print data on top of the report see report_header()

void hk_report::set_end ( const hk_string &  ,
bool  registerchange = true 
)

Here you can set a string which will be shown at the very end of the report (report footer) To print data at the end of the report see report_footer()

hk_reportsection * hk_report::page_header ( void   ) 

The page head will be printed on top of every page

hk_reportsection * hk_report::page_footer ( void   ) 

The page head will be printed on top of every page

hk_reportsection * hk_report::report_header ( void   ) 

the section that will be printed at the beginning of the report

hk_reportsection * hk_report::report_footer ( void   ) 

the section that will be printed at the end of the report

hk_reportsection * hk_report::datasection ( void   ) 

This section is printed for every row in a datasource. It should be regarded as the main data section of the report This section will be embraced by the user defined sections created with new_sectionpair

hk_reportsectionpair * hk_report::new_sectionpair ( bool  registerchange = true  ) 

convenience function. See new_sectionpair_at for details

hk_reportsectionpair * hk_report::new_sectionpair_at ( unsigned int  position,
bool  registerchange = true 
)

creates a new sectionpair at position "position" position most outside position is 0

bool hk_report::move_sectionpair ( unsigned int  actualposition,
int  steps 
)

moves an existing sectionpair relative to the other existing sectionpairs.

Parameters:
actualposition position of the sectionpair to be moved
steps positive values move it closer to the datasection, negative values move it away

bool hk_report::execute ( void   ) 

After you have defined the report with new_section etc. you can start the report by calling this function.

void hk_report::set_recodefunction ( const hk_string &  r,
bool  registerchange = true 
)

If the data has to be recoded (i.e. ASCII to html -> ü) you can write a function and set it with set_recodefunction

Parameters:
r name of an existing recodefunction. A new one can be set with add_recodetype

void hk_report::set_pagedelimiter ( const hk_string &  d,
bool  registerchange = true 
)

The pagedelimiter is a hk_string sequence to be sent between to pages (i.e. an escape sequence for the printer)

vector< hk_reportsectionpair * > * hk_report::sectionpairs ( void   ) 

A list of all the sections

void hk_report::set_multiplefiles ( bool  m = true,
bool  registerchange = true 
) [virtual]

If a report has more than one page and this function is set to true every page will be stored in a separate file.

void hk_report::set_fileextension ( const hk_string &  ext,
bool  registerchange = true 
)

The output filename will be completed with this extension, i.e. '.ps' for postscript files

void hk_report::set_firstpagenumber ( long int  f,
bool  registerchange = true 
)

Set the pagenumber if the first page should not start with 1.

void hk_report::set_pagenamecolumn ( const hk_string &  c,
bool  registerchange = true 
)

You have different possibilities to name the report files. First, with set_filename set_fileextension Second, you can have the the filename in a column of your datasource. Give the name of the column with this function and then it will look up the name in this column. It is your responsibility to make sure that every filename is unique

void hk_report::set_filebegin ( const hk_string &  b,
bool  registerchange = true 
)

will be set at the beginning of a file. If a report has multiple files b will be written in each file

void hk_report::set_fileend ( const hk_string &  e,
bool  registerchange = true 
)

will be set at the end of a file. If a report has multiple files e will be written in each file

void hk_report::set_periodic ( unsigned long  when,
const hk_string &  what = "",
bool  newpage = false,
bool  registerchange = true 
)

A string that will be printed whenever a internal counter will get as big or greater than "when" To define "what counts what" use set_counts_as Whenever the event of "counting" occurs by calling row_count. Example: You want to print 50 lines per page, your header is 3 lines wide and your data isone line per data row set your page head to "3" and your datasection to "1"

ostream * hk_report::outputstream ( void   ) 

If the report will be printed to the standard output the outputstream is cout, else a textstream.

void hk_report::set_masterreport ( hk_report m  ) 

A report can contain a subreport. If this report is a subreport this is its link to its master report Usually you dont have to call this function

void hk_report::rowcount ( unsigned  long  ) 

This function does the counting job for set_periodic and will be called automaticallly

long hk_report::pagenumber ( void   ) 

the number of the page. To get more than one page you have to use either hk_reportsection::set_new_page_after_section or hk_report::set_periodic

hk_string hk_report::default_reportdata ( void   ) 

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

hk_string hk_report::default_beforereportdata ( void   ) 

default beforedata. Will be set when a datafield is created

hk_string hk_report::default_afterreportdata ( void   ) 

default afterdata. Will be set when a datafield is created

void hk_report::set_default_reportdataconfigurefunction ( const hk_string &  f,
bool  registerchange = true 
)

default dataconfigurefunction. Will be set when a datafield is created

void hk_report::set_default_reportsectionbegin ( const hk_string &  e,
bool  registerchange = true 
)

default sectionbegin. Will be set when a section is created See hk_reportsection::set_sectionbegin for details

void hk_report::set_default_reportsectionend ( const hk_string &  e,
bool  registerchange = true 
)

default sectionend. Will be set when a section is created See hk_reportsection::set_sectionend for details

void hk_report::set_default_reportsectionbetweendata ( const hk_string &  b,
bool  registerchange = true 
)

default sectionbetweendata. Will be set when a section is created See hk_reportsection::set_sectionbetweendata for details

void hk_report::set_default_reportsectioncountfunction ( const hk_string &  f,
bool  registerchange = true 
)

default sectioncountfunction. Will be set when a section is created See hk_reportsection::set_sectioncountfunction for details

void hk_report::set_topline ( bool  l = true,
bool  registerchange = true 
)

paints a horizontal line on top of the page

void hk_report::set_bottomline ( bool  l = true,
bool  registerchange = true 
)

paints a horizontal line on the bottom of the page

void hk_report::set_leftline ( bool  l = true,
bool  registerchange = true 
)

paints a vertical line on the left side of the page

void hk_report::set_rightline ( bool  l = true,
bool  registerchange = true 
)

paints a vertical line on the right side of the page

void hk_report::set_diagonalluro ( bool  l = true,
bool  registerchange = true 
)

paints a diagonal line on the left bottom corner to the right upper corner of the page

void hk_report::set_diagonalloru ( bool  l = true,
bool  registerchange = true 
)

paints a diagonal line on the left top corner to the right bottom corner of the page

void hk_report::set_frame ( bool  l = true,
bool  registerchange = true 
)

paints a frame on the page

void hk_report::set_borders ( unsigned int  left = 200,
unsigned int  right = 200,
unsigned int  top = 200,
unsigned int  bottom = 300,
bool  registerchange = true 
)

defines the borders of the page

void hk_report::set_orientation ( orientationtype  o = portrait,
bool  registerchange = true 
)

sets the page orientation. Possible values are portrait and landscape

void hk_report::set_pageformat ( pageformattype  t = A4,
bool  registerchange = true 
)

sets the correct page height and width of the equivalent page formats. Default is A4

void hk_report::set_pageformat ( unsigned int  width,
unsigned int  height,
bool  registerchange 
)

sets the page height and width. The pageformat will be changed to "userdefined"

unsigned int hk_report::formatwidth ( pageformattype  t = A4  ) 

returns the width of the pageformat

unsigned int hk_report::formatheight ( pageformattype  t = A4  ) 

returns the height of the pageformat

void hk_report::init_report ( void   ) 

sets the report in the same state as it would be after creating;

void hk_report::set_printcommand ( const hk_string &  printcommand  )  [static]

sets the printercommand. default is "lpr"

bool hk_report::print_report ( bool  execute_before_printing = true  ) 

sends the report to the printer

void hk_report::set_print_full_pages_only ( bool  ,
bool  registerchange 
)

default is false: if true the section output will be buffered until a new_page is created, if false it is directly written to the stream

bool hk_report::widget_specific_before_new_page ( void   )  [protected, virtual]

If this function returns false the execution of the report will be cancelled

bool hk_report::widget_specific_after_new_page ( void   )  [protected, virtual]

If this function returns false the execution of the report will be cancelled


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