Grantlee  0.4.0
Public Member Functions | List of all members
Grantlee::BBCodeBuilder Class Reference

Builder to create BBCode from a QTextDocument. More...

#include <bbcodebuilder.h>

Inheritance diagram for Grantlee::BBCodeBuilder:
Inheritance graph
[legend]

Public Member Functions

 BBCodeBuilder ()
 
void addNewline ()
 
void appendLiteralText (const QString &text)
 
void beginAnchor (const QString &href=QString(), const QString &name=QString())
 
void beginEmph ()
 
void beginFontPointSize (int size)
 
void beginForeground (const QBrush &brush)
 
void beginList (QTextListFormat::Style type)
 
void beginListItem ()
 
void beginParagraph (Qt::Alignment a=Qt::AlignLeft, qreal top=0.0, qreal bottom=0.0, qreal left=0.0, qreal right=0.0)
 
void beginStrikeout ()
 
void beginStrong ()
 
void beginSubscript ()
 
void beginSuperscript ()
 
void beginTable (qreal, qreal, const QString &)
 
void beginTableRow ()
 
void beginUnderline ()
 
void endAnchor ()
 
void endEmph ()
 
void endFontPointSize ()
 
void endForeground ()
 
void endList ()
 
void endParagraph ()
 
void endStrikeout ()
 
void endStrong ()
 
void endSubscript ()
 
void endSuperscript ()
 
void endUnderline ()
 
const QString escape (const QString &text) const
 
QString getResult ()
 
void insertImage (const QString &src, qreal width, qreal height)
 
- Public Member Functions inherited from Grantlee::AbstractMarkupBuilder
virtual ~AbstractMarkupBuilder ()
 
virtual void appendRawText (const QString &text)=0
 
virtual void beginBackground (const QBrush &brush)=0
 
virtual void beginFontFamily (const QString &family)=0
 
virtual void beginHeader (int level)=0
 
virtual void beginTableCell (const QString &width, int colSpan, int rowSpan)=0
 
virtual void beginTableHeaderCell (const QString &width, int colSpan, int rowSpan)=0
 
virtual void endBackground ()=0
 
virtual void endFontFamily ()=0
 
virtual void endHeader (int level)=0
 
virtual void endListItem ()=0
 
virtual void endTable ()=0
 
virtual void endTableCell ()=0
 
virtual void endTableHeaderCell ()=0
 
virtual void endTableRow ()=0
 
virtual void insertHorizontalRule (int width=-1)=0
 

Detailed Description

Definition at line 32 of file bbcodebuilder.h.

Constructor & Destructor Documentation

Grantlee::BBCodeBuilder::BBCodeBuilder ( )

Creates a new BBCodeBuilder.

Member Function Documentation

void Grantlee::BBCodeBuilder::addNewline ( )
virtual

Add a newline to the markup.

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::appendLiteralText ( const QString &  text)
virtual

Append the plain text text to the markup.

Parameters
textThe text to append.

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginAnchor ( const QString &  href = QString(),
const QString &  name = QString() 
)
virtual

Begin a url anchor element in the markup

Parameters
hrefThe href of the anchor.
nameThe name of the anchor.

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginEmph ( )
virtual

Begin an emphasised element in the markup

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginFontPointSize ( int  size)
virtual

Begin an element of font size size. Note that this size is in pixels, and must be converted before it is suitable for use in BBCode.

Parameters
sizeThe size of font to begin.

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginForeground ( const QBrush &  brush)
virtual

Begin a decorarated foreground element in the markup (A text color) using brush

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::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
styleThe style of list to create.

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginListItem ( )
virtual

Begin a new list item in the markup

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginParagraph ( Qt::Alignment  a = Qt::AlignLeft,
qreal  top = 0.0,
qreal  bottom = 0.0,
qreal  left = 0.0,
qreal  right = 0.0 
)
virtual

Begin a new paragraph in the markup

Parameters
aThe alignment of the new paragraph.
topThe top margin of the new paragraph.
bottomThe bottom margin of the new paragraph.
leftThe left margin of the new paragraph.
rightThe right margin of the new paragraph.

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginStrikeout ( )
virtual

Begin a struck out element in the markup

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginStrong ( )
virtual

Begin a bold element in the markup

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginSubscript ( )
virtual

Begin a subscript element

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginSuperscript ( )
virtual

Begin a superscript element

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginTable ( qreal  cellpadding,
qreal  cellspacing,
const QString &  width 
)
virtual

Begin a table element.

Parameters
cellpaddingThe padding attribute for the table.
cellspacingThe spacing attribute for the table.
widthThe width of the table. May be either an integer, or a percentage value.

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginTableRow ( )
virtual

Begins a new table row.

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::beginUnderline ( )
virtual

Begin an underlined element in the markup

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::endAnchor ( )
virtual

Close the anchor element

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::endEmph ( )
virtual

Close the emphasised element in the markup

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::endFontPointSize ( )
virtual

End font point size element

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::endForeground ( )
virtual

Close the decorarated foreground element in the markup

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::endList ( )
virtual

Close the list.

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::endParagraph ( )
virtual

Close the paragraph in the markup.

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::endStrikeout ( )
virtual

Close the struck out element in the markup

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::endStrong ( )
virtual

Close the bold element in the markup

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::endSubscript ( )
virtual

End subscript element

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::endSuperscript ( )
virtual

End superscript element

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::endUnderline ( )
virtual

Close the underlined element in the markup

Implements Grantlee::AbstractMarkupBuilder.

const QString Grantlee::BBCodeBuilder::escape ( const QString &  text) const

Escapes text appropriately for BBCode.

QString Grantlee::BBCodeBuilder::getResult ( )
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.

Implements Grantlee::AbstractMarkupBuilder.

void Grantlee::BBCodeBuilder::insertImage ( const QString &  url,
qreal  width,
qreal  height 
)
virtual

Insert a new image element into the markup.

Parameters
urlThe url of the image
widthThe width of the image
heightThe height of the image.

Implements Grantlee::AbstractMarkupBuilder.