MyBooks
rendererinterface.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 #ifndef RENDERERINTERFACE_H
31 #define RENDERERINTERFACE_H
32 
33 #include "reportplugininterface.h"
34 //#include <qscriptengine.h>
35 
36 #include <QObject>
37 #include <QGraphicsItem>
38 #include <QtCore>
39 #include <QWidget>
40 
41 namespace CuteReport
42 {
43 
44 class ReportInterface;
45 class RenderedPageInterface;
46 class RenderedReportInterface;
47 class RendererHelperInterface;
48 
50 {
51  Q_OBJECT
53 
54 // Q_PROPERTY(int dpi READ dpi WRITE setDpi NOTIFY dpiChanged)
55 
56  Q_PROPERTY(int _current_property READ _currentProperty WRITE _setCurrentProperty DESIGNABLE false STORED false)
57  Q_PROPERTY(QString _current_property_description READ _current_property_description DESIGNABLE false STORED false)
58 
59 public:
60  // TODO
61 // enum DataType {DataVariable, DataFunction, DataDataset};
62 // Q_DECLARE_FLAGS(DataTypes, DataType)
63  explicit RendererInterface(QObject *parent = 0);
64  virtual ~RendererInterface();
65 
66  virtual RendererInterface * createInstance(QObject * parent = 0) const = 0;
67  virtual RendererInterface * clone() const = 0;
68  virtual CuteReport::RendererHelperInterface * helper() {return 0;}
69 
70  virtual void run(ReportInterface* report, ThreadingLevel threading = ThreadNo) = 0;
71  virtual void stop() = 0;
72  virtual bool isRunning() = 0;
73 
74  virtual ScriptString processString(ScriptString & scriptString) = 0;
75 
76  virtual QSet<QString> reportParameters(CuteReport::ReportInterface *report) = 0;
77 
78  virtual ReportInterface * report() = 0;
79 
80 // virtual void setDpi(int dpi) = 0;
81 // virtual int dpi() const = 0;
82 
83  virtual CuteReport::RenderedReportInterface * takeRenderedReport() = 0;
84 
85  virtual void _setCurrentProperty(int num) { m_currentProperty = num; }
86  virtual int _currentProperty() { return m_currentProperty; }
87  virtual QString _current_property_description() const;
88 
89  virtual QAbstractItemModel * createFunctionsModel() {return 0;}
90  virtual QAbstractItemModel * createVariablesModel() {return 0;}
91 
92 signals:
93  void started();
94  void done(bool errorsFound);
95  void cancelled();
96  void processingPage(int page, int total, int pass, int passTotal);
97  void dpiChanged(int);
98 
99 protected:
100  explicit RendererInterface(const RendererInterface &dd, QObject * parent);
101 
102  friend class RenderedReportInterface;
103 
105 };
106 
107 
109 {
110  Q_OBJECT
111 public:
112  enum VisibleOptions{ReportsOptions, ObjectsOptions, AllOptions};
114  virtual void load() = 0;
115  virtual void save() = 0;
116 };
117 
118 
119 
120 } //namespace
121 
122 Q_DECLARE_INTERFACE(CuteReport::RendererInterface, "CuteReport.RendererInterface/1.0")
123 
124 
125 
126 
127 #endif // RENDERERINTERFACE_H
Definition: abstractpainterdelegate.h:42
virtual QAbstractItemModel * createVariablesModel()
Definition: rendererinterface.h:90
TODO v2: rename to ReportObject.
Definition: reportinterface.h:71
Definition: reportplugininterface.h:53
Definition: cutereport_types.h:310
ThreadingLevel
Definition: reportplugininterface.h:63
Definition: rendererinterface.h:108
virtual void _setCurrentProperty(int num)
Definition: rendererinterface.h:85
#define CUTEREPORT_EXPORTS
Definition: cutereport_globals.h:47
Definition: rendererinterface.h:49
RendererHelperInterface(RendererInterface *, VisibleOptions=AllOptions)
Definition: rendererinterface.h:113
int m_currentProperty
Definition: rendererinterface.h:104
VisibleOptions
Definition: rendererinterface.h:112
virtual int _currentProperty()
Definition: rendererinterface.h:86
virtual QAbstractItemModel * createFunctionsModel()
Definition: rendererinterface.h:89