diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-01-19 19:45:45 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-01-25 08:52:03 +0200 |
commit | 752cd07d085ac0aadc99bd512d49072843139032 (patch) | |
tree | 21ff2f55761b34bfdd721b5e1ed43333e8874e46 /sfx2 | |
parent | 0e7cd653ea90da388820220bf6a3eb140b57bbd6 (diff) |
InterfaceContainer2 with vector instead of Sequence
create an InterfaceContainer2 class to replace InterfaceContainer.
It uses a std::vector instead of a Sequence for the mutable listener
list, which provides far better performance.
Switch all our internal use-sites to the new class.
Change-Id: I6b56cfa511ded2395faa22e68fab3b2f16c3cb88
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/notify/globalevents.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/view/sfxbasecontroller.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/userinputinterception.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/view/viewimp.hxx | 4 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 4 |
6 files changed, 18 insertions, 19 deletions
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 2cab0ea97fc3..dee9a73bbdc1 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -63,7 +63,7 @@ #include <tools/datetime.hxx> #include <osl/mutex.hxx> #include <cppuhelper/basemutex.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/storagehelper.hxx> #include <unotools/mediadescriptor.hxx> #include <comphelper/sequence.hxx> @@ -292,7 +292,7 @@ protected: const css::uno::Reference< css::uno::XComponentContext > m_xContext; /// for notification - ::cppu::OInterfaceContainerHelper m_NotifyListeners; + ::comphelper::OInterfaceContainerHelper2 m_NotifyListeners; /// flag: false means not initialized yet, or disposed bool m_isInitialized; /// flag @@ -2274,12 +2274,11 @@ void SfxDocumentMetaData::createUserDefined() m_xUserDefined, css::uno::UNO_QUERY); if (xMB.is()) { - const css::uno::Sequence<css::uno::Reference<css::uno::XInterface> > + const std::vector<css::uno::Reference<css::uno::XInterface> > listeners(m_NotifyListeners.getElements()); - for (css::uno::Reference< css::uno::XInterface > const * iter = listeners.begin(); iter != listeners.end(); ++iter) { + for (const auto& l : listeners) { xMB->addModifyListener( - css::uno::Reference< css::util::XModifyListener >(*iter, - css::uno::UNO_QUERY)); + css::uno::Reference< css::util::XModifyListener >(l, css::uno::UNO_QUERY) ); } } } diff --git a/sfx2/source/notify/globalevents.cxx b/sfx2/source/notify/globalevents.cxx index e1f794c6dc5d..960890d0bfb9 100644 --- a/sfx2/source/notify/globalevents.cxx +++ b/sfx2/source/notify/globalevents.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/uno/Type.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <rtl/ref.hxx> #include <comphelper/enumhelper.hxx> @@ -66,8 +66,8 @@ class SfxGlobalEvents_Impl : public ModelCollectionMutexBase { css::uno::Reference< css::container::XNameReplace > m_xEvents; css::uno::Reference< css::document::XEventListener > m_xJobExecutorListener; - ::cppu::OInterfaceContainerHelper m_aLegacyListeners; - ::cppu::OInterfaceContainerHelper m_aDocumentListeners; + ::comphelper::OInterfaceContainerHelper2 m_aLegacyListeners; + ::comphelper::OInterfaceContainerHelper2 m_aDocumentListeners; TModelList m_lModels; GlobalEventConfig* pImp; diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 6d9d0b4457ef..f159814b0f8e 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -400,7 +400,7 @@ struct IMPL_SfxBaseController_DataContainer Reference< XCloseListener > m_xCloseListener ; ::sfx2::UserInputInterception m_aUserInputInterception; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer ; - ::cppu::OInterfaceContainerHelper m_aInterceptorContainer ; + ::comphelper::OInterfaceContainerHelper2 m_aInterceptorContainer ; Reference< XStatusIndicator > m_xIndicator ; SfxViewShell* m_pViewShell ; SfxBaseController* m_pController ; diff --git a/sfx2/source/view/userinputinterception.cxx b/sfx2/source/view/userinputinterception.cxx index a92b575d42d1..3e28bf6d93c5 100644 --- a/sfx2/source/view/userinputinterception.cxx +++ b/sfx2/source/view/userinputinterception.cxx @@ -23,7 +23,7 @@ #include <com/sun/star/awt/MouseButton.hpp> #include <com/sun/star/awt/KeyModifier.hpp> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/weak.hxx> #include <vcl/event.hxx> #include <vcl/window.hxx> @@ -56,8 +56,8 @@ namespace sfx2 { public: ::cppu::OWeakObject& m_rControllerImpl; - ::cppu::OInterfaceContainerHelper m_aKeyHandlers; - ::cppu::OInterfaceContainerHelper m_aMouseClickHandlers; + ::comphelper::OInterfaceContainerHelper2 m_aKeyHandlers; + ::comphelper::OInterfaceContainerHelper2 m_aMouseClickHandlers; public: UserInputInterception_Data( ::cppu::OWeakObject& _rControllerImpl, ::osl::Mutex& _rMutex ) @@ -184,7 +184,7 @@ namespace sfx2 if ( _rEvent.GetWindow() ) aEvent.Source = _rEvent.GetWindow()->GetComponentInterface(); - ::cppu::OInterfaceIteratorHelper aIterator( m_pData->m_aKeyHandlers ); + ::comphelper::OInterfaceIteratorHelper2 aIterator( m_pData->m_aKeyHandlers ); while ( aIterator.hasMoreElements() ) { Reference< XKeyHandler > xHandler( static_cast< XKeyHandler* >( aIterator.next() ) ); @@ -222,7 +222,7 @@ namespace sfx2 if ( _rEvent.GetWindow() ) aEvent.Source = _rEvent.GetWindow()->GetComponentInterface(); - ::cppu::OInterfaceIteratorHelper aIterator( m_pData->m_aMouseClickHandlers ); + ::comphelper::OInterfaceIteratorHelper2 aIterator( m_pData->m_aMouseClickHandlers ); while ( aIterator.hasMoreElements() ) { Reference< XMouseClickHandler > xHandler( static_cast< XMouseClickHandler* >( aIterator.next() ) ); diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 5780232586f1..82889e71d087 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -24,7 +24,7 @@ #include <sfx2/viewsh.hxx> #include <sfx2/viewfrm.hxx> #include <osl/mutex.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <svtools/acceleratorexecute.hxx> @@ -42,7 +42,7 @@ class SfxInPlaceClientList; struct SfxViewShell_Impl { ::osl::Mutex aMutex; - ::cppu::OInterfaceContainerHelper aInterceptorContainer; + ::comphelper::OInterfaceContainerHelper2 aInterceptorContainer; bool m_bControllerSet; SfxShellArr_Impl aArr; Size aMargin; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 56331df570db..c18e338a6938 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1891,7 +1891,7 @@ bool SfxViewShell::TryContextMenuInterception( Menu& rIn, const OUString& rMenuI aEvent.Selection.set( GetController(), uno::UNO_QUERY ); // call interceptors - ::cppu::OInterfaceIteratorHelper aIt( pImp->aInterceptorContainer ); + ::comphelper::OInterfaceIteratorHelper2 aIt( pImp->aInterceptorContainer ); while( aIt.hasMoreElements() ) { try @@ -1953,7 +1953,7 @@ bool SfxViewShell::TryContextMenuInterception( Menu& rMenu, const OUString& rMen aEvent.Selection = css::uno::Reference< css::view::XSelectionSupplier >( GetController(), css::uno::UNO_QUERY ); // call interceptors - ::cppu::OInterfaceIteratorHelper aIt( pImp->aInterceptorContainer ); + ::comphelper::OInterfaceIteratorHelper2 aIt( pImp->aInterceptorContainer ); while( aIt.hasMoreElements() ) { try |