LibreOffice Module chart2 (master) 1
TextLabelItemConverter.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 <ChartModel.hxx>
23#include <ChartModelHelper.hxx>
24#include <ChartType.hxx>
25#include <ChartTypeHelper.hxx>
26#include <DataSeries.hxx>
27#include <DataSeriesHelper.hxx>
28#include <DiagramHelper.hxx>
29#include <Diagram.hxx>
30#include <ItemPropertyMap.hxx>
31#include "SchWhichPairs.hxx"
32#include <unonames.hxx>
33
34#include <editeng/brushitem.hxx>
35#include <editeng/sizeitem.hxx>
36#include <svl/eitem.hxx>
37#include <svl/ilstitem.hxx>
38#include <svl/intitem.hxx>
39#include <svl/stritem.hxx>
40#include <svx/tabline.hxx>
41#include <svx/sdangitm.hxx>
43#include <vcl/graph.hxx>
44#include <rtl/math.hxx>
45
46#include <com/sun/star/chart/DataLabelPlacement.hpp>
47#include <com/sun/star/chart2/AxisType.hpp>
48#include <com/sun/star/chart2/DataPointLabel.hpp>
49#include <com/sun/star/chart2/Symbol.hpp>
50#include <com/sun/star/chart2/RelativePosition.hpp>
51#include <com/sun/star/chart2/XDataSeries.hpp>
52#include <memory>
53
54using namespace com::sun::star;
55using namespace com::sun::star::chart2;
57
58namespace chart::wrapper {
59
60namespace {
61
62const ItemPropertyMapType& getTextLabelPropertyMap()
63{
70 return aMap;
71};
72
73sal_Int32 getSymbolStyleForSymbol( const chart2::Symbol& rSymbol )
74{
75 sal_Int32 nStyle = SVX_SYMBOLTYPE_UNKNOWN;
76 switch (rSymbol.Style)
77 {
78 case chart2::SymbolStyle_NONE:
79 nStyle = SVX_SYMBOLTYPE_NONE;
80 break;
81 case chart2::SymbolStyle_AUTO:
82 nStyle = SVX_SYMBOLTYPE_AUTO;
83 break;
84 case chart2::SymbolStyle_GRAPHIC:
86 break;
87 case chart2::SymbolStyle_STANDARD:
88 nStyle = rSymbol.StandardSymbol;
89 break;
90 case chart2::SymbolStyle_POLYGON:
91 default:
92 ;
93 }
94 return nStyle;
95}
96
97bool numberFormatFromItemToPropertySet(
98 sal_uInt16 nWhichId, const SfxItemSet& rItemSet, const uno::Reference<beans::XPropertySet>& xPropertySet,
99 bool bOverwriteDataPoints )
100{
101 bool bChanged = false;
102 if (!xPropertySet.is())
103 return bChanged;
104
105 OUString aPropertyName = (nWhichId == SID_ATTR_NUMBERFORMAT_VALUE) ? OUString(CHART_UNONAME_NUMFMT) : OUString("PercentageNumberFormat");
106 sal_uInt16 nSourceWhich = (nWhichId == SID_ATTR_NUMBERFORMAT_VALUE) ? SID_ATTR_NUMBERFORMAT_SOURCE : SCHATTR_PERCENT_NUMBERFORMAT_SOURCE;
107
108 if (rItemSet.GetItemState(nSourceWhich) != SfxItemState::SET)
109 return bChanged;
110
111 uno::Any aValue;
112 bool bUseSourceFormat = static_cast<const SfxBoolItem&>(rItemSet.Get(nSourceWhich)).GetValue();
113 if (!bUseSourceFormat)
114 {
115 SfxItemState aState = rItemSet.GetItemState(nWhichId);
116 if (aState == SfxItemState::SET)
117 {
118 sal_Int32 nFmt = static_cast<sal_Int32>(
119 static_cast<const SfxUInt32Item&>(
120 rItemSet.Get(nWhichId)).GetValue());
121 aValue <<= nFmt;
122 }
123 else
124 return bChanged;
125 }
126
127 uno::Any aOldValue = xPropertySet->getPropertyValue(aPropertyName);
128 if (bOverwriteDataPoints)
129 {
130 rtl::Reference<DataSeries> xSeries( dynamic_cast<DataSeries*>(xPropertySet.get()) );
131 if (aValue != aOldValue ||
133 {
135 bChanged = true;
136 }
137 }
138 else if (aOldValue != aValue)
139 {
140 xPropertySet->setPropertyValue(aPropertyName, aValue);
141 bChanged = true;
142 }
143 return bChanged;
144}
145
146bool useSourceFormatFromItemToPropertySet(
147 sal_uInt16 nWhichId, const SfxItemSet& rItemSet, const uno::Reference<beans::XPropertySet>& xPropertySet,
148 bool bOverwriteDataPoints )
149{
150 bool bChanged = false;
151 if (!xPropertySet.is())
152 return bChanged;
153 OUString aPropertyName = (nWhichId == SID_ATTR_NUMBERFORMAT_SOURCE) ? OUString(CHART_UNONAME_NUMFMT) : OUString("PercentageNumberFormat");
154 sal_uInt16 nFormatWhich = (nWhichId == SID_ATTR_NUMBERFORMAT_SOURCE) ? SID_ATTR_NUMBERFORMAT_VALUE : SCHATTR_PERCENT_NUMBERFORMAT_VALUE;
155
156 if (rItemSet.GetItemState(nWhichId) != SfxItemState::SET)
157 return bChanged;
158
159 uno::Any aNewValue;
160 bool bUseSourceFormat = static_cast<const SfxBoolItem&>(
161 rItemSet.Get(nWhichId)).GetValue();
162 xPropertySet->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::Any(bUseSourceFormat));
163 if (!bUseSourceFormat)
164 {
165 SfxItemState aState = rItemSet.GetItemState(nFormatWhich);
166 if (aState == SfxItemState::SET)
167 {
168 sal_Int32 nFormatKey = static_cast<sal_Int32>(
169 static_cast<const SfxUInt32Item&>(
170 rItemSet.Get(nFormatWhich)).GetValue());
171 aNewValue <<= nFormatKey;
172 }
173 else
174 return bChanged;
175 }
176
177 uno::Any aOldValue(xPropertySet->getPropertyValue(aPropertyName));
178 if (bOverwriteDataPoints)
179 {
180 rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(xPropertySet.get()));
181 if (aNewValue != aOldValue ||
183 {
185 bChanged = true;
186 }
187 }
188 else if (aOldValue != aNewValue)
189 {
190 xPropertySet->setPropertyValue(aPropertyName, aNewValue);
191 bChanged = true;
192 }
193
194 return bChanged;
195}
196
197} // anonymous namespace
198
200 const rtl::Reference<::chart::ChartModel>& xChartModel,
201 const uno::Reference<beans::XPropertySet>& rPropertySet,
202 const rtl::Reference<DataSeries>& xSeries,
203 SfxItemPool& rItemPool, const awt::Size* pRefSize,
204 bool bDataSeries, sal_Int32 nNumberFormat, sal_Int32 nPercentNumberFormat ) :
205 ItemConverter(rPropertySet, rItemPool),
206 mnNumberFormat(nNumberFormat),
207 mnPercentNumberFormat(nPercentNumberFormat),
208 mbDataSeries(bDataSeries),
209 mbForbidPercentValue(true),
210 m_xSeries(xSeries)
211{
212 maConverters.emplace_back(new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
213
214 rtl::Reference< Diagram > xDiagram(xChartModel->getFirstChartDiagram());
215 rtl::Reference< ChartType > xChartType(xDiagram->getChartTypeOfSeries(xSeries));
216 bool bFound = false;
217 bool bAmbiguous = false;
218 bool bSwapXAndY = xDiagram->getVertical(bFound, bAmbiguous);
220
221 mbForbidPercentValue = ChartTypeHelper::getAxisType(xChartType, 0) != AxisType::CATEGORY;
222}
223
225{
226}
227
229{
230 for( const auto& pConv : maConverters )
231 pConv->FillItemSet( rOutItemSet );
232
233 // own items
234 ItemConverter::FillItemSet(rOutItemSet);
235}
236
238{
239 bool bResult = false;
240
241 for( const auto& pConv: maConverters )
242 bResult = pConv->ApplyItemSet( rItemSet ) || bResult;
243
244 // own items
245 return ItemConverter::ApplyItemSet(rItemSet) || bResult;
246}
247
249{
250 // must span all used items!
252}
253
255{
256 const ItemPropertyMapType& rMap = getTextLabelPropertyMap();
257 ItemPropertyMapType::const_iterator it = rMap.find(nWhichId);
258
259 if (it == rMap.end())
260 return false;
261
262 rOutProperty = it->second;
263 return true;
264}
265
266bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet& rItemSet )
267{
268 bool bChanged = false;
269
270 switch (nWhichId)
271 {
277 {
278 const SfxBoolItem& rItem = static_cast<const SfxBoolItem&>(rItemSet.Get(nWhichId));
279
280 uno::Any aOldValue = GetPropertySet()->getPropertyValue(CHART_UNONAME_LABEL);
281 chart2::DataPointLabel aLabel;
282 if (aOldValue >>= aLabel)
283 {
284 sal_Bool& rValue = (nWhichId == SCHATTR_DATADESCR_SHOW_NUMBER) ? aLabel.ShowNumber : (
285 (nWhichId == SCHATTR_DATADESCR_SHOW_PERCENTAGE) ? aLabel.ShowNumberInPercent : (
286 (nWhichId == SCHATTR_DATADESCR_SHOW_CATEGORY) ? aLabel.ShowCategoryName :
287 (nWhichId == SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME) ? aLabel.ShowSeriesName : aLabel.ShowLegendSymbol));
288 bool bOldValue = rValue;
289 rValue = rItem.GetValue();
290 if (mbDataSeries)
291 {
292 rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get()));
293 if (bOldValue != bool(rValue) ||
295 {
298 bChanged = true;
299 }
300 }
301 else if (bOldValue != bool(rValue))
302 {
303 GetPropertySet()->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabel));
304 bChanged = true;
305 }
306 }
307 }
308 break;
309 case SID_ATTR_NUMBERFORMAT_VALUE:
310 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE: //fall through intended
311 {
312 bChanged = numberFormatFromItemToPropertySet(nWhichId, rItemSet, GetPropertySet(), mbDataSeries);
313 }
314 break;
315 case SID_ATTR_NUMBERFORMAT_SOURCE:
316 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE: //fall through intended
317 {
318 bChanged = useSourceFormatFromItemToPropertySet(nWhichId, rItemSet, GetPropertySet(), mbDataSeries);
319 }
320 break;
322 {
323 OUString aNewValue = static_cast<const SfxStringItem&>(rItemSet.Get(nWhichId)).GetValue();
324 try
325 {
326 OUString aOldValue;
327 GetPropertySet()->getPropertyValue("LabelSeparator") >>= aOldValue;
328 if (mbDataSeries)
329 {
330 rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get()));
331 if (aOldValue != aNewValue ||
332 DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, "LabelSeparator", uno::Any(aOldValue)))
333 {
334 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries, "LabelSeparator", uno::Any(aNewValue));
335 bChanged = true;
336 }
337 }
338 else if (aOldValue != aNewValue)
339 {
340 GetPropertySet()->setPropertyValue("LabelSeparator", uno::Any(aNewValue));
341 bChanged = true;
342 }
343 }
344 catch (const uno::Exception&)
345 {
346 TOOLS_WARN_EXCEPTION("chart2", "");
347 }
348 }
349 break;
351 {
352
353 try
354 {
355 bool bNew = static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue();
356 bool bOld = false;
357 GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bOld;
358 if( mbDataSeries )
359 {
360 rtl::Reference< DataSeries > xSeries( dynamic_cast<DataSeries*>(GetPropertySet().get()) );
361 if( bOld!=bNew ||
362 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "TextWordWrap", uno::Any( bOld ) ) )
363 {
365 bChanged = true;
366 }
367 }
368 else if( bOld!=bNew )
369 {
370 GetPropertySet()->setPropertyValue( "TextWordWrap", uno::Any( bNew ));
371 bChanged = true;
372 }
373 }
374 catch( const uno::Exception& )
375 {
376 TOOLS_WARN_EXCEPTION("chart2", "" );
377 }
378 }
379 break;
381 {
382 try
383 {
384 sal_Int32 nNew = static_cast<const SfxInt32Item&>(rItemSet.Get(nWhichId)).GetValue();
385 sal_Int32 nOld = -1;
386 RelativePosition aCustomLabelPosition;
387 GetPropertySet()->getPropertyValue("LabelPlacement") >>= nOld;
388 if (mbDataSeries)
389 {
390 rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get()));
391 if (nOld != nNew ||
393 {
395 bChanged = true;
396 }
397 }
398 else if (nOld != nNew || (GetPropertySet()->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition))
399 {
400 GetPropertySet()->setPropertyValue("LabelPlacement", uno::Any(nNew));
401 GetPropertySet()->setPropertyValue("CustomLabelPosition", uno::Any());
402 bChanged = true;
403 }
404 }
405 catch (const uno::Exception&)
406 {
407 TOOLS_WARN_EXCEPTION("chart2", "" );
408 }
409 }
410 break;
412 {
413 sal_Int32 nStyle =
414 static_cast<const SfxInt32Item&>(
415 rItemSet.Get(nWhichId)).GetValue();
416 chart2::Symbol aSymbol;
417
418 GetPropertySet()->getPropertyValue("Symbol") >>= aSymbol;
419 sal_Int32 nOldStyle = getSymbolStyleForSymbol(aSymbol);
420
421 if (nStyle != nOldStyle)
422 {
423 bool bDeleteSymbol = false;
424 switch (nStyle)
425 {
427 aSymbol.Style = chart2::SymbolStyle_NONE;
428 break;
430 aSymbol.Style = chart2::SymbolStyle_AUTO;
431 break;
433 aSymbol.Style = chart2::SymbolStyle_GRAPHIC;
434 break;
436 bDeleteSymbol = true;
437 break;
438
439 default:
440 aSymbol.Style = chart2::SymbolStyle_STANDARD;
441 aSymbol.StandardSymbol = nStyle;
442 }
443
444 if (bDeleteSymbol)
445 GetPropertySet()->setPropertyValue("Symbol", uno::Any());
446 else
447 GetPropertySet()->setPropertyValue("Symbol", uno::Any(aSymbol));
448 bChanged = true;
449 }
450 }
451 break;
453 {
454 Size aSize = static_cast<const SvxSizeItem&>(
455 rItemSet.Get(nWhichId)).GetSize();
456 chart2::Symbol aSymbol;
457
458 GetPropertySet()->getPropertyValue("Symbol") >>= aSymbol;
459 if (aSize.getWidth() != aSymbol.Size.Width ||
460 aSize.getHeight() != aSymbol.Size.Height)
461 {
462 aSymbol.Size.Width = aSize.getWidth();
463 aSymbol.Size.Height = aSize.getHeight();
464
465 GetPropertySet()->setPropertyValue("Symbol", uno::Any(aSymbol));
466 bChanged = true;
467 }
468 }
469 break;
471 {
472 const SvxBrushItem& rBrshItem(static_cast<const SvxBrushItem&>(
473 rItemSet.Get(nWhichId)));
474 uno::Any aXGraphicAny;
475 const Graphic* pGraphic(rBrshItem.GetGraphic());
476 if (pGraphic)
477 {
479 if (xGraphic.is())
480 {
481 aXGraphicAny <<= xGraphic;
482 chart2::Symbol aSymbol;
483 GetPropertySet()->getPropertyValue("Symbol") >>= aSymbol;
484 if (aSymbol.Graphic != xGraphic)
485 {
486 aSymbol.Graphic = xGraphic;
487 GetPropertySet()->setPropertyValue("Symbol", uno::Any(aSymbol));
488 bChanged = true;
489 }
490 }
491 }
492 }
493 break;
495 {
496 double fValue = static_cast<double>(
497 static_cast<const SdrAngleItem&>(
498 rItemSet.Get(nWhichId)).GetValue().get()) / 100.0;
499 double fOldValue = 0.0;
500 bool bPropExisted =
501 (GetPropertySet()->getPropertyValue("TextRotation") >>= fOldValue);
502
503 if (!bPropExisted || fOldValue != fValue)
504 {
505 GetPropertySet()->setPropertyValue("TextRotation", uno::Any(fValue));
506 bChanged = true;
507 }
508 }
509 break;
511 {
512 try
513 {
514 bool bNew = static_cast<const SfxBoolItem&>(rItemSet.Get(nWhichId)).GetValue();
515 bool bOld = true;
516 if( (m_xSeries->getPropertyValue("ShowCustomLeaderLines") >>= bOld) && bOld != bNew )
517 {
518 m_xSeries->setPropertyValue("ShowCustomLeaderLines", uno::Any(bNew));
519 bChanged = true;
520 }
521 }
522 catch (const uno::Exception&)
523 {
524 TOOLS_WARN_EXCEPTION("chart2", "");
525 }
526 }
527 break;
528 }
529
530 return bChanged;
531}
532
533void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& rOutItemSet ) const
534{
535 switch (nWhichId)
536 {
542 {
543 chart2::DataPointLabel aLabel;
545 {
546 bool bValue = (nWhichId == SCHATTR_DATADESCR_SHOW_NUMBER) ? aLabel.ShowNumber : (
547 (nWhichId == SCHATTR_DATADESCR_SHOW_PERCENTAGE) ? aLabel.ShowNumberInPercent : (
548 (nWhichId == SCHATTR_DATADESCR_SHOW_CATEGORY) ? aLabel.ShowCategoryName : (
549 (nWhichId == SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME) ? aLabel.ShowSeriesName : aLabel.ShowLegendSymbol)));
550
551 rOutItemSet.Put(SfxBoolItem(nWhichId, bValue));
552
553 if (mbDataSeries)
554 {
556 dynamic_cast<DataSeries*>(GetPropertySet().get()), CHART_UNONAME_LABEL, uno::Any(aLabel)))
557 {
558 rOutItemSet.InvalidateItem(nWhichId);
559 }
560 }
561 }
562 }
563 break;
564 case SID_ATTR_NUMBERFORMAT_VALUE:
565 {
566 sal_Int32 nKey = 0;
567 if (!(GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nKey))
568 nKey = mnNumberFormat;
569 rOutItemSet.Put(SfxUInt32Item(nWhichId, nKey));
570 }
571 break;
573 {
574 sal_Int32 nKey = 0;
575 if (!(GetPropertySet()->getPropertyValue("PercentageNumberFormat") >>= nKey))
577 rOutItemSet.Put(SfxUInt32Item(nWhichId, nKey));
578 }
579 break;
580 case SID_ATTR_NUMBERFORMAT_SOURCE:
581 {
582 bool bUseSourceFormat = false;
583 try
584 {
585 GetPropertySet()->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bUseSourceFormat;
586 }
587 catch (const uno::Exception&)
588 {
589 TOOLS_WARN_EXCEPTION("chart2", "");
590 }
591 bool bNumberFormatIsSet = GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue() && !bUseSourceFormat;
592 rOutItemSet.Put(SfxBoolItem(nWhichId, !bNumberFormatIsSet));
593 }
594 break;
596 {
597 bool bUseSourceFormat = false;
598 try
599 {
600 GetPropertySet()->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bUseSourceFormat;
601 }
602 catch (const uno::Exception&)
603 {
604 TOOLS_WARN_EXCEPTION("chart2", "");
605 }
606 bool bNumberFormatIsSet = GetPropertySet()->getPropertyValue("PercentageNumberFormat").hasValue() && !bUseSourceFormat;
607 rOutItemSet.Put(SfxBoolItem(nWhichId, !bNumberFormatIsSet));
608 }
609 break;
611 {
612 try
613 {
614 OUString aValue;
615 GetPropertySet()->getPropertyValue("LabelSeparator") >>= aValue;
616 rOutItemSet.Put(SfxStringItem(nWhichId, aValue));
617 }
618 catch (const uno::Exception&)
619 {
620 TOOLS_WARN_EXCEPTION("chart2", "" );
621 }
622 }
623 break;
625 {
626 try
627 {
628 bool bValue = false;
629 GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bValue;
630 rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
631 }
632 catch( const uno::Exception& )
633 {
634 TOOLS_WARN_EXCEPTION("chart2", "" );
635 }
636 }
637 break;
639 {
640 try
641 {
642 sal_Int32 nPlacement = 0;
643 RelativePosition aCustomLabelPosition;
644 if (!mbDataSeries && (GetPropertySet()->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition))
645 rOutItemSet.Put(SfxInt32Item(nWhichId, css::chart::DataLabelPlacement::CUSTOM));
646 else if (GetPropertySet()->getPropertyValue("LabelPlacement") >>= nPlacement)
647 rOutItemSet.Put(SfxInt32Item(nWhichId, nPlacement));
648 else if (maAvailableLabelPlacements.hasElements())
649 rOutItemSet.Put(SfxInt32Item(nWhichId, maAvailableLabelPlacements[0]));
650 }
651 catch (const uno::Exception&)
652 {
653 TOOLS_WARN_EXCEPTION("chart2", "" );
654 }
655 }
656 break;
658 {
659 rOutItemSet.Put(SfxIntegerListItem(nWhichId, maAvailableLabelPlacements));
660 }
661 break;
663 {
664 rOutItemSet.Put(SfxBoolItem(nWhichId, mbForbidPercentValue));
665 }
666 break;
668 {
669 try
670 {
671 bool bValue = true;
672 if( m_xSeries->getPropertyValue( "ShowCustomLeaderLines" ) >>= bValue )
673 rOutItemSet.Put(SfxBoolItem(nWhichId, bValue));
674 }
675 catch (const uno::Exception&)
676 {
677 TOOLS_WARN_EXCEPTION("chart2", "");
678 }
679 }
680 break;
682 {
683 chart2::Symbol aSymbol;
684 if (GetPropertySet()->getPropertyValue("Symbol") >>= aSymbol)
685 rOutItemSet.Put(SfxInt32Item(nWhichId, getSymbolStyleForSymbol(aSymbol)));
686 }
687 break;
689 {
690 chart2::Symbol aSymbol;
691 if (GetPropertySet()->getPropertyValue("Symbol") >>= aSymbol)
692 rOutItemSet.Put(
693 SvxSizeItem(nWhichId, Size(aSymbol.Size.Width, aSymbol.Size.Height)));
694 }
695 break;
697 {
698 chart2::Symbol aSymbol;
699 if ((GetPropertySet()->getPropertyValue("Symbol") >>= aSymbol)
700 && aSymbol.Graphic.is())
701 {
702 rOutItemSet.Put(
704 }
705 }
706 break;
708 {
709 double fValue = 0;
710
711 if (GetPropertySet()->getPropertyValue("TextRotation") >>= fValue)
712 {
713 rOutItemSet.Put(
714 SdrAngleItem(SCHATTR_TEXT_DEGREES, Degree100(static_cast<sal_Int32>(rtl::math::round(fValue * 100.0)))));
715 }
716 }
717 break;
718 }
719}
720
721}
722
723/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr TypedWhichId< SfxBoolItem > SCHATTR_DATADESCR_SHOW_SYMBOL(SCHATTR_DATADESCR_START+3)
constexpr TypedWhichId< SvxSizeItem > SCHATTR_SYMBOL_SIZE(SCHATTR_AXIS_END+4)
constexpr TypedWhichId< SfxInt32Item > SCHATTR_DATADESCR_PLACEMENT(SCHATTR_DATADESCR_START+6)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_DATADESCR_CUSTOM_LEADER_LINES(SCHATTR_DATADESCR_START+9)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME(SCHATTR_DATADESCR_START+12)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_PERCENT_NUMBERFORMAT_SOURCE(SCHATTR_DATADESCR_START+11)
constexpr TypedWhichId< SfxInt32Item > SCHATTR_STYLE_SYMBOL(SCHATTR_STYLE_START+8)
constexpr TypedWhichId< SfxStringItem > SCHATTR_DATADESCR_SEPARATOR(SCHATTR_DATADESCR_START+5)
constexpr TypedWhichId< SfxUInt32Item > SCHATTR_PERCENT_NUMBERFORMAT_VALUE(SCHATTR_DATADESCR_START+10)
constexpr TypedWhichId< SfxIntegerListItem > SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS(SCHATTR_DATADESCR_START+7)
constexpr TypedWhichId< SdrAngleItem > SCHATTR_TEXT_DEGREES(SCHATTR_TEXT_START)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_DATADESCR_NO_PERCENTVALUE(SCHATTR_DATADESCR_START+8)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_DATADESCR_SHOW_NUMBER(SCHATTR_DATADESCR_START)
constexpr TypedWhichId< SvxBrushItem > SCHATTR_SYMBOL_BRUSH(SCHATTR_AXIS_END+1)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_DATADESCR_WRAP_TEXT(SCHATTR_DATADESCR_START+4)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_DATADESCR_SHOW_PERCENTAGE(SCHATTR_DATADESCR_START+1)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_DATADESCR_SHOW_CATEGORY(SCHATTR_DATADESCR_START+2)
rtl::Reference< ::chart::DataSeries > m_xSeries
const WhichRangesContainer nTextLabelWhichPairs(svl::Items< SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END, SCHATTR_TEXT_DEGREES, SCHATTR_TEXT_DEGREES, SCHATTR_STYLE_SYMBOL, SCHATTR_STYLE_SYMBOL, SCHATTR_SYMBOL_BRUSH, SCHATTR_SYMBOL_BRUSH, SCHATTR_SYMBOL_SIZE, SCHATTR_SYMBOL_SIZE, XATTR_LINESTYLE, XATTR_LINECOLOR, XATTR_LINETRANSPARENCE, XATTR_LINETRANSPARENCE, EE_ITEMS_START, EE_ITEMS_END, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING >)
GPOS_MM
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
bool GetValue() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void InvalidateItem(sal_uInt16 nWhich)
constexpr tools::Long getHeight() const
constexpr tools::Long getWidth() const
const Graphic * GetGraphic(OUString const &referer=OUString()) const
static css::uno::Sequence< sal_Int32 > getSupportedLabelPlacements(const rtl::Reference< ::chart::ChartType > &xChartType, bool bSwapXAndY, const rtl::Reference< ::chart::DataSeries > &xSeries)
static sal_Int32 getAxisType(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionIndex)
This class serves for conversion between properties of an XPropertySet and SfxItems in SfxItemSets.
virtual void FillItemSet(SfxItemSet &rOutItemSet) const
applies all properties that can be mapped to items into the given item set.
std::pair< tPropertyNameType, tMemberIdType > tPropertyNameWithMemberId
const css::uno::Reference< css::beans::XPropertySet > & GetPropertySet() const
Returns the XPropertySet that was given in the CTOR and is used to apply items in ApplyItemSet().
virtual bool ApplyItemSet(const SfxItemSet &rItemSet)
applies all properties that are results of a conversion from all items in rItemSet to the internal XP...
css::uno::Sequence< sal_Int32 > maAvailableLabelPlacements
virtual void FillItemSet(SfxItemSet &rOutItemSet) const override
applies all properties that can be mapped to items into the given item set.
TextLabelItemConverter(const rtl::Reference<::chart::ChartModel > &xChartModel, const css::uno::Reference< css::beans::XPropertySet > &rPropertySet, const rtl::Reference<::chart::DataSeries > &xSeries, SfxItemPool &rItemPool, const css::awt::Size *pRefSize, bool bDataSeries, sal_Int32 nNumberFormat, sal_Int32 nPercentNumberFormat)
virtual void FillSpecialItem(sal_uInt16 nWhichId, SfxItemSet &rOutItemSet) const override
for items that can not be mapped directly to a property.
rtl::Reference<::chart::DataSeries > m_xSeries
virtual bool GetItemProperty(tWhichIdType nWhichId, tPropertyNameWithMemberId &rOutProperty) const override
implement this method to return a Property object for a given which id.
virtual const WhichRangesContainer & GetWhichPairs() const override
implement this method to provide an array of which-ranges
std::vector< std::unique_ptr< ItemConverter > > maConverters
virtual bool ApplyItemSet(const SfxItemSet &rItemSet) override
applies all properties that are results of a conversion from all items in rItemSet to the internal XP...
virtual bool ApplySpecialItem(sal_uInt16 nWhichId, const SfxItemSet &rItemSet) override
for items that can not be mapped directly to a property.
#define TOOLS_WARN_EXCEPTION(area, stream)
OOO_DLLPUBLIC_CHARTTOOLS void setPropertyAlsoToAllAttributedDataPoints(const rtl::Reference< ::chart::DataSeries > &xSeries, const OUString &rPropertyName, const css::uno::Any &rPropertyValue)
OOO_DLLPUBLIC_CHARTTOOLS bool hasAttributedDataPointDifferentValue(const rtl::Reference< ::chart::DataSeries > &xSeries, const OUString &rPropertyName, const css::uno::Any &rPropertyValue)
std::map< ItemConverter::tWhichIdType, std::pair< ItemConverter::tPropertyNameType, ItemConverter::tMemberIdType > > ItemPropertyMapType
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
HashMap_OWString_Interface aMap
const char GetValue[]
SfxItemState
#define SVX_SYMBOLTYPE_BRUSHITEM
#define SVX_SYMBOLTYPE_NONE
#define SVX_SYMBOLTYPE_UNKNOWN
#define SVX_SYMBOLTYPE_AUTO
unsigned char sal_Bool
OUString aLabel
constexpr OUStringLiteral CHART_UNONAME_LABEL_BORDER_WIDTH
Definition: unonames.hxx:27
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_NUMFMT
Definition: unonames.hxx:20
constexpr OUStringLiteral CHART_UNONAME_CUSTOM_LABEL_FIELDS
Definition: unonames.hxx:36
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
Definition: unonames.hxx:24
constexpr OUStringLiteral CHART_UNONAME_LABEL_BORDER_DASH
Definition: unonames.hxx:29
constexpr TypedWhichId< XLineColorItem > XATTR_LINECOLOR(XATTR_LINE_FIRST+3)
constexpr TypedWhichId< XLineDashItem > XATTR_LINEDASH(XATTR_LINE_FIRST+1)
constexpr TypedWhichId< XLineWidthItem > XATTR_LINEWIDTH(XATTR_LINE_FIRST+2)
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
constexpr TypedWhichId< XLineTransparenceItem > XATTR_LINETRANSPARENCE(XATTR_LINE_FIRST+10)