Grantlee 5.3.0
texthtmlbuilder.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_TEXTHTMLBUILDER_H
22#define GRANTLEE_TEXTHTMLBUILDER_H
23
24#ifdef Q_CC_MSVC
25#pragma warning(disable : 4250)
26#endif
27
28#include "abstractmarkupbuilder.h"
29#include "grantlee_textdocument_export.h"
30#include "markupdirector.h"
31
32namespace Grantlee
33{
34
35class TextHTMLBuilderPrivate;
36
38
111class GRANTLEE_TEXTDOCUMENT_EXPORT TextHTMLBuilder
112 : virtual public AbstractMarkupBuilder
113{
114public:
118 void beginStrong() override;
119 void endStrong() override;
120 void beginEmph() override;
121 void endEmph() override;
122 void beginUnderline() override;
123 void endUnderline() override;
124 void beginStrikeout() override;
125 void endStrikeout() override;
126 void beginForeground(const QBrush &brush) override;
127 void endForeground() override;
128 void beginBackground(const QBrush &brush) override;
129 void endBackground() override;
130 void beginAnchor(const QString &href = {}, const QString &name = {}) override;
131 void endAnchor() override;
133 // Maybe this stuff should just be added to a list, and then when I add
134 // literal text,
135 // add some kind of style attribute in one span instead of many.
136 void beginFontFamily(const QString &family) override;
137 void endFontFamily() override;
138
143 void beginFontPointSize(int size) override;
144 void endFontPointSize() override;
145
154 void beginParagraph(Qt::Alignment al = Qt::AlignLeft, qreal topMargin = 0.0,
155 qreal bottomMargin = 0.0, qreal leftMargin = 0.0,
156 qreal rightMargin = 0.0) override;
157
162 void beginHeader(int level) override;
163
168 void endHeader(int level) override;
170 void endParagraph() override;
171 void addNewline() override;
172
173 void insertHorizontalRule(int width = -1) override;
174
175 void insertImage(const QString &src, qreal width, qreal height) override;
176
177 void beginList(QTextListFormat::Style type) override;
179 void endList() override;
181 void beginListItem() override;
182 void endListItem() override;
183
184 void beginSuperscript() override;
185
186 void endSuperscript() override;
187
188 void beginSubscript() override;
189
190 void endSubscript() override;
192 void beginTable(qreal cellpadding, qreal cellspacing,
193 const QString &width) override;
194
195 void beginTableRow() override;
196 void beginTableHeaderCell(const QString &width, int colspan,
197 int rowspan) override;
199 void beginTableCell(const QString &width, int colspan, int rowspan) override;
201 void endTable() override;
202 void endTableRow() override;
203 void endTableHeaderCell() override;
204 void endTableCell() override;
205
221 void appendLiteralText(const QString &text) override;
222
228 void appendRawText(const QString &text) override;
229
230 QString getResult() override;
231
232private:
233 TextHTMLBuilderPrivate *d_ptr;
234 Q_DECLARE_PRIVATE(TextHTMLBuilder)
235};
236}
237
238#endif
The TextHTMLBuilder creates a clean html markup output.
The Grantlee namespace holds all public Grantlee API.
Definition Mainpage.dox:8