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 "ChangingResource.hxx"
24 #include "ThreeDHelper.hxx"
25 #include <comphelper/InlineContainer.hxx>
27 #include <com/sun/star/chart2/CurveStyle.hpp>
28 #include <com/sun/star/chart2/XChartDocument.hpp>
29 #include <com/sun/star/chart2/XChartTypeTemplate.hpp>
30 #include <vcl/builder.hxx>
31 #include <vcl/button.hxx>
32 #include <vcl/field.hxx>
33 #include <vcl/fixed.hxx>
34 #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 , ::com::sun::star::chart2::CurveStyle eCurveStyle
= ::com::sun::star::chart2::CurveStyle_LINES
);
60 virtual ~ChartTypeParameter();
62 bool mapsToSameService( const ChartTypeParameter
& rParameter
) const;
63 bool mapsToSimilarService( const ChartTypeParameter
& rParameter
, sal_Int32 nTheHigherTheLess
) const;
65 sal_Int32 nSubTypeIndex
;//starting with 1
67 bool bXAxisWithValues
;
72 GlobalStackMode eStackMode
;
73 ::com::sun::star::chart2::CurveStyle eCurveStyle
;
75 sal_Int32 nCurveResolution
;
76 sal_Int32 nSplineOrder
;
78 sal_Int32 nGeometry3D
;
80 ThreeDLookScheme eThreeDLookScheme
;
86 typedef ::comphelper::MakeMap
< OUString
, ChartTypeParameter
> tTemplateServiceChartTypeParameterMap
;
88 class ChartTypeDialogController
: public ChangingResource
91 ChartTypeDialogController();
92 virtual ~ChartTypeDialogController();
94 virtual OUString
getName()=0;
95 virtual Image
getImage();
96 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const = 0;
97 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
);
99 virtual bool shouldShow_3DLookControl() const;
100 virtual bool shouldShow_StackingControl() const;
101 virtual bool shouldShow_DeepStackingControl() const;
102 virtual bool shouldShow_SplineControl() const;
103 virtual bool shouldShow_GeometryControl() const;
104 virtual bool shouldShow_SortByXValuesResourceGroup() const;
105 virtual bool shouldShow_GL3DResourceGroup() const;
107 virtual void showExtraControls(VclBuilderContainer
* pParent
);
108 virtual void hideExtraControls() const;
109 virtual void fillExtraControls( const ChartTypeParameter
& rParameter
110 , const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
>& xChartModel
111 , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xTemplateProps
=::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>() ) const;
112 virtual void setTemplateProperties( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xTemplateProps
) const throw (::com::sun::star::uno::RuntimeException
);
114 bool isSubType( const OUString
& rServiceName
);
115 ChartTypeParameter
getChartTypeParameterForService( const OUString
& rServiceName
, const ::com::sun::star::uno::Reference
<
116 ::com::sun::star::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 bool commitToModel( const ChartTypeParameter
& rParameter
122 , const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
>& xChartModel
);
123 ::com::sun::star::uno::Reference
<
124 ::com::sun::star::chart2::XChartTypeTemplate
> getCurrentTemplate( const ChartTypeParameter
& rParameter
125 , const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xTemplateManager
) const;
128 bool bSupportsXAxisWithValues
;
132 class ColumnOrBarChartDialogController_Base
: public ChartTypeDialogController
135 ColumnOrBarChartDialogController_Base();
136 virtual ~ColumnOrBarChartDialogController_Base();
138 virtual bool shouldShow_3DLookControl() const SAL_OVERRIDE
;
139 virtual bool shouldShow_GeometryControl() const SAL_OVERRIDE
;
141 virtual void adjustSubTypeAndEnableControls( ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
144 class ColumnChartDialogController
: public ColumnOrBarChartDialogController_Base
147 ColumnChartDialogController();
148 virtual ~ColumnChartDialogController();
150 virtual OUString
getName() SAL_OVERRIDE
;
151 virtual Image
getImage() SAL_OVERRIDE
;
152 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const SAL_OVERRIDE
;
153 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
156 class BarChartDialogController
: public ColumnOrBarChartDialogController_Base
159 BarChartDialogController();
160 virtual ~BarChartDialogController();
162 virtual OUString
getName() SAL_OVERRIDE
;
163 virtual Image
getImage() SAL_OVERRIDE
;
164 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const SAL_OVERRIDE
;
165 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
168 class PieChartDialogController
: public ChartTypeDialogController
171 PieChartDialogController();
172 virtual ~PieChartDialogController();
174 virtual OUString
getName() SAL_OVERRIDE
;
175 virtual Image
getImage() SAL_OVERRIDE
;
176 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const SAL_OVERRIDE
;
177 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
178 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
180 virtual bool shouldShow_3DLookControl() const SAL_OVERRIDE
;
183 class LineChartDialogController
: public ChartTypeDialogController
186 LineChartDialogController();
187 virtual ~LineChartDialogController();
189 virtual OUString
getName() SAL_OVERRIDE
;
190 virtual Image
getImage() SAL_OVERRIDE
;
191 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const SAL_OVERRIDE
;
192 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
193 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
194 virtual void adjustParameterToMainType( ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
196 virtual bool shouldShow_StackingControl() const SAL_OVERRIDE
;
197 virtual bool shouldShow_DeepStackingControl() const SAL_OVERRIDE
;
198 virtual bool shouldShow_SplineControl() const SAL_OVERRIDE
;
201 class XYChartDialogController
: public ChartTypeDialogController
204 XYChartDialogController();
205 virtual ~XYChartDialogController();
207 virtual OUString
getName() SAL_OVERRIDE
;
208 virtual Image
getImage() SAL_OVERRIDE
;
209 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const SAL_OVERRIDE
;
210 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
211 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
213 virtual bool shouldShow_SplineControl() const SAL_OVERRIDE
;
214 virtual bool shouldShow_SortByXValuesResourceGroup() const SAL_OVERRIDE
;
217 class AreaChartDialogController
: public ChartTypeDialogController
220 AreaChartDialogController();
221 virtual ~AreaChartDialogController();
223 virtual OUString
getName() SAL_OVERRIDE
;
224 virtual Image
getImage() SAL_OVERRIDE
;
225 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const SAL_OVERRIDE
;
226 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
227 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
228 virtual void adjustParameterToMainType( ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
230 virtual bool shouldShow_3DLookControl() const SAL_OVERRIDE
;
233 class NetChartDialogController
: public ChartTypeDialogController
236 NetChartDialogController();
237 virtual ~NetChartDialogController();
239 virtual OUString
getName() SAL_OVERRIDE
;
240 virtual Image
getImage() SAL_OVERRIDE
;
241 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const SAL_OVERRIDE
;
242 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
243 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
245 virtual bool shouldShow_StackingControl() const SAL_OVERRIDE
;
248 class StockChartDialogController
: public ChartTypeDialogController
251 StockChartDialogController();
252 virtual ~StockChartDialogController();
254 virtual OUString
getName() SAL_OVERRIDE
;
255 virtual Image
getImage() SAL_OVERRIDE
;
256 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const SAL_OVERRIDE
;
257 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
258 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
261 class CombiColumnLineChartDialogController
: public ChartTypeDialogController
264 CombiColumnLineChartDialogController();
266 virtual OUString
getName() SAL_OVERRIDE
;
267 virtual Image
getImage() SAL_OVERRIDE
;
268 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const SAL_OVERRIDE
;
269 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
270 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
272 virtual void showExtraControls(VclBuilderContainer
* pParent
) SAL_OVERRIDE
;
273 virtual void hideExtraControls() const SAL_OVERRIDE
;
274 virtual void fillExtraControls( const ChartTypeParameter
& rParameter
275 , const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
>& xChartModel
276 , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xTemplateProps
=::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>() ) const SAL_OVERRIDE
;
278 virtual void setTemplateProperties( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xTemplateProps
) const throw (::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
281 DECL_LINK( ChangeLineCountHdl
, void* );
284 VclPtr
<FixedText
> m_pFT_NumberOfLines
;
285 VclPtr
<NumericField
> m_pMF_NumberOfLines
;
288 class BubbleChartDialogController
: public ChartTypeDialogController
291 BubbleChartDialogController();
292 virtual ~BubbleChartDialogController();
294 virtual OUString
getName() SAL_OVERRIDE
;
295 virtual Image
getImage() SAL_OVERRIDE
;
296 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const SAL_OVERRIDE
;
297 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
298 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
) SAL_OVERRIDE
;
304 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */