|
QGIS API Documentation
master-6164ace
|
00001 /*************************************************************************** 00002 qgscomposermultiframe.h 00003 ------------------------------------------------------------ 00004 begin : July 2012 00005 copyright : (C) 2012 by Marco Hugentobler 00006 email : marco dot hugentobler at sourcepole dot ch 00007 *************************************************************************** 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 ***************************************************************************/ 00015 00016 #ifndef QGSCOMPOSERMULTIFRAME_H 00017 #define QGSCOMPOSERMULTIFRAME_H 00018 00019 #include <QObject> 00020 #include <QSizeF> 00021 00022 class QgsComposerFrame; 00023 class QgsComposerItem; 00024 class QgsComposition; 00025 class QDomDocument; 00026 class QDomElement; 00027 class QRectF; 00028 class QPainter; 00029 00031 class CORE_EXPORT QgsComposerMultiFrame: public QObject 00032 { 00033 Q_OBJECT 00034 public: 00035 00036 enum ResizeMode 00037 { 00038 UseExistingFrames = 0, 00039 ExtendToNextPage, //uses the next page(s) until the content has been printed 00040 RepeatOnEveryPage, //repeats the same frame on every page 00041 RepeatUntilFinished //duplicates last frame to next page to fit the total size 00042 }; 00043 00044 QgsComposerMultiFrame( QgsComposition* c, bool createUndoCommands ); 00045 virtual ~QgsComposerMultiFrame(); 00046 virtual QSizeF totalSize() const = 0; 00047 virtual void render( QPainter* p, const QRectF& renderExtent ) = 0; 00048 00049 virtual void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true ) = 0; 00050 00051 void removeFrame( int i ); 00052 00053 void update(); 00054 00055 void setResizeMode( ResizeMode mode ); 00056 ResizeMode resizeMode() const { return mResizeMode; } 00057 00058 virtual bool writeXML( QDomElement& elem, QDomDocument & doc, bool ignoreFrames = false ) const = 0; 00059 bool _writeXML( QDomElement& elem, QDomDocument& doc, bool ignoreFrames = false ) const; 00060 00061 virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false ) = 0; 00062 bool _readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false ); 00063 00064 QgsComposition* composition() { return mComposition; } 00065 00066 bool createUndoCommands() const { return mCreateUndoCommands; } 00067 void setCreateUndoCommands( bool enabled ) { mCreateUndoCommands = enabled; } 00068 00070 void deleteFrames(); 00071 00075 int frameCount() const { return mFrameItems.size(); } 00076 QgsComposerFrame* frame( int i ) const; 00077 00078 protected: 00079 QgsComposition* mComposition; 00080 QList<QgsComposerFrame*> mFrameItems; 00081 ResizeMode mResizeMode; 00083 bool mCreateUndoCommands; 00084 00085 protected slots: 00086 void recalculateFrameSizes(); 00088 void handleFrameRemoval( QgsComposerItem* item ); 00090 void handlePageChange(); 00091 00092 private: 00093 QgsComposerMultiFrame(); //forbidden 00094 00095 signals: 00096 void changed(); 00097 }; 00098 00099 #endif // QGSCOMPOSERMULTIFRAME_H