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 <DataPointItemConverter.hxx>
21 #include "SchWhichPairs.hxx"
22 #include <ItemPropertyMap.hxx>
24 #include <GraphicPropertyItemConverter.hxx>
25 #include <CharacterPropertyItemConverter.hxx>
26 #include <StatisticsItemConverter.hxx>
27 #include <SeriesOptionsItemConverter.hxx>
28 #include <DataSeriesHelper.hxx>
29 #include <DiagramHelper.hxx>
30 #include <ChartModelHelper.hxx>
31 #include <ChartTypeHelper.hxx>
32 #include <unonames.hxx>
34 #include <com/sun/star/chart2/AxisType.hpp>
35 #include <com/sun/star/chart2/DataPointLabel.hpp>
36 #include <com/sun/star/chart2/Symbol.hpp>
37 #include <com/sun/star/beans/XPropertySet.hpp>
39 #include <sal/log.hxx>
40 #include <svx/xflclit.hxx>
41 #include <svl/eitem.hxx>
42 #include <svl/intitem.hxx>
43 #include <editeng/sizeitem.hxx>
44 #include <svl/stritem.hxx>
45 #include <editeng/brushitem.hxx>
46 #include <svl/ilstitem.hxx>
47 #include <tools/diagnose_ex.h>
48 #include <vcl/graph.hxx>
50 #include <svx/tabline.hxx>
54 using namespace ::com::sun::star
;
55 using namespace ::com::sun::star::chart2
;
56 using ::com::sun::star::uno::Reference
;
58 namespace chart
{ namespace wrapper
{
62 ItemPropertyMapType
& lcl_GetDataPointPropertyMap()
64 static ItemPropertyMapType aDataPointPropertyMap
{
65 {SCHATTR_STYLE_SHAPE
, {"Geometry3D", 0}}};
66 return aDataPointPropertyMap
;
69 sal_Int32
lcl_getSymbolStyleForSymbol( const chart2::Symbol
& rSymbol
)
71 sal_Int32 nStyle
= SVX_SYMBOLTYPE_UNKNOWN
;
72 switch( rSymbol
.Style
)
74 case chart2::SymbolStyle_NONE
:
75 nStyle
= SVX_SYMBOLTYPE_NONE
;
77 case chart2::SymbolStyle_AUTO
:
78 nStyle
= SVX_SYMBOLTYPE_AUTO
;
80 case chart2::SymbolStyle_GRAPHIC
:
81 nStyle
= SVX_SYMBOLTYPE_BRUSHITEM
;
83 case chart2::SymbolStyle_STANDARD
:
84 nStyle
= rSymbol
.StandardSymbol
;
87 case chart2::SymbolStyle_POLYGON
:
89 case chart2::SymbolStyle::SymbolStyle_MAKE_FIXED_SIZE
:
96 bool lcl_NumberFormatFromItemToPropertySet( sal_uInt16 nWhichId
, const SfxItemSet
& rItemSet
, const uno::Reference
< beans::XPropertySet
> & xPropertySet
, bool bOverwriteAttributedDataPointsAlso
)
98 bool bChanged
= false;
99 if( !xPropertySet
.is() )
101 OUString aPropertyName
= (nWhichId
==SID_ATTR_NUMBERFORMAT_VALUE
) ? OUString(CHART_UNONAME_NUMFMT
) : OUString( "PercentageNumberFormat" );
102 sal_uInt16 nSourceWhich
= (nWhichId
==SID_ATTR_NUMBERFORMAT_VALUE
) ? SID_ATTR_NUMBERFORMAT_SOURCE
: SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
;
104 if( rItemSet
.GetItemState( nSourceWhich
) != SfxItemState::SET
)
108 bool bUseSourceFormat
= static_cast< const SfxBoolItem
& >(
109 rItemSet
.Get( nSourceWhich
)).GetValue();
110 if( !bUseSourceFormat
)
112 SfxItemState aState
= rItemSet
.GetItemState( nWhichId
);
113 if( aState
== SfxItemState::SET
)
115 sal_Int32 nFmt
= static_cast< sal_Int32
>(
116 static_cast< const SfxUInt32Item
& >(
117 rItemSet
.Get( nWhichId
)).GetValue());
124 uno::Any
aOldValue( xPropertySet
->getPropertyValue(aPropertyName
) );
125 if( bOverwriteAttributedDataPointsAlso
)
127 Reference
< chart2::XDataSeries
> xSeries( xPropertySet
, uno::UNO_QUERY
);
128 if( aValue
!= aOldValue
||
129 ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, aPropertyName
, aOldValue
) )
131 ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, aPropertyName
, aValue
);
135 else if( aOldValue
!= aValue
)
137 xPropertySet
->setPropertyValue(aPropertyName
, aValue
);
143 bool lcl_UseSourceFormatFromItemToPropertySet( sal_uInt16 nWhichId
, const SfxItemSet
& rItemSet
, const uno::Reference
< beans::XPropertySet
> & xPropertySet
, bool bOverwriteAttributedDataPointsAlso
)
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( bOverwriteAttributedDataPointsAlso
)
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 DataPointItemConverter::DataPointItemConverter(
195 const uno::Reference
< frame::XModel
> & xChartModel
,
196 const uno::Reference
< uno::XComponentContext
> & xContext
,
197 const uno::Reference
< beans::XPropertySet
> & rPropertySet
,
198 const uno::Reference
< XDataSeries
> & xSeries
,
199 SfxItemPool
& rItemPool
,
200 SdrModel
& rDrawModel
,
201 const uno::Reference
<lang::XMultiServiceFactory
>& xNamedPropertyContainerFactory
,
202 GraphicObjectType eMapTo
,
203 const awt::Size
* pRefSize
,
205 bool bUseSpecialFillColor
,
206 sal_Int32 nSpecialFillColor
,
207 bool bOverwriteLabelsForAttributedDataPointsAlso
,
208 sal_Int32 nNumberFormat
,
209 sal_Int32 nPercentNumberFormat
) :
210 ItemConverter( rPropertySet
, rItemPool
),
211 m_bDataSeries( bDataSeries
),
212 m_bOverwriteLabelsForAttributedDataPointsAlso(m_bDataSeries
&& bOverwriteLabelsForAttributedDataPointsAlso
),
213 m_bUseSpecialFillColor(bUseSpecialFillColor
),
214 m_nSpecialFillColor(nSpecialFillColor
),
215 m_nNumberFormat(nNumberFormat
),
216 m_nPercentNumberFormat(nPercentNumberFormat
),
217 m_aAvailableLabelPlacements(),
218 m_bForbidPercentValue(true)
220 m_aConverters
.emplace_back( new GraphicPropertyItemConverter(
221 rPropertySet
, rItemPool
, rDrawModel
, xNamedPropertyContainerFactory
, eMapTo
));
222 m_aConverters
.emplace_back( new CharacterPropertyItemConverter(rPropertySet
, rItemPool
, pRefSize
, "ReferencePageSize"));
225 m_aConverters
.emplace_back( new StatisticsItemConverter( xChartModel
, rPropertySet
, rItemPool
));
226 m_aConverters
.emplace_back( new SeriesOptionsItemConverter( xChartModel
, xContext
, rPropertySet
, rItemPool
));
229 uno::Reference
< XDiagram
> xDiagram( ChartModelHelper::findDiagram(xChartModel
) );
230 uno::Reference
< XChartType
> xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram
, xSeries
) );
232 bool bAmbiguous
= false;
233 bool bSwapXAndY
= DiagramHelper::getVertical( xDiagram
, bFound
, bAmbiguous
);
234 m_aAvailableLabelPlacements
= ChartTypeHelper::getSupportedLabelPlacements( xChartType
, bSwapXAndY
, xSeries
);
236 m_bForbidPercentValue
= ChartTypeHelper::getAxisType( xChartType
, 0 ) != AxisType::CATEGORY
;
239 DataPointItemConverter::~DataPointItemConverter()
243 void DataPointItemConverter::FillItemSet( SfxItemSet
& rOutItemSet
) const
245 for( const auto& pConv
: m_aConverters
)
246 pConv
->FillItemSet( rOutItemSet
);
249 ItemConverter::FillItemSet( rOutItemSet
);
251 if( m_bUseSpecialFillColor
)
253 Color
aColor(m_nSpecialFillColor
);
254 rOutItemSet
.Put( XFillColorItem( OUString(), aColor
) );
258 bool DataPointItemConverter::ApplyItemSet( const SfxItemSet
& rItemSet
)
260 bool bResult
= false;
262 for( const auto& pConv
: m_aConverters
)
263 bResult
= pConv
->ApplyItemSet( rItemSet
) || bResult
;
266 return ItemConverter::ApplyItemSet( rItemSet
) || bResult
;
269 const sal_uInt16
* DataPointItemConverter::GetWhichPairs() const
271 // must span all used items!
273 return nRowWhichPairs
;
274 return nDataPointWhichPairs
;
277 bool DataPointItemConverter::GetItemProperty( tWhichIdType nWhichId
, tPropertyNameWithMemberId
& rOutProperty
) const
279 ItemPropertyMapType
& rMap( lcl_GetDataPointPropertyMap());
280 ItemPropertyMapType::const_iterator
aIt( rMap
.find( nWhichId
));
282 if( aIt
== rMap
.end())
285 rOutProperty
=(*aIt
).second
;
289 bool DataPointItemConverter::ApplySpecialItem(
290 sal_uInt16 nWhichId
, const SfxItemSet
& rItemSet
)
292 bool bChanged
= false;
296 case SCHATTR_DATADESCR_SHOW_NUMBER
:
297 case SCHATTR_DATADESCR_SHOW_PERCENTAGE
:
298 case SCHATTR_DATADESCR_SHOW_CATEGORY
:
299 case SCHATTR_DATADESCR_SHOW_SYMBOL
:
301 const SfxBoolItem
& rItem
= static_cast< const SfxBoolItem
& >( rItemSet
.Get( nWhichId
));
303 uno::Any aOldValue
= GetPropertySet()->getPropertyValue(CHART_UNONAME_LABEL
);
304 chart2::DataPointLabel aLabel
;
305 if( aOldValue
>>= aLabel
)
307 sal_Bool
& rValue
= (nWhichId
==SCHATTR_DATADESCR_SHOW_NUMBER
) ? aLabel
.ShowNumber
: (
308 (nWhichId
==SCHATTR_DATADESCR_SHOW_PERCENTAGE
) ? aLabel
.ShowNumberInPercent
: (
309 (nWhichId
==SCHATTR_DATADESCR_SHOW_CATEGORY
) ? aLabel
.ShowCategoryName
: aLabel
.ShowLegendSymbol
));
310 bool bOldValue
= rValue
;
311 rValue
= rItem
.GetValue();
312 if( m_bOverwriteLabelsForAttributedDataPointsAlso
)
314 Reference
< chart2::XDataSeries
> xSeries( GetPropertySet(), uno::UNO_QUERY
);
315 if( bOldValue
!= bool(rValue
) ||
316 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, CHART_UNONAME_LABEL
, aOldValue
) )
318 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, CHART_UNONAME_LABEL
, uno::Any( aLabel
) );
322 else if( bOldValue
!= bool(rValue
) )
324 GetPropertySet()->setPropertyValue(CHART_UNONAME_LABEL
, uno::Any(aLabel
));
331 case SID_ATTR_NUMBERFORMAT_VALUE
:
332 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE
: //fall through intended
334 bChanged
= lcl_NumberFormatFromItemToPropertySet( nWhichId
, rItemSet
, GetPropertySet(), m_bOverwriteLabelsForAttributedDataPointsAlso
);
338 case SID_ATTR_NUMBERFORMAT_SOURCE
:
339 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
: //fall through intended
341 bChanged
= lcl_UseSourceFormatFromItemToPropertySet( nWhichId
, rItemSet
, GetPropertySet(), m_bOverwriteLabelsForAttributedDataPointsAlso
);
345 case SCHATTR_DATADESCR_SEPARATOR
:
347 OUString aNewValue
= static_cast< const SfxStringItem
& >( rItemSet
.Get( nWhichId
)).GetValue();
351 GetPropertySet()->getPropertyValue( "LabelSeparator" ) >>= aOldValue
;
352 if( m_bOverwriteLabelsForAttributedDataPointsAlso
)
354 Reference
< chart2::XDataSeries
> xSeries( GetPropertySet(), uno::UNO_QUERY
);
355 if( aOldValue
!= aNewValue
||
356 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, "LabelSeparator" , uno::Any( aOldValue
) ) )
358 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, "LabelSeparator" , uno::Any( aNewValue
) );
362 else if( aOldValue
!= aNewValue
)
364 GetPropertySet()->setPropertyValue( "LabelSeparator" , uno::Any( aNewValue
));
368 catch( const uno::Exception
& )
370 TOOLS_WARN_EXCEPTION("chart2", "" );
375 case SCHATTR_DATADESCR_WRAP_TEXT
:
380 bool bNew
= static_cast< const SfxBoolItem
& >( rItemSet
.Get( nWhichId
)).GetValue();
382 GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bOld
;
383 if( m_bOverwriteLabelsForAttributedDataPointsAlso
)
385 Reference
< chart2::XDataSeries
> xSeries( GetPropertySet(), uno::UNO_QUERY
);
387 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, "TextWordWrap", uno::Any( bOld
) ) )
389 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, "TextWordWrap", uno::Any( bNew
) );
393 else if( bOld
!=bNew
)
395 GetPropertySet()->setPropertyValue( "TextWordWrap", uno::Any( bNew
));
399 catch( const uno::Exception
& )
401 TOOLS_WARN_EXCEPTION("chart2", "" );
406 case SCHATTR_DATADESCR_PLACEMENT
:
411 sal_Int32 nNew
= static_cast< const SfxInt32Item
& >( rItemSet
.Get( nWhichId
)).GetValue();
413 if( !(GetPropertySet()->getPropertyValue( "LabelPlacement" ) >>= nOld
) )
415 if( m_aAvailableLabelPlacements
.hasElements() )
416 nOld
= m_aAvailableLabelPlacements
[0];
418 if( m_bOverwriteLabelsForAttributedDataPointsAlso
)
420 Reference
< chart2::XDataSeries
> xSeries( GetPropertySet(), uno::UNO_QUERY
);
422 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, "LabelPlacement" , uno::Any( nOld
) ) )
424 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, "LabelPlacement" , uno::Any( nNew
) );
428 else if( nOld
!=nNew
)
430 GetPropertySet()->setPropertyValue( "LabelPlacement" , uno::Any( nNew
));
434 catch( const uno::Exception
& )
436 TOOLS_WARN_EXCEPTION("chart2", "" );
441 case SCHATTR_STYLE_SYMBOL
:
444 static_cast< const SfxInt32Item
& >(
445 rItemSet
.Get( nWhichId
)).GetValue();
446 chart2::Symbol aSymbol
;
448 GetPropertySet()->getPropertyValue( "Symbol" ) >>= aSymbol
;
449 sal_Int32 nOldStyle
= lcl_getSymbolStyleForSymbol( aSymbol
);
451 if( nStyle
!= nOldStyle
)
453 bool bDeleteSymbol
= false;
456 case SVX_SYMBOLTYPE_NONE
:
457 aSymbol
.Style
= chart2::SymbolStyle_NONE
;
459 case SVX_SYMBOLTYPE_AUTO
:
460 aSymbol
.Style
= chart2::SymbolStyle_AUTO
;
462 case SVX_SYMBOLTYPE_BRUSHITEM
:
463 aSymbol
.Style
= chart2::SymbolStyle_GRAPHIC
;
465 case SVX_SYMBOLTYPE_UNKNOWN
:
466 bDeleteSymbol
= true;
470 aSymbol
.Style
= chart2::SymbolStyle_STANDARD
;
471 aSymbol
.StandardSymbol
= nStyle
;
475 GetPropertySet()->setPropertyValue( "Symbol" , uno::Any());
477 GetPropertySet()->setPropertyValue( "Symbol" , uno::Any( aSymbol
));
483 case SCHATTR_SYMBOL_SIZE
:
485 Size aSize
= static_cast< const SvxSizeItem
& >(
486 rItemSet
.Get( nWhichId
)).GetSize();
487 chart2::Symbol aSymbol
;
489 GetPropertySet()->getPropertyValue( "Symbol" ) >>= aSymbol
;
490 if( aSize
.getWidth() != aSymbol
.Size
.Width
||
491 aSize
.getHeight() != aSymbol
.Size
.Height
)
493 aSymbol
.Size
.Width
= aSize
.getWidth();
494 aSymbol
.Size
.Height
= aSize
.getHeight();
496 GetPropertySet()->setPropertyValue( "Symbol" , uno::Any( aSymbol
));
502 case SCHATTR_SYMBOL_BRUSH
:
504 const SvxBrushItem
& rBrshItem( static_cast< const SvxBrushItem
& >(
505 rItemSet
.Get( nWhichId
)));
506 uno::Any aXGraphicAny
;
507 const Graphic
*pGraphic( rBrshItem
.GetGraphic());
510 uno::Reference
< graphic::XGraphic
> xGraphic( pGraphic
->GetXGraphic());
513 aXGraphicAny
<<= xGraphic
;
514 chart2::Symbol aSymbol
;
515 GetPropertySet()->getPropertyValue( "Symbol" ) >>= aSymbol
;
516 if( aSymbol
.Graphic
!= xGraphic
)
518 aSymbol
.Graphic
= xGraphic
;
519 GetPropertySet()->setPropertyValue( "Symbol" , uno::Any( aSymbol
));
527 case SCHATTR_TEXT_DEGREES
:
529 double fValue
= static_cast< double >(
530 static_cast< const SfxInt32Item
& >(
531 rItemSet
.Get( nWhichId
)).GetValue()) / 100.0;
532 double fOldValue
= 0.0;
534 ( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldValue
);
536 if( ! bPropExisted
|| fOldValue
!= fValue
)
538 GetPropertySet()->setPropertyValue( "TextRotation" , uno::Any( fValue
));
548 void DataPointItemConverter::FillSpecialItem(
549 sal_uInt16 nWhichId
, SfxItemSet
& rOutItemSet
) const
553 case SCHATTR_DATADESCR_SHOW_NUMBER
:
554 case SCHATTR_DATADESCR_SHOW_PERCENTAGE
:
555 case SCHATTR_DATADESCR_SHOW_CATEGORY
:
556 case SCHATTR_DATADESCR_SHOW_SYMBOL
:
558 chart2::DataPointLabel aLabel
;
559 if (GetPropertySet()->getPropertyValue(CHART_UNONAME_LABEL
) >>= aLabel
)
561 bool bValue
= (nWhichId
==SCHATTR_DATADESCR_SHOW_NUMBER
) ? aLabel
.ShowNumber
: (
562 (nWhichId
==SCHATTR_DATADESCR_SHOW_PERCENTAGE
) ? aLabel
.ShowNumberInPercent
: (
563 (nWhichId
==SCHATTR_DATADESCR_SHOW_CATEGORY
) ? aLabel
.ShowCategoryName
: aLabel
.ShowLegendSymbol
));
565 rOutItemSet
.Put( SfxBoolItem( nWhichId
, bValue
));
567 if( m_bOverwriteLabelsForAttributedDataPointsAlso
)
569 if( DataSeriesHelper::hasAttributedDataPointDifferentValue(
570 Reference
< chart2::XDataSeries
>( GetPropertySet(), uno::UNO_QUERY
), CHART_UNONAME_LABEL
, uno::Any(aLabel
) ) )
572 rOutItemSet
.InvalidateItem(nWhichId
);
579 case SID_ATTR_NUMBERFORMAT_VALUE
:
582 if (!(GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT
) >>= nKey
))
583 nKey
= m_nNumberFormat
;
584 rOutItemSet
.Put( SfxUInt32Item( nWhichId
, nKey
));
588 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE
:
591 if( !(GetPropertySet()->getPropertyValue( "PercentageNumberFormat" ) >>= nKey
) )
592 nKey
= m_nPercentNumberFormat
;
593 rOutItemSet
.Put( SfxUInt32Item( nWhichId
, nKey
));
597 case SID_ATTR_NUMBERFORMAT_SOURCE
:
599 bool bNumberFormatIsSet
= GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT
).hasValue();
600 rOutItemSet
.Put( SfxBoolItem( nWhichId
, ! bNumberFormatIsSet
));
603 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
:
605 bool bNumberFormatIsSet
= GetPropertySet()->getPropertyValue( "PercentageNumberFormat" ).hasValue();
606 rOutItemSet
.Put( SfxBoolItem( nWhichId
, ! bNumberFormatIsSet
));
610 case SCHATTR_DATADESCR_SEPARATOR
:
615 GetPropertySet()->getPropertyValue( "LabelSeparator" ) >>= aValue
;
616 rOutItemSet
.Put( SfxStringItem( nWhichId
, aValue
));
618 catch( const uno::Exception
& )
620 TOOLS_WARN_EXCEPTION("chart2", "" );
625 case SCHATTR_DATADESCR_WRAP_TEXT
:
630 GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bValue
;
631 rOutItemSet
.Put( SfxBoolItem( nWhichId
, bValue
));
633 catch( const uno::Exception
& )
635 TOOLS_WARN_EXCEPTION("chart2", "" );
640 case SCHATTR_DATADESCR_PLACEMENT
:
644 sal_Int32 nPlacement
=0;
645 if( GetPropertySet()->getPropertyValue( "LabelPlacement" ) >>= nPlacement
)
646 rOutItemSet
.Put( SfxInt32Item( nWhichId
, nPlacement
));
647 else if( m_aAvailableLabelPlacements
.hasElements() )
648 rOutItemSet
.Put( SfxInt32Item( nWhichId
, m_aAvailableLabelPlacements
[0] ));
650 catch( const uno::Exception
& )
652 TOOLS_WARN_EXCEPTION("chart2", "" );
657 case SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS
:
659 rOutItemSet
.Put( SfxIntegerListItem( nWhichId
, m_aAvailableLabelPlacements
) );
663 case SCHATTR_DATADESCR_NO_PERCENTVALUE
:
665 rOutItemSet
.Put( SfxBoolItem( nWhichId
, m_bForbidPercentValue
));
669 case SCHATTR_STYLE_SYMBOL
:
671 chart2::Symbol aSymbol
;
672 if( GetPropertySet()->getPropertyValue( "Symbol" ) >>= aSymbol
)
673 rOutItemSet
.Put( SfxInt32Item( nWhichId
, lcl_getSymbolStyleForSymbol( aSymbol
) ));
677 case SCHATTR_SYMBOL_SIZE
:
679 chart2::Symbol aSymbol
;
680 if( GetPropertySet()->getPropertyValue( "Symbol" ) >>= aSymbol
)
682 SvxSizeItem( nWhichId
, Size( aSymbol
.Size
.Width
, aSymbol
.Size
.Height
) ));
686 case SCHATTR_SYMBOL_BRUSH
:
688 chart2::Symbol aSymbol
;
689 if(( GetPropertySet()->getPropertyValue( "Symbol" ) >>= aSymbol
)
690 && aSymbol
.Graphic
.is() )
692 rOutItemSet
.Put( SvxBrushItem( Graphic( aSymbol
.Graphic
), GPOS_MM
, SCHATTR_SYMBOL_BRUSH
));
697 case SCHATTR_TEXT_DEGREES
:
701 if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fValue
)
703 rOutItemSet
.Put( SfxInt32Item( nWhichId
, static_cast< sal_Int32
>(
704 ::rtl::math::round( fValue
* 100.0 ) ) ));
713 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */