diff options
Diffstat (limited to 'chart2/source/tools/RegressionCurveModel.cxx')
-rwxr-xr-x[-rw-r--r--] | chart2/source/tools/RegressionCurveModel.cxx | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/chart2/source/tools/RegressionCurveModel.cxx b/chart2/source/tools/RegressionCurveModel.cxx index cf5be998308e..02c3e164e742 100644..100755 --- a/chart2/source/tools/RegressionCurveModel.cxx +++ b/chart2/source/tools/RegressionCurveModel.cxx @@ -63,37 +63,30 @@ static const OUString lcl_aImplementationName_Potential( static const OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.RegressionCurve" )); -const uno::Sequence< Property > & lcl_GetPropertySequence() +struct StaticRegressionCurveInfoHelper_Initializer { - static uno::Sequence< Property > aPropSeq; + ::cppu::OPropertyArrayHelper* operator()() + { + static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); + return &aPropHelper; + } - // /-- - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + uno::Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; ::chart::LineProperties::AddPropertiesToVector( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } +}; - return aPropSeq; -} - -::cppu::IPropertyArrayHelper & lcl_getInfoHelper() +struct StaticRegressionCurveInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticRegressionCurveInfoHelper_Initializer > { - static ::cppu::OPropertyArrayHelper aArrayHelper( - lcl_GetPropertySequence(), - /* bSorted = */ sal_True ); - - return aArrayHelper; -} +}; } // anonymous namespace @@ -262,7 +255,7 @@ uno::Any RegressionCurveModel::GetDefaultValue( sal_Int32 nHandle ) const ::cppu::IPropertyArrayHelper & SAL_CALL RegressionCurveModel::getInfoHelper() { - return lcl_getInfoHelper(); + return *StaticRegressionCurveInfoHelper::get(); } |