summaryrefslogtreecommitdiff
path: root/chart2/source/model/main/Legend.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/model/main/Legend.cxx')
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/Legend.cxx33
1 files changed, 13 insertions, 20 deletions
diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx
index c1143ecdf77a..ce9dbcac9ace 100644..100755
--- a/chart2/source/model/main/Legend.cxx
+++ b/chart2/source/model/main/Legend.cxx
@@ -120,15 +120,17 @@ void lcl_AddDefaultsToMap(
::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
}
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticLegendInfoHelper_Initializer
{
- static Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+private:
+ Sequence< Property > lcl_GetPropertySequence()
{
- // get properties
::std::vector< ::com::sun::star::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::LineProperties::AddPropertiesToVector( aProperties );
@@ -136,25 +138,16 @@ const 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 StaticLegendInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticLegendInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
-
- return aArrayHelper;
-}
+};
} // anonymous namespace
@@ -334,7 +327,7 @@ Any Legend::GetDefaultValue( sal_Int32 nHandle ) const
::cppu::IPropertyArrayHelper & SAL_CALL Legend::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticLegendInfoHelper::get();
}