Branch data 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 OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX
21 : : #define OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX
22 : :
23 : : #include "oox/drawingml/chart/converterbase.hxx"
24 : :
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; } }
31 : : } } }
32 : :
33 : : namespace oox {
34 : : namespace drawingml {
35 : : namespace chart {
36 : :
37 : : // ============================================================================
38 : :
39 : : /** Enumerates different chart types. */
40 : : enum TypeId
41 : : {
42 : : TYPEID_BAR, /// Vertical bar chart.
43 : : TYPEID_HORBAR, /// Horizontal bar chart.
44 : : TYPEID_LINE, /// Line chart.
45 : : TYPEID_AREA, /// Area chart.
46 : : TYPEID_STOCK, /// Stock chart.
47 : : TYPEID_RADARLINE, /// Linear radar chart.
48 : : TYPEID_RADARAREA, /// Filled radar chart.
49 : : TYPEID_PIE, /// Pie chart.
50 : : TYPEID_DOUGHNUT, /// Doughnut (ring) chart.
51 : : TYPEID_OFPIE, /// Pie-to-pie or pie-to-bar chart.
52 : : TYPEID_SCATTER, /// Scatter (XY) chart.
53 : : TYPEID_BUBBLE, /// Bubble chart.
54 : : TYPEID_SURFACE, /// Surface chart.
55 : : TYPEID_UNKNOWN /// Default for unknown chart types.
56 : : };
57 : :
58 : : // ----------------------------------------------------------------------------
59 : :
60 : : /** Enumerates different categories of similar chart types. */
61 : : enum TypeCategory
62 : : {
63 : : TYPECATEGORY_BAR, /// Bar charts (horizontal or vertical).
64 : : TYPECATEGORY_LINE, /// Line charts (line, area, stock charts).
65 : : TYPECATEGORY_RADAR, /// Radar charts (linear or filled).
66 : : TYPECATEGORY_PIE, /// Pie and donut charts.
67 : : TYPECATEGORY_SCATTER, /// Scatter and bubble charts.
68 : : TYPECATEGORY_SURFACE /// Surface charts.
69 : : };
70 : :
71 : : // ----------------------------------------------------------------------------
72 : :
73 : : /** Enumerates modes for varying point colors in a series. */
74 : : enum VarPointMode
75 : : {
76 : : VARPOINTMODE_NONE, /// No varied colors supported.
77 : : VARPOINTMODE_SINGLE, /// Only supported, if type group contains only one series.
78 : : VARPOINTMODE_MULTI /// Supported for multiple series in a chart type group.
79 : : };
80 : :
81 : : // ============================================================================
82 : :
83 : : /** Contains info for a chart type related to the OpenOffice.org chart module. */
84 : : struct TypeGroupInfo
85 : : {
86 : : TypeId meTypeId; /// Unique chart type identifier.
87 : : TypeCategory meTypeCategory; /// Category this chart type belongs to.
88 : : const sal_Char* mpcServiceName; /// Service name of the type.
89 : : VarPointMode meVarPointMode; /// Mode for varying point colors.
90 : : sal_Int32 mnDefLabelPos; /// Default data label position (API constant).
91 : : bool mbCombinable2d; /// True = types can be combined in one axes set.
92 : : bool mbSupports3d; /// True = 3D type allowed, false = only 2D type.
93 : : bool mbPolarCoordSystem; /// True = polar, false = cartesian.
94 : : bool mbSeriesIsFrame2d; /// True = 2D type series with area formatting.
95 : : bool mbSingleSeriesVis; /// True = only first series visible (e.g. pie charts).
96 : : bool mbCategoryAxis; /// True = X axis contains categories.
97 : : bool mbSwappedAxesSet; /// True = X axis and Y axis are swapped.
98 : : bool mbSupportsStacking; /// True = data points can be stacked on each other.
99 : : bool mbReverseSeries; /// True = insert unstacked series in reverse order.
100 : : bool mbTicksBetweenCateg; /// True = X axis ticks between categories.
101 : : bool mbPictureOptions; /// True = bitmaps support options from c:pictureOptions.
102 : : };
103 : :
104 : : // ============================================================================
105 : :
106 : : struct UpDownBarsModel;
107 : :
108 : : class UpDownBarsConverter : public ConverterBase< UpDownBarsModel >
109 : : {
110 : : public:
111 : : explicit UpDownBarsConverter( const ConverterRoot& rParent, UpDownBarsModel& rModel );
112 : : virtual ~UpDownBarsConverter();
113 : :
114 : : /** Converts the OOXML up/down bars. */
115 : : void convertFromModel(
116 : : const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& rxChartType );
117 : : };
118 : :
119 : : // ============================================================================
120 : :
121 : : struct TypeGroupModel;
122 : : struct View3DModel;
123 : :
124 : : class TypeGroupConverter : public ConverterBase< TypeGroupModel >
125 : : {
126 : : public:
127 : : explicit TypeGroupConverter( const ConverterRoot& rParent, TypeGroupModel& rModel );
128 : : virtual ~TypeGroupConverter();
129 : :
130 : : /** Returns the type info struct that describes this chart type group. */
131 : 0 : inline const TypeGroupInfo& getTypeInfo() const { return maTypeInfo; }
132 : :
133 : : /** Returns true, if the series in this chart type group are stacked on each other (no percentage). */
134 : : bool isStacked() const;
135 : : /** Returns true, if the series in this chart type group are stacked on each other as percentage. */
136 : : bool isPercent() const;
137 : : /** Returns true, if the chart is three-dimensional. */
138 : : bool is3dChart() const;
139 : : /** Returns true, if chart type supports wall and floor format in 3D mode. */
140 : : bool isWall3dChart() const;
141 : : /** Returns true, if the series in this chart type group are ordered on the Z axis. */
142 : : bool isDeep3dChart() const;
143 : :
144 : : /** Returns true, if this chart type supports area formatting for its series. */
145 : : bool isSeriesFrameFormat() const;
146 : : /** Returns the object type for a series depending on the chart type. */
147 : : ObjectType getSeriesObjectType() const;
148 : :
149 : : /** Returns true, if this chart type has to reverse its series order. */
150 : : bool isReverseSeries() const;
151 : : /** Returns series title, if the chart type group contains only one single series. */
152 : : ::rtl::OUString getSingleSeriesTitle() const;
153 : :
154 : : /** Creates a coordinate system according to the contained chart type. */
155 : : ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >
156 : : createCoordinateSystem();
157 : : /** Creates a labeled data sequence object for axis categories. */
158 : : ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
159 : : createCategorySequence();
160 : :
161 : : /** Converts the OOXML type group model into a chart2 coordinate system. */
162 : : void convertFromModel(
163 : : const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram,
164 : : const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& rxCoordSystem,
165 : : sal_Int32 nAxesSetIdx, bool bSupportsVaryColorsByPoint );
166 : :
167 : : /** Sets the passed OOXML marker style at the passed property set. */
168 : : void convertMarker( PropertySet& rPropSet, sal_Int32 nOoxSymbol, sal_Int32 nOoxSize ) const;
169 : : /** Sets the passed OOXML line smoothing at the passed property set. */
170 : : void convertLineSmooth( PropertySet& rPropSet, bool bOoxSmooth ) const;
171 : : /** Sets the passed OOXML bar 3D geometry at the passed property set. */
172 : : void convertBarGeometry( PropertySet& rPropSet, sal_Int32 nOoxShape ) const;
173 : : /** Sets the passed OOXML pie rotation at the passed property set. */
174 : : void convertPieRotation( PropertySet& rPropSet, sal_Int32 nOoxAngle ) const;
175 : : /** Sets the passed OOXML pie explosion at the passed property set. */
176 : : void convertPieExplosion( PropertySet& rPropSet, sal_Int32 nOoxExplosion ) const;
177 : :
178 : : private:
179 : : /** Inserts the passed series into the chart type. Adds additional properties to the series. */
180 : : void insertDataSeries(
181 : : const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& rxChartType,
182 : : const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxSeries,
183 : : sal_Int32 nAxesSetIdx );
184 : :
185 : : private:
186 : : TypeGroupInfo maTypeInfo; /// Extended type info for contained chart type model.
187 : : bool mb3dChart; /// True = type is a 3D chart type.
188 : : };
189 : :
190 : : // ============================================================================
191 : :
192 : : } // namespace chart
193 : : } // namespace drawingml
194 : : } // namespace oox
195 : :
196 : : #endif
197 : :
198 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|