Grantlee  5.2.0
plaintextmarkupbuilder.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_PLAINTEXTMARKUPBUILDER_H
22 #define GRANTLEE_PLAINTEXTMARKUPBUILDER_H
23 
24 #ifdef Q_OS_WIN
25 #pragma warning(disable : 4250)
26 #endif
27 
28 #define LETTERSINALPHABET 26
29 #define DIGITSOFFSET 10
30 
31 #include "abstractmarkupbuilder.h"
32 #include "grantlee_textdocument_export.h"
33 #include "markupdirector.h"
34 
35 class QBrush;
36 
37 namespace Grantlee
38 {
39 
40 class PlainTextMarkupBuilderPrivate;
41 
43 
104 class GRANTLEE_TEXTDOCUMENT_EXPORT PlainTextMarkupBuilder
105  : virtual public AbstractMarkupBuilder
106 {
107 public:
109 
110  ~PlainTextMarkupBuilder() override;
111 
112  void beginStrong() override;
113  void endStrong() override;
114  void beginEmph() override;
115  void endEmph() override;
116  void beginUnderline() override;
117  void endUnderline() override;
118  void beginStrikeout() override;
119  void endStrikeout() override;
120 
121  void beginAnchor(const QString &href = {}, const QString &name = {}) override;
122 
123  void endAnchor() override;
124 
125  void beginForeground(const QBrush &brush) override;
126 
127  void endForeground() override;
128 
129  void beginBackground(const QBrush &brush) override;
130 
131  void endBackground() override;
132 
133  void beginFontFamily(const QString &family) override;
134 
135  void endFontFamily() override;
136 
137  void beginFontPointSize(int size) override;
138 
139  void endFontPointSize() override;
140 
141  void beginParagraph(Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0,
142  qreal bottom = 0.0, qreal left = 0.0,
143  qreal right = 0.0) override;
144 
145  void endParagraph() override;
146  void addNewline() override;
147 
148  void insertHorizontalRule(int width = -1) override;
149 
150  void insertImage(const QString &src, qreal width, qreal height) override;
151 
152  void beginList(QTextListFormat::Style style) override;
153 
154  void endList() override;
155 
156  void beginListItem() override;
157 
158  void endListItem() override;
159 
160  void beginSuperscript() override;
161 
162  void endSuperscript() override;
163 
164  void beginSubscript() override;
165 
166  void endSubscript() override;
167 
168  void beginTable(qreal cellpadding, qreal cellspacing,
169  const QString &width) override;
170 
171  void beginTableRow() override;
172 
173  void beginTableHeaderCell(const QString &width, int colSpan,
174  int rowSpan) override;
175 
176  void beginTableCell(const QString &width, int colSpan, int rowSpan) override;
177 
178  void endTable() override;
179 
180  void endTableRow() override;
181 
182  void endTableHeaderCell() override;
183 
184  void endTableCell() override;
185 
186  void beginHeader(int level) override;
187 
188  void endHeader(int level) override;
189 
190  void appendLiteralText(const QString &text) override;
191 
192  void appendRawText(const QString &text) override;
193 
198  int addReference(const QString &reference);
199 
203  QString getResult() override;
204 
205 private:
206  PlainTextMarkupBuilderPrivate *const d_ptr;
207  Q_DECLARE_PRIVATE(PlainTextMarkupBuilder)
208 };
209 }
210 
211 #endif
Grantlee::PlainTextMarkupBuilder
Creates a simple marked up plain text document.
Definition: plaintextmarkupbuilder.h:104
Grantlee::AbstractMarkupBuilder
Interface for creating marked-up text output.
Definition: abstractmarkupbuilder.h:51
Grantlee
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:7