17 #ifndef KDREPORTSREPORT_H 18 #define KDREPORTSREPORT_H 20 #include "KDReportsErrorDetails.h" 21 #include "KDReportsGlobal.h" 22 #include <QtCore/QSizeF> 25 #include <QTextOption> 27 #include <QtPrintSupport/QPrinter> 31 class QTextDocumentFragment;
35 class QAbstractItemModel;
48 class HeaderReportBuilder;
50 typedef Header Footer;
54 class TableBreakingSettingsDialog;
55 class AutoTableElement;
56 class XmlElementHandler;
99 class KDREPORTS_EXPORT
Report : public QObject
102 Q_PROPERTY(QString documentName READ documentName WRITE setDocumentName)
109 explicit Report( QObject* parent = 0 );
139 void setReportMode( ReportMode reportMode );
145 ReportMode reportMode()
const;
151 void setDefaultFont(
const QFont& font );
157 QFont defaultFont()
const;
171 void addInlineElement(
const Element& element );
187 void addElement(
const Element& element, Qt::AlignmentFlag horizontalAlignment = Qt::AlignLeft,
188 const QColor& backgroundColor = QColor() );
195 void addVerticalSpacing( qreal space );
203 void addFragment(
const QTextDocumentFragment& fragment );
246 QTextOption::Tab rightAlignedTab()
const;
254 QTextOption::Tab middleAlignedTab()
const;
261 void setParagraphMargins( qreal left, qreal top, qreal right, qreal bottom );
268 void setPageSize(
const QPrinter::PageSize& size );
274 void setPaperSize(
const QSizeF & paperSize, QPrinter::Unit unit );
279 QPrinter::PageSize pageSize()
const;
283 void setOrientation( QPrinter::Orientation orientation );
287 QPrinter::Orientation orientation()
const;
302 void setWidthForEndlessPrinter( qreal widthMM );
307 void setMargins( qreal top, qreal left, qreal bottom, qreal right );
313 void getMargins( qreal* top, qreal* left, qreal* bottom, qreal* right )
const;
319 void setTopPageMargin( qreal top );
325 qreal topPageMargins()
const;
331 void setLeftPageMargin( qreal left );
337 qreal leftPageMargins()
const;
343 void setRightPageMargin( qreal right );
349 qreal rightPageMargins()
const;
355 void setBottomPageMargin( qreal bottom );
361 qreal bottomPageMargins()
const;
368 void setHeaderBodySpacing( qreal spacing );
374 qreal headerBodySpacing()
const;
381 void setFooterBodySpacing( qreal spacing );
387 qreal footerBodySpacing()
const;
414 Footer& footer( HeaderLocations hl =
AllPages );
422 void associateModel(
const QString& modelKey, QAbstractItemModel* model );
434 void associateTextValue(
const QString&
id,
const QString& value );
445 void associateImageValue(
const QString&
id,
const QPixmap& value );
460 void associateImageValue(
const QString&
id,
const QImage& value );
472 bool loadFromXML( QIODevice* iodevice,
ErrorDetails* details = 0 );
486 bool loadFromXML(
const QDomDocument& doc,
ErrorDetails* details = 0 );
504 void setCurrentRow(
const QAbstractItemModel *model,
int row );
511 void setDocumentName(
const QString &name );
517 QString documentName()
const;
524 bool printWithDialog( QWidget* parent );
538 bool print( QPrinter* printer, QWidget* parent = 0 );
546 bool exportToFile(
const QString& fileName, QWidget* parent = 0 );
554 bool exportToImage(
const QSize& size,
const QString& fileName,
const char* format );
563 bool exportToHtml(
const QString& fileName );
570 void paintPage(
int pageNumber, QPainter& painter );
577 void setFirstPageNumber(
int num );
582 int firstPageNumber()
const;
587 int numberOfPages()
const;
612 void setTableBreakingEnabled(
bool tableBreakingEnabled );
618 bool isTableBreakingEnabled()
const;
620 enum TableBreakingPageOrder { DownThenRight, RightThenDown };
629 void setTableBreakingPageOrder( TableBreakingPageOrder pageOrder );
635 TableBreakingPageOrder tableBreakingPageOrder()
const;
646 void setFontScalingFactor( qreal factor );
652 qreal fontScalingFactor()
const;
676 void scaleTo(
int numPagesHorizontally,
int numPagesVertically );
682 int maximumNumberOfPagesForHorizontalScaling()
const;
687 int maximumNumberOfPagesForVerticalScaling()
const;
694 void setFixedRowHeight( qreal mm );
711 void regenerateAutoTables();
718 void regenerateAutoTableForModel( QAbstractItemModel* model );
729 void setWatermarkText(
const QString& text,
731 const QColor& color = QColor( 204, 204, 204 ),
732 const QFont& font = QFont( QLatin1String(
"Helvetica" ), 48 ) );
737 QString watermarkText()
const;
742 int watermarkRotation()
const;
747 QColor watermarkColor()
const;
752 QFont watermarkFont()
const;
764 void setWatermarkPixmap(
const QPixmap& pixmap,
bool autoGrayOut =
true );
771 QPixmap watermarkPixmap()
const;
777 void setWatermarkImage(
const QImage& image );
783 QImage watermarkImage()
const;
789 KDReports::HeaderLocations headerLocation(
Header* header)
const;
801 void setHeaderLocation(HeaderLocations hl,
Header *header);
807 void setFooterLocation(HeaderLocations hl, Footer *footer);
812 QSizeF paperSize()
const;
822 int currentPosition()
const;
846 friend class ::ReportData;
847 friend class ::EditorData;
848 KDReports::TextDocument& doc()
const;
850 QString asHtml()
const;
852 void setupPrinter( QPrinter* printer );
856 friend class HeaderReportBuilder;
859 friend class XmlParser;
861 friend class PreviewDialogPrivate;
862 friend class PreviewWidgetPrivate;
863 friend class ReportPrivate;
864 ReportPrivate*
const d;
Definition: KDReportsReport.h:99
HeaderLocation
Definition: KDReportsReport.h:81
Definition: KDReportsXmlElementHandler.h:80
The first page of the report.
Definition: KDReportsReport.h:82
Definition: KDReportsMainTable.h:44
Definition: KDReportsImageElement.h:35
All pages (except first and last if FirstPage or LastPage have their own headers) ...
Definition: KDReportsReport.h:86
Definition: KDReportsAbstractTableElement.h:30
The odd pages of the report: 1 (unless FirstPage has its own header), 3, 5, 7 etc.
Definition: KDReportsReport.h:84
The last page of the report.
Definition: KDReportsReport.h:85
Definition: KDReportsElement.h:39
The even pages of the report: 2, 4, 6 etc.
Definition: KDReportsReport.h:83
Definition: KDReportsErrorDetails.h:30
Definition: KDReportsChartElement.h:39
Definition: KDReportsAbstractTableElement.h:24