LibreOffice Module chart2 (master) 1
DataPointProperties.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
22#include <FillProperties.hxx>
23#include <unonames.hxx>
24
25#include <com/sun/star/beans/PropertyAttribute.hpp>
26#include <com/sun/star/drawing/FillStyle.hpp>
27#include <com/sun/star/drawing/LineStyle.hpp>
28#include <com/sun/star/drawing/LineDash.hpp>
29#include <com/sun/star/drawing/LineCap.hpp>
30#include <com/sun/star/drawing/BitmapMode.hpp>
31#include <com/sun/star/drawing/RectanglePoint.hpp>
32#include <com/sun/star/chart2/RelativePosition.hpp>
33#include <com/sun/star/chart2/XDataPointCustomLabelField.hpp>
34#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
35#include <com/sun/star/chart2/DataPointLabel.hpp>
36#include <com/sun/star/chart2/Symbol.hpp>
37
38#include <tools/color.hxx>
39
40using namespace ::com::sun::star;
41
42using ::com::sun::star::beans::Property;
43
44namespace chart
45{
46
48 std::vector< Property > & rOutProperties )
49{
50 // DataPointProperties
51
52 // Common
53
54 rOutProperties.emplace_back( "Color",
57 beans::PropertyAttribute::BOUND
58 | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
59 | beans::PropertyAttribute::MAYBEDEFAULT );
60
61 rOutProperties.emplace_back( "FillColor",
64 beans::PropertyAttribute::BOUND
65 | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
66 | beans::PropertyAttribute::MAYBEDEFAULT );
67
68 rOutProperties.emplace_back( "Transparency",
71 beans::PropertyAttribute::BOUND
72 | beans::PropertyAttribute::MAYBEDEFAULT );
73
74 rOutProperties.emplace_back( "FillTransparence",
77 beans::PropertyAttribute::BOUND
78 | beans::PropertyAttribute::MAYBEDEFAULT );
79
80 // Fill Properties
81 rOutProperties.emplace_back( "FillStyle",
84 beans::PropertyAttribute::BOUND
85 | beans::PropertyAttribute::MAYBEDEFAULT );
86
87 rOutProperties.emplace_back( "TransparencyGradientName",
90 beans::PropertyAttribute::BOUND
91 | beans::PropertyAttribute::MAYBEDEFAULT
92 | beans::PropertyAttribute::MAYBEVOID );
93
94 rOutProperties.emplace_back( "FillTransparenceGradientName",
97 beans::PropertyAttribute::BOUND
98 | beans::PropertyAttribute::MAYBEDEFAULT
99 | beans::PropertyAttribute::MAYBEVOID );
100
101 rOutProperties.emplace_back( "GradientName",
104 beans::PropertyAttribute::BOUND
105 | beans::PropertyAttribute::MAYBEDEFAULT
106 | beans::PropertyAttribute::MAYBEVOID );
107
108 rOutProperties.emplace_back( "FillGradientName",
111 beans::PropertyAttribute::BOUND
112 | beans::PropertyAttribute::MAYBEDEFAULT
113 | beans::PropertyAttribute::MAYBEVOID );
114
115 rOutProperties.emplace_back( "GradientStepCount",
118 beans::PropertyAttribute::BOUND
119 | beans::PropertyAttribute::MAYBEVOID );
120
121 rOutProperties.emplace_back( "FillGradientStepCount",
124 beans::PropertyAttribute::BOUND
125 | beans::PropertyAttribute::MAYBEVOID );
126
127 rOutProperties.emplace_back( "HatchName",
130 beans::PropertyAttribute::BOUND
131 | beans::PropertyAttribute::MAYBEDEFAULT
132 | beans::PropertyAttribute::MAYBEVOID );
133
134 rOutProperties.emplace_back( "FillHatchName",
137 beans::PropertyAttribute::BOUND
138 | beans::PropertyAttribute::MAYBEDEFAULT
139 | beans::PropertyAttribute::MAYBEVOID );
140
141 rOutProperties.emplace_back( "FillBitmapName",
144 beans::PropertyAttribute::BOUND
145 | beans::PropertyAttribute::MAYBEDEFAULT
146 | beans::PropertyAttribute::MAYBEVOID );
147
148 rOutProperties.emplace_back( "FillBackground",
151 beans::PropertyAttribute::BOUND
152 | beans::PropertyAttribute::MAYBEDEFAULT
153 | beans::PropertyAttribute::MAYBEVOID );
154
155 // border for filled objects
156 rOutProperties.emplace_back( "BorderColor",
159 beans::PropertyAttribute::BOUND
160 | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
161 | beans::PropertyAttribute::MAYBEDEFAULT );
162
163 rOutProperties.emplace_back( "BorderStyle",
166 beans::PropertyAttribute::BOUND
167 | beans::PropertyAttribute::MAYBEDEFAULT );
168
169 rOutProperties.emplace_back( "BorderWidth",
172 beans::PropertyAttribute::BOUND
173 | beans::PropertyAttribute::MAYBEDEFAULT );
174
175 rOutProperties.emplace_back( "BorderDashName",
178 beans::PropertyAttribute::BOUND
179 | beans::PropertyAttribute::MAYBEVOID );
180
181 rOutProperties.emplace_back( "BorderTransparency",
184 beans::PropertyAttribute::BOUND
185 | beans::PropertyAttribute::MAYBEVOID );
186
187 // Line Properties
188
189 rOutProperties.emplace_back( "LineColor",
192 beans::PropertyAttribute::BOUND
193 | beans::PropertyAttribute::MAYBEVOID
194 | beans::PropertyAttribute::MAYBEDEFAULT );
195
196 rOutProperties.emplace_back( "LineStyle",
199 beans::PropertyAttribute::BOUND
200 | beans::PropertyAttribute::MAYBEDEFAULT );
201
202 rOutProperties.emplace_back( "LineWidth",
205 beans::PropertyAttribute::BOUND
206 | beans::PropertyAttribute::MAYBEDEFAULT );
207
208 rOutProperties.emplace_back( "LineDash",
211 beans::PropertyAttribute::BOUND
212 | beans::PropertyAttribute::MAYBEVOID );
213
214 rOutProperties.emplace_back( "LineDashName",
217 beans::PropertyAttribute::BOUND
218 | beans::PropertyAttribute::MAYBEVOID );
219
220 rOutProperties.emplace_back( "LineTransparence",
223 beans::PropertyAttribute::BOUND
224 | beans::PropertyAttribute::MAYBEVOID );
225
226 rOutProperties.emplace_back( "LineCap",
229 beans::PropertyAttribute::BOUND
230 | beans::PropertyAttribute::MAYBEDEFAULT );
231
232 // FillProperties
233 // bitmap properties
234 rOutProperties.emplace_back( "FillBitmapOffsetX",
237 beans::PropertyAttribute::BOUND
238 | beans::PropertyAttribute::MAYBEDEFAULT );
239
240 rOutProperties.emplace_back( "FillBitmapOffsetY",
243 beans::PropertyAttribute::BOUND
244 | beans::PropertyAttribute::MAYBEDEFAULT );
245
246 rOutProperties.emplace_back( "FillBitmapPositionOffsetX",
249 beans::PropertyAttribute::BOUND
250 | beans::PropertyAttribute::MAYBEDEFAULT );
251
252 rOutProperties.emplace_back( "FillBitmapPositionOffsetY",
255 beans::PropertyAttribute::BOUND
256 | beans::PropertyAttribute::MAYBEDEFAULT );
257
258 rOutProperties.emplace_back( "FillBitmapRectanglePoint",
261 beans::PropertyAttribute::BOUND
262 | beans::PropertyAttribute::MAYBEDEFAULT );
263
264 rOutProperties.emplace_back( "FillBitmapLogicalSize",
267 beans::PropertyAttribute::BOUND
268 | beans::PropertyAttribute::MAYBEDEFAULT );
269
270 rOutProperties.emplace_back( "FillBitmapSizeX",
273 beans::PropertyAttribute::BOUND
274 | beans::PropertyAttribute::MAYBEDEFAULT );
275
276 rOutProperties.emplace_back( "FillBitmapSizeY",
279 beans::PropertyAttribute::BOUND
280 | beans::PropertyAttribute::MAYBEDEFAULT );
281
282 rOutProperties.emplace_back( "FillBitmapMode",
285 beans::PropertyAttribute::BOUND
286 | beans::PropertyAttribute::MAYBEDEFAULT );
287
288 // others
289 rOutProperties.emplace_back( "Symbol",
292 beans::PropertyAttribute::BOUND
293 | beans::PropertyAttribute::MAYBEDEFAULT );
294 rOutProperties.emplace_back( "Offset",
297 beans::PropertyAttribute::BOUND
298 | beans::PropertyAttribute::MAYBEDEFAULT );
299 rOutProperties.emplace_back( "Geometry3D",
302 beans::PropertyAttribute::BOUND
303 | beans::PropertyAttribute::MAYBEDEFAULT );
304
305 rOutProperties.emplace_back( CHART_UNONAME_NUMFMT,
308 beans::PropertyAttribute::BOUND
309 | beans::PropertyAttribute::MAYBEDEFAULT );
310
311 rOutProperties.emplace_back( CHART_UNONAME_LINK_TO_SRC_NUMFMT,
314 beans::PropertyAttribute::BOUND
315 | beans::PropertyAttribute::MAYBEDEFAULT );
316
317 //additional 'PercentageNumberFormat'
318 rOutProperties.emplace_back( "PercentageNumberFormat",
321 beans::PropertyAttribute::BOUND
322 | beans::PropertyAttribute::MAYBEVOID );
323
324 rOutProperties.emplace_back( "LabelPlacement",
327 beans::PropertyAttribute::BOUND
328 | beans::PropertyAttribute::MAYBEVOID );
329
330 rOutProperties.emplace_back( "ReferencePageSize",
333 beans::PropertyAttribute::BOUND
334 | beans::PropertyAttribute::MAYBEVOID );
335
336 rOutProperties.emplace_back( "TextRotation",
339 beans::PropertyAttribute::BOUND
340 | beans::PropertyAttribute::MAYBEDEFAULT );
341
342 // statistics
343 rOutProperties.emplace_back( CHART_UNONAME_ERRORBAR_X,
345 // XPropertySet supporting service ErrorBar
347 beans::PropertyAttribute::BOUND
348 | beans::PropertyAttribute::MAYBEVOID );
349 rOutProperties.emplace_back( CHART_UNONAME_ERRORBAR_Y,
351 // XPropertySet supporting service ErrorBar
353 beans::PropertyAttribute::BOUND
354 | beans::PropertyAttribute::MAYBEVOID );
355 rOutProperties.emplace_back( "ShowErrorBox",
358 beans::PropertyAttribute::BOUND
359 | beans::PropertyAttribute::MAYBEVOID );
360 rOutProperties.emplace_back( "PercentDiagonal",
363 beans::PropertyAttribute::BOUND
364 | beans::PropertyAttribute::MAYBEVOID );
365
366 // Properties specific to data label.
367
368 rOutProperties.emplace_back( CHART_UNONAME_LABEL,
371 beans::PropertyAttribute::BOUND
372 | beans::PropertyAttribute::MAYBEDEFAULT );
373
374 rOutProperties.emplace_back( "TextWordWrap",
377 beans::PropertyAttribute::BOUND
378 | beans::PropertyAttribute::MAYBEDEFAULT );
379
380 rOutProperties.emplace_back( CHART_UNONAME_LABEL_SEP,
383 beans::PropertyAttribute::BOUND
384 | beans::PropertyAttribute::MAYBEDEFAULT );
385
386 rOutProperties.emplace_back( CHART_UNONAME_LABEL_BORDER_STYLE,
389 beans::PropertyAttribute::BOUND
390 | beans::PropertyAttribute::MAYBEDEFAULT );
391 rOutProperties.emplace_back( CHART_UNONAME_LABEL_BORDER_COLOR,
394 beans::PropertyAttribute::BOUND
395 | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
396 | beans::PropertyAttribute::MAYBEDEFAULT );
397 rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_STYLE,
400 beans::PropertyAttribute::BOUND
401 | beans::PropertyAttribute::MAYBEDEFAULT );
402 rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_COLOR,
405 beans::PropertyAttribute::BOUND
406 | beans::PropertyAttribute::MAYBEVOID
407 | beans::PropertyAttribute::MAYBEDEFAULT );
408 rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_BACKGROUND,
411 beans::PropertyAttribute::BOUND
412 | beans::PropertyAttribute::MAYBEDEFAULT );
413 rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_HATCH_NAME,
416 beans::PropertyAttribute::BOUND
417 | beans::PropertyAttribute::MAYBEDEFAULT );
418 rOutProperties.emplace_back( CHART_UNONAME_LABEL_BORDER_WIDTH,
421 beans::PropertyAttribute::BOUND
422 | beans::PropertyAttribute::MAYBEDEFAULT );
423 rOutProperties.emplace_back( CHART_UNONAME_LABEL_BORDER_DASH,
426 beans::PropertyAttribute::BOUND
427 | beans::PropertyAttribute::MAYBEVOID );
428 rOutProperties.emplace_back( CHART_UNONAME_LABEL_BORDER_DASHNAME,
431 beans::PropertyAttribute::BOUND
432 | beans::PropertyAttribute::MAYBEVOID );
433 rOutProperties.emplace_back( CHART_UNONAME_LABEL_BORDER_TRANS,
436 beans::PropertyAttribute::BOUND
437 | beans::PropertyAttribute::MAYBEDEFAULT );
438
439 rOutProperties.emplace_back( CHART_UNONAME_CUSTOM_LABEL_FIELDS,
441 cppu::UnoType<uno::Sequence<uno::Reference<chart2::XDataPointCustomLabelField>>>::get(),
442 beans::PropertyAttribute::BOUND
443 | beans::PropertyAttribute::MAYBEDEFAULT);
444
445 rOutProperties.emplace_back( "CustomLabelPosition",
448 beans::PropertyAttribute::BOUND
449 | beans::PropertyAttribute::MAYBEVOID );
450}
451
454{
455 PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_COLOR, Color(0x99, 0xcc, 0xff) ); // blue 8
457
458 //fill
459 PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_FILL_STYLE, drawing::FillStyle_SOLID );
465
466 //border
468 PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_BORDER_STYLE, drawing::LineStyle_SOLID ); // drawing::LineStyle_NONE
472
473 //line
479
480 //fill bitmap
485 PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT, drawing::RectanglePoint_MIDDLE_MIDDLE );
487
491
492 //others
493 chart2::Symbol aSymbProp;
494 aSymbProp.Style = chart2::SymbolStyle_NONE;
495 aSymbProp.StandardSymbol = 0;
496 aSymbProp.Size = awt::Size( 250, 250 ); // ca. 7pt x 7pt (7pt=246.94)
497 aSymbProp.BorderColor = sal_Int32(COL_BLACK);
498 aSymbProp.FillColor = 0xee4000; // OrangeRed2
500
502 PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_GEOMETRY3D, chart2::DataPointGeometry3D::CUBOID );
503
504 //@todo maybe choose a different one here -> should be dynamically that of the attached axis
508
510
512
513 // data label
515 rOutMap, PROP_DATAPOINT_LABEL,
516 chart2::DataPointLabel(
517 false, // ShowNumber
518 false, // ShowNumberInPercent
519 false, // ShowCategoryName
520 false, // ShowLegendSymbol
521 false, // ShowCustomLabel
522 false // ShowSeriesName
523 ));
524
537
540}
541
542} // namespace chart
543
544/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
void AddPropertiesToVector(std::vector< css::beans::Property > &rOutProperties)
void AddDefaultsToMap(::chart::tPropertyValueMap &rOutMap)
void setPropertyValueDefault(tPropertyValueMap &rOutMap, tPropertyValueMapKey key, const Value &value)
Calls setPropertyValue() but asserts that the given property hasn't been set before.
OOO_DLLPUBLIC_CHARTTOOLS void setEmptyPropertyValueDefault(tPropertyValueMap &rOutMap, tPropertyValueMapKey key)
Calls setPropertyValueDefault() with an empty Any as value.
std::unordered_map< tPropertyValueMapKey, css::uno::Any > tPropertyValueMap
constexpr OUStringLiteral CHART_UNONAME_LABEL_BORDER_WIDTH
Definition: unonames.hxx:27
constexpr OUStringLiteral CHART_UNONAME_ERRORBAR_Y
Definition: unonames.hxx:23
constexpr OUStringLiteral CHART_UNONAME_LABEL_BORDER_TRANS
Definition: unonames.hxx:31
constexpr OUStringLiteral CHART_UNONAME_LINK_TO_SRC_NUMFMT
Definition: unonames.hxx:21
constexpr OUStringLiteral CHART_UNONAME_LABEL_BORDER_DASHNAME
Definition: unonames.hxx:30
constexpr OUStringLiteral CHART_UNONAME_LABEL_FILL_COLOR
Definition: unonames.hxx:35
constexpr OUStringLiteral CHART_UNONAME_LABEL_FILL_STYLE
Definition: unonames.hxx:32
constexpr OUStringLiteral CHART_UNONAME_LABEL_SEP
Definition: unonames.hxx:25
constexpr OUStringLiteral CHART_UNONAME_NUMFMT
Definition: unonames.hxx:20
constexpr OUStringLiteral CHART_UNONAME_CUSTOM_LABEL_FIELDS
Definition: unonames.hxx:36
constexpr OUStringLiteral CHART_UNONAME_LABEL_FILL_BACKGROUND
Definition: unonames.hxx:33
constexpr OUStringLiteral CHART_UNONAME_ERRORBAR_X
Definition: unonames.hxx:22
constexpr OUStringLiteral CHART_UNONAME_LABEL_BORDER_COLOR
Definition: unonames.hxx:28
constexpr OUStringLiteral CHART_UNONAME_LABEL_BORDER_STYLE
Definition: unonames.hxx:26
constexpr OUStringLiteral CHART_UNONAME_LABEL_FILL_HATCH_NAME
Definition: unonames.hxx:34
constexpr OUStringLiteral CHART_UNONAME_LABEL
Definition: unonames.hxx:24
constexpr OUStringLiteral CHART_UNONAME_LABEL_BORDER_DASH
Definition: unonames.hxx:29