diff options
Diffstat (limited to 'chart2/source/model/main/StockBar.cxx')
-rwxr-xr-x[-rw-r--r--] | chart2/source/model/main/StockBar.cxx | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/chart2/source/model/main/StockBar.cxx b/chart2/source/model/main/StockBar.cxx index 9a3c7f8ab623..73639211677f 100644..100755 --- a/chart2/source/model/main/StockBar.cxx +++ b/chart2/source/model/main/StockBar.cxx @@ -57,30 +57,33 @@ namespace static const ::rtl::OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.StockBar" )); -const uno::Sequence< Property > & lcl_GetPropertySequence() +struct StaticStockBarInfoHelper_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 ); ::chart::FillProperties::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; -} +}; + +struct StaticStockBarInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticStockBarInfoHelper_Initializer > +{ +}; void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) @@ -89,15 +92,6 @@ void lcl_AddDefaultsToMap( ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff ); // white } -::cppu::IPropertyArrayHelper & lcl_getInfoHelper() -{ - static ::cppu::OPropertyArrayHelper aArrayHelper( - lcl_GetPropertySequence(), - /* bSorted = */ sal_True ); - - return aArrayHelper; -} - } // anonymous namespace // ____________________________________________________________ @@ -170,7 +164,7 @@ uno::Any StockBar::GetDefaultValue( sal_Int32 nHandle ) const ::cppu::IPropertyArrayHelper & SAL_CALL StockBar::getInfoHelper() { - return lcl_getInfoHelper(); + return *StaticStockBarInfoHelper::get(); } // ____ XPropertySet ____ @@ -185,7 +179,7 @@ Reference< beans::XPropertySetInfo > SAL_CALL if( !xInfo.is()) { xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( - lcl_getInfoHelper()); + getInfoHelper()); } return xInfo; |