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 <ChartModelHelper.hxx>
23 #include <ChartTypeHelper.hxx>
24 #include <DataSeriesHelper.hxx>
25 #include <DiagramHelper.hxx>
26 #include <ItemPropertyMap.hxx>
27 #include "SchWhichPairs.hxx"
28 #include <unonames.hxx>
30 #include <editeng/brushitem.hxx>
31 #include <editeng/sizeitem.hxx>
32 #include <svl/eitem.hxx>
33 #include <svl/ilstitem.hxx>
34 #include <svl/intitem.hxx>
35 #include <svl/stritem.hxx>
36 #include <svx/tabline.hxx>
37 #include <tools/diagnose_ex.h>
38 #include <vcl/graph.hxx>
39 #include <rtl/math.hxx>
41 #include <com/sun/star/chart/DataLabelPlacement.hpp>
42 #include <com/sun/star/chart2/AxisType.hpp>
43 #include <com/sun/star/chart2/DataPointLabel.hpp>
44 #include <com/sun/star/chart2/Symbol.hpp>
45 #include <com/sun/star/chart2/RelativePosition.hpp>
46 #include <com/sun/star/frame/XModel.hpp>
49 using namespace com::sun::star
;
50 using namespace com::sun::star::chart2
;
51 using com::sun::star::uno::Reference
;
53 namespace chart::wrapper
{
57 const ItemPropertyMapType
& getTextLabelPropertyMap()
59 static ItemPropertyMapType aMap
{
60 {XATTR_LINESTYLE
, {CHART_UNONAME_LABEL_BORDER_STYLE
, 0}},
61 {XATTR_LINEWIDTH
, {CHART_UNONAME_LABEL_BORDER_WIDTH
, 0}},
62 {XATTR_LINEDASH
, {CHART_UNONAME_LABEL_BORDER_DASH
, 0}},
63 {XATTR_LINECOLOR
, {CHART_UNONAME_LABEL_BORDER_COLOR
, 0}},
64 {XATTR_LINETRANSPARENCE
, {CHART_UNONAME_LABEL_BORDER_TRANS
, 0}}};
68 sal_Int32
getSymbolStyleForSymbol( const chart2::Symbol
& rSymbol
)
70 sal_Int32 nStyle
= SVX_SYMBOLTYPE_UNKNOWN
;
71 switch (rSymbol
.Style
)
73 case chart2::SymbolStyle_NONE
:
74 nStyle
= SVX_SYMBOLTYPE_NONE
;
76 case chart2::SymbolStyle_AUTO
:
77 nStyle
= SVX_SYMBOLTYPE_AUTO
;
79 case chart2::SymbolStyle_GRAPHIC
:
80 nStyle
= SVX_SYMBOLTYPE_BRUSHITEM
;
82 case chart2::SymbolStyle_STANDARD
:
83 nStyle
= rSymbol
.StandardSymbol
;
85 case chart2::SymbolStyle_POLYGON
:
92 bool numberFormatFromItemToPropertySet(
93 sal_uInt16 nWhichId
, const SfxItemSet
& rItemSet
, const uno::Reference
<beans::XPropertySet
>& xPropertySet
,
94 bool bOverwriteDataPoints
)
96 bool bChanged
= false;
97 if (!xPropertySet
.is())
100 OUString aPropertyName
= (nWhichId
== SID_ATTR_NUMBERFORMAT_VALUE
) ? OUString(CHART_UNONAME_NUMFMT
) : OUString("PercentageNumberFormat");
101 sal_uInt16 nSourceWhich
= (nWhichId
== SID_ATTR_NUMBERFORMAT_VALUE
) ? SID_ATTR_NUMBERFORMAT_SOURCE
: SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
;
103 if (rItemSet
.GetItemState(nSourceWhich
) != SfxItemState::SET
)
107 bool bUseSourceFormat
= static_cast<const SfxBoolItem
&>(rItemSet
.Get(nSourceWhich
)).GetValue();
108 if (!bUseSourceFormat
)
110 SfxItemState aState
= rItemSet
.GetItemState(nWhichId
);
111 if (aState
== SfxItemState::SET
)
113 sal_Int32 nFmt
= static_cast<sal_Int32
>(
114 static_cast<const SfxUInt32Item
&>(
115 rItemSet
.Get(nWhichId
)).GetValue());
122 uno::Any aOldValue
= xPropertySet
->getPropertyValue(aPropertyName
);
123 if (bOverwriteDataPoints
)
125 Reference
<chart2::XDataSeries
> xSeries(xPropertySet
, uno::UNO_QUERY
);
126 if (aValue
!= aOldValue
||
127 ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries
, aPropertyName
, aOldValue
))
129 ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries
, aPropertyName
, aValue
);
133 else if (aOldValue
!= aValue
)
135 xPropertySet
->setPropertyValue(aPropertyName
, aValue
);
141 bool useSourceFormatFromItemToPropertySet(
142 sal_uInt16 nWhichId
, const SfxItemSet
& rItemSet
, const uno::Reference
<beans::XPropertySet
>& xPropertySet
,
143 bool bOverwriteDataPoints
)
145 bool bChanged
= false;
146 if (!xPropertySet
.is())
148 OUString aPropertyName
= (nWhichId
== SID_ATTR_NUMBERFORMAT_SOURCE
) ? OUString(CHART_UNONAME_NUMFMT
) : OUString("PercentageNumberFormat");
149 sal_uInt16 nFormatWhich
= (nWhichId
== SID_ATTR_NUMBERFORMAT_SOURCE
) ? SID_ATTR_NUMBERFORMAT_VALUE
: SCHATTR_PERCENT_NUMBERFORMAT_VALUE
;
151 if (rItemSet
.GetItemState(nWhichId
) != SfxItemState::SET
)
155 bool bUseSourceFormat
= static_cast<const SfxBoolItem
&>(
156 rItemSet
.Get(nWhichId
)).GetValue();
157 xPropertySet
->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT
, uno::Any(bUseSourceFormat
));
158 if (!bUseSourceFormat
)
160 SfxItemState aState
= rItemSet
.GetItemState(nFormatWhich
);
161 if (aState
== SfxItemState::SET
)
163 sal_Int32 nFormatKey
= static_cast<sal_Int32
>(
164 static_cast<const SfxUInt32Item
&>(
165 rItemSet
.Get(nFormatWhich
)).GetValue());
166 aNewValue
<<= nFormatKey
;
172 uno::Any
aOldValue(xPropertySet
->getPropertyValue(aPropertyName
));
173 if (bOverwriteDataPoints
)
175 Reference
<chart2::XDataSeries
> xSeries(xPropertySet
, uno::UNO_QUERY
);
176 if (aNewValue
!= aOldValue
||
177 ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries
, aPropertyName
, aOldValue
))
179 ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries
, aPropertyName
, aNewValue
);
183 else if (aOldValue
!= aNewValue
)
185 xPropertySet
->setPropertyValue(aPropertyName
, aNewValue
);
192 } // anonymous namespace
194 TextLabelItemConverter::TextLabelItemConverter(
195 const uno::Reference
<frame::XModel
>& xChartModel
,
196 const uno::Reference
<beans::XPropertySet
>& rPropertySet
,
197 const uno::Reference
<XDataSeries
>& xSeries
,
198 SfxItemPool
& rItemPool
, const awt::Size
* pRefSize
,
199 bool bDataSeries
, sal_Int32 nNumberFormat
, sal_Int32 nPercentNumberFormat
) :
200 ItemConverter(rPropertySet
, rItemPool
),
201 mnNumberFormat(nNumberFormat
),
202 mnPercentNumberFormat(nPercentNumberFormat
),
203 mbDataSeries(bDataSeries
),
204 mbForbidPercentValue(true),
207 maConverters
.emplace_back(new CharacterPropertyItemConverter(rPropertySet
, rItemPool
, pRefSize
, "ReferencePageSize"));
209 uno::Reference
<XDiagram
> xDiagram(ChartModelHelper::findDiagram(xChartModel
));
210 uno::Reference
<XChartType
> xChartType(DiagramHelper::getChartTypeOfSeries(xDiagram
, xSeries
));
212 bool bAmbiguous
= false;
213 bool bSwapXAndY
= DiagramHelper::getVertical(xDiagram
, bFound
, bAmbiguous
);
214 maAvailableLabelPlacements
= ChartTypeHelper::getSupportedLabelPlacements(xChartType
, bSwapXAndY
, xSeries
);
216 mbForbidPercentValue
= ChartTypeHelper::getAxisType(xChartType
, 0) != AxisType::CATEGORY
;
219 TextLabelItemConverter::~TextLabelItemConverter()
223 void TextLabelItemConverter::FillItemSet( SfxItemSet
& rOutItemSet
) const
225 for( const auto& pConv
: maConverters
)
226 pConv
->FillItemSet( rOutItemSet
);
229 ItemConverter::FillItemSet(rOutItemSet
);
232 bool TextLabelItemConverter::ApplyItemSet( const SfxItemSet
& rItemSet
)
234 bool bResult
= false;
236 for( const auto& pConv
: maConverters
)
237 bResult
= pConv
->ApplyItemSet( rItemSet
) || bResult
;
240 return ItemConverter::ApplyItemSet(rItemSet
) || bResult
;
243 const sal_uInt16
* TextLabelItemConverter::GetWhichPairs() const
245 // must span all used items!
246 return nTextLabelWhichPairs
;
249 bool TextLabelItemConverter::GetItemProperty( tWhichIdType nWhichId
, tPropertyNameWithMemberId
& rOutProperty
) const
251 const ItemPropertyMapType
& rMap
= getTextLabelPropertyMap();
252 ItemPropertyMapType::const_iterator it
= rMap
.find(nWhichId
);
254 if (it
== rMap
.end())
257 rOutProperty
= it
->second
;
261 bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId
, const SfxItemSet
& rItemSet
)
263 bool bChanged
= false;
267 case SCHATTR_DATADESCR_SHOW_NUMBER
:
268 case SCHATTR_DATADESCR_SHOW_PERCENTAGE
:
269 case SCHATTR_DATADESCR_SHOW_CATEGORY
:
270 case SCHATTR_DATADESCR_SHOW_SYMBOL
:
272 const SfxBoolItem
& rItem
= static_cast<const SfxBoolItem
&>(rItemSet
.Get(nWhichId
));
274 uno::Any aOldValue
= GetPropertySet()->getPropertyValue(CHART_UNONAME_LABEL
);
275 chart2::DataPointLabel aLabel
;
276 if (aOldValue
>>= aLabel
)
278 sal_Bool
& rValue
= (nWhichId
== SCHATTR_DATADESCR_SHOW_NUMBER
) ? aLabel
.ShowNumber
: (
279 (nWhichId
== SCHATTR_DATADESCR_SHOW_PERCENTAGE
) ? aLabel
.ShowNumberInPercent
: (
280 (nWhichId
== SCHATTR_DATADESCR_SHOW_CATEGORY
) ? aLabel
.ShowCategoryName
: aLabel
.ShowLegendSymbol
));
281 bool bOldValue
= rValue
;
282 rValue
= rItem
.GetValue();
285 Reference
<chart2::XDataSeries
> xSeries(GetPropertySet(), uno::UNO_QUERY
);
286 if (bOldValue
!= bool(rValue
) ||
287 DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries
, CHART_UNONAME_LABEL
, aOldValue
))
289 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries
, CHART_UNONAME_LABEL
, uno::Any(aLabel
));
290 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries
, CHART_UNONAME_CUSTOM_LABEL_FIELDS
, uno::Any());
294 else if (bOldValue
!= bool(rValue
))
296 GetPropertySet()->setPropertyValue(CHART_UNONAME_LABEL
, uno::Any(aLabel
));
302 case SID_ATTR_NUMBERFORMAT_VALUE
:
303 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE
: //fall through intended
305 bChanged
= numberFormatFromItemToPropertySet(nWhichId
, rItemSet
, GetPropertySet(), mbDataSeries
);
308 case SID_ATTR_NUMBERFORMAT_SOURCE
:
309 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
: //fall through intended
311 bChanged
= useSourceFormatFromItemToPropertySet(nWhichId
, rItemSet
, GetPropertySet(), mbDataSeries
);
314 case SCHATTR_DATADESCR_SEPARATOR
:
316 OUString aNewValue
= static_cast<const SfxStringItem
&>(rItemSet
.Get(nWhichId
)).GetValue();
320 GetPropertySet()->getPropertyValue("LabelSeparator") >>= aOldValue
;
323 Reference
<chart2::XDataSeries
> xSeries(GetPropertySet(), uno::UNO_QUERY
);
324 if (aOldValue
!= aNewValue
||
325 DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries
, "LabelSeparator", uno::Any(aOldValue
)))
327 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries
, "LabelSeparator", uno::Any(aNewValue
));
331 else if (aOldValue
!= aNewValue
)
333 GetPropertySet()->setPropertyValue("LabelSeparator", uno::Any(aNewValue
));
337 catch (const uno::Exception
&)
339 TOOLS_WARN_EXCEPTION("chart2", "");
343 case SCHATTR_DATADESCR_WRAP_TEXT
:
348 bool bNew
= static_cast< const SfxBoolItem
& >( rItemSet
.Get( nWhichId
)).GetValue();
350 GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bOld
;
353 Reference
< chart2::XDataSeries
> xSeries( GetPropertySet(), uno::UNO_QUERY
);
355 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, "TextWordWrap", uno::Any( bOld
) ) )
357 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, "TextWordWrap", uno::Any( bNew
) );
361 else if( bOld
!=bNew
)
363 GetPropertySet()->setPropertyValue( "TextWordWrap", uno::Any( bNew
));
367 catch( const uno::Exception
& )
369 TOOLS_WARN_EXCEPTION("chart2", "" );
373 case SCHATTR_DATADESCR_PLACEMENT
:
377 sal_Int32 nNew
= static_cast<const SfxInt32Item
&>(rItemSet
.Get(nWhichId
)).GetValue();
379 RelativePosition aCustomLabelPosition
;
380 GetPropertySet()->getPropertyValue("LabelPlacement") >>= nOld
;
383 Reference
<chart2::XDataSeries
> xSeries(GetPropertySet(), uno::UNO_QUERY
);
385 DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries
, "LabelPlacement", uno::Any(nOld
)))
387 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries
, "LabelPlacement", uno::Any(nNew
));
391 else if (nOld
!= nNew
|| (GetPropertySet()->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition
))
393 GetPropertySet()->setPropertyValue("LabelPlacement", uno::Any(nNew
));
394 GetPropertySet()->setPropertyValue("CustomLabelPosition", uno::Any());
398 catch (const uno::Exception
&)
400 TOOLS_WARN_EXCEPTION("chart2", "" );
404 case SCHATTR_STYLE_SYMBOL
:
407 static_cast<const SfxInt32Item
&>(
408 rItemSet
.Get(nWhichId
)).GetValue();
409 chart2::Symbol aSymbol
;
411 GetPropertySet()->getPropertyValue("Symbol") >>= aSymbol
;
412 sal_Int32 nOldStyle
= getSymbolStyleForSymbol(aSymbol
);
414 if (nStyle
!= nOldStyle
)
416 bool bDeleteSymbol
= false;
419 case SVX_SYMBOLTYPE_NONE
:
420 aSymbol
.Style
= chart2::SymbolStyle_NONE
;
422 case SVX_SYMBOLTYPE_AUTO
:
423 aSymbol
.Style
= chart2::SymbolStyle_AUTO
;
425 case SVX_SYMBOLTYPE_BRUSHITEM
:
426 aSymbol
.Style
= chart2::SymbolStyle_GRAPHIC
;
428 case SVX_SYMBOLTYPE_UNKNOWN
:
429 bDeleteSymbol
= true;
433 aSymbol
.Style
= chart2::SymbolStyle_STANDARD
;
434 aSymbol
.StandardSymbol
= nStyle
;
438 GetPropertySet()->setPropertyValue("Symbol", uno::Any());
440 GetPropertySet()->setPropertyValue("Symbol", uno::Any(aSymbol
));
445 case SCHATTR_SYMBOL_SIZE
:
447 Size aSize
= static_cast<const SvxSizeItem
&>(
448 rItemSet
.Get(nWhichId
)).GetSize();
449 chart2::Symbol aSymbol
;
451 GetPropertySet()->getPropertyValue("Symbol") >>= aSymbol
;
452 if (aSize
.getWidth() != aSymbol
.Size
.Width
||
453 aSize
.getHeight() != aSymbol
.Size
.Height
)
455 aSymbol
.Size
.Width
= aSize
.getWidth();
456 aSymbol
.Size
.Height
= aSize
.getHeight();
458 GetPropertySet()->setPropertyValue("Symbol", uno::Any(aSymbol
));
463 case SCHATTR_SYMBOL_BRUSH
:
465 const SvxBrushItem
& rBrshItem(static_cast<const SvxBrushItem
&>(
466 rItemSet
.Get(nWhichId
)));
467 uno::Any aXGraphicAny
;
468 const Graphic
* pGraphic(rBrshItem
.GetGraphic());
471 uno::Reference
<graphic::XGraphic
> xGraphic(pGraphic
->GetXGraphic());
474 aXGraphicAny
<<= xGraphic
;
475 chart2::Symbol aSymbol
;
476 GetPropertySet()->getPropertyValue("Symbol") >>= aSymbol
;
477 if (aSymbol
.Graphic
!= xGraphic
)
479 aSymbol
.Graphic
= xGraphic
;
480 GetPropertySet()->setPropertyValue("Symbol", uno::Any(aSymbol
));
487 case SCHATTR_TEXT_DEGREES
:
489 double fValue
= static_cast<double>(
490 static_cast<const SfxInt32Item
&>(
491 rItemSet
.Get(nWhichId
)).GetValue()) / 100.0;
492 double fOldValue
= 0.0;
494 (GetPropertySet()->getPropertyValue("TextRotation") >>= fOldValue
);
496 if (!bPropExisted
|| fOldValue
!= fValue
)
498 GetPropertySet()->setPropertyValue("TextRotation", uno::Any(fValue
));
503 case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES
:
507 bool bNew
= static_cast<const SfxBoolItem
&>(rItemSet
.Get(nWhichId
)).GetValue();
509 Reference
<beans::XPropertySet
> xSeriesProp(m_xSeries
, uno::UNO_QUERY
);
510 if( (xSeriesProp
->getPropertyValue("ShowCustomLeaderLines") >>= bOld
) && bOld
!= bNew
)
512 xSeriesProp
->setPropertyValue("ShowCustomLeaderLines", uno::Any(bNew
));
516 catch (const uno::Exception
&)
518 TOOLS_WARN_EXCEPTION("chart2", "");
527 void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId
, SfxItemSet
& rOutItemSet
) const
531 case SCHATTR_DATADESCR_SHOW_NUMBER
:
532 case SCHATTR_DATADESCR_SHOW_PERCENTAGE
:
533 case SCHATTR_DATADESCR_SHOW_CATEGORY
:
534 case SCHATTR_DATADESCR_SHOW_SYMBOL
:
536 chart2::DataPointLabel aLabel
;
537 if (GetPropertySet()->getPropertyValue(CHART_UNONAME_LABEL
) >>= aLabel
)
539 bool bValue
= (nWhichId
== SCHATTR_DATADESCR_SHOW_NUMBER
) ? aLabel
.ShowNumber
: (
540 (nWhichId
== SCHATTR_DATADESCR_SHOW_PERCENTAGE
) ? aLabel
.ShowNumberInPercent
: (
541 (nWhichId
== SCHATTR_DATADESCR_SHOW_CATEGORY
) ? aLabel
.ShowCategoryName
: aLabel
.ShowLegendSymbol
));
543 rOutItemSet
.Put(SfxBoolItem(nWhichId
, bValue
));
547 if (DataSeriesHelper::hasAttributedDataPointDifferentValue(
548 Reference
<chart2::XDataSeries
>(GetPropertySet(), uno::UNO_QUERY
), CHART_UNONAME_LABEL
, uno::Any(aLabel
)))
550 rOutItemSet
.InvalidateItem(nWhichId
);
556 case SID_ATTR_NUMBERFORMAT_VALUE
:
559 if (!(GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT
) >>= nKey
))
560 nKey
= mnNumberFormat
;
561 rOutItemSet
.Put(SfxUInt32Item(nWhichId
, nKey
));
564 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE
:
567 if (!(GetPropertySet()->getPropertyValue("PercentageNumberFormat") >>= nKey
))
568 nKey
= mnPercentNumberFormat
;
569 rOutItemSet
.Put(SfxUInt32Item(nWhichId
, nKey
));
572 case SID_ATTR_NUMBERFORMAT_SOURCE
:
574 bool bUseSourceFormat
= false;
577 GetPropertySet()->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT
) >>= bUseSourceFormat
;
579 catch (const uno::Exception
&)
581 TOOLS_WARN_EXCEPTION("chart2", "");
583 bool bNumberFormatIsSet
= GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT
).hasValue() && !bUseSourceFormat
;
584 rOutItemSet
.Put(SfxBoolItem(nWhichId
, !bNumberFormatIsSet
));
587 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
:
589 bool bUseSourceFormat
= false;
592 GetPropertySet()->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT
) >>= bUseSourceFormat
;
594 catch (const uno::Exception
&)
596 TOOLS_WARN_EXCEPTION("chart2", "");
598 bool bNumberFormatIsSet
= GetPropertySet()->getPropertyValue("PercentageNumberFormat").hasValue() && !bUseSourceFormat
;
599 rOutItemSet
.Put(SfxBoolItem(nWhichId
, !bNumberFormatIsSet
));
602 case SCHATTR_DATADESCR_SEPARATOR
:
607 GetPropertySet()->getPropertyValue("LabelSeparator") >>= aValue
;
608 rOutItemSet
.Put(SfxStringItem(nWhichId
, aValue
));
610 catch (const uno::Exception
&)
612 TOOLS_WARN_EXCEPTION("chart2", "" );
616 case SCHATTR_DATADESCR_WRAP_TEXT
:
621 GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bValue
;
622 rOutItemSet
.Put( SfxBoolItem( nWhichId
, bValue
));
624 catch( const uno::Exception
& )
626 TOOLS_WARN_EXCEPTION("chart2", "" );
630 case SCHATTR_DATADESCR_PLACEMENT
:
634 sal_Int32 nPlacement
= 0;
635 RelativePosition aCustomLabelPosition
;
636 if (!mbDataSeries
&& (GetPropertySet()->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition
))
637 rOutItemSet
.Put(SfxInt32Item(nWhichId
, css::chart::DataLabelPlacement::CUSTOM
));
638 else if (GetPropertySet()->getPropertyValue("LabelPlacement") >>= nPlacement
)
639 rOutItemSet
.Put(SfxInt32Item(nWhichId
, nPlacement
));
640 else if (maAvailableLabelPlacements
.hasElements())
641 rOutItemSet
.Put(SfxInt32Item(nWhichId
, maAvailableLabelPlacements
[0]));
643 catch (const uno::Exception
&)
645 TOOLS_WARN_EXCEPTION("chart2", "" );
649 case SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS
:
651 rOutItemSet
.Put(SfxIntegerListItem(nWhichId
, maAvailableLabelPlacements
));
654 case SCHATTR_DATADESCR_NO_PERCENTVALUE
:
656 rOutItemSet
.Put(SfxBoolItem(nWhichId
, mbForbidPercentValue
));
659 case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES
:
664 Reference
<beans::XPropertySet
> xSeriesProp(m_xSeries
, uno::UNO_QUERY
);
665 if( xSeriesProp
->getPropertyValue( "ShowCustomLeaderLines" ) >>= bValue
)
666 rOutItemSet
.Put(SfxBoolItem(nWhichId
, bValue
));
668 catch (const uno::Exception
&)
670 TOOLS_WARN_EXCEPTION("chart2", "");
674 case SCHATTR_STYLE_SYMBOL
:
676 chart2::Symbol aSymbol
;
677 if (GetPropertySet()->getPropertyValue("Symbol") >>= aSymbol
)
678 rOutItemSet
.Put(SfxInt32Item(nWhichId
, getSymbolStyleForSymbol(aSymbol
)));
681 case SCHATTR_SYMBOL_SIZE
:
683 chart2::Symbol aSymbol
;
684 if (GetPropertySet()->getPropertyValue("Symbol") >>= aSymbol
)
686 SvxSizeItem(nWhichId
, Size(aSymbol
.Size
.Width
, aSymbol
.Size
.Height
)));
689 case SCHATTR_SYMBOL_BRUSH
:
691 chart2::Symbol aSymbol
;
692 if ((GetPropertySet()->getPropertyValue("Symbol") >>= aSymbol
)
693 && aSymbol
.Graphic
.is())
696 SvxBrushItem(Graphic(aSymbol
.Graphic
), GPOS_MM
, SCHATTR_SYMBOL_BRUSH
));
700 case SCHATTR_TEXT_DEGREES
:
704 if (GetPropertySet()->getPropertyValue("TextRotation") >>= fValue
)
707 SfxInt32Item(nWhichId
, static_cast<sal_Int32
>(rtl::math::round(fValue
* 100.0))));
716 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */