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 .
20 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPEDIALOGCONTROLLER_HXX
21 #define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPEDIALOGCONTROLLER_HXX
23 #include <sal/config.h>
27 #include "ChangingResource.hxx"
28 #include "ThreeDHelper.hxx"
30 #include <com/sun/star/chart2/CurveStyle.hpp>
31 #include <vcl/weld.hxx>
67 class XChartTypeTemplate
;
80 class XMultiServiceFactory
;
93 GlobalStackMode_STACK_Y
,
94 GlobalStackMode_STACK_Y_PERCENT
,
95 GlobalStackMode_STACK_Z
98 class ChartTypeParameter
101 ChartTypeParameter(sal_Int32 nSubTypeIndex
, bool bXAxisWithValues
= false, bool b3DLook
= false,
102 GlobalStackMode eStackMode
= GlobalStackMode_NONE
, bool _bSymbols
= 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
;
118 GlobalStackMode eStackMode
;
119 css::chart2::CurveStyle eCurveStyle
;
121 sal_Int32 nCurveResolution
;
122 sal_Int32 nSplineOrder
;
124 sal_Int32 nGeometry3D
;
126 ThreeDLookScheme eThreeDLookScheme
;
132 typedef std::map
<OUString
, ChartTypeParameter
> tTemplateServiceChartTypeParameterMap
;
134 class ChartTypeDialogController
: public ChangingResource
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;
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(
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;
177 bool bSupportsXAxisWithValues
;
181 class ColumnOrBarChartDialogController_Base
: public ChartTypeDialogController
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
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
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
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
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
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
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
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
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
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
;
339 DECL_LINK(ChangeLineCountHdl
, weld::SpinButton
&, void);
342 std::unique_ptr
<weld::Label
> m_xFT_NumberOfLines
;
343 std::unique_ptr
<weld::SpinButton
> m_xMF_NumberOfLines
;
346 class BubbleChartDialogController
: public ChartTypeDialogController
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
;
363 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */