KD Reports API Documentation 2.2
Loading...
Searching...
No Matches
KDReportsTextDocumentData_p.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** This file is part of the KD Reports library.
4**
5** SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6**
7** SPDX-License-Identifier: MIT
8**
9****************************************************************************/
10
11#ifndef KDREPORTSTEXTDOCUMENTDATA_P_H
12#define KDREPORTSTEXTDOCUMENTDATA_P_H
14#include "KDReportsReport.h"
15#include <QMultiMap>
16#include <QTextCursor>
17#include <QTextDocument>
18
19//
20// W A R N I N G
21// -------------
22//
23// This file is not part of the KD Reports API. It exists purely as an
24// implementation detail. This header file may change from version to
25// version without notice, or even be removed.
26//
27// We mean it.
28//
29//
30
31namespace KDReports {
32
38{
39public:
40 explicit TextDocumentData();
42
45
47 {
48 return m_document;
49 }
50 const QTextDocument &document() const
51 {
52 return m_document;
53 }
54
55 void setUsesTabPositions(bool usesTabs);
56 void saveResourcesToFiles();
58 {
60 Modify
61 };
62 void aboutToModifyContents(ModificationMode mode);
63 void updateTextValue(const QString &id, const QString &newValue);
64 void layoutWithTextWidth(qreal w);
65 void setPageSize(QSizeF size);
66 void scaleFontsBy(qreal factor); // TODO remove?
67 void updatePercentSizes(QSizeF size);
68 void setTextValueMarker(int pos, const QString &id, int valueLength, bool html);
71 // int breakTables( const QSizeF& textDocPageSize, int numHorizontalPages, KDReports::Report::TableBreakingPageOrder pageOrder );
72 // We need to know about all tables in order to implement table-breaking
73 void registerTable(QTextTable *table);
74 QString asHtml() const;
77 void registerAutoTable(QTextTable *table, const KDReports::AutoTableElement *element);
81 void addResourceName(const QString &resourceName);
82 void setHasResizableImages();
83
84 static void updatePercentSize(QTextImageFormat &format, QSizeF size);
85
86private:
87 void resolveCursorPositions(ModificationMode mode);
88 void setFontSizeHelper(QTextCursor &lastCursor, int endPosition, qreal pointSize, qreal factor);
89 void regenerateOneTable(const KDReports::AutoTableElement &tableElement, QTextTable *table);
90 void dumpTextValueCursors() const;
91
92 QTextDocument m_document;
93 enum ElementType
94 {
95 ElementTypeText,
96 ElementTypeHtml
97 };
98 struct TextValueData
99 {
100 int valueLength;
101 ElementType elementType;
102 QTextCursor cursor;
103 int initialPosition;
104 };
105 QMultiMap<QString, TextValueData> m_textValueCursors;
106
107 QList<QTextTable *> m_tables;
108
110 AutoTablesMaps m_autoTables;
111 QList<QString> m_resourceNames;
112 bool m_usesTabPositions;
113 bool m_hasResizableImages = false;
114};
115
116}
117
118#endif /* KDREPORTSTEXTDOCUMENTDATA_P_H */
#define KDREPORTS_EXPORT
TextDocumentData & operator=(const TextDocumentData &)=delete
void regenerateAutoTableForModel(QAbstractItemModel *model)
TextDocumentData(const TextDocumentData &)=delete
const QTextDocument & document() const
QList< KDReports::AutoTableElement * > autoTableElements()

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-reports/
Generated on Wed Apr 24 2024 04:08:15 for KD Reports API Documentation by doxygen 1.9.8