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> 41 class QTextDocumentFragment;
45 class QAbstractItemModel;
58 class HeaderReportBuilder;
60 typedef Header Footer;
64 class TableBreakingSettingsDialog;
65 class AutoTableElement;
66 class XmlElementHandler;
109 class KDREPORTS_EXPORT
Report : public QObject
112 Q_PROPERTY(QString documentName READ documentName WRITE setDocumentName)
119 explicit Report( QObject* parent = 0 );
149 void setReportMode( ReportMode reportMode );
155 ReportMode reportMode()
const;
161 void setDefaultFont(
const QFont& font );
167 QFont defaultFont()
const;
181 void addInlineElement(
const Element& element );
197 void addElement(
const Element& element, Qt::AlignmentFlag horizontalAlignment = Qt::AlignLeft,
198 const QColor& backgroundColor = QColor() );
205 void addVerticalSpacing( qreal space );
213 void addFragment(
const QTextDocumentFragment& fragment );
256 QTextOption::Tab rightAlignedTab()
const;
264 QTextOption::Tab middleAlignedTab()
const;
271 void setParagraphMargins( qreal left, qreal top, qreal right, qreal bottom );
278 void setPageSize(
const QPrinter::PageSize& size );
285 void setPaperSize(
const QSizeF & paperSize, QPrinter::Unit unit );
290 QPrinter::PageSize pageSize()
const;
294 void setOrientation( QPrinter::Orientation orientation );
298 QPrinter::Orientation orientation()
const;
313 void setWidthForEndlessPrinter( qreal widthMM );
318 void setMargins( qreal top, qreal left, qreal bottom, qreal right );
324 void getMargins( qreal* top, qreal* left, qreal* bottom, qreal* right )
const;
330 void setTopPageMargin( qreal top );
336 qreal topPageMargins()
const;
342 void setLeftPageMargin( qreal left );
348 qreal leftPageMargins()
const;
354 void setRightPageMargin( qreal right );
360 qreal rightPageMargins()
const;
366 void setBottomPageMargin( qreal bottom );
372 qreal bottomPageMargins()
const;
379 void setHeaderBodySpacing( qreal spacing );
385 qreal headerBodySpacing()
const;
392 void setFooterBodySpacing( qreal spacing );
398 qreal footerBodySpacing()
const;
425 Footer& footer( HeaderLocations hl =
AllPages );
433 void associateModel(
const QString& modelKey, QAbstractItemModel* model );
445 void associateTextValue(
const QString&
id,
const QString& value );
456 void associateImageValue(
const QString&
id,
const QPixmap& value );
471 void associateImageValue(
const QString&
id,
const QImage& value );
483 bool loadFromXML( QIODevice* iodevice,
ErrorDetails* details = 0 );
497 bool loadFromXML(
const QDomDocument& doc,
ErrorDetails* details = 0 );
515 void setCurrentRow(
const QAbstractItemModel *model,
int row );
522 void setDocumentName(
const QString &name );
528 QString documentName()
const;
535 bool printWithDialog( QWidget* parent );
549 bool print( QPrinter* printer, QWidget* parent = 0 );
557 bool exportToFile(
const QString& fileName, QWidget* parent = 0 );
565 bool exportToImage(
const QSize& size,
const QString& fileName,
const char* format );
574 bool exportToHtml(
const QString& fileName );
581 void paintPage(
int pageNumber, QPainter& painter );
588 void setFirstPageNumber(
int num );
593 int firstPageNumber()
const;
598 int numberOfPages()
const;
623 void setTableBreakingEnabled(
bool tableBreakingEnabled );
629 bool isTableBreakingEnabled()
const;
631 enum TableBreakingPageOrder { DownThenRight, RightThenDown };
640 void setTableBreakingPageOrder( TableBreakingPageOrder pageOrder );
646 TableBreakingPageOrder tableBreakingPageOrder()
const;
657 void setFontScalingFactor( qreal factor );
663 qreal fontScalingFactor()
const;
687 void scaleTo(
int numPagesHorizontally,
int numPagesVertically );
693 int maximumNumberOfPagesForHorizontalScaling()
const;
698 int maximumNumberOfPagesForVerticalScaling()
const;
705 void setFixedRowHeight( qreal mm );
722 void regenerateAutoTables();
729 void regenerateAutoTableForModel( QAbstractItemModel* model );
740 void setWatermarkText(
const QString& text,
742 const QColor& color = QColor( 204, 204, 204 ),
743 const QFont& font = QFont( QLatin1String(
"Helvetica" ), 48 ) );
748 QString watermarkText()
const;
753 int watermarkRotation()
const;
758 QColor watermarkColor()
const;
763 QFont watermarkFont()
const;
775 void setWatermarkPixmap(
const QPixmap& pixmap,
bool autoGrayOut =
true );
782 QPixmap watermarkPixmap()
const;
788 void setWatermarkImage(
const QImage& image );
794 QImage watermarkImage()
const;
800 KDReports::HeaderLocations headerLocation(
Header* header)
const;
812 void setHeaderLocation(HeaderLocations hl,
Header *header);
818 void setFooterLocation(HeaderLocations hl, Footer *footer);
823 QSizeF paperSize()
const;
833 int currentPosition()
const;
857 friend class ::ReportData;
858 friend class ::EditorData;
859 KDReports::TextDocument& doc()
const;
861 QString asHtml()
const;
863 void setupPrinter( QPrinter* printer );
867 friend class HeaderReportBuilder;
870 friend class XmlParser;
872 friend class PreviewDialogPrivate;
873 friend class PreviewWidgetPrivate;
874 friend class ReportPrivate;
875 ReportPrivate*
const d;
Definition: KDReportsReport.h:109
HeaderLocation
Definition: KDReportsReport.h:91
Definition: KDReportsXmlElementHandler.h:86
The first page of the report.
Definition: KDReportsReport.h:92
Definition: KDReportsMainTable.h:50
Definition: KDReportsImageElement.h:41
All pages (except first and last if FirstPage or LastPage have their own headers) ...
Definition: KDReportsReport.h:96
Definition: KDReportsAbstractTableElement.h:36
The odd pages of the report: 1 (unless FirstPage has its own header), 3, 5, 7 etc.
Definition: KDReportsReport.h:94
The last page of the report.
Definition: KDReportsReport.h:95
Definition: KDReportsElement.h:45
The even pages of the report: 2, 4, 6 etc.
Definition: KDReportsReport.h:93
Definition: KDReportsErrorDetails.h:36
Definition: KDReportsChartElement.h:45
Definition: KDReportsAbstractTableElement.h:30