Grantlee  5.1.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:
110 
111  ~PlainTextMarkupBuilder() override;
112 
113  void beginStrong() override;
114  void endStrong() override;
115  void beginEmph() override;
116  void endEmph() override;
117  void beginUnderline() override;
118  void endUnderline() override;
119  void beginStrikeout() override;
120  void endStrikeout() override;
121 
122  void beginAnchor(const QString &href = QString(),
123  const QString &name = QString()) override;
124 
125  void endAnchor() override;
126 
127  void beginForeground(const QBrush &brush) override;
128 
129  void endForeground() override;
130 
131  void beginBackground(const QBrush &brush) override;
132 
133  void endBackground() override;
134 
135  void beginFontFamily(const QString &family) override;
136 
137  void endFontFamily() override;
138 
139  void beginFontPointSize(int size) override;
140 
141  void endFontPointSize() override;
142 
143  void beginParagraph(Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0,
144  qreal bottom = 0.0, qreal left = 0.0,
145  qreal right = 0.0) override;
146 
147  void endParagraph() override;
148  void addNewline() override;
149 
150  void insertHorizontalRule(int width = -1) override;
151 
152  void insertImage(const QString &src, qreal width, qreal height) override;
153 
154  void beginList(QTextListFormat::Style style) override;
155 
156  void endList() override;
157 
158  void beginListItem() override;
159 
160  void endListItem() override;
161 
162  void beginSuperscript() override;
163 
164  void endSuperscript() override;
165 
166  void beginSubscript() override;
167 
168  void endSubscript() override;
169 
170  void beginTable(qreal cellpadding, qreal cellspacing,
171  const QString &width) override;
172 
173  void beginTableRow() override;
174 
175  void beginTableHeaderCell(const QString &width, int colSpan,
176  int rowSpan) override;
177 
178  void beginTableCell(const QString &width, int colSpan, int rowSpan) override;
179 
180  void endTable() override;
181 
182  void endTableRow() override;
183 
184  void endTableHeaderCell() override;
185 
186  void endTableCell() override;
187 
188  void beginHeader(int level) override;
189 
190  void endHeader(int level) override;
191 
192  void appendLiteralText(const QString &text) override;
193 
194  void appendRawText(const QString &text) override;
195 
200  int addReference(const QString &reference);
201 
205  QString getResult() override;
206 
207 private:
208  PlainTextMarkupBuilderPrivate *const d_ptr;
209  Q_DECLARE_PRIVATE(PlainTextMarkupBuilder)
210 };
211 }
212 
213 #endif
The PlainTextHTMLMarkupBuilder creates a simple marked up plain text document.
The AbstractMarkupBuilder class serves as a base class for creating marked up plain text output...
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:7