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 _CHART2_CHARTTYPE_DIALOG_CONTROLLER_HXX
21 : #define _CHART2_CHARTTYPE_DIALOG_CONTROLLER_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 : // header for class CheckBox
31 : #include <vcl/button.hxx>
32 : // header for class FixedText
33 : #include <vcl/fixed.hxx>
34 : // header for class MetricField
35 : #include <vcl/field.hxx>
36 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37 :
38 : class ValueSet;
39 :
40 : //.............................................................................
41 : namespace chart
42 : {
43 : //.............................................................................
44 :
45 : //-----------------------------------------------------------------------------
46 : /**
47 : */
48 :
49 : enum GlobalStackMode
50 : {
51 : GlobalStackMode_NONE,
52 : GlobalStackMode_STACK_Y,
53 : GlobalStackMode_STACK_Y_PERCENT,
54 : GlobalStackMode_STACK_Z
55 : };
56 :
57 0 : class ChartTypeParameter
58 : {
59 : public:
60 : ChartTypeParameter( sal_Int32 nSubTypeIndex, bool bXAxisWithValues=false
61 : , bool b3DLook=false, GlobalStackMode eStackMode=GlobalStackMode_NONE
62 : , bool _bSymbols = true, bool _bLines = true
63 : , ::com::sun::star::chart2::CurveStyle eCurveStyle = ::com::sun::star::chart2::CurveStyle_LINES );
64 : ChartTypeParameter();
65 : virtual ~ChartTypeParameter();
66 :
67 : bool mapsToSameService( const ChartTypeParameter& rParameter ) const;
68 : bool mapsToSimilarService( const ChartTypeParameter& rParameter, sal_Int32 nTheHigherTheLess ) const;
69 :
70 : sal_Int32 nSubTypeIndex;//starting with 1
71 :
72 : bool bXAxisWithValues;
73 : bool b3DLook;
74 : bool bSymbols;
75 : bool bLines;
76 :
77 : GlobalStackMode eStackMode;
78 : ::com::sun::star::chart2::CurveStyle eCurveStyle;
79 :
80 : sal_Int32 nCurveResolution;
81 : sal_Int32 nSplineOrder;
82 :
83 : sal_Int32 nGeometry3D;
84 :
85 : ThreeDLookScheme eThreeDLookScheme;
86 : bool bSortByXValues;
87 : };
88 :
89 : typedef ::comphelper::MakeMap< ::rtl::OUString, ChartTypeParameter > tTemplateServiceChartTypeParameterMap;
90 :
91 : class ChartTypeDialogController : public ChangingResource
92 : {
93 : public:
94 : ChartTypeDialogController();
95 : virtual ~ChartTypeDialogController();
96 :
97 : virtual String getName()=0;
98 : virtual Image getImage();
99 : virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const = 0;
100 : virtual void fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter );
101 :
102 : virtual bool shouldShow_XAxisTypeControl() const;
103 : virtual bool shouldShow_3DLookControl() const;
104 : virtual bool shouldShow_StackingControl() const;
105 : virtual bool shouldShow_DeepStackingControl() const;
106 : virtual bool shouldShow_SplineControl() const;
107 : virtual bool shouldShow_GeometryControl() const;
108 : virtual bool shouldShow_SortByXValuesResourceGroup() const;
109 :
110 : virtual void showExtraControls( Window* pParent, const Point& rPosition, const Size& rSize );
111 : virtual void hideExtraControls() const;
112 : virtual void fillExtraControls( const ChartTypeParameter& rParameter
113 : , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartModel
114 : , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTemplateProps=::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >() ) const;
115 : virtual void setTemplateProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTemplateProps ) const throw (::com::sun::star::uno::RuntimeException);
116 :
117 : virtual bool isSubType( const rtl::OUString& rServiceName );
118 : virtual ChartTypeParameter getChartTypeParameterForService( const rtl::OUString& rServiceName, const ::com::sun::star::uno::Reference<
119 : ::com::sun::star::beans::XPropertySet >& xTemplateProps );
120 : virtual void adjustSubTypeAndEnableControls( ChartTypeParameter& rParameter );//if you have different counts of subtypes you may need to adjust the index
121 : virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
122 : virtual void adjustParameterToMainType( ChartTypeParameter& rParameter );
123 : virtual rtl::OUString getServiceNameForParameter( const ChartTypeParameter& rParameter ) const;
124 : virtual bool commitToModel( const ChartTypeParameter& rParameter
125 : , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartModel );
126 : virtual ::com::sun::star::uno::Reference<
127 : ::com::sun::star::chart2::XChartTypeTemplate > getCurrentTemplate( const ChartTypeParameter& rParameter
128 : , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xTemplateManager ) const;
129 :
130 : protected:
131 : bool bSupportsXAxisWithValues;
132 : bool bSupports3D;
133 : };
134 :
135 : class ColumnOrBarChartDialogController_Base : public ChartTypeDialogController
136 : {
137 : public:
138 : ColumnOrBarChartDialogController_Base();
139 : virtual ~ColumnOrBarChartDialogController_Base();
140 :
141 : virtual bool shouldShow_3DLookControl() const;
142 : virtual bool shouldShow_GeometryControl() const;
143 :
144 : virtual void adjustSubTypeAndEnableControls( ChartTypeParameter& rParameter );
145 : };
146 :
147 : class ColumnChartDialogController : public ColumnOrBarChartDialogController_Base
148 : {
149 : public:
150 : ColumnChartDialogController();
151 : virtual ~ColumnChartDialogController();
152 :
153 : virtual String getName();
154 : virtual Image getImage();
155 : virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
156 : virtual void fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter );
157 : };
158 :
159 : class BarChartDialogController : public ColumnOrBarChartDialogController_Base
160 : {
161 : public:
162 : BarChartDialogController();
163 : virtual ~BarChartDialogController();
164 :
165 : virtual String getName();
166 : virtual Image getImage();
167 : virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
168 : virtual void fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter );
169 : };
170 :
171 : class PieChartDialogController : public ChartTypeDialogController
172 : {
173 : public:
174 : PieChartDialogController();
175 : virtual ~PieChartDialogController();
176 :
177 : virtual String getName();
178 : virtual Image getImage();
179 : virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
180 : virtual void fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter );
181 : virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
182 :
183 : virtual bool shouldShow_3DLookControl() const;
184 : };
185 :
186 : class LineChartDialogController : public ChartTypeDialogController
187 : {
188 : public:
189 : LineChartDialogController();
190 : virtual ~LineChartDialogController();
191 :
192 : virtual String getName();
193 : virtual Image getImage();
194 : virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
195 : virtual void fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter );
196 : virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
197 : virtual void adjustParameterToMainType( ChartTypeParameter& rParameter );
198 :
199 : virtual bool shouldShow_StackingControl() const;
200 : virtual bool shouldShow_DeepStackingControl() const;
201 : virtual bool shouldShow_SplineControl() const;
202 : };
203 :
204 : class XYChartDialogController : public ChartTypeDialogController
205 : {
206 : public:
207 : XYChartDialogController();
208 : virtual ~XYChartDialogController();
209 :
210 : virtual String getName();
211 : virtual Image getImage();
212 : virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
213 : virtual void fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter );
214 : virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
215 :
216 : virtual bool shouldShow_SplineControl() const;
217 : virtual bool shouldShow_SortByXValuesResourceGroup() const;
218 : };
219 :
220 : class AreaChartDialogController : public ChartTypeDialogController
221 : {
222 : public:
223 : AreaChartDialogController();
224 : virtual ~AreaChartDialogController();
225 :
226 : virtual String getName();
227 : virtual Image getImage();
228 : virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
229 : virtual void fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter );
230 : virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
231 : virtual void adjustParameterToMainType( ChartTypeParameter& rParameter );
232 :
233 : virtual bool shouldShow_3DLookControl() const;
234 : };
235 :
236 : class NetChartDialogController : public ChartTypeDialogController
237 : {
238 : public:
239 : NetChartDialogController();
240 : virtual ~NetChartDialogController();
241 :
242 : virtual String getName();
243 : virtual Image getImage();
244 : virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
245 : virtual void fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter );
246 : virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
247 :
248 : virtual bool shouldShow_StackingControl() const;
249 : };
250 :
251 : class StockChartDialogController : public ChartTypeDialogController
252 : {
253 : public:
254 : StockChartDialogController();
255 : virtual ~StockChartDialogController();
256 :
257 : virtual String getName();
258 : virtual Image getImage();
259 : virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
260 : virtual void fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter );
261 : virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
262 : };
263 :
264 : class CombiColumnLineChartDialogController : public ChartTypeDialogController
265 : {
266 : public:
267 : CombiColumnLineChartDialogController();
268 : virtual ~CombiColumnLineChartDialogController();
269 :
270 : virtual String getName();
271 : virtual Image getImage();
272 : virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
273 : virtual void fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter );
274 : virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
275 :
276 : virtual void showExtraControls( Window* pParent, const Point& rPosition, const Size& rSize );
277 : virtual void hideExtraControls() const;
278 : virtual void fillExtraControls( const ChartTypeParameter& rParameter
279 : , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartModel
280 : , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTemplateProps=::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >() ) const;
281 :
282 : virtual void setTemplateProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTemplateProps ) const throw (::com::sun::star::uno::RuntimeException);
283 :
284 : private:
285 : DECL_LINK( ChangeLineCountHdl, void* );
286 :
287 : private:
288 : FixedText* m_pFT_NumberOfLines;
289 : MetricField* m_pMF_NumberOfLines;
290 : };
291 :
292 : class BubbleChartDialogController : public ChartTypeDialogController
293 : {
294 : public:
295 : BubbleChartDialogController();
296 : virtual ~BubbleChartDialogController();
297 :
298 : virtual String getName();
299 : virtual Image getImage();
300 : virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
301 : virtual void fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter );
302 : virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
303 : };
304 :
305 : //.............................................................................
306 : } //namespace chart
307 : //.............................................................................
308 : #endif
309 :
310 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|