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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_chart2.hxx"
26 #include "DataPointProperties.hxx"
27 #include "macros.hxx"
28 #include "LineProperties.hxx"
29 #include "FillProperties.hxx"
30
31 // #ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
32 // #include <com/sun/star/awt/Gradient.hpp>
33 // #endif
34 #include <com/sun/star/beans/PropertyAttribute.hpp>
35 #include <com/sun/star/drawing/FillStyle.hpp>
36 #include <com/sun/star/drawing/LineStyle.hpp>
37 #include <com/sun/star/drawing/LineDash.hpp>
38 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
39 // #ifndef _COM_SUN_STAR_DRAWING_HATCH_HPP_
40 // #include <com/sun/star/drawing/Hatch.hpp>
41 // #endif
42 #include <com/sun/star/style/XStyle.hpp>
43 #include <com/sun/star/drawing/BitmapMode.hpp>
44 #include <com/sun/star/drawing/RectanglePoint.hpp>
45
46 // #ifndef _COM_SUN_STAR_CHART2_FILLBITMAP_HPP_
47 // #include <com/sun/star/chart2/FillBitmap.hpp>
48 // #endif
49 #include <com/sun/star/chart2/DataPointGeometry3D.hpp>
50 #include <com/sun/star/chart2/DataPointLabel.hpp>
51 #include <com/sun/star/chart2/Symbol.hpp>
52
53 using namespace ::com::sun::star;
54
55 using ::com::sun::star::beans::Property;
56
57 namespace chart
58 {
59
AddPropertiesToVector(::std::vector<Property> & rOutProperties)60 void DataPointProperties::AddPropertiesToVector(
61 ::std::vector< Property > & rOutProperties )
62 {
63 // DataPointProperties
64 // ===================
65
66 // Common
67 // ------
68 rOutProperties.push_back(
69 Property( C2U( "Color" ),
70 PROP_DATAPOINT_COLOR,
71 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
72 beans::PropertyAttribute::BOUND
73 | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
74 | beans::PropertyAttribute::MAYBEDEFAULT ));
75
76 rOutProperties.push_back(
77 Property( C2U( "Transparency" ),
78 PROP_DATAPOINT_TRANSPARENCY,
79 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
80 beans::PropertyAttribute::BOUND
81 | beans::PropertyAttribute::MAYBEDEFAULT ));
82
83 // Fill Properties
84 // ---------------
85 rOutProperties.push_back(
86 Property( C2U( "FillStyle" ),
87 PROP_DATAPOINT_FILL_STYLE,
88 ::getCppuType( reinterpret_cast< const drawing::FillStyle * >(0)),
89 beans::PropertyAttribute::BOUND
90 | beans::PropertyAttribute::MAYBEDEFAULT ));
91
92 rOutProperties.push_back(
93 Property( C2U( "TransparencyGradientName" ),
94 PROP_DATAPOINT_TRANSPARENCY_GRADIENT_NAME,
95 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
96 beans::PropertyAttribute::BOUND
97 | beans::PropertyAttribute::MAYBEDEFAULT
98 | beans::PropertyAttribute::MAYBEVOID ));
99
100 rOutProperties.push_back(
101 Property( C2U( "GradientName" ),
102 PROP_DATAPOINT_GRADIENT_NAME,
103 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
104 beans::PropertyAttribute::BOUND
105 | beans::PropertyAttribute::MAYBEDEFAULT
106 | beans::PropertyAttribute::MAYBEVOID ));
107
108
109 rOutProperties.push_back(
110 beans::Property( C2U( "GradientStepCount" ),
111 PROP_DATAPOINT_GRADIENT_STEPCOUNT,
112 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
113 beans::PropertyAttribute::BOUND
114 | beans::PropertyAttribute::MAYBEVOID ));
115
116 rOutProperties.push_back(
117 Property( C2U( "HatchName" ),
118 PROP_DATAPOINT_HATCH_NAME,
119 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
120 beans::PropertyAttribute::BOUND
121 | beans::PropertyAttribute::MAYBEDEFAULT
122 | beans::PropertyAttribute::MAYBEVOID ));
123
124 rOutProperties.push_back(
125 Property( C2U( "FillBitmapName" ),
126 PROP_DATAPOINT_FILL_BITMAP_NAME,
127 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
128 beans::PropertyAttribute::BOUND
129 | beans::PropertyAttribute::MAYBEDEFAULT
130 | beans::PropertyAttribute::MAYBEVOID ));
131 rOutProperties.push_back(
132 Property( C2U( "FillBackground" ),
133 PROP_DATAPOINT_FILL_BACKGROUND,
134 ::getBooleanCppuType(),
135 beans::PropertyAttribute::BOUND
136 | beans::PropertyAttribute::MAYBEDEFAULT
137 | beans::PropertyAttribute::MAYBEVOID ));
138
139 // border for filled objects
140 rOutProperties.push_back(
141 Property( C2U( "BorderColor" ),
142 PROP_DATAPOINT_BORDER_COLOR,
143 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
144 beans::PropertyAttribute::BOUND
145 | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
146 | beans::PropertyAttribute::MAYBEDEFAULT ));
147 rOutProperties.push_back(
148 Property( C2U( "BorderStyle" ),
149 PROP_DATAPOINT_BORDER_STYLE,
150 ::getCppuType( reinterpret_cast< const drawing::LineStyle * >(0)),
151 beans::PropertyAttribute::BOUND
152 | beans::PropertyAttribute::MAYBEDEFAULT ));
153 rOutProperties.push_back(
154 Property( C2U( "BorderWidth" ),
155 PROP_DATAPOINT_BORDER_WIDTH,
156 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
157 beans::PropertyAttribute::BOUND
158 | beans::PropertyAttribute::MAYBEDEFAULT ));
159 rOutProperties.push_back(
160 Property( C2U( "BorderDashName" ),
161 PROP_DATAPOINT_BORDER_DASH_NAME,
162 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
163 beans::PropertyAttribute::BOUND
164 | beans::PropertyAttribute::MAYBEVOID ));
165 rOutProperties.push_back(
166 Property( C2U( "BorderTransparency" ),
167 PROP_DATAPOINT_BORDER_TRANSPARENCY,
168 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
169 beans::PropertyAttribute::BOUND
170 | beans::PropertyAttribute::MAYBEVOID ));
171
172 // Line Properties
173 // ---------------
174 rOutProperties.push_back(
175 Property( C2U( "LineStyle" ),
176 LineProperties::PROP_LINE_STYLE,
177 ::getCppuType( reinterpret_cast< const drawing::LineStyle * >(0)),
178 beans::PropertyAttribute::BOUND
179 | beans::PropertyAttribute::MAYBEDEFAULT ));
180 rOutProperties.push_back(
181 Property( C2U( "LineWidth" ),
182 LineProperties::PROP_LINE_WIDTH,
183 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
184 beans::PropertyAttribute::BOUND
185 | beans::PropertyAttribute::MAYBEDEFAULT ));
186 rOutProperties.push_back(
187 Property( C2U( "LineDash" ),
188 LineProperties::PROP_LINE_DASH,
189 ::getCppuType( reinterpret_cast< const drawing::LineDash * >(0)),
190 beans::PropertyAttribute::BOUND
191 | beans::PropertyAttribute::MAYBEVOID ));
192 rOutProperties.push_back(
193 Property( C2U( "LineDashName" ),
194 LineProperties::PROP_LINE_DASH_NAME,
195 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
196 beans::PropertyAttribute::BOUND
197 | beans::PropertyAttribute::MAYBEVOID ));
198
199 // FillProperties
200 // bitmap properties
201 rOutProperties.push_back(
202 Property( C2U( "FillBitmapOffsetX" ),
203 FillProperties::PROP_FILL_BITMAP_OFFSETX,
204 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
205 beans::PropertyAttribute::BOUND
206 | beans::PropertyAttribute::MAYBEDEFAULT ));
207
208 rOutProperties.push_back(
209 Property( C2U( "FillBitmapOffsetY" ),
210 FillProperties::PROP_FILL_BITMAP_OFFSETY,
211 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
212 beans::PropertyAttribute::BOUND
213 | beans::PropertyAttribute::MAYBEDEFAULT ));
214
215 rOutProperties.push_back(
216 Property( C2U( "FillBitmapPositionOffsetX" ),
217 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX,
218 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
219 beans::PropertyAttribute::BOUND
220 | beans::PropertyAttribute::MAYBEDEFAULT ));
221
222 rOutProperties.push_back(
223 Property( C2U( "FillBitmapPositionOffsetY" ),
224 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY,
225 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
226 beans::PropertyAttribute::BOUND
227 | beans::PropertyAttribute::MAYBEDEFAULT ));
228
229
230 rOutProperties.push_back(
231 Property( C2U( "FillBitmapRectanglePoint" ),
232 FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT,
233 ::getCppuType( reinterpret_cast< const drawing::RectanglePoint * >(0)),
234 beans::PropertyAttribute::BOUND
235 | beans::PropertyAttribute::MAYBEDEFAULT ));
236
237 rOutProperties.push_back(
238 Property( C2U( "FillBitmapLogicalSize" ),
239 FillProperties::PROP_FILL_BITMAP_LOGICALSIZE,
240 ::getBooleanCppuType(),
241 beans::PropertyAttribute::BOUND
242 | beans::PropertyAttribute::MAYBEDEFAULT ));
243
244 rOutProperties.push_back(
245 Property( C2U( "FillBitmapSizeX" ),
246 FillProperties::PROP_FILL_BITMAP_SIZEX,
247 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
248 beans::PropertyAttribute::BOUND
249 | beans::PropertyAttribute::MAYBEDEFAULT ));
250
251 rOutProperties.push_back(
252 Property( C2U( "FillBitmapSizeY" ),
253 FillProperties::PROP_FILL_BITMAP_SIZEY,
254 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
255 beans::PropertyAttribute::BOUND
256 | beans::PropertyAttribute::MAYBEDEFAULT ));
257
258 rOutProperties.push_back(
259 Property( C2U( "FillBitmapMode" ),
260 FillProperties::PROP_FILL_BITMAP_MODE,
261 ::getCppuType( reinterpret_cast< const drawing::BitmapMode * >(0)),
262 beans::PropertyAttribute::BOUND
263 | beans::PropertyAttribute::MAYBEDEFAULT ));
264
265 // others
266 rOutProperties.push_back(
267 Property( C2U( "Symbol" ),
268 PROP_DATAPOINT_SYMBOL_PROP,
269 ::getCppuType( reinterpret_cast< const chart2::Symbol * >(0)),
270 beans::PropertyAttribute::BOUND
271 | beans::PropertyAttribute::MAYBEDEFAULT ));
272 rOutProperties.push_back(
273 Property( C2U( "Offset" ),
274 PROP_DATAPOINT_OFFSET,
275 ::getCppuType( reinterpret_cast< const double * >(0)),
276 beans::PropertyAttribute::BOUND
277 | beans::PropertyAttribute::MAYBEDEFAULT ));
278 rOutProperties.push_back(
279 Property( C2U( "Geometry3D" ),
280 PROP_DATAPOINT_GEOMETRY3D,
281 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
282 beans::PropertyAttribute::BOUND
283 | beans::PropertyAttribute::MAYBEDEFAULT ));
284
285 rOutProperties.push_back(
286 Property( C2U( "Label" ),
287 PROP_DATAPOINT_LABEL,
288 ::getCppuType( reinterpret_cast< const chart2::DataPointLabel * >(0)),
289 beans::PropertyAttribute::BOUND
290 | beans::PropertyAttribute::MAYBEDEFAULT ));
291
292 rOutProperties.push_back(
293 Property( C2U( "LabelSeparator" ),
294 PROP_DATAPOINT_LABEL_SEPARATOR,
295 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
296 beans::PropertyAttribute::BOUND
297 | beans::PropertyAttribute::MAYBEDEFAULT ));
298
299 rOutProperties.push_back(
300 Property( C2U( "NumberFormat" ),
301 PROP_DATAPOINT_NUMBER_FORMAT,
302 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
303 beans::PropertyAttribute::BOUND
304 | beans::PropertyAttribute::MAYBEVOID ));
305
306 //additional 'PercentageNumberFormat'
307 rOutProperties.push_back(
308 Property( C2U( "PercentageNumberFormat" ),
309 PROP_DATAPOINT_PERCENTAGE_NUMBER_FORMAT,
310 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
311 beans::PropertyAttribute::BOUND
312 | beans::PropertyAttribute::MAYBEVOID ));
313
314 rOutProperties.push_back(
315 Property( C2U( "LabelPlacement" ),
316 PROP_DATAPOINT_LABEL_PLACEMENT,
317 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
318 beans::PropertyAttribute::BOUND
319 | beans::PropertyAttribute::MAYBEVOID ));
320
321 rOutProperties.push_back(
322 Property( C2U( "ReferencePageSize" ),
323 PROP_DATAPOINT_REFERENCE_DIAGRAM_SIZE,
324 ::getCppuType( reinterpret_cast< const awt::Size * >(0)),
325 beans::PropertyAttribute::BOUND
326 | beans::PropertyAttribute::MAYBEVOID ));
327
328 rOutProperties.push_back(
329 Property( C2U( "TextRotation" ),
330 PROP_DATAPOINT_TEXT_ROTATION,
331 ::getCppuType( reinterpret_cast< const double * >(0)),
332 beans::PropertyAttribute::BOUND
333 | beans::PropertyAttribute::MAYBEDEFAULT ));
334
335 // statistics
336 rOutProperties.push_back(
337 Property( C2U( "ErrorBarX" ),
338 PROP_DATAPOINT_ERROR_BAR_X,
339 // XPropertySet supporting service ErrorBar
340 ::getCppuType( reinterpret_cast< const uno::Reference< beans::XPropertySet > * >(0)),
341 beans::PropertyAttribute::BOUND
342 | beans::PropertyAttribute::MAYBEVOID ));
343 rOutProperties.push_back(
344 Property( C2U( "ErrorBarY" ),
345 PROP_DATAPOINT_ERROR_BAR_Y,
346 // XPropertySet supporting service ErrorBar
347 ::getCppuType( reinterpret_cast< const uno::Reference< beans::XPropertySet > * >(0)),
348 beans::PropertyAttribute::BOUND
349 | beans::PropertyAttribute::MAYBEVOID ));
350 rOutProperties.push_back(
351 Property( C2U( "ShowErrorBox" ),
352 PROP_DATAPOINT_SHOW_ERROR_BOX,
353 ::getBooleanCppuType(),
354 beans::PropertyAttribute::BOUND
355 | beans::PropertyAttribute::MAYBEVOID ));
356 rOutProperties.push_back(
357 Property( C2U( "PercentDiagonal" ),
358 PROP_DATAPOINT_PERCENT_DIAGONAL,
359 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
360 beans::PropertyAttribute::BOUND
361 | beans::PropertyAttribute::MAYBEVOID ));
362 }
363
AddDefaultsToMap(::chart::tPropertyValueMap & rOutMap)364 void DataPointProperties::AddDefaultsToMap(
365 ::chart::tPropertyValueMap & rOutMap )
366 {
367 PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DATAPOINT_COLOR, 0x0099ccff ); // blue 8
368 PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_DATAPOINT_TRANSPARENCY, 0 );
369
370 //fill
371 PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_FILL_STYLE, drawing::FillStyle_SOLID );
372 PropertyHelper::setEmptyPropertyValueDefault( rOutMap, PROP_DATAPOINT_TRANSPARENCY_GRADIENT_NAME );
373 PropertyHelper::setEmptyPropertyValueDefault( rOutMap, PROP_DATAPOINT_GRADIENT_NAME );
374 PropertyHelper::setEmptyPropertyValueDefault( rOutMap, PROP_DATAPOINT_HATCH_NAME );
375 PropertyHelper::setEmptyPropertyValueDefault( rOutMap, PROP_DATAPOINT_FILL_BITMAP_NAME );
376 PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_FILL_BACKGROUND, false );
377
378 //border
379 PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DATAPOINT_BORDER_COLOR, 0x000000 ); // black
380 PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_BORDER_STYLE, drawing::LineStyle_SOLID ); // drawing::LineStyle_NONE
381 PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DATAPOINT_BORDER_WIDTH, 0 );
382 PropertyHelper::setEmptyPropertyValueDefault( rOutMap, PROP_DATAPOINT_BORDER_DASH_NAME );
383 PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_DATAPOINT_BORDER_TRANSPARENCY, 0 );
384
385 //line
386 PropertyHelper::setPropertyValueDefault( rOutMap, LineProperties::PROP_LINE_STYLE, drawing::LineStyle_SOLID );
387 PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, LineProperties::PROP_LINE_WIDTH, 0 );
388 PropertyHelper::setPropertyValueDefault( rOutMap, LineProperties::PROP_LINE_DASH, drawing::LineDash());
389 PropertyHelper::setEmptyPropertyValueDefault( rOutMap, LineProperties::PROP_LINE_DASH_NAME );
390
391 //fill bitmap
392 PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETX, 0 );
393 PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETY, 0 );
394 PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX, 0 );
395 PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY, 0 );
396 PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT, drawing::RectanglePoint_MIDDLE_MIDDLE );
397 PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_LOGICALSIZE, true );
398
399 PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEX, 0 );
400 PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEY, 0 );
401 PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_MODE, drawing::BitmapMode_REPEAT );
402
403 //others
404 chart2::Symbol aSymbProp;
405 aSymbProp.Style = chart2::SymbolStyle_NONE;
406 aSymbProp.StandardSymbol = 0;
407 aSymbProp.Size = awt::Size( 250, 250 ); // ca. 7pt x 7pt (7pt=246.94)
408 aSymbProp.BorderColor = 0x000000; // Black
409 aSymbProp.FillColor = 0xee4000; // OrangeRed2
410 PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_SYMBOL_PROP, aSymbProp );
411
412 PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_DATAPOINT_OFFSET, 0.0 );
413 PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_GEOMETRY3D, chart2::DataPointGeometry3D::CUBOID );
414
415 PropertyHelper::setPropertyValueDefault(
416 rOutMap, PROP_DATAPOINT_LABEL,
417 chart2::DataPointLabel(
418 sal_False, // ShowNumber
419 sal_False, // ShowNumberInPercent
420 sal_False, // ShowCategoryName
421 sal_False // ShowLegendSymbol
422 ));
423
424 PropertyHelper::setPropertyValueDefault< rtl::OUString >( rOutMap, PROP_DATAPOINT_LABEL_SEPARATOR, C2U(" ") );
425
426 //@todo maybe choose a different one here -> should be dynamically that of the attached axis
427 PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_ERROR_BAR_X, uno::Reference< beans::XPropertySet >());
428 PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_ERROR_BAR_Y, uno::Reference< beans::XPropertySet >());
429 PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_DATAPOINT_PERCENT_DIAGONAL, 0 );
430
431 PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_DATAPOINT_TEXT_ROTATION, 0.0 );
432 }
433
434 } // namespace chart
435