kpimtextedit/richtextbuilders
#include <kmarkupdirector.h>
Public Member Functions | |
KMarkupDirector (KAbstractMarkupBuilder *builder) | |
virtual | ~KMarkupDirector () |
virtual void | constructContent (QTextDocument *doc) |
Protected Member Functions | |
void | processBlock (const QTextBlock &block) |
void | processBlockContents (const QTextBlock &block) |
void | processDocumentContents (QTextFrame::iterator start, QTextFrame::iterator end) |
void | processFragment (const QTextFragment &fragment) |
void | processFrame (QTextFrame *frame) |
void | processList (const QTextBlock &block) |
void | processTable (QTextTable *table) |
void | processTableCell (const QTextTableCell &cell) |
Detailed Description
The Markupdirector class controls and instructs a builder object to create markup output.
The KMarkupDirector is used with a subclass of AbstractMarkupBuilder to create a marked up document output.
Usage can be quite simple.
QTextDocument *doc = editor->document(); // editor is a QTextEdit AbstractMarkupBuilder *builder = new HTMLBuilder(); KMarkupDirector *md = new MarkupDirector(builder); md->constructContent(doc); browser.setHtml(builder->getResult()); // browser is a QTextBrowser.
Or with a different builder:
AbstractMarkupBuilder *builder = new PlainTextMarkupBuilder(); KMarkupDirector *md = new MarkupDirector(builder); md->constructContent(doc); browser.setPlainText(builder->getResult());
- Todo:
- Move this to kdelibs when tested and prooven.
- Since:
- 4.2
Constructor & Destructor Documentation
KMarkupDirector::KMarkupDirector | ( | KAbstractMarkupBuilder * | builder | ) |
Construct a new KMarkupDirector.
Definition at line 44 of file kmarkupdirector.cpp.
KMarkupDirector::~KMarkupDirector | ( | ) | [virtual] |
Destructor.
Definition at line 50 of file kmarkupdirector.cpp.
Member Function Documentation
void KMarkupDirector::constructContent | ( | QTextDocument * | doc | ) | [virtual] |
Constructs the output by directing the builder to create the markup.
Definition at line 374 of file kmarkupdirector.cpp.
void KMarkupDirector::processBlock | ( | const QTextBlock & | block | ) | [protected] |
Process a block.
Note: If block is the first item in a list, the entire (maybe nested) list will be processed. If block is part of a nested list, but is not the first item, it is ignored.
- Parameters:
-
block The block to process.
Definition at line 77 of file kmarkupdirector.cpp.
void KMarkupDirector::processBlockContents | ( | const QTextBlock & | block | ) | [protected] |
Processes the contents of a QTextBlock.
The block is traversed and each QTextFragment is processed individually.
A QTextFragment is a fragment of continuous text with continuous formatting.
Eg, a block of text represented by
Some long <b>formatted paragraph</b> of several pieces <b><i>of decorated</i> text</b> .
would contain the fragments
- Some long
- formatted paragraph
- of several pieces
- of decorated
- text
- Parameters:
-
block The block to process.
Definition at line 244 of file kmarkupdirector.cpp.
void KMarkupDirector::processDocumentContents | ( | QTextFrame::iterator | start, |
QTextFrame::iterator | end | ||
) | [protected] |
Processes the document between the iterators start
and end
inclusive.
Definition at line 55 of file kmarkupdirector.cpp.
void KMarkupDirector::processFragment | ( | const QTextFragment & | fragment | ) | [protected] |
Processes a QTextFragment.
- Parameters:
-
fragment The fragment to process.
void KMarkupDirector::processFrame | ( | QTextFrame * | frame | ) | [protected] |
Processes the frame by iterating over its child frames and blocks and processing them as needed.
Definition at line 72 of file kmarkupdirector.cpp.
void KMarkupDirector::processList | ( | const QTextBlock & | block | ) | [protected] |
Processes a list by iterating over it.
Nested lists are processed by a recursive call.
- Parameters:
-
block The first block in a list.
Definition at line 180 of file kmarkupdirector.cpp.
void KMarkupDirector::processTable | ( | QTextTable * | table | ) | [protected] |
Processes the table by iterating over its rows and columns, processing their contents.
Definition at line 93 of file kmarkupdirector.cpp.
void KMarkupDirector::processTableCell | ( | const QTextTableCell & | cell | ) | [protected] |
Processes the table cell by iterating over its contents.
May contain another table, nested list etc.
Definition at line 175 of file kmarkupdirector.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:08:41 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.