summaryrefslogtreecommitdiff
path: root/chart2/source/controller/chartapiwrapper
diff options
context:
space:
mode:
authorIngrid Halama <iha@openoffice.org>2010-10-07 16:21:04 +0200
committerIngrid Halama <iha@openoffice.org>2010-10-07 16:21:04 +0200
commit43a5cf89dfeecfead56d9b2ee8e1413941fa40bf (patch)
treef2c4258184ec2645365a38538ad90afc6dfb5b67 /chart2/source/controller/chartapiwrapper
parent6d0405c480b42b831a26558eecea994df10f804d (diff)
chart49: #i113103# use corrected double-checked locking pattern for default properties
Diffstat (limited to 'chart2/source/controller/chartapiwrapper')
-rwxr-xr-xchart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx39
-rwxr-xr-xchart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx41
2 files changed, 47 insertions, 33 deletions
diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
index 7e84a22ca..802f2657d 100755
--- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
@@ -56,6 +56,25 @@ namespace
static const OUString lcl_aServiceName(
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartLine" ));
+struct StaticMinMaxLineWrapperDefaults_Initializer
+{
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::LineProperties::AddDefaultsToMap( rOutMap );
+ }
+};
+
+struct StaticMinMaxLineWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticMinMaxLineWrapperDefaults_Initializer >
+{
+};
+
struct StaticMinMaxLineWrapperPropertyArray_Initializer
{
Sequence< Property >* operator()()
@@ -360,26 +379,14 @@ void SAL_CALL MinMaxLineWrapper::setPropertyToDefault( const ::rtl::OUString& rP
{
this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) );
}
+
uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName )
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
- static tPropertyValueMap aStaticDefaults;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aStaticDefaults.size() )
- {
- LineProperties::AddDefaultsToMap( aStaticDefaults );
- }
-
- sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
+ const tPropertyValueMap& rStaticDefaults = *StaticMinMaxLineWrapperDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( getInfoHelper().getHandleByName( rPropertyName ) ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
}
diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
index 13b7e3ca1..791f0152e 100755
--- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
@@ -113,6 +113,26 @@ struct StaticUpDownBarWrapperInfo : public rtl::StaticAggregate< uno::Reference<
{
};
+struct StaticUpDownBarWrapperDefaults_Initializer
+{
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::LineProperties::AddDefaultsToMap( rOutMap );
+ ::chart::FillProperties::AddDefaultsToMap( rOutMap );
+ }
+};
+
+struct StaticUpDownBarWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticUpDownBarWrapperDefaults_Initializer >
+{
+};
+
} // anonymous namespace
// --------------------------------------------------------------------------------
@@ -323,27 +343,14 @@ void SAL_CALL UpDownBarWrapper::setPropertyToDefault( const ::rtl::OUString& rPr
{
this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) );
}
+
uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName )
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
- static tPropertyValueMap aStaticDefaults;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aStaticDefaults.size() )
- {
- LineProperties::AddDefaultsToMap( aStaticDefaults );
- FillProperties::AddDefaultsToMap( aStaticDefaults );
- }
-
- sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
+ const tPropertyValueMap& rStaticDefaults = *StaticUpDownBarWrapperDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( getInfoHelper().getHandleByName( rPropertyName ) ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
}