diff options
60 files changed, 464 insertions, 199 deletions
diff --git a/UnoControls/inc/basecontainercontrol.hxx b/UnoControls/inc/basecontainercontrol.hxx index fe0d87f2d8cb..507dd2be394a 100644 --- a/UnoControls/inc/basecontainercontrol.hxx +++ b/UnoControls/inc/basecontainercontrol.hxx @@ -24,6 +24,7 @@ #include "basecontrol.hxx" #include <com/sun/star/awt/XControlContainer.hpp> +#include <comphelper/multicontainer2.hxx> namespace unocontrols { @@ -144,7 +145,7 @@ private: // list of pointer of "struct IMPL_ControlInfo" to hold child-controls ::std::vector< IMPL_ControlInfo > maControlInfoList; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListeners; + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListeners; }; diff --git a/UnoControls/inc/multiplexer.hxx b/UnoControls/inc/multiplexer.hxx index 3fc19c126114..58bd1563fb0a 100644 --- a/UnoControls/inc/multiplexer.hxx +++ b/UnoControls/inc/multiplexer.hxx @@ -28,7 +28,7 @@ #include <com/sun/star/awt/XFocusListener.hpp> #include <cppuhelper/weak.hxx> #include <cppuhelper/weakref.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> namespace com::sun::star::awt { class XWindow; } namespace com::sun::star::awt { struct KeyEvent; } @@ -223,7 +223,7 @@ private: ::osl::Mutex m_aMutex; css::uno::Reference< css::awt::XWindow > m_xPeer; /// The source of the events. Normally this is the peer object. css::uno::WeakReference< css::awt::XWindow > m_xControl; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerHolder; + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerHolder; }; diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx index dbcfb77bbc2e..a440505149ed 100644 --- a/UnoControls/source/base/basecontainercontrol.cxx +++ b/UnoControls/source/base/basecontainercontrol.cxx @@ -219,7 +219,7 @@ void SAL_CALL BaseContainerControl::addControl ( const OUString& rName, const Re } // Send message to all listener - OInterfaceContainerHelper* pInterfaceContainer = m_aListeners.getContainer( cppu::UnoType<XContainerListener>::get()); + comphelper::OInterfaceContainerHelper2* pInterfaceContainer = m_aListeners.getContainer( cppu::UnoType<XContainerListener>::get()); if (!pInterfaceContainer) return; @@ -231,7 +231,7 @@ void SAL_CALL BaseContainerControl::addControl ( const OUString& rName, const Re aEvent.Element <<= rControl; // Get all listener - OInterfaceIteratorHelper aIterator (*pInterfaceContainer); + comphelper::OInterfaceIteratorHelper2 aIterator (*pInterfaceContainer); // Send event while ( aIterator.hasMoreElements() ) @@ -266,7 +266,7 @@ void SAL_CALL BaseContainerControl::removeControl ( const Reference< XControl > maControlInfoList.erase(maControlInfoList.begin() + n); // Send message to all other listener - OInterfaceContainerHelper * pInterfaceContainer = m_aListeners.getContainer( cppu::UnoType<XContainerListener>::get()); + comphelper::OInterfaceContainerHelper2 * pInterfaceContainer = m_aListeners.getContainer( cppu::UnoType<XContainerListener>::get()); if (pInterfaceContainer) { @@ -275,7 +275,7 @@ void SAL_CALL BaseContainerControl::removeControl ( const Reference< XControl > aEvent.Source = *this; aEvent.Element <<= rControl; - OInterfaceIteratorHelper aIterator (*pInterfaceContainer); + comphelper::OInterfaceIteratorHelper2 aIterator (*pInterfaceContainer); while ( aIterator.hasMoreElements() ) { diff --git a/UnoControls/source/base/multiplexer.cxx b/UnoControls/source/base/multiplexer.cxx index 6e737c7f9b26..c7bf65c170c1 100644 --- a/UnoControls/source/base/multiplexer.cxx +++ b/UnoControls/source/base/multiplexer.cxx @@ -38,11 +38,11 @@ namespace unocontrols { #define MULTIPLEX( INTERFACE, METHOD, EVENTTYP, EVENT ) \ \ /* First get all interfaces from container with right type.*/ \ - OInterfaceContainerHelper* pContainer = m_aListenerHolder.getContainer( cppu::UnoType<INTERFACE>::get() ); \ + comphelper::OInterfaceContainerHelper2* pContainer = m_aListenerHolder.getContainer( cppu::UnoType<INTERFACE>::get() ); \ /* Do the follow only, if elements in container exist.*/ \ if( !pContainer ) \ return; \ - OInterfaceIteratorHelper aIterator( *pContainer ); \ + comphelper::OInterfaceIteratorHelper2 aIterator( *pContainer ); \ EVENTTYP aLocalEvent = EVENT; \ /* Remark: The control is the event source not the peer.*/ \ /* We must change the source of the event. */ \ @@ -156,7 +156,7 @@ void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer ) if( m_xPeer.is() ) { // get all types from the listener added to the peer - const Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); + const std::vector< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); // loop over all listener types and remove the listeners from the peer for( const auto& rContainedType : aContainedTypes ) impl_unadviseFromPeer( m_xPeer, rContainedType ); @@ -165,7 +165,7 @@ void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer ) if( m_xPeer.is() ) { // get all types from the listener added to the peer - const Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); + const std::vector< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); // loop over all listener types and add the listeners to the peer for( const auto& rContainedType : aContainedTypes ) impl_adviseToPeer( m_xPeer, rContainedType ); diff --git a/UnoControls/source/controls/OConnectionPointContainerHelper.cxx b/UnoControls/source/controls/OConnectionPointContainerHelper.cxx index d0e9d30b611b..bf687a0df5d6 100644 --- a/UnoControls/source/controls/OConnectionPointContainerHelper.cxx +++ b/UnoControls/source/controls/OConnectionPointContainerHelper.cxx @@ -22,6 +22,7 @@ #include <OConnectionPointHelper.hxx> #include <cppuhelper/queryinterface.hxx> +#include <comphelper/sequence.hxx> // namespaces @@ -94,7 +95,7 @@ void SAL_CALL OConnectionPointContainerHelper::release() noexcept Sequence< Type > SAL_CALL OConnectionPointContainerHelper::getConnectionPointTypes() { // Container is threadsafe himself ! - return m_aMultiTypeContainer.getContainedTypes(); + return comphelper::containerToSequence(m_aMultiTypeContainer.getContainedTypes()); } // XConnectionPointContainer @@ -105,7 +106,7 @@ Reference< XConnectionPoint > SAL_CALL OConnectionPointContainerHelper::queryCon Reference< XConnectionPoint > xConnectionPoint; // Get all elements of the container, which have the searched type. - OInterfaceContainerHelper* pSpecialContainer = m_aMultiTypeContainer.getContainer( aType ); + comphelper::OInterfaceContainerHelper2* pSpecialContainer = m_aMultiTypeContainer.getContainer( aType ); if ( pSpecialContainer && pSpecialContainer->getLength() > 0 ) { // Ready for multithreading diff --git a/UnoControls/source/controls/OConnectionPointHelper.cxx b/UnoControls/source/controls/OConnectionPointHelper.cxx index f44aef51aab1..b6ddaaa513a0 100644 --- a/UnoControls/source/controls/OConnectionPointHelper.cxx +++ b/UnoControls/source/controls/OConnectionPointHelper.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/lang/InvalidListenerException.hpp> #include <cppuhelper/queryinterface.hxx> +#include <comphelper/sequence.hxx> // namespaces @@ -188,13 +189,13 @@ Sequence< Reference< XInterface > > SAL_CALL OConnectionPointHelper::getConnecti // Set default return value, if method failed. Sequence< Reference< XInterface > > seqReturnConnections; // Get reference to private member of OConnectionPointHelperContainer! - OMultiTypeInterfaceContainerHelper& aSharedContainer = m_pContainerImplementation->impl_getMultiTypeContainer(); + comphelper::OMultiTypeInterfaceContainerHelper2& aSharedContainer = m_pContainerImplementation->impl_getMultiTypeContainer(); // Get pointer to specialized container which hold all interfaces of searched type. - OInterfaceContainerHelper* pSpecialContainer = aSharedContainer.getContainer( m_aInterfaceType ); + comphelper::OInterfaceContainerHelper2* pSpecialContainer = aSharedContainer.getContainer( m_aInterfaceType ); // Get elements of searched type, if some else exist. if ( pSpecialContainer != nullptr ) { - seqReturnConnections = pSpecialContainer->getElements(); + seqReturnConnections = comphelper::containerToSequence(pSpecialContainer->getElements()); } // Don't forget this! impl_UnlockContainer(); diff --git a/UnoControls/source/inc/OConnectionPointContainerHelper.hxx b/UnoControls/source/inc/OConnectionPointContainerHelper.hxx index 54eed76e6ce1..c1e46b457f79 100644 --- a/UnoControls/source/inc/OConnectionPointContainerHelper.hxx +++ b/UnoControls/source/inc/OConnectionPointContainerHelper.hxx @@ -21,7 +21,7 @@ #include <com/sun/star/lang/XConnectionPointContainer.hpp> #include <cppuhelper/weak.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> namespace com::sun::star::lang { class XConnectionPoint; } @@ -92,11 +92,11 @@ public: // Is necessary to get container member at OConnectionPoint-instance. // Impl methods are not threadsafe! // "Parent" function must do this. - ::cppu::OMultiTypeInterfaceContainerHelper& impl_getMultiTypeContainer() { return m_aMultiTypeContainer; } + comphelper::OMultiTypeInterfaceContainerHelper2& impl_getMultiTypeContainer() { return m_aMultiTypeContainer; } private: ::osl::Mutex& m_aSharedMutex; - ::cppu::OMultiTypeInterfaceContainerHelper m_aMultiTypeContainer; // Container to hold listener + comphelper::OMultiTypeInterfaceContainerHelper2 m_aMultiTypeContainer; // Container to hold listener }; } diff --git a/avmedia/source/macavf/window.hxx b/avmedia/source/macavf/window.hxx index cfaae6f47d3b..14fdaf389811 100644 --- a/avmedia/source/macavf/window.hxx +++ b/avmedia/source/macavf/window.hxx @@ -21,7 +21,7 @@ #include "macavfcommon.hxx" #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/multicontainer2.hxx> #include <com/sun/star/media/XPlayerWindow.hpp> @@ -92,7 +92,7 @@ public: private: ::osl::Mutex maMutex; - ::cppu::OMultiTypeInterfaceContainerHelper maListeners; + comphelper::OMultiTypeInterfaceContainerHelper2 maListeners; css::media::ZoomLevel meZoomLevel; Player& mrPlayer; int mnPointerType; diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx index b7aa28ba26d5..4f4ef47456e6 100644 --- a/avmedia/source/win/window.cxx +++ b/avmedia/source/win/window.cxx @@ -423,11 +423,11 @@ void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventLis void Window::fireMousePressedEvent( const css::awt::MouseEvent& rEvt ) { - ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( cppu::UnoType<awt::XMouseListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = maListeners.getContainer( cppu::UnoType<awt::XMouseListener>::get()); if( pContainer ) { - ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); + comphelper::OInterfaceIteratorHelper2 aIter( *pContainer ); while( aIter.hasMoreElements() ) static_cast< awt::XMouseListener* >( aIter.next() )->mousePressed( rEvt ); @@ -436,11 +436,11 @@ void Window::fireMousePressedEvent( const css::awt::MouseEvent& rEvt ) void Window::fireMouseReleasedEvent( const css::awt::MouseEvent& rEvt ) { - ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( cppu::UnoType<awt::XMouseListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = maListeners.getContainer( cppu::UnoType<awt::XMouseListener>::get()); if( pContainer ) { - ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); + comphelper::OInterfaceIteratorHelper2 aIter( *pContainer ); while( aIter.hasMoreElements() ) static_cast< awt::XMouseListener* >( aIter.next() )->mouseReleased( rEvt ); @@ -449,11 +449,11 @@ void Window::fireMouseReleasedEvent( const css::awt::MouseEvent& rEvt ) void Window::fireMouseMovedEvent( const css::awt::MouseEvent& rEvt ) { - ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( cppu::UnoType<awt::XMouseMotionListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = maListeners.getContainer( cppu::UnoType<awt::XMouseMotionListener>::get()); if( pContainer ) { - ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); + comphelper::OInterfaceIteratorHelper2 aIter( *pContainer ); while( aIter.hasMoreElements() ) static_cast< awt::XMouseMotionListener* >( aIter.next() )->mouseMoved( rEvt ); @@ -462,11 +462,11 @@ void Window::fireMouseMovedEvent( const css::awt::MouseEvent& rEvt ) void Window::fireSetFocusEvent( const css::awt::FocusEvent& rEvt ) { - ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( cppu::UnoType<awt::XFocusListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = maListeners.getContainer( cppu::UnoType<awt::XFocusListener>::get()); if( pContainer ) { - ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); + comphelper::OInterfaceIteratorHelper2 aIter( *pContainer ); while( aIter.hasMoreElements() ) static_cast< awt::XFocusListener* >( aIter.next() )->focusGained( rEvt ); diff --git a/avmedia/source/win/window.hxx b/avmedia/source/win/window.hxx index c13bd8b62ea4..39d5aec626c4 100644 --- a/avmedia/source/win/window.hxx +++ b/avmedia/source/win/window.hxx @@ -25,7 +25,7 @@ #include "wincommon.hxx" #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/multicontainer2.hxx> #include <com/sun/star/media/XPlayerWindow.hpp> @@ -96,7 +96,7 @@ public: private: ::osl::Mutex maMutex; - ::cppu::OMultiTypeInterfaceContainerHelper maListeners; + comphelper::OMultiTypeInterfaceContainerHelper2 maListeners; css::media::ZoomLevel meZoomLevel; Player& mrPlayer; HWND mnFrameWnd; diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index 437d49527974..2634288daed7 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -20,7 +20,7 @@ #include <chartview/ExplicitValueProvider.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/multicontainer2.hxx> #include <svl/lstner.hxx> #include <com/sun/star/awt/Size.hpp> @@ -229,7 +229,7 @@ private: //member std::vector< std::unique_ptr<VCoordinateSystem> > m_aVCooSysList; - ::cppu::OMultiTypeInterfaceContainerHelper + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; bool m_bViewDirty; //states whether the view needs to be rebuild diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 024cbe5bf589..c7af79a03da8 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -1751,13 +1751,13 @@ void SAL_CALL ChartController::removeSelectionChangeListener( const uno::Referen void ChartController::impl_notifySelectionChangeListeners() { - ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer + ::comphelper::OInterfaceContainerHelper2* pIC = m_aLifeTimeManager.m_aListenerContainer .getContainer( cppu::UnoType<view::XSelectionChangeListener>::get() ); if( pIC ) { uno::Reference< view::XSelectionSupplier > xSelectionSupplier(this); lang::EventObject aEvent( xSelectionSupplier ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); + ::comphelper::OInterfaceIteratorHelper2 aIt( *pIC ); while( aIt.hasMoreElements() ) { static_cast< view::XSelectionChangeListener* >( aIt.next() )->selectionChanged( aEvent ); diff --git a/chart2/source/inc/LifeTime.hxx b/chart2/source/inc/LifeTime.hxx index 082300df3c80..613d92314f96 100644 --- a/chart2/source/inc/LifeTime.hxx +++ b/chart2/source/inc/LifeTime.hxx @@ -20,7 +20,7 @@ #include <osl/mutex.hxx> #include <osl/conditn.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/multicontainer2.hxx> #include "charttoolsdllapi.hxx" namespace com::sun::star::lang { class XComponent; } @@ -45,7 +45,7 @@ public: bool dispose(); public: - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; + ::comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; protected: SAL_DLLPRIVATE virtual bool impl_canStartApiCall(); diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index b36d2becb6f3..c6aea8b186d9 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -243,12 +243,12 @@ uno::Reference< frame::XController > ChartModel::impl_getCurrentController() void ChartModel::impl_notifyCloseListeners() { - ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer + ::comphelper::OInterfaceContainerHelper2* pIC = m_aLifeTimeManager.m_aListenerContainer .getContainer( cppu::UnoType<util::XCloseListener>::get()); if( pIC ) { lang::EventObject aEvent( static_cast< lang::XComponent*>(this) ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); + ::comphelper::OInterfaceIteratorHelper2 aIt( *pIC ); while( aIt.hasMoreElements() ) { static_cast< util::XCloseListener* >( aIt.next() )->notifyClosing( aEvent ); diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index b3166c32bd9b..efb4d0b44c31 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -646,12 +646,12 @@ void ChartModel::impl_notifyModifiedListeners() //always notify the view first! ChartViewHelper::setViewToDirtyState( this ); - ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer + ::comphelper::OInterfaceContainerHelper2* pIC = m_aLifeTimeManager.m_aListenerContainer .getContainer( cppu::UnoType<util::XModifyListener>::get()); if( pIC ) { lang::EventObject aEvent( static_cast< lang::XComponent*>(this) ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); + ::comphelper::OInterfaceIteratorHelper2 aIt( *pIC ); while( aIt.hasMoreElements() ) { static_cast< util::XModifyListener* >( aIt.next() )->modified( aEvent ); @@ -781,11 +781,11 @@ Reference< embed::XStorage > SAL_CALL ChartModel::getDocumentStorage() void ChartModel::impl_notifyStorageChangeListeners() { - ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer + ::comphelper::OInterfaceContainerHelper2* pIC = m_aLifeTimeManager.m_aListenerContainer .getContainer( cppu::UnoType<document::XStorageChangeListener>::get()); if( pIC ) { - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); + ::comphelper::OInterfaceIteratorHelper2 aIt( *pIC ); while( aIt.hasMoreElements() ) { static_cast< document::XStorageChangeListener* >( aIt.next() ) diff --git a/chart2/source/tools/LifeTime.cxx b/chart2/source/tools/LifeTime.cxx index c705405c8913..7a84f4f648c6 100644 --- a/chart2/source/tools/LifeTime.cxx +++ b/chart2/source/tools/LifeTime.cxx @@ -218,12 +218,12 @@ bool CloseableLifeTimeManager::g_close_startTryClose(bool bDeliverOwnership) if(xCloseable.is()) { //--call queryClosing on all registered close listeners - ::cppu::OInterfaceContainerHelper* pIC = m_aListenerContainer.getContainer( + ::comphelper::OInterfaceContainerHelper2* pIC = m_aListenerContainer.getContainer( cppu::UnoType<util::XCloseListener>::get()); if( pIC ) { lang::EventObject aEvent( xCloseable ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); + ::comphelper::OInterfaceIteratorHelper2 aIt( *pIC ); while( aIt.hasMoreElements() ) { static_cast< util::XCloseListener* >( aIt.next() ) @@ -327,12 +327,12 @@ void CloseableLifeTimeManager::impl_doClose() if(xCloseable.is()) { //--call notifyClosing on all registered close listeners - ::cppu::OInterfaceContainerHelper* pIC = m_aListenerContainer.getContainer( + ::comphelper::OInterfaceContainerHelper2* pIC = m_aListenerContainer.getContainer( cppu::UnoType<util::XCloseListener>::get()); if( pIC ) { lang::EventObject aEvent( xCloseable ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); + ::comphelper::OInterfaceIteratorHelper2 aIt( *pIC ); while( aIt.hasMoreElements() ) { static_cast< util::XCloseListener* >( aIt.next() )->notifyClosing( aEvent ); diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index a5db1f26b69d..99b1ce5ee99c 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2614,12 +2614,12 @@ void ChartView::impl_notifyModeChangeListener( const OUString& rNewMode ) { try { - ::cppu::OInterfaceContainerHelper* pIC = m_aListenerContainer + comphelper::OInterfaceContainerHelper2* pIC = m_aListenerContainer .getContainer( cppu::UnoType<util::XModeChangeListener>::get()); if( pIC ) { util::ModeChangeEvent aEvent( static_cast< uno::XWeak* >( this ), rNewMode ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); + comphelper::OInterfaceIteratorHelper2 aIt( *pIC ); while( aIt.hasMoreElements() ) { static_cast< util::XModeChangeListener* >( aIt.next() )->modeChanged( aEvent ); diff --git a/comphelper/source/container/interfacecontainer2.cxx b/comphelper/source/container/interfacecontainer2.cxx index 1524600affd0..151f298d19c0 100644 --- a/comphelper/source/container/interfacecontainer2.cxx +++ b/comphelper/source/container/interfacecontainer2.cxx @@ -19,6 +19,7 @@ #include <comphelper/interfacecontainer2.hxx> +#include <comphelper/multicontainer2.hxx> #include <osl/diagnose.h> #include <osl/mutex.hxx> @@ -285,6 +286,121 @@ void OInterfaceContainerHelper2::clear() } + +// specialized class for type + +OMultiTypeInterfaceContainerHelper2::OMultiTypeInterfaceContainerHelper2( Mutex & rMutex_ ) + : rMutex( rMutex_ ) +{ +} + +OMultiTypeInterfaceContainerHelper2::~OMultiTypeInterfaceContainerHelper2() +{ +} + +std::vector< css::uno::Type > OMultiTypeInterfaceContainerHelper2::getContainedTypes() const +{ + ::osl::MutexGuard aGuard( rMutex ); + std::vector< Type > aInterfaceTypes; + aInterfaceTypes.reserve( m_aMap.size() ); + for (const auto& rItem : m_aMap) + { + // are interfaces added to this container? + if( rItem.second->getLength() ) + // yes, put the type in the array + aInterfaceTypes.push_back(rItem.first); + } + return aInterfaceTypes; +} + +OMultiTypeInterfaceContainerHelper2::t_type2ptr::iterator OMultiTypeInterfaceContainerHelper2::findType(const Type & rKey ) +{ + return std::find_if(m_aMap.begin(), m_aMap.end(), + [&rKey](const t_type2ptr::value_type& rItem) { return rItem.first == rKey; }); +} + +OMultiTypeInterfaceContainerHelper2::t_type2ptr::const_iterator OMultiTypeInterfaceContainerHelper2::findType(const Type & rKey ) const +{ + return std::find_if(m_aMap.begin(), m_aMap.end(), + [&rKey](const t_type2ptr::value_type& rItem) { return rItem.first == rKey; }); +} + +OInterfaceContainerHelper2 * OMultiTypeInterfaceContainerHelper2::getContainer( const Type & rKey ) const +{ + ::osl::MutexGuard aGuard( rMutex ); + + auto iter = findType( rKey ); + if( iter != m_aMap.end() ) + return (*iter).second.get(); + return nullptr; +} + +sal_Int32 OMultiTypeInterfaceContainerHelper2::addInterface( + const Type & rKey, const Reference< XInterface > & rListener ) +{ + ::osl::MutexGuard aGuard( rMutex ); + auto iter = findType( rKey ); + if( iter == m_aMap.end() ) + { + OInterfaceContainerHelper2 * pLC = new OInterfaceContainerHelper2( rMutex ); + m_aMap.emplace_back(rKey, pLC); + return pLC->addInterface( rListener ); + } + return (*iter).second->addInterface( rListener ); +} + +sal_Int32 OMultiTypeInterfaceContainerHelper2::removeInterface( + const Type & rKey, const Reference< XInterface > & rListener ) +{ + ::osl::MutexGuard aGuard( rMutex ); + + // search container with id nUik + auto iter = findType( rKey ); + // container found? + if( iter != m_aMap.end() ) + return (*iter).second->removeInterface( rListener ); + + // no container with this id. Always return 0 + return 0; +} + +void OMultiTypeInterfaceContainerHelper2::disposeAndClear( const EventObject & rEvt ) +{ + t_type2ptr::size_type nSize = 0; + std::unique_ptr<OInterfaceContainerHelper2 *[]> ppListenerContainers; + { + ::osl::MutexGuard aGuard( rMutex ); + nSize = m_aMap.size(); + if( nSize ) + { + typedef OInterfaceContainerHelper2* ppp; + ppListenerContainers.reset(new ppp[nSize]); + + t_type2ptr::size_type i = 0; + for (const auto& rItem : m_aMap) + { + ppListenerContainers[i++] = rItem.second.get(); + } + } + } + + // create a copy, because do not fire event in a guarded section + for( t_type2ptr::size_type i = 0; i < nSize; i++ ) + { + if( ppListenerContainers[i] ) + ppListenerContainers[i]->disposeAndClear( rEvt ); + } +} + +void OMultiTypeInterfaceContainerHelper2::clear() +{ + ::osl::MutexGuard aGuard( rMutex ); + + for (auto& rItem : m_aMap) + rItem.second->clear(); +} + + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index 5b4c1da23fd5..933ddb60a3db 100644 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -37,7 +37,7 @@ #include <com/sun/star/embed/EmbedMisc.hpp> #include <cppuhelper/exc_hlp.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <comphelper/lok.hxx> #include <sal/log.hxx> @@ -129,13 +129,13 @@ void OCommonEmbeddedObject::StateChangeNotification_Impl( bool bBeforeChange, sa if ( !m_pInterfaceContainer ) return; - ::cppu::OInterfaceContainerHelper* pContainer = m_pInterfaceContainer->getContainer( + comphelper::OInterfaceContainerHelper2* pContainer = m_pInterfaceContainer->getContainer( cppu::UnoType<embed::XStateChangeListener>::get()); if ( pContainer == nullptr ) return; lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) ); - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); // should be locked after the method is finished successfully rGuard.clear(); diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index ab9f2b53c0ff..8d2cb7332a40 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/io/TempFile.hpp> +#include <comphelper/multicontainer2.hxx> #include <comphelper/storagehelper.hxx> #include <cppuhelper/queryinterface.hxx> @@ -355,7 +356,7 @@ void OCommonEmbeddedObject::PostEvent_Impl( const OUString& aEventName ) if ( !m_pInterfaceContainer ) return; - ::cppu::OInterfaceContainerHelper* pIC = m_pInterfaceContainer->getContainer( + comphelper::OInterfaceContainerHelper2* pIC = m_pInterfaceContainer->getContainer( cppu::UnoType<document::XEventListener>::get()); if( !pIC ) return; @@ -366,7 +367,7 @@ void OCommonEmbeddedObject::PostEvent_Impl( const OUString& aEventName ) // For now all the events are sent as object events // aEvent.Source = ( xSource.is() ? xSource // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); + comphelper::OInterfaceIteratorHelper2 aIt( *pIC ); while( aIt.hasMoreElements() ) { try @@ -486,7 +487,7 @@ void SAL_CALL OCommonEmbeddedObject::addStateChangeListener( const uno::Referenc throw lang::DisposedException(); // TODO if ( !m_pInterfaceContainer ) - m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex )); + m_pInterfaceContainer.reset(new comphelper::OMultiTypeInterfaceContainerHelper2( m_aMutex )); m_pInterfaceContainer->addInterface( cppu::UnoType<embed::XStateChangeListener>::get(), xListener ); @@ -514,11 +515,11 @@ void SAL_CALL OCommonEmbeddedObject::close( sal_Bool bDeliverOwnership ) if ( m_pInterfaceContainer ) { - ::cppu::OInterfaceContainerHelper* pContainer = + comphelper::OInterfaceContainerHelper2* pContainer = m_pInterfaceContainer->getContainer( cppu::UnoType<util::XCloseListener>::get()); if ( pContainer != nullptr ) { - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try @@ -536,7 +537,7 @@ void SAL_CALL OCommonEmbeddedObject::close( sal_Bool bDeliverOwnership ) cppu::UnoType<util::XCloseListener>::get()); if ( pContainer != nullptr ) { - ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pCloseIterator(*pContainer); while (pCloseIterator.hasMoreElements()) { try @@ -606,7 +607,7 @@ void SAL_CALL OCommonEmbeddedObject::addCloseListener( const uno::Reference< uti throw lang::DisposedException(); // TODO if ( !m_pInterfaceContainer ) - m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper(m_aMutex)); + m_pInterfaceContainer.reset(new comphelper::OMultiTypeInterfaceContainerHelper2(m_aMutex)); m_pInterfaceContainer->addInterface( cppu::UnoType<util::XCloseListener>::get(), xListener ); } @@ -628,7 +629,7 @@ void SAL_CALL OCommonEmbeddedObject::addEventListener( const uno::Reference< doc throw lang::DisposedException(); // TODO if ( !m_pInterfaceContainer ) - m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper(m_aMutex)); + m_pInterfaceContainer.reset(new comphelper::OMultiTypeInterfaceContainerHelper2(m_aMutex)); m_pInterfaceContainer->addInterface( cppu::UnoType<document::XEventListener>::get(), xListener ); } diff --git a/embeddedobj/source/general/dummyobject.cxx b/embeddedobj/source/general/dummyobject.cxx index e37aca939b9b..8bd43fc488ae 100644 --- a/embeddedobj/source/general/dummyobject.cxx +++ b/embeddedobj/source/general/dummyobject.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/NoSupportException.hpp> +#include <comphelper/multicontainer2.hxx> #include <dummyobject.hxx> @@ -60,7 +61,7 @@ void ODummyEmbeddedObject::PostEvent_Impl( const OUString& aEventName ) if ( !m_pInterfaceContainer ) return; - ::cppu::OInterfaceContainerHelper* pIC = m_pInterfaceContainer->getContainer( + comphelper::OInterfaceContainerHelper2* pIC = m_pInterfaceContainer->getContainer( cppu::UnoType<document::XEventListener>::get()); if( !pIC ) return; @@ -71,7 +72,7 @@ void ODummyEmbeddedObject::PostEvent_Impl( const OUString& aEventName ) // For now all the events are sent as object events // aEvent.Source = ( xSource.is() ? xSource // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); + comphelper::OInterfaceIteratorHelper2 aIt( *pIC ); while( aIt.hasMoreElements() ) { try @@ -506,7 +507,7 @@ void SAL_CALL ODummyEmbeddedObject::addStateChangeListener( const uno::Reference return; if ( !m_pInterfaceContainer ) - m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex )); + m_pInterfaceContainer.reset(new comphelper::OMultiTypeInterfaceContainerHelper2( m_aMutex )); m_pInterfaceContainer->addInterface( cppu::UnoType<embed::XStateChangeListener>::get(), xListener ); @@ -534,11 +535,11 @@ void SAL_CALL ODummyEmbeddedObject::close( sal_Bool bDeliverOwnership ) if ( m_pInterfaceContainer ) { - ::cppu::OInterfaceContainerHelper* pContainer = + comphelper::OInterfaceContainerHelper2* pContainer = m_pInterfaceContainer->getContainer( cppu::UnoType<util::XCloseListener>::get()); if ( pContainer != nullptr ) { - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try @@ -556,7 +557,7 @@ void SAL_CALL ODummyEmbeddedObject::close( sal_Bool bDeliverOwnership ) cppu::UnoType<util::XCloseListener>::get()); if ( pContainer != nullptr ) { - ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pCloseIterator(*pContainer); while (pCloseIterator.hasMoreElements()) { try @@ -584,7 +585,7 @@ void SAL_CALL ODummyEmbeddedObject::addCloseListener( const uno::Reference< util return; if ( !m_pInterfaceContainer ) - m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex )); + m_pInterfaceContainer.reset(new comphelper::OMultiTypeInterfaceContainerHelper2( m_aMutex )); m_pInterfaceContainer->addInterface( cppu::UnoType<util::XCloseListener>::get(), xListener ); } @@ -606,7 +607,7 @@ void SAL_CALL ODummyEmbeddedObject::addEventListener( const uno::Reference< docu return; if ( !m_pInterfaceContainer ) - m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex )); + m_pInterfaceContainer.reset(new comphelper::OMultiTypeInterfaceContainerHelper2( m_aMutex )); m_pInterfaceContainer->addInterface( cppu::UnoType<document::XEventListener>::get(), xListener ); } diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx index b055adc4a9f1..4b087ccc7601 100644 --- a/embeddedobj/source/inc/commonembobj.hxx +++ b/embeddedobj/source/inc/commonembobj.hxx @@ -54,8 +54,8 @@ namespace com::sun::star { } } -namespace cppu { - class OMultiTypeInterfaceContainerHelper; +namespace comphelper { + class OMultiTypeInterfaceContainerHelper2; } namespace comphelper { @@ -86,7 +86,7 @@ protected: rtl::Reference<DocumentHolder> m_xDocHolder; - std::unique_ptr<::cppu::OMultiTypeInterfaceContainerHelper> m_pInterfaceContainer; + std::unique_ptr<::comphelper::OMultiTypeInterfaceContainerHelper2> m_pInterfaceContainer; bool m_bReadOnly; diff --git a/embeddedobj/source/inc/dummyobject.hxx b/embeddedobj/source/inc/dummyobject.hxx index 17d113cb7153..cc7355668dd6 100644 --- a/embeddedobj/source/inc/dummyobject.hxx +++ b/embeddedobj/source/inc/dummyobject.hxx @@ -28,7 +28,7 @@ #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/embed/XEmbedPersist.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> namespace com::sun::star { namespace embed { @@ -43,10 +43,6 @@ namespace com::sun::star { } } -namespace cppu { - class OMultiTypeInterfaceContainerHelper; -} - /** * Represents an OLE object that has native data (next to the replacement * image), but we don't understand that data. @@ -56,7 +52,7 @@ class ODummyEmbeddedObject : public ::cppu::WeakImplHelper , css::embed::XEmbedPersist > { ::osl::Mutex m_aMutex; - std::unique_ptr<cppu::OMultiTypeInterfaceContainerHelper> + std::unique_ptr<comphelper::OMultiTypeInterfaceContainerHelper2> m_pInterfaceContainer; bool m_bDisposed; diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx index 7eea3d407e7d..d0884871deb4 100644 --- a/embeddedobj/source/inc/oleembobj.hxx +++ b/embeddedobj/source/inc/oleembobj.hxx @@ -39,8 +39,8 @@ #include <osl/thread.h> #include <memory> -namespace cppu { - class OMultiTypeInterfaceContainerHelper; +namespace comphelper { + class OMultiTypeInterfaceContainerHelper2; } class VerbExecutionController @@ -122,7 +122,7 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper rtl::Reference<OleComponent> m_pOleComponent; - std::unique_ptr<::cppu::OMultiTypeInterfaceContainerHelper> m_pInterfaceContainer; + std::unique_ptr<::comphelper::OMultiTypeInterfaceContainerHelper2> m_pInterfaceContainer; bool m_bReadOnly; diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index b0c4fc62c1ac..3834d4098170 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -32,7 +32,7 @@ #include <com/sun/star/awt/XRequestCallback.hpp> #include "platform.h" -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/multicontainer2.hxx> #include <comphelper/mimeconfighelper.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/windowserrorstring.hxx> @@ -1460,11 +1460,11 @@ void SAL_CALL OleComponent::close( sal_Bool bDeliverOwnership ) if (m_pInterfaceContainer) { - ::cppu::OInterfaceContainerHelper* pContainer + comphelper::OInterfaceContainerHelper2* pContainer = m_pInterfaceContainer->getContainer(cppu::UnoType<util::XCloseListener>::get()); if (pContainer != nullptr) { - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try @@ -1483,7 +1483,7 @@ void SAL_CALL OleComponent::close( sal_Bool bDeliverOwnership ) = m_pInterfaceContainer->getContainer(cppu::UnoType<util::XCloseListener>::get()); if (pContainer != nullptr) { - ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pCloseIterator(*pContainer); while (pCloseIterator.hasMoreElements()) { try @@ -1511,7 +1511,7 @@ void SAL_CALL OleComponent::addCloseListener( const uno::Reference< util::XClose throw lang::DisposedException(); // TODO if ( !m_pInterfaceContainer ) - m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex ); + m_pInterfaceContainer = new comphelper::OMultiTypeInterfaceContainerHelper2( m_aMutex ); m_pInterfaceContainer->addInterface( cppu::UnoType<util::XCloseListener>::get(), xListener ); } @@ -1682,7 +1682,7 @@ void SAL_CALL OleComponent::addEventListener( const uno::Reference< lang::XEvent throw lang::DisposedException(); // TODO if ( !m_pInterfaceContainer ) - m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex ); + m_pInterfaceContainer = new comphelper::OMultiTypeInterfaceContainerHelper2( m_aMutex ); m_pInterfaceContainer->addInterface( cppu::UnoType<lang::XEventListener>::get(), xListener ); } @@ -1743,11 +1743,11 @@ void SAL_CALL OleComponent::setModified( sal_Bool bModified ) if ( bModified && m_pInterfaceContainer ) { - ::cppu::OInterfaceContainerHelper* pContainer = + comphelper::OInterfaceContainerHelper2* pContainer = m_pInterfaceContainer->getContainer( cppu::UnoType<util::XModifyListener>::get()); if ( pContainer != nullptr ) { - ::cppu::OInterfaceIteratorHelper pIterator( *pContainer ); + comphelper::OInterfaceIteratorHelper2 pIterator( *pContainer ); while ( pIterator.hasMoreElements() ) { try @@ -1771,7 +1771,7 @@ void SAL_CALL OleComponent::addModifyListener( const css::uno::Reference < css:: throw lang::DisposedException(); // TODO if ( !m_pInterfaceContainer ) - m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex ); + m_pInterfaceContainer = new comphelper::OMultiTypeInterfaceContainerHelper2( m_aMutex ); m_pInterfaceContainer->addInterface( cppu::UnoType<util::XModifyListener>::get(), xListener ); } diff --git a/embeddedobj/source/msole/olecomponent.hxx b/embeddedobj/source/msole/olecomponent.hxx index 08f1cbed696f..5a96b64fcbfc 100644 --- a/embeddedobj/source/msole/olecomponent.hxx +++ b/embeddedobj/source/msole/olecomponent.hxx @@ -34,8 +34,8 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <rtl/ref.hxx> -namespace cppu { - class OMultiTypeInterfaceContainerHelper; +namespace comphelper { + class OMultiTypeInterfaceContainerHelper2; } class OleWrapperClientSite; @@ -48,7 +48,7 @@ class OleComponent : public ::cppu::WeakImplHelper< css::util::XCloseable, css:: css::datatransfer::XTransferable > { ::osl::Mutex m_aMutex; - ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer; + comphelper::OMultiTypeInterfaceContainerHelper2* m_pInterfaceContainer; bool m_bDisposed; bool m_bModified; diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index 8c23a4429895..ba678d4dfb87 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -47,7 +47,7 @@ #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <cppuhelper/exc_hlp.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/multicontainer2.hxx> #include <comphelper/mimeconfighelper.hxx> #include <sal/log.hxx> #include <tools/diagnose_ex.h> @@ -125,13 +125,13 @@ void OleEmbeddedObject::MoveListeners() // move state change listeners { - ::cppu::OInterfaceContainerHelper* pStateChangeContainer = + comphelper::OInterfaceContainerHelper2* pStateChangeContainer = m_pInterfaceContainer->getContainer( cppu::UnoType<embed::XStateChangeListener>::get()); if ( pStateChangeContainer != nullptr ) { if ( m_xWrappedObject.is() ) { - ::cppu::OInterfaceIteratorHelper pIterator( *pStateChangeContainer ); + comphelper::OInterfaceIteratorHelper2 pIterator( *pStateChangeContainer ); while ( pIterator.hasMoreElements() ) { try @@ -149,13 +149,13 @@ void OleEmbeddedObject::MoveListeners() // move event listeners { - ::cppu::OInterfaceContainerHelper* pEventContainer = + comphelper::OInterfaceContainerHelper2* pEventContainer = m_pInterfaceContainer->getContainer( cppu::UnoType<document::XEventListener>::get()); if ( pEventContainer != nullptr ) { if ( m_xWrappedObject.is() ) { - ::cppu::OInterfaceIteratorHelper pIterator( *pEventContainer ); + comphelper::OInterfaceIteratorHelper2 pIterator( *pEventContainer ); while ( pIterator.hasMoreElements() ) { try @@ -173,13 +173,13 @@ void OleEmbeddedObject::MoveListeners() // move close listeners { - ::cppu::OInterfaceContainerHelper* pCloseContainer = + comphelper::OInterfaceContainerHelper2* pCloseContainer = m_pInterfaceContainer->getContainer( cppu::UnoType<util::XCloseListener>::get()); if ( pCloseContainer != nullptr ) { if ( m_xWrappedObject.is() ) { - ::cppu::OInterfaceIteratorHelper pIterator( *pCloseContainer ); + comphelper::OInterfaceIteratorHelper2 pIterator( *pCloseContainer ); while ( pIterator.hasMoreElements() ) { try diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx index f85c845e31a8..a4045f34b4f2 100644 --- a/embeddedobj/source/msole/olemisc.cxx +++ b/embeddedobj/source/msole/olemisc.cxx @@ -28,7 +28,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/DisposedException.hpp> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/multicontainer2.hxx> #include <comphelper/sequenceashashmap.hxx> #include <oleembobj.hxx> @@ -156,14 +156,14 @@ void OleEmbeddedObject::MakeEventListenerNotification_Impl( const OUString& aEve if ( !m_pInterfaceContainer ) return; - ::cppu::OInterfaceContainerHelper* pContainer = - m_pInterfaceContainer->getContainer( + comphelper::OInterfaceContainerHelper2* pContainer = + m_pInterfaceContainer->getContainer( cppu::UnoType<document::XEventListener>::get()); if ( pContainer == nullptr ) return; document::EventObject aEvent( static_cast< ::cppu::OWeakObject* >( this ), aEventName ); - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try @@ -181,12 +181,12 @@ void OleEmbeddedObject::StateChangeNotification_Impl( bool bBeforeChange, sal_In { if ( m_pInterfaceContainer ) { - ::cppu::OInterfaceContainerHelper* pContainer = m_pInterfaceContainer->getContainer( + comphelper::OInterfaceContainerHelper2* pContainer = m_pInterfaceContainer->getContainer( cppu::UnoType<embed::XStateChangeListener>::get()); if ( pContainer != nullptr ) { lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) ); - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { @@ -399,7 +399,7 @@ void SAL_CALL OleEmbeddedObject::addStateChangeListener( const uno::Reference< e throw lang::DisposedException(); // TODO if ( !m_pInterfaceContainer ) - m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex )); + m_pInterfaceContainer.reset(new comphelper::OMultiTypeInterfaceContainerHelper2( m_aMutex )); m_pInterfaceContainer->addInterface( cppu::UnoType<embed::XStateChangeListener>::get(), xListener ); @@ -446,11 +446,11 @@ void SAL_CALL OleEmbeddedObject::close( sal_Bool bDeliverOwnership ) if ( m_pInterfaceContainer ) { - ::cppu::OInterfaceContainerHelper* pContainer = + comphelper::OInterfaceContainerHelper2* pContainer = m_pInterfaceContainer->getContainer( cppu::UnoType<util::XCloseListener>::get()); if ( pContainer != nullptr ) { - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try @@ -468,7 +468,7 @@ void SAL_CALL OleEmbeddedObject::close( sal_Bool bDeliverOwnership ) cppu::UnoType<util::XCloseListener>::get()); if ( pContainer != nullptr ) { - ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pCloseIterator(*pContainer); while (pCloseIterator.hasMoreElements()) { try @@ -504,7 +504,7 @@ void SAL_CALL OleEmbeddedObject::addCloseListener( const uno::Reference< util::X throw lang::DisposedException(); // TODO if ( !m_pInterfaceContainer ) - m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex )); + m_pInterfaceContainer.reset(new comphelper::OMultiTypeInterfaceContainerHelper2( m_aMutex )); m_pInterfaceContainer->addInterface( cppu::UnoType<util::XCloseListener>::get(), xListener ); } @@ -549,7 +549,7 @@ void SAL_CALL OleEmbeddedObject::addEventListener( const uno::Reference< documen throw lang::DisposedException(); // TODO if ( !m_pInterfaceContainer ) - m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex )); + m_pInterfaceContainer.reset(new comphelper::OMultiTypeInterfaceContainerHelper2( m_aMutex )); m_pInterfaceContainer->addInterface( cppu::UnoType<document::XEventListener>::get(), xListener ); } diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index e83580689435..8c1d6eefddc3 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/sdb/RowChangeAction.hpp> #include <com/sun/star/frame/CommandGroup.hpp> #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <sot/exchange.hxx> #include <sot/formats.hxx> @@ -121,7 +121,7 @@ class BibFrameCtrl_Impl : public cppu::WeakImplHelper < XFrameActionListener > { public: Mutex aMutex; - OMultiTypeInterfaceContainerHelper aLC; + comphelper::OMultiTypeInterfaceContainerHelper2 aLC; BibFrameController_Impl* pController; diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx index 71eb4f931399..4047f4df2719 100644 --- a/filter/source/config/cache/basecontainer.cxx +++ b/filter/source/config/cache/basecontainer.cxx @@ -451,11 +451,11 @@ void SAL_CALL BaseContainer::flush() // Further it's not a good idea to hold the own lock // if an outside object is called :-) css::lang::EventObject aSource (static_cast< css::util::XFlushable* >(this)); - ::cppu::OInterfaceContainerHelper* pContainer = m_lListener.getContainer(cppu::UnoType<css::util::XFlushListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = m_lListener.getContainer(cppu::UnoType<css::util::XFlushListener>::get()); if (!pContainer) return; - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try diff --git a/filter/source/config/cache/basecontainer.hxx b/filter/source/config/cache/basecontainer.hxx index 001c304ffaed..dee054d90731 100644 --- a/filter/source/config/cache/basecontainer.hxx +++ b/filter/source/config/cache/basecontainer.hxx @@ -27,7 +27,7 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/util/XFlushable.hpp> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/multicontainer2.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/weakref.hxx> #include <rtl/ustring.hxx> @@ -93,7 +93,7 @@ class BaseContainer : public BaseLock FilterCache::EItemType m_eType; /** @short holds all listener, which are registered at this instance. */ - ::cppu::OMultiTypeInterfaceContainerHelper m_lListener; + comphelper::OMultiTypeInterfaceContainerHelper2 m_lListener; // native interface diff --git a/filter/source/config/cache/configflush.cxx b/filter/source/config/cache/configflush.cxx index 5643e2d0ccf4..017fd8b19bb1 100644 --- a/filter/source/config/cache/configflush.cxx +++ b/filter/source/config/cache/configflush.cxx @@ -59,11 +59,11 @@ void SAL_CALL ConfigFlush::refresh() // Further it's not a good idea to hold the own lock // if an outside object is called :-) css::lang::EventObject aSource (static_cast< css::util::XRefreshable* >(this)); - ::cppu::OInterfaceContainerHelper* pContainer = m_lListener.getContainer(cppu::UnoType<css::util::XRefreshListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = m_lListener.getContainer(cppu::UnoType<css::util::XRefreshListener>::get()); if (!pContainer) return; - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try diff --git a/filter/source/config/cache/configflush.hxx b/filter/source/config/cache/configflush.hxx index 05edb639c886..20b1c14caae6 100644 --- a/filter/source/config/cache/configflush.hxx +++ b/filter/source/config/cache/configflush.hxx @@ -21,7 +21,7 @@ #include "cacheitem.hxx" #include <com/sun/star/util/XRefreshable.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/multicontainer2.hxx> #include <cppuhelper/implbase.hxx> @@ -41,7 +41,7 @@ class ConfigFlush final : public BaseLock > { /** @short holds all listener, which are registered at this instance. */ - ::cppu::OMultiTypeInterfaceContainerHelper m_lListener; + comphelper::OMultiTypeInterfaceContainerHelper2 m_lListener; // native interface diff --git a/fpicker/source/win32/VistaFilePickerEventHandler.cxx b/fpicker/source/win32/VistaFilePickerEventHandler.cxx index c7946b0216bc..97c0c9fbd41e 100644 --- a/fpicker/source/win32/VistaFilePickerEventHandler.cxx +++ b/fpicker/source/win32/VistaFilePickerEventHandler.cxx @@ -279,11 +279,11 @@ void doRequest(Request& rRequest) void VistaFilePickerEventHandler::impl_sendEvent( EEventType eEventType, ::sal_Int16 nControlID) { - ::cppu::OInterfaceContainerHelper* pContainer = m_lListener.getContainer( cppu::UnoType<css::ui::dialogs::XFilePickerListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = m_lListener.getContainer( cppu::UnoType<css::ui::dialogs::XFilePickerListener>::get()); if ( ! pContainer) return; - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try diff --git a/fpicker/source/win32/VistaFilePickerEventHandler.hxx b/fpicker/source/win32/VistaFilePickerEventHandler.hxx index 71199cd07b45..b27ef7326f35 100644 --- a/fpicker/source/win32/VistaFilePickerEventHandler.hxx +++ b/fpicker/source/win32/VistaFilePickerEventHandler.hxx @@ -28,7 +28,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <cppuhelper/basemutex.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/multicontainer2.hxx> #include <osl/interlck.h> namespace fpicker{ @@ -182,7 +182,7 @@ class VistaFilePickerEventHandler : public ::cppu::BaseMutex * be locked during this time. If we call our listener back now synchronously .. * we will block on SolarMutex.acquire() forever .-)) */ - ::cppu::OMultiTypeInterfaceContainerHelper m_lListener; + comphelper::OMultiTypeInterfaceContainerHelper2 m_lListener; }; } // namespace vista diff --git a/framework/inc/helper/uiconfigelementwrapperbase.hxx b/framework/inc/helper/uiconfigelementwrapperbase.hxx index a58c187c0945..5b561bef5db5 100644 --- a/framework/inc/helper/uiconfigelementwrapperbase.hxx +++ b/framework/inc/helper/uiconfigelementwrapperbase.hxx @@ -30,6 +30,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <rtl/ustring.hxx> +#include <comphelper/multicontainer2.hxx> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/propshlp.hxx> #include <cppuhelper/implbase.hxx> @@ -132,7 +133,7 @@ class UIConfigElementWrapperBase : private cppu::BaseMutex, css::uno::Reference< css::container::XIndexAccess > m_xConfigData; css::uno::WeakReference< css::frame::XFrame > m_xWeakFrame; css::uno::Reference< css::awt::XMenuBar > m_xMenuBar; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener }; } // namespace framework diff --git a/framework/inc/helper/uielementwrapperbase.hxx b/framework/inc/helper/uielementwrapperbase.hxx index 71fc8d0784ae..573755f2020d 100644 --- a/framework/inc/helper/uielementwrapperbase.hxx +++ b/framework/inc/helper/uielementwrapperbase.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/util/XUpdatable.hpp> #include <rtl/ustring.hxx> +#include <comphelper/multicontainer2.hxx> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/propshlp.hxx> #include <cppuhelper/implbase.hxx> @@ -98,7 +99,7 @@ class UIElementWrapperBase : private cppu::BaseMutex, static css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(); - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener OUString m_aResourceURL; css::uno::WeakReference< css::frame::XFrame > m_xWeakFrame; sal_Int16 m_nType; diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx index 0274492db1d3..189be410bfc9 100644 --- a/framework/inc/services/layoutmanager.hxx +++ b/framework/inc/services/layoutmanager.hxx @@ -35,7 +35,7 @@ #include <cppuhelper/basemutex.hxx> #include <cppuhelper/propshlp.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/propertycontainer.hxx> #include <comphelper/uno3.hxx> @@ -261,7 +261,7 @@ namespace framework std::unique_ptr<GlobalSettings> m_pGlobalSettings; OUString m_aModuleIdentifier; Timer m_aAsyncLayoutTimer; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; // container for ALL Listener rtl::Reference< ToolbarLayoutManager > m_xToolbarManager; friend class detail::InfoHelperBuilder; diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx index c4b2876277ad..99cf94ea1d59 100644 --- a/framework/inc/uielement/statusbarmanager.hxx +++ b/framework/inc/uielement/statusbarmanager.hxx @@ -26,7 +26,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <vcl/status.hxx> #include <vcl/vclptr.hxx> #include <map> @@ -93,7 +93,7 @@ class StatusBarManager final: public ::cppu::WeakImplHelper< css::uno::Reference< css::frame::XFrame > m_xFrame; StatusBarControllerMap m_aControllerMap; osl::Mutex m_mutex; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::frame::XUIControllerFactory > m_xStatusbarControllerFactory; }; diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index 6de526423d38..a12528415184 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -37,7 +37,7 @@ #include <rtl/ustring.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <tools/link.hxx> #include <vcl/weld.hxx> @@ -229,7 +229,7 @@ class ToolBarManager final : public ToolbarManager_Base css::uno::Reference< css::frame::XFrame > m_xFrame; ToolBarControllerMap m_aControllerMap; osl::Mutex m_mutex; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::frame::XUIControllerFactory > m_xToolbarControllerFactory; css::uno::Reference< css::ui::XImageManager > m_xModuleImageManager; diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index ae9c1f348b0e..246032945512 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -283,11 +283,11 @@ void TitleHelper::impl_sendTitleChangedEvent () if( ! aEvent.Source.is() ) return; - ::cppu::OInterfaceContainerHelper* pContainer = m_aListener.getContainer( cppu::UnoType<css::frame::XTitleChangeListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = m_aListener.getContainer( cppu::UnoType<css::frame::XTitleChangeListener>::get()); if ( ! pContainer) return; - ::cppu::OInterfaceIteratorHelper pIt( *pContainer ); + comphelper::OInterfaceIteratorHelper2 pIt( *pContainer ); while ( pIt.hasMoreElements() ) { try diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index a717de1fa00f..4d821b4e08ae 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -2580,12 +2580,12 @@ void SAL_CALL LayoutManager::removeLayoutManagerEventListener( const uno::Refere void LayoutManager::implts_notifyListeners(short nEvent, const uno::Any& rInfoParam) { - lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>(this) ); - ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<frame::XLayoutManagerListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<frame::XLayoutManagerListener>::get()); if (pContainer==nullptr) return; - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>(this) ); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 0315ab1bae70..ea2f0cac77f5 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -1554,13 +1554,13 @@ bool Desktop::impl_sendQueryTerminationEvent(Desktop::TTerminateListenerList& lC { TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); - ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::frame::XTerminateListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::frame::XTerminateListener>::get()); if ( ! pContainer ) return true; css::lang::EventObject aEvent( static_cast< ::cppu::OWeakObject* >(this) ); - ::cppu::OInterfaceIteratorHelper aIterator( *pContainer ); + comphelper::OInterfaceIteratorHelper2 aIterator( *pContainer ); while ( aIterator.hasMoreElements() ) { try @@ -1612,11 +1612,11 @@ void Desktop::impl_sendTerminateToClipboard() { TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); - ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::frame::XTerminateListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::frame::XTerminateListener>::get()); if ( ! pContainer ) return; - ::cppu::OInterfaceIteratorHelper aIterator( *pContainer ); + comphelper::OInterfaceIteratorHelper2 aIterator( *pContainer ); while ( aIterator.hasMoreElements() ) { try @@ -1650,13 +1650,13 @@ void Desktop::impl_sendNotifyTerminationEvent() { TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); - ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::frame::XTerminateListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::frame::XTerminateListener>::get()); if ( ! pContainer ) return; css::lang::EventObject aEvent( static_cast< ::cppu::OWeakObject* >(this) ); - ::cppu::OInterfaceIteratorHelper aIterator( *pContainer ); + comphelper::OInterfaceIteratorHelper2 aIterator( *pContainer ); while ( aIterator.hasMoreElements() ) { try diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index f74dad8f5fd3..c373c5fa1162 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -68,7 +68,7 @@ #include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/weak.hxx> #include <sal/log.hxx> @@ -377,7 +377,7 @@ private: /// helper for XFrames, XIndexAccess and XElementAccess interfaces css::uno::Reference< css::frame::XFrames > m_xFramesHelper; /// container for ALL Listener - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// parent of this frame css::uno::Reference< css::frame::XFramesSupplier > m_xParent; /// containerwindow of this frame for embedded components @@ -1671,10 +1671,10 @@ void SAL_CALL XFrameImpl::close( sal_Bool bDeliverOwnership ) // internal operations too... // Note: container is threadsafe himself. css::lang::EventObject aSource (static_cast< ::cppu::OWeakObject*>(this)); - ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::util::XCloseListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::util::XCloseListener>::get()); if (pContainer!=nullptr) { - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try @@ -1708,7 +1708,7 @@ void SAL_CALL XFrameImpl::close( sal_Bool bDeliverOwnership ) pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::util::XCloseListener>::get()); if (pContainer!=nullptr) { - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try @@ -2947,7 +2947,7 @@ void XFrameImpl::implts_sendFrameActionEvent( const css::frame::FrameAction& aAc // Get container for right listener. // FOLLOW LINES ARE THREADSAFE!!! // ( OInterfaceContainerHelper2 is synchronized with m_aListenerContainer! ) - ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( + comphelper::OInterfaceContainerHelper2* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::frame::XFrameActionListener>::get()); if( pContainer == nullptr ) @@ -2957,7 +2957,7 @@ void XFrameImpl::implts_sendFrameActionEvent( const css::frame::FrameAction& aAc css::frame::FrameActionEvent aFrameActionEvent( static_cast< ::cppu::OWeakObject* >(this), this, aAction ); // Get iterator for access to listener. - ::cppu::OInterfaceIteratorHelper aIterator( *pContainer ); + comphelper::OInterfaceIteratorHelper2 aIterator( *pContainer ); // Send message to all listener. while( aIterator.hasMoreElements() ) { diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index ecd4d18b2391..04ec4db065e1 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -1161,12 +1161,12 @@ void ImageManagerImpl::removeConfigurationListener( const uno::Reference< css::u void ImageManagerImpl::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp ) { - ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( + comphelper::OInterfaceContainerHelper2* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::ui::XUIConfigurationListener>::get()); if ( pContainer == nullptr ) return; - ::cppu::OInterfaceIteratorHelper pIterator( *pContainer ); + comphelper::OInterfaceIteratorHelper2 pIterator( *pContainer ); while ( pIterator.hasMoreElements() ) { try diff --git a/framework/source/uiconfiguration/imagemanagerimpl.hxx b/framework/source/uiconfiguration/imagemanagerimpl.hxx index 3621be9fb489..9bc6f4eb7077 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.hxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.hxx @@ -27,7 +27,7 @@ #include <com/sun/star/embed/XTransactedObject.hpp> #include <cppuhelper/weak.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <rtl/ustring.hxx> #include <rtl/ref.hxx> @@ -171,7 +171,7 @@ namespace framework OUString m_aModuleIdentifier; OUString m_aResourceString; osl::Mutex m_mutex; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener o3tl::enumarray<vcl::ImageType,std::unique_ptr<ImageList>> m_pUserImageList; o3tl::enumarray<vcl::ImageType,bool> m_bUserImageListModified; bool m_bUseGlobal; diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 8aeea629694a..02954c18dfd6 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -54,6 +54,7 @@ #include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> #include <sal/log.hxx> +#include <comphelper/multicontainer2.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/servicehelper.hxx> #include <memory> @@ -211,7 +212,7 @@ private: css::uno::Reference< css::embed::XTransactedObject > m_xUserRootCommit; css::uno::Reference< css::uno::XComponentContext > m_xContext; osl::Mutex m_mutex; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener rtl::Reference< ImageManager > m_xModuleImageManager; css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager; }; @@ -1610,11 +1611,11 @@ sal_Bool SAL_CALL ModuleUIConfigurationManager::isReadOnly() void ModuleUIConfigurationManager::implts_notifyContainerListener( const ui::ConfigurationEvent& aEvent, NotifyOp eOp ) { - ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::ui::XUIConfigurationListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::ui::XUIConfigurationListener>::get()); if ( pContainer == nullptr ) return; - ::cppu::OInterfaceIteratorHelper pIterator( *pContainer ); + comphelper::OInterfaceIteratorHelper2 pIterator( *pContainer ); while ( pIterator.hasMoreElements() ) { try diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index e210eb9d2ab5..038c0585ae53 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -48,6 +48,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/multicontainer2.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> #include <vcl/svapp.hxx> @@ -189,7 +190,7 @@ private: OUString m_aPropUIName; css::uno::Reference< css::uno::XComponentContext > m_xContext; osl::Mutex m_mutex; - cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener rtl::Reference< ImageManager > m_xImageManager; css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAccConfig; }; @@ -1334,11 +1335,11 @@ sal_Bool SAL_CALL UIConfigurationManager::isReadOnly() void UIConfigurationManager::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp ) { - ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::ui::XUIConfigurationListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::ui::XUIConfigurationListener>::get()); if ( pContainer == nullptr ) return; - ::cppu::OInterfaceIteratorHelper pIterator( *pContainer ); + comphelper::OInterfaceIteratorHelper2 pIterator( *pContainer ); while ( pIterator.hasMoreElements() ) { try diff --git a/include/comphelper/multicontainer2.hxx b/include/comphelper/multicontainer2.hxx new file mode 100644 index 000000000000..35f0fd9686ef --- /dev/null +++ b/include/comphelper/multicontainer2.hxx @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <sal/config.h> + +#include <osl/diagnose.h> +#include <osl/mutex.hxx> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <comphelper/comphelperdllapi.h> +#include <comphelper/interfacecontainer2.hxx> +#include <cstddef> +#include <functional> +#include <memory> +#include <vector> +#include <utility> + +namespace com::sun::star::uno +{ +class XInterface; +} + +/** */ //for docpp +namespace comphelper +{ +/** Specialized class for key type css::uno::Type, + without explicit usage of STL symbols. +*/ +class COMPHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelper2 +{ +public: + /** + Create a container of interface containers. + + @param rMutex the mutex to protect multi thread access. + The lifetime must be longer than the lifetime + of this object. + */ + OMultiTypeInterfaceContainerHelper2(::osl::Mutex& rMutex); + /** + Delete all containers. + */ + ~OMultiTypeInterfaceContainerHelper2(); + + /** + Return all id's under which at least one interface is added. + */ + std::vector<css::uno::Type> getContainedTypes() const; + + /** + Return the container created under this key. + @return the container created under this key. If the container + was not created, null was returned. + */ + OInterfaceContainerHelper2* getContainer(const css::uno::Type& rKey) const; + + /** Inserts an element into the container with the specified key. + The position is not specified, thus it is not specified in which order events are fired. + + @attention + If you add the same interface more than once, then it will be added to the elements list + more than once and thus if you want to remove that interface from the list, you have to call + removeInterface() the same number of times. + In the latter case, you will also get events fired more than once (if the interface is a + listener interface). + + @param rKey + the id of the container + @param r + interface to be added; it is allowed, to insert null or + the same interface more than once + @return + the new count of elements in the container + */ + sal_Int32 addInterface(const css::uno::Type& rKey, + const css::uno::Reference<css::uno::XInterface>& r); + + /** Removes an element from the container with the specified key. + It uses interface equality to remove the interface. + + @param rKey + the id of the container + @param rxIFace + interface to be removed + @return + the new count of elements in the container + */ + sal_Int32 removeInterface(const css::uno::Type& rKey, + const css::uno::Reference<css::uno::XInterface>& rxIFace); + + /** + Call disposing on all object in the container that + support XEventListener. Then clear the container. + */ + void disposeAndClear(const css::lang::EventObject& rEvt); + /** + Remove all elements of all containers. Does not delete the container. + */ + void clear(); + + typedef css::uno::Type keyType; + +private: + typedef std::vector<std::pair<css::uno::Type, std::unique_ptr<OInterfaceContainerHelper2>>> + t_type2ptr; + + t_type2ptr::iterator findType(const css::uno::Type& rKey); + t_type2ptr::const_iterator findType(const css::uno::Type& rKey) const; + + t_type2ptr m_aMap; + ::osl::Mutex& rMutex; + + OMultiTypeInterfaceContainerHelper2(const OMultiTypeInterfaceContainerHelper2&) = delete; + OMultiTypeInterfaceContainerHelper2& operator=(const OMultiTypeInterfaceContainerHelper2&) + = delete; +}; + +} // namespace comphelper + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/framework/desktop.hxx b/include/framework/desktop.hxx index 254a1520bb3e..bd094ee90298 100644 --- a/include/framework/desktop.hxx +++ b/include/framework/desktop.hxx @@ -46,6 +46,7 @@ #include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <comphelper/multicontainer2.hxx> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/propshlp.hxx> @@ -394,7 +395,7 @@ class FWK_DLLPUBLIC Desktop final : private cppu::BaseMutex, css::uno::Reference< css::uno::XComponentContext > m_xContext; /// reference to factory, which has create this instance FrameContainer m_aChildTaskContainer; /// array of child tasks (children of desktop are tasks; and tasks are also frames - But pure frames are not accepted!) - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener css::uno::Reference< css::frame::XFrames > m_xFramesHelper; /// helper for XFrames, XIndexAccess, XElementAccess and implementation of a childcontainer! css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchHelper; /// helper to dispatch something for new tasks, created by "_blank"! ELoadState m_eLoadState; /// hold information about state of asynchron loading of component for loadComponentFromURL()! diff --git a/include/framework/titlehelper.hxx b/include/framework/titlehelper.hxx index 93322818955d..474d709339e2 100644 --- a/include/framework/titlehelper.hxx +++ b/include/framework/titlehelper.hxx @@ -29,7 +29,7 @@ #include <cppuhelper/basemutex.hxx> #include <cppuhelper/weakref.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <rtl/ustrbuf.hxx> @@ -187,7 +187,7 @@ class FWK_DLLPUBLIC TitleHelper final : private ::cppu::BaseMutex ::sal_Int32 m_nLeasedNumber; /** contains all title change listener */ - ::cppu::OMultiTypeInterfaceContainerHelper m_aListener; + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListener; }; } // namespace framework diff --git a/include/svtools/statusbarcontroller.hxx b/include/svtools/statusbarcontroller.hxx index f62feabc0e01..fee4b2869b25 100644 --- a/include/svtools/statusbarcontroller.hxx +++ b/include/svtools/statusbarcontroller.hxx @@ -22,7 +22,7 @@ #include <svtools/svtdllapi.h> #include <com/sun/star/frame/XStatusbarController.hpp> #include <cppuhelper/weak.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <cppuhelper/basemutex.hxx> #include <tools/gen.hxx> #include <unordered_map> @@ -122,7 +122,7 @@ class SVT_DLLPUBLIC StatusbarController : css::uno::Reference< css::uno::XComponentContext > m_xContext; OUString m_aCommandURL; URLToDispatchMap m_aListenerMap; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener mutable css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; css::uno::Reference< css::ui::XStatusbarItem > m_xStatusbarItem; }; diff --git a/include/svtools/toolboxcontroller.hxx b/include/svtools/toolboxcontroller.hxx index c8d0e8c8e7de..f2068306438e 100644 --- a/include/svtools/toolboxcontroller.hxx +++ b/include/svtools/toolboxcontroller.hxx @@ -27,7 +27,7 @@ #include <com/sun/star/util/XUpdatable.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <comphelper/broadcasthelper.hxx> #include <comphelper/proparrhlp.hxx> #include <comphelper/propertycontainer.hxx> @@ -181,7 +181,7 @@ class SVT_DLLPUBLIC ToolboxController : css::uno::Reference< css::uno::XComponentContext > m_xContext; OUString m_aCommandURL; URLToDispatchMap m_aListenerMap; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener css::uno::Reference< css::awt::XWindow > m_xParentWindow; css::uno::Reference< css::util::XURLTransformer > m_xUrlTransformer; diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 1b13d49c79db..89daf8ccafdb 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -44,6 +44,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/ofopxmlhelper.hxx> +#include <comphelper/multicontainer2.hxx> #include <comphelper/refcountedmutex.hxx> #include <comphelper/sequence.hxx> @@ -66,7 +67,7 @@ struct WSInternalData_Impl { rtl::Reference<comphelper::RefCountedMutex> m_xSharedMutex; ::std::unique_ptr< ::cppu::OTypeCollection> m_pTypeCollection; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenersContainer; // list of listeners + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenersContainer; // list of listeners sal_Int32 m_nStorageType; // the mutex reference MUST NOT be empty @@ -3008,13 +3009,13 @@ void OWriteStream::BroadcastTransaction( sal_Int8 nMessage ) lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) ); - ::cppu::OInterfaceContainerHelper* pContainer = + comphelper::OInterfaceContainerHelper2* pContainer = m_pData->m_aListenersContainer.getContainer( cppu::UnoType<embed::XTransactionListener>::get()); if ( !pContainer ) return; - ::cppu::OInterfaceIteratorHelper pIterator( *pContainer ); + comphelper::OInterfaceIteratorHelper2 pIterator( *pContainer ); while ( pIterator.hasMoreElements( ) ) { OSL_ENSURE( nMessage >= 1 && nMessage <= 4, "Wrong internal notification code is used!" ); diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index f7e86b4234ad..470ec4468130 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -56,6 +56,7 @@ #include <comphelper/storagehelper.hxx> #include <comphelper/ofopxmlhelper.hxx> +#include <comphelper/multicontainer2.hxx> #include <tools/diagnose_ex.h> #include "xstorage.hxx" @@ -75,7 +76,7 @@ using namespace ::com::sun::star; struct StorInternalData_Impl { rtl::Reference<comphelper::RefCountedMutex> m_xSharedMutex; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenersContainer; // list of listeners + comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenersContainer; // list of listeners ::std::unique_ptr< ::cppu::OTypeCollection> m_pTypeCollection; bool m_bIsRoot; sal_Int32 m_nStorageType; // the mode in which the storage is used @@ -1921,12 +1922,12 @@ void OStorage::BroadcastModifiedIfNecessary() lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) ); - ::cppu::OInterfaceContainerHelper* pContainer = + comphelper::OInterfaceContainerHelper2* pContainer = m_pData->m_aListenersContainer.getContainer( cppu::UnoType<util::XModifyListener>::get()); if ( pContainer ) { - ::cppu::OInterfaceIteratorHelper pIterator( *pContainer ); + comphelper::OInterfaceIteratorHelper2 pIterator( *pContainer ); while ( pIterator.hasMoreElements( ) ) { static_cast<util::XModifyListener*>( pIterator.next( ) )->modified( aSource ); @@ -1953,13 +1954,13 @@ void OStorage::BroadcastTransaction( sal_Int8 nMessage ) lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) ); - ::cppu::OInterfaceContainerHelper* pContainer = + comphelper::OInterfaceContainerHelper2* pContainer = m_pData->m_aListenersContainer.getContainer( cppu::UnoType<embed::XTransactionListener>::get()); if ( !pContainer ) return; - ::cppu::OInterfaceIteratorHelper pIterator( *pContainer ); + comphelper::OInterfaceIteratorHelper2 pIterator( *pContainer ); while ( pIterator.hasMoreElements( ) ) { OSL_ENSURE( nMessage >= 1 && nMessage <= 4, "Wrong internal notification code is used!" ); diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 6ed21500a2a9..cb4fd94571be 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -39,7 +39,7 @@ #include <tools/urlobj.hxx> #include <tools/diagnose_ex.h> #include <ucbhelper/content.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <osl/mutex.hxx> #include <cppuhelper/implbase.hxx> #include <vcl/settings.hxx> @@ -59,7 +59,7 @@ using namespace ::com::sun::star::uno; struct IMPL_PrintListener_DataContainer : public SfxListener { SfxObjectShellRef m_pObjectShell; - ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer; + comphelper::OMultiTypeInterfaceContainerHelper2 m_aInterfaceContainer; uno::Reference< css::view::XPrintJob> m_xPrintJob; css::uno::Sequence< css::beans::PropertyValue > m_aPrintOptions; @@ -778,7 +778,7 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin m_aPrintOptions = pPrintHint->GetOptions(); } - ::cppu::OInterfaceContainerHelper* pContainer = m_aInterfaceContainer.getContainer( + comphelper::OInterfaceContainerHelper2* pContainer = m_aInterfaceContainer.getContainer( cppu::UnoType<view::XPrintJobListener>::get()); if ( !pContainer ) return; @@ -787,7 +787,7 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin aEvent.Source = m_xPrintJob; aEvent.State = pPrintHint->GetWhich(); - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) static_cast<view::XPrintJobListener*>(pIterator.next())->printJobEvent( aEvent ); } diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index c95c068463cd..50835238c40b 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -59,7 +59,7 @@ #include <comphelper/enumhelper.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <cppuhelper/exc_hlp.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/sequenceashashmap.hxx> @@ -188,7 +188,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument OUString m_sURL ; OUString m_sRuntimeUID ; OUString m_aPreusedFilterName ; - ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer ; + comphelper::OMultiTypeInterfaceContainerHelper2 m_aInterfaceContainer ; std::unordered_map<css::uno::Reference< css::drawing::XShape >, std::vector<css::uno::Reference< css::document::XShapeEventListener >>> maShapeListeners; Reference< XInterface > m_xParent ; @@ -331,10 +331,10 @@ void SAL_CALL SfxPrintHelperListener_Impl::disposing( const lang::EventObject& ) void SAL_CALL SfxPrintHelperListener_Impl::printJobEvent( const view::PrintJobEvent& rEvent ) { - ::cppu::OInterfaceContainerHelper* pContainer = m_pData->m_aInterfaceContainer.getContainer( cppu::UnoType<view::XPrintJobListener>::get()); + ::comphelper::OInterfaceContainerHelper2* pContainer = m_pData->m_aInterfaceContainer.getContainer( cppu::UnoType<view::XPrintJobListener>::get()); if ( pContainer!=nullptr ) { - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + ::comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) static_cast<view::XPrintJobListener*>(pIterator.next())->printJobEvent( rEvent ); } @@ -1427,10 +1427,10 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) Reference< XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) ); lang::EventObject aSource ( static_cast< ::cppu::OWeakObject* >(this) ); - ::cppu::OInterfaceContainerHelper* pContainer = m_pData->m_aInterfaceContainer.getContainer( cppu::UnoType<util::XCloseListener>::get()); + comphelper::OInterfaceContainerHelper2* pContainer = m_pData->m_aInterfaceContainer.getContainer( cppu::UnoType<util::XCloseListener>::get()); if (pContainer!=nullptr) { - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try @@ -1458,7 +1458,7 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) pContainer = m_pData->m_aInterfaceContainer.getContainer( cppu::UnoType<util::XCloseListener>::get()); if (pContainer!=nullptr) { - ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer); + comphelper::OInterfaceIteratorHelper2 pCloseIterator(*pContainer); while (pCloseIterator.hasMoreElements()) { try @@ -2900,7 +2900,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , void SfxBaseModel::NotifyModifyListeners_Impl() const { - ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( cppu::UnoType<util::XModifyListener>::get()); + comphelper::OInterfaceContainerHelper2* pIC = m_pData->m_aInterfaceContainer.getContainer( cppu::UnoType<util::XModifyListener>::get()); if ( pIC ) { lang::EventObject aEvent( static_cast<frame::XModel *>(const_cast<SfxBaseModel *>(this)) ); @@ -3223,7 +3223,7 @@ void SfxBaseModel::postEvent_Impl( const OUString& aName, const Reference< frame if (aName.isEmpty()) return; - ::cppu::OInterfaceContainerHelper* pIC = + comphelper::OInterfaceContainerHelper2* pIC = m_pData->m_aInterfaceContainer.getContainer( cppu::UnoType<document::XDocumentEventListener>::get()); if ( pIC ) { @@ -3304,13 +3304,13 @@ void SfxBaseModel::notifyEvent( const document::EventObject& aEvent ) const if ( impl_isDisposed() ) return; - ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( + comphelper::OInterfaceContainerHelper2* pIC = m_pData->m_aInterfaceContainer.getContainer( cppu::UnoType<document::XEventListener>::get()); if( !pIC ) return; - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); + comphelper::OInterfaceIteratorHelper2 aIt( *pIC ); while( aIt.hasMoreElements() ) { try diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 8f5bfddba32d..60252a3b71cb 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/container/XIndexAccess.hpp> #include <comphelper/interfacecontainer2.hxx> +#include <comphelper/multicontainer2.hxx> #include <sfx2/viewsh.hxx> #include <sfx2/docfac.hxx> #include <sfx2/viewfrm.hxx> @@ -353,7 +354,7 @@ struct IMPL_SfxBaseController_DataContainer Reference< XFrameActionListener > m_xListener ; Reference< XCloseListener > m_xCloseListener ; ::sfx2::UserInputInterception m_aUserInputInterception; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer ; + ::comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer ; ::comphelper::OInterfaceContainerHelper2 m_aInterceptorContainer ; Reference< XStatusIndicator > m_xIndicator ; SfxViewShell* m_pViewShell ; @@ -890,7 +891,7 @@ awt::Rectangle SAL_CALL SfxBaseController::queryBorderedArea( const awt::Rectang void SfxBaseController::BorderWidthsChanged_Impl() { - ::cppu::OInterfaceContainerHelper* pContainer = m_pData->m_aListenerContainer.getContainer( + ::comphelper::OInterfaceContainerHelper2* pContainer = m_pData->m_aListenerContainer.getContainer( cppu::UnoType<frame::XBorderResizeListener>::get()); if ( !pContainer ) return; @@ -898,7 +899,7 @@ void SfxBaseController::BorderWidthsChanged_Impl() frame::BorderWidths aBWidths = getBorder(); Reference< uno::XInterface > xThis( static_cast< ::cppu::OWeakObject* >(this), uno::UNO_QUERY ); - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + ::comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); while (pIterator.hasMoreElements()) { try diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 1b6f8d7fb166..b71d108b9cf6 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -33,6 +33,7 @@ #include <osl/mutex.hxx> #include <cppuhelper/interfacecontainer.h> #include <comphelper/interfacecontainer2.hxx> +#include <comphelper/multicontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <tools/UnitConversion.hxx> #include <vcl/svapp.hxx> @@ -295,7 +296,7 @@ private: public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OMultiTypeInterfaceContainerHelper m_Listeners; + ::comphelper::OMultiTypeInterfaceContainerHelper2 m_Listeners; SfxItemPropertySet const& m_rPropSet; const TOXTypes m_eTOXType; bool m_bIsDescriptor; @@ -1263,7 +1264,7 @@ void SAL_CALL SwXDocumentIndex::refresh() pTOXBase->UpdatePageNum(); } - ::cppu::OInterfaceContainerHelper *const pContainer( + ::comphelper::OInterfaceContainerHelper2 *const pContainer( m_pImpl->m_Listeners.getContainer( cppu::UnoType<util::XRefreshListener>::get())); if (pContainer) diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 8931bc098044..9c9b6d52c675 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -24,7 +24,7 @@ #include <algorithm> #include <limits> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <o3tl/any.hxx> #include <o3tl/safeint.hxx> #include <editeng/memberids.h> @@ -156,7 +156,7 @@ namespace void lcl_SendChartEvent( uno::Reference<uno::XInterface> const& xSource, - ::cppu::OMultiTypeInterfaceContainerHelper const& rListeners) + ::comphelper::OMultiTypeInterfaceContainerHelper2 const& rListeners) { auto pContainer(rListeners.getContainer(cppu::UnoType<chart::XChartDataChangeEventListener>::get())); if (pContainer) @@ -1913,7 +1913,7 @@ private: public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OMultiTypeInterfaceContainerHelper m_Listeners; + ::comphelper::OMultiTypeInterfaceContainerHelper2 m_Listeners; const SfxItemPropertySet * m_pPropSet; |