KD Reports API Documentation  2.2
KDReportsTextDocument.cpp
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 
13 
14 #include <QDebug>
15 
16 // #define DEBUG_TABLEBREAKING
17 
19 {
20 }
21 
23 {
24 }
25 
27 {
28  m_contentDocument.layoutWithTextWidth(w);
29 }
30 
32 {
33  m_contentDocument.setPageSize(size);
34 }
35 
37 {
38  return m_contentDocument;
39 }
40 
42 {
43  return contentDocumentData().document();
44 }
45 
47 {
48  return m_contentDocument.document().defaultFont();
49 }
50 
52 {
53  m_contentDocument.scaleFontsBy(factor);
54 }
55 
56 void KDReports::TextDocument::updateTextValue(const QString &id, const QString &newValue)
57 {
58  m_contentDocument.updateTextValue(id, newValue);
59 }
60 
61 //@cond PRIVATE
62 QString KDReports::TextDocument::asHtml() const
63 {
64  return m_contentDocument.asHtml();
65 }
66 //@endcond
67 
69 {
70 #if 0
71  qDebug() << "Dumping document:";
72  QTextCursor cursor( &m_contentDocument );
73  int i = 0;
74  int currentBlock = -1;
75  Q_FOREVER {
76  const int blockNumber = cursor.block().blockNumber(); // needs Qt-4.4
77  if ( blockNumber != currentBlock ) {
78  currentBlock = blockNumber;
79  qDebug() << " block" << currentBlock << "starts at char" << i;
80  QTextFormat::PageBreakFlags flags = cursor.block().blockFormat().pageBreakPolicy();
81  if ( flags & QTextFormat::PageBreak_AlwaysBefore )
82  qDebug() << " block" << currentBlock << "says: BREAK BEFORE";
83  if ( flags & QTextFormat::PageBreak_AlwaysAfter )
84  qDebug() << " block" << currentBlock << "says: BREAK AFTER";
85  }
86  const QChar ch = m_contentDocument.characterAt( i );
87  qDebug() << " char" << i << ch << ch.unicode(); // 8233 == paragraph separator
88 
89  if ( cursor.atEnd() ) {
90  qDebug() << " document ends at" << cursor.position();
91  break;
92  }
93  cursor.movePosition( QTextCursor::NextCharacter );
94  ++i;
95  }
96 #endif
97 }
98 
99 //@cond PRIVATE
101 {
102  return m_contentDocument.autoTableElements(); // doesn't matter in which one we call it
103 }
104 
106 {
107  m_contentDocument.regenerateAutoTables();
108 }
109 
110 void KDReports::TextDocument::regenerateAutoTableForModel(QAbstractItemModel *model)
111 {
112  m_contentDocument.regenerateAutoTableForModel(model);
113 }
114 //@endcond
QString asHtml() const
QList< KDReports::AutoTableElement * > autoTableElements()
void regenerateAutoTableForModel(QAbstractItemModel *model)
TextDocumentData & contentDocumentData()
void updateTextValue(const QString &id, const QString &newValue)

© 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 by doxygen 1.9.1