File indexing completed on 2024-05-12 16:33:30
0001 /* This file is part of the KDE project 0002 * 0003 * Copyright (C) 2007 Inge Wallin <inge@lysator.liu.se> 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 0022 #ifndef KCHART_CHARTTOOL_H 0023 #define KCHART_CHARTTOOL_H 0024 0025 // Calligra 0026 #include <KoToolBase.h> 0027 0028 // KoChart 0029 #include "ChartShape.h" 0030 0031 class QAction; 0032 0033 0034 namespace KoChart 0035 { 0036 0037 0038 /** 0039 * This is the tool for the chart shape, which is a flake-based plugin. 0040 */ 0041 0042 class ChartTool : public KoToolBase 0043 { 0044 Q_OBJECT 0045 public: 0046 explicit ChartTool(KoCanvasBase *canvas); 0047 ~ChartTool(); 0048 0049 /// reimplemented from superclass 0050 void paint(QPainter &painter, const KoViewConverter &converter) override; 0051 0052 /// reimplemented from superclass 0053 void mousePressEvent(KoPointerEvent *event) override; 0054 /// reimplemented from superclass 0055 void mouseMoveEvent(KoPointerEvent *event) override; 0056 /// reimplemented from superclass 0057 void mouseReleaseEvent(KoPointerEvent *event) override; 0058 /// reimplemented from superclass 0059 void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override; 0060 /// reimplemented from superclass 0061 void deactivate() override; 0062 /// reimplemented from superclass 0063 QList<QPointer<QWidget> > createOptionWidgets() override; 0064 0065 private Q_SLOTS: 0066 void setChartType(ChartType type, ChartSubtype subtype); 0067 void setChartSubType(ChartSubtype subtype); 0068 void setThreeDMode(bool threeD); 0069 void setDataDirection(Qt::Orientation); 0070 void setChartOrientation(Qt::Orientation); 0071 void setShowTitle(bool show); 0072 void setTitlePositioning(int index); 0073 void setTitleResize(int index); 0074 void setShowSubTitle(bool show); 0075 void setSubTitlePositioning(int index); 0076 void setSubTitleResize(int index); 0077 void setShowFooter(bool show); 0078 void setFooterPositioning(int index); 0079 void setFooterResize(int index); 0080 0081 // Datasets 0082 void setDataSetXDataRegion(DataSet *dataSet, const CellRegion ®ion); 0083 void setDataSetYDataRegion(DataSet *dataSet, const CellRegion ®ion); 0084 void setDataSetCustomDataRegion(DataSet *dataSet, const CellRegion ®ion); 0085 void setDataSetLabelDataRegion(DataSet *dataSet, const CellRegion ®ion); 0086 void setDataSetCategoryDataRegion(DataSet *dataSet, const CellRegion ®ion); 0087 0088 void setDataSetChartType(DataSet *dataSet, ChartType type, ChartSubtype subType); 0089 0090 void setDataSetShowCategory(DataSet *dataSet, bool b, int section = -1); 0091 void setDataSetShowNumber(DataSet *dataSet, bool b, int section = -1); 0092 void setDataSetShowPercent(DataSet *dataSet, bool b, int section = -1); 0093 void setDataSetShowSymbol(DataSet *dataSet, bool b, int section = -1); 0094 0095 void setDataSetPen(DataSet *dataSet, const QColor& color, int section = -1); 0096 void setDataSetBrush(DataSet *dataSet, const QColor& color, int section = -1); 0097 void setDataSetMarker(DataSet *dataSet, OdfSymbolType type, OdfMarkerStyle style); 0098 void setDataSetAxis(DataSet *dataSet, Axis *axis); 0099 0100 // Plot Area 0101 void setGapBetweenBars(Axis *axis, int percent); 0102 void setGapBetweenSets(Axis *axis, int percent); 0103 void setPieExplodeFactor(DataSet *dataSet, int section, int percent); 0104 0105 // Axes 0106 void addAxis(AxisDimension, const QString& title = QString()); 0107 void removeAxis(Axis *axis); 0108 void setShowAxis(Axis *axis, bool show); 0109 void setAxisPosition(Axis *axis, const QString &pos); 0110 void setAxisLabelsPosition(Axis *axis, const QString &pos); 0111 void setAxisShowTitle(Axis *axis, bool show); 0112 void setAxisShowLabels(Axis *axis, bool b); 0113 void setAxisShowMajorGridLines(Axis *axis, bool b = true); 0114 void setAxisShowMinorGridLines(Axis *axis, bool b = true); 0115 void setAxisUseLogarithmicScaling(Axis *axis, bool b = true); 0116 void setAxisStepWidth(Axis *axis, qreal width); 0117 void setAxisSubStepWidth(Axis *axis, qreal width); 0118 void setAxisUseAutomaticStepWidth(Axis *axis, bool automatic); 0119 void setAxisUseAutomaticSubStepWidth(Axis *axis, bool automatic); 0120 void setAxisLabelsFont(Axis *axis, const QFont& font); 0121 0122 // Legend 0123 void setShowLegend(bool show); 0124 void setLegendTitle(const QString& title); 0125 void setLegendFont(const QFont& font); 0126 void setLegendFontSize(int size); 0127 void setLegendOrientation(Qt::Orientation); 0128 void setLegendPosition(Position); 0129 void setLegendAlignment(Qt::Alignment); 0130 0131 void shapeSelectionChanged(); 0132 0133 private: 0134 class Private; 0135 Private * const d; 0136 }; 0137 0138 } // namespace KoChart 0139 0140 0141 #endif // KCHART_CHARTTOOL_H