libs/kotext

KoTextDocumentLayout Class Reference

KWords text layouter that allows text to flow in multiple frames and around other KWord objects. More...

#include <KoTextDocumentLayout.h>

Inheritance diagram for KoTextDocumentLayout:

List of all members.

Classes

class  LayoutState
 This inner class is an interface that allows the KoTextDocumentLayout to do rough layout while the LayoutState implementation can do all the boring details. More...
struct  PaintContext
 This struct is a helper for painting of kotext texts. More...

Public Slots

void scheduleLayout ()

Signals

void shapeAdded (KoShape *shape)

Public Member Functions

 KoTextDocumentLayout (QTextDocument *document, KoTextDocumentLayout::LayoutState *layout=0)
virtual ~KoTextDocumentLayout ()
void addShape (KoShape *shape)
virtual QRectF blockBoundingRect (const QTextBlock &block) const
virtual void documentChanged (int position, int charsRemoved, int charsAdded)
virtual QSizeF documentSize () const
void draw (QPainter *painter, const KoTextDocumentLayout::PaintContext &context)
virtual void draw (QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context)
virtual QRectF frameBoundingRect (QTextFrame *frame) const
bool hasLayouter () const
virtual int hitTest (const QPointF &point, Qt::HitTestAccuracy accuracy) const
KoInlineTextObjectManagerinlineTextObjectManager ()
void interruptLayout ()
void layout ()
virtual int pageCount () const
void setInlineTextObjectManager (KoInlineTextObjectManager *manager)
void setLayout (LayoutState *layout)
KoShape * shapeForPosition (int position) const
virtual QList< KoShape * > shapes () const

Protected Member Functions

virtual void drawInlineObject (QPainter *painter, const QRectF &rect, QTextInlineObject object, int position, const QTextFormat &format)
int hitTestIterated (QTextFrame::iterator begin, QTextFrame::iterator end, const QPointF &point, Qt::HitTestAccuracy accuracy) const
virtual void positionInlineObject (QTextInlineObject item, int position, const QTextFormat &format)
virtual void relayout ()
virtual void resizeInlineObject (QTextInlineObject item, int position, const QTextFormat &format)
void scheduleLayoutWithoutInterrupt ()

Protected Attributes

LayoutStatem_state

Detailed Description

KWords text layouter that allows text to flow in multiple frames and around other KWord objects.

Definition at line 43 of file KoTextDocumentLayout.h.


Constructor & Destructor Documentation

KoTextDocumentLayout::KoTextDocumentLayout ( QTextDocument document,
KoTextDocumentLayout::LayoutState layout = 0 
) [explicit]

constructor

Definition at line 117 of file KoTextDocumentLayout.cpp.

KoTextDocumentLayout::~KoTextDocumentLayout (  )  [virtual]

Definition at line 128 of file KoTextDocumentLayout.cpp.


Member Function Documentation

void KoTextDocumentLayout::addShape ( KoShape *  shape  ) 

Add a shape to the list of shapes that the text can run into.

Definition at line 152 of file KoTextDocumentLayout.cpp.

QRectF KoTextDocumentLayout::blockBoundingRect ( const QTextBlock block  )  const [virtual]

Returns the bounding rectangle of block.

Definition at line 174 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::documentChanged ( int  position,
int  charsRemoved,
int  charsAdded 
) [virtual]

reimplemented from QAbstractTextDocumentLayout

Reimplemented from QAbstractTextDocumentLayout.

Definition at line 270 of file KoTextDocumentLayout.cpp.

QSizeF KoTextDocumentLayout::documentSize (  )  const [virtual]

Returns the total size of the document.

This is useful to display widgets since they can use to information to update their scroll bars correctly

Definition at line 182 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::draw ( QPainter painter,
const KoTextDocumentLayout::PaintContext context 
)

Draws the layout on the given painter with the given context, and pass the zoom.

Definition at line 196 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::draw ( QPainter painter,
const QAbstractTextDocumentLayout::PaintContext &  context 
) [virtual]

Draws the layout on the given painter with the given context.

