1 /* 2 * Kexi Report Plugin 3 * Copyright (C) 2007-2008 by Adam Pigg <adam@piggz.co.uk> 4 * Copyright (C) 2011-2017 Jarosław Staniek <staniek@kde.org> 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef _KEXIREPORTPART_H_ 21 #define _KEXIREPORTPART_H_ 22 23 #include <core/kexipart.h> 24 #include <core/KexiWindowData.h> 25 26 #include <KReportDataSource> 27 #include <KReportScriptSource> 28 29 #include <KDbTableSchemaChangeListener> 30 31 #include <QDomElement> 32 33 class KexiReportPartTempData : public KexiWindowData, public KDbTableSchemaChangeListener 34 { 35 Q_OBJECT 36 public: 37 KexiReportPartTempData(KexiWindow* parent, KDbConnection *conn); 38 ~KexiReportPartTempData(); 39 QDomElement reportDefinition; 40 QDomElement connectionDefinition; 41 42 /*! true, if \a document member has changed in previous view. Used on view switching. 43 Check this flag to see if we should refresh data for DataViewMode. */ 44 bool reportSchemaChangedInPreviousView; 45 46 KDbConnection *connection(); 47 48 protected: 49 //! This temp-data acts as a listener for tracking changes in table schema 50 //! used by the report. This method closes the report on request. 51 tristate closeListener() override; 52 53 private: 54 Q_DISABLE_COPY(KexiReportPartTempData) 55 class Private; 56 Private * const d; 57 }; 58 59 /** 60 * @short Application Main Window 61 */ 62 class KexiReportPart : public KexiPart::Part, public KReportScriptSource 63 { 64 Q_OBJECT 65 public: 66 /** 67 * Default Constructor 68 */ 69 KexiReportPart(QObject *parent, const QVariantList &l); 70 71 /** 72 * Default Destructor 73 */ 74 virtual ~KexiReportPart(); 75 76 virtual void setupCustomPropertyPanelTabs(QTabWidget *tab); 77 78 virtual KLocalizedString i18nMessage(const QString& englishMessage, 79 KexiWindow* window) const; 80 81 QStringList scriptList() const override; 82 QString scriptCode(const QString& script) const override; 83 84 protected: 85 KexiView *createView(QWidget *parent, KexiWindow *win, KexiPart::Item *item, 86 Kexi::ViewMode = Kexi::DataViewMode, 87 QMap<QString, QVariant> *staticObjectArgs = nullptr) override Q_REQUIRED_RESULT; 88 89 KexiWindowData* createWindowData(KexiWindow* window) override Q_REQUIRED_RESULT; 90 91 virtual void initPartActions(); 92 93 virtual KDbObject* loadSchemaObject(KexiWindow *window, 94 const KDbObject& object, Kexi::ViewMode viewMode, bool *ownedByWindow); 95 96 private Q_SLOTS: 97 void slotToolboxActionTriggered(bool checked); 98 //! Unchecks toolbox action for @a entity after it is used. 99 void slotItemInserted(const QString& entity); 100 101 private: 102 class Private; 103 Private* d; 104 }; 105 106 #endif // _KEXIREPORTPART_H_ 107