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