diff options
Diffstat (limited to 'chart2/source/model/main/Wall.cxx')
-rw-r--r-- | chart2/source/model/main/Wall.cxx | 105 |
1 files changed, 37 insertions, 68 deletions
diff --git a/chart2/source/model/main/Wall.cxx b/chart2/source/model/main/Wall.cxx index 5588ed81e0a3..1bbe133de905 100644 --- a/chart2/source/model/main/Wall.cxx +++ b/chart2/source/model/main/Wall.cxx @@ -24,7 +24,6 @@ #include <PropertyHelper.hxx> #include <ModifyListenerHelper.hxx> #include <com/sun/star/drawing/LineStyle.hpp> -#include <tools/diagnose_ex.h> #include <vector> #include <algorithm> @@ -36,69 +35,21 @@ using ::com::sun::star::beans::Property; namespace { -struct StaticWallDefaults_Initializer +::cppu::OPropertyArrayHelper& StaticWallInfoHelper() { - ::chart::tPropertyValueMap* operator()() - { - static ::chart::tPropertyValueMap aStaticDefaults; - lcl_AddDefaultsToMap( aStaticDefaults ); - return &aStaticDefaults; - } -private: - static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) - { - ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); - ::chart::FillProperties::AddDefaultsToMap( rOutMap ); - - // override other defaults - ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE ); - } -}; + static ::cppu::OPropertyArrayHelper aPropHelper = []() + { + std::vector< css::beans::Property > aProperties; + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); + ::chart::FillProperties::AddPropertiesToVector( aProperties ); + ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); -struct StaticWallDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticWallDefaults_Initializer > -{ -}; - -struct StaticWallInfoHelper_Initializer -{ - ::cppu::OPropertyArrayHelper* operator()() - { - static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); - return &aPropHelper; - } - -private: - static uno::Sequence< Property > lcl_GetPropertySequence() - { - std::vector< css::beans::Property > aProperties; - ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); - ::chart::FillProperties::AddPropertiesToVector( aProperties ); - ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); - - std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); - - return comphelper::containerToSequence( aProperties ); - } + std::sort( aProperties.begin(), aProperties.end(), + ::chart::PropertyNameLess() ); -}; - -struct StaticWallInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticWallInfoHelper_Initializer > -{ -}; - -struct StaticWallInfo_Initializer -{ - uno::Reference< beans::XPropertySetInfo >* operator()() - { - static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( - ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticWallInfoHelper::get() ) ); - return &xPropertySetInfo; - } -}; - -struct StaticWallInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticWallInfo_Initializer > -{ + return comphelper::containerToSequence( aProperties ); + }(); + return aPropHelper; }; } // anonymous namespace @@ -107,19 +58,26 @@ namespace chart { Wall::Wall() : - ::property::OPropertySet( m_aMutex ), m_xModifyEventForwarder( new ModifyEventForwarder() ) {} Wall::Wall( const Wall & rOther ) : impl::Wall_Base(rOther), - ::property::OPropertySet( rOther, m_aMutex ), + ::property::OPropertySet( rOther ), m_xModifyEventForwarder( new ModifyEventForwarder() ) {} Wall::~Wall() {} +// ____ XTypeProvider ____ +uno::Sequence< css::uno::Type > SAL_CALL Wall::getTypes() +{ + return ::comphelper::concatSequences( + impl::Wall_Base::getTypes(), + ::property::OPropertySet::getTypes()); +} + // ____ XCloneable ____ uno::Reference< util::XCloneable > SAL_CALL Wall::createClone() { @@ -129,9 +87,18 @@ uno::Reference< util::XCloneable > SAL_CALL Wall::createClone() // ____ OPropertySet ____ void Wall::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const { - const tPropertyValueMap& rStaticDefaults = *StaticWallDefaults::get(); - tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); - if( aFound == rStaticDefaults.end() ) + static ::chart::tPropertyValueMap aStaticDefaults = []() + { + ::chart::tPropertyValueMap aTmp; + ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp ); + ::chart::FillProperties::AddDefaultsToMap( aTmp ); + + // override other defaults + ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE ); + return aTmp; + }(); + tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( nHandle ) ); + if( aFound == aStaticDefaults.end() ) rAny.clear(); else rAny = (*aFound).second; @@ -139,13 +106,15 @@ void Wall::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const ::cppu::IPropertyArrayHelper & SAL_CALL Wall::getInfoHelper() { - return *StaticWallInfoHelper::get(); + return StaticWallInfoHelper(); } // ____ XPropertySet ____ uno::Reference< beans::XPropertySetInfo > SAL_CALL Wall::getPropertySetInfo() { - return *StaticWallInfo::get(); + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(StaticWallInfoHelper() ) ); + return xPropertySetInfo; } // ____ XModifyBroadcaster ____ |