MyBooks
bandinterface.h
Go to the documentation of this file.
1 /***************************************************************************
2  * This file is part of the CuteReport project *
3  * Copyright (C) 2012-2017 by Alexander Mikhalov *
4  * alexander.mikhalov@gmail.com *
5  * *
6  ** GNU General Public License Usage **
7  * *
8  * This library is free software: you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation, either version 3 of the License, or *
11  * (at your option) any later version. *
12  * You should have received a copy of the GNU General Public License *
13  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
14  * *
15  ** GNU Lesser General Public License **
16  * *
17  * This library is free software: you can redistribute it and/or modify *
18  * it under the terms of the GNU Lesser General Public License as *
19  * published by the Free Software Foundation, either version 3 of the *
20  * License, or (at your option) any later version. *
21  * You should have received a copy of the GNU Lesser General Public *
22  * License along with this library. *
23  * If not, see <http://www.gnu.org/licenses/>. *
24  * *
25  * This library is distributed in the hope that it will be useful, *
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
28  * GNU General Public License for more details. *
29  ****************************************************************************/
30 
31 #ifndef BANDINTERFACE_H
32 #define BANDINTERFACE_H
33 
34 #include "baseiteminterface.h"
35 #include "cutereport_globals.h"
36 
37 #define BANDVIEWTYPE QGraphicsItem::UserType + 102
38 
39 namespace CuteReport
40 {
41 
42 class BandInterfacePrivate;
43 
45 {
46  Q_OBJECT
47  Q_INTERFACES(CuteReport::BaseItemInterface)
48 
49 // Q_PROPERTY(Margins margins READ margins WRITE setMargins NOTIFY marginsChanged)
50  Q_PROPERTY(bool stretchable READ stretchable WRITE setStretchable NOTIFY stretchableChanged)
51  Q_PROPERTY(bool showStretchability READ showStretchability WRITE setShowStretchability NOTIFY showStretchabilityChanged)
52  Q_PROPERTY(QSizeF stretchOriginalSize READ stretchOriginalSize WRITE setStretchOriginalSize DESIGNABLE false)
53  Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
54 
55 public:
56  enum LayoutType { LayoutUndefined, LayoutTop, LayoutBottom, LayoutFree };
57  //enum AccomodationType {AccomodationUndefined, AccomodationOnce, AccomodationFirstPage, AccomodationLastPage, AccomodationEveryPage};
58 
59 public:
60  explicit BandInterface(QObject * parent);
61  virtual ~BandInterface();
62  inline void initMe();
63 
64  virtual void init_gui();
65  virtual bool renderNewPage() {return false;}
66  virtual bool renderNewPageComplete();
67 
68  virtual LayoutType layoutType() const;
69  virtual int layoutPriority() const;
70  virtual bool respectPageColumns() {return false;}
71 
72  virtual void setGeometry(const QRectF & rect, CuteReport::Unit unit = CuteReport::UnitNotDefined);
73  virtual void setHeight(qreal height, CuteReport::Unit unit = CuteReport::UnitNotDefined);
74 
75  virtual QString dataset() const { return QString(); }
76  virtual void setDataset(const QString & dataset) { Q_UNUSED(dataset); }
77 
78  virtual CuteReport::Margins margins() const;
79  virtual void setMargins(const CuteReport::Margins & margins);
80 
81  virtual bool stretchable() const;
82  virtual void setStretchable(bool value);
83 
84  virtual bool showStretchability() const;
85  virtual void setShowStretchability(bool value);
86 
87  virtual QSizeF stretchOriginalSize() const;
88  virtual void setStretchOriginalSize(const QSizeF &size);
89 
90  virtual QFont font() const;
91  virtual void setFont(const QFont & font);
92 
93  virtual QByteArray serialize() const;
94  virtual void deserialize(QByteArray &data);
95 
96  virtual QPair<QString, int> sortingOrder() const {return QPair<QString, int>(moduleShortName(), 0);} // first - sorting group, second - sorting order
97 
98 signals:
99  void marginsChanged(CuteReport::Margins);
100  void groupChanged(QString);
101  void stretchableChanged(bool);
102  void showStretchabilityChanged(bool);
103  void fontChanged(QFont);
104 
105 private slots:
106  void childGeometryChanged(QRectF geometry);
107 
108 protected:
109  explicit BandInterface(BandInterfacePrivate *dd, QObject * parent);
110 
111  virtual void childAdded(BaseItemInterface * item);
112  virtual void childRemoved(BaseItemInterface * item);
113  virtual bool adjustSize();
114 
115 private:
116  Q_DECLARE_PRIVATE(BandInterface)
117 };
118 
119 } //namespace
120 
121 Q_DECLARE_INTERFACE(CuteReport::BandInterface, "CuteReport.BandInterface/1.0")
122 
123 #endif
Definition: abstractpainterdelegate.h:42
Definition: bandinterface.h:44
virtual bool respectPageColumns()
Definition: bandinterface.h:70
Definition: cutereport_types.h:103
virtual QPair< QString, int > sortingOrder() const
Definition: bandinterface.h:96
Definition: cutereport_types.h:46
LayoutType
Definition: bandinterface.h:56
#define CUTEREPORT_EXPORTS
Definition: cutereport_globals.h:47
virtual bool renderNewPage()
Definition: bandinterface.h:65
virtual void setDataset(const QString &dataset)
Definition: bandinterface.h:76
Definition: bandinterface.h:56
Unit
Definition: cutereport_types.h:95
Definition: baseiteminterface.h:107
virtual QString dataset() const
Definition: bandinterface.h:75