2
This file is part of the Grantlee template system.
4
Copyright (c) 2008 Stephen Kelly <steveire@gmail.com>
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 of the Licence, or (at your option) any later version.
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
Library General Public License for more details.
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/>.
21
#ifndef GRANTLEE_PLAINTEXTMARKUPBUILDER_H
22
#define GRANTLEE_PLAINTEXTMARKUPBUILDER_H
26
#pragma warning( disable : 4250 )
29
#define LETTERSINALPHABET 26
30
#define DIGITSOFFSET 10
32
#include "abstractmarkupbuilder.h"
33
#include "markupdirector.h"
35
#include "grantlee_gui_export.h"
42
class PlainTextMarkupBuilderPrivate;
44
/// @headerfile plaintextmarkupbuilder.h grantlee/plaintextmarkupbuilder.h
47
@brief The PlainTextHTMLMarkupBuilder creates a simple marked up plain text document.
49
This class creates a simple plain text markup.
51
Text that may be represented as
54
A paragraph with <b>bold</b> text, <i>italic</i> text, and <u>underlined</u> text.
60
A paragraph with *bold* text /italic/ text, and _underlined_ text.
63
The markup is intended to be simple, plain and easily human readable. No markup is created for different font-familiy, font-size, foreground or background colors.
65
Lists are marked up by preceding the list element with '*' for disc, 'o' for circle, 'X' for square, or a letter or number. Lists are also indented if nested.
78
External references such as external urls and images are represented in the body text as a reference, and references are maintained at the bottom of the output.
82
Here is a link to <a href="http://www.kde.org">KDE</a> and the <a href="http://pim.kde.org">KDEPIM project</a>.
88
Here is a link to KDE[1], and the KDEPIM project[2].
91
[1] http://www.kde.org
92
[2] http://pim.kde.org
95
@author Stephen Kelly <steveire@gmail.com>
97
class GRANTLEE_GUI_EXPORT PlainTextMarkupBuilder : virtual public AbstractMarkupBuilder
100
/** Construct a new PlainTextHTMLMarkupBuilder. */
101
PlainTextMarkupBuilder();
103
virtual ~PlainTextMarkupBuilder();
105
/* reimp */ void beginStrong();
106
/* reimp */ void endStrong();
107
/* reimp */ void beginEmph();
108
/* reimp */ void endEmph();
109
/* reimp */ void beginUnderline();
110
/* reimp */ void endUnderline();
111
/* reimp */ void beginStrikeout();
112
/* reimp */ void endStrikeout();
114
/* reimp */ void beginAnchor( const QString &href = QString(), const QString &name = QString() );
116
/* reimp */ void endAnchor();
118
/* reimp */ void beginForeground( const QBrush &brush );
120
/* reimp */ void endForeground();
122
/* reimp */ void beginBackground( const QBrush &brush );
124
/* reimp */ void endBackground();
126
/* reimp */ void beginFontFamily( const QString &family );
128
/* reimp */ void endFontFamily();
130
/* reimp */ void beginFontPointSize( int size );
132
/* reimp */ void endFontPointSize();
134
/* reimp */ void beginParagraph( Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0, qreal bottom = 0.0, qreal left = 0.0, qreal right = 0.0 );
136
/* reimp */ void endParagraph();
137
/* reimp */ void addNewline();
139
/* reimp */ void insertHorizontalRule( int width = -1 );
141
/* reimp */ void insertImage( const QString &src, qreal width, qreal height );
143
/* reimp */ void beginList( QTextListFormat::Style style );
145
/* reimp */ void endList();
147
/* reimp */ void beginListItem();
149
/* reimp */ void endListItem();
151
/* reimp */ void beginSuperscript();
153
/* reimp */ void endSuperscript();
155
/* reimp */ void beginSubscript();
157
/* reimp */ void endSubscript();
159
/* reimp */ void beginTable( qreal cellpadding, qreal cellspacing, const QString &width );
161
/* reimp */ void beginTableRow();
163
/* reimp */ void beginTableHeaderCell( const QString &width, int colSpan, int rowSpan );
165
/* reimp */ void beginTableCell( const QString &width, int colSpan, int rowSpan );
167
/* reimp */ void endTable();
169
/* reimp */ void endTableRow();
171
/* reimp */ void endTableHeaderCell();
173
/* reimp */ void endTableCell();
175
/* reimp */ void beginHeader( int level );
177
/* reimp */ void endHeader( int level );
179
/* reimp */ void appendLiteralText( const QString &text );
181
/* reimp */ void appendRawText( const QString &text );
184
Adds a reference to @p reference to the internal list of references in the document.
186
int addReference( const QString &reference );
189
Returns the finalised plain text markup, including references at the end.
191
/* reimp */ QString getResult();
194
PlainTextMarkupBuilderPrivate * const d_ptr;
195
Q_DECLARE_PRIVATE( PlainTextMarkupBuilder )