1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DataPointItemConverter.cxx,v $
10 * $Revision: 1.19.44.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
33 #include "DataPointItemConverter.hxx"
34 #include "SchWhichPairs.hxx"
36 #include "ItemPropertyMap.hxx"
38 #include "GraphicPropertyItemConverter.hxx"
39 #include "CharacterPropertyItemConverter.hxx"
40 #include "StatisticsItemConverter.hxx"
41 #include "SeriesOptionsItemConverter.hxx"
42 #include "DataSeriesHelper.hxx"
43 #include "DiagramHelper.hxx"
44 #include "ChartModelHelper.hxx"
45 #include "ChartTypeHelper.hxx"
46 #include <svx/chrtitem.hxx>
47 #include <com/sun/star/chart2/DataPointLabel.hpp>
48 #include <com/sun/star/chart2/Symbol.hpp>
50 // header for class XFillColorItem
51 #include <svx/xflclit.hxx>
52 #include <svtools/intitem.hxx>
53 #include <svx/sizeitem.hxx>
54 // header for class SfxStringItem
55 #include <svtools/stritem.hxx>
56 #include <svx/brshitem.hxx>
58 #include <svtools/ilstitem.hxx>
59 #define _SVSTDARR_ULONGS
60 #include <svtools/svstdarr.hxx>
61 #include <vcl/graph.hxx>
62 #include <com/sun/star/graphic/XGraphic.hpp>
64 // for SVX_SYMBOLTYPE_...
65 #include <svx/tabline.hxx>
70 using namespace ::com::sun::star
;
71 using namespace ::com::sun::star::chart2
;
72 using ::com::sun::star::uno::Reference
;
76 ::comphelper::ItemPropertyMapType
& lcl_GetDataPointPropertyMap()
78 static ::comphelper::ItemPropertyMapType
aDataPointPropertyMap(
79 ::comphelper::MakeItemPropertyMap
80 // IPM_MAP_ENTRY( CHATTR_PIE_SEGMENT_OFFSET, "Offset", 0 )
81 IPM_MAP_ENTRY( SCHATTR_STYLE_SHAPE
, "Geometry3D", 0 )
84 return aDataPointPropertyMap
;
87 sal_Int32
lcl_getSymbolStyleForSymbol( const chart2::Symbol
& rSymbol
)
89 sal_Int32 nStyle
= SVX_SYMBOLTYPE_UNKNOWN
;
90 switch( rSymbol
.Style
)
92 case chart2::SymbolStyle_NONE
:
93 nStyle
= SVX_SYMBOLTYPE_NONE
;
95 case chart2::SymbolStyle_AUTO
:
96 nStyle
= SVX_SYMBOLTYPE_AUTO
;
98 case chart2::SymbolStyle_GRAPHIC
:
99 nStyle
= SVX_SYMBOLTYPE_BRUSHITEM
;
101 case chart2::SymbolStyle_STANDARD
:
102 nStyle
= rSymbol
.StandardSymbol
;
105 case chart2::SymbolStyle_POLYGON
:
107 case chart2::SymbolStyle_MAKE_FIXED_SIZE
:
114 bool lcl_NumberFormatFromItemToPropertySet( USHORT nWhichId
, const SfxItemSet
& rItemSet
, const uno::Reference
< beans::XPropertySet
> & xPropertySet
, bool bOverwriteAttributedDataPointsAlso
)
116 bool bChanged
= false;
117 if( !xPropertySet
.is() )
119 rtl::OUString aPropertyName
= (SID_ATTR_NUMBERFORMAT_VALUE
==nWhichId
) ? C2U( "NumberFormat" ) : C2U( "PercentageNumberFormat" );
120 USHORT nSourceWhich
= (SID_ATTR_NUMBERFORMAT_VALUE
==nWhichId
) ? SID_ATTR_NUMBERFORMAT_SOURCE
: SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
;
122 if( SFX_ITEM_SET
!= rItemSet
.GetItemState( nSourceWhich
) )
126 bool bUseSourceFormat
= (static_cast< const SfxBoolItem
& >(
127 rItemSet
.Get( nSourceWhich
)).GetValue() );
128 if( !bUseSourceFormat
)
130 SfxItemState aState
= rItemSet
.GetItemState( nWhichId
);
131 if( aState
== SFX_ITEM_SET
)
133 sal_Int32 nFmt
= static_cast< sal_Int32
>(
134 static_cast< const SfxUInt32Item
& >(
135 rItemSet
.Get( nWhichId
)).GetValue());
136 aValue
= uno::makeAny(nFmt
);
142 uno::Any
aOldValue( xPropertySet
->getPropertyValue(aPropertyName
) );
143 if( bOverwriteAttributedDataPointsAlso
)
145 Reference
< chart2::XDataSeries
> xSeries( xPropertySet
, uno::UNO_QUERY
);
146 if( aValue
!= aOldValue
||
147 ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, aPropertyName
, aOldValue
) )
149 ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, aPropertyName
, aValue
);
153 else if( aOldValue
!= aValue
)
155 xPropertySet
->setPropertyValue(aPropertyName
, aValue
);
161 bool lcl_UseSourceFormatFromItemToPropertySet( USHORT nWhichId
, const SfxItemSet
& rItemSet
, const uno::Reference
< beans::XPropertySet
> & xPropertySet
, bool bOverwriteAttributedDataPointsAlso
)
163 bool bChanged
= false;
164 if( !xPropertySet
.is() )
166 rtl::OUString aPropertyName
= (SID_ATTR_NUMBERFORMAT_SOURCE
==nWhichId
) ? C2U( "NumberFormat" ) : C2U( "PercentageNumberFormat" );
167 USHORT nFormatWhich
= (SID_ATTR_NUMBERFORMAT_SOURCE
==nWhichId
) ? SID_ATTR_NUMBERFORMAT_VALUE
: SCHATTR_PERCENT_NUMBERFORMAT_VALUE
;
169 if( SFX_ITEM_SET
!= rItemSet
.GetItemState( nWhichId
) )
173 bool bUseSourceFormat
= (static_cast< const SfxBoolItem
& >(
174 rItemSet
.Get( nWhichId
)).GetValue() );
175 if( !bUseSourceFormat
)
177 SfxItemState aState
= rItemSet
.GetItemState( nFormatWhich
);
178 if( aState
== SFX_ITEM_SET
)
180 sal_Int32 nFormatKey
= static_cast< sal_Int32
>(
181 static_cast< const SfxUInt32Item
& >(
182 rItemSet
.Get( nFormatWhich
)).GetValue());
183 aNewValue
<<= nFormatKey
;
189 uno::Any
aOldValue( xPropertySet
->getPropertyValue(aPropertyName
) );
190 if( bOverwriteAttributedDataPointsAlso
)
192 Reference
< chart2::XDataSeries
> xSeries( xPropertySet
, uno::UNO_QUERY
);
193 if( aNewValue
!= aOldValue
||
194 ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, aPropertyName
, aOldValue
) )
196 ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, aPropertyName
, aNewValue
);
200 else if( aOldValue
!= aNewValue
)
202 xPropertySet
->setPropertyValue( aPropertyName
, aNewValue
);
209 } // anonymous namespace
216 DataPointItemConverter::DataPointItemConverter(
217 const uno::Reference
< frame::XModel
> & xChartModel
,
218 const uno::Reference
< uno::XComponentContext
> & xContext
,
219 const uno::Reference
< beans::XPropertySet
> & rPropertySet
,
220 const uno::Reference
< XDataSeries
> & xSeries
,
221 SfxItemPool
& rItemPool
,
222 SdrModel
& rDrawModel
,
223 NumberFormatterWrapper
* pNumFormatter
,
224 const uno::Reference
< lang::XMultiServiceFactory
> & xNamedPropertyContainerFactory
,
225 GraphicPropertyItemConverter::eGraphicObjectType eMapTo
/* = FILL_PROPERTIES */,
226 ::std::auto_ptr
< awt::Size
> pRefSize
/* = NULL */,
227 bool bDataSeries
/* = false */,
228 bool bUseSpecialFillColor
/* = false */,
229 sal_Int32 nSpecialFillColor
/* =0 */,
230 bool bOverwriteLabelsForAttributedDataPointsAlso
/*false*/,
231 sal_Int32 nNumberFormat
,
232 sal_Int32 nPercentNumberFormat
234 ItemConverter( rPropertySet
, rItemPool
),
235 m_pNumberFormatterWrapper( pNumFormatter
),
236 m_bDataSeries( bDataSeries
),
237 m_bOverwriteLabelsForAttributedDataPointsAlso(m_bDataSeries
&& bOverwriteLabelsForAttributedDataPointsAlso
),
238 m_bUseSpecialFillColor(bUseSpecialFillColor
),
239 m_nSpecialFillColor(nSpecialFillColor
),
240 m_nNumberFormat(nNumberFormat
),
241 m_nPercentNumberFormat(nPercentNumberFormat
),
242 m_aAvailableLabelPlacements(),
243 m_bForbidPercentValue(true)
245 m_aConverters
.push_back( new GraphicPropertyItemConverter(
246 rPropertySet
, rItemPool
, rDrawModel
, xNamedPropertyContainerFactory
, eMapTo
));
247 m_aConverters
.push_back( new CharacterPropertyItemConverter( rPropertySet
, rItemPool
, pRefSize
,
248 C2U( "ReferencePageSize" )));
251 m_aConverters
.push_back( new StatisticsItemConverter( xChartModel
, rPropertySet
, rItemPool
));
252 m_aConverters
.push_back( new SeriesOptionsItemConverter( xChartModel
, xContext
, rPropertySet
, rItemPool
));
255 uno::Reference
< XDiagram
> xDiagram( ChartModelHelper::findDiagram(xChartModel
) );
256 uno::Reference
< XChartType
> xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram
, xSeries
) );
258 bool bAmbiguous
= false;
259 sal_Bool bSwapXAndY
= DiagramHelper::getVertical( xDiagram
, bFound
, bAmbiguous
);
260 m_aAvailableLabelPlacements
= ChartTypeHelper::getSupportedLabelPlacements( xChartType
, DiagramHelper::getDimension( xDiagram
), bSwapXAndY
, xSeries
);
262 m_bForbidPercentValue
= AxisType::CATEGORY
!= ChartTypeHelper::getAxisType( xChartType
, 0 );
265 DataPointItemConverter::~DataPointItemConverter()
267 ::std::for_each( m_aConverters
.begin(), m_aConverters
.end(),
268 ::comphelper::DeleteItemConverterPtr() );
271 void DataPointItemConverter::FillItemSet( SfxItemSet
& rOutItemSet
) const
273 ::std::for_each( m_aConverters
.begin(), m_aConverters
.end(),
274 ::comphelper::FillItemSetFunc( rOutItemSet
));
277 ItemConverter::FillItemSet( rOutItemSet
);
279 if( m_bUseSpecialFillColor
)
281 Color
aColor(m_nSpecialFillColor
);
282 rOutItemSet
.Put( XFillColorItem( String(), aColor
) );
286 bool DataPointItemConverter::ApplyItemSet( const SfxItemSet
& rItemSet
)
288 bool bResult
= false;
290 ::std::for_each( m_aConverters
.begin(), m_aConverters
.end(),
291 ::comphelper::ApplyItemSetFunc( rItemSet
, bResult
));
294 return ItemConverter::ApplyItemSet( rItemSet
) || bResult
;
297 const USHORT
* DataPointItemConverter::GetWhichPairs() const
299 // must span all used items!
301 return nRowWhichPairs
;
302 return nDataPointWhichPairs
;
305 bool DataPointItemConverter::GetItemProperty( tWhichIdType nWhichId
, tPropertyNameWithMemberId
& rOutProperty
) const
307 ::comphelper::ItemPropertyMapType
& rMap( lcl_GetDataPointPropertyMap());
308 ::comphelper::ItemPropertyMapType::const_iterator
aIt( rMap
.find( nWhichId
));
310 if( aIt
== rMap
.end())
313 rOutProperty
=(*aIt
).second
;
318 bool DataPointItemConverter::ApplySpecialItem(
319 USHORT nWhichId
, const SfxItemSet
& rItemSet
)
320 throw( uno::Exception
)
322 bool bChanged
= false;
327 case SCHATTR_DATADESCR_SHOW_NUMBER
:
328 case SCHATTR_DATADESCR_SHOW_PERCENTAGE
:
329 case SCHATTR_DATADESCR_SHOW_CATEGORY
:
330 case SCHATTR_DATADESCR_SHOW_SYMBOL
:
332 const SfxBoolItem
& rItem
= static_cast< const SfxBoolItem
& >( rItemSet
.Get( nWhichId
));
334 uno::Any
aOldValue( GetPropertySet()->getPropertyValue( C2U( "Label" ) ));
335 chart2::DataPointLabel aLabel
;
336 if( aOldValue
>>= aLabel
)
338 sal_Bool
& rValue
= (SCHATTR_DATADESCR_SHOW_NUMBER
==nWhichId
) ? aLabel
.ShowNumber
: (
339 (SCHATTR_DATADESCR_SHOW_PERCENTAGE
==nWhichId
) ? aLabel
.ShowNumberInPercent
: (
340 (SCHATTR_DATADESCR_SHOW_CATEGORY
==nWhichId
) ? aLabel
.ShowCategoryName
: aLabel
.ShowLegendSymbol
));
341 sal_Bool bOldValue
= rValue
;
342 rValue
= static_cast< sal_Bool
>( rItem
.GetValue() );
343 if( m_bOverwriteLabelsForAttributedDataPointsAlso
)
345 Reference
< chart2::XDataSeries
> xSeries( GetPropertySet(), uno::UNO_QUERY
);
346 if( bOldValue
!= rValue
||
347 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, C2U( "Label" ), aOldValue
) )
349 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, C2U( "Label" ), uno::makeAny( aLabel
) );
353 else if( bOldValue
!= rValue
)
355 GetPropertySet()->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel
));
362 case SID_ATTR_NUMBERFORMAT_VALUE
:
363 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE
: //fall through intended
365 bChanged
= lcl_NumberFormatFromItemToPropertySet( nWhichId
, rItemSet
, GetPropertySet(), m_bOverwriteLabelsForAttributedDataPointsAlso
);
369 case SID_ATTR_NUMBERFORMAT_SOURCE
:
370 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
: //fall through intended
372 bChanged
= lcl_UseSourceFormatFromItemToPropertySet( nWhichId
, rItemSet
, GetPropertySet(), m_bOverwriteLabelsForAttributedDataPointsAlso
);
376 case SCHATTR_DATADESCR_SEPARATOR
:
378 rtl::OUString aNewValue
= static_cast< const SfxStringItem
& >( rItemSet
.Get( nWhichId
)).GetValue();
379 rtl::OUString aOldValue
;
382 GetPropertySet()->getPropertyValue( C2U( "LabelSeparator" ) ) >>= aOldValue
;
383 if( m_bOverwriteLabelsForAttributedDataPointsAlso
)
385 Reference
< chart2::XDataSeries
> xSeries( GetPropertySet(), uno::UNO_QUERY
);
386 if( !aOldValue
.equals(aNewValue
) ||
387 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, C2U( "LabelSeparator" ), uno::makeAny( aOldValue
) ) )
389 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, C2U( "LabelSeparator" ), uno::makeAny( aNewValue
) );
393 else if( !aOldValue
.equals(aNewValue
) )
395 GetPropertySet()->setPropertyValue( C2U( "LabelSeparator" ), uno::makeAny( aNewValue
));
399 catch( uno::Exception
& e
)
401 ASSERT_EXCEPTION( e
);
406 case SCHATTR_DATADESCR_PLACEMENT
:
411 sal_Int32 nNew
= static_cast< const SfxInt32Item
& >( rItemSet
.Get( nWhichId
)).GetValue();
413 if( !(GetPropertySet()->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nOld
) )
415 if( m_aAvailableLabelPlacements
.getLength() )
416 nOld
= m_aAvailableLabelPlacements
[0];
418 if( m_bOverwriteLabelsForAttributedDataPointsAlso
)
420 Reference
< chart2::XDataSeries
> xSeries( GetPropertySet(), uno::UNO_QUERY
);
422 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, C2U( "LabelPlacement" ), uno::makeAny( nOld
) ) )
424 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, C2U( "LabelPlacement" ), uno::makeAny( nNew
) );
428 else if( nOld
!=nNew
)
430 GetPropertySet()->setPropertyValue( C2U( "LabelPlacement" ), uno::makeAny( nNew
));
434 catch( uno::Exception
& e
)
436 ASSERT_EXCEPTION( e
);
441 case SCHATTR_STYLE_SYMBOL
:
444 static_cast< const SfxInt32Item
& >(
445 rItemSet
.Get( nWhichId
)).GetValue();
446 chart2::Symbol aSymbol
;
448 GetPropertySet()->getPropertyValue( C2U( "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( C2U( "Symbol" ), uno::Any());
477 GetPropertySet()->setPropertyValue( C2U( "Symbol" ),
478 uno::makeAny( aSymbol
));
484 case SCHATTR_SYMBOL_SIZE
:
486 Size aSize
= static_cast< const SvxSizeItem
& >(
487 rItemSet
.Get( nWhichId
)).GetSize();
488 chart2::Symbol aSymbol
;
490 GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol
;
491 if( aSize
.getWidth() != aSymbol
.Size
.Width
||
492 aSize
.getHeight() != aSymbol
.Size
.Height
)
494 aSymbol
.Size
.Width
= aSize
.getWidth();
495 aSymbol
.Size
.Height
= aSize
.getHeight();
497 GetPropertySet()->setPropertyValue( C2U( "Symbol" ), uno::makeAny( aSymbol
));
503 case SCHATTR_SYMBOL_BRUSH
:
505 const SvxBrushItem
& rBrshItem( static_cast< const SvxBrushItem
& >(
506 rItemSet
.Get( nWhichId
)));
507 uno::Any aXGraphicAny
;
508 const Graphic
*pGraphic( rBrshItem
.GetGraphic());
511 uno::Reference
< graphic::XGraphic
> xGraphic( pGraphic
->GetXGraphic());
514 aXGraphicAny
<<= xGraphic
;
515 chart2::Symbol aSymbol
;
516 GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol
;
517 if( aSymbol
.Graphic
!= xGraphic
)
519 aSymbol
.Graphic
= xGraphic
;
520 GetPropertySet()->setPropertyValue( C2U( "Symbol" ), uno::makeAny( aSymbol
));
528 case SCHATTR_TEXT_DEGREES
:
530 double fValue
= static_cast< double >(
531 static_cast< const SfxInt32Item
& >(
532 rItemSet
.Get( nWhichId
)).GetValue()) / 100.0;
533 double fOldValue
= 0.0;
535 ( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fOldValue
);
537 if( ! bPropExisted
||
538 ( bPropExisted
&& fOldValue
!= fValue
))
540 GetPropertySet()->setPropertyValue( C2U( "TextRotation" ), uno::makeAny( fValue
));
550 void DataPointItemConverter::FillSpecialItem(
551 USHORT nWhichId
, SfxItemSet
& rOutItemSet
) const
552 throw( uno::Exception
)
556 case SCHATTR_DATADESCR_SHOW_NUMBER
:
557 case SCHATTR_DATADESCR_SHOW_PERCENTAGE
:
558 case SCHATTR_DATADESCR_SHOW_CATEGORY
:
559 case SCHATTR_DATADESCR_SHOW_SYMBOL
:
561 chart2::DataPointLabel aLabel
;
562 if( GetPropertySet()->getPropertyValue( C2U( "Label" )) >>= aLabel
)
564 sal_Bool bValue
= (SCHATTR_DATADESCR_SHOW_NUMBER
==nWhichId
) ? aLabel
.ShowNumber
: (
565 (SCHATTR_DATADESCR_SHOW_PERCENTAGE
==nWhichId
) ? aLabel
.ShowNumberInPercent
: (
566 (SCHATTR_DATADESCR_SHOW_CATEGORY
==nWhichId
) ? aLabel
.ShowCategoryName
: aLabel
.ShowLegendSymbol
));
568 rOutItemSet
.Put( SfxBoolItem( nWhichId
, bValue
));
570 if( m_bOverwriteLabelsForAttributedDataPointsAlso
)
572 if( DataSeriesHelper::hasAttributedDataPointDifferentValue(
573 Reference
< chart2::XDataSeries
>( GetPropertySet(), uno::UNO_QUERY
), C2U( "Label" ), uno::makeAny(aLabel
) ) )
575 rOutItemSet
.InvalidateItem(nWhichId
);
582 case SID_ATTR_NUMBERFORMAT_VALUE
:
585 if( !(GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) >>= nKey
) )
586 nKey
= m_nNumberFormat
;
587 rOutItemSet
.Put( SfxUInt32Item( nWhichId
, nKey
));
591 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE
:
594 if( !(GetPropertySet()->getPropertyValue( C2U( "PercentageNumberFormat" )) >>= nKey
) )
595 nKey
= m_nPercentNumberFormat
;
596 rOutItemSet
.Put( SfxUInt32Item( nWhichId
, nKey
));
600 case SID_ATTR_NUMBERFORMAT_SOURCE
:
602 bool bNumberFormatIsSet
= ( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )).hasValue());
603 rOutItemSet
.Put( SfxBoolItem( nWhichId
, ! bNumberFormatIsSet
));
606 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
:
608 bool bNumberFormatIsSet
= ( GetPropertySet()->getPropertyValue( C2U( "PercentageNumberFormat" )).hasValue());
609 rOutItemSet
.Put( SfxBoolItem( nWhichId
, ! bNumberFormatIsSet
));
613 case SCHATTR_DATADESCR_SEPARATOR
:
615 rtl::OUString aValue
;
618 GetPropertySet()->getPropertyValue( C2U( "LabelSeparator" ) ) >>= aValue
;
619 rOutItemSet
.Put( SfxStringItem( nWhichId
, aValue
));
621 catch( uno::Exception
& e
)
623 ASSERT_EXCEPTION( e
);
628 case SCHATTR_DATADESCR_PLACEMENT
:
632 sal_Int32 nPlacement
=0;
633 if( GetPropertySet()->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nPlacement
)
634 rOutItemSet
.Put( SfxInt32Item( nWhichId
, nPlacement
));
635 else if( m_aAvailableLabelPlacements
.getLength() )
636 rOutItemSet
.Put( SfxInt32Item( nWhichId
, m_aAvailableLabelPlacements
[0] ));
638 catch( uno::Exception
& e
)
640 ASSERT_EXCEPTION( e
);
645 case SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS
:
648 for ( sal_Int32 nN
=0; nN
<m_aAvailableLabelPlacements
.getLength(); nN
++ )
649 aList
.Insert( m_aAvailableLabelPlacements
[nN
], sal::static_int_cast
< USHORT
>(nN
) );
650 rOutItemSet
.Put( SfxIntegerListItem( nWhichId
, aList
) );
654 case SCHATTR_DATADESCR_NO_PERCENTVALUE
:
656 rOutItemSet
.Put( SfxBoolItem( nWhichId
, m_bForbidPercentValue
));
660 case SCHATTR_STYLE_SYMBOL
:
662 chart2::Symbol aSymbol
;
663 if( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol
)
664 rOutItemSet
.Put( SfxInt32Item( nWhichId
, lcl_getSymbolStyleForSymbol( aSymbol
) ));
668 case SCHATTR_SYMBOL_SIZE
:
670 chart2::Symbol aSymbol
;
671 if( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol
)
673 SvxSizeItem( nWhichId
, Size( aSymbol
.Size
.Width
, aSymbol
.Size
.Height
) ));
677 case SCHATTR_SYMBOL_BRUSH
:
679 chart2::Symbol aSymbol
;
680 if(( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol
)
681 && aSymbol
.Graphic
.is() )
683 rOutItemSet
.Put( SvxBrushItem( Graphic( aSymbol
.Graphic
), GPOS_MM
, SCHATTR_SYMBOL_BRUSH
));
688 case SCHATTR_TEXT_DEGREES
:
692 if( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fValue
)
694 rOutItemSet
.Put( SfxInt32Item( nWhichId
, static_cast< sal_Int32
>(
695 ::rtl::math::round( fValue
* 100.0 ) ) ));
702 } // namespace wrapper