File indexing completed on 2024-05-12 16:33:30
0001 /* This file is part of the KDE project 0002 Copyright (C) 2018 Dag Andersen <danders@get2net.dk> 0003 Copyright 2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net> 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 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 KCHART_CHART_SHAPE_FACTORY 0022 #define KCHART_CHART_SHAPE_FACTORY 0023 0024 0025 // Qt 0026 #include <QStringList> 0027 0028 // Calligra 0029 #include <KoShapeFactoryBase.h> 0030 #include <QVariantList> 0031 0032 0033 class KoShape; 0034 class KoShapeConfigWidgetBase; 0035 0036 namespace KoChart { 0037 class ChartShape; 0038 } 0039 0040 class ChartShapePlugin : public QObject 0041 { 0042 Q_OBJECT 0043 public: 0044 0045 ChartShapePlugin(QObject *parent, const QVariantList&); 0046 ~ChartShapePlugin() {} 0047 }; 0048 0049 0050 class ChartShapeFactory : public KoShapeFactoryBase 0051 { 0052 public: 0053 ChartShapeFactory(); 0054 ~ChartShapeFactory() {} 0055 0056 bool supports(const KoXmlElement &element, KoShapeLoadingContext &context) const override; 0057 0058 KoShape *createShape(const KoProperties* properties, KoDocumentResourceManager *documentResources) const override; 0059 0060 KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override; 0061 // reimplemented to not create a default shape to just overwrite it afterwards 0062 KoShape *createShapeFromOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override; 0063 void newDocumentResourceManager(KoDocumentResourceManager *manager) const override; 0064 0065 QList<KoShapeConfigWidgetBase*> createShapeOptionPanels() override; 0066 0067 private: 0068 KoChart::ChartShape *createBarChart(KoDocumentResourceManager *documentResources, int subtype) const; 0069 KoChart::ChartShape *createLineChart(KoDocumentResourceManager *documentResources, int subtype) const; 0070 KoChart::ChartShape *createAreaChart(KoDocumentResourceManager *documentResources, int subtype) const; 0071 KoChart::ChartShape *createStockChart(KoDocumentResourceManager *documentResources, int subtype) const; 0072 KoChart::ChartShape *createPieChart(KoDocumentResourceManager *documentResources) const; 0073 KoChart::ChartShape *createRingChart(KoDocumentResourceManager *documentResources) const; 0074 KoChart::ChartShape *createBubbleChart(KoDocumentResourceManager *documentResources) const; 0075 KoChart::ChartShape *createScatterChart(KoDocumentResourceManager *documentResources) const; 0076 KoChart::ChartShape *createRadarChart(KoDocumentResourceManager *documentResources) const; 0077 KoChart::ChartShape *createFilledRadarChart(KoDocumentResourceManager *documentResources) const; 0078 0079 void radarData(KoChart::ChartShape *shape) const; 0080 0081 }; 0082 0083 0084 #endif // KCHART_CHART_SHAPE_FACTORY