summaryrefslogtreecommitdiff
path: root/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
diff options
context:
space:
mode:
authorIngrid Halama [iha] <Ingrid.Halama@oracle.com>2011-01-15 17:21:37 +0100
committerIngrid Halama [iha] <Ingrid.Halama@oracle.com>2011-01-15 17:21:37 +0100
commit2ce9a356b9c14263008c3c182d5e69508d2c9107 (patch)
treef3e07ed0cf867aea00cfd1ac1bbce09ccfabe323 /chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
parentdf4eb12515da36973ad00eb2ae2b18ca303646c7 (diff)
parenta7417580c63270351601a7aef27c11247a831206 (diff)
chart46: merge with DEV300_m97
Diffstat (limited to 'chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx')
-rwxr-xr-x[-rw-r--r--]chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx124
1 files changed, 68 insertions, 56 deletions
diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
index fdfc7c094aaf..2885a79afe6d 100644..100755
--- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
@@ -56,31 +56,79 @@ namespace
static const OUString lcl_aServiceName(
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartLine" ));
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticMinMaxLineWrapperDefaults_Initializer
{
- static Sequence< Property > aPropSeq;
+ ::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()()
+ {
+ 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::NamedLineProperties::AddPropertiesToVector( aProperties );
+ //::chart::NamedLineProperties::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 StaticMinMaxLineWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticMinMaxLineWrapperPropertyArray_Initializer >
+{
+};
+
+struct StaticMinMaxLineWrapperInfoHelper_Initializer
+{
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( *StaticMinMaxLineWrapperPropertyArray::get() );
+ return &aPropHelper;
+ }
+};
+
+struct StaticMinMaxLineWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticMinMaxLineWrapperInfoHelper_Initializer >
+{
+};
+
+struct StaticMinMaxLineWrapperInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticMinMaxLineWrapperInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticMinMaxLineWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticMinMaxLineWrapperInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -94,7 +142,6 @@ namespace wrapper
MinMaxLineWrapper::MinMaxLineWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
: m_spChart2ModelContact( spChart2ModelContact )
, m_aEventListenerContainer( m_aMutex )
- , m_pPropertyArrayHelper()
, m_aWrappedLineJointProperty( C2U("LineJoint"), uno::makeAny( drawing::LineJoint_NONE ))
{
}
@@ -109,11 +156,6 @@ void SAL_CALL MinMaxLineWrapper::dispose()
{
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
-
- // /--
- MutexGuard aGuard( GetMutex());
- m_xInfo.clear();
- // \--
}
void SAL_CALL MinMaxLineWrapper::addEventListener(
@@ -132,34 +174,16 @@ void SAL_CALL MinMaxLineWrapper::removeEventListener(
::cppu::IPropertyArrayHelper& MinMaxLineWrapper::getInfoHelper()
{
- if(!m_pPropertyArrayHelper.get())
- {
- // /--
- ::osl::MutexGuard aGuard( GetMutex() );
- if(!m_pPropertyArrayHelper.get())
- {
- sal_Bool bSorted = sal_True;
- m_pPropertyArrayHelper = ::boost::shared_ptr< ::cppu::OPropertyArrayHelper >( new ::cppu::OPropertyArrayHelper( lcl_GetPropertySequence(), bSorted ) );
- }
- // \--
- }
- return *m_pPropertyArrayHelper.get();
+ return *StaticMinMaxLineWrapperInfoHelper::get();
}
//XPropertySet
uno::Reference< beans::XPropertySetInfo > SAL_CALL MinMaxLineWrapper::getPropertySetInfo()
throw (uno::RuntimeException)
{
- if( !m_xInfo.is() )
- {
- // /--
- ::osl::MutexGuard aGuard( GetMutex() );
- if( !m_xInfo.is() )
- m_xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
- // \--
- }
- return m_xInfo;
+ return *StaticMinMaxLineWrapperInfo::get();
}
+
void SAL_CALL MinMaxLineWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue )
throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
@@ -355,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;
}
@@ -383,7 +395,7 @@ uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const ::rtl::OUString&
void SAL_CALL MinMaxLineWrapper::setAllPropertiesToDefault( )
throw (uno::RuntimeException)
{
- const Sequence< beans::Property >& rPropSeq = lcl_GetPropertySequence();
+ const Sequence< beans::Property >& rPropSeq = *StaticMinMaxLineWrapperPropertyArray::get();
for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++)
{
::rtl::OUString aPropertyName( rPropSeq[nN].Name );