merge the formfield patch from ooo-build
[ooovba.git] / chart2 / source / controller / itemsetwrapper / DataPointItemConverter.cxx
bloba902a593f22ed97178f518993c5d915535c05287
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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"
35 #include "macros.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>
57 //SfxIntegerListItem
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>
67 #include <functional>
68 #include <algorithm>
70 using namespace ::com::sun::star;
71 using namespace ::com::sun::star::chart2;
72 using ::com::sun::star::uno::Reference;
74 namespace
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;
94 break;
95 case chart2::SymbolStyle_AUTO:
96 nStyle = SVX_SYMBOLTYPE_AUTO;
97 break;
98 case chart2::SymbolStyle_GRAPHIC:
99 nStyle = SVX_SYMBOLTYPE_BRUSHITEM;
100 break;
101 case chart2::SymbolStyle_STANDARD:
102 nStyle = rSymbol.StandardSymbol;
103 break;
105 case chart2::SymbolStyle_POLYGON:
106 // to avoid warning
107 case chart2::SymbolStyle_MAKE_FIXED_SIZE:
108 // nothing
109 break;
111 return nStyle;
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() )
118 return bChanged;
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 ) )
123 return bChanged;
125 uno::Any aValue;
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);
138 else
139 return bChanged;
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 );
150 bChanged = true;
153 else if( aOldValue != aValue )
155 xPropertySet->setPropertyValue(aPropertyName, aValue );
156 bChanged = true;
158 return bChanged;
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() )
165 return bChanged;
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 ) )
170 return bChanged;
172 uno::Any aNewValue;
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;
185 else
186 return bChanged;
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 );
197 bChanged = true;
200 else if( aOldValue != aNewValue )
202 xPropertySet->setPropertyValue( aPropertyName, aNewValue );
203 bChanged = true;
206 return bChanged;
209 } // anonymous namespace
211 namespace chart
213 namespace wrapper
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" )));
249 if( bDataSeries )
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 ) );
257 bool bFound = false;
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 ));
276 // own items
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 ));
293 // own items
294 return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
297 const USHORT * DataPointItemConverter::GetWhichPairs() const
299 // must span all used items!
300 if( m_bDataSeries )
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())
311 return false;
313 rOutProperty =(*aIt).second;
314 return true;
318 bool DataPointItemConverter::ApplySpecialItem(
319 USHORT nWhichId, const SfxItemSet & rItemSet )
320 throw( uno::Exception )
322 bool bChanged = false;
323 uno::Any aValue;
325 switch( nWhichId )
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 ) );
350 bChanged = true;
353 else if( bOldValue != rValue )
355 GetPropertySet()->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ));
356 bChanged = true;
360 break;
362 case SID_ATTR_NUMBERFORMAT_VALUE:
363 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE: //fall through intended
365 bChanged = lcl_NumberFormatFromItemToPropertySet( nWhichId, rItemSet, GetPropertySet(), m_bOverwriteLabelsForAttributedDataPointsAlso );
367 break;
369 case SID_ATTR_NUMBERFORMAT_SOURCE:
370 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE: //fall through intended
372 bChanged = lcl_UseSourceFormatFromItemToPropertySet( nWhichId, rItemSet, GetPropertySet(), m_bOverwriteLabelsForAttributedDataPointsAlso );
374 break;
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 ) );
390 bChanged = true;
393 else if( !aOldValue.equals(aNewValue) )
395 GetPropertySet()->setPropertyValue( C2U( "LabelSeparator" ), uno::makeAny( aNewValue ));
396 bChanged = true;
399 catch( uno::Exception& e )
401 ASSERT_EXCEPTION( e );
404 break;
406 case SCHATTR_DATADESCR_PLACEMENT:
411 sal_Int32 nNew = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
412 sal_Int32 nOld =0;
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);
421 if( nOld!=nNew ||
422 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, C2U( "LabelPlacement" ), uno::makeAny( nOld ) ) )
424 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "LabelPlacement" ), uno::makeAny( nNew ) );
425 bChanged = true;
428 else if( nOld!=nNew )
430 GetPropertySet()->setPropertyValue( C2U( "LabelPlacement" ), uno::makeAny( nNew ));
431 bChanged = true;
434 catch( uno::Exception& e )
436 ASSERT_EXCEPTION( e );
439 break;
441 case SCHATTR_STYLE_SYMBOL:
443 sal_Int32 nStyle =
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;
454 switch( nStyle )
456 case SVX_SYMBOLTYPE_NONE:
457 aSymbol.Style = chart2::SymbolStyle_NONE;
458 break;
459 case SVX_SYMBOLTYPE_AUTO:
460 aSymbol.Style = chart2::SymbolStyle_AUTO;
461 break;
462 case SVX_SYMBOLTYPE_BRUSHITEM:
463 aSymbol.Style = chart2::SymbolStyle_GRAPHIC;
464 break;
465 case SVX_SYMBOLTYPE_UNKNOWN:
466 bDeleteSymbol = true;
467 break;
469 default:
470 aSymbol.Style = chart2::SymbolStyle_STANDARD;
471 aSymbol.StandardSymbol = nStyle;
474 if( bDeleteSymbol )
475 GetPropertySet()->setPropertyValue( C2U( "Symbol" ), uno::Any());
476 else
477 GetPropertySet()->setPropertyValue( C2U( "Symbol" ),
478 uno::makeAny( aSymbol ));
479 bChanged = true;
482 break;
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 ));
498 bChanged = true;
501 break;
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());
509 if( pGraphic )
511 uno::Reference< graphic::XGraphic > xGraphic( pGraphic->GetXGraphic());
512 if( xGraphic.is())
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 ));
521 bChanged = true;
526 break;
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;
534 bool bPropExisted =
535 ( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fOldValue );
537 if( ! bPropExisted ||
538 ( bPropExisted && fOldValue != fValue ))
540 GetPropertySet()->setPropertyValue( C2U( "TextRotation" ), uno::makeAny( fValue ));
541 bChanged = true;
544 break;
547 return bChanged;
550 void DataPointItemConverter::FillSpecialItem(
551 USHORT nWhichId, SfxItemSet & rOutItemSet ) const
552 throw( uno::Exception )
554 switch( nWhichId )
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);
580 break;
582 case SID_ATTR_NUMBERFORMAT_VALUE:
584 sal_Int32 nKey = 0;
585 if( !(GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) >>= nKey) )
586 nKey = m_nNumberFormat;
587 rOutItemSet.Put( SfxUInt32Item( nWhichId, nKey ));
589 break;
591 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE:
593 sal_Int32 nKey = 0;
594 if( !(GetPropertySet()->getPropertyValue( C2U( "PercentageNumberFormat" )) >>= nKey) )
595 nKey = m_nPercentNumberFormat;
596 rOutItemSet.Put( SfxUInt32Item( nWhichId, nKey ));
598 break;
600 case SID_ATTR_NUMBERFORMAT_SOURCE:
602 bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )).hasValue());
603 rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
605 break;
606 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE:
608 bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "PercentageNumberFormat" )).hasValue());
609 rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
611 break;
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 );
626 break;
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 );
643 break;
645 case SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS:
647 SvULongs aList;
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 ) );
652 break;
654 case SCHATTR_DATADESCR_NO_PERCENTVALUE:
656 rOutItemSet.Put( SfxBoolItem( nWhichId, m_bForbidPercentValue ));
658 break;
660 case SCHATTR_STYLE_SYMBOL:
662 chart2::Symbol aSymbol;
663 if( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol )
664 rOutItemSet.Put( SfxInt32Item( nWhichId, lcl_getSymbolStyleForSymbol( aSymbol ) ));
666 break;
668 case SCHATTR_SYMBOL_SIZE:
670 chart2::Symbol aSymbol;
671 if( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol )
672 rOutItemSet.Put(
673 SvxSizeItem( nWhichId, Size( aSymbol.Size.Width, aSymbol.Size.Height ) ));
675 break;
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 ));
686 break;
688 case SCHATTR_TEXT_DEGREES:
690 double fValue = 0;
692 if( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fValue )
694 rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
695 ::rtl::math::round( fValue * 100.0 ) ) ));
698 break;
702 } // namespace wrapper
703 } // namespace chart