#include <kplaintextmarkupbuilder.h>

Public Member Functions | |
KPlainTextMarkupBuilder () | |
virtual void | addNewline () |
virtual void | appendLiteralText (const QString &text) |
virtual void | beginAnchor (const QString &href=QString(), const QString &name=QString()) |
virtual void | beginEmph () |
virtual void | beginList (QTextListFormat::Style style) |
virtual void | beginListItem () |
virtual void | beginStrikeout () |
virtual void | beginStrong () |
virtual void | beginSubscript () |
virtual void | beginSuperscript () |
virtual void | beginUnderline () |
virtual void | endAnchor () |
virtual void | endEmph () |
virtual void | endList () |
virtual void | endListItem () |
virtual void | endParagraph () |
virtual void | endStrikeout () |
virtual void | endStrong () |
virtual void | endSubscript () |
virtual void | endSuperscript () |
virtual void | endUnderline () |
virtual QString & | getResult () |
virtual void | insertHorizontalRule (int width=-1) |
virtual void | insertImage (const QString &src, qreal width, qreal height) |
Detailed Description
The KPlainTextMarkupBuilder creates a simple marked up plain text document.
This class creates a simple plain text markup.
Text that may be represented as
A paragraph with <b>bold</b> text, <i>italic</i> text, and <u>underlined</u> text.
would be output as
A paragraph with *bold* text /italic/ text, and _underlined_ text.
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.
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. eg:
A. One B. Two o Three o Four \* Five \* Six C. Seven
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.
Eg,
Here is a link to <a href="http://www.kde.org">KDE</a> and the <a href="http://pim.kde.org">KDEPIM project</a>.
becomes:
Here is a link to KDE[1], and the KDEPIM project[2]. ---- References ---- [1] http://www.kde.org [2] http://pim.kde.org
- Todo:
- Move this to kdelibs when tested and in use.
- Since:
- 4.2
Definition at line 89 of file kplaintextmarkupbuilder.h.
Constructor & Destructor Documentation
Construct a new KPlainTextMarkupBuilder.
Definition at line 98 of file kplaintextmarkupbuilder.cpp.
Member Function Documentation
void KPlainTextMarkupBuilder::addNewline | ( | ) | [virtual] |
Add a newline to the markup.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 168 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::appendLiteralText | ( | const QString & | text | ) | [virtual] |
Append the plain text text
to the markup.
- Parameters:
-
The text to append.
Implements KAbstractMarkupBuilder.
Definition at line 275 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::beginAnchor | ( | const QString & | href = QString() , |
const QString & | name = QString() |
||
) | [virtual] |
Begin a url anchor element in the markup.
- Parameters:
-
href The href of the anchor. name The name of the anchor.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 145 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::beginEmph | ( | ) | [virtual] |
Begin an emphasised element in the markup.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 114 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::beginList | ( | QTextListFormat::Style | style | ) | [virtual] |
Begin a new list element in the markup.
A list element contains list items, and may contain other lists.
- Parameters:
-
style The style of list to create.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 195 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::beginListItem | ( | ) | [virtual] |
Begin a new list item in the markup.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 210 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::beginStrikeout | ( | ) | [virtual] |
Begin a struck out element in the markup.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 134 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::beginStrong | ( | ) | [virtual] |
Begin a bold element in the markup.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 104 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::beginSubscript | ( | ) | [virtual] |
Begin a subscript element.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 263 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::beginSuperscript | ( | ) | [virtual] |
Begin a superscript element.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 251 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::beginUnderline | ( | ) | [virtual] |
Begin an underlined element in the markup.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 124 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::endAnchor | ( | ) | [virtual] |
Close the anchor element.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 156 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::endEmph | ( | ) | [virtual] |
Close the emphasised element in the markup.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 119 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::endList | ( | ) | [virtual] |
Close the list.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 202 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::endListItem | ( | ) | [virtual] |
End the list item.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 244 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::endParagraph | ( | ) | [virtual] |
Close the paragraph in the markup.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 162 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::endStrikeout | ( | ) | [virtual] |
Close the struck out element in the markup.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 139 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::endStrong | ( | ) | [virtual] |
Close the bold element in the markup.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 109 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::endSubscript | ( | ) | [virtual] |
End subscript element.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 269 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::endSuperscript | ( | ) | [virtual] |
End superscript element.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 257 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::endUnderline | ( | ) | [virtual] |
Close the underlined element in the markup.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 129 of file kplaintextmarkupbuilder.cpp.
QString & KPlainTextMarkupBuilder::getResult | ( | ) | [virtual] |
Returns the finalised plain text markup, including references at the end.
Implements KAbstractMarkupBuilder.
Definition at line 281 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::insertHorizontalRule | ( | int | width = -1 | ) | [virtual] |
Insert a horizontal rule into the markup.
- Parameters:
-
width The width of the rule. Default is full width.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 174 of file kplaintextmarkupbuilder.cpp.
void KPlainTextMarkupBuilder::insertImage | ( | const QString & | url, |
qreal | width, | ||
qreal | height | ||
) | [virtual] |
Insert a new image element into the markup.
- Parameters:
-
url The url of the image width The width of the image height The height of the image.
Reimplemented from KAbstractMarkupBuilder.
Definition at line 182 of file kplaintextmarkupbuilder.cpp.
The documentation for this class was generated from the following files: