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