1 /* This file is part of the KDE project
2 
3    Copyright 2008 Johannes Simon <johannes.simon@gmail.com>
4    Copyright 2008 Inge Wallin    <inge@lysator.liu.se>
5 
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Library General Public
8    License as published by the Free Software Foundation; either
9    version 2 of the License, or (at your option) any later version.
10 
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Library General Public License for more details.
15 
16    You should have received a copy of the GNU Library General Public License
17    along with this library; see the file COPYING.LIB.  If not, write to
18    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20 */
21 
22 
23 #ifndef KOCHART_AXESCONFIGWIDGET
24 #define KOCHART_AXESCONFIGWIDGET
25 
26 
27 #include "ConfigSubWidgetBase.h"
28 #include "ChartShape.h"
29 
30 #include <QObject>
31 
32 class KoShape;
33 class QAction;
34 
35 namespace KChart
36 {
37     class Position;
38     class CartesianAxis;
39 }
40 
41 namespace KoChart
42 {
43 class ChartShape;
44 
45 /**
46  * Chart type configuration widget.
47  */
48 class AxesConfigWidget : public ConfigSubWidgetBase
49 {
50     Q_OBJECT
51 
52 public:
53     AxesConfigWidget(QWidget *parent = 0);
54     AxesConfigWidget(QList<ChartType> types, QWidget *parent = 0);
55     ~AxesConfigWidget();
56 
57     void open(ChartShape* shape) override;
58 
59     /// Delete all open dialogs.
60     /// This is called when e.g. the tool is deactivated.
61     void deleteSubDialogs(ChartType type = LastChartType);
62 
63 public Q_SLOTS:
64     void updateData(ChartType type, ChartSubtype subtype) override;
65 
66     void ui_axisSelectionChanged(int index);
67     void ui_axisShowTitleChanged(bool b);
68     void ui_axisShowChanged(bool b);
69     void ui_axisPositionChanged(int index);
70     void ui_axisLabelsPositionChanged(int index);
71     void ui_axisShowLabelsChanged(bool value);
72     void ui_axisShowMajorGridLinesChanged(bool b);
73     void ui_axisShowMinorGridLinesChanged(bool b);
74     void ui_axisUseLogarithmicScalingChanged(bool b);
75     void ui_axisStepWidthChanged(double width);
76     void ui_axisUseAutomaticStepWidthChanged(bool b);
77     void ui_axisSubStepWidthChanged(double width);
78     void ui_axisUseAutomaticSubStepWidthChanged(bool b);
79     void ui_axisScalingButtonClicked();
80     void ui_axisEditFontButtonClicked();
81     void ui_axisLabelsFontChanged();
82 
83 Q_SIGNALS:
84     void axisAdded(AxisDimension, const QString& title);
85     void axisRemoved(Axis *axis);
86     void axisShowTitleChanged(Axis *axis, bool b);
87     void axisShowChanged(Axis *axis, bool b);
88     void axisPositionChanged(Axis *axis, const QString &pos);
89     void axisLabelsPositionChanged(Axis *axis, const QString &pos);
90     void axisShowLabelsChanged(Axis *axis, bool value);
91     void axisShowMajorGridLinesChanged(Axis *axis, bool b);
92     void axisShowMinorGridLinesChanged(Axis *axis, bool b);
93     void axisUseLogarithmicScalingChanged(Axis *axis, bool b);
94     void axisStepWidthChanged(Axis *axis, qreal width);
95     void axisSubStepWidthChanged(Axis *axis, qreal width);
96     void axisUseAutomaticStepWidthChanged(Axis *axis, bool automatic);
97     void axisUseAutomaticSubStepWidthChanged(Axis *axis, bool automatic);
98     void axisLabelsFontChanged(Axis *axis, const QFont& font);
99 
100     void gapBetweenBarsChanged(Axis *axis, int percent);
101     void gapBetweenSetsChanged(Axis *axis, int percent);
102 
103 private Q_SLOTS:
104     void slotGapBetweenBars();
105     void slotGapBetweenSets();
106 
107 private:
108     Axis *axis(int index) const;
109     void setupDialogs();
110     void createActions();
111 
112     class Private;
113     Private * const d;
114 };
115 
116 }  // namespace KoChart
117 
118 
119 #endif // KOCHART_AXESCONFIGWIDGET
120