QGIS API Documentation  2.3.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 <QObject>
20 #include <QSizeF>
21 
22 class QgsComposerFrame;
23 class QgsComposerItem;
24 class QgsComposition;
25 class QDomDocument;
26 class QDomElement;
27 class QRectF;
28 class QPainter;
29 
31 class CORE_EXPORT QgsComposerMultiFrame: public QObject
32 {
33  Q_OBJECT
34  public:
35 
37  {
38  UseExistingFrames = 0,
39  ExtendToNextPage, //uses the next page(s) until the content has been printed
40  RepeatOnEveryPage, //repeats the same frame on every page
41  RepeatUntilFinished //duplicates last frame to next page to fit the total size
42  };
43 
44  QgsComposerMultiFrame( QgsComposition* c, bool createUndoCommands );
45  virtual ~QgsComposerMultiFrame();
46  virtual QSizeF totalSize() const = 0;
47  virtual void render( QPainter* p, const QRectF& renderExtent ) = 0;
48 
49  virtual void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true ) = 0;
50 
51  void removeFrame( int i );
52 
53  void update();
54 
55  void setResizeMode( ResizeMode mode );
56  ResizeMode resizeMode() const { return mResizeMode; }
57 
58  virtual bool writeXML( QDomElement& elem, QDomDocument & doc, bool ignoreFrames = false ) const = 0;
59  bool _writeXML( QDomElement& elem, QDomDocument& doc, bool ignoreFrames = false ) const;
60 
61  virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false ) = 0;
62  bool _readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false );
63 
64  QgsComposition* composition() { return mComposition; }
65 
66  bool createUndoCommands() const { return mCreateUndoCommands; }
67  void setCreateUndoCommands( bool enabled ) { mCreateUndoCommands = enabled; }
68 
70  void deleteFrames();
71 
75  int frameCount() const { return mFrameItems.size(); }
76  QgsComposerFrame* frame( int i ) const;
77 
78  protected:
80  QList<QgsComposerFrame*> mFrameItems;
84 
85  protected slots:
86  void recalculateFrameSizes();
88  void handleFrameRemoval( QgsComposerItem* item );
90  void handlePageChange();
91 
92  private:
93  QgsComposerMultiFrame(); //forbidden
94 
95  signals:
96  void changed();
97 };
98 
99 #endif // QGSCOMPOSERMULTIFRAME_H
A item that forms part of a map composition.
ResizeMode resizeMode() const
QgsComposition * mComposition
void setCreateUndoCommands(bool enabled)
Abstract base class for composer entries with the ability to distribute the content to several frames...
QList< QgsComposerFrame * > mFrameItems
bool mCreateUndoCommands
True: creates QgsMultiFrameCommands on internal changes (e.g.
int frameCount() const
Return the number of frames associated with this multiframeset.
Graphics scene for map printing.
Frame for html, table, text which can be divided onto several frames.
QgsComposition * composition()