Cutelee
6.1.0
|
The TextHTMLBuilder creates a clean html markup output. More...
#include <cutelee/texthtmlbuilder.h>
Public Member Functions | |
void | addNewline () override |
void | appendLiteralText (const QString &text) override |
void | appendRawText (const QString &text) override |
void | beginAnchor (const QString &href={}, const QString &name={}) override |
void | beginBackground (const QBrush &brush) override |
void | beginEmph () override |
void | beginFontFamily (const QString &family) override |
void | beginFontPointSize (int size) override |
void | beginForeground (const QBrush &brush) override |
void | beginHeader (int level) override |
void | beginList (QTextListFormat::Style type) override |
void | beginListItem () override |
void | beginParagraph (Qt::Alignment al=Qt::AlignLeft, qreal topMargin=0.0, qreal bottomMargin=0.0, qreal leftMargin=0.0, qreal rightMargin=0.0) override |
void | beginStrikeout () override |
void | beginStrong () override |
void | beginSubscript () override |
void | beginSuperscript () override |
void | beginTable (qreal cellpadding, qreal cellspacing, const QString &width) override |
void | beginTableCell (const QString &width, int colspan, int rowspan) override |
void | beginTableHeaderCell (const QString &width, int colspan, int rowspan) override |
void | beginTableRow () override |
void | beginUnderline () override |
void | endAnchor () override |
void | endBackground () override |
void | endEmph () override |
void | endFontFamily () override |
void | endFontPointSize () override |
void | endForeground () override |
void | endHeader (int level) override |
void | endList () override |
void | endListItem () override |
void | endParagraph () override |
void | endStrikeout () override |
void | endStrong () override |
void | endSubscript () override |
void | endSuperscript () override |
void | endTable () override |
void | endTableCell () override |
void | endTableHeaderCell () override |
void | endTableRow () override |
void | endUnderline () override |
QString | getResult () override |
void | insertHorizontalRule (int width=-1) override |
void | insertImage (const QString &src, qreal width, qreal height) override |
![]() | |
virtual | ~AbstractMarkupBuilder () |
This class creates html output which is as minimal as possible and restricted to the rich text features supported in Qt. (https://doc.qt.io/qt-5/richtext-html-subset.html)
The output contains only the body content, not the head element or other metadata.
eg:
instead of the content produced by Qt:
Such tags should be created separately. For example:
Font formatting information on elements is represented by individual span elements.
eg:
instead of
It my be possible to change this if necessary.
Definition at line 111 of file texthtmlbuilder.h.
|
overridevirtual |
Add a newline to the markup.
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 281 of file texthtmlbuilder.cpp.
|
overridevirtual |
Reimplemented from AbstractMarkupBuilder.
This implementation escapes the text before appending so that
A sample <b>bold</b> word.
becomes
A sample <b>bold</b> word.
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 461 of file texthtmlbuilder.cpp.
|
overridevirtual |
Append text
without escaping.
This is useful if extending MarkupDirector
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 467 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a url anchor element in the markup
href | The href of the anchor. |
name | The name of the anchor. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 127 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a decorarated background element in the markup (A text background color) using brush
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 114 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin an emphasised element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 65 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a new font familiy element in the markup
family | The name of the font family to begin. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 150 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a new font point size
size | The new size to begin. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 163 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a decorarated foreground element in the markup (A text color) using brush
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 101 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a new header element.
level | The new level to begin. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 221 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a new list element in the markup. A list element contains list items, and may contain other lists.
style | The style of list to create. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 307 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a new list item in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 361 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a new paragraph
al | The new paragraph alignment |
topMargin | The new paragraph topMargin |
bottomMargin | The new paragraph bottomMargin |
leftMargin | The new paragraph leftMargin |
rightMargin | The new paragraph rightMargin |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 176 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a struck out element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 89 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a bold element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 52 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a subscript element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 385 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a superscript element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 373 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a table element.
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. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 397 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a new table cell.
width | The width of the cell. |
colSpan | The column span of the cell. |
rowSpan | The row span of the cell. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 426 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a new table header cell.
width | The width of the cell. |
colSpan | The column span of the cell. |
rowSpan | The row span of the cell. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 415 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin a new table row
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 409 of file texthtmlbuilder.cpp.
|
overridevirtual |
Begin an underlined element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 77 of file texthtmlbuilder.cpp.
|
overridevirtual |
Close the anchor element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 144 of file texthtmlbuilder.cpp.
|
overridevirtual |
Close the decorarated background element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 121 of file texthtmlbuilder.cpp.
|
overridevirtual |
Close the emphasised element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 71 of file texthtmlbuilder.cpp.
|
overridevirtual |
End font family element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 157 of file texthtmlbuilder.cpp.
|
overridevirtual |
End font point size element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 170 of file texthtmlbuilder.cpp.
|
overridevirtual |
Close the decorarated foreground element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 108 of file texthtmlbuilder.cpp.
|
overridevirtual |
End a header element.
level | The new level to end. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 248 of file texthtmlbuilder.cpp.
|
overridevirtual |
Close the list.
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 340 of file texthtmlbuilder.cpp.
|
overridevirtual |
End the list item
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 367 of file texthtmlbuilder.cpp.
|
overridevirtual |
Close the paragraph in the markup.
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 275 of file texthtmlbuilder.cpp.
|
overridevirtual |
Close the struck out element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 95 of file texthtmlbuilder.cpp.
|
overridevirtual |
Close the bold element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 59 of file texthtmlbuilder.cpp.
|
overridevirtual |
End subscript element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 391 of file texthtmlbuilder.cpp.
|
overridevirtual |
End superscript element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 379 of file texthtmlbuilder.cpp.
|
overridevirtual |
End a table element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 437 of file texthtmlbuilder.cpp.
|
overridevirtual |
End a table cell
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 455 of file texthtmlbuilder.cpp.
|
overridevirtual |
End a table header cell
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 449 of file texthtmlbuilder.cpp.
|
overridevirtual |
End a table row
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 443 of file texthtmlbuilder.cpp.
|
overridevirtual |
Close the underlined element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 83 of file texthtmlbuilder.cpp.
|
overridevirtual |
Return the fully marked up result of the building process.
This may contain metadata etc, such as a head element in html.
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 473 of file texthtmlbuilder.cpp.
|
overridevirtual |
Insert a horizontal rule into the markup.
width | The width of the rule. Default is full width. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 287 of file texthtmlbuilder.cpp.
|
overridevirtual |
Insert a new image element into the markup.
url | The url of the image |
width | The width of the image |
height | The height of the image. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 296 of file texthtmlbuilder.cpp.