QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgspaperitem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspaperitem.h
3  -------------------
4  begin : September 2008
5  copyright : (C) 2008 by Marco Hugentobler
6  email : marco dot hugentobler at karto dot baug dot ethz dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSPAPERITEM_H
19 #define QGSPAPERITEM_H
20 
21 #include "qgscomposeritem.h"
22 #include <QGraphicsRectItem>
23 
26 class CORE_EXPORT QgsPaperGrid: public QGraphicsRectItem
27 {
28  public:
29  QgsPaperGrid( double x, double y, double width, double height, QgsComposition* composition );
30  ~QgsPaperGrid();
31 
33  void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
34 
35  private:
36  QgsComposition* mComposition;
37 };
38 
40 class CORE_EXPORT QgsPaperItem : public QgsComposerItem
41 {
42  public:
44  QgsPaperItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition );
45  ~QgsPaperItem();
46 
48  virtual int type() const { return ComposerPaper; }
49 
51  void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
52 
57  bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
58 
63  bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
64 
65  virtual void setSceneRect( const QRectF& rectangle );
66 
67  private:
68  QgsPaperItem();
70  void initialize();
71 
72  void calculatePageMargin();
73 
74  QgsPaperGrid* mPageGrid;
75  double mPageMargin;
76 };
77 
78 #endif