class hk_report

basic class to create reports. More...

Definition#include <hk_classes/hk_classes/hk_report.h>
Inheritshk_presentation [public ]
Inherited byhk_kdesimplereport
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods

Protected Methods

Protected Members


Detailed Description

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.

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

 hk_report (void)

hk_report

 ~hk_report (void)

~hk_report

[virtual]

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

set_filename

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

hk_string  filename (void)

filename

void  set_use_standard_storagepath (bool s=true)

set_use_standard_storagepath

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

bool  use_standard_storagepath (void)

use_standard_storagepath

hk_string  outputfile (void)

outputfile

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  set_begin (const hk_string&,bool registerchange=true)

set_begin

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()

hk_string  begin (void)

begin

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

set_end

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_string  end (void)

end

hk_reportsection*  page_header (void)

page_header

The page head will be printed on top of every page

hk_reportsection*  page_footer (void)

page_footer

The page head will be printed on top of every page

hk_reportsection*  report_header (void)

report_header

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

hk_reportsection*  report_footer (void)

report_footer

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

hk_reportsection*  datasection (void)

datasection

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*  new_sectionpair (bool registerchange=true)

new_sectionpair

convenience function. See new_sectionpair_at for details

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

new_sectionpair_at

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

bool  move_sectionpair (unsigned int actualposition,int steps)

move_sectionpair

moves an existing sectionpair relative to the other existing sectionpairs.

Parameters:
actualpositionposition of the sectionpair to be moved
stepspositive values move it closer to the datasection, negative values move it away

bool  execute (void)

execute

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

bool  set_mode (enum_mode s)

set_mode

[virtual]

Reimplemented from hk_presentation.

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

set_recodefunction

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

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

recodefunctiontype*  recodefunction (void)

recodefunction

hk_string  recodefunctionstring (void)

recodefunctionstring

void  add_recodetype (const hk_string& name,recodefunctiontype* f)

add_recodetype

[static]

list<hk_string>*  recodelist (void)

recodelist

[static]

list<hk_string>*  fontencodinglist (void)

fontencodinglist

[static]

list of supported character encodings ( mainly important for postscript) existing types are:ISO 8859-1 to ..-10, KOI8-R and KOI8-U

bool  set_fontencoding (int )

set_fontencoding

[static]

bool  set_fontencoding (const hk_string&)

set_fontencoding

[static]

hk_string  fontencodingstring (void)

fontencodingstring

[static]

int  fontencoding (void)

fontencoding

[static]

void  new_page (void)

new_page

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

set_pagedelimiter

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

hk_string  pagedelimiter (void)

pagedelimiter

vector<hk_reportsectionpair*>*  sectionpairs (void)

sectionpairs

A list of all the sections

void  set_multiplefiles (bool m=true,bool registerchange=true)

set_multiplefiles

[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.

bool  multiplefiles (void)

multiplefiles

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

set_fileextension

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

hk_string  fileextension (void)

fileextension

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

set_firstpagenumber

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

long int  firstpagenumber (void)

firstpagenumber

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

set_pagenamecolumn

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

hk_string  pagenamecolumn (void)

pagenamecolumn

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

set_filebegin

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

hk_string  filebegin (void)

filebegin

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

set_fileend

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

hk_string  fileend (void)

fileend

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

set_periodic

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"

unsigned long  periodic_when (void)

periodic_when

hk_string  periodic_what (void)

periodic_what

bool  periodic_newpage (void)

periodic_newpage

ostream*  outputstream (void)

outputstream

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

void  set_masterreport (hk_report* m)

set_masterreport

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

hk_report*  masterreport (void)

masterreport

void  rowcount (unsigned long)

rowcount

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

hk_font  font (void)

font

[virtual]

long  pagenumber (void)

pagenumber

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

long  absolutepagenumber (void)

absolutepagenumber

unsigned long  rownumber (void)

rownumber

bool  set_presentationdatasource (long n, bool registerchange=true)

set_presentationdatasource

[virtual]

bool  save_report (const hk_string& name="",bool ask=true)

save_report

[virtual]

bool  load_report (const hk_string& name="")

load_report

[virtual]

void  savedata (ostream& s)

savedata

[virtual]

Reimplemented from hk_presentation.

void  loaddata (const hk_string& definition)

loaddata

[virtual]

Reimplemented from hk_presentation.

hk_string  default_reportdata (void)

default_reportdata

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

void  set_default_reportdata (const hk_string& v,bool registerchange=true)

set_default_reportdata

hk_string  default_beforereportdata (void)

default_beforereportdata

default beforedata. Will be set when a datafield is created

void  set_default_beforereportdata (const hk_string& v,bool registerchange=true)

set_default_beforereportdata

hk_string  default_afterreportdata (void)

default_afterreportdata

default afterdata. Will be set when a datafield is created

void  set_default_afterreportdata (const hk_string& v,bool registerchange=true)

set_default_afterreportdata

int  default_reportprecision (void)

default_reportprecision

void  set_default_reportprecision (int, bool registerchange=true)

set_default_reportprecision

bool  default_use_reportseparator (void)

default_use_reportseparator

void  set_default_use_reportseparator (bool, bool registerchange=true)

set_default_use_reportseparator

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

set_default_reportdataconfigurefunction

default dataconfigurefunction. Will be set when a datafield is created

hk_string  default_reportdataconfigurefunction (void)

default_reportdataconfigurefunction

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

set_default_reportsectionbegin

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

hk_string  default_reportsectionbegin (void)

default_reportsectionbegin

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

set_default_reportsectionend

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

hk_string  default_reportsectionend (void)

default_reportsectionend

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

set_default_reportsectionbetweendata

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

hk_string  default_reportsectionbetweendata (void)

default_reportsectionbetweendata

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

set_default_reportsectioncountfunction

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

hk_string  default_reportsectioncountfunction (void)

default_reportsectioncountfunction

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

set_topline

paints a horizontal line on top of the page

bool  topline (void)

topline

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

set_bottomline

paints a horizontal line on the bottom of the page

bool  bottomline (void)

bottomline

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

set_leftline

paints a vertical line on the left side of the page

bool  leftline (void)

leftline

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

set_rightline

paints a vertical line on the right side of the page

bool  rightline (void)

rightline

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

set_diagonalluro

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

bool  diagonalluro (void)

diagonalluro

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

set_diagonalloru

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

bool  diagonalloru (void)

diagonalloru

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

set_frame

paints a frame on the page

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

set_borders

defines the borders of the page

unsigned int  border_left (void)

border_left

unsigned int  border_right (void)

border_right

unsigned int  border_top (void)

border_top

unsigned int  border_bottom (void)

border_bottom

enum orientationtype {landscape,portrait}

orientationtype

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

set_orientation

sets the page orientation. Possible values are portrait and landscape

orientationtype  orientation (void)

orientation

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}

pageformattype

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

set_pageformat

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

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

set_pageformat

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

pageformattype  pageformat (void)

pageformat

unsigned int  formatwidth (pageformattype t=A4)

formatwidth

returns the width of the pageformat

unsigned int  formatheight (pageformattype t=A4)

formatheight

returns the height of the pageformat

void  set_reportconfigurefunction (const hk_string& f,bool registerchange)

set_reportconfigurefunction

void  set_reporttype (const hk_string&,bool registerchange=true)

set_reporttype

hk_string  reporttype (void)

reporttype

void  add_reporttype (const hk_string& name,reporttypefunction* f)

add_reporttype

[static]

list<hk_string>*  reporttypelist (void)

reporttypelist

[static]

void  configure_page (void)

configure_page

void  neutralize_definition (bool registerchange)

neutralize_definition

void  init_report (void)

init_report

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

void  add_configurefunctiontype (const hk_string& name,report_configurefunction* f)

add_configurefunctiontype

[static]

list<hk_string>*  configurefunctionlist (void)

configurefunctionlist

[static]

void  remove_sectionpair (hk_reportsectionpair*,bool registerchange=true)

remove_sectionpair

list<hk_string>*  neededfonts (void)

neededfonts

list<hk_string>*  usedfonts (void)

usedfonts

void  set_printcommand (const hk_string& printcommand)

set_printcommand

[static]

sets the printercommand. default is "lpr"

hk_string  printcommand (void)

printcommand

[static]

bool  print_report (bool execute_before_printing=true)

print_report

sends the report to the printer

unsigned int  designwidth (void)

designwidth

Reimplemented from hk_presentation.

unsigned int  designheight (void)

designheight

Reimplemented from hk_presentation.

unsigned int  horizontal2relativ (unsigned int h)

horizontal2relativ

Reimplemented from hk_presentation.

unsigned int  vertical2relativ (unsigned int v)

vertical2relativ

Reimplemented from hk_presentation.

unsigned int  relativ2horizontal (unsigned int r)

relativ2horizontal

Reimplemented from hk_presentation.

unsigned int  relativ2vertical (unsigned int r)

relativ2vertical

Reimplemented from hk_presentation.

void  bulk_operation (enum_bulkoperation bulkoperation)

bulk_operation

[virtual]

Reimplemented from hk_presentation.

void  setup_reportbasics (void)

setup_reportbasics

[static]

hk_reportdata*  get_reportdatavisible (long nr)

get_reportdatavisible

hk_reportdata*  get_reportdatavisible (const hk_string& identifier)

get_reportdatavisible

void  set_on_new_page_action (const hk_string&,bool registerchange=true)

set_on_new_page_action

hk_string  on_new_page_action (void)

on_new_page_action

void  stop_execution (void)

stop_execution

bool  execution_stopped (void)

execution_stopped

void  remove_section (hk_reportsection*)

remove_section

[protected]

hk_string  replace (const hk_string& where)

replace

[protected virtual]

bool  datasource_disable (void)

datasource_disable

[protected virtual]

bool  before_columns_deleted (void)

before_columns_deleted

[protected virtual]

bool  widget_specific_before_new_page (void)

widget_specific_before_new_page

[protected virtual]

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

bool  widget_specific_after_new_page (void)

widget_specific_after_new_page

[protected virtual]

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

hk_reportsection*  widget_specific_new_section (void)

widget_specific_new_section

[protected virtual]

void  widget_specific_after_loadreport (void)

widget_specific_after_loadreport

[protected virtual]

void  widget_specific_before_execute (void)

widget_specific_before_execute

[protected virtual]

void  widget_specific_after_first_outstream_created (void)

widget_specific_after_first_outstream_created

[protected virtual]

void  widget_specific_before_last_outstream_closed (void)

widget_specific_before_last_outstream_closed

[protected virtual]

void  widget_specific_after_execute (void)

widget_specific_after_execute

[protected virtual]

void  remove_all_sections (void)

remove_all_sections

[protected]

bool p_multiplefiles

p_multiplefiles

[protected]

vector<hk_reportsectionpair*> p_sectionpairs

p_sectionpairs

[protected]

hk_string p_default_data

p_default_data

[protected]

hk_string p_default_beforedata

p_default_beforedata

[protected]

hk_string p_default_afterdata

p_default_afterdata

[protected]

hk_string p_default_dataconfigurefunction

p_default_dataconfigurefunction

[protected]

void  sizetype_changed (void)

sizetype_changed

[protected virtual]

Reimplemented from hk_presentation.

bool  action_on_new_page (void)

action_on_new_page

[protected virtual]