1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef OOX_DRAWINGML_CHART_SERIESMODEL_HXX
25 #define OOX_DRAWINGML_CHART_SERIESMODEL_HXX
26 
27 #include "oox/drawingml/chart/datasourcemodel.hxx"
28 #include "oox/drawingml/chart/titlemodel.hxx"
29 
30 namespace oox {
31 namespace drawingml {
32 namespace chart {
33 
34 // ============================================================================
35 
36 struct DataLabelModelBase
37 {
38     typedef ModelRef< Shape >       ShapeRef;
39     typedef ModelRef< TextBody >    TextBodyRef;
40 
41     ShapeRef            mxShapeProp;        /// Data label frame formatting.
42     TextBodyRef         mxTextProp;         /// Data label text formatting.
43     NumberFormat        maNumberFormat;     /// Number format for numeric data labels.
44     OptValue< ::rtl::OUString > moaSeparator;/// Separator between label components.
45     OptValue< sal_Int32 > monLabelPos;      /// Data label position.
46     OptValue< bool >    mobShowBubbleSize;  /// True = show size of bubbles in bubble charts.
47     OptValue< bool >    mobShowCatName;     /// True = show category name of data points.
48     OptValue< bool >    mobShowLegendKey;   /// True = show legend key of data series.
49     OptValue< bool >    mobShowPercent;     /// True = show percentual value in pie/doughnut charts.
50     OptValue< bool >    mobShowSerName;     /// True = show series name.
51     OptValue< bool >    mobShowVal;         /// True = show data point value.
52     bool                mbDeleted;          /// True = data label(s) deleted.
53 
54     explicit            DataLabelModelBase();
55                         ~DataLabelModelBase();
56 };
57 
58 // ============================================================================
59 
60 struct DataLabelModel : public DataLabelModelBase
61 {
62     typedef ModelRef< LayoutModel > LayoutRef;
63     typedef ModelRef< TextModel >   TextRef;
64 
65     LayoutRef           mxLayout;           /// Layout/position of the data point label frame.
66     TextRef             mxText;             /// Manual or linked text for this data point label.
67     sal_Int32           mnIndex;            /// Data point index for this data label.
68 
69     explicit            DataLabelModel();
70                         ~DataLabelModel();
71 };
72 
73 // ============================================================================
74 
75 struct DataLabelsModel : public DataLabelModelBase
76 {
77     typedef ModelVector< DataLabelModel >   DataLabelVector;
78     typedef ModelRef< Shape >               ShapeRef;
79 
80     DataLabelVector     maPointLabels;      /// Settings for individual data point labels.
81     ShapeRef            mxLeaderLines;      /// Formatting of connector lines between data points and labels.
82     bool                mbShowLeaderLines;  /// True = show connector lines between data points and labels.
83 
84     explicit            DataLabelsModel();
85                         ~DataLabelsModel();
86 };
87 
88 // ============================================================================
89 
90 struct PictureOptionsModel
91 {
92     double              mfStackUnit;        /// Bitmap stacking unit.
93     sal_Int32           mnPictureFormat;    /// Bitmap mode (stretch/tile).
94     bool                mbApplyToFront;     /// True = draw picture at front/back side of 3D data points.
95     bool                mbApplyToSides;     /// True = draw picture at left/right side of 3D data points.
96     bool                mbApplyToEnd;       /// True = draw picture at top/bottom side of 3D data points.
97 
98     explicit            PictureOptionsModel();
99                         ~PictureOptionsModel();
100 };
101 
102 // ============================================================================
103 
104 struct ErrorBarModel
105 {
106     enum SourceType
107     {
108         PLUS,               /// Plus error bar values.
109         MINUS               /// Minus error bar values.
110     };
111 
112     typedef ModelMap< SourceType, DataSourceModel > DataSourceMap;
113     typedef ModelRef< Shape >                       ShapeRef;
114 
115     DataSourceMap       maSources;          /// Source ranges for manual error bar values.
116     ShapeRef            mxShapeProp;        /// Error line formatting.
117     double              mfValue;            /// Fixed value for several error bar types.
118     sal_Int32           mnDirection;        /// Direction of the error bars (x/y).
119     sal_Int32           mnTypeId;           /// Type of the error bars (plus/minus/both).
120     sal_Int32           mnValueType;        /// Type of the values.
121     bool                mbNoEndCap;         /// True = no end cap at error bar lines.
122 
123     explicit            ErrorBarModel();
124                         ~ErrorBarModel();
125 };
126 
127 // ============================================================================
128 
129 struct TrendlineLabelModel
130 {
131     typedef ModelRef< Shape >       ShapeRef;
132     typedef ModelRef< TextBody >    TextBodyRef;
133     typedef ModelRef< LayoutModel > LayoutRef;
134     typedef ModelRef< TextModel >   TextRef;
135 
136     ShapeRef            mxShapeProp;        /// Label frame formatting.
137     TextBodyRef         mxTextProp;         /// Label text formatting.
138     LayoutRef           mxLayout;           /// Layout/position of the frame.
139     TextRef             mxText;             /// Text source of the label.
140     NumberFormat        maNumberFormat;     /// Number format for coefficients.
141 
142     explicit            TrendlineLabelModel();
143                         ~TrendlineLabelModel();
144 };
145 
146 // ============================================================================
147 
148 struct TrendlineModel
149 {
150     typedef ModelRef< Shape >               ShapeRef;
151     typedef ModelRef< TrendlineLabelModel > TrendlineLabelRef;
152 
153     ShapeRef            mxShapeProp;        /// Trendline formatting.
154     TrendlineLabelRef   mxLabel;            /// Trendline label text object.
155     ::rtl::OUString     maName;             /// User-defined name of the trendline.
156     OptValue< double >  mfBackward;         /// Size of trendline before first data point.
157     OptValue< double >  mfForward;          /// Size of trendline behind last data point.
158     OptValue< double >  mfIntercept;        /// Crossing point with Y axis.
159     sal_Int32           mnOrder;            /// Polynomial order in range [2, 6].
160     sal_Int32           mnPeriod;           /// Moving average period in range [2, 255].
161     sal_Int32           mnTypeId;           /// Type of the trendline.
162     bool                mbDispEquation;     /// True = show equation of the trendline.
163     bool                mbDispRSquared;     /// True = show R-squared of the trendline.
164 
165     explicit            TrendlineModel();
166                         ~TrendlineModel();
167 };
168 
169 // ============================================================================
170 
171 struct DataPointModel
172 {
173     typedef ModelRef< Shape >               ShapeRef;
174     typedef ModelRef< PictureOptionsModel > PictureOptionsRef;
175 
176     ShapeRef            mxShapeProp;        /// Data point formatting.
177     PictureOptionsRef   mxPicOptions;       /// Fill bitmap settings.
178     ShapeRef            mxMarkerProp;       /// Data point marker formatting.
179     OptValue< sal_Int32 > monExplosion;     /// Pie slice moved from pie center.
180     OptValue< sal_Int32 > monMarkerSize;    /// Size of the series line marker (2...72).
181     OptValue< sal_Int32 > monMarkerSymbol;  /// Series line marker symbol.
182     OptValue< bool >    mobBubble3d;        /// True = show bubbles with 3D shade.
183     sal_Int32           mnIndex;            /// Unique data point index.
184     bool                mbInvertNeg;        /// True = invert negative data points (not derived from series!).
185 
186     explicit            DataPointModel();
187                         ~DataPointModel();
188 };
189 
190 // ============================================================================
191 
192 struct SeriesModel
193 {
194     enum SourceType
195     {
196         CATEGORIES,         /// Data point categories.
197         VALUES,             /// Data point values.
198         POINTS              /// Data point size (e.g. bubble size in bubble charts).
199     };
200 
201     typedef ModelMap< SourceType, DataSourceModel > DataSourceMap;
202     typedef ModelVector< ErrorBarModel >            ErrorBarVector;
203     typedef ModelVector< TrendlineModel >           TrendlineVector;
204     typedef ModelVector< DataPointModel >           DataPointVector;
205     typedef ModelRef< Shape >                       ShapeRef;
206     typedef ModelRef< PictureOptionsModel >         PictureOptionsRef;
207     typedef ModelRef< TextModel >                   TextRef;
208     typedef ModelRef< DataLabelsModel >             DataLabelsRef;
209 
210     DataSourceMap       maSources;          /// Series source ranges.
211     ErrorBarVector      maErrorBars;        /// All error bars of this series.
212     TrendlineVector     maTrendlines;       /// All trendlines of this series.
213     DataPointVector     maPoints;           /// Explicit formatted data points.
214     ShapeRef            mxShapeProp;        /// Series formatting.
215     PictureOptionsRef   mxPicOptions;       /// Fill bitmap settings.
216     ShapeRef            mxMarkerProp;       /// Data point marker formatting.
217     TextRef             mxText;             /// Series title source.
218     DataLabelsRef       mxLabels;           /// Data point label settings for all points.
219     OptValue< sal_Int32 > monShape;         /// 3D bar shape type.
220     sal_Int32           mnExplosion;        /// Pie slice moved from pie center.
221     sal_Int32           mnIndex;            /// Series index used for automatic formatting.
222     sal_Int32           mnMarkerSize;       /// Size of the series line marker (2...72).
223     sal_Int32           mnMarkerSymbol;     /// Series line marker symbol.
224     sal_Int32           mnOrder;            /// Series order.
225     bool                mbBubble3d;         /// True = show bubbles with 3D shade.
226     bool                mbInvertNeg;        /// True = invert negative data points.
227     bool                mbSmooth;           /// True = smooth series line.
228 
229     explicit            SeriesModel();
230                         ~SeriesModel();
231 };
232 
233 // ============================================================================
234 
235 } // namespace chart
236 } // namespace drawingml
237 } // namespace oox
238 
239 #endif
240