17 #ifndef KDREPORTSREPORT_H
18 #define KDREPORTSREPORT_H
24 #include <QTextOption>
25 #include <QtCore/QSizeF>
27 #include <QtPrintSupport/QPrinter>
31 class QTextDocumentFragment;
35 class QAbstractItemModel;
48 class HeaderReportBuilder;
54 class TableBreakingSettingsDialog;
55 class AutoTableElement;
56 class XmlElementHandler;
83 Q_PROPERTY(QString documentName READ documentName WRITE setDocumentName)
90 explicit Report(QObject *parent =
nullptr);
118 void setReportMode(ReportMode reportMode);
124 ReportMode reportMode()
const;
130 void setDefaultFont(
const QFont &font);
136 QFont defaultFont()
const;
150 void addInlineElement(
const Element &element);
166 void addElement(
const Element &element, Qt::AlignmentFlag horizontalAlignment = Qt::AlignLeft,
const QColor &backgroundColor = QColor());
173 void addVerticalSpacing(qreal space);
181 void addFragment(
const QTextDocumentFragment &fragment);
224 static QTextOption::Tab rightAlignedTab();
232 static QTextOption::Tab middleAlignedTab();
239 void setParagraphMargins(qreal left, qreal top, qreal right, qreal bottom);
241 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
248 void setPageSize(QPrinter::PageSize size);
256 void setPageSize(QPageSize::PageSizeId size);
263 void setPageSize(
const QPageSize &size);
265 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
269 QPrinter::PageSize pageSize()
const;
274 QPageSize pageSize()
const;
283 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
288 Q_DECL_DEPRECATED
void setOrientation(QPrinter::Orientation orientation);
293 Q_DECL_DEPRECATED QPrinter::Orientation orientation()
const;
299 void setPageOrientation(QPageLayout::Orientation orientation);
303 QPageLayout::Orientation pageOrientation()
const;
318 void setWidthForEndlessPrinter(qreal widthMM);
323 void setMargins(qreal top, qreal left, qreal bottom, qreal right);
328 void getMargins(qreal *top, qreal *left, qreal *bottom, qreal *right)
const;
334 void setTopPageMargin(qreal top);
340 qreal topPageMargins()
const;
346 void setLeftPageMargin(qreal left);
352 qreal leftPageMargins()
const;
358 void setRightPageMargin(qreal right);
364 qreal rightPageMargins()
const;
370 void setBottomPageMargin(qreal bottom);
376 qreal bottomPageMargins()
const;
383 void setHeaderBodySpacing(qreal spacing);
389 qreal headerBodySpacing()
const;
396 void setFooterBodySpacing(qreal spacing);
402 qreal footerBodySpacing()
const;
437 void associateModel(
const QString &modelKey, QAbstractItemModel *model);
449 void associateTextValue(
const QString &
id,
const QString &value);
460 void associateImageValue(
const QString &
id,
const QPixmap &value);
475 void associateImageValue(
const QString &
id,
const QImage &value);
487 bool loadFromXML(QIODevice *iodevice,
ErrorDetails *details =
nullptr);
501 bool loadFromXML(
const QDomDocument &doc,
ErrorDetails *details =
nullptr);
519 void setCurrentRow(
const QAbstractItemModel *model,
int row);
526 void setDocumentName(
const QString &name);
532 QString documentName()
const;
539 bool printWithDialog(QWidget *parent);
553 bool print(QPrinter *printer, QWidget *parent =
nullptr);
561 bool exportToFile(
const QString &fileName, QWidget *parent =
nullptr);
569 bool exportToImage(QSize size,
const QString &fileName,
const char *format);
578 bool exportToHtml(
const QString &fileName);
587 void paintPage(
int pageNumber, QPainter &painter);
594 void setFirstPageNumber(
int num);
599 int firstPageNumber()
const;
604 int numberOfPages()
const;
609 bool isTableBreakingEnabled()
const;
621 void setTableBreakingPageOrder(TableBreakingPageOrder pageOrder);
627 TableBreakingPageOrder tableBreakingPageOrder()
const;
638 void setFontScalingFactor(qreal factor);
644 qreal fontScalingFactor()
const;
666 void scaleTo(
int numPagesHorizontally,
int numPagesVertically);
672 int maximumNumberOfPagesForHorizontalScaling()
const;
677 int maximumNumberOfPagesForVerticalScaling()
const;
684 void setFixedRowHeight(qreal mm);
701 void regenerateAutoTables();
708 void regenerateAutoTableForModel(QAbstractItemModel *model);
719 void setWatermarkText(
const QString &text,
int rotation = 0,
const QColor &color = QColor(204, 204, 204),
const QFont &font = QFont(QStringLiteral(
"Helvetica"), 48));
724 QString watermarkText()
const;
729 int watermarkRotation()
const;
734 QColor watermarkColor()
const;
739 QFont watermarkFont()
const;
751 void setWatermarkPixmap(
const QPixmap &pixmap,
bool autoGrayOut =
true);
758 QPixmap watermarkPixmap()
const;
764 void setWatermarkImage(
const QImage &image);
770 QImage watermarkImage()
const;
776 KDReports::HeaderLocations headerLocation(
Header *header)
const;
788 void setHeaderLocation(HeaderLocations hl,
Header *header);
794 void setFooterLocation(HeaderLocations hl,
Footer *footer);
799 QSizeF paperSize()
const;
809 int currentPosition()
const;
839 QString anchorAt(
int pageNumber, QPoint pos)
const;
843 friend class ::ReportData;
844 friend class ::EditorData;
847 QString asHtml()
const;
849 void setupPrinter(QPrinter *printer);
858 friend class PreviewDialogPrivate;
859 friend class PreviewWidgetPrivate;