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 <com/sun/star/chart2/XChartDocument.hpp>
32 #include <com/sun/star/chart2/XChartTypeTemplate.hpp>
33 #include <vcl/builder.hxx>
34 #include <vcl/button.hxx>
35 #include <vcl/field.hxx>
36 #include <vcl/fixed.hxx>
37 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
47 GlobalStackMode_STACK_Y
,
48 GlobalStackMode_STACK_Y_PERCENT
,
49 GlobalStackMode_STACK_Z
52 class ChartTypeParameter
55 ChartTypeParameter( sal_Int32 nSubTypeIndex
, bool bXAxisWithValues
=false
56 , bool b3DLook
=false, GlobalStackMode eStackMode
=GlobalStackMode_NONE
57 , bool _bSymbols
= true, bool _bLines
= true
58 , css::chart2::CurveStyle eCurveStyle
= css::chart2::CurveStyle_LINES
);
61 bool mapsToSameService( const ChartTypeParameter
& rParameter
) const;
62 bool mapsToSimilarService( const ChartTypeParameter
& rParameter
, sal_Int32 nTheHigherTheLess
) const;
64 sal_Int32 nSubTypeIndex
;//starting with 1
66 bool bXAxisWithValues
;
71 GlobalStackMode eStackMode
;
72 css::chart2::CurveStyle eCurveStyle
;
74 sal_Int32 nCurveResolution
;
75 sal_Int32 nSplineOrder
;
77 sal_Int32 nGeometry3D
;
79 ThreeDLookScheme eThreeDLookScheme
;
85 typedef std::map
< OUString
, ChartTypeParameter
> tTemplateServiceChartTypeParameterMap
;
87 class ChartTypeDialogController
: public ChangingResource
90 ChartTypeDialogController();
91 virtual ~ChartTypeDialogController() override
;
93 virtual OUString
getName()=0;
94 virtual Image
getImage();
95 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const = 0;
96 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
);
98 virtual bool shouldShow_3DLookControl() const;
99 virtual bool shouldShow_StackingControl() const;
100 virtual bool shouldShow_DeepStackingControl() const;
101 virtual bool shouldShow_SplineControl() const;
102 virtual bool shouldShow_GeometryControl() const;
103 virtual bool shouldShow_SortByXValuesResourceGroup() const;
104 virtual bool shouldShow_GL3DResourceGroup() const;
106 virtual void showExtraControls(VclBuilderContainer
* pParent
);
107 virtual void hideExtraControls() const;
108 virtual void fillExtraControls( const ChartTypeParameter
& rParameter
109 , const css::uno::Reference
< css::chart2::XChartDocument
>& xChartModel
110 , const css::uno::Reference
< css::beans::XPropertySet
>& xTemplateProps
) const;
111 /// @throws css::uno::RuntimeException
112 virtual void setTemplateProperties( const css::uno::Reference
< css::beans::XPropertySet
>& xTemplateProps
) const;
114 bool isSubType( const OUString
& rServiceName
);
115 ChartTypeParameter
getChartTypeParameterForService( const OUString
& rServiceName
, const css::uno::Reference
<
116 css::beans::XPropertySet
>& xTemplateProps
);
117 virtual void adjustSubTypeAndEnableControls( ChartTypeParameter
& rParameter
);//if you have different counts of subtypes you may need to adjust the index
118 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
);
119 virtual void adjustParameterToMainType( ChartTypeParameter
& rParameter
);
120 OUString
getServiceNameForParameter( const ChartTypeParameter
& rParameter
) const;
121 void commitToModel( const ChartTypeParameter
& rParameter
122 , const css::uno::Reference
< css::chart2::XChartDocument
>& xChartModel
);
124 css::chart2::XChartTypeTemplate
> getCurrentTemplate( const ChartTypeParameter
& rParameter
125 , const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xTemplateManager
) const;
128 bool bSupportsXAxisWithValues
;
132 class ColumnOrBarChartDialogController_Base
: public ChartTypeDialogController
135 ColumnOrBarChartDialogController_Base();
136 virtual ~ColumnOrBarChartDialogController_Base() override
;
138 virtual bool shouldShow_3DLookControl() const override
;
139 virtual bool shouldShow_GeometryControl() const override
;
141 virtual void adjustSubTypeAndEnableControls( ChartTypeParameter
& rParameter
) override
;
144 class ColumnChartDialogController
: public ColumnOrBarChartDialogController_Base
147 ColumnChartDialogController();
148 virtual ~ColumnChartDialogController() override
;
150 virtual OUString
getName() override
;
151 virtual Image
getImage() override
;
152 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
153 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) override
;
156 class BarChartDialogController
: public ColumnOrBarChartDialogController_Base
159 BarChartDialogController();
160 virtual ~BarChartDialogController() override
;
162 virtual OUString
getName() override
;
163 virtual Image
getImage() override
;
164 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
165 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) override
;
168 class PieChartDialogController
: public ChartTypeDialogController
171 PieChartDialogController();
172 virtual ~PieChartDialogController() override
;
174 virtual OUString
getName() override
;
175 virtual Image
getImage() override
;
176 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
177 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) override
;
178 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) override
;
180 virtual bool shouldShow_3DLookControl() const override
;
183 class LineChartDialogController
: public ChartTypeDialogController
186 LineChartDialogController();
187 virtual ~LineChartDialogController() override
;
189 virtual OUString
getName() override
;
190 virtual Image
getImage() override
;
191 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
192 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) override
;
193 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) override
;
194 virtual void adjustParameterToMainType( ChartTypeParameter
& rParameter
) override
;
196 virtual bool shouldShow_StackingControl() const override
;
197 virtual bool shouldShow_DeepStackingControl() const override
;
198 virtual bool shouldShow_SplineControl() const override
;
201 class XYChartDialogController
: public ChartTypeDialogController
204 XYChartDialogController();
205 virtual ~XYChartDialogController() override
;
207 virtual OUString
getName() override
;
208 virtual Image
getImage() override
;
209 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
210 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) override
;
211 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) override
;
213 virtual bool shouldShow_SplineControl() const override
;
214 virtual bool shouldShow_SortByXValuesResourceGroup() const override
;
217 class AreaChartDialogController
: public ChartTypeDialogController
220 AreaChartDialogController();
221 virtual ~AreaChartDialogController() override
;
223 virtual OUString
getName() override
;
224 virtual Image
getImage() override
;
225 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
226 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) override
;
227 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) override
;
228 virtual void adjustParameterToMainType( ChartTypeParameter
& rParameter
) override
;
230 virtual bool shouldShow_3DLookControl() const override
;
233 class NetChartDialogController
: public ChartTypeDialogController
236 NetChartDialogController();
237 virtual ~NetChartDialogController() override
;
239 virtual OUString
getName() override
;
240 virtual Image
getImage() override
;
241 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
242 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) override
;
243 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) override
;
245 virtual bool shouldShow_StackingControl() const override
;
248 class StockChartDialogController
: public ChartTypeDialogController
251 StockChartDialogController();
252 virtual ~StockChartDialogController() override
;
254 virtual OUString
getName() override
;
255 virtual Image
getImage() override
;
256 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
257 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) override
;
258 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) override
;
261 class CombiColumnLineChartDialogController
: public ChartTypeDialogController
264 CombiColumnLineChartDialogController();
266 virtual OUString
getName() override
;
267 virtual Image
getImage() override
;
268 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
269 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) override
;
270 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) override
;
272 virtual void showExtraControls(VclBuilderContainer
* pParent
) override
;
273 virtual void hideExtraControls() const override
;
274 virtual void fillExtraControls( const ChartTypeParameter
& rParameter
275 , const css::uno::Reference
< css::chart2::XChartDocument
>& xChartModel
276 , const css::uno::Reference
< css::beans::XPropertySet
>& xTemplateProps
) const override
;
278 virtual void setTemplateProperties( const css::uno::Reference
< css::beans::XPropertySet
>& xTemplateProps
) const override
;
281 DECL_LINK( ChangeLineCountHdl
, Edit
&, void );
284 VclPtr
<FixedText
> m_pFT_NumberOfLines
;
285 VclPtr
<NumericField
> m_pMF_NumberOfLines
;
288 class BubbleChartDialogController
: public ChartTypeDialogController
291 BubbleChartDialogController();
292 virtual ~BubbleChartDialogController() override
;
294 virtual OUString
getName() override
;
295 virtual Image
getImage() override
;
296 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const override
;
297 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) override
;
298 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) override
;
304 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */