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 
33 class CORE_EXPORT QgsComposerMultiFrame: public QgsComposerObject
34 {
35  Q_OBJECT
36  public:
37 
39  {
40  UseExistingFrames = 0,
41  ExtendToNextPage, //uses the next page(s) until the content has been printed
42  RepeatOnEveryPage, //repeats the same frame on every page
43  RepeatUntilFinished //duplicates last frame to next page to fit the total size
44  };
45 
46  QgsComposerMultiFrame( QgsComposition* c, bool createUndoCommands );
47  virtual ~QgsComposerMultiFrame();
48  virtual QSizeF totalSize() const = 0;
49  virtual void render( QPainter* p, const QRectF& renderExtent ) = 0;
50 
51  virtual void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true ) = 0;
52 
58  virtual double findNearbyPageBreak( double yPos ) { return yPos; }
59 
60  void removeFrame( int i );
61 
62  void update();
63 
64  void setResizeMode( ResizeMode mode );
65  ResizeMode resizeMode() const { return mResizeMode; }
66 
67  virtual bool writeXML( QDomElement& elem, QDomDocument & doc, bool ignoreFrames = false ) const = 0;
68  bool _writeXML( QDomElement& elem, QDomDocument& doc, bool ignoreFrames = false ) const;
69 
70  virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false ) = 0;
71  bool _readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false );
72 
74 
75  bool createUndoCommands() const { return mCreateUndoCommands; }
76  void setCreateUndoCommands( bool enabled ) { mCreateUndoCommands = enabled; }
77 
79  void deleteFrames();
80 
84  int frameCount() const { return mFrameItems.size(); }
85  QgsComposerFrame* frame( int i ) const;
86 
95  QgsComposerFrame* createNewFrame( QgsComposerFrame* currentFrame, QPointF pos, QSizeF size );
96 
101  virtual QString displayName() const;
102 
103  public slots:
104 
110  void recalculateFrameSizes();
111 
112  protected:
113  QList<QgsComposerFrame*> mFrameItems;
117 
118  protected slots:
120  void handleFrameRemoval( QgsComposerItem* item );
122  void handlePageChange();
123 
124  private:
125  QgsComposerMultiFrame(); //forbidden
126 
127  bool mIsRecalculatingSize;
128 
129  signals:
130  void changed();
131 
135  void contentsChanged();
136 };
137 
138 #endif // QGSCOMPOSERMULTIFRAME_H
ResizeMode
Definition: qgscomposermultiframe.h:38
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:58
A item that forms part of a map composition.
Definition: qgscomposeritem.h:38
ResizeMode resizeMode() const
Definition: qgscomposermultiframe.h:65
Definition: qgscomposermultiframe.h:41
void setCreateUndoCommands(bool enabled)
Definition: qgscomposermultiframe.h:76
Abstract base class for composer entries with the ability to distribute the content to several frames...
Definition: qgscomposermultiframe.h:33
Definition: qgscomposermultiframe.h:42
QList< QgsComposerFrame * > mFrameItems
Definition: qgscomposermultiframe.h:113
bool mCreateUndoCommands
True: creates QgsMultiFrameCommands on internal changes (e.g.
Definition: qgscomposermultiframe.h:116
ResizeMode mResizeMode
Definition: qgscomposermultiframe.h:114
int frameCount() const
Return the number of frames associated with this multiframeset.
Definition: qgscomposermultiframe.h:84
Graphics scene for map printing.
Definition: qgscomposition.h:70
Frame for html, table, text which can be divided onto several frames.
Definition: qgscomposerframe.h:25
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()
Definition: qgscomposermultiframe.h:73
bool createUndoCommands() const
Definition: qgscomposermultiframe.h:75
double size
Definition: qgssvgcache.cpp:77