QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
qgscomposermultiframe.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscomposermultiframe.h
3  ------------------------------------------------------------
4  begin : July 2012
5  copyright : (C) 2012 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSCOMPOSERMULTIFRAME_H
17 #define QGSCOMPOSERMULTIFRAME_H
18 
19 #include "qgscomposerobject.h"
20 #include <QObject>
21 #include <QSizeF>
22 #include <QPointF>
23 
24 class QgsComposerFrame;
25 class QgsComposerItem;
26 class QgsComposition;
27 class QDomDocument;
28 class QDomElement;
29 class QRectF;
30 class QPainter;
31 
39 class CORE_EXPORT QgsComposerMultiFrame: public QgsComposerObject
40 {
41  Q_OBJECT
42 
43  public:
44 
48  {
49  UseExistingFrames = 0,
52  RepeatUntilFinished
54  };
55 
60  QgsComposerMultiFrame( QgsComposition* c, bool createUndoCommands );
61 
62  virtual ~QgsComposerMultiFrame();
63 
67  virtual QSizeF totalSize() const = 0;
68 
79  virtual QSizeF fixedFrameSize( const int frameIndex = -1 ) const { Q_UNUSED( frameIndex ); return QSizeF( 0, 0 ); }
80 
91  virtual QSizeF minFrameSize( const int frameIndex = -1 ) const { Q_UNUSED( frameIndex ); return QSizeF( 0, 0 ); }
92 
98  Q_DECL_DEPRECATED virtual void render( QPainter* p, const QRectF& renderExtent );
99 
106  virtual void render( QPainter* painter, const QRectF& renderExtent, const int frameIndex );
107 
113  virtual void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true ) = 0;
114 
121  virtual double findNearbyPageBreak( double yPos ) { return yPos; }
122 
129  void removeFrame( int i );
130 
134  void deleteFrames();
135 
140  void setResizeMode( ResizeMode mode );
141 
146  ResizeMode resizeMode() const { return mResizeMode; }
147 
155  virtual bool writeXML( QDomElement& elem, QDomDocument & doc, bool ignoreFrames = false ) const = 0;
156 
164  bool _writeXML( QDomElement& elem, QDomDocument& doc, bool ignoreFrames = false ) const;
165 
173  virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false ) = 0;
174 
182  bool _readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false );
183 
188 
193  bool createUndoCommands() const { return mCreateUndoCommands; }
194 
199  void setCreateUndoCommands( bool enabled ) { mCreateUndoCommands = enabled; }
200 
205  int frameCount() const { return mFrameItems.size(); }
206 
212  QgsComposerFrame* frame( int i ) const;
213 
220  int frameIndex( QgsComposerFrame *frame ) const;
221 
230  QgsComposerFrame* createNewFrame( QgsComposerFrame* currentFrame, QPointF pos, QSizeF size );
231 
236  virtual QString displayName() const;
237 
238  public slots:
239 
242  void update();
243 
250  virtual void recalculateFrameSizes();
251 
260  void recalculateFrameRects();
261 
262  signals:
263 
267  void changed();
268 
272  void contentsChanged();
273 
274  protected:
275 
276  QList<QgsComposerFrame*> mFrameItems;
277 
279 
282 
283  protected slots:
284 
288  void handleFrameRemoval( QgsComposerItem* item );
289 
292  void handlePageChange();
293 
294  private:
295  QgsComposerMultiFrame(); //forbidden
296 
297  bool mIsRecalculatingSize;
298 
299 };
300 
301 #endif // QGSCOMPOSERMULTIFRAME_H
ResizeMode
Definition: qgscomposermultiframe.h:47
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const
Stores item state in DOM element.
Definition: qgscomposerobject.cpp:61
A base class for objects which belong to a map composition.
Definition: qgscomposerobject.h:33
virtual double findNearbyPageBreak(double yPos)
Finds the optimal position to break a frame at.
Definition: qgscomposermultiframe.h:121
A item that forms part of a map composition.
Definition: qgscomposeritem.h:38
ResizeMode resizeMode() const
Returns the resize mode for the multiframe.
Definition: qgscomposermultiframe.h:146
Definition: qgscomposermultiframe.h:50
void setCreateUndoCommands(bool enabled)
Sets whether undo commands should be created for interactions with the multiframe.
Definition: qgscomposermultiframe.h:199
Abstract base class for composer items with the ability to distribute the content to several frames (...
Definition: qgscomposermultiframe.h:39
Definition: qgscomposermultiframe.h:51
QList< QgsComposerFrame * > mFrameItems
Definition: qgscomposermultiframe.h:276
bool mCreateUndoCommands
True: creates QgsMultiFrameCommands on internal changes (e.g.
Definition: qgscomposermultiframe.h:281
ResizeMode mResizeMode
Definition: qgscomposermultiframe.h:278
int frameCount() const
Returns the number of frames associated with this multiframe.
Definition: qgscomposermultiframe.h:205
Graphics scene for map printing.
Definition: qgscomposition.h:72
Frame item for a composer multiframe item.
Definition: qgscomposerframe.h:25
virtual QSizeF minFrameSize(const int frameIndex=-1) const
Returns the minimum size for a frames, if desired.
Definition: qgscomposermultiframe.h:91
QgsComposition * mComposition
Definition: qgscomposerobject.h:139
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc)
Sets item state from DOM element.
Definition: qgscomposerobject.cpp:74
QgsComposition * composition()
Returns the parent composition for the multiframe.
Definition: qgscomposermultiframe.h:187
virtual QSizeF fixedFrameSize(const int frameIndex=-1) const
Returns the fixed size for a frame, if desired.
Definition: qgscomposermultiframe.h:79
bool createUndoCommands() const
Returns whether undo commands should be created for interactions with the multiframe.
Definition: qgscomposermultiframe.h:193
double size
Definition: qgssvgcache.cpp:77