Grantlee: textdocument/lib/markupdirector.h Source File

Grantlee 5.2.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
92 class GRANTLEE_TEXTDOCUMENT_EXPORT MarkupDirector
93 {
94 public:
98 MarkupDirector(AbstractMarkupBuilder *builder);
99
103 virtual ~MarkupDirector();
104
108 virtual void processDocument(QTextDocument *doc);
109
114 virtual QTextFrame::iterator processFrame(QTextFrame::iterator it,
115 QTextFrame *frame);
116
124 virtual QTextFrame::iterator processBlock(QTextFrame::iterator it,
125 const QTextBlock &block);
126
133 virtual QTextFrame::iterator processObject(QTextFrame::iterator it,
134 const QTextBlock &block,
135 QTextObject *textObject);
136
143 virtual QPair<QTextFrame::iterator, QTextBlock>
144 processBlockGroup(QTextFrame::iterator it, const QTextBlock &block,
145 QTextBlockGroup *textBlockGroup);
146
153 virtual QPair<QTextFrame::iterator, QTextBlock>
154 processList(QTextFrame::iterator it, const QTextBlock &block,
155 QTextList *textList);
156
162 virtual QTextFrame::iterator processBlockContents(QTextFrame::iterator it,
163 const QTextBlock &block);
164
169 virtual void processCustomFragment(const QTextFragment &fragment,
170 QTextDocument const *doc);
171
177 virtual QTextBlock::iterator processFragment(QTextBlock::iterator it,
178 const QTextFragment &fragment,
179 QTextDocument const *doc);
180
189 virtual QTextBlock::iterator
190 processCharTextObject(QTextBlock::iterator it, const QTextFragment &fragment,
191 QTextObject *textObject);
192
200 virtual QTextBlock::iterator processImage(QTextBlock::iterator it,
201 const QTextImageFormat &imageFormat,
202 QTextDocument *doc);
203
211 virtual QTextFrame::iterator processTable(QTextFrame::iterator it,
212 QTextTable *table);
213
218 virtual void processTableCell(const QTextTableCell &tableCell,
219 QTextTable *table);
220
221 protected:
225 void processDocumentContents(QTextFrame::iterator begin,
226 QTextFrame::iterator end);
227
235 QPair<QTextFrame::iterator, QTextBlock>
236 skipBlockGroup(QTextFrame::iterator it, const QTextBlock &_block,
237 QTextBlockGroup *blockGroup);
238
246 QList<int> sortOpeningOrder(QSet<int> openingTags,
247 QTextBlock::iterator it) const;
248
253 virtual void processClosingElements(QTextBlock::iterator it);
254
258 virtual void processOpeningElements(QTextBlock::iterator it);
259
263 virtual QSet<int> getElementsToClose(QTextBlock::iterator it) const;
264
268 virtual QList<int> getElementsToOpen(QTextBlock::iterator it);
269
273 enum OpenElementValues {
274 None = 0x0,
275 SuperScript = 0x01,
276 SubScript = 0x02,
277 Anchor = 0x04,
278 SpanForeground = 0x08,
279 SpanBackground = 0x10,
280 SpanFontFamily = 0x20,
281 SpanFontPointSize = 0x40,
282 Strong = 0x80,
283 Emph = 0x100,
284 Underline = 0x200,
285 StrikeOut = 0x400
286 };
287
288 protected:
289 #ifndef Q_QDOC
290 MarkupDirectorPrivate *const d_ptr;
291 #endif
292
297 AbstractMarkupBuilder *m_builder;
298
299 #ifndef Q_QDOC
300 private:
301 Q_DECLARE_PRIVATE(MarkupDirector)
302 #endif
303 };
304 }
305
306 #endif
Grantlee::MarkupDirector::processObject
virtual QTextFrame::iterator processObject(QTextFrame::iterator it, const QTextBlock &block, QTextObject *textObject)
Grantlee::MarkupDirector::sortOpeningOrder
QList< int > sortOpeningOrder(QSet< int > openingTags, QTextBlock::iterator it) const
Grantlee::MarkupDirector::m_builder
AbstractMarkupBuilder * m_builder
Definition: markupdirector.h:297
Grantlee::MarkupDirector::processCharTextObject
virtual QTextBlock::iterator processCharTextObject(QTextBlock::iterator it, const QTextFragment &fragment, QTextObject *textObject)
Grantlee::MarkupDirector::processBlockGroup
virtual QPair< QTextFrame::iterator, QTextBlock > processBlockGroup(QTextFrame::iterator it, const QTextBlock &block, QTextBlockGroup *textBlockGroup)
Grantlee::MarkupDirector::MarkupDirector
MarkupDirector(AbstractMarkupBuilder *builder)
Grantlee::MarkupDirector::processDocument
virtual void processDocument(QTextDocument *doc)
Grantlee::MarkupDirector::processDocumentContents
void processDocumentContents(QTextFrame::iterator begin, QTextFrame::iterator end)
Grantlee::MarkupDirector::getElementsToOpen
virtual QList< int > getElementsToOpen(QTextBlock::iterator it)
Grantlee::MarkupDirector::processList
virtual QPair< QTextFrame::iterator, QTextBlock > processList(QTextFrame::iterator it, const QTextBlock &block, QTextList *textList)
Grantlee::MarkupDirector::processClosingElements
virtual void processClosingElements(QTextBlock::iterator it)
Grantlee::MarkupDirector::skipBlockGroup
QPair< QTextFrame::iterator, QTextBlock > skipBlockGroup(QTextFrame::iterator it, const QTextBlock &_block, QTextBlockGroup *blockGroup)
Grantlee::MarkupDirector::processTableCell
virtual void processTableCell(const QTextTableCell &tableCell, QTextTable *table)
Grantlee::MarkupDirector
Instructs a builder object to create markup output.
Definition: markupdirector.h:93
Grantlee::MarkupDirector::processBlock
virtual QTextFrame::iterator processBlock(QTextFrame::iterator it, const QTextBlock &block)
Grantlee::MarkupDirector::OpenElementValues
OpenElementValues
Definition: markupdirector.h:273
Grantlee::MarkupDirector::processFrame
virtual QTextFrame::iterator processFrame(QTextFrame::iterator it, QTextFrame *frame)
Grantlee::MarkupDirector::processImage
virtual QTextBlock::iterator processImage(QTextBlock::iterator it, const QTextImageFormat &imageFormat, QTextDocument *doc)
Grantlee::MarkupDirector::processBlockContents
virtual QTextFrame::iterator processBlockContents(QTextFrame::iterator it, const QTextBlock &block)
Grantlee::MarkupDirector::processCustomFragment
virtual void processCustomFragment(const QTextFragment &fragment, QTextDocument const *doc)
Grantlee::AbstractMarkupBuilder
Interface for creating marked-up text output.
Definition: abstractmarkupbuilder.h:52
Grantlee
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:8
Grantlee::MarkupDirector::processOpeningElements
virtual void processOpeningElements(QTextBlock::iterator it)
Grantlee::MarkupDirector::getElementsToClose
virtual QSet< int > getElementsToClose(QTextBlock::iterator it) const
Grantlee::MarkupDirector::processFragment
virtual QTextBlock::iterator processFragment(QTextBlock::iterator it, const QTextFragment &fragment, QTextDocument const *doc)
Grantlee::MarkupDirector::processTable
virtual QTextFrame::iterator processTable(QTextFrame::iterator it, QTextTable *table)
Grantlee::MarkupDirector::~MarkupDirector
virtual ~MarkupDirector()