KPIMTextEdit::AbstractMarkupBuilder Class
class KPIMTextEdit::AbstractMarkupBuilderInterface for creating marked-up text output. More...
| Header: | #include <KPIMTextEdit/AbstractMarkupBuilder> |
| CMake: | find_package(KPim6TextEdit REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::TextEdit) |
| Inherited By: | KPIMTextEdit::PlainTextMarkupBuilder and KPIMTextEdit::TextHTMLBuilder |
Public Functions
| virtual | ~AbstractMarkupBuilder() |
| virtual void | addNewline() = 0 |
| virtual void | addSingleBreakLine() = 0 |
| virtual void | appendLiteralText(const QString &text) = 0 |
| virtual void | appendRawText(const QString &text) = 0 |
| virtual void | beginAnchor(const QString &href = {}, const QString &name = {}) = 0 |
| virtual void | beginBackground(const QBrush &brush) = 0 |
| virtual void | beginEmph() = 0 |
| virtual void | beginFontFamily(const QString &family) = 0 |
| virtual void | beginFontPointSize(int size) = 0 |
| virtual void | beginForeground(const QBrush &brush) = 0 |
| virtual void | beginHeader(int level) = 0 |
| virtual void | beginList(QTextListFormat::Style style, int start) = 0 |
| virtual void | beginListItem(QTextBlockFormat::MarkerType type) = 0 |
| virtual void | beginParagraph(Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0, qreal bottom = 0.0, qreal left = 0.0, qreal right = 0.0, bool rightToLeftText = false) = 0 |
| virtual void | beginStrikeout() = 0 |
| virtual void | beginStrong() = 0 |
| virtual void | beginSubscript() = 0 |
| virtual void | beginSuperscript() = 0 |
| virtual void | beginTable(const QTextTableFormat &format) = 0 |
| virtual void | beginTableCell(const QTextTableCellFormat &format, const QTextLength &width) = 0 |
| virtual void | beginTableHeaderCell(const QTextTableCellFormat &format, const QTextLength &width) = 0 |
| virtual void | beginTableRow() = 0 |
| virtual void | beginUnderline() = 0 |
| virtual void | endAnchor() = 0 |
| virtual void | endBackground() = 0 |
| virtual void | endEmph() = 0 |
| virtual void | endFontFamily() = 0 |
| virtual void | endFontPointSize() = 0 |
| virtual void | endForeground() = 0 |
| virtual void | endHeader(int level) = 0 |
| virtual void | endList() = 0 |
| virtual void | endListItem() = 0 |
| virtual void | endParagraph() = 0 |
| virtual void | endStrikeout() = 0 |
| virtual void | endStrong() = 0 |
| virtual void | endSubscript() = 0 |
| virtual void | endSuperscript() = 0 |
| virtual void | endTable() = 0 |
| virtual void | endTableCell() = 0 |
| virtual void | endTableHeaderCell() = 0 |
| virtual void | endTableRow() = 0 |
| virtual void | endUnderline() = 0 |
| virtual QString | getResult() = 0 |
| virtual void | insertHorizontalRule(const QTextLength &width = {}) = 0 |
| virtual void | insertImage(const QString &url, qreal width, qreal height) = 0 |
Detailed Description
The AbstractMarkupBuilder is used by a MarkupDirector to create marked-up output such as html or markdown.
See PlainTextMarkupBuilder and TextHTMLBuilder for example implementations.
This interface can be extended to handle custom format types in a QTextDocument.
Author: Stephen Kelly <steveire@gmail.com>
Member Function Documentation
[virtual constexpr noexcept default] AbstractMarkupBuilder::~AbstractMarkupBuilder()
Destructor
[pure virtual] void AbstractMarkupBuilder::addNewline()
Add a newline to the markup.
[pure virtual] void AbstractMarkupBuilder::addSingleBreakLine()
Add a single line break to the markup.
[pure virtual] void AbstractMarkupBuilder::appendLiteralText(const QString &text)
Append the plain text text to the markup
text The text to append.
[pure virtual] void AbstractMarkupBuilder::appendRawText(const QString &text)
Append the raw text text to the markup. text is added unescaped
[pure virtual] void AbstractMarkupBuilder::beginAnchor(const QString &href = {}, const QString &name = {})
Begin a url anchor element in the markup href The href of the anchor. name The name of the anchor.
[pure virtual] void AbstractMarkupBuilder::beginBackground(const QBrush &brush)
Begin a decorarated background element in the markup (A text background color) using brush
[pure virtual] void AbstractMarkupBuilder::beginEmph()
Begin an emphasised element in the markup
[pure virtual] void AbstractMarkupBuilder::beginFontFamily(const QString &family)
Begin a new font family element in the markup family The name of the font family to begin.
[pure virtual] void AbstractMarkupBuilder::beginFontPointSize(int size)
Begin a new font point size element in the markup size The point size to begin.
[pure virtual] void AbstractMarkupBuilder::beginForeground(const QBrush &brush)
Begin a decorarated foreground element in the markup (A text color) using brush
[pure virtual] void AbstractMarkupBuilder::beginHeader(int level)
Begin a level level header level An integer between 1 and 6
[pure virtual] void AbstractMarkupBuilder::beginList(QTextListFormat::Style style, int start)
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. start The number of the first item of an ordered list. It is one based, and 1 for a list which is not renumbered.
[pure virtual] void AbstractMarkupBuilder::beginListItem(QTextBlockFormat::MarkerType type)
Begin a new list item of type type in the markup
[pure virtual] void AbstractMarkupBuilder::beginParagraph(Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0, qreal bottom = 0.0, qreal left = 0.0, qreal right = 0.0, bool rightToLeftText = false)
Begin a new paragraph in the markup 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. rightToLeftText Whether the text direction of the paragraph is right-to-left.
[pure virtual] void AbstractMarkupBuilder::beginStrikeout()
Begin a struck out element in the markup
[pure virtual] void AbstractMarkupBuilder::beginStrong()
Begin a bold element in the markup
[pure virtual] void AbstractMarkupBuilder::beginSubscript()
Begin a subscript element
[pure virtual] void AbstractMarkupBuilder::beginSuperscript()
Begin a superscript element
[pure virtual] void AbstractMarkupBuilder::beginTable(const QTextTableFormat &format)
Begin a table element.
format The format of the table, holding the cell padding, the cell spacing, the width and the border of the table.
[pure virtual] void AbstractMarkupBuilder::beginTableCell(const QTextTableCellFormat &format, const QTextLength &width)
Begin a new table cell.
format The format of the cell, holding the column and row spans, the padding, the borders and the background of the cell. width The width of the column the cell belongs to. The width is a constraint of the table, not of the cell, hence it is passed separately.
[pure virtual] void AbstractMarkupBuilder::beginTableHeaderCell(const QTextTableCellFormat &format, const QTextLength &width)
Begin a new table header cell.
format The format of the cell, holding the column and row spans, the padding, the borders and the background of the cell. width The width of the column the cell belongs to. The width is a constraint of the table, not of the cell, hence it is passed separately.
[pure virtual] void AbstractMarkupBuilder::beginTableRow()
Begin a new table row
[pure virtual] void AbstractMarkupBuilder::beginUnderline()
Begin an underlined element in the markup
[pure virtual] void AbstractMarkupBuilder::endAnchor()
Close the anchor element
[pure virtual] void AbstractMarkupBuilder::endBackground()
Close the decorarated background element in the markup
[pure virtual] void AbstractMarkupBuilder::endEmph()
Close the emphasised element in the markup
[pure virtual] void AbstractMarkupBuilder::endFontFamily()
End font family element
[pure virtual] void AbstractMarkupBuilder::endFontPointSize()
End font point size element
[pure virtual] void AbstractMarkupBuilder::endForeground()
Close the decorarated foreground element in the markup
[pure virtual] void AbstractMarkupBuilder::endHeader(int level)
End a level level header level An integer between 1 and 6
[pure virtual] void AbstractMarkupBuilder::endList()
Close the list.
[pure virtual] void AbstractMarkupBuilder::endListItem()
End the list item
[pure virtual] void AbstractMarkupBuilder::endParagraph()
Close the paragraph in the markup.
[pure virtual] void AbstractMarkupBuilder::endStrikeout()
Close the struck out element in the markup
[pure virtual] void AbstractMarkupBuilder::endStrong()
Close the bold element in the markup
[pure virtual] void AbstractMarkupBuilder::endSubscript()
End subscript element
[pure virtual] void AbstractMarkupBuilder::endSuperscript()
End superscript element
[pure virtual] void AbstractMarkupBuilder::endTable()
End a table element
[pure virtual] void AbstractMarkupBuilder::endTableCell()
End a table cell
[pure virtual] void AbstractMarkupBuilder::endTableHeaderCell()
End a table header cell
[pure virtual] void AbstractMarkupBuilder::endTableRow()
End a table row
[pure virtual] void AbstractMarkupBuilder::endUnderline()
Close the underlined element in the markup
[pure virtual] QString AbstractMarkupBuilder::getResult()
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.
[pure virtual] void AbstractMarkupBuilder::insertHorizontalRule(const QTextLength &width = {})
Insert a horizontal rule into the markup. width The width of the rule. Default is full width.
[pure virtual] void AbstractMarkupBuilder::insertImage(const QString &url, qreal width, qreal height)
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.