diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-03-18 15:33:40 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-03-18 15:33:40 +0100 |
commit | e6064484fae8aa2797f86c68e9a8d23d2e213367 (patch) | |
tree | db2f4d140efca43ab01dee4fc053fff0829d106b /chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx | |
parent | 9e0a09e89c38774dd1af902387a8b25de158b634 (diff) | |
parent | 378c75a798c8baa34cb26e7f07fe28cb5ee2a85f (diff) |
Merge remote-tracking branch 'origin/integration/dev300_m101'
Conflicts:
chart2/source/controller/main/UndoManager.cxx
chart2/source/tools/RegressionCurveHelper.cxx
sc/inc/address.hxx
sc/inc/attrib.hxx
sc/inc/bigrange.hxx
sc/inc/callform.hxx
sc/inc/cell.hxx
sc/inc/chartarr.hxx
sc/inc/chartlis.hxx
sc/inc/chgtrack.hxx
sc/inc/collect.hxx
sc/inc/compiler.hxx
sc/inc/detdata.hxx
sc/inc/document.hxx
sc/inc/fillinfo.hxx
sc/inc/olinetab.hxx
sc/inc/prnsave.hxx
sc/inc/queryparam.hxx
sc/inc/sc.hrc
sc/inc/scabstdlg.hxx
sc/inc/table.hxx
sc/inc/validat.hxx
sc/inc/zforauto.hxx
sc/source/core/data/documen2.cxx
sc/source/core/data/document.cxx
sc/source/core/data/table1.cxx
sc/source/core/tool/address.cxx
sc/source/core/tool/token.cxx
sc/source/filter/excel/frmbase.cxx
sc/source/filter/excel/impop.cxx
sc/source/filter/excel/xename.cxx
sc/source/filter/inc/formel.hxx
sc/source/filter/inc/xename.hxx
sc/source/filter/xml/xmlexprt.cxx
sc/source/filter/xml/xmlnexpi.cxx
sc/source/filter/xml/xmlnexpi.hxx
sc/source/ui/dbgui/filtdlg.cxx
sc/source/ui/inc/docfunc.hxx
sc/source/ui/inc/namedlg.hxx
sc/source/ui/namedlg/namedlg.cxx
sc/source/ui/src/namedlg.src
Diffstat (limited to 'chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx')
-rwxr-xr-x[-rw-r--r--] | chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx | 116 |
1 files changed, 67 insertions, 49 deletions
diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx index e803e0033d51..a972e61a6119 100644..100755 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx @@ -57,30 +57,80 @@ 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::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 > +{ +}; + +struct StaticUpDownBarWrapperInfoHelper_Initializer +{ + ::cppu::OPropertyArrayHelper* operator()() + { + static ::cppu::OPropertyArrayHelper aPropHelper( *StaticUpDownBarWrapperPropertyArray::get() ); + return &aPropHelper; + } +}; + +struct StaticUpDownBarWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticUpDownBarWrapperInfoHelper_Initializer > +{ +}; + +struct StaticUpDownBarWrapperInfo_Initializer +{ + uno::Reference< beans::XPropertySetInfo >* operator()() + { + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticUpDownBarWrapperInfoHelper::get() ) ); + return &xPropertySetInfo; + } +}; + +struct StaticUpDownBarWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticUpDownBarWrapperInfo_Initializer > +{ +}; + +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 @@ -96,8 +146,6 @@ UpDownBarWrapper::UpDownBarWrapper( : m_spChart2ModelContact( spChart2ModelContact ) , m_aEventListenerContainer( m_aMutex ) , m_aPropertySetName( bUp ? C2U("WhiteDay") : C2U("BlackDay") ) - , m_xInfo(0) - , m_pPropertyArrayHelper() { } @@ -111,9 +159,6 @@ void SAL_CALL UpDownBarWrapper::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 UpDownBarWrapper::addEventListener( @@ -132,29 +177,14 @@ void SAL_CALL UpDownBarWrapper::removeEventListener( ::cppu::IPropertyArrayHelper& UpDownBarWrapper::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 *StaticUpDownBarWrapperInfoHelper::get(); } //XPropertySet uno::Reference< beans::XPropertySetInfo > SAL_CALL UpDownBarWrapper::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 *StaticUpDownBarWrapperInfo::get(); } void SAL_CALL UpDownBarWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) @@ -308,26 +338,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; } @@ -336,7 +354,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 ); |