BPS C++ API  2.24.4
bpsreport.h
Go to the documentation of this file.
1 
4 #ifndef BPSREPORT_H
5 #define BPSREPORT_H
6 
7 #include "bpsreportelement.h"
8 
9 class BpsDatastore;
10 class BpsScriptEngine;
11 class BpsReportPage;
12 class BpsReportSection;
13 class QPrinter;
14 
29 {
30  Q_OBJECT
32 
33 public:
38  BpsReport(QObject* aParent = nullptr);
39 
46  BpsReport(const BpsReportElement& aReportElement, QObject* aParent = nullptr);
47 
48  virtual ~BpsReport();
49 
55 
63  void load(BpsDatastore* aDatastore, const QVariant& aKey);
64 
72  void load(BpsDatastore* aDatastore, const QString& aPath);
73 
80  void load(const QString& aPath);
81 
86  void execute();
87 
88 public slots:
89 
94  qreal printHeight() const;
95 
101  void setItemsCount(int aCount);
102 
108  void setLoadedItems(int aCount);
109 
114  int pageCount() const;
115 
121 
128  BpsReportPage* pageAt(int aIndex) const;
129 
137 
142  void setPrinterDefaults(QPrinter* aPrinter);
143 
151  int printedPages(QPrinter* aPrinter, int& aFirstPage = *new int, int& aLastPage = *new int) const;
152 
157  void print(QPrinter* aPrinter);
158 
159 signals:
160 
165  void beginLoad(int aCount);
166 
171  void itemsLoaded(int aCount);
172 
177  void percentLoaded(int aPercent);
178 
184  void pagesAdded(int aCount);
185 
190  void endLoad(int aCount);
191 
196  void beginPrint(int aCount);
197 
203  void pagesPrinted(int aCount);
204 
209  void endPrint(int aCount);
210 
211 protected:
212 
217  void scriptDebug(const QString& aLine) const;
218 
223  void scriptPrint(const QString& aLine) const;
224 
229  void scriptPerror(const QString& aLine) const;
230 
231 };
232 
233 Q_DECLARE_METATYPE(BpsReport*)
234 
235 #endif // BPSREPORT_H
#define BPSCORE_EXPORT
Declare class to be an import from the shared library.
Definition: bpscore_global.h:22
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
Public include file for BpsReportElement class.
BPS datastore class.
Definition: bpsdatastore.h:61
This class represents a BPS report element.
Definition: bpsreportelement.h:79
BPS Report Object.
Definition: bpsreport.h:29
void beginPrint(int aCount)
This signal is emitted when printing begins.
void setPrinterDefaults(QPrinter *aPrinter)
Setup the defaults for the printer.
void load(const QString &aPath)
Loads a report from file.
void pagesPrinted(int aCount)
This signal is emitted when a page is completed while printing the report.
BpsScriptEngine * engine()
Get the engine used to process the report script.
BpsReportPage * pageAt(int aIndex) const
Get the page at a certain index position.
void execute()
Execute the report script.
BpsReport(QObject *aParent=nullptr)
Default constructor.
qreal printHeight() const
Returns the height in millimeters available for printing.
BpsReportPage * addPage()
Adds a new page to the report.
void scriptPerror(const QString &aLine) const
Write the script perror() output.
BpsReportSection * createSection(const QString &aName)
Creates a new section with the properties of a named section element.
void load(BpsDatastore *aDatastore, const QString &aPath)
Loads a report from database when the path name is known.
void setLoadedItems(int aCount)
The script should set the number of loaded items after every item that got processed,...
void print(QPrinter *aPrinter)
Print the report.
void itemsLoaded(int aCount)
This signal is emitted after calling setLoadedItems(int).
void percentLoaded(int aPercent)
This signal is emitted after calling setLoadedItems(int).
void setItemsCount(int aCount)
The script should set the number of items that need to be processed at begin of script execution,...
void endLoad(int aCount)
This signal is emitted when loading has completed.
void beginLoad(int aCount)
This signal is emitted after calling setItemsCount(int).
void pagesAdded(int aCount)
This signal is emitted after a new page is added while loading the report.
BpsReport(const BpsReportElement &aReportElement, QObject *aParent=nullptr)
Constructor using the properties of an existing report element.
int printedPages(QPrinter *aPrinter, int &aFirstPage= *new int, int &aLastPage= *new int) const
Get the number and range of printed pages.
void endPrint(int aCount)
This signal is emitted when printing has completed.
void scriptPrint(const QString &aLine) const
Write the script print() output.
void load(BpsDatastore *aDatastore, const QVariant &aKey)
Loads a report from database when the key t_reports.c_key is known This method is used with objects c...
void scriptDebug(const QString &aLine) const
Write the script debug() output.
int pageCount() const
Get the number of pages in the report.
A report page will typically be created by calling BpsReport::addPage() from within the report script...
Definition: bpsreportpage.h:18
A report section will typically be created by calling BpsReport::createSection() from within the repo...
Definition: bpsreportsection.h:15
The BPS scripting engine.
Definition: bpsscriptengine.h:17