1*cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*cde9e8dcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*cde9e8dcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*cde9e8dcSAndrew Rist  * distributed with this work for additional information
6*cde9e8dcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*cde9e8dcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*cde9e8dcSAndrew Rist  * "License"); you may not use this file except in compliance
9*cde9e8dcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*cde9e8dcSAndrew Rist  *
11*cde9e8dcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*cde9e8dcSAndrew Rist  *
13*cde9e8dcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*cde9e8dcSAndrew Rist  * software distributed under the License is distributed on an
15*cde9e8dcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*cde9e8dcSAndrew Rist  * KIND, either express or implied.  See the License for the
17*cde9e8dcSAndrew Rist  * specific language governing permissions and limitations
18*cde9e8dcSAndrew Rist  * under the License.
19*cde9e8dcSAndrew Rist  *
20*cde9e8dcSAndrew Rist  *************************************************************/
21*cde9e8dcSAndrew Rist 
22*cde9e8dcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir #include "DataPointItemConverter.hxx"
27cdf0e10cSrcweir #include "SchWhichPairs.hxx"
28cdf0e10cSrcweir #include "macros.hxx"
29cdf0e10cSrcweir #include "ItemPropertyMap.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "GraphicPropertyItemConverter.hxx"
32cdf0e10cSrcweir #include "CharacterPropertyItemConverter.hxx"
33cdf0e10cSrcweir #include "StatisticsItemConverter.hxx"
34cdf0e10cSrcweir #include "SeriesOptionsItemConverter.hxx"
35cdf0e10cSrcweir #include "DataSeriesHelper.hxx"
36cdf0e10cSrcweir #include "DiagramHelper.hxx"
37cdf0e10cSrcweir #include "ChartModelHelper.hxx"
38cdf0e10cSrcweir #include "ChartTypeHelper.hxx"
39cdf0e10cSrcweir #include <svx/chrtitem.hxx>
40cdf0e10cSrcweir #include <com/sun/star/chart2/DataPointLabel.hpp>
41cdf0e10cSrcweir #include <com/sun/star/chart2/Symbol.hpp>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir // header for class XFillColorItem
44cdf0e10cSrcweir #include <svx/xflclit.hxx>
45cdf0e10cSrcweir #include <svl/intitem.hxx>
46cdf0e10cSrcweir #include <editeng/sizeitem.hxx>
47cdf0e10cSrcweir // header for class SfxStringItem
48cdf0e10cSrcweir #include <svl/stritem.hxx>
49cdf0e10cSrcweir #include <editeng/brshitem.hxx>
50cdf0e10cSrcweir //SfxIntegerListItem
51cdf0e10cSrcweir #include <svl/ilstitem.hxx>
52cdf0e10cSrcweir #define _SVSTDARR_ULONGS
53cdf0e10cSrcweir #include <svl/svstdarr.hxx>
54cdf0e10cSrcweir #include <vcl/graph.hxx>
55cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphic.hpp>
56cdf0e10cSrcweir 
57cdf0e10cSrcweir // for SVX_SYMBOLTYPE_...
58cdf0e10cSrcweir #include <svx/tabline.hxx>
59cdf0e10cSrcweir 
60cdf0e10cSrcweir #include <functional>
61cdf0e10cSrcweir #include <algorithm>
62cdf0e10cSrcweir 
63cdf0e10cSrcweir using namespace ::com::sun::star;
64cdf0e10cSrcweir using namespace ::com::sun::star::chart2;
65cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir namespace
68cdf0e10cSrcweir {
lcl_GetDataPointPropertyMap()69cdf0e10cSrcweir ::comphelper::ItemPropertyMapType & lcl_GetDataPointPropertyMap()
70cdf0e10cSrcweir {
71cdf0e10cSrcweir     static ::comphelper::ItemPropertyMapType aDataPointPropertyMap(
72cdf0e10cSrcweir         ::comphelper::MakeItemPropertyMap
73cdf0e10cSrcweir //        IPM_MAP_ENTRY( CHATTR_PIE_SEGMENT_OFFSET, "Offset", 0 )
74cdf0e10cSrcweir         IPM_MAP_ENTRY( SCHATTR_STYLE_SHAPE, "Geometry3D", 0 )
75cdf0e10cSrcweir         );
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     return aDataPointPropertyMap;
78cdf0e10cSrcweir };
79cdf0e10cSrcweir 
lcl_getSymbolStyleForSymbol(const chart2::Symbol & rSymbol)80cdf0e10cSrcweir sal_Int32 lcl_getSymbolStyleForSymbol( const chart2::Symbol & rSymbol )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir     sal_Int32 nStyle = SVX_SYMBOLTYPE_UNKNOWN;
83cdf0e10cSrcweir     switch( rSymbol.Style )
84cdf0e10cSrcweir     {
85cdf0e10cSrcweir         case chart2::SymbolStyle_NONE:
86cdf0e10cSrcweir             nStyle = SVX_SYMBOLTYPE_NONE;
87cdf0e10cSrcweir             break;
88cdf0e10cSrcweir         case chart2::SymbolStyle_AUTO:
89cdf0e10cSrcweir             nStyle = SVX_SYMBOLTYPE_AUTO;
90cdf0e10cSrcweir             break;
91cdf0e10cSrcweir         case chart2::SymbolStyle_GRAPHIC:
92cdf0e10cSrcweir             nStyle = SVX_SYMBOLTYPE_BRUSHITEM;
93cdf0e10cSrcweir             break;
94cdf0e10cSrcweir         case chart2::SymbolStyle_STANDARD:
95cdf0e10cSrcweir             nStyle = rSymbol.StandardSymbol;
96cdf0e10cSrcweir             break;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir         case chart2::SymbolStyle_POLYGON:
99cdf0e10cSrcweir             // to avoid warning
100cdf0e10cSrcweir         case chart2::SymbolStyle_MAKE_FIXED_SIZE:
101cdf0e10cSrcweir             // nothing
102cdf0e10cSrcweir             break;
103cdf0e10cSrcweir     }
104cdf0e10cSrcweir     return nStyle;
105cdf0e10cSrcweir }
106cdf0e10cSrcweir 
lcl_NumberFormatFromItemToPropertySet(sal_uInt16 nWhichId,const SfxItemSet & rItemSet,const uno::Reference<beans::XPropertySet> & xPropertySet,bool bOverwriteAttributedDataPointsAlso)107cdf0e10cSrcweir bool lcl_NumberFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxItemSet & rItemSet, const uno::Reference< beans::XPropertySet > & xPropertySet, bool bOverwriteAttributedDataPointsAlso  )
108cdf0e10cSrcweir {
109cdf0e10cSrcweir     bool bChanged = false;
110cdf0e10cSrcweir     if( !xPropertySet.is() )
111cdf0e10cSrcweir         return bChanged;
112cdf0e10cSrcweir     rtl::OUString aPropertyName = (SID_ATTR_NUMBERFORMAT_VALUE==nWhichId) ? C2U( "NumberFormat" ) : C2U( "PercentageNumberFormat" );
113cdf0e10cSrcweir     sal_uInt16 nSourceWhich = (SID_ATTR_NUMBERFORMAT_VALUE==nWhichId) ? SID_ATTR_NUMBERFORMAT_SOURCE : SCHATTR_PERCENT_NUMBERFORMAT_SOURCE;
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     if( SFX_ITEM_SET != rItemSet.GetItemState( nSourceWhich ) )
116cdf0e10cSrcweir         return bChanged;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     uno::Any aValue;
119cdf0e10cSrcweir     bool bUseSourceFormat = (static_cast< const SfxBoolItem & >(
120cdf0e10cSrcweir                 rItemSet.Get( nSourceWhich )).GetValue() );
121cdf0e10cSrcweir     if( !bUseSourceFormat )
122cdf0e10cSrcweir     {
123cdf0e10cSrcweir         SfxItemState aState = rItemSet.GetItemState( nWhichId );
124cdf0e10cSrcweir         if( aState == SFX_ITEM_SET )
125cdf0e10cSrcweir         {
126cdf0e10cSrcweir             sal_Int32 nFmt = static_cast< sal_Int32 >(
127cdf0e10cSrcweir                 static_cast< const SfxUInt32Item & >(
128cdf0e10cSrcweir                     rItemSet.Get( nWhichId )).GetValue());
129cdf0e10cSrcweir             aValue = uno::makeAny(nFmt);
130cdf0e10cSrcweir         }
131cdf0e10cSrcweir         else
132cdf0e10cSrcweir             return bChanged;
133cdf0e10cSrcweir     }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     uno::Any aOldValue( xPropertySet->getPropertyValue(aPropertyName) );
136cdf0e10cSrcweir     if( bOverwriteAttributedDataPointsAlso )
137cdf0e10cSrcweir     {
138cdf0e10cSrcweir         Reference< chart2::XDataSeries > xSeries( xPropertySet, uno::UNO_QUERY);
139cdf0e10cSrcweir         if( aValue != aOldValue ||
140cdf0e10cSrcweir             ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, aPropertyName, aOldValue ) )
141cdf0e10cSrcweir         {
142cdf0e10cSrcweir             ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, aPropertyName, aValue );
143cdf0e10cSrcweir             bChanged = true;
144cdf0e10cSrcweir         }
145cdf0e10cSrcweir     }
146cdf0e10cSrcweir     else if( aOldValue != aValue )
147cdf0e10cSrcweir     {
148cdf0e10cSrcweir         xPropertySet->setPropertyValue(aPropertyName, aValue );
149cdf0e10cSrcweir         bChanged = true;
150cdf0e10cSrcweir     }
151cdf0e10cSrcweir     return bChanged;
152cdf0e10cSrcweir }
153cdf0e10cSrcweir 
lcl_UseSourceFormatFromItemToPropertySet(sal_uInt16 nWhichId,const SfxItemSet & rItemSet,const uno::Reference<beans::XPropertySet> & xPropertySet,bool bOverwriteAttributedDataPointsAlso)154cdf0e10cSrcweir bool lcl_UseSourceFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxItemSet & rItemSet, const uno::Reference< beans::XPropertySet > & xPropertySet, bool bOverwriteAttributedDataPointsAlso  )
155cdf0e10cSrcweir {
156cdf0e10cSrcweir     bool bChanged = false;
157cdf0e10cSrcweir     if( !xPropertySet.is() )
158cdf0e10cSrcweir         return bChanged;
159cdf0e10cSrcweir     rtl::OUString aPropertyName = (SID_ATTR_NUMBERFORMAT_SOURCE==nWhichId) ? C2U( "NumberFormat" ) : C2U( "PercentageNumberFormat" );
160cdf0e10cSrcweir     sal_uInt16 nFormatWhich = (SID_ATTR_NUMBERFORMAT_SOURCE==nWhichId) ? SID_ATTR_NUMBERFORMAT_VALUE : SCHATTR_PERCENT_NUMBERFORMAT_VALUE;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     if( SFX_ITEM_SET != rItemSet.GetItemState( nWhichId ) )
163cdf0e10cSrcweir         return bChanged;
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     uno::Any aNewValue;
166cdf0e10cSrcweir     bool bUseSourceFormat = (static_cast< const SfxBoolItem & >(
167cdf0e10cSrcweir                 rItemSet.Get( nWhichId )).GetValue() );
168cdf0e10cSrcweir     if( !bUseSourceFormat )
169cdf0e10cSrcweir     {
170cdf0e10cSrcweir         SfxItemState aState = rItemSet.GetItemState( nFormatWhich );
171cdf0e10cSrcweir         if( aState == SFX_ITEM_SET )
172cdf0e10cSrcweir         {
173cdf0e10cSrcweir             sal_Int32 nFormatKey = static_cast< sal_Int32 >(
174cdf0e10cSrcweir             static_cast< const SfxUInt32Item & >(
175cdf0e10cSrcweir                 rItemSet.Get( nFormatWhich )).GetValue());
176cdf0e10cSrcweir             aNewValue <<= nFormatKey;
177cdf0e10cSrcweir         }
178cdf0e10cSrcweir         else
179cdf0e10cSrcweir             return bChanged;
180cdf0e10cSrcweir     }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     uno::Any aOldValue( xPropertySet->getPropertyValue(aPropertyName) );
183cdf0e10cSrcweir     if( bOverwriteAttributedDataPointsAlso )
184cdf0e10cSrcweir     {
185cdf0e10cSrcweir         Reference< chart2::XDataSeries > xSeries( xPropertySet, uno::UNO_QUERY);
186cdf0e10cSrcweir         if( aNewValue != aOldValue ||
187cdf0e10cSrcweir             ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, aPropertyName, aOldValue ) )
188cdf0e10cSrcweir         {
189cdf0e10cSrcweir             ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, aPropertyName, aNewValue );
190cdf0e10cSrcweir             bChanged = true;
191cdf0e10cSrcweir         }
192cdf0e10cSrcweir     }
193cdf0e10cSrcweir     else if( aOldValue != aNewValue )
194cdf0e10cSrcweir     {
195cdf0e10cSrcweir         xPropertySet->setPropertyValue( aPropertyName, aNewValue );
196cdf0e10cSrcweir         bChanged = true;
197cdf0e10cSrcweir     }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir     return bChanged;
200cdf0e10cSrcweir }
201cdf0e10cSrcweir 
202cdf0e10cSrcweir } // anonymous namespace
203cdf0e10cSrcweir 
204cdf0e10cSrcweir namespace chart
205cdf0e10cSrcweir {
206cdf0e10cSrcweir namespace wrapper
207cdf0e10cSrcweir {
208cdf0e10cSrcweir 
DataPointItemConverter(const uno::Reference<frame::XModel> & xChartModel,const uno::Reference<uno::XComponentContext> & xContext,const uno::Reference<beans::XPropertySet> & rPropertySet,const uno::Reference<XDataSeries> & xSeries,SfxItemPool & rItemPool,SdrModel & rDrawModel,NumberFormatterWrapper * pNumFormatter,const uno::Reference<lang::XMultiServiceFactory> & xNamedPropertyContainerFactory,GraphicPropertyItemConverter::eGraphicObjectType eMapTo,::std::auto_ptr<awt::Size> pRefSize,bool bDataSeries,bool bUseSpecialFillColor,sal_Int32 nSpecialFillColor,bool bOverwriteLabelsForAttributedDataPointsAlso,sal_Int32 nNumberFormat,sal_Int32 nPercentNumberFormat)209cdf0e10cSrcweir DataPointItemConverter::DataPointItemConverter(
210cdf0e10cSrcweir     const uno::Reference< frame::XModel > & xChartModel,
211cdf0e10cSrcweir     const uno::Reference< uno::XComponentContext > & xContext,
212cdf0e10cSrcweir     const uno::Reference< beans::XPropertySet > & rPropertySet,
213cdf0e10cSrcweir     const uno::Reference< XDataSeries > & xSeries,
214cdf0e10cSrcweir     SfxItemPool& rItemPool,
215cdf0e10cSrcweir     SdrModel& rDrawModel,
216cdf0e10cSrcweir     NumberFormatterWrapper * pNumFormatter,
217cdf0e10cSrcweir     const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
218cdf0e10cSrcweir     GraphicPropertyItemConverter::eGraphicObjectType eMapTo /* = FILL_PROPERTIES */,
219cdf0e10cSrcweir     ::std::auto_ptr< awt::Size > pRefSize /* = NULL */,
220cdf0e10cSrcweir     bool bDataSeries /* = false */,
221cdf0e10cSrcweir     bool bUseSpecialFillColor /* = false */,
222cdf0e10cSrcweir     sal_Int32 nSpecialFillColor /* =0 */,
223cdf0e10cSrcweir     bool bOverwriteLabelsForAttributedDataPointsAlso /*false*/,
224cdf0e10cSrcweir     sal_Int32 nNumberFormat,
225cdf0e10cSrcweir     sal_Int32 nPercentNumberFormat
226cdf0e10cSrcweir     ) :
227cdf0e10cSrcweir         ItemConverter( rPropertySet, rItemPool ),
228cdf0e10cSrcweir         m_pNumberFormatterWrapper( pNumFormatter ),
229cdf0e10cSrcweir         m_bDataSeries( bDataSeries ),
230cdf0e10cSrcweir         m_bOverwriteLabelsForAttributedDataPointsAlso(m_bDataSeries && bOverwriteLabelsForAttributedDataPointsAlso),
231cdf0e10cSrcweir         m_bUseSpecialFillColor(bUseSpecialFillColor),
232cdf0e10cSrcweir         m_nSpecialFillColor(nSpecialFillColor),
233cdf0e10cSrcweir         m_nNumberFormat(nNumberFormat),
234cdf0e10cSrcweir         m_nPercentNumberFormat(nPercentNumberFormat),
235cdf0e10cSrcweir         m_aAvailableLabelPlacements(),
236cdf0e10cSrcweir         m_bForbidPercentValue(true)
237cdf0e10cSrcweir {
238cdf0e10cSrcweir     m_aConverters.push_back( new GraphicPropertyItemConverter(
239cdf0e10cSrcweir                                  rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, eMapTo ));
240cdf0e10cSrcweir     m_aConverters.push_back( new CharacterPropertyItemConverter( rPropertySet, rItemPool, pRefSize,
241cdf0e10cSrcweir                                                                  C2U( "ReferencePageSize" )));
242cdf0e10cSrcweir     if( bDataSeries )
243cdf0e10cSrcweir     {
244cdf0e10cSrcweir         m_aConverters.push_back( new StatisticsItemConverter( xChartModel, rPropertySet, rItemPool ));
245cdf0e10cSrcweir         m_aConverters.push_back( new SeriesOptionsItemConverter( xChartModel, xContext, rPropertySet, rItemPool ));
246cdf0e10cSrcweir     }
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
249cdf0e10cSrcweir     uno::Reference< XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram , xSeries ) );
250cdf0e10cSrcweir     bool bFound = false;
251cdf0e10cSrcweir     bool bAmbiguous = false;
252cdf0e10cSrcweir     sal_Bool bSwapXAndY = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
253cdf0e10cSrcweir     m_aAvailableLabelPlacements = ChartTypeHelper::getSupportedLabelPlacements( xChartType, DiagramHelper::getDimension( xDiagram ), bSwapXAndY, xSeries );
254cdf0e10cSrcweir 
255cdf0e10cSrcweir     m_bForbidPercentValue = AxisType::CATEGORY != ChartTypeHelper::getAxisType( xChartType, 0 );
256cdf0e10cSrcweir }
257cdf0e10cSrcweir 
~DataPointItemConverter()258cdf0e10cSrcweir DataPointItemConverter::~DataPointItemConverter()
259cdf0e10cSrcweir {
260cdf0e10cSrcweir     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
261cdf0e10cSrcweir                      ::comphelper::DeleteItemConverterPtr() );
262cdf0e10cSrcweir }
263cdf0e10cSrcweir 
FillItemSet(SfxItemSet & rOutItemSet) const264cdf0e10cSrcweir void DataPointItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
265cdf0e10cSrcweir {
266cdf0e10cSrcweir     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
267cdf0e10cSrcweir                      ::comphelper::FillItemSetFunc( rOutItemSet ));
268cdf0e10cSrcweir 
269cdf0e10cSrcweir     // own items
270cdf0e10cSrcweir     ItemConverter::FillItemSet( rOutItemSet );
271cdf0e10cSrcweir 
272cdf0e10cSrcweir     if( m_bUseSpecialFillColor )
273cdf0e10cSrcweir     {
274cdf0e10cSrcweir         Color aColor(m_nSpecialFillColor);
275cdf0e10cSrcweir         rOutItemSet.Put( XFillColorItem( String(), aColor ) );
276cdf0e10cSrcweir     }
277cdf0e10cSrcweir }
278cdf0e10cSrcweir 
ApplyItemSet(const SfxItemSet & rItemSet)279cdf0e10cSrcweir bool DataPointItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
280cdf0e10cSrcweir {
281cdf0e10cSrcweir     bool bResult = false;
282cdf0e10cSrcweir 
283cdf0e10cSrcweir     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
284cdf0e10cSrcweir                      ::comphelper::ApplyItemSetFunc( rItemSet, bResult ));
285cdf0e10cSrcweir 
286cdf0e10cSrcweir     // own items
287cdf0e10cSrcweir     return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
288cdf0e10cSrcweir }
289cdf0e10cSrcweir 
GetWhichPairs() const290cdf0e10cSrcweir const sal_uInt16 * DataPointItemConverter::GetWhichPairs() const
291cdf0e10cSrcweir {
292cdf0e10cSrcweir     // must span all used items!
293cdf0e10cSrcweir     if( m_bDataSeries )
294cdf0e10cSrcweir         return nRowWhichPairs;
295cdf0e10cSrcweir     return nDataPointWhichPairs;
296cdf0e10cSrcweir }
297cdf0e10cSrcweir 
GetItemProperty(tWhichIdType nWhichId,tPropertyNameWithMemberId & rOutProperty) const298cdf0e10cSrcweir bool DataPointItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
299cdf0e10cSrcweir {
300cdf0e10cSrcweir     ::comphelper::ItemPropertyMapType & rMap( lcl_GetDataPointPropertyMap());
301cdf0e10cSrcweir     ::comphelper::ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
302cdf0e10cSrcweir 
303cdf0e10cSrcweir     if( aIt == rMap.end())
304cdf0e10cSrcweir         return false;
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     rOutProperty =(*aIt).second;
307cdf0e10cSrcweir     return true;
308cdf0e10cSrcweir }
309cdf0e10cSrcweir 
310cdf0e10cSrcweir 
ApplySpecialItem(sal_uInt16 nWhichId,const SfxItemSet & rItemSet)311cdf0e10cSrcweir bool DataPointItemConverter::ApplySpecialItem(
312cdf0e10cSrcweir     sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
313cdf0e10cSrcweir     throw( uno::Exception )
314cdf0e10cSrcweir {
315cdf0e10cSrcweir     bool bChanged = false;
316cdf0e10cSrcweir     uno::Any aValue;
317cdf0e10cSrcweir 
318cdf0e10cSrcweir     switch( nWhichId )
319cdf0e10cSrcweir     {
320cdf0e10cSrcweir         case SCHATTR_DATADESCR_SHOW_NUMBER:
321cdf0e10cSrcweir         case SCHATTR_DATADESCR_SHOW_PERCENTAGE:
322cdf0e10cSrcweir         case SCHATTR_DATADESCR_SHOW_CATEGORY:
323cdf0e10cSrcweir         case SCHATTR_DATADESCR_SHOW_SYMBOL:
324cdf0e10cSrcweir         {
325cdf0e10cSrcweir             const SfxBoolItem & rItem = static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId ));
326cdf0e10cSrcweir 
327cdf0e10cSrcweir             uno::Any aOldValue( GetPropertySet()->getPropertyValue( C2U( "Label" ) ));
328cdf0e10cSrcweir             chart2::DataPointLabel aLabel;
329cdf0e10cSrcweir             if( aOldValue >>= aLabel )
330cdf0e10cSrcweir             {
331cdf0e10cSrcweir                 sal_Bool& rValue = (SCHATTR_DATADESCR_SHOW_NUMBER==nWhichId) ? aLabel.ShowNumber : (
332cdf0e10cSrcweir                     (SCHATTR_DATADESCR_SHOW_PERCENTAGE==nWhichId) ? aLabel.ShowNumberInPercent : (
333cdf0e10cSrcweir                     (SCHATTR_DATADESCR_SHOW_CATEGORY==nWhichId) ? aLabel.ShowCategoryName : aLabel.ShowLegendSymbol ));
334cdf0e10cSrcweir                 sal_Bool bOldValue = rValue;
335cdf0e10cSrcweir                 rValue = static_cast< sal_Bool >( rItem.GetValue() );
336cdf0e10cSrcweir                 if( m_bOverwriteLabelsForAttributedDataPointsAlso )
337cdf0e10cSrcweir                 {
338cdf0e10cSrcweir                     Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
339cdf0e10cSrcweir                     if( bOldValue != rValue ||
340cdf0e10cSrcweir                         DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, C2U( "Label" ), aOldValue ) )
341cdf0e10cSrcweir                     {
342cdf0e10cSrcweir                         DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "Label" ), uno::makeAny( aLabel ) );
343cdf0e10cSrcweir                         bChanged = true;
344cdf0e10cSrcweir                     }
345cdf0e10cSrcweir                 }
346cdf0e10cSrcweir                 else if( bOldValue != rValue )
347cdf0e10cSrcweir                 {
348cdf0e10cSrcweir                     GetPropertySet()->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ));
349cdf0e10cSrcweir                     bChanged = true;
350cdf0e10cSrcweir                 }
351cdf0e10cSrcweir             }
352cdf0e10cSrcweir         }
353cdf0e10cSrcweir         break;
354cdf0e10cSrcweir 
355cdf0e10cSrcweir         case SID_ATTR_NUMBERFORMAT_VALUE:
356cdf0e10cSrcweir         case SCHATTR_PERCENT_NUMBERFORMAT_VALUE:  //fall through intended
357cdf0e10cSrcweir         {
358cdf0e10cSrcweir             bChanged = lcl_NumberFormatFromItemToPropertySet( nWhichId, rItemSet, GetPropertySet(), m_bOverwriteLabelsForAttributedDataPointsAlso );
359cdf0e10cSrcweir         }
360cdf0e10cSrcweir         break;
361cdf0e10cSrcweir 
362cdf0e10cSrcweir         case SID_ATTR_NUMBERFORMAT_SOURCE:
363cdf0e10cSrcweir         case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE: //fall through intended
364cdf0e10cSrcweir         {
365cdf0e10cSrcweir             bChanged = lcl_UseSourceFormatFromItemToPropertySet( nWhichId, rItemSet, GetPropertySet(), m_bOverwriteLabelsForAttributedDataPointsAlso );
366cdf0e10cSrcweir         }
367cdf0e10cSrcweir         break;
368cdf0e10cSrcweir 
369cdf0e10cSrcweir         case SCHATTR_DATADESCR_SEPARATOR:
370cdf0e10cSrcweir         {
371cdf0e10cSrcweir             rtl::OUString aNewValue = static_cast< const SfxStringItem & >( rItemSet.Get( nWhichId )).GetValue();
372cdf0e10cSrcweir             rtl::OUString aOldValue;
373cdf0e10cSrcweir             try
374cdf0e10cSrcweir             {
375cdf0e10cSrcweir                 GetPropertySet()->getPropertyValue( C2U( "LabelSeparator" ) ) >>= aOldValue;
376cdf0e10cSrcweir                 if( m_bOverwriteLabelsForAttributedDataPointsAlso )
377cdf0e10cSrcweir                 {
378cdf0e10cSrcweir                     Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
379cdf0e10cSrcweir                     if( !aOldValue.equals(aNewValue) ||
380cdf0e10cSrcweir                         DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, C2U( "LabelSeparator" ), uno::makeAny( aOldValue ) ) )
381cdf0e10cSrcweir                     {
382cdf0e10cSrcweir                         DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "LabelSeparator" ), uno::makeAny( aNewValue ) );
383cdf0e10cSrcweir                         bChanged = true;
384cdf0e10cSrcweir                     }
385cdf0e10cSrcweir                 }
386cdf0e10cSrcweir                 else if( !aOldValue.equals(aNewValue) )
387cdf0e10cSrcweir                 {
388cdf0e10cSrcweir                     GetPropertySet()->setPropertyValue( C2U( "LabelSeparator" ), uno::makeAny( aNewValue ));
389cdf0e10cSrcweir                     bChanged = true;
390cdf0e10cSrcweir                 }
391cdf0e10cSrcweir             }
392cdf0e10cSrcweir             catch( uno::Exception& e )
393cdf0e10cSrcweir 	        {
394cdf0e10cSrcweir                 ASSERT_EXCEPTION( e );
395cdf0e10cSrcweir             }
396cdf0e10cSrcweir         }
397cdf0e10cSrcweir         break;
398cdf0e10cSrcweir 
399cdf0e10cSrcweir         case SCHATTR_DATADESCR_PLACEMENT:
400cdf0e10cSrcweir         {
401cdf0e10cSrcweir 
402cdf0e10cSrcweir             try
403cdf0e10cSrcweir             {
404cdf0e10cSrcweir                 sal_Int32 nNew = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
405cdf0e10cSrcweir                 sal_Int32 nOld =0;
406cdf0e10cSrcweir                 if( !(GetPropertySet()->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nOld) )
407cdf0e10cSrcweir                 {
408cdf0e10cSrcweir                     if( m_aAvailableLabelPlacements.getLength() )
409cdf0e10cSrcweir                         nOld = m_aAvailableLabelPlacements[0];
410cdf0e10cSrcweir                 }
411cdf0e10cSrcweir                 if( m_bOverwriteLabelsForAttributedDataPointsAlso )
412cdf0e10cSrcweir                 {
413cdf0e10cSrcweir                     Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
414cdf0e10cSrcweir                     if( nOld!=nNew ||
415cdf0e10cSrcweir                         DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, C2U( "LabelPlacement" ), uno::makeAny( nOld ) ) )
416cdf0e10cSrcweir                     {
417cdf0e10cSrcweir                         DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "LabelPlacement" ), uno::makeAny( nNew ) );
418cdf0e10cSrcweir                         bChanged = true;
419cdf0e10cSrcweir                     }
420cdf0e10cSrcweir                 }
421cdf0e10cSrcweir                 else if( nOld!=nNew )
422cdf0e10cSrcweir                 {
423cdf0e10cSrcweir                     GetPropertySet()->setPropertyValue( C2U( "LabelPlacement" ), uno::makeAny( nNew ));
424cdf0e10cSrcweir                     bChanged = true;
425cdf0e10cSrcweir                 }
426cdf0e10cSrcweir             }
427cdf0e10cSrcweir             catch( uno::Exception& e )
428cdf0e10cSrcweir 	        {
429cdf0e10cSrcweir                 ASSERT_EXCEPTION( e );
430cdf0e10cSrcweir             }
431cdf0e10cSrcweir         }
432cdf0e10cSrcweir         break;
433cdf0e10cSrcweir 
434cdf0e10cSrcweir         case SCHATTR_STYLE_SYMBOL:
435cdf0e10cSrcweir         {
436cdf0e10cSrcweir             sal_Int32 nStyle =
437cdf0e10cSrcweir                 static_cast< const SfxInt32Item & >(
438cdf0e10cSrcweir                     rItemSet.Get( nWhichId )).GetValue();
439cdf0e10cSrcweir             chart2::Symbol aSymbol;
440cdf0e10cSrcweir 
441cdf0e10cSrcweir             GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol;
442cdf0e10cSrcweir             sal_Int32 nOldStyle = lcl_getSymbolStyleForSymbol( aSymbol );
443cdf0e10cSrcweir 
444cdf0e10cSrcweir             if( nStyle != nOldStyle )
445cdf0e10cSrcweir             {
446cdf0e10cSrcweir                 bool bDeleteSymbol = false;
447cdf0e10cSrcweir                 switch( nStyle )
448cdf0e10cSrcweir                 {
449cdf0e10cSrcweir                     case SVX_SYMBOLTYPE_NONE:
450cdf0e10cSrcweir                         aSymbol.Style = chart2::SymbolStyle_NONE;
451cdf0e10cSrcweir                         break;
452cdf0e10cSrcweir                     case SVX_SYMBOLTYPE_AUTO:
453cdf0e10cSrcweir                         aSymbol.Style = chart2::SymbolStyle_AUTO;
454cdf0e10cSrcweir                         break;
455cdf0e10cSrcweir                     case SVX_SYMBOLTYPE_BRUSHITEM:
456cdf0e10cSrcweir                         aSymbol.Style = chart2::SymbolStyle_GRAPHIC;
457cdf0e10cSrcweir                         break;
458cdf0e10cSrcweir                     case SVX_SYMBOLTYPE_UNKNOWN:
459cdf0e10cSrcweir                         bDeleteSymbol = true;
460cdf0e10cSrcweir                         break;
461cdf0e10cSrcweir 
462cdf0e10cSrcweir                     default:
463cdf0e10cSrcweir                         aSymbol.Style = chart2::SymbolStyle_STANDARD;
464cdf0e10cSrcweir                         aSymbol.StandardSymbol = nStyle;
465cdf0e10cSrcweir                 }
466cdf0e10cSrcweir 
467cdf0e10cSrcweir                 if( bDeleteSymbol )
468cdf0e10cSrcweir                     GetPropertySet()->setPropertyValue( C2U( "Symbol" ), uno::Any());
469cdf0e10cSrcweir                 else
470cdf0e10cSrcweir                     GetPropertySet()->setPropertyValue( C2U( "Symbol" ),
471cdf0e10cSrcweir                                                         uno::makeAny( aSymbol ));
472cdf0e10cSrcweir                 bChanged = true;
473cdf0e10cSrcweir             }
474cdf0e10cSrcweir         }
475cdf0e10cSrcweir         break;
476cdf0e10cSrcweir 
477cdf0e10cSrcweir         case SCHATTR_SYMBOL_SIZE:
478cdf0e10cSrcweir         {
479cdf0e10cSrcweir             Size aSize = static_cast< const SvxSizeItem & >(
480cdf0e10cSrcweir                 rItemSet.Get( nWhichId )).GetSize();
481cdf0e10cSrcweir             chart2::Symbol aSymbol;
482cdf0e10cSrcweir 
483cdf0e10cSrcweir             GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol;
484cdf0e10cSrcweir             if( aSize.getWidth() != aSymbol.Size.Width ||
485cdf0e10cSrcweir                 aSize.getHeight() != aSymbol.Size.Height )
486cdf0e10cSrcweir             {
487cdf0e10cSrcweir                 aSymbol.Size.Width = aSize.getWidth();
488cdf0e10cSrcweir                 aSymbol.Size.Height = aSize.getHeight();
489cdf0e10cSrcweir 
490cdf0e10cSrcweir                 GetPropertySet()->setPropertyValue( C2U( "Symbol" ), uno::makeAny( aSymbol ));
491cdf0e10cSrcweir                 bChanged = true;
492cdf0e10cSrcweir             }
493cdf0e10cSrcweir         }
494cdf0e10cSrcweir         break;
495cdf0e10cSrcweir 
496cdf0e10cSrcweir         case SCHATTR_SYMBOL_BRUSH:
497cdf0e10cSrcweir         {
498cdf0e10cSrcweir             const SvxBrushItem & rBrshItem( static_cast< const SvxBrushItem & >(
499cdf0e10cSrcweir                                                 rItemSet.Get( nWhichId )));
500cdf0e10cSrcweir             uno::Any aXGraphicAny;
501cdf0e10cSrcweir             const Graphic *pGraphic( rBrshItem.GetGraphic());
502cdf0e10cSrcweir             if( pGraphic )
503cdf0e10cSrcweir             {
504cdf0e10cSrcweir                 uno::Reference< graphic::XGraphic > xGraphic( pGraphic->GetXGraphic());
505cdf0e10cSrcweir                 if( xGraphic.is())
506cdf0e10cSrcweir                 {
507cdf0e10cSrcweir                     aXGraphicAny <<= xGraphic;
508cdf0e10cSrcweir                     chart2::Symbol aSymbol;
509cdf0e10cSrcweir                     GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol;
510cdf0e10cSrcweir                     if( aSymbol.Graphic != xGraphic )
511cdf0e10cSrcweir                     {
512cdf0e10cSrcweir                         aSymbol.Graphic = xGraphic;
513cdf0e10cSrcweir                         GetPropertySet()->setPropertyValue( C2U( "Symbol" ), uno::makeAny( aSymbol ));
514cdf0e10cSrcweir                         bChanged = true;
515cdf0e10cSrcweir                     }
516cdf0e10cSrcweir                 }
517cdf0e10cSrcweir             }
518cdf0e10cSrcweir         }
519cdf0e10cSrcweir         break;
520cdf0e10cSrcweir 
521cdf0e10cSrcweir         case SCHATTR_TEXT_DEGREES:
522cdf0e10cSrcweir         {
523cdf0e10cSrcweir             double fValue = static_cast< double >(
524cdf0e10cSrcweir                 static_cast< const SfxInt32Item & >(
525cdf0e10cSrcweir                     rItemSet.Get( nWhichId )).GetValue()) / 100.0;
526cdf0e10cSrcweir             double fOldValue = 0.0;
527cdf0e10cSrcweir             bool bPropExisted =
528cdf0e10cSrcweir                 ( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fOldValue );
529cdf0e10cSrcweir 
530cdf0e10cSrcweir             if( ! bPropExisted ||
531cdf0e10cSrcweir                 ( bPropExisted && fOldValue != fValue ))
532cdf0e10cSrcweir             {
533cdf0e10cSrcweir                 GetPropertySet()->setPropertyValue( C2U( "TextRotation" ), uno::makeAny( fValue ));
534cdf0e10cSrcweir                 bChanged = true;
535cdf0e10cSrcweir             }
536cdf0e10cSrcweir         }
537cdf0e10cSrcweir         break;
538cdf0e10cSrcweir     }
539cdf0e10cSrcweir 
540cdf0e10cSrcweir     return bChanged;
541cdf0e10cSrcweir }
542cdf0e10cSrcweir 
FillSpecialItem(sal_uInt16 nWhichId,SfxItemSet & rOutItemSet) const543cdf0e10cSrcweir void DataPointItemConverter::FillSpecialItem(
544cdf0e10cSrcweir     sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
545cdf0e10cSrcweir     throw( uno::Exception )
546cdf0e10cSrcweir {
547cdf0e10cSrcweir     switch( nWhichId )
548cdf0e10cSrcweir     {
549cdf0e10cSrcweir         case SCHATTR_DATADESCR_SHOW_NUMBER:
550cdf0e10cSrcweir         case SCHATTR_DATADESCR_SHOW_PERCENTAGE:
551cdf0e10cSrcweir         case SCHATTR_DATADESCR_SHOW_CATEGORY:
552cdf0e10cSrcweir         case SCHATTR_DATADESCR_SHOW_SYMBOL:
553cdf0e10cSrcweir         {
554cdf0e10cSrcweir             chart2::DataPointLabel aLabel;
555cdf0e10cSrcweir             if( GetPropertySet()->getPropertyValue( C2U( "Label" )) >>= aLabel )
556cdf0e10cSrcweir             {
557cdf0e10cSrcweir                 sal_Bool bValue = (SCHATTR_DATADESCR_SHOW_NUMBER==nWhichId) ? aLabel.ShowNumber : (
558cdf0e10cSrcweir                     (SCHATTR_DATADESCR_SHOW_PERCENTAGE==nWhichId) ? aLabel.ShowNumberInPercent : (
559cdf0e10cSrcweir                     (SCHATTR_DATADESCR_SHOW_CATEGORY==nWhichId) ? aLabel.ShowCategoryName : aLabel.ShowLegendSymbol ));
560cdf0e10cSrcweir 
561cdf0e10cSrcweir                 rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
562cdf0e10cSrcweir 
563cdf0e10cSrcweir                 if( m_bOverwriteLabelsForAttributedDataPointsAlso )
564cdf0e10cSrcweir                 {
565cdf0e10cSrcweir                     if( DataSeriesHelper::hasAttributedDataPointDifferentValue(
566cdf0e10cSrcweir                         Reference< chart2::XDataSeries >( GetPropertySet(), uno::UNO_QUERY), C2U( "Label" ), uno::makeAny(aLabel) ) )
567cdf0e10cSrcweir                     {
568cdf0e10cSrcweir                         rOutItemSet.InvalidateItem(nWhichId);
569cdf0e10cSrcweir                     }
570cdf0e10cSrcweir                 }
571cdf0e10cSrcweir             }
572cdf0e10cSrcweir         }
573cdf0e10cSrcweir         break;
574cdf0e10cSrcweir 
575cdf0e10cSrcweir         case SID_ATTR_NUMBERFORMAT_VALUE:
576cdf0e10cSrcweir         {
577cdf0e10cSrcweir             sal_Int32 nKey = 0;
578cdf0e10cSrcweir             if( !(GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) >>= nKey) )
579cdf0e10cSrcweir                 nKey = m_nNumberFormat;
580cdf0e10cSrcweir             rOutItemSet.Put( SfxUInt32Item( nWhichId, nKey ));
581cdf0e10cSrcweir         }
582cdf0e10cSrcweir         break;
583cdf0e10cSrcweir 
584cdf0e10cSrcweir         case SCHATTR_PERCENT_NUMBERFORMAT_VALUE:
585cdf0e10cSrcweir         {
586cdf0e10cSrcweir             sal_Int32 nKey = 0;
587cdf0e10cSrcweir             if( !(GetPropertySet()->getPropertyValue( C2U( "PercentageNumberFormat" )) >>= nKey) )
588cdf0e10cSrcweir                 nKey = m_nPercentNumberFormat;
589cdf0e10cSrcweir             rOutItemSet.Put( SfxUInt32Item( nWhichId, nKey ));
590cdf0e10cSrcweir         }
591cdf0e10cSrcweir         break;
592cdf0e10cSrcweir 
593cdf0e10cSrcweir         case SID_ATTR_NUMBERFORMAT_SOURCE:
594cdf0e10cSrcweir         {
595cdf0e10cSrcweir             bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )).hasValue());
596cdf0e10cSrcweir             rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
597cdf0e10cSrcweir         }
598cdf0e10cSrcweir         break;
599cdf0e10cSrcweir         case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE:
600cdf0e10cSrcweir         {
601cdf0e10cSrcweir             bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "PercentageNumberFormat" )).hasValue());
602cdf0e10cSrcweir             rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
603cdf0e10cSrcweir         }
604cdf0e10cSrcweir         break;
605cdf0e10cSrcweir 
606cdf0e10cSrcweir         case SCHATTR_DATADESCR_SEPARATOR:
607cdf0e10cSrcweir         {
608cdf0e10cSrcweir             rtl::OUString aValue;
609cdf0e10cSrcweir             try
610cdf0e10cSrcweir             {
611cdf0e10cSrcweir                 GetPropertySet()->getPropertyValue( C2U( "LabelSeparator" ) ) >>= aValue;
612cdf0e10cSrcweir                 rOutItemSet.Put( SfxStringItem( nWhichId, aValue ));
613cdf0e10cSrcweir             }
614cdf0e10cSrcweir             catch( uno::Exception& e )
615cdf0e10cSrcweir 	        {
616cdf0e10cSrcweir                 ASSERT_EXCEPTION( e );
617cdf0e10cSrcweir             }
618cdf0e10cSrcweir         }
619cdf0e10cSrcweir         break;
620cdf0e10cSrcweir 
621cdf0e10cSrcweir         case SCHATTR_DATADESCR_PLACEMENT:
622cdf0e10cSrcweir         {
623cdf0e10cSrcweir             try
624cdf0e10cSrcweir             {
625cdf0e10cSrcweir                 sal_Int32 nPlacement=0;
626cdf0e10cSrcweir                 if( GetPropertySet()->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nPlacement )
627cdf0e10cSrcweir                     rOutItemSet.Put( SfxInt32Item( nWhichId, nPlacement ));
628cdf0e10cSrcweir                 else if( m_aAvailableLabelPlacements.getLength() )
629cdf0e10cSrcweir                     rOutItemSet.Put( SfxInt32Item( nWhichId, m_aAvailableLabelPlacements[0] ));
630cdf0e10cSrcweir             }
631cdf0e10cSrcweir             catch( uno::Exception& e )
632cdf0e10cSrcweir 	        {
633cdf0e10cSrcweir                 ASSERT_EXCEPTION( e );
634cdf0e10cSrcweir             }
635cdf0e10cSrcweir         }
636cdf0e10cSrcweir         break;
637cdf0e10cSrcweir 
638cdf0e10cSrcweir         case SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS:
639cdf0e10cSrcweir         {
640cdf0e10cSrcweir             SvULongs aList;
641cdf0e10cSrcweir             for ( sal_Int32 nN=0; nN<m_aAvailableLabelPlacements.getLength(); nN++ )
642cdf0e10cSrcweir                 aList.Insert( m_aAvailableLabelPlacements[nN], sal::static_int_cast< sal_uInt16 >(nN) );
643cdf0e10cSrcweir             rOutItemSet.Put( SfxIntegerListItem( nWhichId, aList ) );
644cdf0e10cSrcweir         }
645cdf0e10cSrcweir         break;
646cdf0e10cSrcweir 
647cdf0e10cSrcweir         case SCHATTR_DATADESCR_NO_PERCENTVALUE:
648cdf0e10cSrcweir         {
649cdf0e10cSrcweir             rOutItemSet.Put( SfxBoolItem( nWhichId, m_bForbidPercentValue ));
650cdf0e10cSrcweir         }
651cdf0e10cSrcweir         break;
652cdf0e10cSrcweir 
653cdf0e10cSrcweir         case SCHATTR_STYLE_SYMBOL:
654cdf0e10cSrcweir         {
655cdf0e10cSrcweir             chart2::Symbol aSymbol;
656cdf0e10cSrcweir             if( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol )
657cdf0e10cSrcweir                 rOutItemSet.Put( SfxInt32Item( nWhichId, lcl_getSymbolStyleForSymbol( aSymbol ) ));
658cdf0e10cSrcweir         }
659cdf0e10cSrcweir         break;
660cdf0e10cSrcweir 
661cdf0e10cSrcweir         case SCHATTR_SYMBOL_SIZE:
662cdf0e10cSrcweir         {
663cdf0e10cSrcweir             chart2::Symbol aSymbol;
664cdf0e10cSrcweir             if( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol )
665cdf0e10cSrcweir                 rOutItemSet.Put(
666cdf0e10cSrcweir                     SvxSizeItem( nWhichId, Size( aSymbol.Size.Width, aSymbol.Size.Height ) ));
667cdf0e10cSrcweir         }
668cdf0e10cSrcweir         break;
669cdf0e10cSrcweir 
670cdf0e10cSrcweir         case SCHATTR_SYMBOL_BRUSH:
671cdf0e10cSrcweir         {
672cdf0e10cSrcweir             chart2::Symbol aSymbol;
673cdf0e10cSrcweir             if(( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol )
674cdf0e10cSrcweir                && aSymbol.Graphic.is() )
675cdf0e10cSrcweir             {
676cdf0e10cSrcweir                 rOutItemSet.Put( SvxBrushItem( Graphic( aSymbol.Graphic ), GPOS_MM, SCHATTR_SYMBOL_BRUSH ));
677cdf0e10cSrcweir             }
678cdf0e10cSrcweir         }
679cdf0e10cSrcweir         break;
680cdf0e10cSrcweir 
681cdf0e10cSrcweir         case SCHATTR_TEXT_DEGREES:
682cdf0e10cSrcweir         {
683cdf0e10cSrcweir             double fValue = 0;
684cdf0e10cSrcweir 
685cdf0e10cSrcweir             if( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fValue )
686cdf0e10cSrcweir             {
687cdf0e10cSrcweir                 rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
688cdf0e10cSrcweir                                                    ::rtl::math::round( fValue * 100.0 ) ) ));
689cdf0e10cSrcweir             }
690cdf0e10cSrcweir         }
691cdf0e10cSrcweir         break;
692cdf0e10cSrcweir    }
693cdf0e10cSrcweir }
694cdf0e10cSrcweir 
695cdf0e10cSrcweir } //  namespace wrapper
696cdf0e10cSrcweir } //  namespace chart
697