Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPEDIALOGCONTROLLER_HXX
21 : #define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPEDIALOGCONTROLLER_HXX
22 :
23 : #include "ChangingResource.hxx"
24 : #include "ThreeDHelper.hxx"
25 : #include <comphelper/InlineContainer.hxx>
26 :
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>
35 :
36 : class ValueSet;
37 :
38 : namespace chart
39 : {
40 :
41 : /**
42 : */
43 :
44 : enum GlobalStackMode
45 : {
46 : GlobalStackMode_NONE,
47 : GlobalStackMode_STACK_Y,
48 : GlobalStackMode_STACK_Y_PERCENT,
49 : GlobalStackMode_STACK_Z
50 : };
51 :
52 0 : class ChartTypeParameter
53 : {
54 : public:
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 );
59 : ChartTypeParameter();
60 : virtual ~ChartTypeParameter();
61 :
62 : bool mapsToSameService( const ChartTypeParameter& rParameter ) const;
63 : bool mapsToSimilarService( const ChartTypeParameter& rParameter, sal_Int32 nTheHigherTheLess ) const;
64 :
65 : sal_Int32 nSubTypeIndex;//starting with 1
66 :
67 : bool bXAxisWithValues;
68 : bool b3DLook;
69 : bool bSymbols;
70 : bool bLines;
71 :
72 : GlobalStackMode eStackMode;
73 : ::com::sun::star::chart2::CurveStyle eCurveStyle;
74 :
75 : sal_Int32 nCurveResolution;
76 : sal_Int32 nSplineOrder;
77 :
78 : sal_Int32 nGeometry3D;
79 :
80 : ThreeDLookScheme eThreeDLookScheme;
81 : bool bSortByXValues;
82 :
83 : bool mbRoundedEdge;
84 : };
85 :
86 : typedef ::comphelper::MakeMap< OUString, ChartTypeParameter > tTemplateServiceChartTypeParameterMap;
87 :
88 : class ChartTypeDialogController : public ChangingResource
89 : {
90 : public:
91 : ChartTypeDialogController();
92 : virtual ~ChartTypeDialogController();
93 :
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 );
98 :
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;
106 :
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);
113 :
114 : virtual bool isSubType( const OUString& rServiceName );
115 : virtual 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 : virtual OUString getServiceNameForParameter( const ChartTypeParameter& rParameter ) const;
121 : virtual bool commitToModel( const ChartTypeParameter& rParameter
122 : , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartModel );
123 : virtual ::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;
126 :
127 : protected:
128 : bool bSupportsXAxisWithValues;
129 : bool bSupports3D;
130 : };
131 :
132 : class ColumnOrBarChartDialogController_Base : public ChartTypeDialogController
133 : {
134 : public:
135 : ColumnOrBarChartDialogController_Base();
136 : virtual ~ColumnOrBarChartDialogController_Base();
137 :
138 : virtual bool shouldShow_3DLookControl() const SAL_OVERRIDE;
139 : virtual bool shouldShow_GeometryControl() const SAL_OVERRIDE;
140 :
141 : virtual void adjustSubTypeAndEnableControls( ChartTypeParameter& rParameter ) SAL_OVERRIDE;
142 : };
143 :
144 : class ColumnChartDialogController : public ColumnOrBarChartDialogController_Base
145 : {
146 : public:
147 : ColumnChartDialogController();
148 : virtual ~ColumnChartDialogController();
149 :
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;
154 : };
155 :
156 : class BarChartDialogController : public ColumnOrBarChartDialogController_Base
157 : {
158 : public:
159 : BarChartDialogController();
160 : virtual ~BarChartDialogController();
161 :
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;
166 : };
167 :
168 : class PieChartDialogController : public ChartTypeDialogController
169 : {
170 : public:
171 : PieChartDialogController();
172 : virtual ~PieChartDialogController();
173 :
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;
179 :
180 : virtual bool shouldShow_3DLookControl() const SAL_OVERRIDE;
181 : };
182 :
183 : class LineChartDialogController : public ChartTypeDialogController
184 : {
185 : public:
186 : LineChartDialogController();
187 : virtual ~LineChartDialogController();
188 :
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;
195 :
196 : virtual bool shouldShow_StackingControl() const SAL_OVERRIDE;
197 : virtual bool shouldShow_DeepStackingControl() const SAL_OVERRIDE;
198 : virtual bool shouldShow_SplineControl() const SAL_OVERRIDE;
199 : };
200 :
201 : class XYChartDialogController : public ChartTypeDialogController
202 : {
203 : public:
204 : XYChartDialogController();
205 : virtual ~XYChartDialogController();
206 :
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;
212 :
213 : virtual bool shouldShow_SplineControl() const SAL_OVERRIDE;
214 : virtual bool shouldShow_SortByXValuesResourceGroup() const SAL_OVERRIDE;
215 : };
216 :
217 : class AreaChartDialogController : public ChartTypeDialogController
218 : {
219 : public:
220 : AreaChartDialogController();
221 : virtual ~AreaChartDialogController();
222 :
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;
229 :
230 : virtual bool shouldShow_3DLookControl() const SAL_OVERRIDE;
231 : };
232 :
233 : class NetChartDialogController : public ChartTypeDialogController
234 : {
235 : public:
236 : NetChartDialogController();
237 : virtual ~NetChartDialogController();
238 :
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;
244 :
245 : virtual bool shouldShow_StackingControl() const SAL_OVERRIDE;
246 : };
247 :
248 : class StockChartDialogController : public ChartTypeDialogController
249 : {
250 : public:
251 : StockChartDialogController();
252 : virtual ~StockChartDialogController();
253 :
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;
259 : };
260 :
261 0 : class CombiColumnLineChartDialogController : public ChartTypeDialogController
262 : {
263 : public:
264 : CombiColumnLineChartDialogController();
265 :
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;
271 :
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;
277 :
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;
279 :
280 : private:
281 : DECL_LINK( ChangeLineCountHdl, void* );
282 :
283 : private:
284 : FixedText* m_pFT_NumberOfLines;
285 : NumericField* m_pMF_NumberOfLines;
286 : };
287 :
288 : class BubbleChartDialogController : public ChartTypeDialogController
289 : {
290 : public:
291 : BubbleChartDialogController();
292 : virtual ~BubbleChartDialogController();
293 :
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;
299 : };
300 :
301 : } //namespace chart
302 : #endif
303 :
304 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|