1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DataPointProperties.cxx,v $
10 * $Revision: 1.18.8.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
33 #include "DataPointProperties.hxx"
35 #include "LineProperties.hxx"
36 #include "FillProperties.hxx"
38 // #ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
39 // #include <com/sun/star/awt/Gradient.hpp>
41 #include <com/sun/star/beans/PropertyAttribute.hpp>
42 #include <com/sun/star/drawing/FillStyle.hpp>
43 #include <com/sun/star/drawing/LineStyle.hpp>
44 #include <com/sun/star/drawing/LineDash.hpp>
45 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
46 // #ifndef _COM_SUN_STAR_DRAWING_HATCH_HPP_
47 // #include <com/sun/star/drawing/Hatch.hpp>
49 #include <com/sun/star/style/XStyle.hpp>
50 #include <com/sun/star/drawing/BitmapMode.hpp>
51 #include <com/sun/star/drawing/RectanglePoint.hpp>
53 // #ifndef _COM_SUN_STAR_CHART2_FILLBITMAP_HPP_
54 // #include <com/sun/star/chart2/FillBitmap.hpp>
56 #include <com/sun/star/chart2/DataPointGeometry3D.hpp>
57 #include <com/sun/star/chart2/DataPointLabel.hpp>
58 #include <com/sun/star/chart2/Symbol.hpp>
60 using namespace ::com::sun::star
;
62 using ::com::sun::star::beans::Property
;
67 void DataPointProperties::AddPropertiesToVector(
68 ::std::vector
< Property
> & rOutProperties
)
70 // DataPointProperties
71 // ===================
75 rOutProperties
.push_back(
76 Property( C2U( "Color" ),
78 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
79 beans::PropertyAttribute::BOUND
80 | beans::PropertyAttribute::MAYBEVOID
// "maybe auto"
81 | beans::PropertyAttribute::MAYBEDEFAULT
));
83 rOutProperties
.push_back(
84 Property( C2U( "Transparency" ),
85 PROP_DATAPOINT_TRANSPARENCY
,
86 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
87 beans::PropertyAttribute::BOUND
88 | beans::PropertyAttribute::MAYBEDEFAULT
));
92 rOutProperties
.push_back(
93 Property( C2U( "FillStyle" ),
94 PROP_DATAPOINT_FILL_STYLE
,
95 ::getCppuType( reinterpret_cast< const drawing::FillStyle
* >(0)),
96 beans::PropertyAttribute::BOUND
97 | beans::PropertyAttribute::MAYBEDEFAULT
));
99 rOutProperties
.push_back(
100 Property( C2U( "TransparencyGradientName" ),
101 PROP_DATAPOINT_TRANSPARENCY_GRADIENT_NAME
,
102 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
103 beans::PropertyAttribute::BOUND
104 | beans::PropertyAttribute::MAYBEDEFAULT
105 | beans::PropertyAttribute::MAYBEVOID
));
107 rOutProperties
.push_back(
108 Property( C2U( "GradientName" ),
109 PROP_DATAPOINT_GRADIENT_NAME
,
110 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
111 beans::PropertyAttribute::BOUND
112 | beans::PropertyAttribute::MAYBEDEFAULT
113 | beans::PropertyAttribute::MAYBEVOID
));
116 rOutProperties
.push_back(
117 beans::Property( C2U( "GradientStepCount" ),
118 PROP_DATAPOINT_GRADIENT_STEPCOUNT
,
119 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
120 beans::PropertyAttribute::BOUND
121 | beans::PropertyAttribute::MAYBEVOID
));
123 rOutProperties
.push_back(
124 Property( C2U( "HatchName" ),
125 PROP_DATAPOINT_HATCH_NAME
,
126 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
127 beans::PropertyAttribute::BOUND
128 | beans::PropertyAttribute::MAYBEDEFAULT
129 | beans::PropertyAttribute::MAYBEVOID
));
131 rOutProperties
.push_back(
132 Property( C2U( "FillBitmapName" ),
133 PROP_DATAPOINT_FILL_BITMAP_NAME
,
134 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
135 beans::PropertyAttribute::BOUND
136 | beans::PropertyAttribute::MAYBEDEFAULT
137 | beans::PropertyAttribute::MAYBEVOID
));
138 rOutProperties
.push_back(
139 Property( C2U( "FillBackground" ),
140 PROP_DATAPOINT_FILL_BACKGROUND
,
141 ::getBooleanCppuType(),
142 beans::PropertyAttribute::BOUND
143 | beans::PropertyAttribute::MAYBEDEFAULT
144 | beans::PropertyAttribute::MAYBEVOID
));
146 // border for filled objects
147 rOutProperties
.push_back(
148 Property( C2U( "BorderColor" ),
149 PROP_DATAPOINT_BORDER_COLOR
,
150 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
151 beans::PropertyAttribute::BOUND
152 | beans::PropertyAttribute::MAYBEVOID
// "maybe auto"
153 | beans::PropertyAttribute::MAYBEDEFAULT
));
154 rOutProperties
.push_back(
155 Property( C2U( "BorderStyle" ),
156 PROP_DATAPOINT_BORDER_STYLE
,
157 ::getCppuType( reinterpret_cast< const drawing::LineStyle
* >(0)),
158 beans::PropertyAttribute::BOUND
159 | beans::PropertyAttribute::MAYBEDEFAULT
));
160 rOutProperties
.push_back(
161 Property( C2U( "BorderWidth" ),
162 PROP_DATAPOINT_BORDER_WIDTH
,
163 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
164 beans::PropertyAttribute::BOUND
165 | beans::PropertyAttribute::MAYBEDEFAULT
));
166 rOutProperties
.push_back(
167 Property( C2U( "BorderDashName" ),
168 PROP_DATAPOINT_BORDER_DASH_NAME
,
169 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
170 beans::PropertyAttribute::BOUND
171 | beans::PropertyAttribute::MAYBEVOID
));
172 rOutProperties
.push_back(
173 Property( C2U( "BorderTransparency" ),
174 PROP_DATAPOINT_BORDER_TRANSPARENCY
,
175 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
176 beans::PropertyAttribute::BOUND
177 | beans::PropertyAttribute::MAYBEVOID
));
181 rOutProperties
.push_back(
182 Property( C2U( "LineStyle" ),
183 LineProperties::PROP_LINE_STYLE
,
184 ::getCppuType( reinterpret_cast< const drawing::LineStyle
* >(0)),
185 beans::PropertyAttribute::BOUND
186 | beans::PropertyAttribute::MAYBEDEFAULT
));
187 rOutProperties
.push_back(
188 Property( C2U( "LineWidth" ),
189 LineProperties::PROP_LINE_WIDTH
,
190 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
191 beans::PropertyAttribute::BOUND
192 | beans::PropertyAttribute::MAYBEDEFAULT
));
193 rOutProperties
.push_back(
194 Property( C2U( "LineDash" ),
195 LineProperties::PROP_LINE_DASH
,
196 ::getCppuType( reinterpret_cast< const drawing::LineDash
* >(0)),
197 beans::PropertyAttribute::BOUND
198 | beans::PropertyAttribute::MAYBEVOID
));
199 rOutProperties
.push_back(
200 Property( C2U( "LineDashName" ),
201 LineProperties::PROP_LINE_DASH_NAME
,
202 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
203 beans::PropertyAttribute::BOUND
204 | beans::PropertyAttribute::MAYBEVOID
));
208 rOutProperties
.push_back(
209 Property( C2U( "FillBitmapOffsetX" ),
210 FillProperties::PROP_FILL_BITMAP_OFFSETX
,
211 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
212 beans::PropertyAttribute::BOUND
213 | beans::PropertyAttribute::MAYBEDEFAULT
));
215 rOutProperties
.push_back(
216 Property( C2U( "FillBitmapOffsetY" ),
217 FillProperties::PROP_FILL_BITMAP_OFFSETY
,
218 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
219 beans::PropertyAttribute::BOUND
220 | beans::PropertyAttribute::MAYBEDEFAULT
));
222 rOutProperties
.push_back(
223 Property( C2U( "FillBitmapPositionOffsetX" ),
224 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX
,
225 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
226 beans::PropertyAttribute::BOUND
227 | beans::PropertyAttribute::MAYBEDEFAULT
));
229 rOutProperties
.push_back(
230 Property( C2U( "FillBitmapPositionOffsetY" ),
231 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY
,
232 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
233 beans::PropertyAttribute::BOUND
234 | beans::PropertyAttribute::MAYBEDEFAULT
));
237 rOutProperties
.push_back(
238 Property( C2U( "FillBitmapRectanglePoint" ),
239 FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT
,
240 ::getCppuType( reinterpret_cast< const drawing::RectanglePoint
* >(0)),
241 beans::PropertyAttribute::BOUND
242 | beans::PropertyAttribute::MAYBEDEFAULT
));
244 rOutProperties
.push_back(
245 Property( C2U( "FillBitmapLogicalSize" ),
246 FillProperties::PROP_FILL_BITMAP_LOGICALSIZE
,
247 ::getBooleanCppuType(),
248 beans::PropertyAttribute::BOUND
249 | beans::PropertyAttribute::MAYBEDEFAULT
));
251 rOutProperties
.push_back(
252 Property( C2U( "FillBitmapSizeX" ),
253 FillProperties::PROP_FILL_BITMAP_SIZEX
,
254 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
255 beans::PropertyAttribute::BOUND
256 | beans::PropertyAttribute::MAYBEDEFAULT
));
258 rOutProperties
.push_back(
259 Property( C2U( "FillBitmapSizeY" ),
260 FillProperties::PROP_FILL_BITMAP_SIZEY
,
261 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
262 beans::PropertyAttribute::BOUND
263 | beans::PropertyAttribute::MAYBEDEFAULT
));
265 rOutProperties
.push_back(
266 Property( C2U( "FillBitmapMode" ),
267 FillProperties::PROP_FILL_BITMAP_MODE
,
268 ::getCppuType( reinterpret_cast< const drawing::BitmapMode
* >(0)),
269 beans::PropertyAttribute::BOUND
270 | beans::PropertyAttribute::MAYBEDEFAULT
));
273 rOutProperties
.push_back(
274 Property( C2U( "Symbol" ),
275 PROP_DATAPOINT_SYMBOL_PROP
,
276 ::getCppuType( reinterpret_cast< const chart2::Symbol
* >(0)),
277 beans::PropertyAttribute::BOUND
278 | beans::PropertyAttribute::MAYBEDEFAULT
));
279 rOutProperties
.push_back(
280 Property( C2U( "Offset" ),
281 PROP_DATAPOINT_OFFSET
,
282 ::getCppuType( reinterpret_cast< const double * >(0)),
283 beans::PropertyAttribute::BOUND
284 | beans::PropertyAttribute::MAYBEDEFAULT
));
285 rOutProperties
.push_back(
286 Property( C2U( "Geometry3D" ),
287 PROP_DATAPOINT_GEOMETRY3D
,
288 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
289 beans::PropertyAttribute::BOUND
290 | beans::PropertyAttribute::MAYBEDEFAULT
));
292 rOutProperties
.push_back(
293 Property( C2U( "Label" ),
294 PROP_DATAPOINT_LABEL
,
295 ::getCppuType( reinterpret_cast< const chart2::DataPointLabel
* >(0)),
296 beans::PropertyAttribute::BOUND
297 | beans::PropertyAttribute::MAYBEDEFAULT
));
299 rOutProperties
.push_back(
300 Property( C2U( "LabelSeparator" ),
301 PROP_DATAPOINT_LABEL_SEPARATOR
,
302 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
303 beans::PropertyAttribute::BOUND
304 | beans::PropertyAttribute::MAYBEDEFAULT
));
306 rOutProperties
.push_back(
307 Property( C2U( "NumberFormat" ),
308 PROP_DATAPOINT_NUMBER_FORMAT
,
309 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
310 beans::PropertyAttribute::BOUND
311 | beans::PropertyAttribute::MAYBEVOID
));
313 //additional 'PercentageNumberFormat'
314 rOutProperties
.push_back(
315 Property( C2U( "PercentageNumberFormat" ),
316 PROP_DATAPOINT_PERCENTAGE_NUMBER_FORMAT
,
317 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
318 beans::PropertyAttribute::BOUND
319 | beans::PropertyAttribute::MAYBEVOID
));
321 rOutProperties
.push_back(
322 Property( C2U( "LabelPlacement" ),
323 PROP_DATAPOINT_LABEL_PLACEMENT
,
324 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
325 beans::PropertyAttribute::BOUND
326 | beans::PropertyAttribute::MAYBEVOID
));
328 rOutProperties
.push_back(
329 Property( C2U( "ReferencePageSize" ),
330 PROP_DATAPOINT_REFERENCE_DIAGRAM_SIZE
,
331 ::getCppuType( reinterpret_cast< const awt::Size
* >(0)),
332 beans::PropertyAttribute::BOUND
333 | beans::PropertyAttribute::MAYBEVOID
));
335 rOutProperties
.push_back(
336 Property( C2U( "TextRotation" ),
337 PROP_DATAPOINT_TEXT_ROTATION
,
338 ::getCppuType( reinterpret_cast< const double * >(0)),
339 beans::PropertyAttribute::BOUND
340 | beans::PropertyAttribute::MAYBEDEFAULT
));
343 rOutProperties
.push_back(
344 Property( C2U( "ErrorBarX" ),
345 PROP_DATAPOINT_ERROR_BAR_X
,
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( "ErrorBarY" ),
352 PROP_DATAPOINT_ERROR_BAR_Y
,
353 // XPropertySet supporting service ErrorBar
354 ::getCppuType( reinterpret_cast< const uno::Reference
< beans::XPropertySet
> * >(0)),
355 beans::PropertyAttribute::BOUND
356 | beans::PropertyAttribute::MAYBEVOID
));
357 rOutProperties
.push_back(
358 Property( C2U( "ShowErrorBox" ),
359 PROP_DATAPOINT_SHOW_ERROR_BOX
,
360 ::getBooleanCppuType(),
361 beans::PropertyAttribute::BOUND
362 | beans::PropertyAttribute::MAYBEVOID
));
363 rOutProperties
.push_back(
364 Property( C2U( "PercentDiagonal" ),
365 PROP_DATAPOINT_PERCENT_DIAGONAL
,
366 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
367 beans::PropertyAttribute::BOUND
368 | beans::PropertyAttribute::MAYBEVOID
));
371 void DataPointProperties::AddDefaultsToMap(
372 ::chart::tPropertyValueMap
& rOutMap
)
374 PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, PROP_DATAPOINT_COLOR
, 0x0099ccff ); // blue 8
375 PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, PROP_DATAPOINT_TRANSPARENCY
, 0 );
378 PropertyHelper::setPropertyValueDefault( rOutMap
, PROP_DATAPOINT_FILL_STYLE
, drawing::FillStyle_SOLID
);
379 PropertyHelper::setEmptyPropertyValueDefault( rOutMap
, PROP_DATAPOINT_TRANSPARENCY_GRADIENT_NAME
);
380 PropertyHelper::setEmptyPropertyValueDefault( rOutMap
, PROP_DATAPOINT_GRADIENT_NAME
);
381 PropertyHelper::setEmptyPropertyValueDefault( rOutMap
, PROP_DATAPOINT_HATCH_NAME
);
382 PropertyHelper::setEmptyPropertyValueDefault( rOutMap
, PROP_DATAPOINT_FILL_BITMAP_NAME
);
383 PropertyHelper::setPropertyValueDefault( rOutMap
, PROP_DATAPOINT_FILL_BACKGROUND
, false );
386 PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, PROP_DATAPOINT_BORDER_COLOR
, 0x000000 ); // black
387 PropertyHelper::setPropertyValueDefault( rOutMap
, PROP_DATAPOINT_BORDER_STYLE
, drawing::LineStyle_SOLID
); // drawing::LineStyle_NONE
388 PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, PROP_DATAPOINT_BORDER_WIDTH
, 0 );
389 PropertyHelper::setEmptyPropertyValueDefault( rOutMap
, PROP_DATAPOINT_BORDER_DASH_NAME
);
390 PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, PROP_DATAPOINT_BORDER_TRANSPARENCY
, 0 );
393 PropertyHelper::setPropertyValueDefault( rOutMap
, LineProperties::PROP_LINE_STYLE
, drawing::LineStyle_SOLID
);
394 PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, LineProperties::PROP_LINE_WIDTH
, 0 );
395 PropertyHelper::setPropertyValueDefault( rOutMap
, LineProperties::PROP_LINE_DASH
, drawing::LineDash());
396 PropertyHelper::setEmptyPropertyValueDefault( rOutMap
, LineProperties::PROP_LINE_DASH_NAME
);
399 PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_OFFSETX
, 0 );
400 PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_OFFSETY
, 0 );
401 PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX
, 0 );
402 PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY
, 0 );
403 PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT
, drawing::RectanglePoint_MIDDLE_MIDDLE
);
404 PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_LOGICALSIZE
, true );
406 PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_SIZEX
, 0 );
407 PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_SIZEY
, 0 );
408 PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_MODE
, drawing::BitmapMode_REPEAT
);
411 chart2::Symbol aSymbProp
;
412 aSymbProp
.Style
= chart2::SymbolStyle_NONE
;
413 aSymbProp
.StandardSymbol
= 0;
414 aSymbProp
.Size
= awt::Size( 250, 250 ); // ca. 7pt x 7pt (7pt=246.94)
415 aSymbProp
.BorderColor
= 0x000000; // Black
416 aSymbProp
.FillColor
= 0xee4000; // OrangeRed2
417 PropertyHelper::setPropertyValueDefault( rOutMap
, PROP_DATAPOINT_SYMBOL_PROP
, aSymbProp
);
419 PropertyHelper::setPropertyValueDefault
< double >( rOutMap
, PROP_DATAPOINT_OFFSET
, 0.0 );
420 PropertyHelper::setPropertyValueDefault( rOutMap
, PROP_DATAPOINT_GEOMETRY3D
, chart2::DataPointGeometry3D::CUBOID
);
422 PropertyHelper::setPropertyValueDefault(
423 rOutMap
, PROP_DATAPOINT_LABEL
,
424 chart2::DataPointLabel(
425 sal_False
, // ShowNumber
426 sal_False
, // ShowNumberInPercent
427 sal_False
, // ShowCategoryName
428 sal_False
// ShowLegendSymbol
431 PropertyHelper::setPropertyValueDefault
< rtl::OUString
>( rOutMap
, PROP_DATAPOINT_LABEL_SEPARATOR
, C2U(" ") );
433 //@todo maybe choose a different one here -> should be dynamically that of the attached axis
434 PropertyHelper::setPropertyValueDefault( rOutMap
, PROP_DATAPOINT_ERROR_BAR_X
, uno::Reference
< beans::XPropertySet
>());
435 PropertyHelper::setPropertyValueDefault( rOutMap
, PROP_DATAPOINT_ERROR_BAR_Y
, uno::Reference
< beans::XPropertySet
>());
436 PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, PROP_DATAPOINT_PERCENT_DIAGONAL
, 0 );
438 PropertyHelper::setPropertyValueDefault
< double >( rOutMap
, PROP_DATAPOINT_TEXT_ROTATION
, 0.0 );