QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
qgscomposerframe.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscomposerframe.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 QGSCOMPOSERFRAME_H
17 #define QGSCOMPOSERFRAME_H
18 
19 #include "qgscomposeritem.h"
20 
21 class QgsComposition;
23 
25 class CORE_EXPORT QgsComposerFrame: public QgsComposerItem
26 {
27 
28  public:
29 
30  QgsComposerFrame( QgsComposition* c, QgsComposerMultiFrame* mf, qreal x, qreal y, qreal width, qreal height );
31 
33 
39  void setContentSection( const QRectF& section ) { mSection = section; }
40 
44  QgsComposerMultiFrame* multiFrame() const { return mMultiFrame; }
45 
46  //Overriden to allow multiframe to set display name
47  virtual QString displayName() const;
48 
49  //Overriden to handle fixed frame sizes set by multi frame
50  void setSceneRect( const QRectF& rectangle );
51 
52  void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
53  void beginItemCommand( const QString& text );
54  void endItemCommand();
55  bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
56  bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
57  int type() const { return ComposerFrame; }
58 
65  QRectF extent() const { return mSection; }
66 
72  bool hidePageIfEmpty() const { return mHidePageIfEmpty; }
73 
79  void setHidePageIfEmpty( const bool hidePageIfEmpty );
80 
86  bool hideBackgroundIfEmpty() const { return mHideBackgroundIfEmpty; }
87 
93  void setHideBackgroundIfEmpty( const bool hideBackgroundIfEmpty );
94 
100  bool isEmpty() const;
101 
102  private:
103  QgsComposerFrame(); //forbidden
104  QgsComposerMultiFrame* mMultiFrame;
105  QRectF mSection;
106 
108  bool mHidePageIfEmpty;
110  bool mHideBackgroundIfEmpty;
111 
112 };
113 
114 #endif // QGSCOMPOSERFRAME_H
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const
Stores item state in DOM element.
virtual void beginItemCommand(const QString &text)
A item that forms part of a map composition.
Abstract base class for composer items with the ability to distribute the content to several frames (...
bool hideBackgroundIfEmpty() const
Returns whether the background and frame border should be hidden if this frame is empty...
Graphics scene for map printing.
Frame item for a composer multiframe item.
virtual QString displayName() const
Get item display name.
QRectF extent() const
Returns the visible portion of the multi frame's content which is shown in this frame.
virtual void endItemCommand()
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc)
Sets item state from DOM element.
virtual void setSceneRect(const QRectF &rectangle)
Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size un...
bool hidePageIfEmpty() const
Returns whether the page should be hidden (ie, not included in composer exports) if this frame is emp...
void setContentSection(const QRectF &section)
Sets the visible part of the multiframe's content which is visible within this frame (relative to the...
QgsComposerMultiFrame * multiFrame() const
Returns the parent multiframe for the frame.
int type() const
return correct graphics item type.