tdf#36709 editeng: Layout for font-relative first-line indent
[LibreOffice.git] / chart2 / source / inc / ChartTypeDialogController.hxx
blobcbeeb8b59406ff3d6285c0a60cf418f1fad54eac
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 #pragma once
22 #include <sal/config.h>
24 #include <map>
26 #include "ChangingResource.hxx"
27 #include "ThreeDHelper.hxx"
29 #include <com/sun/star/chart2/CurveStyle.hpp>
30 #include <vcl/weld.hxx>
32 namespace com::sun::star::beans
34 class XPropertySet;
36 namespace com::sun::star::chart2
38 class XChartDocument;
40 namespace com::sun::star::lang
42 class XMultiServiceFactory;
45 class ValueSet;
47 namespace chart
49 class ChartModel;
50 class ChartTypeTemplate;
51 class ChartTypeManager;
53 enum GlobalStackMode
55 GlobalStackMode_NONE,
56 GlobalStackMode_STACK_Y,
57 GlobalStackMode_STACK_Y_PERCENT,
58 GlobalStackMode_STACK_Z
61 class ChartTypeParameter
63 public:
64 ChartTypeParameter(sal_Int32 nSubTypeIndex, bool bXAxisWithValues = false, bool b3DLook = false,
65 GlobalStackMode eStackMode = GlobalStackMode_NONE, bool _bSymbols = true,
66 bool _bLines = true,
67 css::chart2::CurveStyle eCurveStyle = css::chart2::CurveStyle_LINES);
68 ChartTypeParameter();
70 bool mapsToSameService(const ChartTypeParameter& rParameter) const;
71 bool mapsToSimilarService(const ChartTypeParameter& rParameter,
72 sal_Int32 nTheHigherTheLess) const;
74 sal_Int32 nSubTypeIndex; //starting with 1
76 bool bXAxisWithValues;
77 bool b3DLook;
78 bool bSymbols;
79 bool bLines;
81 GlobalStackMode eStackMode;
82 css::chart2::CurveStyle eCurveStyle;
84 sal_Int32 nCurveResolution;
85 sal_Int32 nSplineOrder;
87 sal_Int32 nGeometry3D;
89 ThreeDLookScheme eThreeDLookScheme;
90 bool bSortByXValues;
92 bool mbRoundedEdge;
95 typedef std::map<OUString, ChartTypeParameter> tTemplateServiceChartTypeParameterMap;
97 class ChartTypeDialogController : public ChangingResource
99 public:
100 ChartTypeDialogController();
101 virtual ~ChartTypeDialogController() override;
103 virtual OUString getName() = 0;
104 virtual OUString getImage() = 0;
105 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const = 0;
106 virtual void fillSubTypeList(ValueSet& rSubTypeList, const ChartTypeParameter& rParameter);
108 virtual bool shouldShow_3DLookControl() const;
109 virtual bool shouldShow_StackingControl() const;
110 virtual bool shouldShow_SplineControl() const;
111 virtual bool shouldShow_GeometryControl() const;
112 virtual bool shouldShow_SortByXValuesResourceGroup() const;
114 virtual void showExtraControls(weld::Builder* pBuilder);
115 virtual void hideExtraControls() const;
116 virtual void
117 fillExtraControls(const rtl::Reference<::chart::ChartModel>& xChartModel,
118 const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const;
119 /// @throws css::uno::RuntimeException
120 virtual void setTemplateProperties(
121 const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const;
123 bool isSubType(const OUString& rServiceName);
124 ChartTypeParameter getChartTypeParameterForService(
125 const OUString& rServiceName,
126 const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps);
127 virtual void adjustSubTypeAndEnableControls(
128 ChartTypeParameter&
129 rParameter); //if you have different counts of subtypes you may need to adjust the index
130 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter);
131 virtual void adjustParameterToMainType(ChartTypeParameter& rParameter);
132 OUString getServiceNameForParameter(const ChartTypeParameter& rParameter) const;
133 void commitToModel(const ChartTypeParameter& rParameter,
134 const rtl::Reference<::chart::ChartModel>& xChartModel);
135 rtl::Reference<::chart::ChartTypeTemplate>
136 getCurrentTemplate(const ChartTypeParameter& rParameter,
137 const rtl::Reference<::chart::ChartTypeManager>& xTemplateManager) const;
139 protected:
140 bool bSupportsXAxisWithValues;
141 bool bSupports3D;
144 class ColumnOrBarChartDialogController_Base : public ChartTypeDialogController
146 public:
147 ColumnOrBarChartDialogController_Base();
148 virtual ~ColumnOrBarChartDialogController_Base() override;
150 virtual bool shouldShow_3DLookControl() const override;
151 virtual bool shouldShow_GeometryControl() const override;
153 virtual void adjustSubTypeAndEnableControls(ChartTypeParameter& rParameter) override;
156 class ColumnChartDialogController final : public ColumnOrBarChartDialogController_Base
158 public:
159 ColumnChartDialogController();
160 virtual ~ColumnChartDialogController() override;
162 virtual OUString getName() override;
163 virtual OUString getImage() override;
164 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
165 virtual void fillSubTypeList(ValueSet& rSubTypeList,
166 const ChartTypeParameter& rParameter) override;
169 class BarChartDialogController final : public ColumnOrBarChartDialogController_Base
171 public:
172 BarChartDialogController();
173 virtual ~BarChartDialogController() override;
175 virtual OUString getName() override;
176 virtual OUString getImage() override;
177 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
178 virtual void fillSubTypeList(ValueSet& rSubTypeList,
179 const ChartTypeParameter& rParameter) override;
182 class HistogramChartDialogController final : public ChartTypeDialogController
184 public:
185 HistogramChartDialogController();
186 virtual ~HistogramChartDialogController() override;
188 virtual OUString getName() override;
189 virtual OUString getImage() override;
190 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
191 virtual void fillSubTypeList(ValueSet& rSubTypeList,
192 const ChartTypeParameter& rParameter) override;
193 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
196 class PieChartDialogController final : public ChartTypeDialogController
198 public:
199 PieChartDialogController();
200 virtual ~PieChartDialogController() override;
202 virtual OUString getName() override;
203 virtual OUString getImage() override;
204 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
205 virtual void fillSubTypeList(ValueSet& rSubTypeList,
206 const ChartTypeParameter& rParameter) override;
207 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
209 virtual bool shouldShow_3DLookControl() const override;
212 class OfPieChartDialogController final : public ChartTypeDialogController
214 public:
215 OfPieChartDialogController();
216 virtual ~OfPieChartDialogController() override;
218 virtual OUString getName() override;
219 virtual OUString getImage() override;
220 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
221 virtual void fillSubTypeList(ValueSet& rSubTypeList,
222 const ChartTypeParameter& rParameter) override;
223 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
225 virtual bool shouldShow_3DLookControl() const override;
227 virtual void showExtraControls(weld::Builder* pBuilder) override;
228 virtual void hideExtraControls() const override;
229 virtual void fillExtraControls(
230 const rtl::Reference<::chart::ChartModel>& xChartModel,
231 const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const override;
233 virtual void setTemplateProperties(
234 const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const override;
236 private:
237 DECL_LINK(ChangeCompositeSizeHdl, weld::SpinButton&, void);
239 private:
240 std::unique_ptr<weld::Label> m_xFT_CompositeSize;
241 std::unique_ptr<weld::SpinButton> m_xMF_CompositeSize;
244 class LineChartDialogController final : public ChartTypeDialogController
246 public:
247 LineChartDialogController();
248 virtual ~LineChartDialogController() override;
250 virtual OUString getName() override;
251 virtual OUString getImage() override;
252 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
253 virtual void fillSubTypeList(ValueSet& rSubTypeList,
254 const ChartTypeParameter& rParameter) override;
255 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
256 virtual void adjustParameterToMainType(ChartTypeParameter& rParameter) override;
258 virtual bool shouldShow_StackingControl() const override;
259 virtual bool shouldShow_SplineControl() const override;
262 class XYChartDialogController final : public ChartTypeDialogController
264 public:
265 XYChartDialogController();
266 virtual ~XYChartDialogController() override;
268 virtual OUString getName() override;
269 virtual OUString getImage() override;
270 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
271 virtual void fillSubTypeList(ValueSet& rSubTypeList,
272 const ChartTypeParameter& rParameter) override;
273 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
275 virtual bool shouldShow_SplineControl() const override;
276 virtual bool shouldShow_SortByXValuesResourceGroup() const override;
279 class AreaChartDialogController final : public ChartTypeDialogController
281 public:
282 AreaChartDialogController();
283 virtual ~AreaChartDialogController() override;
285 virtual OUString getName() override;
286 virtual OUString getImage() override;
287 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
288 virtual void fillSubTypeList(ValueSet& rSubTypeList,
289 const ChartTypeParameter& rParameter) override;
290 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
291 virtual void adjustParameterToMainType(ChartTypeParameter& rParameter) override;
293 virtual bool shouldShow_3DLookControl() const override;
296 class NetChartDialogController final : public ChartTypeDialogController
298 public:
299 NetChartDialogController();
300 virtual ~NetChartDialogController() override;
302 virtual OUString getName() override;
303 virtual OUString getImage() override;
304 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
305 virtual void fillSubTypeList(ValueSet& rSubTypeList,
306 const ChartTypeParameter& rParameter) override;
307 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
309 virtual bool shouldShow_StackingControl() const override;
312 class StockChartDialogController final : public ChartTypeDialogController
314 public:
315 StockChartDialogController();
316 virtual ~StockChartDialogController() override;
318 virtual OUString getName() override;
319 virtual OUString getImage() override;
320 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
321 virtual void fillSubTypeList(ValueSet& rSubTypeList,
322 const ChartTypeParameter& rParameter) override;
323 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
326 class CombiColumnLineChartDialogController final : public ChartTypeDialogController
328 public:
329 CombiColumnLineChartDialogController();
331 virtual OUString getName() override;
332 virtual OUString getImage() override;
333 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
334 virtual void fillSubTypeList(ValueSet& rSubTypeList,
335 const ChartTypeParameter& rParameter) override;
336 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
338 virtual void showExtraControls(weld::Builder* pBuilder) override;
339 virtual void hideExtraControls() const override;
340 virtual void fillExtraControls(
341 const rtl::Reference<::chart::ChartModel>& xChartModel,
342 const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const override;
344 virtual void setTemplateProperties(
345 const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const override;
347 private:
348 DECL_LINK(ChangeLineCountHdl, weld::SpinButton&, void);
350 private:
351 std::unique_ptr<weld::Label> m_xFT_NumberOfLines;
352 std::unique_ptr<weld::SpinButton> m_xMF_NumberOfLines;
355 class BubbleChartDialogController final : public ChartTypeDialogController
357 public:
358 BubbleChartDialogController();
359 virtual ~BubbleChartDialogController() override;
361 virtual OUString getName() override;
362 virtual OUString getImage() override;
363 virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
364 virtual void fillSubTypeList(ValueSet& rSubTypeList,
365 const ChartTypeParameter& rParameter) override;
366 virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
369 } //namespace chart
371 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */