diff options
Diffstat (limited to 'chart2/source/model/main/DataPoint.cxx')
-rw-r--r-- | chart2/source/model/main/DataPoint.cxx | 71 |
1 files changed, 24 insertions, 47 deletions
diff --git a/chart2/source/model/main/DataPoint.cxx b/chart2/source/model/main/DataPoint.cxx index a5838c91f5d5..3e224d6523de 100644 --- a/chart2/source/model/main/DataPoint.cxx +++ b/chart2/source/model/main/DataPoint.cxx @@ -26,7 +26,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <cppuhelper/supportsservice.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <algorithm> @@ -39,45 +39,21 @@ using ::com::sun::star::beans::Property; namespace { -struct StaticDataPointInfoHelper_Initializer +::cppu::OPropertyArrayHelper& StaticDataPointInfoHelper() { - ::cppu::OPropertyArrayHelper* operator()() - { - static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); - return &aPropHelper; - } - -private: - static Sequence< Property > lcl_GetPropertySequence() - { - std::vector< css::beans::Property > aProperties; - ::chart::DataPointProperties::AddPropertiesToVector( aProperties ); - ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); - ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); - - std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); - - return comphelper::containerToSequence( aProperties ); - } -}; - -struct StaticDataPointInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticDataPointInfoHelper_Initializer > -{ -}; + static ::cppu::OPropertyArrayHelper aPropHelper = []() + { + std::vector< css::beans::Property > aProperties; + ::chart::DataPointProperties::AddPropertiesToVector( aProperties ); + ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); + ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); -struct StaticDataPointInfo_Initializer -{ - uno::Reference< beans::XPropertySetInfo >* operator()() - { - static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( - ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticDataPointInfoHelper::get() ) ); - return &xPropertySetInfo; - } -}; + std::sort( aProperties.begin(), aProperties.end(), + ::chart::PropertyNameLess() ); -struct StaticDataPointInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticDataPointInfo_Initializer > -{ + return comphelper::containerToSequence( aProperties ); + }(); + return aPropHelper; }; } // anonymous namespace @@ -86,7 +62,6 @@ namespace chart { DataPoint::DataPoint( const uno::Reference< beans::XPropertySet > & rParentProperties ) : - ::property::OPropertySet( m_aMutex ), m_xParentProperties( rParentProperties ), m_xModifyEventForwarder( new ModifyEventForwarder() ), m_bNoParentPropAllowed( false ) @@ -96,7 +71,7 @@ DataPoint::DataPoint( const uno::Reference< beans::XPropertySet > & rParentPrope DataPoint::DataPoint( const DataPoint & rOther ) : impl::DataPoint_Base(rOther), - ::property::OPropertySet( rOther, m_aMutex ), + ::property::OPropertySet( rOther ), m_xModifyEventForwarder( new ModifyEventForwarder() ), m_bNoParentPropAllowed( true ) { @@ -195,7 +170,7 @@ void SAL_CALL DataPoint::setFastPropertyValue_NoBroadcast( ModifyListenerHelper::removeListener( xBroadcaster, m_xModifyEventForwarder ); } - OSL_ASSERT( rValue.getValueType().getTypeClass() == uno::TypeClass_INTERFACE ); + OSL_ASSERT( rValue.getValueTypeClass() == uno::TypeClass_INTERFACE ); if( rValue.hasValue() && (rValue >>= xBroadcaster) && xBroadcaster.is()) @@ -209,13 +184,15 @@ void SAL_CALL DataPoint::setFastPropertyValue_NoBroadcast( ::cppu::IPropertyArrayHelper & SAL_CALL DataPoint::getInfoHelper() { - return *StaticDataPointInfoHelper::get(); + return StaticDataPointInfoHelper(); } // ____ XPropertySet ____ Reference< beans::XPropertySetInfo > SAL_CALL DataPoint::getPropertySetInfo() { - return *StaticDataPointInfo::get(); + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(StaticDataPointInfoHelper() ) ); + return xPropertySetInfo; } // ____ XModifyBroadcaster ____ @@ -255,7 +232,7 @@ IMPLEMENT_FORWARD_XINTERFACE2( DataPoint, DataPoint_Base, ::property::OPropertyS // implement XServiceInfo methods basing upon getSupportedServiceNames_Static OUString SAL_CALL DataPoint::getImplementationName() { - return "com.sun.star.comp.chart.DataPoint" ; + return u"com.sun.star.comp.chart.DataPoint"_ustr ; } sal_Bool SAL_CALL DataPoint::supportsService( const OUString& rServiceName ) @@ -266,10 +243,10 @@ sal_Bool SAL_CALL DataPoint::supportsService( const OUString& rServiceName ) css::uno::Sequence< OUString > SAL_CALL DataPoint::getSupportedServiceNames() { return { - "com.sun.star.drawing.FillProperties", - "com.sun.star.chart2.DataPoint", - "com.sun.star.chart2.DataPointProperties", - "com.sun.star.beans.PropertySet" + u"com.sun.star.drawing.FillProperties"_ustr, + u"com.sun.star.chart2.DataPoint"_ustr, + u"com.sun.star.chart2.DataPointProperties"_ustr, + u"com.sun.star.beans.PropertySet"_ustr }; } |