kpimtextedit/richtextbuilders
#include <kabstractmarkupbuilder.h>

Public Types | |
enum | ExtraElement { UserElement = 100 } |
Public Member Functions | |
virtual | ~KAbstractMarkupBuilder () |
virtual void | addNewline () |
virtual void | appendLiteralText (const QString &text)=0 |
virtual void | beginAnchor (const QString &href=QString(), const QString &name=QString()) |
virtual void | beginBackground (const QBrush &brush) |
virtual void | beginEmph () |
virtual void | beginExtraElement (int type, QVariantList args) |
virtual void | beginFontFamily (const QString &family) |
virtual void | beginFontPointSize (int size) |
virtual void | beginForeground (const QBrush &brush) |
virtual void | beginHeader (int level) |
virtual void | beginList (QTextListFormat::Style style) |
virtual void | beginListItem () |
virtual void | beginParagraph (Qt::Alignment a=Qt::AlignLeft, qreal top=0.0, qreal bottom=0.0, qreal left=0.0, qreal right=0.0) |
virtual void | beginStrikeout () |
virtual void | beginStrong () |
virtual void | beginSubscript () |
virtual void | beginSuperscript () |
virtual void | beginTable (qreal cellpadding, qreal cellspacing, const QString &width) |
virtual void | beginTableCell (const QString &width, int colSpan, int rowSpan) |
virtual void | beginTableHeaderCell (const QString &width, int colSpan, int rowSpan) |
virtual void | beginTableRow () |
virtual void | beginUnderline () |
virtual void | endAnchor () |
virtual void | endBackground () |
virtual void | endEmph () |
virtual void | endExtraElement (int type) |
virtual void | endFontFamily () |
virtual void | endFontPointSize () |
virtual void | endForeground () |
virtual void | endHeader (int level) |
virtual void | endList () |
virtual void | endListItem () |
virtual void | endParagraph () |
virtual void | endStrikeout () |
virtual void | endStrong () |
virtual void | endSubscript () |
virtual void | endSuperscript () |
virtual void | endTable () |
virtual void | endTableCell () |
virtual void | endTableHeaderCell () |
virtual void | endTableRow () |
virtual void | endUnderline () |
virtual QString & | getResult ()=0 |
virtual void | insertHorizontalRule (int width=-1) |
virtual void | insertImage (const QString &url, qreal width, qreal height) |
Detailed Description
The KAbstractMarkupBuilder class serves as a base class for creating marked up plain text output.
The KAbstractMarkupBuilder is used by the MarkupDirector to create marked up output such as html or markdown.
Subclasses can reimplement whichever methods they choose. None of the methods are pure virtual and all default to an empty function to allow a clean fall-through. The exception is appendLiteralText, which appends its argument to the text being built.
See PlainTextMarkupBuilder and HTMLBuilder for example implementations.
- Note:
- For maintenance, if an extra tag is needed which is not provided by the virtual methods, the ExtraElement can be used.
eg,
builder->beginExtraElement(KAbstractMarkupBuilder::DivTag);
// ...
builder->endExtraElement(KAbstractMarkupBuilder::DivTag);
- Todo:
- Move this to kdelibs when tested.
- Since:
- 4.2
Member Enumeration Documentation
For future compatibility.
This enum can be used to insert extra tags not supported by the virtual methods.
Definition at line 66 of file kabstractmarkupbuilder.h.
Constructor & Destructor Documentation
virtual KAbstractMarkupBuilder::~KAbstractMarkupBuilder | ( | ) | [inline, virtual] |
Destructor.
Definition at line 69 of file kabstractmarkupbuilder.h.
Member Function Documentation
virtual void KAbstractMarkupBuilder::addNewline | ( | ) | [inline, virtual] |
Add a newline to the markup.
Reimplemented in KTextHTMLBuilder, KPlainTextMarkupBuilder, BBCodeBuilder, and MediaWikiMarkupBuilder.
Definition at line 160 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::appendLiteralText | ( | const QString & | text | ) | [pure virtual] |
Append the plain text text
to the markup.
- Parameters:
-
The text to append.
Implemented in KTextHTMLBuilder, KPlainTextMarkupBuilder, BBCodeBuilder, and MediaWikiMarkupBuilder.
virtual void KAbstractMarkupBuilder::beginAnchor | ( | const QString & | href = QString() , |
const QString & | name = QString() |
||
) | [inline, virtual] |
Begin a url anchor element in the markup.
- Parameters:
-
href The href of the anchor. name The name of the anchor.
Reimplemented in KTextHTMLBuilder, KPlainTextMarkupBuilder, MediaWikiMarkupBuilder, and BBCodeBuilder.
Definition at line 115 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginBackground | ( | const QBrush & | brush | ) | [inline, virtual] |
Begin a decorarated background element in the markup (A text background color)
Reimplemented in KTextHTMLBuilder.
Definition at line 104 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginEmph | ( | ) | [inline, virtual] |
Begin an emphasised element in the markup.
Reimplemented in KPlainTextMarkupBuilder, KTextHTMLBuilder, MediaWikiMarkupBuilder, and BBCodeBuilder.
Definition at line 78 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginExtraElement | ( | int | type, |
QVariantList | args | ||
) | [inline, virtual] |
Begin an extra identified element.
Override this to support more elements in the future in a BC way.
- Parameters:
-
type The type of element to create args Arguments for the element.
Definition at line 290 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginFontFamily | ( | const QString & | family | ) | [inline, virtual] |
Begin a new font familiy element in the markup.
- Parameters:
-
family The name of the font family to begin.
Reimplemented in KTextHTMLBuilder.
Definition at line 126 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginFontPointSize | ( | int | size | ) | [inline, virtual] |
Begin a new font point size element in the markup.
- Parameters:
-
int The point size to begin.
Reimplemented in KTextHTMLBuilder, and BBCodeBuilder.
Definition at line 135 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginForeground | ( | const QBrush & | brush | ) | [inline, virtual] |
Begin a decorarated foreground element in the markup (A text color)
Reimplemented in KTextHTMLBuilder, and BBCodeBuilder.
Definition at line 96 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginHeader | ( | int | level | ) | [inline, virtual] |
Begin a level level
header.
- Parameters:
-
level An integer between 1 and 6
Reimplemented in KTextHTMLBuilder, and MediaWikiMarkupBuilder.
Definition at line 271 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginList | ( | QTextListFormat::Style | style | ) | [inline, 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 in KTextHTMLBuilder, KPlainTextMarkupBuilder, BBCodeBuilder, and MediaWikiMarkupBuilder.
Definition at line 186 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginListItem | ( | ) | [inline, virtual] |
Begin a new list item in the markup.
Reimplemented in KTextHTMLBuilder, KPlainTextMarkupBuilder, BBCodeBuilder, and MediaWikiMarkupBuilder.
Definition at line 196 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginParagraph | ( | Qt::Alignment | a = Qt::AlignLeft , |
qreal | top = 0.0 , |
||
qreal | bottom = 0.0 , |
||
qreal | left = 0.0 , |
||
qreal | right = 0.0 |
||
) | [inline, virtual] |
Begin a new paragraph in the markup.
- Parameters:
-
a The alignment of the new paragraph. top The top margin of the new paragraph. bottom The bottom margin of the new paragraph. left The left margin of the new paragraph. right The right margin of the new paragraph.
Reimplemented in KTextHTMLBuilder, and BBCodeBuilder.
Definition at line 148 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginStrikeout | ( | ) | [inline, virtual] |
Begin a struck out element in the markup.
Reimplemented in KPlainTextMarkupBuilder, KTextHTMLBuilder, MediaWikiMarkupBuilder, and BBCodeBuilder.
Definition at line 90 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginStrong | ( | ) | [inline, virtual] |
Begin a bold element in the markup.
Reimplemented in KPlainTextMarkupBuilder, KTextHTMLBuilder, MediaWikiMarkupBuilder, and BBCodeBuilder.
Definition at line 72 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginSubscript | ( | ) | [inline, virtual] |
Begin a subscript element.
Reimplemented in KTextHTMLBuilder, KPlainTextMarkupBuilder, and BBCodeBuilder.
Definition at line 208 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginSuperscript | ( | ) | [inline, virtual] |
Begin a superscript element.
Reimplemented in KTextHTMLBuilder, KPlainTextMarkupBuilder, and BBCodeBuilder.
Definition at line 202 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginTable | ( | qreal | cellpadding, |
qreal | cellspacing, | ||
const QString & | width | ||
) | [inline, virtual] |
Begin a table element.
- Parameters:
-
cellpadding The padding attribute for the table. cellspacing The spacing attribute for the table. width The width of the table. May be either an integer, or a percentage value.
Reimplemented in KTextHTMLBuilder, and BBCodeBuilder.
Definition at line 220 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginTableCell | ( | const QString & | width, |
int | colSpan, | ||
int | rowSpan | ||
) | [inline, virtual] |
Begin a new table cell.
- Parameters:
-
width The width of the cell. colSpan The column span of the cell. rowSpan The row span of the cell.
Reimplemented in KTextHTMLBuilder.
Definition at line 249 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginTableHeaderCell | ( | const QString & | width, |
int | colSpan, | ||
int | rowSpan | ||
) | [inline, virtual] |
Begin a new table header cell.
- Parameters:
-
width The width of the cell. colSpan The column span of the cell. rowSpan The row span of the cell.
Reimplemented in KTextHTMLBuilder.
Definition at line 237 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginTableRow | ( | ) | [inline, virtual] |
Begins a new table row.
Reimplemented in KTextHTMLBuilder, and BBCodeBuilder.
Definition at line 229 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::beginUnderline | ( | ) | [inline, virtual] |
Begin an underlined element in the markup.
Reimplemented in KPlainTextMarkupBuilder, KTextHTMLBuilder, MediaWikiMarkupBuilder, and BBCodeBuilder.
Definition at line 84 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endAnchor | ( | ) | [inline, virtual] |
Close the anchor element.
Reimplemented in KPlainTextMarkupBuilder, KTextHTMLBuilder, MediaWikiMarkupBuilder, and BBCodeBuilder.
Definition at line 121 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endBackground | ( | ) | [inline, virtual] |
Close the decorarated background element in the markup.
Reimplemented in KTextHTMLBuilder.
Definition at line 109 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endEmph | ( | ) | [inline, virtual] |
Close the emphasised element in the markup.
Reimplemented in KPlainTextMarkupBuilder, KTextHTMLBuilder, MediaWikiMarkupBuilder, and BBCodeBuilder.
Definition at line 81 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endExtraElement | ( | int | type | ) | [inline, virtual] |
End extra tag.
- Parameters:
-
type The type of the tag to end.
Definition at line 299 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endFontFamily | ( | ) | [inline, virtual] |
End font family element.
Reimplemented in KTextHTMLBuilder.
Definition at line 130 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endFontPointSize | ( | ) | [inline, virtual] |
End font point size element.
Reimplemented in KTextHTMLBuilder, and BBCodeBuilder.
Definition at line 139 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endForeground | ( | ) | [inline, virtual] |
Close the decorarated foreground element in the markup.
Reimplemented in KTextHTMLBuilder, and BBCodeBuilder.
Definition at line 101 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endHeader | ( | int | level | ) | [inline, virtual] |
End a level level
header.
- Parameters:
-
level An integer between 1 and 6
Reimplemented in KTextHTMLBuilder, and MediaWikiMarkupBuilder.
Definition at line 279 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endList | ( | ) | [inline, virtual] |
Close the list.
Reimplemented in KTextHTMLBuilder, KPlainTextMarkupBuilder, BBCodeBuilder, and MediaWikiMarkupBuilder.
Definition at line 193 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endListItem | ( | ) | [inline, virtual] |
End the list item.
Reimplemented in KTextHTMLBuilder, KPlainTextMarkupBuilder, and MediaWikiMarkupBuilder.
Definition at line 199 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endParagraph | ( | ) | [inline, virtual] |
Close the paragraph in the markup.
Reimplemented in KTextHTMLBuilder, KPlainTextMarkupBuilder, BBCodeBuilder, and MediaWikiMarkupBuilder.
Definition at line 158 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endStrikeout | ( | ) | [inline, virtual] |
Close the struck out element in the markup.
Reimplemented in KPlainTextMarkupBuilder, KTextHTMLBuilder, MediaWikiMarkupBuilder, and BBCodeBuilder.
Definition at line 93 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endStrong | ( | ) | [inline, virtual] |
Close the bold element in the markup.
Reimplemented in KPlainTextMarkupBuilder, KTextHTMLBuilder, MediaWikiMarkupBuilder, and BBCodeBuilder.
Definition at line 75 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endSubscript | ( | ) | [inline, virtual] |
End subscript element.
Reimplemented in KTextHTMLBuilder, KPlainTextMarkupBuilder, and BBCodeBuilder.
Definition at line 211 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endSuperscript | ( | ) | [inline, virtual] |
End superscript element.
Reimplemented in KTextHTMLBuilder, KPlainTextMarkupBuilder, and BBCodeBuilder.
Definition at line 205 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endTable | ( | ) | [inline, virtual] |
End a table element.
Reimplemented in KTextHTMLBuilder.
Definition at line 256 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endTableCell | ( | ) | [inline, virtual] |
End a table cell.
Reimplemented in KTextHTMLBuilder.
Definition at line 265 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endTableHeaderCell | ( | ) | [inline, virtual] |
End a table header cell.
Reimplemented in KTextHTMLBuilder.
Definition at line 262 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endTableRow | ( | ) | [inline, virtual] |
End a table row.
Reimplemented in KTextHTMLBuilder.
Definition at line 259 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::endUnderline | ( | ) | [inline, virtual] |
Close the underlined element in the markup.
Reimplemented in KPlainTextMarkupBuilder, KTextHTMLBuilder, MediaWikiMarkupBuilder, and BBCodeBuilder.
Definition at line 87 of file kabstractmarkupbuilder.h.
virtual QString& KAbstractMarkupBuilder::getResult | ( | ) | [pure virtual] |
Return the fully marked up result of the building process.
This may contain metadata etc, such as a head element in html.
- Returns:
- The fully marked up text.
Implemented in KTextHTMLBuilder, KPlainTextMarkupBuilder, BBCodeBuilder, and MediaWikiMarkupBuilder.
virtual void KAbstractMarkupBuilder::insertHorizontalRule | ( | int | width = -1 | ) | [inline, virtual] |
Insert a horizontal rule into the markup.
- Parameters:
-
width The width of the rule. Default is full width.
Reimplemented in KTextHTMLBuilder, and KPlainTextMarkupBuilder.
Definition at line 165 of file kabstractmarkupbuilder.h.
virtual void KAbstractMarkupBuilder::insertImage | ( | const QString & | url, |
qreal | width, | ||
qreal | height | ||
) | [inline, 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 in KTextHTMLBuilder, KPlainTextMarkupBuilder, and BBCodeBuilder.
Definition at line 175 of file kabstractmarkupbuilder.h.
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 14 2012 04:44:29 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.