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;
62 class TableBreakingSettingsDialog;
63 class AutoTableElement;
64 class XmlElementHandler;
107 class KDREPORTS_EXPORT
Report : public QObject
110 Q_PROPERTY(QString documentName READ documentName WRITE setDocumentName)
117 explicit 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;
423 Footer& footer( HeaderLocations hl =
AllPages );
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 void setDocumentName(
const QString &name );
526 QString documentName()
const;
533 bool printWithDialog( QWidget* parent );
547 bool print( QPrinter* printer, QWidget* parent = 0 );
555 bool exportToFile(
const QString& fileName, QWidget* parent = 0 );
563 bool exportToImage(
const QSize& size,
const QString& fileName,
const char* format );
572 bool exportToHtml(
const QString& fileName );
579 void paintPage(
int pageNumber, QPainter& painter );
586 void setFirstPageNumber(
int num );
591 int firstPageNumber()
const;
596 int numberOfPages()
const;
621 void setTableBreakingEnabled(
bool tableBreakingEnabled );
627 bool isTableBreakingEnabled()
const;
629 enum TableBreakingPageOrder { DownThenRight, RightThenDown };
638 void setTableBreakingPageOrder( TableBreakingPageOrder pageOrder );
644 TableBreakingPageOrder tableBreakingPageOrder()
const;
655 void setFontScalingFactor( qreal factor );
661 qreal fontScalingFactor()
const;
685 void scaleTo(
int numPagesHorizontally,
int numPagesVertically );
691 int maximumNumberOfPagesForHorizontalScaling()
const;
696 int maximumNumberOfPagesForVerticalScaling()
const;
703 void setFixedRowHeight( qreal mm );
720 void regenerateAutoTables();
727 void regenerateAutoTableForModel( QAbstractItemModel* model );
738 void setWatermarkText(
const QString& text,
740 const QColor& color = QColor( 204, 204, 204 ),
741 const QFont& font = QFont( QLatin1String(
"Helvetica" ), 48 ) );
746 QString watermarkText()
const;
751 int watermarkRotation()
const;
756 QColor watermarkColor()
const;
761 QFont watermarkFont()
const;
773 void setWatermarkPixmap(
const QPixmap& pixmap,
bool autoGrayOut =
true );
780 QPixmap watermarkPixmap()
const;
786 void setWatermarkImage(
const QImage& image );
792 QImage watermarkImage()
const;
798 KDReports::HeaderLocations headerLocation(
Header* header)
const;
810 void setHeaderLocation(HeaderLocations hl,
Header *header);
816 void setFooterLocation(HeaderLocations hl, Footer *footer);
821 QSizeF paperSize()
const;
831 int currentPosition()
const;
855 friend class ::ReportData;
856 friend class ::EditorData;
857 KDReports::TextDocument& doc()
const;
859 QString asHtml()
const;
861 void setupPrinter( QPrinter* printer );
865 friend class HeaderReportBuilder;
868 friend class XmlParser;
870 friend class PreviewDialogPrivate;
871 friend class PreviewWidgetPrivate;
872 friend class ReportPrivate;
873 ReportPrivate*
const d;
Definition: KDReportsReport.h:107
HeaderLocation
Definition: KDReportsReport.h:89
Definition: KDReportsXmlElementHandler.h:83
The first page of the report.
Definition: KDReportsReport.h:90
Definition: KDReportsMainTable.h:50
Definition: KDReportsImageElement.h:38
All pages (except first and last if FirstPage or LastPage have their own headers) ...
Definition: KDReportsReport.h:94
Definition: KDReportsAbstractTableElement.h:33
The odd pages of the report: 1 (unless FirstPage has its own header), 3, 5, 7 etc.
Definition: KDReportsReport.h:92
The last page of the report.
Definition: KDReportsReport.h:93
Definition: KDReportsElement.h:42
The even pages of the report: 2, 4, 6 etc.
Definition: KDReportsReport.h:91
Definition: KDReportsErrorDetails.h:36
Definition: KDReportsChartElement.h:42
Definition: KDReportsAbstractTableElement.h:29