diff options
Diffstat (limited to 'chart2/source/tools/RegressionEquation.cxx')
-rwxr-xr-x[-rw-r--r--] | chart2/source/tools/RegressionEquation.cxx | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/chart2/source/tools/RegressionEquation.cxx b/chart2/source/tools/RegressionEquation.cxx index ea16e5b7702a..747f673a9c34 100644..100755 --- a/chart2/source/tools/RegressionEquation.cxx +++ b/chart2/source/tools/RegressionEquation.cxx @@ -135,15 +135,17 @@ void lcl_AddDefaultsToMap( ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight ); } -const uno::Sequence< Property > & lcl_GetPropertySequence() +struct StaticRegressionEquationInfoHelper_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; lcl_AddPropertiesToVector( aProperties ); ::chart::LineProperties::AddPropertiesToVector( aProperties ); @@ -151,25 +153,17 @@ const uno::Sequence< Property > & lcl_GetPropertySequence() ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::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 StaticRegressionEquationInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticRegressionEquationInfoHelper_Initializer > { - static ::cppu::OPropertyArrayHelper aArrayHelper( - lcl_GetPropertySequence(), - /* bSorted = */ sal_True ); - - return aArrayHelper; -} +}; } // anonymous namespace @@ -233,7 +227,7 @@ uno::Any RegressionEquation::GetDefaultValue( sal_Int32 nHandle ) const ::cppu::IPropertyArrayHelper & SAL_CALL RegressionEquation::getInfoHelper() { - return lcl_getInfoHelper(); + return *StaticRegressionEquationInfoHelper::get(); } // ____ XPropertySet ____ @@ -248,7 +242,7 @@ Reference< beans::XPropertySetInfo > SAL_CALL if( !xInfo.is()) { xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( - lcl_getInfoHelper()); + getInfoHelper()); } return xInfo; |