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
107 It my be possible to change this if necessary.
108
109 @author Stephen Kelly <steveire@gmail.com>
110*/
111class GRANTLEE_TEXTDOCUMENT_EXPORT TextHTMLBuilder
112 : virtual public AbstractMarkupBuilder
113{
114public:
115 TextHTMLBuilder();
116 ~TextHTMLBuilder() override;
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
Interface for creating marked-up text output.
void beginStrikeout() override
void insertHorizontalRule(int width=-1) override
void beginBackground(const QBrush &brush) override
void endList() override
void appendLiteralText(const QString &text) override
void beginEmph() override
void beginFontFamily(const QString &family) override
void appendRawText(const QString &text) override
void beginSubscript() override
void beginList(QTextListFormat::Style type) override
void endFontPointSize() override
QString getResult() override
void beginUnderline() override
void beginSuperscript() override
void endTableHeaderCell() override
void insertImage(const QString &src, qreal width, qreal height) override
void beginAnchor(const QString &href={}, const QString &name={}) override
void endTableCell() override
void beginTableCell(const QString &width, int colspan, int rowspan) override
void beginParagraph(Qt::Alignment al=Qt::AlignLeft, qreal topMargin=0.0, qreal bottomMargin=0.0, qreal leftMargin=0.0, qreal rightMargin=0.0) override
void endSuperscript() override
void endFontFamily() override
void beginStrong() override
void beginTable(qreal cellpadding, qreal cellspacing, const QString &width) override
void endStrikeout() override
void endUnderline() override
void beginForeground(const QBrush &brush) override
void beginListItem() override
void endSubscript() override
void endParagraph() override
void endHeader(int level) override
void endTable() override
void beginTableHeaderCell(const QString &width, int colspan, int rowspan) override
void endStrong() override
void addNewline() override
void beginTableRow() override
void beginFontPointSize(int size) override
void endTableRow() override
void endEmph() override
void endForeground() override
void beginHeader(int level) override
void endListItem() override
void endBackground() override
The Grantlee namespace holds all public Grantlee API.
Definition Mainpage.dox:8