1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <TextLabelItemConverter.hxx>
21 #include <CharacterPropertyItemConverter.hxx>
22 #include <ChartModel.hxx>
23 #include <ChartType.hxx>
24 #include <ChartTypeHelper.hxx>
25 #include <DataSeries.hxx>
26 #include <DataSeriesHelper.hxx>
27 #include <DataSeriesProperties.hxx>
28 #include <Diagram.hxx>
29 #include <ItemPropertyMap.hxx>
30 #include "SchWhichPairs.hxx"
31 #include <unonames.hxx>
33 #include <editeng/brushitem.hxx>
34 #include <editeng/sizeitem.hxx>
35 #include <svl/eitem.hxx>
36 #include <svl/ilstitem.hxx>
37 #include <svl/intitem.hxx>
38 #include <svl/stritem.hxx>
39 #include <svx/tabline.hxx>
40 #include <svx/sdangitm.hxx>
41 #include <comphelper/diagnose_ex.hxx>
42 #include <vcl/graph.hxx>
43 #include <rtl/math.hxx>
45 #include <com/sun/star/chart/DataLabelPlacement.hpp>
46 #include <com/sun/star/chart2/AxisType.hpp>
47 #include <com/sun/star/chart2/DataPointLabel.hpp>
48 #include <com/sun/star/chart2/Symbol.hpp>
49 #include <com/sun/star/chart2/RelativePosition.hpp>
52 using namespace com::sun::star
;
53 using namespace com::sun::star::chart2
;
54 using com::sun::star::uno::Reference
;
55 using namespace ::chart::DataSeriesProperties
;
57 namespace chart::wrapper
{
61 const ItemPropertyMapType
& getTextLabelPropertyMap()
63 static ItemPropertyMapType aMap
{
64 {XATTR_LINESTYLE
, {CHART_UNONAME_LABEL_BORDER_STYLE
, 0}},
65 {XATTR_LINEWIDTH
, {CHART_UNONAME_LABEL_BORDER_WIDTH
, 0}},
66 {XATTR_LINEDASH
, {CHART_UNONAME_LABEL_BORDER_DASH
, 0}},
67 {XATTR_LINECOLOR
, {CHART_UNONAME_LABEL_BORDER_COLOR
, 0}},
68 {XATTR_LINETRANSPARENCE
, {CHART_UNONAME_LABEL_BORDER_TRANS
, 0}}};
72 sal_Int32
getSymbolStyleForSymbol( const chart2::Symbol
& rSymbol
)
74 sal_Int32 nStyle
= SVX_SYMBOLTYPE_UNKNOWN
;
75 switch (rSymbol
.Style
)
77 case chart2::SymbolStyle_NONE
:
78 nStyle
= SVX_SYMBOLTYPE_NONE
;
80 case chart2::SymbolStyle_AUTO
:
81 nStyle
= SVX_SYMBOLTYPE_AUTO
;
83 case chart2::SymbolStyle_GRAPHIC
:
84 nStyle
= SVX_SYMBOLTYPE_BRUSHITEM
;
86 case chart2::SymbolStyle_STANDARD
:
87 nStyle
= rSymbol
.StandardSymbol
;
89 case chart2::SymbolStyle_POLYGON
:
96 bool numberFormatFromItemToPropertySet(
97 sal_uInt16 nWhichId
, const SfxItemSet
& rItemSet
, const uno::Reference
<beans::XPropertySet
>& xPropertySet
,
98 bool bOverwriteDataPoints
)
100 bool bChanged
= false;
101 if (!xPropertySet
.is())
104 OUString aPropertyName
= (nWhichId
== SID_ATTR_NUMBERFORMAT_VALUE
) ? CHART_UNONAME_NUMFMT
: u
"PercentageNumberFormat"_ustr
;
105 sal_uInt16 nSourceWhich
= (nWhichId
== SID_ATTR_NUMBERFORMAT_VALUE
) ? SID_ATTR_NUMBERFORMAT_SOURCE
: SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
;
107 if (rItemSet
.GetItemState(nSourceWhich
) != SfxItemState::SET
)
111 bool bUseSourceFormat
= static_cast<const SfxBoolItem
&>(rItemSet
.Get(nSourceWhich
)).GetValue();
112 if (!bUseSourceFormat
)
114 SfxItemState aState
= rItemSet
.GetItemState(nWhichId
);
115 if (aState
== SfxItemState::SET
)
117 sal_Int32 nFmt
= static_cast<sal_Int32
>(
118 static_cast<const SfxUInt32Item
&>(
119 rItemSet
.Get(nWhichId
)).GetValue());
126 uno::Any aOldValue
= xPropertySet
->getPropertyValue(aPropertyName
);
127 if (bOverwriteDataPoints
)
129 rtl::Reference
<DataSeries
> xSeries( dynamic_cast<DataSeries
*>(xPropertySet
.get()) );
130 if (aValue
!= aOldValue
||
131 ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries
, aPropertyName
, aOldValue
))
133 ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries
, aPropertyName
, aValue
);
137 else if (aOldValue
!= aValue
)
139 xPropertySet
->setPropertyValue(aPropertyName
, aValue
);
145 bool useSourceFormatFromItemToPropertySet(
146 sal_uInt16 nWhichId
, const SfxItemSet
& rItemSet
, const uno::Reference
<beans::XPropertySet
>& xPropertySet
,
147 bool bOverwriteDataPoints
)
149 bool bChanged
= false;
150 if (!xPropertySet
.is())
152 OUString aPropertyName
= (nWhichId
== SID_ATTR_NUMBERFORMAT_SOURCE
) ? CHART_UNONAME_NUMFMT
: u
"PercentageNumberFormat"_ustr
;
153 sal_uInt16 nFormatWhich
= (nWhichId
== SID_ATTR_NUMBERFORMAT_SOURCE
) ? SID_ATTR_NUMBERFORMAT_VALUE
: SCHATTR_PERCENT_NUMBERFORMAT_VALUE
;
155 if (rItemSet
.GetItemState(nWhichId
) != SfxItemState::SET
)
159 bool bUseSourceFormat
= static_cast<const SfxBoolItem
&>(
160 rItemSet
.Get(nWhichId
)).GetValue();
161 xPropertySet
->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT
, uno::Any(bUseSourceFormat
));
162 if (!bUseSourceFormat
)
164 SfxItemState aState
= rItemSet
.GetItemState(nFormatWhich
);
165 if (aState
== SfxItemState::SET
)
167 sal_Int32 nFormatKey
= static_cast<sal_Int32
>(
168 static_cast<const SfxUInt32Item
&>(
169 rItemSet
.Get(nFormatWhich
)).GetValue());
170 aNewValue
<<= nFormatKey
;
176 uno::Any
aOldValue(xPropertySet
->getPropertyValue(aPropertyName
));
177 if (bOverwriteDataPoints
)
179 rtl::Reference
<DataSeries
> xSeries(dynamic_cast<DataSeries
*>(xPropertySet
.get()));
180 if (aNewValue
!= aOldValue
||
181 ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries
, aPropertyName
, aOldValue
))
183 ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries
, aPropertyName
, aNewValue
);
187 else if (aOldValue
!= aNewValue
)
189 xPropertySet
->setPropertyValue(aPropertyName
, aNewValue
);
196 } // anonymous namespace
198 TextLabelItemConverter::TextLabelItemConverter(
199 const rtl::Reference
<::chart::ChartModel
>& xChartModel
,
200 const uno::Reference
<beans::XPropertySet
>& rPropertySet
,
201 const rtl::Reference
<DataSeries
>& xSeries
,
202 SfxItemPool
& rItemPool
, const std::optional
<awt::Size
>& pRefSize
,
203 bool bDataSeries
, sal_Int32 nNumberFormat
, sal_Int32 nPercentNumberFormat
) :
204 ItemConverter(rPropertySet
, rItemPool
),
205 mnNumberFormat(nNumberFormat
),
206 mnPercentNumberFormat(nPercentNumberFormat
),
207 mbDataSeries(bDataSeries
),
208 mbForbidPercentValue(true),
211 maConverters
.emplace_back(new CharacterPropertyItemConverter(rPropertySet
, rItemPool
, pRefSize
, u
"ReferencePageSize"_ustr
));
213 rtl::Reference
< Diagram
> xDiagram(xChartModel
->getFirstChartDiagram());
214 rtl::Reference
< ChartType
> xChartType(xDiagram
->getChartTypeOfSeries(xSeries
));
216 bool bAmbiguous
= false;
217 bool bSwapXAndY
= xDiagram
->getVertical(bFound
, bAmbiguous
);
218 maAvailableLabelPlacements
= ChartTypeHelper::getSupportedLabelPlacements(xChartType
, bSwapXAndY
, xSeries
);
220 mbForbidPercentValue
= ChartTypeHelper::getAxisType(xChartType
, 0) != AxisType::CATEGORY
;
223 TextLabelItemConverter::~TextLabelItemConverter()
227 void TextLabelItemConverter::FillItemSet( SfxItemSet
& rOutItemSet
) const
229 for( const auto& pConv
: maConverters
)
230 pConv
->FillItemSet( rOutItemSet
);
233 ItemConverter::FillItemSet(rOutItemSet
);
236 bool TextLabelItemConverter::ApplyItemSet( const SfxItemSet
& rItemSet
)
238 bool bResult
= false;
240 for( const auto& pConv
: maConverters
)
241 bResult
= pConv
->ApplyItemSet( rItemSet
) || bResult
;
244 return ItemConverter::ApplyItemSet(rItemSet
) || bResult
;
247 const WhichRangesContainer
& TextLabelItemConverter::GetWhichPairs() const
249 // must span all used items!
250 return nTextLabelWhichPairs
;
253 bool TextLabelItemConverter::GetItemProperty( tWhichIdType nWhichId
, tPropertyNameWithMemberId
& rOutProperty
) const
255 const ItemPropertyMapType
& rMap
= getTextLabelPropertyMap();
256 ItemPropertyMapType::const_iterator it
= rMap
.find(nWhichId
);
258 if (it
== rMap
.end())
261 rOutProperty
= it
->second
;
265 bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId
, const SfxItemSet
& rItemSet
)
267 bool bChanged
= false;
271 case SCHATTR_DATADESCR_SHOW_NUMBER
:
272 case SCHATTR_DATADESCR_SHOW_PERCENTAGE
:
273 case SCHATTR_DATADESCR_SHOW_CATEGORY
:
274 case SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME
:
275 case SCHATTR_DATADESCR_SHOW_SYMBOL
:
277 const SfxBoolItem
& rItem
= static_cast<const SfxBoolItem
&>(rItemSet
.Get(nWhichId
));
279 uno::Any aOldValue
= GetPropertySet()->getPropertyValue(CHART_UNONAME_LABEL
);
280 chart2::DataPointLabel aLabel
;
281 if (aOldValue
>>= aLabel
)
283 sal_Bool
& rValue
= (nWhichId
== SCHATTR_DATADESCR_SHOW_NUMBER
) ? aLabel
.ShowNumber
: (
284 (nWhichId
== SCHATTR_DATADESCR_SHOW_PERCENTAGE
) ? aLabel
.ShowNumberInPercent
: (
285 (nWhichId
== SCHATTR_DATADESCR_SHOW_CATEGORY
) ? aLabel
.ShowCategoryName
:
286 (nWhichId
== SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME
) ? aLabel
.ShowSeriesName
: aLabel
.ShowLegendSymbol
));
287 bool bOldValue
= rValue
;
288 rValue
= rItem
.GetValue();
291 rtl::Reference
<DataSeries
> xSeries(dynamic_cast<DataSeries
*>(GetPropertySet().get()));
292 if (bOldValue
!= bool(rValue
) ||
293 DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries
, CHART_UNONAME_LABEL
, aOldValue
))
295 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries
, CHART_UNONAME_LABEL
, uno::Any(aLabel
));
296 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries
, CHART_UNONAME_CUSTOM_LABEL_FIELDS
, uno::Any());
300 else if (bOldValue
!= bool(rValue
))
302 GetPropertySet()->setPropertyValue(CHART_UNONAME_LABEL
, uno::Any(aLabel
));
308 case SID_ATTR_NUMBERFORMAT_VALUE
:
309 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE
: //fall through intended
311 bChanged
= numberFormatFromItemToPropertySet(nWhichId
, rItemSet
, GetPropertySet(), mbDataSeries
);
314 case SID_ATTR_NUMBERFORMAT_SOURCE
:
315 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
: //fall through intended
317 bChanged
= useSourceFormatFromItemToPropertySet(nWhichId
, rItemSet
, GetPropertySet(), mbDataSeries
);
320 case SCHATTR_DATADESCR_SEPARATOR
:
322 OUString aNewValue
= static_cast<const SfxStringItem
&>(rItemSet
.Get(nWhichId
)).GetValue();
326 GetPropertySet()->getPropertyValue(u
"LabelSeparator"_ustr
) >>= aOldValue
;
329 rtl::Reference
<DataSeries
> xSeries(dynamic_cast<DataSeries
*>(GetPropertySet().get()));
330 if (aOldValue
!= aNewValue
||
331 DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries
, u
"LabelSeparator"_ustr
, uno::Any(aOldValue
)))
333 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries
, u
"LabelSeparator"_ustr
, uno::Any(aNewValue
));
337 else if (aOldValue
!= aNewValue
)
339 GetPropertySet()->setPropertyValue(u
"LabelSeparator"_ustr
, uno::Any(aNewValue
));
343 catch (const uno::Exception
&)
345 TOOLS_WARN_EXCEPTION("chart2", "");
349 case SCHATTR_DATADESCR_WRAP_TEXT
:
354 bool bNew
= static_cast< const SfxBoolItem
& >( rItemSet
.Get( nWhichId
)).GetValue();
356 GetPropertySet()->getPropertyValue( u
"TextWordWrap"_ustr
) >>= bOld
;
359 rtl::Reference
< DataSeries
> xSeries( dynamic_cast<DataSeries
*>(GetPropertySet().get()) );
361 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, u
"TextWordWrap"_ustr
, uno::Any( bOld
) ) )
363 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, u
"TextWordWrap"_ustr
, uno::Any( bNew
) );
367 else if( bOld
!=bNew
)
369 GetPropertySet()->setPropertyValue( u
"TextWordWrap"_ustr
, uno::Any( bNew
));
373 catch( const uno::Exception
& )
375 TOOLS_WARN_EXCEPTION("chart2", "" );
379 case SCHATTR_DATADESCR_PLACEMENT
:
383 sal_Int32 nNew
= static_cast<const SfxInt32Item
&>(rItemSet
.Get(nWhichId
)).GetValue();
385 RelativePosition aCustomLabelPosition
;
386 GetPropertySet()->getPropertyValue(u
"LabelPlacement"_ustr
) >>= nOld
;
389 rtl::Reference
<DataSeries
> xSeries(dynamic_cast<DataSeries
*>(GetPropertySet().get()));
391 DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries
, u
"LabelPlacement"_ustr
, uno::Any(nOld
)))
393 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries
, u
"LabelPlacement"_ustr
, uno::Any(nNew
));
397 else if (nOld
!= nNew
|| (GetPropertySet()->getPropertyValue(u
"CustomLabelPosition"_ustr
) >>= aCustomLabelPosition
))
399 GetPropertySet()->setPropertyValue(u
"LabelPlacement"_ustr
, uno::Any(nNew
));
400 GetPropertySet()->setPropertyValue(u
"CustomLabelPosition"_ustr
, uno::Any());
401 GetPropertySet()->setPropertyValue(u
"CustomLabelSize"_ustr
, uno::Any());
405 catch (const uno::Exception
&)
407 TOOLS_WARN_EXCEPTION("chart2", "" );
411 case SCHATTR_STYLE_SYMBOL
:
414 static_cast<const SfxInt32Item
&>(
415 rItemSet
.Get(nWhichId
)).GetValue();
416 chart2::Symbol aSymbol
;
418 GetPropertySet()->getPropertyValue(u
"Symbol"_ustr
) >>= aSymbol
;
419 sal_Int32 nOldStyle
= getSymbolStyleForSymbol(aSymbol
);
421 if (nStyle
!= nOldStyle
)
423 bool bDeleteSymbol
= false;
426 case SVX_SYMBOLTYPE_NONE
:
427 aSymbol
.Style
= chart2::SymbolStyle_NONE
;
429 case SVX_SYMBOLTYPE_AUTO
:
430 aSymbol
.Style
= chart2::SymbolStyle_AUTO
;
432 case SVX_SYMBOLTYPE_BRUSHITEM
:
433 aSymbol
.Style
= chart2::SymbolStyle_GRAPHIC
;
435 case SVX_SYMBOLTYPE_UNKNOWN
:
436 bDeleteSymbol
= true;
440 aSymbol
.Style
= chart2::SymbolStyle_STANDARD
;
441 aSymbol
.StandardSymbol
= nStyle
;
445 GetPropertySet()->setPropertyValue(u
"Symbol"_ustr
, uno::Any());
447 GetPropertySet()->setPropertyValue(u
"Symbol"_ustr
, uno::Any(aSymbol
));
452 case SCHATTR_SYMBOL_SIZE
:
454 Size aSize
= static_cast<const SvxSizeItem
&>(
455 rItemSet
.Get(nWhichId
)).GetSize();
456 chart2::Symbol aSymbol
;
458 GetPropertySet()->getPropertyValue(u
"Symbol"_ustr
) >>= aSymbol
;
459 if (aSize
.getWidth() != aSymbol
.Size
.Width
||
460 aSize
.getHeight() != aSymbol
.Size
.Height
)
462 aSymbol
.Size
.Width
= aSize
.getWidth();
463 aSymbol
.Size
.Height
= aSize
.getHeight();
465 GetPropertySet()->setPropertyValue(u
"Symbol"_ustr
, uno::Any(aSymbol
));
470 case SCHATTR_SYMBOL_BRUSH
:
472 const SvxBrushItem
& rBrshItem(static_cast<const SvxBrushItem
&>(
473 rItemSet
.Get(nWhichId
)));
474 uno::Any aXGraphicAny
;
475 const Graphic
* pGraphic(rBrshItem
.GetGraphic());
478 uno::Reference
<graphic::XGraphic
> xGraphic(pGraphic
->GetXGraphic());
481 aXGraphicAny
<<= xGraphic
;
482 chart2::Symbol aSymbol
;
483 GetPropertySet()->getPropertyValue(u
"Symbol"_ustr
) >>= aSymbol
;
484 if (aSymbol
.Graphic
!= xGraphic
)
486 aSymbol
.Graphic
= std::move(xGraphic
);
487 GetPropertySet()->setPropertyValue(u
"Symbol"_ustr
, uno::Any(aSymbol
));
494 case SCHATTR_TEXT_DEGREES
:
496 double fValue
= static_cast<double>(
497 static_cast<const SdrAngleItem
&>(
498 rItemSet
.Get(nWhichId
)).GetValue().get()) / 100.0;
499 double fOldValue
= 0.0;
501 (GetPropertySet()->getPropertyValue(u
"TextRotation"_ustr
) >>= fOldValue
);
503 if (!bPropExisted
|| fOldValue
!= fValue
)
505 GetPropertySet()->setPropertyValue(u
"TextRotation"_ustr
, uno::Any(fValue
));
510 case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES
:
514 bool bNew
= static_cast<const SfxBoolItem
&>(rItemSet
.Get(nWhichId
)).GetValue();
516 if( (m_xSeries
->getFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES
) >>= bOld
) && bOld
!= bNew
)
518 m_xSeries
->setFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES
, uno::Any(bNew
));
522 catch (const uno::Exception
&)
524 TOOLS_WARN_EXCEPTION("chart2", "");
533 void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId
, SfxItemSet
& rOutItemSet
) const
537 case SCHATTR_DATADESCR_SHOW_NUMBER
:
538 case SCHATTR_DATADESCR_SHOW_PERCENTAGE
:
539 case SCHATTR_DATADESCR_SHOW_CATEGORY
:
540 case SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME
:
541 case SCHATTR_DATADESCR_SHOW_SYMBOL
:
543 chart2::DataPointLabel aLabel
;
544 if (GetPropertySet()->getPropertyValue(CHART_UNONAME_LABEL
) >>= aLabel
)
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
)));
551 rOutItemSet
.Put(SfxBoolItem(nWhichId
, bValue
));
555 if (DataSeriesHelper::hasAttributedDataPointDifferentValue(
556 dynamic_cast<DataSeries
*>(GetPropertySet().get()), CHART_UNONAME_LABEL
, uno::Any(aLabel
)))
558 rOutItemSet
.InvalidateItem(nWhichId
);
564 case SID_ATTR_NUMBERFORMAT_VALUE
:
567 if (!(GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT
) >>= nKey
))
568 nKey
= mnNumberFormat
;
569 rOutItemSet
.Put(SfxUInt32Item(nWhichId
, nKey
));
572 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE
:
575 if (!(GetPropertySet()->getPropertyValue(u
"PercentageNumberFormat"_ustr
) >>= nKey
))
576 nKey
= mnPercentNumberFormat
;
577 rOutItemSet
.Put(SfxUInt32Item(nWhichId
, nKey
));
580 case SID_ATTR_NUMBERFORMAT_SOURCE
:
582 bool bUseSourceFormat
= false;
585 GetPropertySet()->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT
) >>= bUseSourceFormat
;
587 catch (const uno::Exception
&)
589 TOOLS_WARN_EXCEPTION("chart2", "");
591 bool bNumberFormatIsSet
= GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT
).hasValue() && !bUseSourceFormat
;
592 rOutItemSet
.Put(SfxBoolItem(nWhichId
, !bNumberFormatIsSet
));
595 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
:
597 bool bUseSourceFormat
= false;
600 GetPropertySet()->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT
) >>= bUseSourceFormat
;
602 catch (const uno::Exception
&)
604 TOOLS_WARN_EXCEPTION("chart2", "");
606 bool bNumberFormatIsSet
= GetPropertySet()->getPropertyValue(u
"PercentageNumberFormat"_ustr
).hasValue() && !bUseSourceFormat
;
607 rOutItemSet
.Put(SfxBoolItem(nWhichId
, !bNumberFormatIsSet
));
610 case SCHATTR_DATADESCR_SEPARATOR
:
615 GetPropertySet()->getPropertyValue(u
"LabelSeparator"_ustr
) >>= aValue
;
616 rOutItemSet
.Put(SfxStringItem(nWhichId
, aValue
));
618 catch (const uno::Exception
&)
620 TOOLS_WARN_EXCEPTION("chart2", "" );
624 case SCHATTR_DATADESCR_WRAP_TEXT
:
629 GetPropertySet()->getPropertyValue( u
"TextWordWrap"_ustr
) >>= bValue
;
630 rOutItemSet
.Put( SfxBoolItem( nWhichId
, bValue
));
632 catch( const uno::Exception
& )
634 TOOLS_WARN_EXCEPTION("chart2", "" );
638 case SCHATTR_DATADESCR_PLACEMENT
:
642 sal_Int32 nPlacement
= 0;
643 RelativePosition aCustomLabelPosition
;
644 if (!mbDataSeries
&& (GetPropertySet()->getPropertyValue(u
"CustomLabelPosition"_ustr
) >>= aCustomLabelPosition
))
645 rOutItemSet
.Put(SfxInt32Item(nWhichId
, css::chart::DataLabelPlacement::CUSTOM
));
646 else if (GetPropertySet()->getPropertyValue(u
"LabelPlacement"_ustr
) >>= nPlacement
)
647 rOutItemSet
.Put(SfxInt32Item(nWhichId
, nPlacement
));
648 else if (maAvailableLabelPlacements
.hasElements())
649 rOutItemSet
.Put(SfxInt32Item(nWhichId
, maAvailableLabelPlacements
[0]));
651 catch (const uno::Exception
&)
653 TOOLS_WARN_EXCEPTION("chart2", "" );
657 case SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS
:
659 rOutItemSet
.Put(SfxIntegerListItem(nWhichId
, maAvailableLabelPlacements
));
662 case SCHATTR_DATADESCR_NO_PERCENTVALUE
:
664 rOutItemSet
.Put(SfxBoolItem(nWhichId
, mbForbidPercentValue
));
667 case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES
:
672 if( m_xSeries
->getFastPropertyValue( PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES
) >>= bValue
)
673 rOutItemSet
.Put(SfxBoolItem(nWhichId
, bValue
));
675 catch (const uno::Exception
&)
677 TOOLS_WARN_EXCEPTION("chart2", "");
681 case SCHATTR_STYLE_SYMBOL
:
683 chart2::Symbol aSymbol
;
684 if (GetPropertySet()->getPropertyValue(u
"Symbol"_ustr
) >>= aSymbol
)
685 rOutItemSet
.Put(SfxInt32Item(nWhichId
, getSymbolStyleForSymbol(aSymbol
)));
688 case SCHATTR_SYMBOL_SIZE
:
690 chart2::Symbol aSymbol
;
691 if (GetPropertySet()->getPropertyValue(u
"Symbol"_ustr
) >>= aSymbol
)
693 SvxSizeItem(nWhichId
, Size(aSymbol
.Size
.Width
, aSymbol
.Size
.Height
)));
696 case SCHATTR_SYMBOL_BRUSH
:
698 chart2::Symbol aSymbol
;
699 if ((GetPropertySet()->getPropertyValue(u
"Symbol"_ustr
) >>= aSymbol
)
700 && aSymbol
.Graphic
.is())
703 SvxBrushItem(Graphic(aSymbol
.Graphic
), GPOS_MM
, SCHATTR_SYMBOL_BRUSH
));
707 case SCHATTR_TEXT_DEGREES
:
711 if (GetPropertySet()->getPropertyValue(u
"TextRotation"_ustr
) >>= fValue
)
714 SdrAngleItem(SCHATTR_TEXT_DEGREES
, Degree100(static_cast<sal_Int32
>(rtl::math::round(fValue
* 100.0)))));
723 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */