Grantlee  0.3.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 
25 #ifdef Q_OS_WIN
26 #pragma warning( disable : 4250 )
27 #endif
28 
29 #define LETTERSINALPHABET 26
30 #define DIGITSOFFSET 10
31 
32 #include "abstractmarkupbuilder.h"
33 #include "grantlee_gui_export.h"
34 #include "markupdirector.h"
35 
36 class QBrush;
37 
38 namespace Grantlee
39 {
40 
41 class PlainTextMarkupBuilderPrivate;
42 
44 
96 class GRANTLEE_GUI_EXPORT PlainTextMarkupBuilder : virtual public AbstractMarkupBuilder
97 {
98 public:
101 
102  virtual ~PlainTextMarkupBuilder();
103 
104  /* reimp */ void beginStrong();
105  /* reimp */ void endStrong();
106  /* reimp */ void beginEmph();
107  /* reimp */ void endEmph();
108  /* reimp */ void beginUnderline();
109  /* reimp */ void endUnderline();
110  /* reimp */ void beginStrikeout();
111  /* reimp */ void endStrikeout();
112 
113  /* reimp */ void beginAnchor( const QString &href = QString(), const QString &name = QString() );
114 
115  /* reimp */ void endAnchor();
116 
117  /* reimp */ void beginForeground( const QBrush &brush );
118 
119  /* reimp */ void endForeground();
120 
121  /* reimp */ void beginBackground( const QBrush &brush );
122 
123  /* reimp */ void endBackground();
124 
125  /* reimp */ void beginFontFamily( const QString &family );
126 
127  /* reimp */ void endFontFamily();
128 
129  /* reimp */ void beginFontPointSize( int size );
130 
131  /* reimp */ void endFontPointSize();
132 
133  /* reimp */ void beginParagraph( Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0, qreal bottom = 0.0, qreal left = 0.0, qreal right = 0.0 );
134 
135  /* reimp */ void endParagraph();
136  /* reimp */ void addNewline();
137 
138  /* reimp */ void insertHorizontalRule( int width = -1 );
139 
140  /* reimp */ void insertImage( const QString &src, qreal width, qreal height );
141 
142  /* reimp */ void beginList( QTextListFormat::Style style );
143 
144  /* reimp */ void endList();
145 
146  /* reimp */ void beginListItem();
147 
148  /* reimp */ void endListItem();
149 
150  /* reimp */ void beginSuperscript();
151 
152  /* reimp */ void endSuperscript();
153 
154  /* reimp */ void beginSubscript();
155 
156  /* reimp */ void endSubscript();
157 
158  /* reimp */ void beginTable( qreal cellpadding, qreal cellspacing, const QString &width );
159 
160  /* reimp */ void beginTableRow();
161 
162  /* reimp */ void beginTableHeaderCell( const QString &width, int colSpan, int rowSpan );
163 
164  /* reimp */ void beginTableCell( const QString &width, int colSpan, int rowSpan );
165 
166  /* reimp */ void endTable();
167 
168  /* reimp */ void endTableRow();
169 
170  /* reimp */ void endTableHeaderCell();
171 
172  /* reimp */ void endTableCell();
173 
174  /* reimp */ void beginHeader( int level );
175 
176  /* reimp */ void endHeader( int level );
177 
178  /* reimp */ void appendLiteralText( const QString &text );
179 
180  /* reimp */ void appendRawText( const QString &text );
181 
185  int addReference( const QString &reference );
186 
190  /* reimp */ QString getResult();
191 
192 private:
193  PlainTextMarkupBuilderPrivate * const d_ptr;
194  Q_DECLARE_PRIVATE( PlainTextMarkupBuilder )
195 
196 };
197 
198 }
199 
200 #endif