2012-08-09 11:10:55 +02:00
|
|
|
|
2014-05-27 23:22:50 +02:00
|
|
|
/**Abstract base class for composer entries with the ability to distribute the content to several frames (items)*/
|
2014-07-10 20:17:42 +10:00
|
|
|
class QgsComposerMultiFrame: QgsComposerObject
|
2012-08-09 11:10:55 +02:00
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgscomposermultiframe.h"
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
public:
|
2012-08-09 11:10:55 +02:00
|
|
|
|
|
|
|
enum ResizeMode
|
|
|
|
{
|
2014-06-02 21:00:51 +02:00
|
|
|
UseExistingFrames,
|
2012-08-17 13:47:03 +02:00
|
|
|
ExtendToNextPage, //uses the next page(s) until the content has been printed
|
|
|
|
RepeatOnEveryPage, //repeats the same frame on every page
|
|
|
|
RepeatUntilFinished //duplicates last frame to next page to fit the total size
|
2012-08-09 11:10:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2014-05-07 07:54:07 +10:00
|
|
|
/**Finds the optimal position to break a frame at.
|
|
|
|
* @param yPos maximum 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*/
|
|
|
|
virtual double findNearbyPageBreak( double yPos );
|
2014-05-27 23:22:50 +02:00
|
|
|
|
2012-08-09 11:10:55 +02:00
|
|
|
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 );
|
|
|
|
|
|
|
|
QgsComposition* composition();
|
|
|
|
|
|
|
|
bool createUndoCommands() const;
|
|
|
|
void setCreateUndoCommands( bool enabled );
|
|
|
|
|
|
|
|
/**Removes and deletes all frames from mComposition*/
|
|
|
|
void deleteFrames();
|
|
|
|
|
2012-09-19 17:15:39 +02:00
|
|
|
/** Return the number of frames associated with this multiframeset.
|
2014-01-27 09:22:24 +01:00
|
|
|
@note added in 2.0, replaces nFrames
|
2012-09-19 17:15:39 +02:00
|
|
|
**/
|
|
|
|
int frameCount() const;
|
2012-08-24 11:46:25 +02:00
|
|
|
QgsComposerFrame* frame( int i );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2014-05-07 07:54:07 +10:00
|
|
|
/**Creates a new frame and adds it to the multi frame and composition.
|
|
|
|
* @param currentFrame an existing QgsComposerFrame from which to copy the size
|
|
|
|
* and general frame properties (eg frame style, background, rendering settings).
|
|
|
|
* @param pos position of top-left corner of the new frame
|
|
|
|
* @param size size of the new frame
|
|
|
|
* @returns new QgsComposerFrame
|
|
|
|
* @note added in version 2.3
|
|
|
|
*/
|
2014-05-27 23:22:50 +02:00
|
|
|
QgsComposerFrame* createNewFrame( QgsComposerFrame* currentFrame, QPointF pos, QSizeF size );
|
2014-05-07 07:54:07 +10:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
/**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.
|
2014-05-27 23:22:50 +02:00
|
|
|
*/
|
2012-09-24 02:28:15 +02:00
|
|
|
void recalculateFrameSizes();
|
2014-05-07 07:54:07 +10:00
|
|
|
|
2014-05-27 23:22:50 +02:00
|
|
|
protected slots:
|
2012-09-24 02:28:15 +02:00
|
|
|
/**Called before a frame is going to be removed (update frame list)*/
|
|
|
|
void handleFrameRemoval( QgsComposerItem* item );
|
|
|
|
/**Adapts to changed number of pages if resize type is RepeatOnEveryPage*/
|
|
|
|
void handlePageChange();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void changed();
|
2012-08-17 13:47:03 +02:00
|
|
|
};
|