1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ChartTypeDialogController.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CHART2_CHARTTYPE_DIALOG_CONTROLLER_HXX
32 #define _CHART2_CHARTTYPE_DIALOG_CONTROLLER_HXX
34 #include "ChangingResource.hxx"
35 #include "ThreeDHelper.hxx"
36 #include <comphelper/InlineContainer.hxx>
38 #include <com/sun/star/chart2/CurveStyle.hpp>
39 #include <com/sun/star/chart2/XChartDocument.hpp>
40 #include <com/sun/star/chart2/XChartTypeTemplate.hpp>
41 #include <svtools/valueset.hxx>
42 // header for class CheckBox
43 #ifndef _SV_BUTTON_HXX
44 #include <vcl/button.hxx>
46 // header for class FixedText
47 #include <vcl/fixed.hxx>
48 // header for class MetricField
49 #include <vcl/field.hxx>
50 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
52 //.............................................................................
55 //.............................................................................
57 //-----------------------------------------------------------------------------
64 GlobalStackMode_STACK_Y
,
65 GlobalStackMode_STACK_Y_PERCENT
,
66 GlobalStackMode_STACK_Z
69 class ChartTypeParameter
72 ChartTypeParameter( sal_Int32 nSubTypeIndex
, bool bXAxisWithValues
=false
73 , bool b3DLook
=false, GlobalStackMode eStackMode
=GlobalStackMode_NONE
74 , bool _bSymbols
= true, bool _bLines
= true
75 , ::com::sun::star::chart2::CurveStyle eCurveStyle
= ::com::sun::star::chart2::CurveStyle_LINES
);
77 virtual ~ChartTypeParameter();
79 bool mapsToSameService( const ChartTypeParameter
& rParameter
) const;
80 bool mapsToSimilarService( const ChartTypeParameter
& rParameter
, sal_Int32 nTheHigherTheLess
) const;
82 sal_Int32 nSubTypeIndex
;//starting with 1
84 bool bXAxisWithValues
;
89 GlobalStackMode eStackMode
;
90 ::com::sun::star::chart2::CurveStyle eCurveStyle
;
92 sal_Int32 nCurveResolution
;
93 sal_Int32 nSplineOrder
;
95 sal_Int32 nGeometry3D
;
97 ThreeDLookScheme eThreeDLookScheme
;
98 sal_Bool bSortByXValues
;
101 typedef ::comphelper::MakeMap
< ::rtl::OUString
, ChartTypeParameter
> tTemplateServiceChartTypeParameterMap
;
103 class ChartTypeDialogController
: public ChangingResource
106 ChartTypeDialogController();
107 virtual ~ChartTypeDialogController();
109 virtual String
getName()=0;
110 virtual Image
getImage( bool bIsHighContrast
);
111 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const = 0;
112 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
);
114 virtual bool shouldShow_XAxisTypeControl() const;
115 virtual bool shouldShow_3DLookControl() const;
116 virtual bool shouldShow_StackingControl() const;
117 virtual bool shouldShow_DeepStackingControl() const;
118 virtual bool shouldShow_SplineControl() const;
119 virtual bool shouldShow_GeometryControl() const;
120 virtual bool shouldShow_SortByXValuesResourceGroup() const;
122 virtual void showExtraControls( Window
* pParent
, const Point
& rPosition
, const Size
& rSize
);
123 virtual void hideExtraControls() const;
124 virtual void fillExtraControls( const ChartTypeParameter
& rParameter
125 , const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
>& xChartModel
126 , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xTemplateProps
=::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>() ) const;
127 virtual void setTemplateProperties( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xTemplateProps
) const throw (::com::sun::star::uno::RuntimeException
);
129 virtual bool isSubType( const rtl::OUString
& rServiceName
);
130 virtual ChartTypeParameter
getChartTypeParameterForService( const rtl::OUString
& rServiceName
, const ::com::sun::star::uno::Reference
<
131 ::com::sun::star::beans::XPropertySet
>& xTemplateProps
);
132 virtual void adjustSubTypeAndEnableControls( ChartTypeParameter
& rParameter
);//if you have different counts of subtypes you may need to adjust the index
133 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
);
134 virtual void adjustParameterToMainType( ChartTypeParameter
& rParameter
);
135 virtual rtl::OUString
getServiceNameForParameter( const ChartTypeParameter
& rParameter
) const;
136 virtual bool commitToModel( const ChartTypeParameter
& rParameter
137 , const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
>& xChartModel
);
138 virtual ::com::sun::star::uno::Reference
<
139 ::com::sun::star::chart2::XChartTypeTemplate
> getCurrentTemplate( const ChartTypeParameter
& rParameter
140 , const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xTemplateManager
) const;
143 bool bSupportsXAxisWithValues
;
147 class ColumnOrBarChartDialogController_Base
: public ChartTypeDialogController
150 ColumnOrBarChartDialogController_Base();
151 virtual ~ColumnOrBarChartDialogController_Base();
153 virtual bool shouldShow_3DLookControl() const;
154 virtual bool shouldShow_GeometryControl() const;
156 virtual void adjustSubTypeAndEnableControls( ChartTypeParameter
& rParameter
);
159 class ColumnChartDialogController
: public ColumnOrBarChartDialogController_Base
162 ColumnChartDialogController();
163 virtual ~ColumnChartDialogController();
165 virtual String
getName();
166 virtual Image
getImage( bool bIsHighContrast
);
167 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const;
168 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
);
171 class BarChartDialogController
: public ColumnOrBarChartDialogController_Base
174 BarChartDialogController();
175 virtual ~BarChartDialogController();
177 virtual String
getName();
178 virtual Image
getImage( bool bIsHighContrast
);
179 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const;
180 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
);
183 class PieChartDialogController
: public ChartTypeDialogController
186 PieChartDialogController();
187 virtual ~PieChartDialogController();
189 virtual String
getName();
190 virtual Image
getImage( bool bIsHighContrast
);
191 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const;
192 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
);
193 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
);
195 virtual bool shouldShow_3DLookControl() const;
198 class LineChartDialogController
: public ChartTypeDialogController
201 LineChartDialogController();
202 virtual ~LineChartDialogController();
204 virtual String
getName();
205 virtual Image
getImage( bool bIsHighContrast
);
206 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const;
207 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
);
208 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
);
209 virtual void adjustParameterToMainType( ChartTypeParameter
& rParameter
);
211 virtual bool shouldShow_StackingControl() const;
212 virtual bool shouldShow_DeepStackingControl() const;
213 virtual bool shouldShow_SplineControl() const;
216 class XYChartDialogController
: public ChartTypeDialogController
219 XYChartDialogController();
220 virtual ~XYChartDialogController();
222 virtual String
getName();
223 virtual Image
getImage( bool bIsHighContrast
);
224 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const;
225 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
);
226 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
);
228 virtual bool shouldShow_SplineControl() const;
229 virtual bool shouldShow_SortByXValuesResourceGroup() const;
232 class AreaChartDialogController
: public ChartTypeDialogController
235 AreaChartDialogController();
236 virtual ~AreaChartDialogController();
238 virtual String
getName();
239 virtual Image
getImage( bool bIsHighContrast
);
240 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const;
241 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
);
242 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
);
243 virtual void adjustParameterToMainType( ChartTypeParameter
& rParameter
);
245 virtual bool shouldShow_3DLookControl() const;
248 class NetChartDialogController
: public ChartTypeDialogController
251 NetChartDialogController();
252 virtual ~NetChartDialogController();
254 virtual String
getName();
255 virtual Image
getImage( bool bIsHighContrast
);
256 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const;
257 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
);
258 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
);
260 virtual bool shouldShow_StackingControl() const;
263 class StockChartDialogController
: public ChartTypeDialogController
266 StockChartDialogController();
267 virtual ~StockChartDialogController();
269 virtual String
getName();
270 virtual Image
getImage( bool bIsHighContrast
);
271 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const;
272 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
);
273 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
);
276 class CombiColumnLineChartDialogController
: public ChartTypeDialogController
279 CombiColumnLineChartDialogController();
280 virtual ~CombiColumnLineChartDialogController();
282 virtual String
getName();
283 virtual Image
getImage( bool bIsHighContrast
);
284 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const;
285 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
);
286 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
);
288 virtual void showExtraControls( Window
* pParent
, const Point
& rPosition
, const Size
& rSize
);
289 virtual void hideExtraControls() const;
290 virtual void fillExtraControls( const ChartTypeParameter
& rParameter
291 , const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
>& xChartModel
292 , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xTemplateProps
=::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>() ) const;
294 virtual void setTemplateProperties( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xTemplateProps
) const throw (::com::sun::star::uno::RuntimeException
);
297 DECL_LINK( ChangeLineCountHdl
, void* );
300 FixedText
* m_pFT_NumberOfLines
;
301 MetricField
* m_pMF_NumberOfLines
;
304 class BubbleChartDialogController
: public ChartTypeDialogController
307 BubbleChartDialogController();
308 virtual ~BubbleChartDialogController();
310 virtual String
getName();
311 virtual Image
getImage( bool bIsHighContrast
);
312 virtual const tTemplateServiceChartTypeParameterMap
& getTemplateMap() const;
313 virtual void fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
);
314 virtual void adjustParameterToSubType( ChartTypeParameter
& rParameter
);
317 //.............................................................................
319 //.............................................................................