File indexing completed on 2024-05-12 16:33:32

0001 /* This file is part of the KDE project
0002 
0003    Copyright 2008 Johannes Simon <johannes.simon@gmail.com>
0004    Copyright 2008 Inge Wallin    <inge@lysator.liu.se>
0005    Copyright 2018 Dag Andersen <danders@get2net.dk>
0006 
0007    This library is free software; you can redistribute it and/or
0008    modify it under the terms of the GNU Library General Public
0009    License as published by the Free Software Foundation; either
0010    version 2 of the License, or (at your option) any later version.
0011 
0012    This library is distributed in the hope that it will be useful,
0013    but WITHOUT ANY WARRANTY; without even the implied warranty of
0014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015    Library General Public License for more details.
0016 
0017    You should have received a copy of the GNU Library General Public License
0018    along with this library; see the file COPYING.LIB.  If not, write to
0019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020  * Boston, MA 02110-1301, USA.
0021 */
0022 
0023 
0024 #ifndef KOCHART_DATACONFIGWIDGET
0025 #define KOCHART_DATACONFIGWIDGET
0026 
0027 
0028 #include "ConfigSubWidgetBase.h"
0029 #include "ChartShape.h"
0030 
0031 
0032 class KoShape;
0033 class QAction;
0034 
0035 namespace KChart
0036 {
0037     class Position;
0038     class CartesianAxis;
0039 }
0040 
0041 namespace KoChart
0042 {
0043 class ChartShape;
0044 
0045 /**
0046  * Chart type configuration widget.
0047  */
0048 class DataSetConfigWidget : public ConfigSubWidgetBase
0049 {
0050     Q_OBJECT
0051 
0052 public:
0053     DataSetConfigWidget(QWidget *parent = 0);
0054     DataSetConfigWidget(QList<ChartType> types, QWidget *parent = 0);
0055     ~DataSetConfigWidget();
0056 
0057     void open(ChartShape* shape) override;
0058     QAction * createAction();
0059 
0060     /// reimplemented
0061     virtual bool showOnShapeCreate() { return true; }
0062 
0063     /// Delete all open dialogs.
0064     /// This is called when e.g. the tool is deactivated.
0065     void deleteSubDialogs(ChartType type = LastChartType);
0066 
0067     void updateMarkers();
0068 
0069 public Q_SLOTS:
0070     void updateData(ChartType type, ChartSubtype subtype) override;
0071 
0072     void slotShowFormatErrorBarDialog();
0073 
0074     void dataSetChartTypeSelected(QAction *action);
0075     void datasetMarkerSelected(QAction *action);
0076     void datasetBrushSelected(const QColor& color);
0077     void datasetPenSelected(const QColor& color);
0078     void ui_datasetShowCategoryChanged(bool b);
0079     void ui_datasetShowErrorBarChanged(bool b);
0080     void ui_dataSetShowNumberChanged(bool b);
0081     void ui_datasetShowPercentChanged(bool b);
0082     void ui_datasetShowSymbolChanged(bool b);
0083     void ui_dataSetSelectionChanged(int index);
0084     void ui_dataSetAxisSelectionChanged(int index);
0085     void ui_dataSetHasChartTypeChanged(bool b);
0086     void ui_dataSetErrorBarTypeChanged();
0087 
0088 Q_SIGNALS:
0089     void dataSetChartTypeChanged(DataSet *dataSet, ChartType type, ChartSubtype subType);
0090 
0091     void showVerticalLinesChanged(bool b);
0092     void showHorizontalLinesChanged(bool b);
0093 
0094     void datasetPenChanged(DataSet *dataSet, const QColor& color, int section);
0095     void datasetBrushChanged(DataSet *dataSet, const QColor& color, int section);
0096     void dataSetMarkerChanged(DataSet *dataSet, OdfSymbolType type, OdfMarkerStyle style);
0097     void datasetShowCategoryChanged(DataSet *dataSet, bool b, int section);
0098     void dataSetShowNumberChanged(DataSet *dataSet, bool b, int section);
0099     void datasetShowPercentChanged(DataSet *dataSet, bool b, int section);
0100     void datasetShowSymbolChanged(DataSet *dataSet, bool b, int section);
0101     void dataSetAxisChanged(DataSet *dataSet, Axis *axis);
0102 
0103     void axisAdded(AxisDimension, const QString& title);
0104 
0105 private:
0106     void setupDialogs();
0107     void createActions();
0108 
0109     class Private;
0110     Private * const d;
0111 };
0112 
0113 }  // namespace KoChart
0114 
0115 
0116 #endif // KOCHART_DATASETCONFIGWIDGET