diff options
Diffstat (limited to 'chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx')
-rwxr-xr-x[-rw-r--r--] | chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx index 338131c4f973..241125169500 100644..100755 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx @@ -57,32 +57,34 @@ namespace static const OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartArea" )); -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticUpDownBarWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - // /-- - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; ::chart::LineProperties::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); -// ::chart::NamedProperties::AddPropertiesToVector( aProperties ); + //::chart::NamedProperties::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 StaticUpDownBarWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticUpDownBarWrapperPropertyArray_Initializer > +{ +}; } // anonymous namespace @@ -143,7 +145,7 @@ void SAL_CALL UpDownBarWrapper::removeEventListener( if(!m_pPropertyArrayHelper.get()) { sal_Bool bSorted = sal_True; - m_pPropertyArrayHelper = ::boost::shared_ptr< ::cppu::OPropertyArrayHelper >( new ::cppu::OPropertyArrayHelper( lcl_GetPropertySequence(), bSorted ) ); + m_pPropertyArrayHelper = ::boost::shared_ptr< ::cppu::OPropertyArrayHelper >( new ::cppu::OPropertyArrayHelper( *StaticUpDownBarWrapperPropertyArray::get(), bSorted ) ); } // \-- } @@ -349,7 +351,7 @@ uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const ::rtl::OUString& r void SAL_CALL UpDownBarWrapper::setAllPropertiesToDefault( ) throw (uno::RuntimeException) { - const Sequence< beans::Property >& rPropSeq = lcl_GetPropertySequence(); + const Sequence< beans::Property >& rPropSeq = *StaticUpDownBarWrapperPropertyArray::get(); for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++) { ::rtl::OUString aPropertyName( rPropSeq[nN].Name ); |