Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / chart2 / source / controller / dialogs / ChartTypeDialogController.hxx
blob1e3830e981f980a750c97a751cd379b77ee10576
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
25 #include <map>
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>
39 class ValueSet;
41 namespace chart
44 enum GlobalStackMode
46 GlobalStackMode_NONE,
47 GlobalStackMode_STACK_Y,
48 GlobalStackMode_STACK_Y_PERCENT,
49 GlobalStackMode_STACK_Z
52 class ChartTypeParameter
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 , css::chart2::CurveStyle eCurveStyle = css::chart2::CurveStyle_LINES );
59 ChartTypeParameter();
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;
67 bool b3DLook;
68 bool bSymbols;
69 bool bLines;
71 GlobalStackMode eStackMode;
72 css::chart2::CurveStyle eCurveStyle;
74 sal_Int32 nCurveResolution;
75 sal_Int32 nSplineOrder;
77 sal_Int32 nGeometry3D;
79 ThreeDLookScheme eThreeDLookScheme;
80 bool bSortByXValues;
82 bool mbRoundedEdge;
85 typedef std::map< OUString, ChartTypeParameter > tTemplateServiceChartTypeParameterMap;
87 class ChartTypeDialogController : public ChangingResource
89 public:
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 );
123 css::uno::Reference<
124 css::chart2::XChartTypeTemplate > getCurrentTemplate( const ChartTypeParameter& rParameter
125 , const css::uno::Reference< css::lang::XMultiServiceFactory >& xTemplateManager ) const;
127 protected:
128 bool bSupportsXAxisWithValues;
129 bool bSupports3D;
132 class ColumnOrBarChartDialogController_Base : public ChartTypeDialogController
134 public:
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
146 public:
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
158 public:
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
170 public:
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
185 public:
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
203 public:
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
219 public:
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
235 public:
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
250 public:
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
263 public:
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;
280 private:
281 DECL_LINK( ChangeLineCountHdl, Edit&, void );
283 private:
284 VclPtr<FixedText> m_pFT_NumberOfLines;
285 VclPtr<NumericField> m_pMF_NumberOfLines;
288 class BubbleChartDialogController : public ChartTypeDialogController
290 public:
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;
301 } //namespace chart
302 #endif
304 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */