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 PieChartDialogController final
: public ChartTypeDialogController
185 PieChartDialogController();
186 virtual ~PieChartDialogController() 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
;
195 virtual bool shouldShow_3DLookControl() const override
;
198 class LineChartDialogController final
: public ChartTypeDialogController
201 LineChartDialogController();
202 virtual ~LineChartDialogController() override
;
204 virtual OUString
getName() override
;
205 virtual OUString
getImage() override
;
206 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
207 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
208 const ChartTypeParameter
& rParameter
) override
;
209 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
210 virtual void adjustParameterToMainType(ChartTypeParameter
& rParameter
) override
;
212 virtual bool shouldShow_StackingControl() const override
;
213 virtual bool shouldShow_SplineControl() const override
;
216 class XYChartDialogController final
: public ChartTypeDialogController
219 XYChartDialogController();
220 virtual ~XYChartDialogController() override
;
222 virtual OUString
getName() override
;
223 virtual OUString
getImage() override
;
224 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
225 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
226 const ChartTypeParameter
& rParameter
) override
;
227 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
229 virtual bool shouldShow_SplineControl() const override
;
230 virtual bool shouldShow_SortByXValuesResourceGroup() const override
;
233 class AreaChartDialogController final
: public ChartTypeDialogController
236 AreaChartDialogController();
237 virtual ~AreaChartDialogController() override
;
239 virtual OUString
getName() override
;
240 virtual OUString
getImage() override
;
241 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
242 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
243 const ChartTypeParameter
& rParameter
) override
;
244 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
245 virtual void adjustParameterToMainType(ChartTypeParameter
& rParameter
) override
;
247 virtual bool shouldShow_3DLookControl() const override
;
250 class NetChartDialogController final
: public ChartTypeDialogController
253 NetChartDialogController();
254 virtual ~NetChartDialogController() override
;
256 virtual OUString
getName() override
;
257 virtual OUString
getImage() override
;
258 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
259 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
260 const ChartTypeParameter
& rParameter
) override
;
261 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
263 virtual bool shouldShow_StackingControl() const override
;
266 class StockChartDialogController final
: public ChartTypeDialogController
269 StockChartDialogController();
270 virtual ~StockChartDialogController() override
;
272 virtual OUString
getName() override
;
273 virtual OUString
getImage() override
;
274 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
275 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
276 const ChartTypeParameter
& rParameter
) override
;
277 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
280 class CombiColumnLineChartDialogController final
: public ChartTypeDialogController
283 CombiColumnLineChartDialogController();
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
;
292 virtual void showExtraControls(weld::Builder
* pBuilder
) override
;
293 virtual void hideExtraControls() const override
;
294 virtual void fillExtraControls(
295 const rtl::Reference
<::chart::ChartModel
>& xChartModel
,
296 const css::uno::Reference
<css::beans::XPropertySet
>& xTemplateProps
) const override
;
298 virtual void setTemplateProperties(
299 const css::uno::Reference
<css::beans::XPropertySet
>& xTemplateProps
) const override
;
302 DECL_LINK(ChangeLineCountHdl
, weld::SpinButton
&, void);
305 std::unique_ptr
<weld::Label
> m_xFT_NumberOfLines
;
306 std::unique_ptr
<weld::SpinButton
> m_xMF_NumberOfLines
;
309 class BubbleChartDialogController final
: public ChartTypeDialogController
312 BubbleChartDialogController();
313 virtual ~BubbleChartDialogController() override
;
315 virtual OUString
getName() override
;
316 virtual OUString
getImage() override
;
317 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
318 virtual void fillSubTypeList(ValueSet
& rSubTypeList
,
319 const ChartTypeParameter
& rParameter
) override
;
320 virtual void adjustParameterToSubType(ChartTypeParameter
& rParameter
) override
;
325 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */