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

RTK::Report Class Reference

The RTK::Report class holds a Report definition. More...

#include <rtkreport.h>

Inheritance diagram for RTK::Report:

RTK::Object List of all members.

Public Types

typedef Input *(* InputCreatorFuncPtr )(const String &name, const String &driver)

Public Member Functions

 Report (const String &title=String::null, UnitsType units=chars, String stylespath=String::null, String imagespath=String::null, const String &name=String::null, Variant value=0, AggregateType aggregate=AggNone, String posx=0, String posy=0, String sizex=0, String sizey=0, const String &style=String::null, const String &url=String::null, const String &tag=String::null, Variant marginleft=0, Variant marginright=0, Variant margintop=0, Variant marginbottom=0, Variant visible=true, Variant supressed=false, Variant fontfamily=String::null, Variant fontsize=12, Variant fontweight=0, Variant fontitalic=false, Variant mask=String::null, Variant format=String::null, Variant halignment=AlignAuto, Variant valignment=AlignTop, Variant maxlines=0, Variant minfontsize=8, Variant adjustment=AdjustTrim, Variant textcolor=Qt::black, Variant backcolor=Qt::white, Variant bordercolor=Qt::black, Variant borderwidth=0, Variant borderstyle=BorderNone, Variant backgroundimage=String::null)
bool readXml (const String &filename, const String &defaultinput=String::null)
 Reads a Report definition from a file in xml format.
int print (Input &in, Output &out)
 Prints this report to the given output object using the given input object.
int print (Output &out)
Input * getInput () const
 Gets a pointer to the input associated to this Report.
void setInput (Input *input)
 Sets the input that will be used with this Report.
ImagefindImage (const String &name) const
 Finds an Image in the Report by name.
bool eraseImage (const String &name)
 Deletes an Image from the Report.
int insertImage (Image *image)
 Inserts an Image in the Report.
int insertImage (String name=String::null, String url=String::null, String mimetype=String::null, String imagestyle=String::null)
int insertSection (Section *section)
 Inserts an existing Section in the Report.
int insertSection (SectionType type=SectionDetails, String groupname="", Variant groupvalue=Variant(), uint grouplevel=0, bool pagebefore=false, bool pageafter=false, bool resetnpage=false, bool supifblank=false, bool repeatheader=false)
 Creates and inserts a Section in the Report.
int insertStyle (Style *style)
 Inserts a Style in the Report.
bool eraseStyle (const String &name)
 Deletes a Style from the Report.
int insertStyle (String name=String::null, String marginleft=0, String marginright=0, String margintop=0, String marginbottom=0, bool visible=true, bool supressed=false, String fontfamily=String::null, int fontsize=12, int fontweight=0, bool fontitalic=false, String mask=String::null, String format=String::null, AlignmentType halignment=AlignAuto, AlignmentType valignment=AlignTop, int maxlines=0, int minfontsize=8, AdjustmentType adjustment=AdjustTrim, Color textcolor=Qt::black, Color backcolor=Qt::white, Color bordercolor=Qt::black, int borderwidth=0, BorderStyle borderstyle=BorderNone, String backgroundimage=String::null)
 Creates and inserts a Style in the Report.
int insertFormula (Formula *formula)
 Inserts a Formula in the Report.
int insertFormula (String name=String::null, String code=String::null)
 Creates and inserts a Formula in the Report.
Section * getSection (const String &name) const
 Gets a section by its name.
Section * getSection (uint nsection) const
 Gets a section by its index.
Style * getStyle (const String &name) const
 Gets a style by its name.
Style * getStyle (uint nstyle) const
 Gets a style by its index.
const FormattergetFormatter () const
void setImagesPath (const QString &path)
void setStylesPath (const QString &path)
const QString & getCWD () const
const String & getTitle () const
void setTitle (const String &title)
UnitsType getUnits () const
void setUnits (UnitsType units)
String getStylesPath () const
String getImagesPath () const
const QDateTime getReportDate () const
unsigned int getRecordCount () const
unsigned int getRecordNumber () const
unsigned int getPageCount () const
unsigned int getPageNumber () const
int debug_print () const

Static Public Member Functions

int registerInput (const String &name, InputCreatorFuncPtr creator)
Input * createRegisteredInput (const String &name, const String &driver)

Protected Attributes

String mTitle
UnitsType mUnits
String mStylesPath
String mImagesPath

Friends

class Section
class Object

Detailed Description

The RTK::Report class holds a Report definition.

A report definition contains several Section objects which in turn contain several Object objects.

The fact that the Report itself is an Object, implies that it inherits all the properties of the Object class, and are considered as global properties. For instance, the BackColor property of a Report is considered the global BackColor of the report which can be overrided by the BackColor property of a Section or an Object.

To create a report definition, call the Report constructor with the appropiate arguments, taking into account that all of them have default values. Then, read the definition from an xml file with readXml. The definition of the report has its Input implicit, but you can override it with setInput. Then, you print the report to a given Output. Here is an example of how to do this:

        Report aReport;
        if ( aReport.readXml ( filename ) ) {
                OutputOpenOffice o( ArgOutputFileName );
                r.print ( o );
        }

You can create a Report definition on the fly by creating Sections and Objects. Once you have created a Section, insert it in the Report with insertSection.


Member Function Documentation

String RTK::Report::getImagesPath  )  const [inline]
 

Gets Path to the image files

Section * getSection const String &  name  )  const
 

Gets a section by its name.

Parameters:
name The name of the section to find
Returns:
A pointer to the section or 0 if not found

String RTK::Report::getStylesPath  )  const [inline]
 

Gets Path to the xml style files

const String& RTK::Report::getTitle  )  const [inline]
 

Gets Report title

UnitsType RTK::Report::getUnits  )  const [inline]
 

Gets Report units

int print Output &  out  ) 
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Prints the report to the given Output object using the internal Input read or set previously.

int print Input &  in,
Output &  out
 

Prints this report to the given output object using the given input object.

Before printing the report, adapt the report measures to the output ones.

Todo:
Print the report-header and report-footer

Define the return value

bool readXml const String &  xmlname,
const String &  defaultinput = String::null
 

Reads a Report definition from a file in xml format.

Parameters:
xmlname The name of the report definition file (.rtk)
defaultinput The name of the input to use
Reads the report definition file named xmlname into this report. If defaultinput is null (default), reads the input named 'default' in the definition file, otherwise, reads the input definition named defaultinput

Returns true if the xml file contains a correct RTK definition. Note that it returns true even if the input couldn't be found.

Todo:
delete the previous report definition

void RTK::Report::setTitle const String &  title  )  [inline]
 

Sets the Report title

void RTK::Report::setUnits UnitsType  units  )  [inline]
 

Sets the Report units


The documentation for this class was generated from the following files:
Generated on Tue Feb 22 14:44:38 2005 for RTK. Report ToolKit by  doxygen 1.3.9.1