Cutelee  6.1.0
plaintextmarkupbuilder.h
1 /*
2  This file is part of the Cutelee 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 CUTELEE_PLAINTEXTMARKUPBUILDER_H
22 #define CUTELEE_PLAINTEXTMARKUPBUILDER_H
23 
24 #include <qglobal.h>
25 
26 #ifdef Q_OS_WIN
27 #pragma warning(disable : 4250)
28 #endif
29 
30 #define LETTERSINALPHABET 26
31 #define DIGITSOFFSET 10
32 
33 #include "abstractmarkupbuilder.h"
34 #include "cutelee_textdocument_export.h"
35 #include "markupdirector.h"
36 
37 class QBrush;
38 
39 namespace Cutelee
40 {
41 
42 class PlainTextMarkupBuilderPrivate;
43 
45 
106 class CUTELEE_TEXTDOCUMENT_EXPORT PlainTextMarkupBuilder
107  : virtual public AbstractMarkupBuilder
108 {
109 public:
111 
112  ~PlainTextMarkupBuilder() override;
113 
114  void beginStrong() override;
115  void endStrong() override;
116  void beginEmph() override;
117  void endEmph() override;
118  void beginUnderline() override;
119  void endUnderline() override;
120  void beginStrikeout() override;
121  void endStrikeout() override;
122 
123  void beginAnchor(const QString &href = {}, const QString &name = {}) 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
Interface for creating marked-up text output.
Creates a simple marked up plain text document.
The Cutelee namespace holds all public Cutelee API.
Definition: Mainpage.dox:8