Definition at line 189 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::drawInlineObject ( QPainter painter,
const QRectF rect,
QTextInlineObject  object,
int  position,
const QTextFormat format 
) [protected, virtual]

reimplemented

Reimplemented from QAbstractTextDocumentLayout.

Definition at line 312 of file KoTextDocumentLayout.cpp.

QRectF KoTextDocumentLayout::frameBoundingRect ( QTextFrame frame  )  const [virtual]

Returns the bounding rectacle of frame. Returns the bounding rectangle of frame.

Definition at line 201 of file KoTextDocumentLayout.cpp.

bool KoTextDocumentLayout::hasLayouter (  )  const

return if this document layout has a proper layoutState object.

Definition at line 143 of file KoTextDocumentLayout.cpp.

int KoTextDocumentLayout::hitTest ( const QPointF point,
Qt::HitTestAccuracy  accuracy 
) const [virtual]

Returns the cursor postion for the given point with the accuracy specified.

Returns -1 to indicate failure if no valid cursor position was found.

Parameters:
point the point in the document
accuracy if Qt::ExactHit this method will return -1 when not actaully hitting any text

Definition at line 209 of file KoTextDocumentLayout.cpp.

int KoTextDocumentLayout::hitTestIterated ( QTextFrame::iterator  begin,
QTextFrame::iterator  end,
const QPointF point,
Qt::HitTestAccuracy  accuracy 
) const [protected]

same as hitTest but for a range specified by an iterator

Definition at line 215 of file KoTextDocumentLayout.cpp.

KoInlineTextObjectManager * KoTextDocumentLayout::inlineTextObjectManager (  ) 

return the currently set manager, or 0 if none is set.

Definition at line 169 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::interruptLayout (  ) 

stop layouting the text document until manually restarted.

Definition at line 368 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::layout (  ) 

Actually do the layout of the text.

This method will layout the text into lines and shapes, chunk by chunk. It will return quite quick and have requested for another layout if its unfinished.

Definition at line 373 of file KoTextDocumentLayout.cpp.

int KoTextDocumentLayout::pageCount (  )  const [virtual]

reimplemented to always return 1

Definition at line 265 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::positionInlineObject ( QTextInlineObject  item,
int  position,
const QTextFormat format 
) [protected, virtual]

reimplemented

Reimplemented from QAbstractTextDocumentLayout.

Definition at line 323 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::relayout (  )  [protected, virtual]

make sure we start a layout run

Definition at line 363 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::resizeInlineObject ( QTextInlineObject  item,
int  position,
const QTextFormat format 
) [protected, virtual]

reimplemented

Reimplemented from QAbstractTextDocumentLayout.

Definition at line 334 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::scheduleLayout (  )  [slot]

make sure we start a layout run (returns immediately)

Definition at line 355 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::scheduleLayoutWithoutInterrupt (  )  [protected]

make sure we start a layout run (returns immediately) This method keeps the state data and does not interrupt a runnign layout.

Definition at line 347 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::setInlineTextObjectManager ( KoInlineTextObjectManager manager  ) 

Register the manager for inline objects which is needed to notify variables of layout changes.

Definition at line 164 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::setLayout ( LayoutState layout  ) 

set the layoutState for this document layout

Definition at line 136 of file KoTextDocumentLayout.cpp.

void KoTextDocumentLayout::shapeAdded ( KoShape *  shape  )  [signal]
KoShape * KoTextDocumentLayout::shapeForPosition ( int  position  )  const

We allow a text document to be shown in more than one shape; which brings up the need to figure out which shape is used for a certain text.

Parameters:
position the position of the character in the text document we want to locate.
Returns:
the shape the text is laid-out in. Or 0 if there is no shape for that text character.

Definition at line 433 of file KoTextDocumentLayout.cpp.

QList< KoShape * > KoTextDocumentLayout::shapes (  )  const [virtual]

return the list of shapes that will be used to run all the text into.

Definition at line 428 of file KoTextDocumentLayout.cpp.


Member Data Documentation

the currently set LayoutState

Definition at line 210 of file KoTextDocumentLayout.h.


The documentation for this class was generated from the following files: