• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.9.4 API Reference
  • KDE Home
  • Contact Us
 

kpimtextedit/richtextbuilders

Public Member Functions | Protected Member Functions | List of all members
KMarkupDirector Class Reference

#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.
Author
Stephen Kelly steve.nosp@m.ire@.nosp@m.gmail.nosp@m..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
blockThe 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
blockThe 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
fragmentThe 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
blockThe 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
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue Dec 11 2012 12:13:25 by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kpimtextedit/richtextbuilders

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

kdepimlibs-4.9.4 API Reference

Skip menu "kdepimlibs-4.9.4 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal