• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

kpimidentities/richtextbuilders

KMarkupDirector Class Reference

The Markupdirector class controls and instructs a builder object to create markup output. More...

#include <kmarkupdirector.h>

List of all members.


Public Member Functions

virtual void constructContent (QTextDocument *doc)
 KMarkupDirector (KAbstractMarkupBuilder *builder)
virtual ~KMarkupDirector ()

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.
Author:
Stephen Kelly <steveire@gmail.com>
Since:
4.2

Definition at line 68 of file kmarkupdirector.h.


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:
  • kmarkupdirector.h
  • kmarkupdirector.cpp

kpimidentities/richtextbuilders

Skip menu "kpimidentities/richtextbuilders"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.7.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal