diff options
Diffstat (limited to 'chart2/source/model/template/BubbleChartType.cxx')
-rw-r--r-- | chart2/source/model/template/BubbleChartType.cxx | 94 |
1 files changed, 32 insertions, 62 deletions
diff --git a/chart2/source/model/template/BubbleChartType.cxx b/chart2/source/model/template/BubbleChartType.cxx index 1998eb9e4dc7..bd8bf287d96a 100644 --- a/chart2/source/model/template/BubbleChartType.cxx +++ b/chart2/source/model/template/BubbleChartType.cxx @@ -21,6 +21,7 @@ #include <PropertyHelper.hxx> #include <servicenames_charttypes.hxx> #include <CartesianCoordinateSystem.hxx> +#include <Axis.hxx> #include <AxisHelper.hxx> #include <AxisIndexDefines.hxx> #include <com/sun/star/chart2/AxisType.hpp> @@ -35,55 +36,16 @@ using ::com::sun::star::uno::Reference; namespace { -struct StaticBubbleChartTypeDefaults_Initializer -{ - ::chart::tPropertyValueMap* operator()() - { - static ::chart::tPropertyValueMap aStaticDefaults; - return &aStaticDefaults; - } -}; - -struct StaticBubbleChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticBubbleChartTypeDefaults_Initializer > -{ -}; - -struct StaticBubbleChartTypeInfoHelper_Initializer -{ - ::cppu::OPropertyArrayHelper* operator()() - { - static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); - return &aPropHelper; - } - -private: - static Sequence< Property > lcl_GetPropertySequence() - { - std::vector< css::beans::Property > aProperties; - - std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); - - return comphelper::containerToSequence( aProperties ); - } -}; - -struct StaticBubbleChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticBubbleChartTypeInfoHelper_Initializer > -{ -}; - -struct StaticBubbleChartTypeInfo_Initializer -{ - uno::Reference< beans::XPropertySetInfo >* operator()() - { - static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( - ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticBubbleChartTypeInfoHelper::get() ) ); - return &xPropertySetInfo; - } -}; - -struct StaticBubbleChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticBubbleChartTypeInfo_Initializer > +::cppu::OPropertyArrayHelper& StaticBubbleChartTypeInfoHelper() { + static ::cppu::OPropertyArrayHelper aPropHelper = []() + { + std::vector< css::beans::Property > aProperties; + std::sort( aProperties.begin(), aProperties.end(), + ::chart::PropertyNameLess() ); + return comphelper::containerToSequence( aProperties ); + }(); + return aPropHelper; }; } // anonymous namespace @@ -109,16 +71,21 @@ uno::Reference< util::XCloneable > SAL_CALL BubbleChartType::createClone() return uno::Reference< util::XCloneable >( new BubbleChartType( *this )); } +rtl::Reference< ChartType > BubbleChartType::cloneChartType() const +{ + return new BubbleChartType( *this ); +} + // ____ XChartType ____ -Reference< chart2::XCoordinateSystem > SAL_CALL - BubbleChartType::createCoordinateSystem( ::sal_Int32 DimensionCount ) +rtl::Reference< ::chart::BaseCoordinateSystem > + BubbleChartType::createCoordinateSystem2( sal_Int32 DimensionCount ) { - Reference< chart2::XCoordinateSystem > xResult( - new CartesianCoordinateSystem( DimensionCount )); + rtl::Reference< CartesianCoordinateSystem > xResult = + new CartesianCoordinateSystem( DimensionCount ); for( sal_Int32 i=0; i<DimensionCount; ++i ) { - Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) ); + rtl::Reference< Axis > xAxis = xResult->getAxisByDimension2( i, MAIN_AXIS_INDEX ); if( !xAxis.is() ) { OSL_FAIL("a created coordinate system should have an axis for each dimension"); @@ -161,25 +128,28 @@ OUString SAL_CALL BubbleChartType::getRoleOfSequenceForSeriesLabel() } // ____ OPropertySet ____ -uno::Any BubbleChartType::GetDefaultValue( sal_Int32 nHandle ) const -{ - const tPropertyValueMap& rStaticDefaults = *StaticBubbleChartTypeDefaults::get(); - tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); - if( aFound == rStaticDefaults.end() ) - return uno::Any(); - return (*aFound).second; +void BubbleChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const +{ + static ::chart::tPropertyValueMap aStaticDefaults; + tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( nHandle ) ); + if( aFound == aStaticDefaults.end() ) + rAny.clear(); + else + rAny = (*aFound).second; } // ____ OPropertySet ____ ::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartType::getInfoHelper() { - return *StaticBubbleChartTypeInfoHelper::get(); + return StaticBubbleChartTypeInfoHelper(); } // ____ XPropertySet ____ uno::Reference< beans::XPropertySetInfo > SAL_CALL BubbleChartType::getPropertySetInfo() { - return *StaticBubbleChartTypeInfo::get(); + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(StaticBubbleChartTypeInfoHelper() ) ); + return xPropertySetInfo; } OUString SAL_CALL BubbleChartType::getImplementationName() |