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: PieChartTypeTemplate.cxx,v $
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 "PieChartTypeTemplate.hxx"
35 #include "CommonConverters.hxx"
36 #include "DiagramHelper.hxx"
37 #include "servicenames_charttypes.hxx"
38 #include "DataSeriesHelper.hxx"
39 #include "ContainerHelper.hxx"
40 #include "BaseGFXHelper.hxx"
41 #include "AxisHelper.hxx"
42 #include "ThreeDHelper.hxx"
43 #include "PropertyHelper.hxx"
44 #include <com/sun/star/beans/PropertyAttribute.hpp>
45 #include <com/sun/star/drawing/LineStyle.hpp>
46 #include <com/sun/star/drawing/FillStyle.hpp>
47 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
48 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
50 #include <rtl/math.hxx>
54 using namespace ::com::sun::star
;
56 using ::rtl::OUString
;
57 using ::com::sun::star::beans::Property
;
58 using ::com::sun::star::uno::Sequence
;
59 using ::com::sun::star::uno::Reference
;
60 using ::com::sun::star::uno::Any
;
61 using ::osl::MutexGuard
;
66 static const ::rtl::OUString
lcl_aServiceName(
67 RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.PieChartTypeTemplate" ));
71 PROP_PIE_TEMPLATE_DEFAULT_OFFSET
,
72 PROP_PIE_TEMPLATE_OFFSET_MODE
,
73 PROP_PIE_TEMPLATE_DIMENSION
,
74 PROP_PIE_TEMPLATE_USE_RINGS
77 void lcl_AddPropertiesToVector(
78 ::std::vector
< Property
> & rOutProperties
)
80 rOutProperties
.push_back(
81 Property( C2U( "OffsetMode" ),
82 PROP_PIE_TEMPLATE_OFFSET_MODE
,
83 ::getCppuType( reinterpret_cast< const chart2::PieChartOffsetMode
* >(0)),
84 beans::PropertyAttribute::BOUND
85 | beans::PropertyAttribute::MAYBEDEFAULT
));
86 rOutProperties
.push_back(
87 Property( C2U( "DefaultOffset" ),
88 PROP_PIE_TEMPLATE_DEFAULT_OFFSET
,
89 ::getCppuType( reinterpret_cast< const double * >(0)),
90 beans::PropertyAttribute::BOUND
91 | beans::PropertyAttribute::MAYBEDEFAULT
));
92 rOutProperties
.push_back(
93 Property( C2U( "Dimension" ),
94 PROP_PIE_TEMPLATE_DIMENSION
,
95 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
96 beans::PropertyAttribute::BOUND
97 | beans::PropertyAttribute::MAYBEDEFAULT
));
98 rOutProperties
.push_back(
99 Property( C2U( "UseRings" ),
100 PROP_PIE_TEMPLATE_USE_RINGS
,
101 ::getBooleanCppuType(),
102 beans::PropertyAttribute::BOUND
103 | beans::PropertyAttribute::MAYBEDEFAULT
));
106 void lcl_AddDefaultsToMap(
107 ::chart::tPropertyValueMap
& rOutMap
)
109 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, PROP_PIE_TEMPLATE_OFFSET_MODE
, chart2::PieChartOffsetMode_NONE
);
110 ::chart::PropertyHelper::setPropertyValueDefault
< double >( rOutMap
, PROP_PIE_TEMPLATE_DEFAULT_OFFSET
, 0.5 );
111 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, PROP_PIE_TEMPLATE_DIMENSION
, 2 );
112 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, PROP_PIE_TEMPLATE_USE_RINGS
, false );
115 const uno::Sequence
< Property
> & lcl_GetPropertySequence()
117 static uno::Sequence
< Property
> aPropSeq
;
120 MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
121 if( 0 == aPropSeq
.getLength() )
124 ::std::vector
< ::com::sun::star::beans::Property
> aProperties
;
125 lcl_AddPropertiesToVector( aProperties
);
127 // and sort them for access via bsearch
128 ::std::sort( aProperties
.begin(), aProperties
.end(),
129 ::chart::PropertyNameLess() );
131 // transfer result to static Sequence
132 aPropSeq
= ::chart::ContainerHelper::ContainerToSequence( aProperties
);
138 ::cppu::IPropertyArrayHelper
& lcl_getInfoHelper()
140 static ::cppu::OPropertyArrayHelper
aArrayHelper(
141 lcl_GetPropertySequence(),
142 /* bSorted = */ sal_True
);
147 } // anonymous namespace
152 PieChartTypeTemplate::PieChartTypeTemplate(
154 uno::XComponentContext
> const & xContext
,
155 const ::rtl::OUString
& rServiceName
,
156 chart2::PieChartOffsetMode eMode
,
157 bool bRings
/* = false */,
158 sal_Int32 nDim
/* = 2 */ ) :
159 ChartTypeTemplate( xContext
, rServiceName
),
160 ::property::OPropertySet( m_aMutex
)
162 setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_OFFSET_MODE
, uno::makeAny( eMode
));
163 setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_DIMENSION
, uno::makeAny( nDim
));
164 setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_USE_RINGS
, uno::makeAny( sal_Bool( bRings
)));
167 PieChartTypeTemplate::~PieChartTypeTemplate()
170 // ____ OPropertySet ____
171 uno::Any
PieChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle
) const
172 throw(beans::UnknownPropertyException
)
174 static tPropertyValueMap aStaticDefaults
;
177 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
178 if( 0 == aStaticDefaults
.size() )
180 // initialize defaults
181 lcl_AddDefaultsToMap( aStaticDefaults
);
184 tPropertyValueMap::const_iterator
aFound(
185 aStaticDefaults
.find( nHandle
));
187 if( aFound
== aStaticDefaults
.end())
190 return (*aFound
).second
;
194 ::cppu::IPropertyArrayHelper
& SAL_CALL
PieChartTypeTemplate::getInfoHelper()
196 return lcl_getInfoHelper();
200 // ____ XPropertySet ____
201 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
202 PieChartTypeTemplate::getPropertySetInfo()
203 throw (uno::RuntimeException
)
205 static uno::Reference
< beans::XPropertySetInfo
> xInfo
;
208 MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
211 xInfo
= ::cppu::OPropertySetHelper::createPropertySetInfo(
220 // ____ ChartTypeTemplate ____
221 sal_Int32
PieChartTypeTemplate::getDimension() const
226 // note: UNO-methods are never const
227 const_cast< PieChartTypeTemplate
* >( this )->
228 getFastPropertyValue( PROP_PIE_TEMPLATE_DIMENSION
) >>= nDim
;
230 catch( beans::UnknownPropertyException
& ex
)
232 ASSERT_EXCEPTION( ex
);
238 sal_Int32
PieChartTypeTemplate::getAxisCountByDimension( sal_Int32
/*nDimension*/ )
243 // void PieChartTypeTemplate::createAxes(
244 // const Sequence< Reference< chart2::XCoordinateSystem > > & rCoordSys )
248 void PieChartTypeTemplate::adaptAxes(
249 const uno::Sequence
< uno::Reference
< chart2::XCoordinateSystem
> > & /*rCoordSys*/ )
251 // hide existing axes
255 void PieChartTypeTemplate::adaptScales(
256 const Sequence
< Reference
< chart2::XCoordinateSystem
> > & aCooSysSeq
,
257 const Reference
< chart2::data::XLabeledDataSequence
> & xCategories
//@todo: in future there may be more than one sequence of categories (e.g. charttype with categories at x and y axis )
260 ChartTypeTemplate::adaptScales( aCooSysSeq
, xCategories
);
262 //remove explicit scalings from radius axis
263 //and ensure correct orientation of scales for donuts
265 for( sal_Int32 nCooSysIdx
=0; nCooSysIdx
<aCooSysSeq
.getLength(); ++nCooSysIdx
)
269 Reference
< chart2::XAxis
> xAxis( AxisHelper::getAxis( 1 /*nDimensionIndex*/,0 /*nAxisIndex*/
270 , aCooSysSeq
[nCooSysIdx
] ) );
273 chart2::ScaleData
aScaleData( xAxis
->getScaleData() );
274 AxisHelper::removeExplicitScaling( aScaleData
);
275 aScaleData
.Orientation
= chart2::AxisOrientation_MATHEMATICAL
;
276 xAxis
->setScaleData( aScaleData
);
281 xAxis
= AxisHelper::getAxis( 0 /*nDimensionIndex*/,0 /*nAxisIndex*/
282 , aCooSysSeq
[nCooSysIdx
] );
285 chart2::ScaleData
aScaleData( xAxis
->getScaleData() );
286 aScaleData
.Orientation
= chart2::AxisOrientation_REVERSE
;
287 xAxis
->setScaleData( aScaleData
);
290 catch( const uno::Exception
& ex
)
292 ASSERT_EXCEPTION( ex
);
297 void PieChartTypeTemplate::createChartTypes(
298 const Sequence
< Sequence
< Reference
< chart2::XDataSeries
> > > & aSeriesSeq
,
299 const Sequence
< Reference
< chart2::XCoordinateSystem
> > & rCoordSys
,
300 const Sequence
< Reference
< chart2::XChartType
> >& /* aOldChartTypesSeq */ )
302 if( rCoordSys
.getLength() == 0 ||
303 ! rCoordSys
[0].is() )
308 Reference
< lang::XMultiServiceFactory
> xFact(
309 GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW
);
311 Reference
< chart2::XChartType
> xCT(
312 xFact
->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_PIE
), uno::UNO_QUERY_THROW
);
313 Reference
< beans::XPropertySet
> xCTProp( xCT
, uno::UNO_QUERY
);
316 xCTProp
->setPropertyValue(
317 C2U( "UseRings" ), getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS
));
319 Reference
< chart2::XChartTypeContainer
> xCTCnt( rCoordSys
[0], uno::UNO_QUERY_THROW
);
320 xCTCnt
->setChartTypes( Sequence
< Reference
< chart2::XChartType
> >( &xCT
, 1 ));
322 if( aSeriesSeq
.getLength() > 0 )
324 Reference
< chart2::XDataSeriesContainer
> xDSCnt( xCT
, uno::UNO_QUERY_THROW
);
325 Sequence
< Reference
< chart2::XDataSeries
> > aFlatSeriesSeq( FlattenSequence( aSeriesSeq
));
326 xDSCnt
->setDataSeries( aFlatSeriesSeq
);
328 DataSeriesHelper::setStackModeAtSeries(
329 aFlatSeriesSeq
, rCoordSys
[0], getStackMode( 0 ));
332 catch( uno::Exception
& ex
)
334 ASSERT_EXCEPTION( ex
);
338 // ____ XChartTypeTemplate ____
339 sal_Bool SAL_CALL
PieChartTypeTemplate::matchesTemplate(
340 const uno::Reference
< chart2::XDiagram
>& xDiagram
,
341 sal_Bool bAdaptProperties
)
342 throw (uno::RuntimeException
)
344 sal_Bool bResult
= ChartTypeTemplate::matchesTemplate( xDiagram
, bAdaptProperties
);
346 sal_Bool bTemplateUsesRings
= sal_False
;
347 getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS
) >>= bTemplateUsesRings
;
348 chart2::PieChartOffsetMode ePieOffsetMode
;
349 getFastPropertyValue( PROP_PIE_TEMPLATE_OFFSET_MODE
) >>= ePieOffsetMode
;
357 bool bAllOffsetsEqual
= true;
359 ::std::vector
< Reference
< chart2::XDataSeries
> > aSeriesVec(
360 DiagramHelper::getDataSeriesFromDiagram( xDiagram
));
362 //check offset of outer series
363 if( aSeriesVec
.size() )
365 sal_Int32 nOuterSeriesIndex
= 0; //@todo in future this will depend on Orientation of the radius axis scale
366 Reference
< chart2::XDataSeries
> xSeries( aSeriesVec
[nOuterSeriesIndex
] );
367 Reference
< beans::XPropertySet
> xProp( xSeries
, uno::UNO_QUERY_THROW
);
368 xProp
->getPropertyValue( C2U( "Offset" )) >>= fOffset
;
370 //get AttributedDataPoints
371 uno::Sequence
< sal_Int32
> aAttributedDataPointIndexList
;
372 if( xProp
->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList
)
374 for(sal_Int32 nN
=aAttributedDataPointIndexList
.getLength();nN
--;)
376 uno::Reference
< beans::XPropertySet
> xPointProp( xSeries
->getDataPointByIndex(aAttributedDataPointIndexList
[nN
]) );
379 double fPointOffset
=0.0;
380 if( (xProp
->getPropertyValue( C2U( "Offset" )) >>= fPointOffset
) )
382 if( ! ::rtl::math::approxEqual( fPointOffset
, fOffset
) )
384 bAllOffsetsEqual
= false;
393 chart2::PieChartOffsetMode eOffsetMode
= chart2::PieChartOffsetMode_NONE
;
394 if( bAllOffsetsEqual
&& fOffset
> 0.0 )
396 eOffsetMode
= chart2::PieChartOffsetMode_ALL_EXPLODED
;
397 if( bAdaptProperties
)
398 setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_DEFAULT_OFFSET
, uno::makeAny( fOffset
));
401 bResult
= ( eOffsetMode
== ePieOffsetMode
);
403 catch( uno::Exception
& ex
)
405 ASSERT_EXCEPTION( ex
);
413 uno::Reference
< beans::XPropertySet
> xCTProp(
414 DiagramHelper::getChartTypeByIndex( xDiagram
, 0 ), uno::UNO_QUERY_THROW
);
415 sal_Bool bUseRings
= false;
416 if( xCTProp
->getPropertyValue( C2U( "UseRings" )) >>= bUseRings
)
418 bResult
= ( bTemplateUsesRings
== bUseRings
);
425 Reference
< chart2::XChartType
> PieChartTypeTemplate::getChartTypeForIndex( sal_Int32
/*nChartTypeIndex*/ )
427 Reference
< chart2::XChartType
> xResult
;
431 Reference
< lang::XMultiServiceFactory
> xFact(
432 GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW
);
433 xResult
.set( xFact
->createInstance(
434 CHART2_SERVICE_NAME_CHARTTYPE_PIE
), uno::UNO_QUERY_THROW
);
435 Reference
< beans::XPropertySet
> xCTProp( xResult
, uno::UNO_QUERY
);
438 xCTProp
->setPropertyValue(
439 C2U( "UseRings" ), getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS
));
443 catch( uno::Exception
& ex
)
445 ASSERT_EXCEPTION( ex
);
451 Reference
< chart2::XChartType
> SAL_CALL
PieChartTypeTemplate::getChartTypeForNewSeries(
452 const uno::Sequence
< Reference
< chart2::XChartType
> >& aFormerlyUsedChartTypes
)
453 throw (uno::RuntimeException
)
455 Reference
< chart2::XChartType
> xResult
;
459 Reference
< lang::XMultiServiceFactory
> xFact(
460 GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW
);
461 xResult
.set( xFact
->createInstance(
462 CHART2_SERVICE_NAME_CHARTTYPE_PIE
), uno::UNO_QUERY_THROW
);
463 ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes
, xResult
);
464 Reference
< beans::XPropertySet
> xCTProp( xResult
, uno::UNO_QUERY
);
467 xCTProp
->setPropertyValue(
468 C2U( "UseRings" ), getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS
));
472 catch( uno::Exception
& ex
)
474 ASSERT_EXCEPTION( ex
);
477 setStackModePropertiesToChartType(xResult
);
481 void SAL_CALL
PieChartTypeTemplate::applyStyle(
482 const Reference
< chart2::XDataSeries
>& xSeries
,
483 ::sal_Int32 nChartTypeIndex
,
484 ::sal_Int32 nSeriesIndex
,
485 ::sal_Int32 nSeriesCount
)
486 throw (uno::RuntimeException
)
488 ChartTypeTemplate::applyStyle( xSeries
, nChartTypeIndex
, nSeriesIndex
, nSeriesCount
);
492 uno::Reference
< beans::XPropertySet
> xProp( xSeries
, uno::UNO_QUERY_THROW
);
494 sal_Bool bTemplateUsesRings
= sal_False
;
495 getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS
) >>= bTemplateUsesRings
;
496 sal_Int32 nOuterSeriesIndex
= 0; //@todo in future this will depend on Orientation of the radius axis scale
497 if( nSeriesIndex
== nOuterSeriesIndex
)
499 const OUString
aOffsetPropName( RTL_CONSTASCII_USTRINGPARAM("Offset"));
501 chart2::PieChartOffsetMode ePieOffsetMode
;
502 this->getFastPropertyValue( PROP_PIE_TEMPLATE_OFFSET_MODE
) >>= ePieOffsetMode
;
504 // get default offset
505 double fDefaultOffset
= 0.5;
506 this->getFastPropertyValue( PROP_PIE_TEMPLATE_DEFAULT_OFFSET
) >>= fDefaultOffset
;
507 double fOffsetToSet
= fDefaultOffset
;
509 uno::Sequence
< sal_Int32
> aAttributedDataPointIndexList
;
510 xProp
->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList
;
512 // determine whether to set the new offset
513 bool bSetOffset
= ( ePieOffsetMode
== chart2::PieChartOffsetMode_ALL_EXPLODED
);
515 (ePieOffsetMode
== chart2::PieChartOffsetMode_NONE
) )
517 // set offset to 0 if the offset was exactly "all exploded"
518 // before (individual offsets are kept)
519 double fOffset
= 0.0;
520 if( (xProp
->getPropertyValue( aOffsetPropName
) >>= fOffset
) &&
521 ::rtl::math::approxEqual( fOffset
, fDefaultOffset
))
525 for( sal_Int32 nPtIdx
=0; nPtIdx
<aAttributedDataPointIndexList
.getLength(); ++nPtIdx
)
527 uno::Reference
< beans::XPropertySet
> xPointProp(
528 xSeries
->getDataPointByIndex( aAttributedDataPointIndexList
[ nPtIdx
] ));
529 uno::Reference
< beans::XPropertyState
> xPointState( xPointProp
, uno::UNO_QUERY
);
530 double fPointOffset
= 0.0;
531 if( xPointState
.is() &&
532 (xPointState
->getPropertyState( aOffsetPropName
) == beans::PropertyState_DIRECT_VALUE
) &&
534 (xPointProp
->getPropertyValue( aOffsetPropName
) >>= fPointOffset
) &&
535 ! ::rtl::math::approxEqual( fPointOffset
, fDefaultOffset
) )
546 // set the offset to the series and to the attributed data points
547 xProp
->setPropertyValue( aOffsetPropName
, uno::makeAny( fOffsetToSet
));
549 // remove hard attributes from data points
550 for( sal_Int32 nPtIdx
=0; nPtIdx
<aAttributedDataPointIndexList
.getLength(); ++nPtIdx
)
552 uno::Reference
< beans::XPropertyState
> xPointState(
553 xSeries
->getDataPointByIndex( aAttributedDataPointIndexList
[ nPtIdx
] ), uno::UNO_QUERY
);
554 if( xPointState
.is())
555 xPointState
->setPropertyToDefault( aOffsetPropName
);
561 drawing::LineStyle eStyle
= (getDimension() == 2)
562 ? drawing::LineStyle_SOLID
563 : drawing::LineStyle_NONE
;
565 xProp
->setPropertyValue( C2U("BorderStyle"),
566 uno::makeAny( eStyle
));
568 // vary colors by point
569 xProp
->setPropertyValue( C2U("VaryColorsByPoint"), uno::makeAny( true ));
571 catch( uno::Exception
& ex
)
573 ASSERT_EXCEPTION( ex
);
578 void SAL_CALL
PieChartTypeTemplate::resetStyles( const Reference
< chart2::XDiagram
>& xDiagram
)
579 throw (uno::RuntimeException
)
581 // reset axes and grids
582 Reference
< chart2::XCoordinateSystemContainer
> xCooSysCnt( xDiagram
, uno::UNO_QUERY
);
585 Sequence
< Reference
< chart2::XCoordinateSystem
> > aCooSysSeq( xCooSysCnt
->getCoordinateSystems());
586 ChartTypeTemplate::createAxes( aCooSysSeq
);
588 //reset scale orientation
589 for( sal_Int32 nCooSysIdx
=0; nCooSysIdx
<aCooSysSeq
.getLength(); ++nCooSysIdx
)
593 Reference
< chart2::XAxis
> xAxis( AxisHelper::getAxis( 0 /*nDimensionIndex*/,0 /*nAxisIndex*/
594 , aCooSysSeq
[nCooSysIdx
] ) );
597 chart2::ScaleData
aScaleData( xAxis
->getScaleData() );
598 aScaleData
.Orientation
= chart2::AxisOrientation_MATHEMATICAL
;
599 xAxis
->setScaleData( aScaleData
);
602 xAxis
= AxisHelper::getAxis( 1, 0, aCooSysSeq
[nCooSysIdx
] );
605 chart2::ScaleData
aScaleData( xAxis
->getScaleData() );
606 aScaleData
.Orientation
= chart2::AxisOrientation_MATHEMATICAL
;
607 xAxis
->setScaleData( aScaleData
);
610 catch( const uno::Exception
& ex
)
612 ASSERT_EXCEPTION( ex
);
617 ChartTypeTemplate::resetStyles( xDiagram
);
619 // vary colors by point,
621 ::std::vector
< Reference
< chart2::XDataSeries
> > aSeriesVec(
622 DiagramHelper::getDataSeriesFromDiagram( xDiagram
));
623 drawing::LineStyle eStyle
= (getDimension() == 2)
624 ? drawing::LineStyle_SOLID
625 : drawing::LineStyle_NONE
;
626 uno::Any
aLineStyleAny( uno::makeAny( eStyle
));
627 for( ::std::vector
< Reference
< chart2::XDataSeries
> >::iterator
aIt( aSeriesVec
.begin());
628 aIt
!= aSeriesVec
.end(); ++aIt
)
630 Reference
< beans::XPropertyState
> xState( *aIt
, uno::UNO_QUERY
);
633 xState
->setPropertyToDefault( C2U("VaryColorsByPoint"));
634 Reference
< beans::XPropertySet
> xProp( xState
, uno::UNO_QUERY
);
636 xProp
->getPropertyValue( C2U("BorderStyle")) == aLineStyleAny
)
638 xState
->setPropertyToDefault( C2U("BorderStyle"));
643 //reset scene properties
644 ThreeDHelper::setDefaultRotation( uno::Reference
< beans::XPropertySet
>( xDiagram
, uno::UNO_QUERY
), false );
647 // ____ XChartTypeTemplate ____
648 void PieChartTypeTemplate::adaptDiagram( const uno::Reference
< chart2::XDiagram
>& xDiagram
)
653 //different default for scene geometry:
654 ThreeDHelper::setDefaultRotation( uno::Reference
< beans::XPropertySet
>( xDiagram
, uno::UNO_QUERY
), true );
657 // ----------------------------------------
659 uno::Sequence
< ::rtl::OUString
> PieChartTypeTemplate::getSupportedServiceNames_Static()
661 uno::Sequence
< ::rtl::OUString
> aServices( 2 );
662 aServices
[ 0 ] = lcl_aServiceName
;
663 aServices
[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
667 // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
668 APPHELPER_XSERVICEINFO_IMPL( PieChartTypeTemplate
, lcl_aServiceName
);
670 IMPLEMENT_FORWARD_XINTERFACE2( PieChartTypeTemplate
, ChartTypeTemplate
, OPropertySet
)
671 IMPLEMENT_FORWARD_XTYPEPROVIDER2( PieChartTypeTemplate
, ChartTypeTemplate
, OPropertySet
)