Grantlee: textdocument/lib/markupdirector.h Source File

Grantlee 5.1.0

markupdirector.h
1 /*
2 This file is part of the Grantlee template system.
3
4 Copyright (c) 2008 Stephen Kelly <steveire@gmail.com>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either version
9 2.1 of the Licence, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library. If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #ifndef GRANTLEE_MARKUPDIRECTOR_H
22 #define GRANTLEE_MARKUPDIRECTOR_H
23
24 #include "abstractmarkupbuilder.h"
25 #include "grantlee_textdocument_export.h"
26
27 #include <QtGui/QTextDocument>
28 #include <QtGui/QTextFrame>
29
30 class QTextTable;
31 class QTextTableCell;
32 class QTextList;
33 class QTextCharFormat;
34
35 namespace Grantlee
36 {
37
38 class MarkupDirectorPrivate;
39
41
95 class GRANTLEE_TEXTDOCUMENT_EXPORT MarkupDirector
96 {
97 public:
101 MarkupDirector(AbstractMarkupBuilder *builder);
102
106 virtual ~MarkupDirector();
107
111 virtual void processDocument(QTextDocument *doc);
112
117 virtual QTextFrame::iterator processFrame(QTextFrame::iterator it,
118 QTextFrame *frame);
119
127 virtual QTextFrame::iterator processBlock(QTextFrame::iterator it,
128 const QTextBlock &block);
129
136 virtual QTextFrame::iterator processObject(QTextFrame::iterator it,
137 const QTextBlock &block,
138 QTextObject *textObject);
139
146 virtual QPair<QTextFrame::iterator, QTextBlock>
147 processBlockGroup(QTextFrame::iterator it, const QTextBlock &block,
148 QTextBlockGroup *textBlockGroup);
149
157 virtual QPair<QTextFrame::iterator, QTextBlock>
158 processList(QTextFrame::iterator it, const QTextBlock &block,
159 QTextList *textList);
160
167 virtual QTextFrame::iterator processBlockContents(QTextFrame::iterator it,
168 const QTextBlock &block);
169
175 virtual void processCustomFragment(const QTextFragment &fragment,
176 QTextDocument const *doc);
177
183 virtual QTextBlock::iterator processFragment(QTextBlock::iterator it,
184 const QTextFragment &fragment,
185 QTextDocument const *doc);
186
195 virtual QTextBlock::iterator
196 processCharTextObject(QTextBlock::iterator it, const QTextFragment &fragment,
197 QTextObject *textObject);
198
206 virtual QTextBlock::iterator processImage(QTextBlock::iterator it,
207 const QTextImageFormat &imageFormat,
208 QTextDocument *doc);
209
217 virtual QTextFrame::iterator processTable(QTextFrame::iterator it,
218 QTextTable *table);
219
224 virtual void processTableCell(const QTextTableCell &tableCell,
225 QTextTable *table);
226
227 protected:
231 void processDocumentContents(QTextFrame::iterator begin,
232 QTextFrame::iterator end);
233
242 QPair<QTextFrame::iterator, QTextBlock>
243 skipBlockGroup(QTextFrame::iterator it, const QTextBlock &_block,
244 QTextBlockGroup *blockGroup);
245
254 QList<int> sortOpeningOrder(QSet<int> openingTags,
255 QTextBlock::iterator it) const;
256
261 virtual void processClosingElements(QTextBlock::iterator it);
262
266 virtual void processOpeningElements(QTextBlock::iterator it);
267
271 virtual QSet<int> getElementsToClose(QTextBlock::iterator it) const;
272
276 virtual QList<int> getElementsToOpen(QTextBlock::iterator it);
277
281 enum OpenElementValues {
282 None = 0x0,
283 SuperScript = 0x01,
284 SubScript = 0x02,
285 Anchor = 0x04,
286 SpanForeground = 0x08,
287 SpanBackground = 0x10,
288 SpanFontFamily = 0x20,
289 SpanFontPointSize = 0x40,
290 Strong = 0x80,
291 Emph = 0x100,
292 Underline = 0x200,
293 StrikeOut = 0x400
294 };
295
296 protected:
297 #ifndef Q_QDOC
298 MarkupDirectorPrivate *const d_ptr;
299 #endif
300
305 AbstractMarkupBuilder *m_builder;
306
307 #ifndef Q_QDOC
308 private:
309 Q_DECLARE_PRIVATE(MarkupDirector)
310 #endif
311 };
312 }
313
314 #endif
Grantlee::MarkupDirector
The MarkupDirector class controls and instructs a builder object to create markup output.
Definition: markupdirector.h:95
Grantlee::MarkupDirector::m_builder
AbstractMarkupBuilder * m_builder
Definition: markupdirector.h:305
Grantlee::MarkupDirector::OpenElementValues
OpenElementValues
Definition: markupdirector.h:281
Grantlee::AbstractMarkupBuilder
The AbstractMarkupBuilder class serves as a base class for creating marked up plain text output.
Definition: abstractmarkupbuilder.h:52
Grantlee
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:7