diff options
| author | Caolán McNamara <caolanm@redhat.com> | 2011-06-01 11:39:41 +0100 |
|---|---|---|
| committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-01 15:21:18 +0100 |
| commit | 118e0bd90213af3d1b707577d44d0c026eeec9c3 (patch) | |
| tree | b37c1eca2a8f4e1f5af413e4528e77a9b3987649 | |
| parent | 83024c48c65b751fd192e8eeb74f35c239c746a8 (diff) | |
overly static
11 files changed, 66 insertions, 44 deletions
diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx index e5fccea1c6..3de228caf4 100644 --- a/framework/inc/services/layoutmanager.hxx +++ b/framework/inc/services/layoutmanager.hxx @@ -97,6 +97,10 @@ namespace framework class ToolbarLayoutManager; class PanelManager; class GlobalSettings; + namespace detail + { + class InfoHelperBuilder; + } typedef ::cppu::WeakImplHelper8 < ::com::sun::star::lang::XServiceInfo , ::com::sun::star::frame::XLayoutManager , ::com::sun::star::awt::XWindowListener @@ -370,6 +374,8 @@ namespace framework PanelManager* m_pPanelManager; ToolbarLayoutManager* m_pToolbarManager; css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener > m_xToolbarManager; + + friend class detail::InfoHelperBuilder; }; } // namespace framework diff --git a/framework/source/fwe/classes/actiontriggerpropertyset.cxx b/framework/source/fwe/classes/actiontriggerpropertyset.cxx index 8d5589f1e2..c7cc9d450b 100644 --- a/framework/source/fwe/classes/actiontriggerpropertyset.cxx +++ b/framework/source/fwe/classes/actiontriggerpropertyset.cxx @@ -351,7 +351,7 @@ throw ( RuntimeException ) const Sequence< Property > ActionTriggerPropertySet::impl_getStaticPropertyDescriptor() { - static const Property pActionTriggerPropertys[] = + const Property pActionTriggerPropertys[] = { Property( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" )), HANDLE_COMMANDURL , ::getCppuType((::rtl::OUString*)0) , PropertyAttribute::TRANSIENT ), Property( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpURL" )), HANDLE_HELPURL , ::getCppuType((::rtl::OUString*)0) , PropertyAttribute::TRANSIENT ), @@ -361,9 +361,9 @@ const Sequence< Property > ActionTriggerPropertySet::impl_getStaticPropertyDescr }; // Use it to initialize sequence! - static const Sequence< Property > seqActionTriggerPropertyDescriptor( pActionTriggerPropertys, PROPERTYCOUNT ); + const Sequence< Property > seqActionTriggerPropertyDescriptor( pActionTriggerPropertys, PROPERTYCOUNT ); - // Return static "PropertyDescriptor" + // Return "PropertyDescriptor" return seqActionTriggerPropertyDescriptor ; } diff --git a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx index b60697d6b9..e26b76b0e7 100644 --- a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx +++ b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx @@ -295,15 +295,15 @@ throw ( RuntimeException ) const Sequence< Property > ActionTriggerSeparatorPropertySet::impl_getStaticPropertyDescriptor() { - static const Property pActionTriggerPropertys[] = + const Property pActionTriggerPropertys[] = { Property( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SeparatorType" )), HANDLE_TYPE, ::getCppuType((sal_Int16*)0), PropertyAttribute::TRANSIENT ) }; // Use it to initialize sequence! - static const Sequence< Property > seqActionTriggerPropertyDescriptor( pActionTriggerPropertys, PROPERTYCOUNT ); + const Sequence< Property > seqActionTriggerPropertyDescriptor( pActionTriggerPropertys, PROPERTYCOUNT ); - // Return static "PropertyDescriptor" + // Return "PropertyDescriptor" return seqActionTriggerPropertyDescriptor ; } diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx b/framework/source/fwi/uielement/constitemcontainer.cxx index 0b99dbd9f6..b90b664cc2 100644 --- a/framework/source/fwi/uielement/constitemcontainer.cxx +++ b/framework/source/fwi/uielement/constitemcontainer.cxx @@ -451,22 +451,22 @@ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang const com::sun::star::uno::Sequence< com::sun::star::beans::Property > ConstItemContainer::impl_getStaticPropertyDescriptor() { - // Create a new static property array to initialize sequence! + // Create a property array to initialize sequence! // Table of all predefined properties of this class. Its used from OPropertySetHelper-class! // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!! // It's necessary for methods of OPropertySetHelper. // ATTENTION: // YOU MUST SORT FOLLOW TABLE BY NAME ALPHABETICAL !!! - static const com::sun::star::beans::Property pProperties[] = + const com::sun::star::beans::Property pProperties[] = { com::sun::star::beans::Property( PROPNAME_UINAME, PROPHANDLE_UINAME , ::getCppuType((const rtl::OUString*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ) }; // Use it to initialize sequence! - static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, PROPCOUNT ); - // Return static "PropertyDescriptor" + const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, PROPCOUNT ); + // Return "PropertyDescriptor" return lPropertyDescriptor; } diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx b/framework/source/fwi/uielement/rootitemcontainer.cxx index 2cca964d2d..fbc4e35585 100644 --- a/framework/source/fwi/uielement/rootitemcontainer.cxx +++ b/framework/source/fwi/uielement/rootitemcontainer.cxx @@ -440,22 +440,22 @@ throw (::com::sun::star::uno::RuntimeException) const com::sun::star::uno::Sequence< com::sun::star::beans::Property > RootItemContainer::impl_getStaticPropertyDescriptor() { - // Create a new static property array to initialize sequence! + // Create a property array to initialize sequence! // Table of all predefined properties of this class. Its used from OPropertySetHelper-class! // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!! // It's necessary for methods of OPropertySetHelper. // ATTENTION: // YOU MUST SORT FOLLOW TABLE BY NAME ALPHABETICAL !!! - static const com::sun::star::beans::Property pProperties[] = + const com::sun::star::beans::Property pProperties[] = { com::sun::star::beans::Property( PROPNAME_UINAME, PROPHANDLE_UINAME , ::getCppuType((const rtl::OUString*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ) }; // Use it to initialize sequence! - static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, PROPCOUNT ); - // Return static "PropertyDescriptor" + const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, PROPCOUNT ); + // Return "PropertyDescriptor" return lPropertyDescriptor; } diff --git a/framework/source/helper/uiconfigelementwrapperbase.cxx b/framework/source/helper/uiconfigelementwrapperbase.cxx index 9b8c031c0c..df353f86c8 100644 --- a/framework/source/helper/uiconfigelementwrapperbase.cxx +++ b/framework/source/helper/uiconfigelementwrapperbase.cxx @@ -472,14 +472,14 @@ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CA const com::sun::star::uno::Sequence< com::sun::star::beans::Property > UIConfigElementWrapperBase::impl_getStaticPropertyDescriptor() { - // Create a new static property array to initialize sequence! + // Create property array to initialize sequence! // Table of all predefined properties of this class. Its used from OPropertySetHelper-class! // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!! // It's necessary for methods of OPropertySetHelper. // ATTENTION: // YOU MUST SORT FOLLOW TABLE BY NAME ALPHABETICAL !!! - static const com::sun::star::beans::Property pProperties[] = + const com::sun::star::beans::Property pProperties[] = { com::sun::star::beans::Property( UIELEMENT_PROPNAME_CONFIGLISTENER, UIELEMENT_PROPHANDLE_CONFIGLISTENER , ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), com::sun::star::beans::Property( UIELEMENT_PROPNAME_CONFIGSOURCE , UIELEMENT_PROPHANDLE_CONFIGSOURCE , ::getCppuType((const Reference< ::com::sun::star::ui::XUIConfigurationManager >*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), @@ -491,8 +491,8 @@ const com::sun::star::uno::Sequence< com::sun::star::beans::Property > UIConfigE com::sun::star::beans::Property( UIELEMENT_PROPNAME_XMENUBAR , UIELEMENT_PROPHANDLE_XMENUBAR , ::getCppuType((const Reference< com::sun::star::awt::XMenuBar >*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ) }; // Use it to initialize sequence! - static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, UIELEMENT_PROPCOUNT ); - // Return static "PropertyDescriptor" + const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, UIELEMENT_PROPCOUNT ); + // Return "PropertyDescriptor" return lPropertyDescriptor; } void SAL_CALL UIConfigElementWrapperBase::setSettings( const Reference< XIndexAccess >& xSettings ) throw ( RuntimeException ) diff --git a/framework/source/helper/uielementwrapperbase.cxx b/framework/source/helper/uielementwrapperbase.cxx index 6923932c15..0e257934a5 100644 --- a/framework/source/helper/uielementwrapperbase.cxx +++ b/framework/source/helper/uielementwrapperbase.cxx @@ -261,22 +261,22 @@ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CA const com::sun::star::uno::Sequence< com::sun::star::beans::Property > UIElementWrapperBase::impl_getStaticPropertyDescriptor() { - // Create a new static property array to initialize sequence! + // Create a property array to initialize sequence! // Table of all predefined properties of this class. Its used from OPropertySetHelper-class! // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!! // It's necessary for methods of OPropertySetHelper. // ATTENTION: // YOU MUST SORT FOLLOW TABLE BY NAME ALPHABETICAL !!! - static const com::sun::star::beans::Property pProperties[] = + const com::sun::star::beans::Property pProperties[] = { com::sun::star::beans::Property( UIELEMENT_PROPNAME_FRAME , UIELEMENT_PROPHANDLE_FRAME , ::getCppuType((Reference< XFrame >*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ), com::sun::star::beans::Property( UIELEMENT_PROPNAME_RESOURCEURL , UIELEMENT_PROPHANDLE_RESOURCEURL , ::getCppuType((sal_Int16*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ), com::sun::star::beans::Property( UIELEMENT_PROPNAME_TYPE , UIELEMENT_PROPHANDLE_TYPE , ::getCppuType((const ::rtl::OUString*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ) }; // Use it to initialize sequence! - static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, UIELEMENT_PROPCOUNT ); - // Return static "PropertyDescriptor" + const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, UIELEMENT_PROPCOUNT ); + // Return "PropertyDescriptor" return lPropertyDescriptor; } diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 603dd2c8b7..1ba2f98cb3 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -90,6 +90,7 @@ #include <comphelper/mediadescriptor.hxx> #include <comphelper/uno3.hxx> #include <rtl/logfile.hxx> +#include <rtl/instance.hxx> #include <unotools/cmdoptions.hxx> #include <algorithm> @@ -3212,24 +3213,39 @@ void SAL_CALL LayoutManager::getFastPropertyValue( uno::Any& aValue, sal_Int32 n LayoutManager_PBase::getFastPropertyValue( aValue, nHandle ); } -::cppu::IPropertyArrayHelper& SAL_CALL LayoutManager::getInfoHelper() +namespace detail { - static ::cppu::OPropertyArrayHelper* pInfoHelper = NULL; - - if( pInfoHelper == NULL ) + class InfoHelperBuilder : private ::boost::noncopyable { - osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; - - if( pInfoHelper == NULL ) + private: + ::cppu::OPropertyArrayHelper *m_pInfoHelper; + public: + InfoHelperBuilder(const LayoutManager &rManager) { uno::Sequence< beans::Property > aProperties; - describeProperties( aProperties ); - static ::cppu::OPropertyArrayHelper aInfoHelper( aProperties, sal_True ); - pInfoHelper = &aInfoHelper; + rManager.describeProperties(aProperties); + m_pInfoHelper = new ::cppu::OPropertyArrayHelper(aProperties, sal_True); + } + ~InfoHelperBuilder() + { + delete m_pInfoHelper; } - } - return(*pInfoHelper); + ::cppu::OPropertyArrayHelper& getHelper() { return *m_pInfoHelper; } + }; +} +namespace +{ + struct theInfoHelper : + public rtl::StaticWithArg< detail::InfoHelperBuilder, LayoutManager, + theInfoHelper > + { + }; +} + +::cppu::IPropertyArrayHelper& SAL_CALL LayoutManager::getInfoHelper() +{ + return theInfoHelper::get(*this).getHelper(); } uno::Reference< beans::XPropertySetInfo > SAL_CALL LayoutManager::getPropertySetInfo() throw (uno::RuntimeException) diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 80fdf7fceb..efe2f17b7c 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -3307,13 +3307,13 @@ void SAL_CALL AutoRecovery::getFastPropertyValue(css::uno::Any& aValue , //----------------------------------------------- const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor() { - static const css::beans::Property pPropertys[] = + const css::beans::Property pPropertys[] = { css::beans::Property( AUTORECOVERY_PROPNAME_CRASHED , AUTORECOVERY_PROPHANDLE_CRASHED , ::getBooleanCppuType() , css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY ), css::beans::Property( AUTORECOVERY_PROPNAME_EXISTS_RECOVERYDATA, AUTORECOVERY_PROPHANDLE_EXISTS_RECOVERYDATA, ::getBooleanCppuType() , css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY ), css::beans::Property( AUTORECOVERY_PROPNAME_EXISTS_SESSIONDATA , AUTORECOVERY_PROPHANDLE_EXISTS_SESSIONDATA , ::getBooleanCppuType() , css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY ), }; - static const css::uno::Sequence< css::beans::Property > lPropertyDescriptor(pPropertys, AUTORECOVERY_PROPCOUNT); + const css::uno::Sequence< css::beans::Property > lPropertyDescriptor(pPropertys, AUTORECOVERY_PROPCOUNT); return lPropertyDescriptor; } diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 0f43a7b3a0..43fde5a0ba 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -1781,14 +1781,14 @@ css::uno::Reference< css::lang::XComponent > Desktop::impl_getFrameComponent( co *//*-*************************************************************************************************************/ const css::uno::Sequence< css::beans::Property > Desktop::impl_getStaticPropertyDescriptor() { - // Create a new static property array to initialize sequence! + // Create a property array to initialize sequence! // Table of all predefined properties of this class. Its used from OPropertySetHelper-class! // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!! // It's necessary for methods of OPropertySetHelper. // ATTENTION: // YOU MUST SORT FOLLOW TABLE BY NAME ALPHABETICAL !!! - static const css::beans::Property pProperties[] = + const css::beans::Property pProperties[] = { css::beans::Property( DESKTOP_PROPNAME_ACTIVEFRAME , DESKTOP_PROPHANDLE_ACTIVEFRAME , ::getCppuType((const css::uno::Reference< css::lang::XComponent >*)NULL) , css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY ), css::beans::Property( DESKTOP_PROPNAME_DISPATCHRECORDERSUPPLIER , DESKTOP_PROPHANDLE_DISPATCHRECORDERSUPPLIER, ::getCppuType((const css::uno::Reference< css::frame::XDispatchRecorderSupplier >*)NULL), css::beans::PropertyAttribute::TRANSIENT ), @@ -1797,8 +1797,8 @@ const css::uno::Sequence< css::beans::Property > Desktop::impl_getStaticProperty css::beans::Property( DESKTOP_PROPNAME_TITLE , DESKTOP_PROPHANDLE_TITLE , ::getCppuType((const ::rtl::OUString*)NULL) , css::beans::PropertyAttribute::TRANSIENT ), }; // Use it to initialize sequence! - static const css::uno::Sequence< css::beans::Property > lPropertyDescriptor( pProperties, DESKTOP_PROPCOUNT ); - // Return static "PropertyDescriptor" + const css::uno::Sequence< css::beans::Property > lPropertyDescriptor( pProperties, DESKTOP_PROPCOUNT ); + // Return "PropertyDescriptor" return lPropertyDescriptor; } diff --git a/framework/source/tabwin/tabwindow.cxx b/framework/source/tabwin/tabwindow.cxx index a898a44555..46680e456c 100644 --- a/framework/source/tabwin/tabwindow.cxx +++ b/framework/source/tabwin/tabwindow.cxx @@ -947,14 +947,14 @@ throw ( css::uno::RuntimeException ) const css::uno::Sequence< css::beans::Property > TabWindow::impl_getStaticPropertyDescriptor() { - // Create a new static property array to initialize sequence! + // Create property array to initialize sequence! // Table of all predefined properties of this class. Its used from OPropertySetHelper-class! // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!! // It's necessary for methods of OPropertySetHelper. // ATTENTION: // YOU MUST SORT FOLLOW TABLE BY NAME ALPHABETICAL !!! - static const com::sun::star::beans::Property pProperties[] = + const com::sun::star::beans::Property pProperties[] = { com::sun::star::beans::Property( TABWINDOW_PROPNAME_PARENTWINDOW, TABWINDOW_PROPHANDLE_PARENTWINDOW, @@ -965,9 +965,9 @@ const css::uno::Sequence< css::beans::Property > TabWindow::impl_getStaticProper ::getCppuType((const css::uno::Reference< css::awt::XWindow >*)NULL), com::sun::star::beans::PropertyAttribute::READONLY ) }; // Use it to initialize sequence! - static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, TABWINDOW_PROPCOUNT ); + const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, TABWINDOW_PROPCOUNT ); - // Return static "PropertyDescriptor" + // Return "PropertyDescriptor" return lPropertyDescriptor; } |
