23 #ifndef KDREPORTSREPORT_H
24 #define KDREPORTSREPORT_H
26 #include "KDReportsErrorDetails.h"
27 #include "KDReportsGlobal.h"
28 #include <QtCore/QSizeF>
31 #include <QTextOption>
33 #if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
34 #include <QtPrintSupport/QPrinter>
40 class QTextDocumentFragment;
44 class QAbstractItemModel;
56 class HeaderReportBuilder;
58 typedef Header Footer;
63 class TableBreakingSettingsDialog;
64 class AutoTableElement;
65 class XmlElementHandler;
108 class KDREPORTS_EXPORT
Report : public QObject
117 Report( QObject* parent = 0 );
147 void setReportMode( ReportMode reportMode );
153 ReportMode reportMode()
const;
159 void setDefaultFont(
const QFont& font );
165 QFont defaultFont()
const;
179 void addInlineElement(
const Element& element );
195 void addElement(
const Element& element, Qt::AlignmentFlag horizontalAlignment = Qt::AlignLeft,
196 const QColor& backgroundColor = QColor() );
203 void addVerticalSpacing( qreal space );
211 void addFragment(
const QTextDocumentFragment& fragment );
254 QTextOption::Tab rightAlignedTab()
const;
262 QTextOption::Tab middleAlignedTab()
const;
269 void setParagraphMargins( qreal left, qreal top, qreal right, qreal bottom );
276 void setPageSize(
const QPrinter::PageSize& size );
283 void setPaperSize(
const QSizeF & paperSize, QPrinter::Unit unit );
288 QPrinter::PageSize pageSize()
const;
292 void setOrientation( QPrinter::Orientation orientation );
296 QPrinter::Orientation orientation()
const;
311 void setWidthForEndlessPrinter( qreal widthMM );
316 void setMargins( qreal top, qreal left, qreal bottom, qreal right );
322 void getMargins( qreal* top, qreal* left, qreal* bottom, qreal* right )
const;
328 void setTopPageMargin( qreal top );
334 qreal topPageMargins()
const;
340 void setLeftPageMargin( qreal left );
346 qreal leftPageMargins()
const;
352 void setRightPageMargin( qreal right );
358 qreal rightPageMargins()
const;
364 void setBottomPageMargin( qreal bottom );
370 qreal bottomPageMargins()
const;
377 void setHeaderBodySpacing( qreal spacing );
383 qreal headerBodySpacing()
const;
390 void setFooterBodySpacing( qreal spacing );
396 qreal footerBodySpacing()
const;
431 void associateModel(
const QString& modelKey, QAbstractItemModel* model );
443 void associateTextValue(
const QString&
id,
const QString& value );
454 void associateImageValue(
const QString&
id,
const QPixmap& value );
469 void associateImageValue(
const QString&
id,
const QImage& value );
481 bool loadFromXML( QIODevice* iodevice,
ErrorDetails* details = 0 );
495 bool loadFromXML(
const QDomDocument& doc,
ErrorDetails* details = 0 );
513 void setCurrentRow(
const QAbstractItemModel *model,
int row );
520 bool printWithDialog( QWidget* parent );
534 bool print( QPrinter* printer, QWidget* parent = 0 );
542 bool exportToFile(
const QString& fileName, QWidget* parent = 0 );
550 bool exportToImage(
const QSize& size,
const QString& fileName,
const char* format );
559 bool exportToHtml(
const QString& fileName );
566 void paintPage(
int pageNumber, QPainter& painter );
573 void setFirstPageNumber(
int num );
578 int firstPageNumber()
const;
583 int numberOfPages()
const;
608 void setTableBreakingEnabled(
bool tableBreakingEnabled );
614 bool isTableBreakingEnabled()
const;
616 enum TableBreakingPageOrder { DownThenRight, RightThenDown };
625 void setTableBreakingPageOrder( TableBreakingPageOrder pageOrder );
631 TableBreakingPageOrder tableBreakingPageOrder()
const;
642 void setFontScalingFactor( qreal factor );
648 qreal fontScalingFactor()
const;
672 void scaleTo(
int numPagesHorizontally,
int numPagesVertically );
678 int maximumNumberOfPagesForHorizontalScaling()
const;
683 int maximumNumberOfPagesForVerticalScaling()
const;
700 void regenerateAutoTables();
707 void regenerateAutoTableForModel( QAbstractItemModel* model );
718 void setWatermarkText(
const QString& text,
720 const QColor& color = QColor( 204, 204, 204 ),
721 const QFont& font = QFont( QLatin1String(
"Helvetica" ), 48 ) );
726 QString watermarkText()
const;
731 int watermarkRotation()
const;
736 QColor watermarkColor()
const;
741 QFont watermarkFont()
const;
753 void setWatermarkPixmap(
const QPixmap& pixmap,
bool autoGrayOut =
true );
760 QPixmap watermarkPixmap()
const;
766 void setWatermarkImage(
const QImage& image );
772 QImage watermarkImage()
const;
778 KDReports::HeaderLocations headerLocation(
Header* header)
const;
790 void setHeaderLocation(HeaderLocations hl,
Header *header);
796 void setFooterLocation(HeaderLocations hl,
Footer *footer);
801 QSizeF paperSize()
const;
811 int currentPosition()
const;
815 friend class ::ReportData;
816 friend class ::EditorData;
817 KDReports::TextDocument& doc()
const;
819 QString asHtml()
const;
823 friend class HeaderReportBuilder;
826 friend class XmlParser;
828 ReportPrivate*
const d;
Definition: KDReportsReport.h:108
HeaderLocation
Definition: KDReportsReport.h:90
Definition: KDReportsXmlElementHandler.h:83
The first page of the report.
Definition: KDReportsReport.h:91
Definition: KDReportsMainTable.h:49
Definition: KDReportsImageElement.h:37
All pages (except first and last if FirstPage or LastPage have their own headers) ...
Definition: KDReportsReport.h:95
The odd pages of the report: 1 (unless FirstPage has its own header), 3, 5, 7 etc.
Definition: KDReportsReport.h:93
The last page of the report.
Definition: KDReportsReport.h:94
Definition: KDReportsElement.h:41
The even pages of the report: 2, 4, 6 etc.
Definition: KDReportsReport.h:92
Definition: KDReportsErrorDetails.h:36
Definition: KDReportsChartElement.h:41
Definition: KDReportsAbstractTableElement.h:29