Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / chart2 / source / inc / ChartTypeDialogController.hxx
blobc3efe736ffc963552982fca6b706ea105da5fac9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPEDIALOGCONTROLLER_HXX
21 #define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPEDIALOGCONTROLLER_HXX
23 #include <sal/config.h>
25 #include <map>
27 #include "ChangingResource.hxx"
28 #include "ThreeDHelper.hxx"
30 #include <com/sun/star/chart2/CurveStyle.hpp>
31 #include <vcl/weld.hxx>
33 namespace com
35 namespace sun
37 namespace star
39 namespace beans
41 class XPropertySet;
46 namespace com
48 namespace sun
50 namespace star
52 namespace chart2
54 class XChartDocument;
59 namespace com
61 namespace sun
63 namespace star
65 namespace chart2
67 class XChartTypeTemplate;
72 namespace com
74 namespace sun
76 namespace star
78 namespace lang
80 class XMultiServiceFactory;
86 class SvtValueSet;
88 namespace chart
90 enum GlobalStackMode
92 GlobalStackMode_NONE,
93 GlobalStackMode_STACK_Y,
94 GlobalStackMode_STACK_Y_PERCENT,
95 GlobalStackMode_STACK_Z
98 class ChartTypeParameter
100 public:
101 ChartTypeParameter(sal_Int32 nSubTypeIndex, bool bXAxisWithValues = false, bool b3DLook = false,
102 GlobalStackMode eStackMode = GlobalStackMode_NONE, bool _bSymbols = true,
103 bool _bLines = true,
104 css::chart2::CurveStyle eCurveStyle = css::chart2::CurveStyle_LINES);
105 ChartTypeParameter();
107 bool mapsToSameService(const ChartTypeParameter& rParameter) const;
108 bool mapsToSimilarService(const ChartTypeParameter& rParameter,
109 sal_Int32 nTheHigherTheLess) const;
111 sal_Int32 nSubTypeIndex; //starting with 1
113 bool bXAxisWithValues;
114 bool b3DLook;
115 bool bSymbols;
116 bool bLines;
118 GlobalStackMode eStackMode;
119 css::chart2::CurveStyle eCurveStyle;
121 sal_Int32 nCurveResolution;
122 sal_Int32 nSplineOrder;
124 sal_Int32 nGeometry3D;
126 ThreeDLookScheme eThreeDLookScheme;
127 bool bSortByXValues;
129 bool mbRoundedEdge;
132 typedef std::map<OUString, ChartTypeParameter> tTemplateServiceChartTypeParameterMap;
134 class ChartTypeDialogController : public ChangingResource
136 public:
137 ChartTypeDialogController();
138 virtual ~ChartTypeDialogController() override;
140 virtual OUString getName() = 0;
141 virtual OUString getImage() = 0;
142 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const = 0;
143 virtual void fillSubTypeList(SvtValueSet& rSubTypeList, const ChartTypeParameter& rParameter);
145 virtual bool shouldShow_3DLookControl() const;
146 virtual bool shouldShow_StackingControl() const;
147 virtual bool shouldShow_SplineControl() const;
148 virtual bool shouldShow_GeometryControl() const;
149 virtual bool shouldShow_SortByXValuesResourceGroup() const;
151 virtual void showExtraControls(weld::Builder* pBuilder);
152 virtual void hideExtraControls() const;
153 virtual void
154 fillExtraControls(const css::uno::Reference<css::chart2::XChartDocument>& xChartModel,
155 const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const;
156 /// @throws css::uno::RuntimeException
157 virtual void setTemplateProperties(
158 const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const;
160 bool isSubType(const OUString& rServiceName);
161 ChartTypeParameter getChartTypeParameterForService(
162 const OUString& rServiceName,
163 const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps);
164 virtual void adjustSubTypeAndEnableControls(
165 ChartTypeParameter&
166 rParameter); //if you have different counts of subtypes you may need to adjust the index
167 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter);
168 virtual void adjustParameterToMainType(ChartTypeParameter& rParameter);
169 OUString getServiceNameForParameter(const ChartTypeParameter& rParameter) const;
170 void commitToModel(const ChartTypeParameter& rParameter,
171 const css::uno::Reference<css::chart2::XChartDocument>& xChartModel);
172 css::uno::Reference<css::chart2::XChartTypeTemplate> getCurrentTemplate(
173 const ChartTypeParameter& rParameter,
174 const css::uno::Reference<css::lang::XMultiServiceFactory>& xTemplateManager) const;
176 protected:
177 bool bSupportsXAxisWithValues;
178 bool bSupports3D;
181 class ColumnOrBarChartDialogController_Base : public ChartTypeDialogController
183 public:
184 ColumnOrBarChartDialogController_Base();
185 virtual ~ColumnOrBarChartDialogController_Base() override;
187 virtual bool shouldShow_3DLookControl() const override;
188 virtual bool shouldShow_GeometryControl() const override;
190 virtual void adjustSubTypeAndEnableControls(ChartTypeParameter& rParameter) override;
193 class ColumnChartDialogController : public ColumnOrBarChartDialogController_Base
195 public:
196 ColumnChartDialogController();
197 virtual ~ColumnChartDialogController() override;
199 virtual OUString getName() override;
200 virtual OUString getImage() override;
201 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
202 virtual void fillSubTypeList(SvtValueSet& rSubTypeList,
203 const ChartTypeParameter& rParameter) override;
206 class BarChartDialogController : public ColumnOrBarChartDialogController_Base
208 public:
209 BarChartDialogController();
210 virtual ~BarChartDialogController() override;
212 virtual OUString getName() override;
213 virtual OUString getImage() override;
214 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
215 virtual void fillSubTypeList(SvtValueSet& rSubTypeList,
216 const ChartTypeParameter& rParameter) override;
219 class PieChartDialogController : public ChartTypeDialogController
221 public:
222 PieChartDialogController();
223 virtual ~PieChartDialogController() override;
225 virtual OUString getName() override;
226 virtual OUString getImage() override;
227 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
228 virtual void fillSubTypeList(SvtValueSet& rSubTypeList,
229 const ChartTypeParameter& rParameter) override;
230 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
232 virtual bool shouldShow_3DLookControl() const override;
235 class LineChartDialogController : public ChartTypeDialogController
237 public:
238 LineChartDialogController();
239 virtual ~LineChartDialogController() override;
241 virtual OUString getName() override;
242 virtual OUString getImage() override;
243 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
244 virtual void fillSubTypeList(SvtValueSet& rSubTypeList,
245 const ChartTypeParameter& rParameter) override;
246 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
247 virtual void adjustParameterToMainType(ChartTypeParameter& rParameter) override;
249 virtual bool shouldShow_StackingControl() const override;
250 virtual bool shouldShow_SplineControl() const override;
253 class XYChartDialogController : public ChartTypeDialogController
255 public:
256 XYChartDialogController();
257 virtual ~XYChartDialogController() override;
259 virtual OUString getName() override;
260 virtual OUString getImage() override;
261 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
262 virtual void fillSubTypeList(SvtValueSet& rSubTypeList,
263 const ChartTypeParameter& rParameter) override;
264 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
266 virtual bool shouldShow_SplineControl() const override;
267 virtual bool shouldShow_SortByXValuesResourceGroup() const override;
270 class AreaChartDialogController : public ChartTypeDialogController
272 public:
273 AreaChartDialogController();
274 virtual ~AreaChartDialogController() override;
276 virtual OUString getName() override;
277 virtual OUString getImage() override;
278 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
279 virtual void fillSubTypeList(SvtValueSet& rSubTypeList,
280 const ChartTypeParameter& rParameter) override;
281 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
282 virtual void adjustParameterToMainType(ChartTypeParameter& rParameter) override;
284 virtual bool shouldShow_3DLookControl() const override;
287 class NetChartDialogController : public ChartTypeDialogController
289 public:
290 NetChartDialogController();
291 virtual ~NetChartDialogController() override;
293 virtual OUString getName() override;
294 virtual OUString getImage() override;
295 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
296 virtual void fillSubTypeList(SvtValueSet& rSubTypeList,
297 const ChartTypeParameter& rParameter) override;
298 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
300 virtual bool shouldShow_StackingControl() const override;
303 class StockChartDialogController : public ChartTypeDialogController
305 public:
306 StockChartDialogController();
307 virtual ~StockChartDialogController() override;
309 virtual OUString getName() override;
310 virtual OUString getImage() override;
311 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
312 virtual void fillSubTypeList(SvtValueSet& rSubTypeList,
313 const ChartTypeParameter& rParameter) override;
314 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
317 class CombiColumnLineChartDialogController : public ChartTypeDialogController
319 public:
320 CombiColumnLineChartDialogController();
322 virtual OUString getName() override;
323 virtual OUString getImage() override;
324 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
325 virtual void fillSubTypeList(SvtValueSet& rSubTypeList,
326 const ChartTypeParameter& rParameter) override;
327 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
329 virtual void showExtraControls(weld::Builder* pBuilder) override;
330 virtual void hideExtraControls() const override;
331 virtual void fillExtraControls(
332 const css::uno::Reference<css::chart2::XChartDocument>& xChartModel,
333 const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const override;
335 virtual void setTemplateProperties(
336 const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const override;
338 private:
339 DECL_LINK(ChangeLineCountHdl, weld::SpinButton&, void);
341 private:
342 std::unique_ptr<weld::Label> m_xFT_NumberOfLines;
343 std::unique_ptr<weld::SpinButton> m_xMF_NumberOfLines;
346 class BubbleChartDialogController : public ChartTypeDialogController
348 public:
349 BubbleChartDialogController();
350 virtual ~BubbleChartDialogController() override;
352 virtual OUString getName() override;
353 virtual OUString getImage() override;
354 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
355 virtual void fillSubTypeList(SvtValueSet& rSubTypeList,
356 const ChartTypeParameter& rParameter) override;
357 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
360 } //namespace chart
361 #endif
363 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */