KReport

KReportChartPlugin.cpp
1 /* This file is part of the KDE project
2  Copyright (C) 2010 by Adam Pigg ([email protected])
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "KReportChartPlugin.h"
21 #include "KReportItemChart.h"
22 #include "KReportDesignerItemChart.h"
23 #include "KReportPluginInfo.h"
24 #ifdef KREPORT_SCRIPTING
25 #include "krscriptchart.h"
26 #endif
27 
28 #include <KoIcon.h>
29 
30 K_EXPORT_KOREPORT_ITEMPLUGIN(KoReportChartPlugin, chartplugin)
31 
32 KReportChartPlugin::KReportChartPlugin(QObject *parent, const QVariantList &args) : KReportPluginInterface(parent)
33 {
34  Q_UNUSED(args);
35 
36  KoReportPluginInfo *info = new KoReportPluginInfo();
37  info->setClassName("chart");
38  info->setIcon(koIcon("office-chart-area"));
39  info->setName(tr("Chart"));
40  setInfo(info);
41 }
42 
43 KReportChartPlugin::~KReportChartPlugin()
44 {
45 
46 }
47 
48 QObject* KReportChartPlugin::createRendererInstance(const QDomNode& element)
49 {
50  return new KReportItemChart(element);
51 }
52 
53 QObject* KReportChartPlugin::createDesignerInstance(const QDomNode& element, KoReportDesigner* designer, QGraphicsScene* scene)
54 {
55  return new KReportDesignerItemChart(element, designer, scene);
56 }
57 
58 QObject* KReportChartPlugin::createDesignerInstance(KoReportDesigner* designer, QGraphicsScene* scene, const QPointF& pos)
59 {
60  return new KReportDesignerItemChart(designer, scene, pos);
61 }
62 
63 #ifdef KREPORT_SCRIPTING
64 QObject* KoReportChartPlugin::createScriptInstance(KReportItemBase* item)
65 {
66  KoReportItemChart *chart = dynamic_cast<KoReportItemChart*>(item);
67  if (chart) {
68  return new Scripting::Chart(chart);
69  }
70  return 0;
71 }
72 #endif
Base class for items that are drawn syncronously.
QString tr(const char *sourceText, const char *disambiguation, int n)
An interface for plugins delivering KReport elements.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:17:37 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.