1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <sal/config.h>
26 #include "ChangingResource.hxx"
27 #include "ThreeDHelper.hxx"
29 #include <com/sun/star/chart2/CurveStyle.hpp>
30 #include <vcl/weld.hxx>
32 namespace com::sun::star::beans
36 namespace com::sun::star::chart2
40 namespace com::sun::star::lang
42 class XMultiServiceFactory
;
50 class ChartTypeTemplate
;
51 class ChartTypeManager
;
56 GlobalStackMode_STACK_Y
,
57 GlobalStackMode_STACK_Y_PERCENT
,
58 GlobalStackMode_STACK_Z
61 class ChartTypeParameter
64 ChartTypeParameter(sal_Int32 nSubTypeIndex
, bool bXAxisWithValues
= false, bool b3DLook
= false,
65 GlobalStackMode eStackMode
= GlobalStackMode_NONE
, bool _bSymbols
= true,
67 css::chart2::CurveStyle eCurveStyle
= css::chart2::CurveStyle_LINES
);
70 bool mapsToSameService(const ChartTypeParameter
& rParameter
) const;
71 bool mapsToSimilarService(const ChartTypeParameter
& rParameter
,
72 sal_Int32 nTheHigherTheLess
) const;
74 sal_Int32 nSubTypeIndex
; //starting with 1
76 bool bXAxisWithValues
;
81 GlobalStackMode eStackMode
;
82 css::chart2::CurveStyle eCurveStyle
;
84 sal_Int32 nCurveResolution
;
85 sal_Int32 nSplineOrder
;
87 sal_Int32 nGeometry3D
;
89 ThreeDLookScheme eThreeDLookScheme
;
95 typedef std::map
<OUString
, ChartTypeParameter
> tTemplateServiceChartTypeParameterMap
;
97 class ChartTypeDialogController
: public ChangingResource
100 ChartTypeDialogController();
101 virtual ~ChartTypeDialogController() override
;
103 virtual OUString
getName() = 0;
104 virtual OUString
getImage() = 0;
105 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const = 0;
106 virtual void fillSubTypeList(ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
);
108 virtual bool shouldShow_3DLookControl() const;
109 virtual bool shouldShow_StackingControl() const;
110 virtual bool shouldShow_SplineControl() const;
111 virtual bool shouldShow_GeometryControl() const;
112 virtual bool shouldShow_SortByXValuesResourceGroup() const;
114 virtual void showExtraControls(weld::Builder
* pBuilder
);
115 virtual void hideExtraControls() const;
117 fillExtraControls(const rtl::Reference
<::chart::ChartModel
>& xChartModel
,
118 const css::uno::Reference
<css::beans::XPropertySet
>& xTemplateProps
) const;
119 /// @throws css::uno::RuntimeException
120 virtual void setTemplateProperties(
121 const css::uno::Reference
<css::beans::XPropertySet
>& xTemplateProps
) const;
123 bool isSubType(const OUString
& rServiceName
);
124 ChartTypeParameter
getChartTypeParameterForService(
125 const OUString
& rServiceName
,
126 const css::uno::Reference
<css::beans::XPropertySet
>& xTemplateProps
);
127 virtual void adjustSubTypeAndEnableControls(
129 rParameter
); //if you have different counts of subtypes you may need to adjust the index
130 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
);
131 virtual void adjustParameterToMainType(ChartTypeParameter
& rParameter
);
132 OUString
getServiceNameForParameter(const ChartTypeParameter
& rParameter
) const;
133 void commitToModel(const ChartTypeParameter
& rParameter
,
134 const rtl::Reference
<::chart::ChartModel
>& xChartModel
);
135 rtl::Reference
<::chart::ChartTypeTemplate
>
136 getCurrentTemplate(const ChartTypeParameter
& rParameter
,
137 const rtl::Reference
<::chart::ChartTypeManager
>& xTemplateManager
) const;
140 bool bSupportsXAxisWithValues
;
144 class ColumnOrBarChartDialogController_Base
: public ChartTypeDialogController
147 ColumnOrBarChartDialogController_Base();
148 virtual ~ColumnOrBarChartDialogController_Base() override
;
150 virtual bool shouldShow_3DLookControl() const override
;
151 virtual bool shouldShow_GeometryControl() const override
;
153 virtual void adjustSubTypeAndEnableControls(ChartTypeParameter
& rParameter
) override
;
156 class ColumnChartDialogController final
: public ColumnOrBarChartDialogController_Base
159 ColumnChartDialogController();
160 virtual ~ColumnChartDialogController() override
;
162 virtual OUString
getName() override
;
163 virtual OUString
getImage() override
;
164 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
165 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
166 const ChartTypeParameter
& rParameter
) override
;
169 class BarChartDialogController final
: public ColumnOrBarChartDialogController_Base
172 BarChartDialogController();
173 virtual ~BarChartDialogController() override
;
175 virtual OUString
getName() override
;
176 virtual OUString
getImage() override
;
177 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
178 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
179 const ChartTypeParameter
& rParameter
) override
;
182 class HistogramChartDialogController final
: public ChartTypeDialogController
185 HistogramChartDialogController();
186 virtual ~HistogramChartDialogController() override
;
188 virtual OUString
getName() override
;
189 virtual OUString
getImage() override
;
190 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
191 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
192 const ChartTypeParameter
& rParameter
) override
;
193 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
196 class PieChartDialogController final
: public ChartTypeDialogController
199 PieChartDialogController();
200 virtual ~PieChartDialogController() override
;
202 virtual OUString
getName() override
;
203 virtual OUString
getImage() override
;
204 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
205 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
206 const ChartTypeParameter
& rParameter
) override
;
207 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
209 virtual bool shouldShow_3DLookControl() const override
;
212 class OfPieChartDialogController final
: public ChartTypeDialogController
215 OfPieChartDialogController();
216 virtual ~OfPieChartDialogController() override
;
218 virtual OUString
getName() override
;
219 virtual OUString
getImage() override
;
220 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
221 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
222 const ChartTypeParameter
& rParameter
) override
;
223 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
225 virtual bool shouldShow_3DLookControl() const override
;
227 virtual void showExtraControls(weld::Builder
* pBuilder
) override
;
228 virtual void hideExtraControls() const override
;
229 virtual void fillExtraControls(
230 const rtl::Reference
<::chart::ChartModel
>& xChartModel
,
231 const css::uno::Reference
<css::beans::XPropertySet
>& xTemplateProps
) const override
;
233 virtual void setTemplateProperties(
234 const css::uno::Reference
<css::beans::XPropertySet
>& xTemplateProps
) const override
;
237 DECL_LINK(ChangeCompositeSizeHdl
, weld::SpinButton
&, void);
240 std::unique_ptr
<weld::Label
> m_xFT_CompositeSize
;
241 std::unique_ptr
<weld::SpinButton
> m_xMF_CompositeSize
;
244 class LineChartDialogController final
: public ChartTypeDialogController
247 LineChartDialogController();
248 virtual ~LineChartDialogController() override
;
250 virtual OUString
getName() override
;
251 virtual OUString
getImage() override
;
252 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
253 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
254 const ChartTypeParameter
& rParameter
) override
;
255 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
256 virtual void adjustParameterToMainType(ChartTypeParameter
& rParameter
) override
;
258 virtual bool shouldShow_StackingControl() const override
;
259 virtual bool shouldShow_SplineControl() const override
;
262 class XYChartDialogController final
: public ChartTypeDialogController
265 XYChartDialogController();
266 virtual ~XYChartDialogController() override
;
268 virtual OUString
getName() override
;
269 virtual OUString
getImage() override
;
270 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
271 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
272 const ChartTypeParameter
& rParameter
) override
;
273 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
275 virtual bool shouldShow_SplineControl() const override
;
276 virtual bool shouldShow_SortByXValuesResourceGroup() const override
;
279 class AreaChartDialogController final
: public ChartTypeDialogController
282 AreaChartDialogController();
283 virtual ~AreaChartDialogController() override
;
285 virtual OUString
getName() override
;
286 virtual OUString
getImage() override
;
287 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
288 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
289 const ChartTypeParameter
& rParameter
) override
;
290 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
291 virtual void adjustParameterToMainType(ChartTypeParameter
& rParameter
) override
;
293 virtual bool shouldShow_3DLookControl() const override
;
296 class NetChartDialogController final
: public ChartTypeDialogController
299 NetChartDialogController();
300 virtual ~NetChartDialogController() override
;
302 virtual OUString
getName() override
;
303 virtual OUString
getImage() override
;
304 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
305 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
306 const ChartTypeParameter
& rParameter
) override
;
307 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
309 virtual bool shouldShow_StackingControl() const override
;
312 class StockChartDialogController final
: public ChartTypeDialogController
315 StockChartDialogController();
316 virtual ~StockChartDialogController() override
;
318 virtual OUString
getName() override
;
319 virtual OUString
getImage() override
;
320 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
321 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
322 const ChartTypeParameter
& rParameter
) override
;
323 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
326 class CombiColumnLineChartDialogController final
: public ChartTypeDialogController
329 CombiColumnLineChartDialogController();
331 virtual OUString
getName() override
;
332 virtual OUString
getImage() override
;
333 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
334 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
335 const ChartTypeParameter
& rParameter
) override
;
336 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
338 virtual void showExtraControls(weld::Builder
* pBuilder
) override
;
339 virtual void hideExtraControls() const override
;
340 virtual void fillExtraControls(
341 const rtl::Reference
<::chart::ChartModel
>& xChartModel
,
342 const css::uno::Reference
<css::beans::XPropertySet
>& xTemplateProps
) const override
;
344 virtual void setTemplateProperties(
345 const css::uno::Reference
<css::beans::XPropertySet
>& xTemplateProps
) const override
;
348 DECL_LINK(ChangeLineCountHdl
, weld::SpinButton
&, void);
351 std::unique_ptr
<weld::Label
> m_xFT_NumberOfLines
;
352 std::unique_ptr
<weld::SpinButton
> m_xMF_NumberOfLines
;
355 class BubbleChartDialogController final
: public ChartTypeDialogController
358 BubbleChartDialogController();
359 virtual ~BubbleChartDialogController() override
;
361 virtual OUString
getName() override
;
362 virtual OUString
getImage() override
;
363 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
364 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
365 const ChartTypeParameter
& rParameter
) override
;
366 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
371 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */