QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Attributes | Private Member Functions | Private Attributes | List of all members
QgsComposerMultiFrame Class Referenceabstract

Abstract base class for composer entries with the ability to distribute the content to several frames (items) More...

#include <qgscomposermultiframe.h>

Inheritance diagram for QgsComposerMultiFrame:
Inheritance graph
[legend]
Collaboration diagram for QgsComposerMultiFrame:
Collaboration graph
[legend]

Public Types

enum  ResizeMode { UseExistingFrames = 0, ExtendToNextPage, RepeatOnEveryPage, RepeatUntilFinished }
 

Public Slots

void recalculateFrameSizes ()
 Recalculates the portion of the multiframe item which is shown in each of it's component frames. More...
 

Signals

void changed ()
 

Public Member Functions

 QgsComposerMultiFrame (QgsComposition *c, bool createUndoCommands)
 
virtual ~QgsComposerMultiFrame ()
 
virtual QSizeF totalSize () const =0
 
virtual void render (QPainter *p, const QRectF &renderExtent)=0
 
virtual void addFrame (QgsComposerFrame *frame, bool recalcFrameSizes=true)=0
 
virtual double findNearbyPageBreak (double yPos)
 Finds the optimal position to break a frame at. More...
 
void removeFrame (int i)
 
void update ()
 
void setResizeMode (ResizeMode mode)
 
ResizeMode resizeMode () const
 
virtual bool writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const =0
 
bool _writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const
 
virtual bool readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false)=0
 
bool _readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false)
 
QgsCompositioncomposition ()
 
bool createUndoCommands () const
 
void setCreateUndoCommands (bool enabled)
 
void deleteFrames ()
 Removes and deletes all frames from mComposition. More...
 
int frameCount () const
 Return the number of frames associated with this multiframeset. More...
 
QgsComposerFrameframe (int i) const
 
QgsComposerFramecreateNewFrame (QgsComposerFrame *currentFrame, QPointF pos, QSizeF size)
 Creates a new frame and adds it to the multi frame and composition. More...
 

Protected Slots

void handleFrameRemoval (QgsComposerItem *item)
 Called before a frame is going to be removed (update frame list) More...
 
void handlePageChange ()
 Adapts to changed number of pages if resize type is RepeatOnEveryPage. More...
 

Protected Attributes

QgsCompositionmComposition
 
QList< QgsComposerFrame * > mFrameItems
 
ResizeMode mResizeMode
 
bool mCreateUndoCommands
 True: creates QgsMultiFrameCommands on internal changes (e.g. More...
 

Private Member Functions

 QgsComposerMultiFrame ()
 

Private Attributes

bool mIsRecalculatingSize
 

Detailed Description

Abstract base class for composer entries with the ability to distribute the content to several frames (items)

Definition at line 32 of file qgscomposermultiframe.h.

Member Enumeration Documentation

Enumerator
UseExistingFrames 
ExtendToNextPage 
RepeatOnEveryPage 
RepeatUntilFinished 

Definition at line 37 of file qgscomposermultiframe.h.

Constructor & Destructor Documentation

QgsComposerMultiFrame::QgsComposerMultiFrame ( QgsComposition c,
bool  createUndoCommands 
)
QgsComposerMultiFrame::~QgsComposerMultiFrame ( )
virtual

Definition at line 38 of file qgscomposermultiframe.cpp.

References deleteFrames().

QgsComposerMultiFrame::QgsComposerMultiFrame ( )
private

Definition at line 31 of file qgscomposermultiframe.cpp.

Member Function Documentation

bool QgsComposerMultiFrame::_readXML ( const QDomElement &  itemElem,
const QDomDocument &  doc,
bool  ignoreFrames = false 
)
bool QgsComposerMultiFrame::_writeXML ( QDomElement &  elem,
QDomDocument &  doc,
bool  ignoreFrames = false 
) const

Definition at line 305 of file qgscomposermultiframe.cpp.

References mFrameItems, and mResizeMode.

Referenced by QgsComposerHtml::writeXML().

virtual void QgsComposerMultiFrame::addFrame ( QgsComposerFrame frame,
bool  recalcFrameSizes = true 
)
pure virtual

Implemented in QgsComposerHtml.

Referenced by _readXML(), createNewFrame(), and handlePageChange().

void QgsComposerMultiFrame::changed ( )
signal
QgsComposition* QgsComposerMultiFrame::composition ( )
inline

Definition at line 72 of file qgscomposermultiframe.h.

QgsComposerFrame * QgsComposerMultiFrame::createNewFrame ( QgsComposerFrame currentFrame,
QPointF  pos,
QSizeF  size 
)

Creates a new frame and adds it to the multi frame and composition.

Parameters
currentFramean existing QgsComposerFrame from which to copy the size and general frame properties (eg frame style, background, rendering settings).
posposition of top-left corner of the new frame
sizesize of the new frame
Returns
new QgsComposerFrame
Note
added in version 2.3

Definition at line 163 of file qgscomposermultiframe.cpp.

References addFrame(), QgsComposerItem::backgroundColor(), QgsComposerItem::blendMode(), QgsComposerItem::frameJoinStyle(), QgsComposerItem::frameOutlineWidth(), QgsComposerItem::hasBackground(), QgsComposerItem::hasFrame(), mComposition, QgsComposerItem::setBackgroundColor(), QgsComposerItem::setBackgroundEnabled(), QgsComposerItem::setBlendMode(), QgsComposerItem::setFrameEnabled(), QgsComposerItem::setFrameJoinStyle(), and QgsComposerItem::setFrameOutlineWidth().

Referenced by recalculateFrameSizes().

bool QgsComposerMultiFrame::createUndoCommands ( ) const
inline

Definition at line 74 of file qgscomposermultiframe.h.

void QgsComposerMultiFrame::deleteFrames ( )

Removes and deletes all frames from mComposition.

Definition at line 280 of file qgscomposermultiframe.cpp.

References handleFrameRemoval(), mComposition, mFrameItems, mResizeMode, QgsComposition::removeComposerItem(), and UseExistingFrames.

Referenced by QgsComposerHtml::readXML(), and ~QgsComposerMultiFrame().

virtual double QgsComposerMultiFrame::findNearbyPageBreak ( double  yPos)
inlinevirtual

Finds the optimal position to break a frame at.

Parameters
yPosmaximum vertical position for break
Returns
the optimal breakable position which occurs in the multi frame close to and before the specified yPos
Note
added in version 2.3

Reimplemented in QgsComposerHtml.

Definition at line 57 of file qgscomposermultiframe.h.

Referenced by recalculateFrameSizes().

QgsComposerFrame * QgsComposerMultiFrame::frame ( int  i) const

Definition at line 296 of file qgscomposermultiframe.cpp.

References mFrameItems.

Referenced by handleFrameRemoval(), and handlePageChange().

int QgsComposerMultiFrame::frameCount ( ) const
inline

Return the number of frames associated with this multiframeset.

Note
added in 2.0, replaces nFrames

Definition at line 83 of file qgscomposermultiframe.h.

Referenced by QgsComposerHtml::loadHtml(), and QgsComposition::removeComposerItem().

void QgsComposerMultiFrame::handleFrameRemoval ( QgsComposerItem item)
protectedslot

Called before a frame is going to be removed (update frame list)

Definition at line 187 of file qgscomposermultiframe.cpp.

References changed(), frame(), index, mFrameItems, mIsRecalculatingSize, mResizeMode, recalculateFrameSizes(), RepeatOnEveryPage, resizeMode(), and UseExistingFrames.

Referenced by deleteFrames(), and QgsComposerHtml::QgsComposerHtml().

void QgsComposerMultiFrame::handlePageChange ( )
protectedslot
virtual bool QgsComposerMultiFrame::readXML ( const QDomElement &  itemElem,
const QDomDocument &  doc,
bool  ignoreFrames = false 
)
pure virtual
void QgsComposerMultiFrame::recalculateFrameSizes ( )
slot

Recalculates the portion of the multiframe item which is shown in each of it's component frames.

If the resize mode is set to anything but UseExistingFrames then this may cause new frames to be added or frames to be removed, in order to fit the current size of the multiframe's content.

Definition at line 53 of file qgscomposermultiframe.cpp.

References createNewFrame(), ExtendToNextPage, findNearbyPageBreak(), mComposition, mFrameItems, mResizeMode, QgsComposition::numPages(), QgsComposition::paperHeight(), removeFrame(), RepeatOnEveryPage, RepeatUntilFinished, QgsComposerFrame::setContentSection(), QgsComposition::setNumPages(), size, QgsComposition::spaceBetweenPages(), totalSize(), and UseExistingFrames.

Referenced by QgsComposerHtml::addFrame(), handleFrameRemoval(), handlePageChange(), QgsComposerHtml::loadHtml(), QgsComposerHtml::setMaxBreakDistance(), setResizeMode(), and QgsComposerHtml::setUseSmartBreaks().

void QgsComposerMultiFrame::removeFrame ( int  i)
virtual void QgsComposerMultiFrame::render ( QPainter *  p,
const QRectF &  renderExtent 
)
pure virtual

Implemented in QgsComposerHtml.

Referenced by QgsComposerFrame::paint().

ResizeMode QgsComposerMultiFrame::resizeMode ( ) const
inline

Definition at line 64 of file qgscomposermultiframe.h.

Referenced by handleFrameRemoval().

void QgsComposerMultiFrame::setCreateUndoCommands ( bool  enabled)
inline

Definition at line 75 of file qgscomposermultiframe.h.

Referenced by QgsComposition::addItemsFromXML().

void QgsComposerMultiFrame::setResizeMode ( ResizeMode  mode)

Definition at line 43 of file qgscomposermultiframe.cpp.

References changed(), mResizeMode, and recalculateFrameSizes().

virtual QSizeF QgsComposerMultiFrame::totalSize ( ) const
pure virtual

Implemented in QgsComposerHtml.

Referenced by recalculateFrameSizes().

void QgsComposerMultiFrame::update ( )

Definition at line 271 of file qgscomposermultiframe.cpp.

References mFrameItems.

Referenced by handlePageChange().

virtual bool QgsComposerMultiFrame::writeXML ( QDomElement &  elem,
QDomDocument &  doc,
bool  ignoreFrames = false 
) const
pure virtual

Member Data Documentation

QgsComposition* QgsComposerMultiFrame::mComposition
protected
bool QgsComposerMultiFrame::mCreateUndoCommands
protected

True: creates QgsMultiFrameCommands on internal changes (e.g.

changing frames )

Definition at line 110 of file qgscomposermultiframe.h.

QList<QgsComposerFrame*> QgsComposerMultiFrame::mFrameItems
protected
bool QgsComposerMultiFrame::mIsRecalculatingSize
private

Definition at line 121 of file qgscomposermultiframe.h.

Referenced by handleFrameRemoval(), and removeFrame().

ResizeMode QgsComposerMultiFrame::mResizeMode
protected

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