fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / itemsetwrapper / DataPointItemConverter.cxx
blob74ebe3b0c714245448eca9016200b76ef2ede79f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "macros.hxx"
23 #include "ItemPropertyMap.hxx"
25 #include "GraphicPropertyItemConverter.hxx"
26 #include "CharacterPropertyItemConverter.hxx"
27 #include "StatisticsItemConverter.hxx"
28 #include "SeriesOptionsItemConverter.hxx"
29 #include "DataSeriesHelper.hxx"
30 #include "DiagramHelper.hxx"
31 #include "ChartModelHelper.hxx"
32 #include "ChartTypeHelper.hxx"
33 #include <unonames.hxx>
35 #include <svx/chrtitem.hxx>
36 #include <com/sun/star/chart2/DataPointLabel.hpp>
37 #include <com/sun/star/chart2/Symbol.hpp>
39 #include <svx/xflclit.hxx>
40 #include <svl/intitem.hxx>
41 #include <editeng/sizeitem.hxx>
42 #include <svl/stritem.hxx>
43 #include <editeng/brushitem.hxx>
44 #include <svl/ilstitem.hxx>
45 #include <vcl/graph.hxx>
46 #include <com/sun/star/graphic/XGraphic.hpp>
48 #include <svx/tabline.hxx>
50 #include <functional>
51 #include <algorithm>
53 using namespace ::com::sun::star;
54 using namespace ::com::sun::star::chart2;
55 using ::com::sun::star::uno::Reference;
57 namespace chart { namespace wrapper {
59 namespace {
61 ItemPropertyMapType & lcl_GetDataPointPropertyMap()
63 static ItemPropertyMapType aDataPointPropertyMap(
64 MakeItemPropertyMap
65 IPM_MAP_ENTRY( SCHATTR_STYLE_SHAPE, "Geometry3D", 0 )
68 return aDataPointPropertyMap;
71 sal_Int32 lcl_getSymbolStyleForSymbol( const chart2::Symbol & rSymbol )
73 sal_Int32 nStyle = SVX_SYMBOLTYPE_UNKNOWN;
74 switch( rSymbol.Style )
76 case chart2::SymbolStyle_NONE:
77 nStyle = SVX_SYMBOLTYPE_NONE;
78 break;
79 case chart2::SymbolStyle_AUTO:
80 nStyle = SVX_SYMBOLTYPE_AUTO;
81 break;
82 case chart2::SymbolStyle_GRAPHIC:
83 nStyle = SVX_SYMBOLTYPE_BRUSHITEM;
84 break;
85 case chart2::SymbolStyle_STANDARD:
86 nStyle = rSymbol.StandardSymbol;
87 break;
89 case chart2::SymbolStyle_POLYGON:
90 // to avoid warning
91 case chart2::SymbolStyle_MAKE_FIXED_SIZE:
92 // nothing
93 break;
95 return nStyle;
98 bool lcl_NumberFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxItemSet & rItemSet, const uno::Reference< beans::XPropertySet > & xPropertySet, bool bOverwriteAttributedDataPointsAlso )
100 bool bChanged = false;
101 if( !xPropertySet.is() )
102 return bChanged;
103 OUString aPropertyName = (SID_ATTR_NUMBERFORMAT_VALUE==nWhichId) ? OUString(CHART_UNONAME_NUMFMT) : OUString( "PercentageNumberFormat" );
104 sal_uInt16 nSourceWhich = (SID_ATTR_NUMBERFORMAT_VALUE==nWhichId) ? SID_ATTR_NUMBERFORMAT_SOURCE : SCHATTR_PERCENT_NUMBERFORMAT_SOURCE;
106 if( SfxItemState::SET != rItemSet.GetItemState( nSourceWhich ) )
107 return bChanged;
109 uno::Any aValue;
110 bool bUseSourceFormat = (static_cast< const SfxBoolItem & >(
111 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());
120 aValue = uno::makeAny(nFmt);
122 else
123 return bChanged;
126 uno::Any aOldValue( xPropertySet->getPropertyValue(aPropertyName) );
127 if( bOverwriteAttributedDataPointsAlso )
129 Reference< chart2::XDataSeries > xSeries( xPropertySet, uno::UNO_QUERY);
130 if( aValue != aOldValue ||
131 ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, aPropertyName, aOldValue ) )
133 ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, aPropertyName, aValue );
134 bChanged = true;
137 else if( aOldValue != aValue )
139 xPropertySet->setPropertyValue(aPropertyName, aValue );
140 bChanged = true;
142 return bChanged;
145 bool lcl_UseSourceFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxItemSet & rItemSet, const uno::Reference< beans::XPropertySet > & xPropertySet, bool bOverwriteAttributedDataPointsAlso )
147 bool bChanged = false;
148 if( !xPropertySet.is() )
149 return bChanged;
150 OUString aPropertyName = (SID_ATTR_NUMBERFORMAT_SOURCE==nWhichId) ? OUString(CHART_UNONAME_NUMFMT) : OUString( "PercentageNumberFormat" );
151 sal_uInt16 nFormatWhich = (SID_ATTR_NUMBERFORMAT_SOURCE==nWhichId) ? SID_ATTR_NUMBERFORMAT_VALUE : SCHATTR_PERCENT_NUMBERFORMAT_VALUE;
153 if( SfxItemState::SET != rItemSet.GetItemState( nWhichId ) )
154 return bChanged;
156 uno::Any aNewValue;
157 bool bUseSourceFormat = (static_cast< const SfxBoolItem & >(
158 rItemSet.Get( nWhichId )).GetValue() );
159 if( !bUseSourceFormat )
161 SfxItemState aState = rItemSet.GetItemState( nFormatWhich );
162 if( aState == SfxItemState::SET )
164 sal_Int32 nFormatKey = static_cast< sal_Int32 >(
165 static_cast< const SfxUInt32Item & >(
166 rItemSet.Get( nFormatWhich )).GetValue());
167 aNewValue <<= nFormatKey;
169 else
170 return bChanged;
173 uno::Any aOldValue( xPropertySet->getPropertyValue(aPropertyName) );
174 if( bOverwriteAttributedDataPointsAlso )
176 Reference< chart2::XDataSeries > xSeries( xPropertySet, uno::UNO_QUERY);
177 if( aNewValue != aOldValue ||
178 ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, aPropertyName, aOldValue ) )
180 ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, aPropertyName, aNewValue );
181 bChanged = true;
184 else if( aOldValue != aNewValue )
186 xPropertySet->setPropertyValue( aPropertyName, aNewValue );
187 bChanged = true;
190 return bChanged;
193 } // anonymous namespace
195 DataPointItemConverter::DataPointItemConverter(
196 const uno::Reference< frame::XModel > & xChartModel,
197 const uno::Reference< uno::XComponentContext > & xContext,
198 const uno::Reference< beans::XPropertySet > & rPropertySet,
199 const uno::Reference< XDataSeries > & xSeries,
200 SfxItemPool& rItemPool,
201 SdrModel& rDrawModel,
202 const uno::Reference<lang::XMultiServiceFactory>& xNamedPropertyContainerFactory,
203 GraphicPropertyItemConverter::eGraphicObjectType eMapTo,
204 const awt::Size* pRefSize,
205 bool bDataSeries,
206 bool bUseSpecialFillColor,
207 sal_Int32 nSpecialFillColor,
208 bool bOverwriteLabelsForAttributedDataPointsAlso,
209 sal_Int32 nNumberFormat,
210 sal_Int32 nPercentNumberFormat ) :
211 ItemConverter( rPropertySet, rItemPool ),
212 m_bDataSeries( bDataSeries ),
213 m_bOverwriteLabelsForAttributedDataPointsAlso(m_bDataSeries && bOverwriteLabelsForAttributedDataPointsAlso),
214 m_bUseSpecialFillColor(bUseSpecialFillColor),
215 m_nSpecialFillColor(nSpecialFillColor),
216 m_nNumberFormat(nNumberFormat),
217 m_nPercentNumberFormat(nPercentNumberFormat),
218 m_aAvailableLabelPlacements(),
219 m_bForbidPercentValue(true)
221 m_aConverters.push_back( new GraphicPropertyItemConverter(
222 rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, eMapTo ));
223 m_aConverters.push_back( new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
224 if( bDataSeries )
226 m_aConverters.push_back( new StatisticsItemConverter( xChartModel, rPropertySet, rItemPool ));
227 m_aConverters.push_back( new SeriesOptionsItemConverter( xChartModel, xContext, rPropertySet, rItemPool ));
230 uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
231 uno::Reference< XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram , xSeries ) );
232 bool bFound = false;
233 bool bAmbiguous = false;
234 bool bSwapXAndY = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
235 m_aAvailableLabelPlacements = ChartTypeHelper::getSupportedLabelPlacements( xChartType, DiagramHelper::getDimension( xDiagram ), bSwapXAndY, xSeries );
237 m_bForbidPercentValue = AxisType::CATEGORY != ChartTypeHelper::getAxisType( xChartType, 0 );
240 DataPointItemConverter::~DataPointItemConverter()
242 ::std::for_each(m_aConverters.begin(), m_aConverters.end(), boost::checked_deleter<ItemConverter>());
245 void DataPointItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
247 ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
248 FillItemSetFunc( rOutItemSet ));
250 // own items
251 ItemConverter::FillItemSet( rOutItemSet );
253 if( m_bUseSpecialFillColor )
255 Color aColor(m_nSpecialFillColor);
256 rOutItemSet.Put( XFillColorItem( OUString(), aColor ) );
260 bool DataPointItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
262 bool bResult = false;
264 ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
265 ApplyItemSetFunc( rItemSet, bResult ));
267 // own items
268 return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
271 const sal_uInt16 * DataPointItemConverter::GetWhichPairs() const
273 // must span all used items!
274 if( m_bDataSeries )
275 return nRowWhichPairs;
276 return nDataPointWhichPairs;
279 bool DataPointItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
281 ItemPropertyMapType & rMap( lcl_GetDataPointPropertyMap());
282 ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
284 if( aIt == rMap.end())
285 return false;
287 rOutProperty =(*aIt).second;
288 return true;
291 bool DataPointItemConverter::ApplySpecialItem(
292 sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
293 throw( uno::Exception )
295 bool bChanged = false;
297 switch( nWhichId )
299 case SCHATTR_DATADESCR_SHOW_NUMBER:
300 case SCHATTR_DATADESCR_SHOW_PERCENTAGE:
301 case SCHATTR_DATADESCR_SHOW_CATEGORY:
302 case SCHATTR_DATADESCR_SHOW_SYMBOL:
304 const SfxBoolItem & rItem = static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId ));
306 uno::Any aOldValue = GetPropertySet()->getPropertyValue(CHART_UNONAME_LABEL);
307 chart2::DataPointLabel aLabel;
308 if( aOldValue >>= aLabel )
310 sal_Bool& rValue = (SCHATTR_DATADESCR_SHOW_NUMBER==nWhichId) ? aLabel.ShowNumber : (
311 (SCHATTR_DATADESCR_SHOW_PERCENTAGE==nWhichId) ? aLabel.ShowNumberInPercent : (
312 (SCHATTR_DATADESCR_SHOW_CATEGORY==nWhichId) ? aLabel.ShowCategoryName : aLabel.ShowLegendSymbol ));
313 bool bOldValue = rValue;
314 rValue = rItem.GetValue();
315 if( m_bOverwriteLabelsForAttributedDataPointsAlso )
317 Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
318 if( bOldValue != bool(rValue) ||
319 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, CHART_UNONAME_LABEL , aOldValue ) )
321 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, CHART_UNONAME_LABEL , uno::makeAny( aLabel ) );
322 bChanged = true;
325 else if( bOldValue != bool(rValue) )
327 GetPropertySet()->setPropertyValue(CHART_UNONAME_LABEL , uno::makeAny(aLabel));
328 bChanged = true;
332 break;
334 case SID_ATTR_NUMBERFORMAT_VALUE:
335 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE: //fall through intended
337 bChanged = lcl_NumberFormatFromItemToPropertySet( nWhichId, rItemSet, GetPropertySet(), m_bOverwriteLabelsForAttributedDataPointsAlso );
339 break;
341 case SID_ATTR_NUMBERFORMAT_SOURCE:
342 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE: //fall through intended
344 bChanged = lcl_UseSourceFormatFromItemToPropertySet( nWhichId, rItemSet, GetPropertySet(), m_bOverwriteLabelsForAttributedDataPointsAlso );
346 break;
348 case SCHATTR_DATADESCR_SEPARATOR:
350 OUString aNewValue = static_cast< const SfxStringItem & >( rItemSet.Get( nWhichId )).GetValue();
351 OUString aOldValue;
354 GetPropertySet()->getPropertyValue( "LabelSeparator" ) >>= aOldValue;
355 if( m_bOverwriteLabelsForAttributedDataPointsAlso )
357 Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
358 if( !aOldValue.equals(aNewValue) ||
359 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "LabelSeparator" , uno::makeAny( aOldValue ) ) )
361 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "LabelSeparator" , uno::makeAny( aNewValue ) );
362 bChanged = true;
365 else if( !aOldValue.equals(aNewValue) )
367 GetPropertySet()->setPropertyValue( "LabelSeparator" , uno::makeAny( aNewValue ));
368 bChanged = true;
371 catch( const uno::Exception& e )
373 ASSERT_EXCEPTION( e );
376 break;
378 case SCHATTR_DATADESCR_PLACEMENT:
383 sal_Int32 nNew = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
384 sal_Int32 nOld =0;
385 if( !(GetPropertySet()->getPropertyValue( "LabelPlacement" ) >>= nOld) )
387 if( m_aAvailableLabelPlacements.getLength() )
388 nOld = m_aAvailableLabelPlacements[0];
390 if( m_bOverwriteLabelsForAttributedDataPointsAlso )
392 Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
393 if( nOld!=nNew ||
394 DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "LabelPlacement" , uno::makeAny( nOld ) ) )
396 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "LabelPlacement" , uno::makeAny( nNew ) );
397 bChanged = true;
400 else if( nOld!=nNew )
402 GetPropertySet()->setPropertyValue( "LabelPlacement" , uno::makeAny( nNew ));
403 bChanged = true;
406 catch( const uno::Exception& e )
408 ASSERT_EXCEPTION( e );
411 break;
413 case SCHATTR_STYLE_SYMBOL:
415 sal_Int32 nStyle =
416 static_cast< const SfxInt32Item & >(
417 rItemSet.Get( nWhichId )).GetValue();
418 chart2::Symbol aSymbol;
420 GetPropertySet()->getPropertyValue( "Symbol" ) >>= aSymbol;
421 sal_Int32 nOldStyle = lcl_getSymbolStyleForSymbol( aSymbol );
423 if( nStyle != nOldStyle )
425 bool bDeleteSymbol = false;
426 switch( nStyle )
428 case SVX_SYMBOLTYPE_NONE:
429 aSymbol.Style = chart2::SymbolStyle_NONE;
430 break;
431 case SVX_SYMBOLTYPE_AUTO:
432 aSymbol.Style = chart2::SymbolStyle_AUTO;
433 break;
434 case SVX_SYMBOLTYPE_BRUSHITEM:
435 aSymbol.Style = chart2::SymbolStyle_GRAPHIC;
436 break;
437 case SVX_SYMBOLTYPE_UNKNOWN:
438 bDeleteSymbol = true;
439 break;
441 default:
442 aSymbol.Style = chart2::SymbolStyle_STANDARD;
443 aSymbol.StandardSymbol = nStyle;
446 if( bDeleteSymbol )
447 GetPropertySet()->setPropertyValue( "Symbol" , uno::Any());
448 else
449 GetPropertySet()->setPropertyValue( "Symbol" , uno::makeAny( aSymbol ));
450 bChanged = true;
453 break;
455 case SCHATTR_SYMBOL_SIZE:
457 Size aSize = static_cast< const SvxSizeItem & >(
458 rItemSet.Get( nWhichId )).GetSize();
459 chart2::Symbol aSymbol;
461 GetPropertySet()->getPropertyValue( "Symbol" ) >>= aSymbol;
462 if( aSize.getWidth() != aSymbol.Size.Width ||
463 aSize.getHeight() != aSymbol.Size.Height )
465 aSymbol.Size.Width = aSize.getWidth();
466 aSymbol.Size.Height = aSize.getHeight();
468 GetPropertySet()->setPropertyValue( "Symbol" , uno::makeAny( aSymbol ));
469 bChanged = true;
472 break;
474 case SCHATTR_SYMBOL_BRUSH:
476 const SvxBrushItem & rBrshItem( static_cast< const SvxBrushItem & >(
477 rItemSet.Get( nWhichId )));
478 uno::Any aXGraphicAny;
479 const Graphic *pGraphic( rBrshItem.GetGraphic());
480 if( pGraphic )
482 uno::Reference< graphic::XGraphic > xGraphic( pGraphic->GetXGraphic());
483 if( xGraphic.is())
485 aXGraphicAny <<= xGraphic;
486 chart2::Symbol aSymbol;
487 GetPropertySet()->getPropertyValue( "Symbol" ) >>= aSymbol;
488 if( aSymbol.Graphic != xGraphic )
490 aSymbol.Graphic = xGraphic;
491 GetPropertySet()->setPropertyValue( "Symbol" , uno::makeAny( aSymbol ));
492 bChanged = true;
497 break;
499 case SCHATTR_TEXT_DEGREES:
501 double fValue = static_cast< double >(
502 static_cast< const SfxInt32Item & >(
503 rItemSet.Get( nWhichId )).GetValue()) / 100.0;
504 double fOldValue = 0.0;
505 bool bPropExisted =
506 ( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldValue );
508 if( ! bPropExisted ||
509 ( bPropExisted && fOldValue != fValue ))
511 GetPropertySet()->setPropertyValue( "TextRotation" , uno::makeAny( fValue ));
512 bChanged = true;
515 break;
518 return bChanged;
521 void DataPointItemConverter::FillSpecialItem(
522 sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
523 throw( uno::Exception )
525 switch( nWhichId )
527 case SCHATTR_DATADESCR_SHOW_NUMBER:
528 case SCHATTR_DATADESCR_SHOW_PERCENTAGE:
529 case SCHATTR_DATADESCR_SHOW_CATEGORY:
530 case SCHATTR_DATADESCR_SHOW_SYMBOL:
532 chart2::DataPointLabel aLabel;
533 if (GetPropertySet()->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabel)
535 bool bValue = (SCHATTR_DATADESCR_SHOW_NUMBER==nWhichId) ? aLabel.ShowNumber : (
536 (SCHATTR_DATADESCR_SHOW_PERCENTAGE==nWhichId) ? aLabel.ShowNumberInPercent : (
537 (SCHATTR_DATADESCR_SHOW_CATEGORY==nWhichId) ? aLabel.ShowCategoryName : aLabel.ShowLegendSymbol ));
539 rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
541 if( m_bOverwriteLabelsForAttributedDataPointsAlso )
543 if( DataSeriesHelper::hasAttributedDataPointDifferentValue(
544 Reference< chart2::XDataSeries >( GetPropertySet(), uno::UNO_QUERY), CHART_UNONAME_LABEL , uno::makeAny(aLabel) ) )
546 rOutItemSet.InvalidateItem(nWhichId);
551 break;
553 case SID_ATTR_NUMBERFORMAT_VALUE:
555 sal_Int32 nKey = 0;
556 if (!(GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nKey))
557 nKey = m_nNumberFormat;
558 rOutItemSet.Put( SfxUInt32Item( nWhichId, nKey ));
560 break;
562 case SCHATTR_PERCENT_NUMBERFORMAT_VALUE:
564 sal_Int32 nKey = 0;
565 if( !(GetPropertySet()->getPropertyValue( "PercentageNumberFormat" ) >>= nKey) )
566 nKey = m_nPercentNumberFormat;
567 rOutItemSet.Put( SfxUInt32Item( nWhichId, nKey ));
569 break;
571 case SID_ATTR_NUMBERFORMAT_SOURCE:
573 bool bNumberFormatIsSet = GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue();
574 rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
576 break;
577 case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE:
579 bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( "PercentageNumberFormat" ).hasValue());
580 rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
582 break;
584 case SCHATTR_DATADESCR_SEPARATOR:
586 OUString aValue;
589 GetPropertySet()->getPropertyValue( "LabelSeparator" ) >>= aValue;
590 rOutItemSet.Put( SfxStringItem( nWhichId, aValue ));
592 catch( const uno::Exception& e )
594 ASSERT_EXCEPTION( e );
597 break;
599 case SCHATTR_DATADESCR_PLACEMENT:
603 sal_Int32 nPlacement=0;
604 if( GetPropertySet()->getPropertyValue( "LabelPlacement" ) >>= nPlacement )
605 rOutItemSet.Put( SfxInt32Item( nWhichId, nPlacement ));
606 else if( m_aAvailableLabelPlacements.getLength() )
607 rOutItemSet.Put( SfxInt32Item( nWhichId, m_aAvailableLabelPlacements[0] ));
609 catch( const uno::Exception& e )
611 ASSERT_EXCEPTION( e );
614 break;
616 case SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS:
618 rOutItemSet.Put( SfxIntegerListItem( nWhichId, m_aAvailableLabelPlacements ) );
620 break;
622 case SCHATTR_DATADESCR_NO_PERCENTVALUE:
624 rOutItemSet.Put( SfxBoolItem( nWhichId, m_bForbidPercentValue ));
626 break;
628 case SCHATTR_STYLE_SYMBOL:
630 chart2::Symbol aSymbol;
631 if( GetPropertySet()->getPropertyValue( "Symbol" ) >>= aSymbol )
632 rOutItemSet.Put( SfxInt32Item( nWhichId, lcl_getSymbolStyleForSymbol( aSymbol ) ));
634 break;
636 case SCHATTR_SYMBOL_SIZE:
638 chart2::Symbol aSymbol;
639 if( GetPropertySet()->getPropertyValue( "Symbol" ) >>= aSymbol )
640 rOutItemSet.Put(
641 SvxSizeItem( nWhichId, Size( aSymbol.Size.Width, aSymbol.Size.Height ) ));
643 break;
645 case SCHATTR_SYMBOL_BRUSH:
647 chart2::Symbol aSymbol;
648 if(( GetPropertySet()->getPropertyValue( "Symbol" ) >>= aSymbol )
649 && aSymbol.Graphic.is() )
651 rOutItemSet.Put( SvxBrushItem( Graphic( aSymbol.Graphic ), GPOS_MM, SCHATTR_SYMBOL_BRUSH ));
654 break;
656 case SCHATTR_TEXT_DEGREES:
658 double fValue = 0;
660 if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fValue )
662 rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
663 ::rtl::math::round( fValue * 100.0 ) ) ));
666 break;
672 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */