1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX
21 #define INCLUDED_OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX
23 #include <drawingml/chart/converterbase.hxx>
25 namespace com
{ namespace sun
{ namespace star
{
26 namespace chart2
{ class XChartType
; }
27 namespace chart2
{ class XCoordinateSystem
; }
28 namespace chart2
{ class XDataSeries
; }
29 namespace chart2
{ class XDiagram
; }
30 namespace chart2
{ namespace data
{ class XLabeledDataSequence
; } }
37 /** Enumerates different chart types. */
40 TYPEID_BAR
, /// Vertical bar chart.
41 TYPEID_HORBAR
, /// Horizontal bar chart.
42 TYPEID_LINE
, /// Line chart.
43 TYPEID_AREA
, /// Area chart.
44 TYPEID_STOCK
, /// Stock chart.
45 TYPEID_RADARLINE
, /// Linear radar chart.
46 TYPEID_RADARAREA
, /// Filled radar chart.
47 TYPEID_PIE
, /// Pie chart.
48 TYPEID_DOUGHNUT
, /// Doughnut (ring) chart.
49 TYPEID_OFPIE
, /// Pie-to-pie or pie-to-bar chart.
50 TYPEID_SCATTER
, /// Scatter (XY) chart.
51 TYPEID_BUBBLE
, /// Bubble chart.
52 TYPEID_SURFACE
, /// Surface chart.
53 TYPEID_UNKNOWN
/// Default for unknown chart types.
56 /** Enumerates different categories of similar chart types. */
59 TYPECATEGORY_BAR
, /// Bar charts (horizontal or vertical).
60 TYPECATEGORY_LINE
, /// Line charts (line, area, stock charts).
61 TYPECATEGORY_RADAR
, /// Radar charts (linear or filled).
62 TYPECATEGORY_PIE
, /// Pie and donut charts.
63 TYPECATEGORY_SCATTER
, /// Scatter and bubble charts.
64 TYPECATEGORY_SURFACE
/// Surface charts.
67 /** Enumerates modes for varying point colors in a series. */
70 VARPOINTMODE_NONE
, /// No varied colors supported.
71 VARPOINTMODE_SINGLE
, /// Only supported, if type group contains only one series.
72 VARPOINTMODE_MULTI
/// Supported for multiple series in a chart type group.
75 /** Contains info for a chart type related to the OpenOffice.org chart module. */
78 TypeId meTypeId
; /// Unique chart type identifier.
79 TypeCategory meTypeCategory
; /// Category this chart type belongs to.
80 const sal_Char
* mpcServiceName
; /// Service name of the type.
81 VarPointMode meVarPointMode
; /// Mode for varying point colors.
82 sal_Int32 mnDefLabelPos
; /// Default data label position (API constant).
83 bool mbPolarCoordSystem
; /// True = polar, false = cartesian.
84 bool mbSeriesIsFrame2d
; /// True = 2D type series with area formatting.
85 bool mbSingleSeriesVis
; /// True = only first series visible (e.g. pie charts).
86 bool mbCategoryAxis
; /// True = X axis contains categories.
87 bool mbSwappedAxesSet
; /// True = X axis and Y axis are swapped.
88 bool mbSupportsStacking
; /// True = data points can be stacked on each other.
89 bool mbReverseSeries
; /// True = insert unstacked series in reverse order.
90 bool mbPictureOptions
; /// True = bitmaps support options from c:pictureOptions.
93 const TypeGroupInfo
& GetTypeGroupInfo( TypeId eType
);
95 struct UpDownBarsModel
;
97 class UpDownBarsConverter
: public ConverterBase
< UpDownBarsModel
>
100 explicit UpDownBarsConverter( const ConverterRoot
& rParent
, UpDownBarsModel
& rModel
);
101 virtual ~UpDownBarsConverter() override
;
103 /** Converts the OOXML up/down bars. */
104 void convertFromModel(
105 const css::uno::Reference
< css::chart2::XChartType
>& rxChartType
);
108 struct TypeGroupModel
;
111 class TypeGroupConverter
: public ConverterBase
< TypeGroupModel
>
114 explicit TypeGroupConverter( const ConverterRoot
& rParent
, TypeGroupModel
& rModel
);
115 virtual ~TypeGroupConverter() override
;
117 /** Returns the type info struct that describes this chart type group. */
118 const TypeGroupInfo
& getTypeInfo() const { return maTypeInfo
; }
120 /** Returns true, if the series in this chart type group are stacked on each other (no percentage). */
121 bool isStacked() const;
122 /** Returns true, if the series in this chart type group are stacked on each other as percentage. */
123 bool isPercent() const;
124 /** Returns true, if the chart is three-dimensional. */
125 bool is3dChart() const { return mb3dChart
;}
126 /** Returns true, if chart type supports wall and floor format in 3D mode. */
127 bool isWall3dChart() const;
128 /** Returns true, if the series in this chart type group are ordered on the Z axis. */
129 bool isDeep3dChart() const;
131 /** Returns true, if this chart type supports area formatting for its series. */
132 bool isSeriesFrameFormat() const;
133 /** Returns the object type for a series depending on the chart type. */
134 ObjectType
getSeriesObjectType() const;
136 /** Returns series title, if the chart type group contains only one single series. */
137 OUString
getSingleSeriesTitle() const;
139 /** Creates a coordinate system according to the contained chart type. */
140 css::uno::Reference
< css::chart2::XCoordinateSystem
>
141 createCoordinateSystem();
142 /** Creates a labeled data sequence object for axis categories. */
143 css::uno::Reference
< css::chart2::data::XLabeledDataSequence
>
144 createCategorySequence();
146 /** Converts the OOXML type group model into a chart2 coordinate system. */
147 void convertFromModel(
148 const css::uno::Reference
< css::chart2::XDiagram
>& rxDiagram
,
149 const css::uno::Reference
< css::chart2::XCoordinateSystem
>& rxCoordSystem
,
150 sal_Int32 nAxesSetIdx
, bool bSupportsVaryColorsByPoint
);
152 /** Sets the passed OOXML marker style at the passed property set. */
153 void convertMarker( PropertySet
& rPropSet
, sal_Int32 nOoxSymbol
, sal_Int32 nOoxSize
,
154 const ModelRef
< Shape
>& xShapeProps
) const;
155 /** Sets the passed OOXML line smoothing at the passed property set. */
156 void convertLineSmooth( PropertySet
& rPropSet
, bool bOoxSmooth
) const;
157 /** Sets the passed OOXML bar 3D geometry at the passed property set. */
158 void convertBarGeometry( PropertySet
& rPropSet
, sal_Int32 nOoxShape
) const;
159 /** Sets the passed OOXML pie rotation at the passed property set. */
160 void convertPieRotation( PropertySet
& rPropSet
, sal_Int32 nOoxAngle
) const;
161 /** Sets the passed OOXML pie explosion at the passed property set. */
162 void convertPieExplosion( PropertySet
& rPropSet
, sal_Int32 nOoxExplosion
) const;
165 /** Inserts the passed series into the chart type. Adds additional properties to the series. */
166 void insertDataSeries(
167 const css::uno::Reference
< css::chart2::XChartType
>& rxChartType
,
168 const css::uno::Reference
< css::chart2::XDataSeries
>& rxSeries
,
169 sal_Int32 nAxesSetIdx
);
172 TypeGroupInfo maTypeInfo
; /// Extended type info for contained chart type model.
173 bool mb3dChart
; /// True = type is a 3D chart type.
177 } // namespace drawingml
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */