File indexing completed on 2024-04-28 04:41:57
0001 /* This file is part of the KDE project 0002 Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk) 0003 Copyright (C) 2015 Jarosław Staniek <staniek@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2.1 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef KREPORTPLUGININTERFACE_H 0022 #define KREPORTPLUGININTERFACE_H 0023 0024 #include "config-kreport.h" 0025 #include "kreport_export.h" 0026 #include "KReportElement.h" 0027 0028 #include <KPluginFactory> 0029 0030 class QGraphicsScene; 0031 class QDomNode; 0032 class QDomElement; 0033 class KReportPluginMetaData; 0034 class KReportDesignReadingStatus; 0035 class KReportDesigner; 0036 class KReportItemBase; 0037 0038 //! deprecated, use K_PLUGIN_CLASS_WITH_JSON instead! 0039 #define KREPORT_PLUGIN_FACTORY(class_name, name) \ 0040 K_PLUGIN_FACTORY_WITH_JSON(class_name ## Factory, name, registerPlugin<class_name>();) 0041 0042 /*! 0043 * @brief An interface for plugins delivering KReport elements. 0044 */ 0045 class KREPORT_EXPORT KReportPluginInterface : public QObject 0046 { 0047 Q_OBJECT 0048 public: 0049 explicit KReportPluginInterface(QObject *parent = nullptr, 0050 const QVariantList &args = QVariantList()); 0051 0052 ~KReportPluginInterface() override; 0053 0054 virtual QObject* createDesignerInstance(KReportDesigner *designer, QGraphicsScene * scene, 0055 const QPointF &pos) = 0; 0056 0057 //! @todo 4.0: Use QDomElement 0058 virtual QObject* createDesignerInstance(const QDomNode &element, KReportDesigner *designer, 0059 QGraphicsScene *scene) = 0; 0060 0061 //! @todo 4.0: Use QDomElement 0062 virtual QObject* createRendererInstance(const QDomNode &element) = 0; 0063 0064 virtual KReportElement createElement(); 0065 0066 virtual bool loadElement(KReportElement *el, const QDomElement &dom, KReportDesignReadingStatus *status); 0067 0068 #ifdef KREPORT_SCRIPTING 0069 virtual QObject* createScriptInstance(KReportItemBase* item) = 0; 0070 #endif 0071 0072 //! @return information about the plugin 0073 const KReportPluginMetaData* metaData() const; 0074 0075 private: 0076 friend class KReportPluginEntry; 0077 void setMetaData(KReportPluginMetaData* metaData); 0078 0079 Q_DISABLE_COPY(KReportPluginInterface) 0080 class Private; 0081 Private * const d; 0082 }; 0083 0084 #endif // KREPORTPLUGININTERFACE_H