diff options
263 files changed, 1655 insertions, 707 deletions
diff --git a/animations/Library_animcore.mk b/animations/Library_animcore.mk index f0fca838f298..6246d571f38c 100644 --- a/animations/Library_animcore.mk +++ b/animations/Library_animcore.mk @@ -26,6 +26,7 @@ $(eval $(call gb_Library_set_componentfile,animcore,animations/source/animcore/a $(eval $(call gb_Library_use_sdk_api,animcore)) $(eval $(call gb_Library_use_libraries,animcore,\ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx index ab1bf53575b7..e4771a19170d 100644 --- a/animations/source/animcore/animcore.cxx +++ b/animations/source/animcore/animcore.cxx @@ -47,7 +47,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <comphelper/servicehelper.hxx> #include <cppuhelper/queryinterface.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/weakref.hxx> @@ -60,8 +60,8 @@ using ::osl::Mutex; using ::osl::Guard; -using ::cppu::OInterfaceContainerHelper; -using ::cppu::OInterfaceIteratorHelper; +using ::comphelper::OInterfaceContainerHelper2; +using ::comphelper::OInterfaceIteratorHelper2; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::XInterface; @@ -287,7 +287,7 @@ public: void fireChangeListener(); private: - OInterfaceContainerHelper maChangeListener; + OInterfaceContainerHelper2 maChangeListener; static void initTypeProvider( sal_Int16 nNodeType ) throw(); @@ -2129,7 +2129,7 @@ void AnimationNode::fireChangeListener() { Guard< Mutex > aGuard( maMutex ); - OInterfaceIteratorHelper aIterator( maChangeListener ); + OInterfaceIteratorHelper2 aIterator( maChangeListener ); if( aIterator.hasMoreElements() ) { Reference< XInterface > xSource( static_cast<OWeakObject*>(this), UNO_QUERY ); diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx index a53a87c5f372..7dc04ed73204 100644 --- a/avmedia/source/win/window.cxx +++ b/avmedia/source/win/window.cxx @@ -532,7 +532,7 @@ 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 ) { @@ -545,7 +545,7 @@ 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 ) { @@ -558,7 +558,7 @@ 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 ) { @@ -571,7 +571,7 @@ 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 ) { diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 0038dbc696c1..da309e79b7e7 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -25,7 +25,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/typeprovider.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/extract.hxx> #include <comphelper/processfactory.hxx> @@ -4297,7 +4297,7 @@ class ModuleInvocationProxy : public WeakImplHelper< XInvocation, XComponent > SbxObjectRef m_xScopeObj; bool m_bProxyIsClassModuleObject; - ::cppu::OInterfaceContainerHelper m_aListeners; + ::comphelper::OInterfaceContainerHelper2 m_aListeners; public: ModuleInvocationProxy( const OUString& aPrefix, SbxObjectRef xScopeObj ); diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index cdc8a652c0c8..0978c1de8cb9 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -79,8 +79,8 @@ class NameContainer : public ::cppu::BaseMutex, public NameContainer_BASE css::uno::Type mType; css::uno::XInterface* mpxEventSource; - ::cppu::OInterfaceContainerHelper maContainerListeners; - ::cppu::OInterfaceContainerHelper maChangesListeners; + ::comphelper::OInterfaceContainerHelper2 maContainerListeners; + ::comphelper::OInterfaceContainerHelper2 maChangesListeners; public: NameContainer( const css::uno::Type& rType ) @@ -157,7 +157,7 @@ public: class ModifiableHelper { private: - ::cppu::OInterfaceContainerHelper m_aModifyListeners; + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; ::cppu::OWeakObject& m_rEventSource; bool mbModified; diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index 41c6f33d533c..b473205c2b0c 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -60,7 +60,7 @@ #include <osl/mutex.hxx> #include <rtl/ref.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <svtools/grfmgr.hxx> #include <memory> @@ -130,7 +130,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > m_xDocumentProperties; ::rtl::Reference< UndoManager > m_pUndoManager; - ::cppu::OInterfaceContainerHelper m_aControllers; + ::comphelper::OInterfaceContainerHelper2 m_aControllers; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xCurrentController; sal_uInt16 m_nControllerLockCount; diff --git a/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx b/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx index ec0d858d4b7b..6ba98ac5e34a 100644 --- a/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx @@ -22,7 +22,7 @@ #include "WrappedPropertySet.hxx" #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -94,7 +94,7 @@ protected: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; }; } // namespace wrapper diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx index bc518df1dea2..e0dcf255d1eb 100644 --- a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx @@ -23,7 +23,7 @@ #include "ReferenceSizePropertyProvider.hxx" #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/chart/XAxis.hpp> #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -131,7 +131,7 @@ private: //methods private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; tAxisType m_eType; diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx index 8c850b7ff7d0..dfde917be350 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx @@ -607,16 +607,7 @@ void ChartDataWrapper::fireChartDataChangeEvent( if( xSrc.is() ) aEvent.Source = xSrc; - ::cppu::OInterfaceIteratorHelper aIter( m_aEventListenerContainer ); - - while( aIter.hasMoreElements() ) - { - uno::Reference< - ::com::sun::star::chart::XChartDataChangeEventListener > xListener( - aIter.next(), uno::UNO_QUERY ); - if( xListener.is() ) - xListener->chartDataChanged( aEvent ); - } + m_aEventListenerContainer.notifyEach( &css::chart::XChartDataChangeEventListener::chartDataChanged, aEvent ); } void ChartDataWrapper::switchToInternalDataProvider() diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx index d5ab6d096110..0f2f2f958faf 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx @@ -21,7 +21,7 @@ #include "MutexContainer.hxx" #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> #include <com/sun/star/chart/XDateCategories.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -157,7 +157,7 @@ private: //member ::com::sun::star::chart2::XAnyDescriptionAccess > m_xDataAccess; std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; }; } // namespace wrapper diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx index b95d58505773..da6455a5925a 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx @@ -23,7 +23,7 @@ #include "ReferenceSizePropertyProvider.hxx" #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/chart2/XDataSeries.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -126,7 +126,7 @@ protected: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; eType m_eType; sal_Int32 m_nSeriesIndexInNewAPI; diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx index bc2b0f33889c..0ec3eb56a7af 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx @@ -241,7 +241,7 @@ protected: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; ::com::sun::star::uno::Reference< ::com::sun::star::chart::XAxis > m_xXAxis; diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx index 590c232f00b7..a53e0b09e7b1 100644 --- a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx @@ -22,7 +22,7 @@ #include "WrappedPropertySet.hxx" #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -89,7 +89,7 @@ protected: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; tGridType m_eType; }; diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx index 2d6ea1c67705..8b1f1c2ed119 100644 --- a/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx @@ -23,7 +23,7 @@ #include "ReferenceSizePropertyProvider.hxx" #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -102,7 +102,7 @@ protected: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; }; } // namespace wrapper diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx index e779fdeea04b..08748bfe12d5 100644 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx @@ -21,7 +21,7 @@ #include "MutexContainer.hxx" #include "WrappedIgnoreProperty.hxx" -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/chart2/XDiagram.hpp> @@ -115,7 +115,7 @@ private: //methods private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; WrappedIgnoreProperty m_aWrappedLineJointProperty; }; diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx index 9bb457b38f30..648281f2310c 100644 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx @@ -123,7 +123,7 @@ private: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; ::chart::TitleHelper::eTitleType m_eTitleType; }; diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx index ae6f08f10c09..938fe0881932 100644 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx @@ -20,7 +20,7 @@ #define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_UPDOWNBARWRAPPER_HXX #include "MutexContainer.hxx" -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/chart2/XDiagram.hpp> @@ -114,7 +114,7 @@ private: //methods private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; OUString m_aPropertySetName; }; diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx index f9e5429d9a86..3773f1fbb2c2 100644 --- a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx @@ -22,7 +22,7 @@ #include "WrappedPropertySet.hxx" #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -76,7 +76,7 @@ protected: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; bool m_bWall; }; diff --git a/chart2/source/controller/main/CommandDispatch.cxx b/chart2/source/controller/main/CommandDispatch.cxx index 35cbf08400df..ea7fd7a157f4 100644 --- a/chart2/source/controller/main/CommandDispatch.cxx +++ b/chart2/source/controller/main/CommandDispatch.cxx @@ -86,7 +86,7 @@ void SAL_CALL CommandDispatch::addStatusListener( const Reference< frame::XStatu { aIt = m_aListeners.insert( m_aListeners.begin(), - tListenerMap::value_type( URL.Complete, new ::cppu::OInterfaceContainerHelper( m_aMutex ))); + tListenerMap::value_type( URL.Complete, new ::comphelper::OInterfaceContainerHelper2( m_aMutex ))); } OSL_ASSERT( aIt != m_aListeners.end()); @@ -155,7 +155,7 @@ void CommandDispatch::fireStatusEventForURL( { if( aIt->second ) { - ::cppu::OInterfaceIteratorHelper aIntfIt( *((*aIt).second) ); + ::comphelper::OInterfaceIteratorHelper2 aIntfIt( *((*aIt).second) ); while( aIntfIt.hasMoreElements()) { diff --git a/chart2/source/controller/main/CommandDispatch.hxx b/chart2/source/controller/main/CommandDispatch.hxx index 6d9feb0849e7..928691554fd6 100644 --- a/chart2/source/controller/main/CommandDispatch.hxx +++ b/chart2/source/controller/main/CommandDispatch.hxx @@ -21,6 +21,7 @@ #include "MutexContainer.hxx" #include <cppuhelper/compbase.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/util/XModifyListener.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -130,7 +131,7 @@ protected: ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; private: - typedef ::std::map< OUString, ::cppu::OInterfaceContainerHelper* > + typedef ::std::map< OUString, ::comphelper::OInterfaceContainerHelper2* > tListenerMap; tListenerMap m_aListeners; diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 3f7c8f3eb598..0b88e7546a0a 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -227,10 +227,10 @@ bool ChartModel::impl_isControllerConnected( const uno::Reference< frame::XContr { try { - uno::Sequence< uno::Reference<uno::XInterface> > aSeq = m_aControllers.getElements(); - for( sal_Int32 nN = aSeq.getLength(); nN--; ) + std::vector< uno::Reference<uno::XInterface> > aSeq = m_aControllers.getElements(); + for( const auto & r : aSeq ) { - if( aSeq[nN] == xController ) + if( r == xController ) return true; } } diff --git a/comphelper/CppunitTest_comphelper_ifcontainer.mk b/comphelper/CppunitTest_comphelper_ifcontainer.mk new file mode 100644 index 000000000000..d336c5546ab2 --- /dev/null +++ b/comphelper/CppunitTest_comphelper_ifcontainer.mk @@ -0,0 +1,29 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# +# 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/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,comphelper_ifcontainer)) + +$(eval $(call gb_CppunitTest_add_exception_objects,comphelper_ifcontainer,\ + comphelper/qa/container/comphelper_ifcontainer \ +)) + +$(eval $(call gb_CppunitTest_use_api,comphelper_ifcontainer,\ + udkapi \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,comphelper_ifcontainer,\ + comphelper \ + cppu \ + cppuhelper \ + sal \ + $(gb_UWINAPI) \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/comphelper/CppunitTest_comphelper_test.mk b/comphelper/CppunitTest_comphelper_test.mk index 89e071044ed7..47843c6ba8ad 100644 --- a/comphelper/CppunitTest_comphelper_test.mk +++ b/comphelper/CppunitTest_comphelper_test.mk @@ -11,6 +11,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,comphelper_test)) $(eval $(call gb_CppunitTest_add_exception_objects,comphelper_test, \ comphelper/qa/string/test_string \ + comphelper/qa/container/testifcontainer \ )) $(eval $(call gb_CppunitTest_use_api,comphelper_test, \ diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk index 6f2cc4c8f137..155d293b600e 100644 --- a/comphelper/Library_comphelper.mk +++ b/comphelper/Library_comphelper.mk @@ -60,6 +60,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\ comphelper/source/container/NamedPropertyValuesContainer \ comphelper/source/container/container \ comphelper/source/container/containermultiplexer \ + comphelper/source/container/interfacecontainer2 \ comphelper/source/container/embeddedobjectcontainer \ comphelper/source/container/enumerablemap \ comphelper/source/container/enumhelper \ diff --git a/comphelper/Module_comphelper.mk b/comphelper/Module_comphelper.mk index acd50c6827be..2eba43df73f8 100644 --- a/comphelper/Module_comphelper.mk +++ b/comphelper/Module_comphelper.mk @@ -30,6 +30,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,comphelper,\ $(eval $(call gb_Module_add_check_targets,comphelper,\ CppunitTest_comphelper_syntaxhighlight_test \ CppunitTest_comphelper_variadictemplates_test \ + CppunitTest_comphelper_ifcontainer \ CppunitTest_comphelper_test \ )) diff --git a/comphelper/qa/container/comphelper_ifcontainer.cxx b/comphelper/qa/container/comphelper_ifcontainer.cxx new file mode 100644 index 000000000000..ba9af495eaf0 --- /dev/null +++ b/comphelper/qa/container/comphelper_ifcontainer.cxx @@ -0,0 +1,212 @@ +/* -*- 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 . + */ + +#include <sal/types.h> + +#include <string.h> +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> + +#include <com/sun/star/lang/XEventListener.hpp> +#include <comphelper/interfacecontainer2.hxx> +#include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/propshlp.hxx> + +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; + +class ContainerListener; + +struct ContainerStats { + int m_nAlive; + int m_nDisposed; + ContainerStats() : m_nAlive(0), m_nDisposed(0) {} +}; + +class ContainerListener : public ::cppu::WeakImplHelper1< XEventListener > +{ + ContainerStats *m_pStats; +public: + explicit ContainerListener(ContainerStats *pStats) + : m_pStats(pStats) { m_pStats->m_nAlive++; } + virtual ~ContainerListener() { m_pStats->m_nAlive--; } + virtual void SAL_CALL disposing( const EventObject& ) + throw (RuntimeException, std::exception) override + { + m_pStats->m_nDisposed++; + } +}; + +namespace comphelper_ifcontainer +{ + static const int nTests = 10; + class IfTest : public CppUnit::TestFixture + { + osl::Mutex m_aGuard; + public: + void testCreateDispose() + { + ContainerStats aStats; + comphelper::OInterfaceContainerHelper2 *pContainer; + + pContainer = new comphelper::OInterfaceContainerHelper2(m_aGuard); + + CPPUNIT_ASSERT_MESSAGE("Empty container not empty", + pContainer->getLength() == 0); + + int i; + for (i = 0; i < nTests; i++) + { + Reference<XEventListener> xRef = new ContainerListener(&aStats); + int nNewLen = pContainer->addInterface(xRef); + + CPPUNIT_ASSERT_MESSAGE("addition length mismatch", + nNewLen == i + 1); + CPPUNIT_ASSERT_MESSAGE("addition length mismatch", + pContainer->getLength() == i + 1); + } + CPPUNIT_ASSERT_MESSAGE("alive count mismatch", + aStats.m_nAlive == nTests); + + EventObject aObj; + pContainer->disposeAndClear(aObj); + + CPPUNIT_ASSERT_MESSAGE("dispose count mismatch", + aStats.m_nDisposed == nTests); + CPPUNIT_ASSERT_MESSAGE("leaked container left alive", + aStats.m_nAlive == 0); + + delete pContainer; + } + + void testEnumerate() + { + int i; + ContainerStats aStats; + comphelper::OInterfaceContainerHelper2 *pContainer; + pContainer = new comphelper::OInterfaceContainerHelper2(m_aGuard); + + std::vector< Reference< XEventListener > > aListeners; + for (i = 0; i < nTests; i++) + { + Reference<XEventListener> xRef = new ContainerListener(&aStats); + pContainer->addInterface(xRef); + aListeners.push_back(xRef); + } + std::vector< Reference< XInterface > > aElements = pContainer->getElements(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("query contents", + (int)aElements.size(), nTests); + if ((int)aElements.size() == nTests) + { + for (i = 0; i < nTests; i++) + { + CPPUNIT_ASSERT_MESSAGE("mismatching elements", + aElements[i] == aListeners[i]); + } + } + pContainer->clear(); + + CPPUNIT_ASSERT_MESSAGE("non-empty container post clear", + pContainer->getLength() == 0); + delete pContainer; + } + + template < typename ContainerType, typename ContainedType > + void doContainerTest(const ContainedType *pTypes) + { + ContainerStats aStats; + ContainerType *pContainer; + pContainer = new ContainerType(m_aGuard); + + int i; + Reference<XEventListener> xRefs[nTests * 2]; + + // add these interfaces + for (i = 0; i < nTests * 2; i++) + { + xRefs[i] = new ContainerListener(&aStats); + pContainer->addInterface(pTypes[i / 2], xRefs[i]); + } + + // check it is all there + for (i = 0; i < nTests; i++) + { + cppu::OInterfaceContainerHelper *pHelper; + + pHelper = pContainer->getContainer(pTypes[i]); + + CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != nullptr); + Sequence<Reference< XInterface > > aSeq = pHelper->getElements(); + CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 2); + CPPUNIT_ASSERT_MESSAGE("match", aSeq[0] == xRefs[i*2]); + CPPUNIT_ASSERT_MESSAGE("match", aSeq[1] == xRefs[i*2+1]); + } + + // remove every other interface + for (i = 0; i < nTests; i++) + pContainer->removeInterface(pTypes[i], xRefs[i*2+1]); + + // check it is half there + for (i = 0; i < nTests; i++) + { + cppu::OInterfaceContainerHelper *pHelper; + + pHelper = pContainer->getContainer(pTypes[i]); + + CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != nullptr); + Sequence<Reference< XInterface > > aSeq = pHelper->getElements(); + CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 1); + CPPUNIT_ASSERT_MESSAGE("match", aSeq[0] == xRefs[i*2]); + } + + // remove the 1st half of the rest + for (i = 0; i < nTests / 2; i++) + pContainer->removeInterface(pTypes[i], xRefs[i*2]); + + // check it is half there + for (i = 0; i < nTests / 2; i++) + { + cppu::OInterfaceContainerHelper *pHelper; + + pHelper = pContainer->getContainer(pTypes[i]); + CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != nullptr); + Sequence<Reference< XInterface > > aSeq = pHelper->getElements(); + CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 0); + } + + delete pContainer; + } + + // Automatic registration code + CPPUNIT_TEST_SUITE(IfTest); + CPPUNIT_TEST(testCreateDispose); + CPPUNIT_TEST(testEnumerate); + CPPUNIT_TEST_SUITE_END(); + }; +} // namespace cppu_ifcontainer + +CPPUNIT_TEST_SUITE_REGISTRATION(comphelper_ifcontainer::IfTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/qa/container/testifcontainer.cxx b/comphelper/qa/container/testifcontainer.cxx new file mode 100644 index 000000000000..7533695640d0 --- /dev/null +++ b/comphelper/qa/container/testifcontainer.cxx @@ -0,0 +1,145 @@ +/* -*- 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 . + */ + +#include <osl/mutex.hxx> + +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <com/sun/star/beans/XVetoableChangeListener.hpp> + +using namespace ::cppu; +using namespace ::osl; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; + + +class TestListener : public WeakImplHelper1< XVetoableChangeListener > +{ +public: + // Methods + virtual void SAL_CALL disposing( const css::lang::EventObject& /*Source*/ ) throw(css::uno::RuntimeException) + { + + } + + virtual void SAL_CALL vetoableChange( const css::beans::PropertyChangeEvent& /*aEvent*/ ) + throw(css::beans::PropertyVetoException, css::uno::RuntimeException) + { + + } +}; + +void test_interfacecontainer() +{ + Mutex mutex; + + { + OInterfaceContainerHelper helper( mutex ); + + Reference< XVetoableChangeListener > r1 = new TestListener(); + Reference< XVetoableChangeListener > r2 = new TestListener(); + Reference< XVetoableChangeListener > r3 = new TestListener(); + + helper.addInterface( r1 ); + helper.addInterface( r2 ); + helper.addInterface( r3 ); + + helper.disposeAndClear( EventObject() ); + } + + { + OInterfaceContainerHelper helper( mutex ); + + Reference< XVetoableChangeListener > r1 = new TestListener(); + Reference< XVetoableChangeListener > r2 = new TestListener(); + Reference< XVetoableChangeListener > r3 = new TestListener(); + + helper.addInterface( r1 ); + helper.addInterface( r2 ); + helper.addInterface( r3 ); + + OInterfaceIteratorHelper iterator( helper ); + + while( iterator.hasMoreElements() ) + ((XVetoableChangeListener*)iterator.next())->vetoableChange( PropertyChangeEvent() ); + + helper.disposeAndClear( EventObject() ); + } + + { + OInterfaceContainerHelper helper( mutex ); + + Reference< XVetoableChangeListener > r1 = new TestListener(); + Reference< XVetoableChangeListener > r2 = new TestListener(); + Reference< XVetoableChangeListener > r3 = new TestListener(); + + helper.addInterface( r1 ); + helper.addInterface( r2 ); + helper.addInterface( r3 ); + + OInterfaceIteratorHelper iterator( helper ); + + ((XVetoableChangeListener*)iterator.next())->vetoableChange( PropertyChangeEvent() ); + iterator.remove(); + ((XVetoableChangeListener*)iterator.next())->vetoableChange( PropertyChangeEvent() ); + iterator.remove(); + ((XVetoableChangeListener*)iterator.next())->vetoableChange( PropertyChangeEvent() ); + iterator.remove(); + + OSL_ASSERT( helper.getLength() == 0 ); + helper.disposeAndClear( EventObject() ); + } + + { + OInterfaceContainerHelper helper( mutex ); + + Reference< XVetoableChangeListener > r1 = new TestListener(); + Reference< XVetoableChangeListener > r2 = new TestListener(); + Reference< XVetoableChangeListener > r3 = new TestListener(); + + helper.addInterface( r1 ); + helper.addInterface( r2 ); + helper.addInterface( r3 ); + + { + OInterfaceIteratorHelper iterator( helper ); + while( iterator.hasMoreElements() ) + { + Reference< XVetoableChangeListener > r = ((XVetoableChangeListener*)iterator.next()); + if( r == r1 ) + iterator.remove(); + } + } + OSL_ASSERT( helper.getLength() == 2 ); + { + OInterfaceIteratorHelper iterator( helper ); + while( iterator.hasMoreElements() ) + { + Reference< XVetoableChangeListener > r = ((XVetoableChangeListener*)iterator.next()); + OSL_ASSERT( r != r1 && ( r == r2 || r == r3 ) ); + } + } + + helper.disposeAndClear( EventObject() ); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/container/interfacecontainer2.cxx b/comphelper/source/container/interfacecontainer2.cxx new file mode 100644 index 000000000000..90f4e01b476e --- /dev/null +++ b/comphelper/source/container/interfacecontainer2.cxx @@ -0,0 +1,307 @@ +/* -*- 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 . + */ + + +#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> +#include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/propshlp.hxx> + +#include <osl/diagnose.h> +#include <osl/mutex.hxx> + +#include <memory> + +#include <com/sun/star/lang/XEventListener.hpp> + + +using namespace osl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; + +namespace comphelper +{ + +OInterfaceIteratorHelper2::OInterfaceIteratorHelper2( OInterfaceContainerHelper2 & rCont_ ) + : rCont( rCont_ ) +{ + MutexGuard aGuard( rCont.rMutex ); + if( rCont.bInUse ) + // worst case, two iterators at the same time + rCont.copyAndResetInUse(); + bIsList = rCont_.bIsList; + aData = rCont_.aData; + if( bIsList ) + { + rCont.bInUse = true; + nRemain = aData.pAsVector->size(); + } + else if( aData.pAsInterface ) + { + aData.pAsInterface->acquire(); + nRemain = 1; + } + else + nRemain = 0; +} + +OInterfaceIteratorHelper2::~OInterfaceIteratorHelper2() +{ + bool bShared; + { + MutexGuard aGuard( rCont.rMutex ); + // bResetInUse protect the iterator against recursion + bShared = aData.pAsVector == rCont.aData.pAsVector && rCont.bIsList; + if( bShared ) + { + OSL_ENSURE( rCont.bInUse, "OInterfaceContainerHelper2 must be in use" ); + rCont.bInUse = false; + } + } + + if( !bShared ) + { + if( bIsList ) + // Sequence owned by the iterator + delete aData.pAsVector; + else if( aData.pAsInterface ) + // Interface is acquired by the iterator + aData.pAsInterface->release(); + } +} + +XInterface * OInterfaceIteratorHelper2::next() +{ + if( nRemain ) + { + nRemain--; + if( bIsList ) + return (*aData.pAsVector)[nRemain].get(); + else if( aData.pAsInterface ) + return aData.pAsInterface; + } + // exception + return nullptr; +} + +void OInterfaceIteratorHelper2::remove() +{ + if( bIsList ) + { + OSL_ASSERT( nRemain >= 0 && + nRemain < (sal_Int32)aData.pAsVector->size() ); + rCont.removeInterface( (*aData.pAsVector)[nRemain] ); + } + else + { + OSL_ASSERT( 0 == nRemain ); + rCont.removeInterface( aData.pAsInterface ); + } +} + +OInterfaceContainerHelper2::OInterfaceContainerHelper2( Mutex & rMutex_ ) + : rMutex( rMutex_ ) + , bInUse( false ) + , bIsList( false ) +{ +} + +OInterfaceContainerHelper2::~OInterfaceContainerHelper2() +{ + OSL_ENSURE( !bInUse, "~OInterfaceContainerHelper2 but is in use" ); + if( bIsList ) + delete aData.pAsVector; + else if( aData.pAsInterface ) + aData.pAsInterface->release(); +} + +sal_Int32 OInterfaceContainerHelper2::getLength() const +{ + MutexGuard aGuard( rMutex ); + if( bIsList ) + return aData.pAsVector->size(); + else if( aData.pAsInterface ) + return 1; + return 0; +} + +std::vector< Reference<XInterface> > OInterfaceContainerHelper2::getElements() const +{ + std::vector< Reference<XInterface> > rVec; + MutexGuard aGuard( rMutex ); + if( bIsList ) + rVec = *aData.pAsVector; + else if( aData.pAsInterface ) + { + rVec.push_back( Reference<XInterface>( aData.pAsInterface ) ); + } + return rVec; +} + +void OInterfaceContainerHelper2::copyAndResetInUse() +{ + OSL_ENSURE( bInUse, "OInterfaceContainerHelper2 not in use" ); + if( bInUse ) + { + // this should be the worst case. If a iterator is active + // and a new Listener is added. + if( bIsList ) + aData.pAsVector = new std::vector< Reference< XInterface > >( *aData.pAsVector ); + else if( aData.pAsInterface ) + aData.pAsInterface->acquire(); + + bInUse = false; + } +} + +sal_Int32 OInterfaceContainerHelper2::addInterface( const Reference<XInterface> & rListener ) +{ + OSL_ASSERT( rListener.is() ); + MutexGuard aGuard( rMutex ); + if( bInUse ) + copyAndResetInUse(); + + if( bIsList ) + { + aData.pAsVector->push_back( rListener ); + return aData.pAsVector->size(); + } + else if( aData.pAsInterface ) + { + std::vector< Reference< XInterface > > * pVec = new std::vector< Reference< XInterface > >( 2 ); + (*pVec)[0] = aData.pAsInterface; + (*pVec)[1] = rListener; + aData.pAsInterface->release(); + aData.pAsVector = pVec; + bIsList = true; + return 2; + } + else + { + aData.pAsInterface = rListener.get(); + if( rListener.is() ) + rListener->acquire(); + return 1; + } +} + +sal_Int32 OInterfaceContainerHelper2::removeInterface( const Reference<XInterface> & rListener ) +{ + OSL_ASSERT( rListener.is() ); + MutexGuard aGuard( rMutex ); + if( bInUse ) + copyAndResetInUse(); + + if( bIsList ) + { + sal_Int32 nLen = aData.pAsVector->size(); + sal_Int32 i; + for( i = 0; i < nLen; i++ ) + { + // It is not valid to compare the pointer directly, but it's faster. + if( (*aData.pAsVector)[i].get() == rListener.get() ) + { + aData.pAsVector->erase(aData.pAsVector->begin()+i); + break; + } + } + + // interface not found, use the correct compare method + if( i == nLen ) + { + for( i = 0; i < nLen; i++ ) + { + if( (*aData.pAsVector)[i] == rListener ) + { + aData.pAsVector->erase(aData.pAsVector->begin()+i); + break; + } + } + } + + if( aData.pAsVector->size() == 1 ) + { + XInterface * p = (*aData.pAsVector)[0].get(); + p->acquire(); + delete aData.pAsVector; + aData.pAsInterface = p; + bIsList = false; + return 1; + } + else + return aData.pAsVector->size(); + } + else if( aData.pAsInterface && Reference<XInterface>( aData.pAsInterface ) == rListener ) + { + aData.pAsInterface->release(); + aData.pAsInterface = nullptr; + } + return aData.pAsInterface ? 1 : 0; +} + +void OInterfaceContainerHelper2::disposeAndClear( const EventObject & rEvt ) +{ + ClearableMutexGuard aGuard( rMutex ); + OInterfaceIteratorHelper2 aIt( *this ); + // Release container, in case new entries come while disposing + OSL_ENSURE( !bIsList || bInUse, "OInterfaceContainerHelper2 not in use" ); + if( !bIsList && aData.pAsInterface ) + aData.pAsInterface->release(); + // set the member to null, use the iterator to delete the values + aData.pAsInterface = nullptr; + bIsList = false; + bInUse = false; + aGuard.clear(); + while( aIt.hasMoreElements() ) + { + try + { + Reference<XEventListener > xLst( aIt.next(), UNO_QUERY ); + if( xLst.is() ) + xLst->disposing( rEvt ); + } + catch ( RuntimeException & ) + { + // be robust, if e.g. a remote bridge has disposed already. + // there is no way to delegate the error to the caller :o(. + } + } +} + + +void OInterfaceContainerHelper2::clear() +{ + ClearableMutexGuard aGuard( rMutex ); + OInterfaceIteratorHelper2 aIt( *this ); + // Release container, in case new entries come while disposing + OSL_ENSURE( !bIsList || bInUse, "OInterfaceContainerHelper2 not in use" ); + if( !bIsList && aData.pAsInterface ) + aData.pAsInterface->release(); + // set the member to null, use the iterator to delete the values + aData.pAsInterface = nullptr; + bIsList = false; + bInUse = false; + // release mutex before aIt destructor call + aGuard.clear(); +} + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx index 0717ea136130..2f2fb5d03883 100644 --- a/comphelper/source/eventattachermgr/eventattachermgr.cxx +++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx @@ -40,7 +40,7 @@ #include <com/sun/star/script/XEventAttacherManager.hpp> #include <com/sun/star/script/XScriptListener.hpp> #include <cppuhelper/weak.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/implbase.hxx> #include <deque> @@ -82,7 +82,7 @@ class ImplEventAttacherManager ::std::deque< AttacherIndex_Impl > aIndex; Mutex aLock; // Container for the ScriptListener - OInterfaceContainerHelper aScriptListeners; + OInterfaceContainerHelper2 aScriptListeners; // Instance of EventAttacher Reference< XEventAttacher2 > xAttacher; Reference< XComponentContext > mxContext; @@ -193,7 +193,7 @@ void SAL_CALL AttacherAllListener_Impl::firing(const AllEventObject& Event) aScriptEvent.ScriptCode = aScriptCode; // Iterate over all listeners and pass events. - OInterfaceIteratorHelper aIt( mpManager->aScriptListeners ); + OInterfaceIteratorHelper2 aIt( mpManager->aScriptListeners ); while( aIt.hasMoreElements() ) static_cast<XScriptListener *>(aIt.next())->firing( aScriptEvent ); } @@ -259,7 +259,7 @@ Any SAL_CALL AttacherAllListener_Impl::approveFiring( const AllEventObject& Even Any aRet; // Iterate over all listeners and pass events. - OInterfaceIteratorHelper aIt( mpManager->aScriptListeners ); + OInterfaceIteratorHelper2 aIt( mpManager->aScriptListeners ); while( aIt.hasMoreElements() ) { aRet = static_cast<XScriptListener *>(aIt.next())->approveFiring( aScriptEvent ); diff --git a/comphelper/source/misc/accessibleeventnotifier.cxx b/comphelper/source/misc/accessibleeventnotifier.cxx index 0d2cb848d34d..348fb555941a 100644 --- a/comphelper/source/misc/accessibleeventnotifier.cxx +++ b/comphelper/source/misc/accessibleeventnotifier.cxx @@ -20,7 +20,7 @@ #include <comphelper/accessibleeventnotifier.hxx> #include <osl/diagnose.h> #include <rtl/instance.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/guarding.hxx> #include <map> @@ -37,7 +37,7 @@ namespace AccessibleEventObject > ClientEvent; typedef ::std::map< AccessibleEventNotifier::TClientId, - ::cppu::OInterfaceContainerHelper*, + ::comphelper::OInterfaceContainerHelper2*, ::std::less< AccessibleEventNotifier::TClientId > > ClientMap; /// key is the end of the interval, value is the start of the interval @@ -153,8 +153,8 @@ namespace comphelper TClientId nNewClientId = generateId( ); // the event listeners for the new client - ::cppu::OInterfaceContainerHelper *const pNewListeners = - new ::cppu::OInterfaceContainerHelper( lclMutex::get() ); + ::comphelper::OInterfaceContainerHelper2 *const pNewListeners = + new ::comphelper::OInterfaceContainerHelper2( lclMutex::get() ); // note that we're using our own mutex here, so the listener containers for all // our clients share this same mutex. // this is a reminiscence to the days where the notifier was asynchronous. Today this is @@ -187,7 +187,7 @@ namespace comphelper void AccessibleEventNotifier::revokeClientNotifyDisposing( const TClientId _nClient, const Reference< XInterface >& _rxEventSource ) { - ::cppu::OInterfaceContainerHelper* pListeners(nullptr); + ::comphelper::OInterfaceContainerHelper2* pListeners(nullptr); { // rhbz#1001768 drop the mutex before calling disposeAndClear @@ -255,7 +255,7 @@ namespace comphelper void AccessibleEventNotifier::addEvent( const TClientId _nClient, const AccessibleEventObject& _rEvent ) { - Sequence< Reference< XInterface > > aListeners; + std::vector< Reference< XInterface > > aListeners; // --- <mutex lock> ------------------------------- { @@ -272,20 +272,17 @@ namespace comphelper // --- </mutex lock> ------------------------------ // default handling: loop through all listeners, and notify them - const Reference< XInterface >* pListeners = aListeners.getConstArray(); - const Reference< XInterface >* pListenersEnd = pListeners + aListeners.getLength(); - while ( pListeners != pListenersEnd ) + for ( const auto& rListener : aListeners ) { try { - static_cast< XAccessibleEventListener* >( pListeners->get() )->notifyEvent( _rEvent ); + static_cast< XAccessibleEventListener* >( rListener.get() )->notifyEvent( _rEvent ); } catch( const Exception& ) { // no assertion, because a broken access remote bridge or something like this // can cause this exception } - ++pListeners; } } diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx index 131efb7e2935..01937dd4c95b 100644 --- a/comphelper/source/misc/instancelocker.cxx +++ b/comphelper/source/misc/instancelocker.cxx @@ -104,7 +104,7 @@ void SAL_CALL OInstanceLocker::addEventListener( const uno::Reference< lang::XEv throw lang::DisposedException(); // TODO if ( !m_pListenersContainer ) - m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); + m_pListenersContainer = new ::comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pListenersContainer->addInterface( xListener ); } diff --git a/comphelper/source/misc/instancelocker.hxx b/comphelper/source/misc/instancelocker.hxx index de9064d280a9..3ac86e534715 100644 --- a/comphelper/source/misc/instancelocker.hxx +++ b/comphelper/source/misc/instancelocker.hxx @@ -31,7 +31,7 @@ #include <cppuhelper/weakref.hxx> #include <osl/mutex.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> class OLockListener; @@ -47,7 +47,7 @@ class OInstanceLocker : public ::cppu::WeakImplHelper< css::lang::XComponent, css::uno::Reference< css::uno::XInterface > m_xLockListener; OLockListener* m_pLockListener; - ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners + ::comphelper::OInterfaceContainerHelper2* m_pListenersContainer; // list of listeners bool m_bDisposed; bool m_bInitialized; diff --git a/comphelper/source/misc/listenernotification.cxx b/comphelper/source/misc/listenernotification.cxx index 7dc4332ff43e..5c0c56de2458 100644 --- a/comphelper/source/misc/listenernotification.cxx +++ b/comphelper/source/misc/listenernotification.cxx @@ -48,7 +48,7 @@ namespace comphelper void OListenerContainer::impl_removeListener( const Reference< XEventListener >& _rxListener ) { #if OSL_DEBUG_LEVEL > 0 - ::cppu::OInterfaceIteratorHelper aIter( m_aListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aListeners ); bool bFound = false; while ( aIter.hasMoreElements() && !bFound ) { @@ -74,7 +74,7 @@ namespace comphelper bool OListenerContainer::impl_notify( const EventObject& _rEvent ) { - ::cppu::OInterfaceIteratorHelper aIter( m_aListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aListeners ); bool bCancelled = false; while ( aIter.hasMoreElements() && !bCancelled ) { diff --git a/comphelper/source/property/opropertybag.hxx b/comphelper/source/property/opropertybag.hxx index a939ded5ea38..e2246f4a39cb 100644 --- a/comphelper/source/property/opropertybag.hxx +++ b/comphelper/source/property/opropertybag.hxx @@ -30,6 +30,7 @@ #include <boost/noncopyable.hpp> #include <cppuhelper/implbase5.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/propstate.hxx> #include <comphelper/broadcasthelper.hxx> #include <comphelper/propertybag.hxx> @@ -84,7 +85,7 @@ namespace comphelper bool m_bAutoAddProperties; /// for notification - ::cppu::OInterfaceContainerHelper m_NotifyListeners; + ::comphelper::OInterfaceContainerHelper2 m_NotifyListeners; /// modify flag bool m_isModified; diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx index dd87288b6076..1a034ee2e57c 100644 --- a/connectivity/source/commontools/parameters.cxx +++ b/connectivity/source/commontools/parameters.cxx @@ -693,7 +693,7 @@ namespace dbtools // TODO: shouldn't we subtract all the parameters which were already visited? if ( nParamsLeft ) { - ::cppu::OInterfaceIteratorHelper aIter( m_aParameterListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aParameterListeners ); Reference< XPropertySet > xProp = m_xComponent; OSL_ENSURE(xProp.is(),"Some already released my component!"); DatabaseParameterEvent aEvent( xProp.get(), m_pOuterParameters.get() ); diff --git a/connectivity/source/drivers/hsqldb/HTables.cxx b/connectivity/source/drivers/hsqldb/HTables.cxx index 0a7c703509be..a519e926315f 100644 --- a/connectivity/source/drivers/hsqldb/HTables.cxx +++ b/connectivity/source/drivers/hsqldb/HTables.cxx @@ -175,7 +175,7 @@ void OTables::appendNew(const OUString& _rsNewTable) // notify our container listeners ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any()); - OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners); + OInterfaceIteratorHelper2 aListenerLoop(m_aContainerListeners); while (aListenerLoop.hasMoreElements()) static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent); } diff --git a/connectivity/source/drivers/mysql/YTables.cxx b/connectivity/source/drivers/mysql/YTables.cxx index b8c3237e1211..5c1e2da0e958 100644 --- a/connectivity/source/drivers/mysql/YTables.cxx +++ b/connectivity/source/drivers/mysql/YTables.cxx @@ -196,7 +196,7 @@ void OTables::appendNew(const OUString& _rsNewTable) // notify our container listeners ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any()); - OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners); + OInterfaceIteratorHelper2 aListenerLoop(m_aContainerListeners); while (aListenerLoop.hasMoreElements()) static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent); } diff --git a/connectivity/source/inc/hsqldb/HConnection.hxx b/connectivity/source/inc/hsqldb/HConnection.hxx index 1db8caf6fc0f..309c033d9dff 100644 --- a/connectivity/source/inc/hsqldb/HConnection.hxx +++ b/connectivity/source/inc/hsqldb/HConnection.hxx @@ -27,7 +27,7 @@ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <cppuhelper/compbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> namespace connectivity { @@ -57,7 +57,7 @@ namespace connectivity ,public IMethodGuardAccess { private: - ::cppu::OInterfaceContainerHelper m_aFlushListeners; + ::comphelper::OInterfaceContainerHelper2 m_aFlushListeners; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > m_xDriver; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; bool m_bIni; diff --git a/connectivity/source/sdbcx/VCollection.cxx b/connectivity/source/sdbcx/VCollection.cxx index f2be688a0963..5b4e96553b19 100644 --- a/connectivity/source/sdbcx/VCollection.cxx +++ b/connectivity/source/sdbcx/VCollection.cxx @@ -422,7 +422,7 @@ void OCollection::notifyElementRemoved(const OUString& _sName) { ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_sName), Any(), Any()); // note that xExistent may be empty, in case somebody removed the data source while it is not alive at this moment - OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners); + OInterfaceIteratorHelper2 aListenerLoop(m_aContainerListeners); while (aListenerLoop.hasMoreElements()) static_cast<XContainerListener*>(aListenerLoop.next())->elementRemoved(aEvent); } @@ -518,7 +518,7 @@ void OCollection::renameObject(const OUString& _sOldName, const OUString& _sNewN { ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_sNewName), makeAny(m_pElements->getObject(_sNewName)),makeAny(_sOldName)); // note that xExistent may be empty, in case somebody removed the data source while it is not alive at this moment - OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners); + OInterfaceIteratorHelper2 aListenerLoop(m_aContainerListeners); while (aListenerLoop.hasMoreElements()) static_cast<XContainerListener*>(aListenerLoop.next())->elementReplaced(aEvent); } diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 58e450859e7b..ae66546c4521 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -103,26 +103,25 @@ com_sun_star_comp_dba_ORowSet_get_implementation(css::uno::XComponentContext* co } #define NOTIFY_LISTENERS_CHECK(_rListeners,T,method) \ - Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \ + std::vector< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \ \ - const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray(); \ - const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \ + auto it = aListenerSeq.rbegin(); \ + const auto itEnd = aListenerSeq.rend(); \ \ _rGuard.clear(); \ bool bCheck = true; \ - while( pxInt > pxIntBegin && bCheck ) \ + for ( ; it != itEnd; ) \ { \ try \ { \ - while( pxInt > pxIntBegin && bCheck ) \ - { \ - --pxInt; \ - bCheck = static_cast< T* >( pxInt->get() )->method(aEvt); \ - } \ + bCheck = static_cast< T* >( it->get() )->method(aEvt); \ + if (!bCheck) \ + break; \ } \ catch( RuntimeException& ) \ { \ } \ + ++it; \ } \ _rGuard.reset(); @@ -1514,7 +1513,7 @@ void ORowSet::approveExecution() throw (RowSetVetoException, RuntimeException) ::osl::MutexGuard aGuard( m_aColumnsMutex ); EventObject aEvt(*this); - OInterfaceIteratorHelper aApproveIter( m_aApproveListeners ); + OInterfaceIteratorHelper2 aApproveIter( m_aApproveListeners ); while ( aApproveIter.hasMoreElements() ) { Reference< XRowSetApproveListener > xListener( static_cast< XRowSetApproveListener* >( aApproveIter.next() ) ); diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx index 75822a4b0732..4bc14a83e252 100644 --- a/dbaccess/source/core/api/RowSet.hxx +++ b/dbaccess/source/core/api/RowSet.hxx @@ -42,6 +42,7 @@ #include <com/sun/star/sdb/XRowsChangeBroadcaster.hpp> #include <cppuhelper/compbase12.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <connectivity/paramwrapper.hxx> #include <connectivity/FValue.hxx> #include <connectivity/warningscontainer.hxx> @@ -91,9 +92,9 @@ namespace dbaccess ::std::vector<bool> m_aParametersSet; ::std::vector<bool> m_aReadOnlyDataColumns; - ::cppu::OInterfaceContainerHelper m_aRowsetListeners; - ::cppu::OInterfaceContainerHelper m_aApproveListeners; - ::cppu::OInterfaceContainerHelper m_aRowsChangeListener; + ::comphelper::OInterfaceContainerHelper2 m_aRowsetListeners; + ::comphelper::OInterfaceContainerHelper2 m_aApproveListeners; + ::comphelper::OInterfaceContainerHelper2 m_aRowsChangeListener; ::dbtools::WarningsContainer m_aWarnings; diff --git a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx index a7490bd7cd01..173ed8866437 100644 --- a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx +++ b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx @@ -107,7 +107,7 @@ void SAL_CALL OBookmarkContainer::insertByName( const OUString& _rName, const An if (m_aContainerListeners.getLength()) { ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sNewLink), Any()); - OInterfaceIteratorHelper aListenerIterator(m_aContainerListeners); + OInterfaceIteratorHelper2 aListenerIterator(m_aContainerListeners); while (aListenerIterator.hasMoreElements()) static_cast< XContainerListener* >(aListenerIterator.next())->elementInserted(aEvent); } @@ -137,7 +137,7 @@ void SAL_CALL OBookmarkContainer::removeByName( const OUString& _rName ) throw(N if (m_aContainerListeners.getLength()) { ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sOldBookmark), Any()); - OInterfaceIteratorHelper aListenerIterator(m_aContainerListeners); + OInterfaceIteratorHelper2 aListenerIterator(m_aContainerListeners); while (aListenerIterator.hasMoreElements()) static_cast< XContainerListener* >(aListenerIterator.next())->elementRemoved(aEvent); } @@ -172,7 +172,7 @@ void SAL_CALL OBookmarkContainer::replaceByName( const OUString& _rName, const A if (m_aContainerListeners.getLength()) { ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sNewLink), makeAny(sOldLink)); - OInterfaceIteratorHelper aListenerIterator(m_aContainerListeners); + OInterfaceIteratorHelper2 aListenerIterator(m_aContainerListeners); while (aListenerIterator.hasMoreElements()) static_cast< XContainerListener* >(aListenerIterator.next())->elementReplaced(aEvent); } diff --git a/dbaccess/source/core/dataaccess/bookmarkcontainer.hxx b/dbaccess/source/core/dataaccess/bookmarkcontainer.hxx index d1e2f4df4ee7..63a99c9e91dc 100644 --- a/dbaccess/source/core/dataaccess/bookmarkcontainer.hxx +++ b/dbaccess/source/core/dataaccess/bookmarkcontainer.hxx @@ -25,7 +25,7 @@ #include <map> #include <vector> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/implbase.hxx> #include <osl/mutex.hxx> #include <com/sun/star/container/XChild.hpp> @@ -64,7 +64,7 @@ protected: protected: ::cppu::OWeakObject& m_rParent; // for the ref counting - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners; ::osl::Mutex& m_rMutex; diff --git a/dbaccess/source/core/dataaccess/databasecontext.hxx b/dbaccess/source/core/dataaccess/databasecontext.hxx index cf862300d378..1eb7233b7821 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.hxx +++ b/dbaccess/source/core/dataaccess/databasecontext.hxx @@ -106,7 +106,7 @@ protected: // recreated afterwards. So it's our (the context's) responsibility to store the session-persistent // properties. - ::cppu::OInterfaceContainerHelper m_aContainerListeners; + ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners; DatabaseDocumentLoader* m_pDatabaseDocumentLoader; public: diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 89d1b171e457..06f2c6a232ba 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -165,9 +165,9 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe typedef std::map< OUString, css::uno::Reference< css::frame::XUntitledNumbers > > TNumberedController; css::uno::Reference< css::ui::XUIConfigurationManager2> m_xUIConfigurationManager; - ::cppu::OInterfaceContainerHelper m_aModifyListeners; - ::cppu::OInterfaceContainerHelper m_aCloseListener; - ::cppu::OInterfaceContainerHelper m_aStorageListeners; + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; + ::comphelper::OInterfaceContainerHelper2 m_aCloseListener; + ::comphelper::OInterfaceContainerHelper2 m_aStorageListeners; DocumentEvents* m_pEventContainer; ::rtl::Reference< DocumentEventExecutor > m_pEventExecutor; diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.cxx b/dbaccess/source/core/dataaccess/databaseregistrations.cxx index e132fbe786b8..3a6aac442967 100644 --- a/dbaccess/source/core/dataaccess/databaseregistrations.cxx +++ b/dbaccess/source/core/dataaccess/databaseregistrations.cxx @@ -20,7 +20,7 @@ #include <com/sun/star/sdb/XDatabaseRegistrations.hpp> #include <cppuhelper/basemutex.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/implbase1.hxx> #include <rtl/ustrbuf.hxx> #include <unotools/pathoptions.hxx> @@ -134,7 +134,7 @@ namespace dbaccess private: Reference<XComponentContext> m_aContext; ::utl::OConfigurationTreeRoot m_aConfigurationRoot; - ::cppu::OInterfaceContainerHelper m_aRegistrationListeners; + ::comphelper::OInterfaceContainerHelper2 m_aRegistrationListeners; }; // DatabaseRegistrations - implementation diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx index 446b846fbd7a..5c898ae6ea96 100644 --- a/dbaccess/source/core/dataaccess/datasource.hxx +++ b/dbaccess/source/core/dataaccess/datasource.hxx @@ -83,7 +83,7 @@ class ODatabaseSource :public ModelDependentComponent // must be first private: using ODatabaseSource_Base::rBHelper; css::uno::Reference<OBookmarkContainer> m_xBookmarks; - ::cppu::OInterfaceContainerHelper m_aFlushListeners; + ::comphelper::OInterfaceContainerHelper2 m_aFlushListeners; private: virtual ~ODatabaseSource(); diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx index fc601b4fccf8..8535b30fa271 100644 --- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx +++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx @@ -289,7 +289,7 @@ void ODefinitionContainer::notifyByName( ResettableMutexGuard& _rGuard, const OU { bool bApprove = ( _eType == ApproveListeners ); - ::cppu::OInterfaceContainerHelper& rContainer( bApprove ? m_aApproveListeners : m_aContainerListeners ); + ::comphelper::OInterfaceContainerHelper2& rContainer( bApprove ? m_aApproveListeners : m_aContainerListeners ); if ( !rContainer.getLength() ) return; diff --git a/dbaccess/source/core/dataaccess/documenteventnotifier.cxx b/dbaccess/source/core/dataaccess/documenteventnotifier.cxx index 2dd4838e2893..b6858068500e 100644 --- a/dbaccess/source/core/dataaccess/documenteventnotifier.cxx +++ b/dbaccess/source/core/dataaccess/documenteventnotifier.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/frame/DoubleInitializationException.hpp> #include <comphelper/asyncnotification.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/weak.hxx> #include <tools/diagnose_ex.h> @@ -59,8 +59,8 @@ namespace dbaccess bool m_bInitialized; bool m_bDisposed; ::rtl::Reference< ::comphelper::AsyncEventNotifier > m_pEventBroadcaster; - ::cppu::OInterfaceContainerHelper m_aLegacyEventListeners; - ::cppu::OInterfaceContainerHelper m_aDocumentEventListeners; + ::comphelper::OInterfaceContainerHelper2 m_aLegacyEventListeners; + ::comphelper::OInterfaceContainerHelper2 m_aDocumentEventListeners; public: DocumentEventNotifier_Impl( ::cppu::OWeakObject& _rBroadcasterDocument, ::osl::Mutex& _rMutex ) diff --git a/dbaccess/source/core/dataaccess/intercept.hxx b/dbaccess/source/core/dataaccess/intercept.hxx index 6d80e4f444eb..fb4c4230d2a2 100644 --- a/dbaccess/source/core/dataaccess/intercept.hxx +++ b/dbaccess/source/core/dataaccess/intercept.hxx @@ -131,7 +131,7 @@ private: css::uno::Sequence< OUString > m_aInterceptedURL; - cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; + comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; PropertyChangeListenerContainer* m_pStatCL; }; diff --git a/dbaccess/source/core/inc/ContentHelper.hxx b/dbaccess/source/core/inc/ContentHelper.hxx index 3e5c74e5de77..768b4b92e4ad 100644 --- a/dbaccess/source/core/inc/ContentHelper.hxx +++ b/dbaccess/source/core/inc/ContentHelper.hxx @@ -32,6 +32,7 @@ #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <cppuhelper/compbase.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/broadcasthelper.hxx> #include <comphelper/uno3.hxx> #include <com/sun/star/beans/Property.hpp> @@ -101,7 +102,7 @@ namespace dbaccess void impl_rename_throw(const OUString& _sNewName,bool _bNotify = true); protected: - ::cppu::OInterfaceContainerHelper m_aContentListeners; + ::comphelper::OInterfaceContainerHelper2 m_aContentListeners; PropertyChangeListenerContainer m_aPropertyChangeListeners; css::uno::Reference< css::uno::XInterface > m_xParentContainer; diff --git a/dbaccess/source/core/inc/definitioncontainer.hxx b/dbaccess/source/core/inc/definitioncontainer.hxx index 1f7c594b3593..bdefec380f7b 100644 --- a/dbaccess/source/core/inc/definitioncontainer.hxx +++ b/dbaccess/source/core/inc/definitioncontainer.hxx @@ -120,9 +120,9 @@ protected: DocumentsIndexAccess m_aDocuments; // for a efficient index access Documents m_aDocumentMap; // for a efficient name access - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aApproveListeners; - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners; bool m_bInPropertyChange; diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 5d1d893e3775..3a391f509762 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -187,7 +187,7 @@ Reference< XInterface > SAL_CALL OApplicationController::Create(const Reference< class SelectionNotifier : public ::boost::noncopyable { private: - ::cppu::OInterfaceContainerHelper m_aSelectionListeners; + ::comphelper::OInterfaceContainerHelper2 m_aSelectionListeners; ::cppu::OWeakObject& m_rContext; sal_Int32 m_nSelectionNestingLevel; @@ -2340,7 +2340,7 @@ IController& OApplicationController::getCommandController() return *this; } -::cppu::OInterfaceContainerHelper* OApplicationController::getContextMenuInterceptors() +::comphelper::OInterfaceContainerHelper2* OApplicationController::getContextMenuInterceptors() { return &m_aContextMenuInterceptors; } diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx index 7da651439903..e73f1eab3f7c 100644 --- a/dbaccess/source/ui/app/AppController.hxx +++ b/dbaccess/source/ui/app/AppController.hxx @@ -38,6 +38,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <comphelper/uno3.hxx> #include <cppuhelper/implbase5.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <sot/storage.hxx> #include <svtools/transfer.hxx> #include <svx/dataaccessdescriptor.hxx> @@ -99,7 +100,7 @@ namespace dbaui m_xDataSource; css::uno::Reference< css::frame::XModel > m_xModel; - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aContextMenuInterceptors; TContainerVector m_aCurrentContainers; // the containers where we are listener on @@ -536,7 +537,7 @@ namespace dbaui // IContextMenuProvider virtual PopupMenu* getContextMenu( Control& _rControl ) const override; virtual IController& getCommandController() override; - virtual ::cppu::OInterfaceContainerHelper* + virtual ::comphelper::OInterfaceContainerHelper2* getContextMenuInterceptors() override; virtual css::uno::Any getCurrentSelection( Control& _rControl ) const override; diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 36425d0f9c7f..f47a075fa737 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -154,7 +154,7 @@ class SbaXDataBrowserController::FormControllerImpl css::frame::XFrameActionListener > { friend class SbaXDataBrowserController; - ::cppu::OInterfaceContainerHelper m_aActivateListeners; + ::comphelper::OInterfaceContainerHelper2 m_aActivateListeners; SbaXDataBrowserController* m_pOwner; public: @@ -935,7 +935,7 @@ void SAL_CALL SbaXDataBrowserController::focusGained(const FocusEvent& /*e*/) th { // notify our activate listeners (registered on the form controller aggregate) EventObject aEvt(*this); - ::cppu::OInterfaceIteratorHelper aIter(m_pFormControllerImpl->m_aActivateListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_pFormControllerImpl->m_aActivateListeners); while (aIter.hasMoreElements()) static_cast<XFormControllerListener*>(aIter.next())->formActivated(aEvt); } @@ -961,7 +961,7 @@ void SAL_CALL SbaXDataBrowserController::focusLost(const FocusEvent& e) throw( R // notify the listeners that the "form" we represent has been deactivated EventObject aEvt(*this); - ::cppu::OInterfaceIteratorHelper aIter(m_pFormControllerImpl->m_aActivateListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_pFormControllerImpl->m_aActivateListeners); while (aIter.hasMoreElements()) static_cast<XFormControllerListener*>(aIter.next())->formDeactivated(aEvt); diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx index c3d2195a2262..e840504dcf34 100644 --- a/dbaccess/source/ui/browser/exsrcbrw.cxx +++ b/dbaccess/source/ui/browser/exsrcbrw.cxx @@ -123,7 +123,7 @@ void SbaExternalSourceBrowser::modified(const css::lang::EventObject& aEvent) th // multiplex this event to all my listeners css::lang::EventObject aEvt(*this); - ::cppu::OInterfaceIteratorHelper aIt(m_aModifyListeners); + ::comphelper::OInterfaceIteratorHelper2 aIt(m_aModifyListeners); while (aIt.hasMoreElements()) static_cast< css::util::XModifyListener*>(aIt.next())->modified(aEvt); } diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx index a25eefce39d5..49a6a3030f1d 100644 --- a/dbaccess/source/ui/browser/formadapter.cxx +++ b/dbaccess/source/ui/browser/formadapter.cxx @@ -168,7 +168,7 @@ void SbaXFormAdapter::AttachForm(const Reference< css::sdbc::XRowSet >& xNewMast if (xLoadable->isLoaded()) { css::lang::EventObject aEvt(*this); - ::cppu::OInterfaceIteratorHelper aIt(m_aLoadListeners); + ::comphelper::OInterfaceIteratorHelper2 aIt(m_aLoadListeners); while (aIt.hasMoreElements()) static_cast< css::form::XLoadListener*>(aIt.next())->unloaded(aEvt); } @@ -185,7 +185,7 @@ void SbaXFormAdapter::AttachForm(const Reference< css::sdbc::XRowSet >& xNewMast if (xLoadable->isLoaded()) { css::lang::EventObject aEvt(*this); - ::cppu::OInterfaceIteratorHelper aIt(m_aLoadListeners); + ::comphelper::OInterfaceIteratorHelper2 aIt(m_aLoadListeners); while (aIt.hasMoreElements()) static_cast< css::form::XLoadListener*>(aIt.next())->loaded(aEvt); } @@ -1421,7 +1421,7 @@ void SbaXFormAdapter::implInsert(const Any& aElement, sal_Int32 nIndex, const OU aEvt.Source = *this; aEvt.Accessor <<= nIndex; aEvt.Element <<= xElement; - ::cppu::OInterfaceIteratorHelper aIt(m_aContainerListeners); + ::comphelper::OInterfaceIteratorHelper2 aIt(m_aContainerListeners); while (aIt.hasMoreElements()) static_cast< css::container::XContainerListener*>(aIt.next())->elementInserted(aEvt); } @@ -1526,7 +1526,7 @@ void SAL_CALL SbaXFormAdapter::removeByIndex(sal_Int32 _rIndex) throw( css::lang css::container::ContainerEvent aEvt; aEvt.Source = *this; aEvt.Element <<= xAffected; - ::cppu::OInterfaceIteratorHelper aIt(m_aContainerListeners); + ::comphelper::OInterfaceIteratorHelper2 aIt(m_aContainerListeners); while (aIt.hasMoreElements()) static_cast< css::container::XContainerListener*>(aIt.next())->elementRemoved(aEvt); @@ -1589,7 +1589,7 @@ void SAL_CALL SbaXFormAdapter::replaceByIndex(sal_Int32 _rIndex, const Any& Elem aEvt.Element <<= xElement; aEvt.ReplacedElement <<= xOld; - ::cppu::OInterfaceIteratorHelper aIt(m_aContainerListeners); + ::comphelper::OInterfaceIteratorHelper2 aIt(m_aContainerListeners); while (aIt.hasMoreElements()) static_cast< css::container::XContainerListener*>(aIt.next())->elementReplaced(aEvt); } diff --git a/dbaccess/source/ui/browser/sbamultiplex.cxx b/dbaccess/source/ui/browser/sbamultiplex.cxx index 309dba915d1d..2220eceba2e2 100644 --- a/dbaccess/source/ui/browser/sbamultiplex.cxx +++ b/dbaccess/source/ui/browser/sbamultiplex.cxx @@ -29,7 +29,7 @@ void SAL_CALL SbaXStatusMultiplexer::statusChanged(const css::frame::FeatureStat { m_aLastKnownStatus = e; m_aLastKnownStatus.Source = &m_rParent; - ::cppu::OInterfaceIteratorHelper aIt( *this ); + ::comphelper::OInterfaceIteratorHelper2 aIt( *this ); while ( aIt.hasMoreElements() ) static_cast< css::frame::XStatusListener* >( aIt.next() )->statusChanged( m_aLastKnownStatus ); } \ @@ -89,7 +89,7 @@ void SbaXPropertiesChangeMultiplexer::propertiesChange(const css::uno::Sequence< for (sal_Int32 i=0; i<aMulti.getLength(); ++i, ++pMulti) pMulti->Source = &m_rParent; - ::cppu::OInterfaceIteratorHelper aIt(*this); + ::comphelper::OInterfaceIteratorHelper2 aIt(*this); while (aIt.hasMoreElements()) static_cast< css::beans::XPropertiesChangeListener*>(aIt.next())->propertiesChange(aMulti); } diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 30cff7ef186e..a19442d3200f 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -3491,7 +3491,7 @@ IController& SbaTableQueryBrowser::getCommandController() return *this; } -::cppu::OInterfaceContainerHelper* SbaTableQueryBrowser::getContextMenuInterceptors() +::comphelper::OInterfaceContainerHelper2* SbaTableQueryBrowser::getContextMenuInterceptors() { return &m_aContextMenuInterceptors; } diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index d27560190b99..7142e295d8e0 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/util/URL.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <vcl/help.hxx> #include <vcl/commandinfoprovider.hxx> #include <dbaccess/IController.hxx> @@ -565,7 +565,7 @@ std::unique_ptr<PopupMenu> DBTreeListBox::CreateContextMenu() // set images lcl_insertMenuItemImages( *pContextMenu, m_pContextMenuProvider->getCommandController() ); // allow context menu interception - ::cppu::OInterfaceContainerHelper* pInterceptors = m_pContextMenuProvider->getContextMenuInterceptors(); + ::comphelper::OInterfaceContainerHelper2* pInterceptors = m_pContextMenuProvider->getContextMenuInterceptors(); if ( !pInterceptors || !pInterceptors->getLength() ) return pContextMenu; @@ -577,7 +577,7 @@ std::unique_ptr<PopupMenu> DBTreeListBox::CreateContextMenu() pContextMenu.get(), nullptr ); aEvent.Selection = new SelectionSupplier( m_pContextMenuProvider->getCurrentSelection( *this ) ); - ::cppu::OInterfaceIteratorHelper aIter( *pInterceptors ); + ::comphelper::OInterfaceIteratorHelper2 aIter( *pInterceptors ); bool bModifiedMenu = false; bool bAskInterceptors = true; while ( aIter.hasMoreElements() && bAskInterceptors ) diff --git a/dbaccess/source/ui/inc/callbacks.hxx b/dbaccess/source/ui/inc/callbacks.hxx index a87ccf374dd9..9c2a579a7a51 100644 --- a/dbaccess/source/ui/inc/callbacks.hxx +++ b/dbaccess/source/ui/inc/callbacks.hxx @@ -31,7 +31,7 @@ class Control; struct AcceptDropEvent; struct ExecuteDropEvent; -namespace cppu { class OInterfaceContainerHelper; } +namespace comphelper { class OInterfaceContainerHelper2; } namespace dbaui { @@ -84,7 +84,7 @@ namespace dbaui /** returns the container of registered context menu interceptors, or NULL if the implementation does not support context menu interception */ - virtual ::cppu::OInterfaceContainerHelper* + virtual ::comphelper::OInterfaceContainerHelper2* getContextMenuInterceptors() = 0; /** returns the current selection in the given control diff --git a/dbaccess/source/ui/inc/exsrcbrw.hxx b/dbaccess/source/ui/inc/exsrcbrw.hxx index 09c0ea6a6fe9..3a533e8fadf4 100644 --- a/dbaccess/source/ui/inc/exsrcbrw.hxx +++ b/dbaccess/source/ui/inc/exsrcbrw.hxx @@ -34,7 +34,7 @@ namespace dbaui :public SbaXDataBrowserController ,public css::util::XModifyBroadcaster { - ::cppu::OInterfaceContainerHelper m_aModifyListeners; + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; // for multiplexing the modify events SbaXFormAdapter* m_pDataSourceImpl; bool m_bInQueryDispatch; diff --git a/dbaccess/source/ui/inc/formadapter.hxx b/dbaccess/source/ui/inc/formadapter.hxx index 82eb85c7b730..c9d7093db9de 100644 --- a/dbaccess/source/ui/inc/formadapter.hxx +++ b/dbaccess/source/ui/inc/formadapter.hxx @@ -136,8 +136,8 @@ namespace dbaui SbaXVetoableChangeMultiplexer m_aVetoablePropertyChangeListeners; SbaXPropertiesChangeMultiplexer m_aPropertiesChangeListeners; - ::cppu::OInterfaceContainerHelper m_aDisposeListeners; - ::cppu::OInterfaceContainerHelper m_aContainerListeners; + ::comphelper::OInterfaceContainerHelper2 m_aDisposeListeners; + ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners; // hierarchy administration css::uno::Reference< css::uno::XInterface > m_xParent; diff --git a/dbaccess/source/ui/inc/sbamultiplex.hxx b/dbaccess/source/ui/inc/sbamultiplex.hxx index c5b097de4db0..67999030cb4d 100644 --- a/dbaccess/source/ui/inc/sbamultiplex.hxx +++ b/dbaccess/source/ui/inc/sbamultiplex.hxx @@ -41,6 +41,7 @@ #include <com/sun/star/frame/XStatusListener.hpp> #include <comphelper/uno3.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/weak.hxx> @@ -64,7 +65,7 @@ namespace dbaui class classname \ :public OSbaWeakSubObject \ ,public listenerclass \ - ,public ::cppu::OInterfaceContainerHelper \ + ,public ::comphelper::OInterfaceContainerHelper2 \ { \ public: \ classname( ::cppu::OWeakObject& rSource, \ @@ -83,7 +84,7 @@ namespace dbaui virtual sal_Bool SAL_CALL methodname(const eventtype& e) throw (css::uno::RuntimeException, std::exception) override; \ #define END_DECLARE_LISTENER_MULTIPLEXER() \ - /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators */ \ + /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */ \ void * SAL_CALL operator new( size_t size ) throw() { return OSbaWeakSubObject::operator new(size); } \ void SAL_CALL operator delete( void * p ) throw() { OSbaWeakSubObject::operator delete(p); } \ }; \ @@ -94,7 +95,7 @@ namespace dbaui \ classname::classname(::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex) \ :OSbaWeakSubObject(rSource) \ - ,OInterfaceContainerHelper(_rMutex) \ + ,OInterfaceContainerHelper2(_rMutex) \ { \ } \ \ @@ -120,7 +121,7 @@ namespace dbaui { \ eventtype aMulti(e); \ aMulti.Source = &m_rParent; \ - ::cppu::OInterfaceIteratorHelper aIt(*this); \ + ::comphelper::OInterfaceIteratorHelper2 aIt(*this); \ while (aIt.hasMoreElements()) \ static_cast< listenerclass*>(aIt.next())->methodname(aMulti); \ } \ @@ -130,7 +131,7 @@ namespace dbaui { \ eventtype aMulti(e); \ aMulti.Source = &m_rParent; \ - ::cppu::OInterfaceIteratorHelper aIt(*this); \ + ::comphelper::OInterfaceIteratorHelper2 aIt(*this); \ bool bResult = true; \ while (bResult && aIt.hasMoreElements()) \ bResult = static_cast< listenerclass*>(aIt.next())->methodname(aMulti); \ diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx index 4c58d72c2463..c70fa481c47b 100644 --- a/dbaccess/source/ui/inc/unodatbr.hxx +++ b/dbaccess/source/ui/inc/unodatbr.hxx @@ -91,8 +91,8 @@ namespace dbaui svx::ODataAccessDescriptor m_aDocumentDataSource; // if we're part of a document, this is the state of the DocumentDataSource slot - ::cppu::OInterfaceContainerHelper m_aSelectionListeners; - ::cppu::OInterfaceContainerHelper m_aContextMenuInterceptors; + ::comphelper::OInterfaceContainerHelper2 m_aSelectionListeners; + ::comphelper::OInterfaceContainerHelper2 m_aContextMenuInterceptors; OTableCopyHelper::DropDescriptor m_aAsyncDrop; OTableCopyHelper m_aTableCopyHelper; @@ -232,7 +232,7 @@ namespace dbaui // IContextMenuProvider virtual PopupMenu* getContextMenu( Control& _rControl ) const override; virtual IController& getCommandController() override; - virtual ::cppu::OInterfaceContainerHelper* + virtual ::comphelper::OInterfaceContainerHelper2* getContextMenuInterceptors() override; virtual css::uno::Any getCurrentSelection( Control& _rControl ) const override; diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx index 1e14c3f75d03..70154bbfcf18 100644 --- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx +++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx @@ -41,6 +41,7 @@ #include <connectivity/dbexception.hxx> #include <connectivity/dbtools.hxx> #include <cppuhelper/typeprovider.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <rtl/ustrbuf.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <tools/debug.hxx> @@ -126,7 +127,7 @@ namespace dbaui OModuleClient m_aModuleClient; ::dbtools::SQLExceptionInfo m_aCurrentError; - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; // <properties> diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index bdfd531da0aa..5030eeb3995a 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -64,6 +64,7 @@ #include <connectivity/dbtools.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/implbase.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <rtl/ustrbuf.hxx> #include <svtools/genericunodialog.hxx> #include <tools/diagnose_ex.h> @@ -346,7 +347,7 @@ private: // other Reference< XInteractionHandler > m_xInteractionHandler; - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aCopyTableListeners; sal_Int16 m_nOverrideExecutionResult; }; @@ -1016,7 +1017,7 @@ bool CopyTableWizard::impl_processCopyError_nothrow( const CopyTableRowEvent& _r Reference< XCopyTableListener > xListener; try { - ::cppu::OInterfaceIteratorHelper aIter( m_aCopyTableListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aCopyTableListeners ); while ( aIter.hasMoreElements() ) { xListener.set( aIter.next(), UNO_QUERY_THROW ); diff --git a/dtrans/source/win32/clipb/WinClipboard.cxx b/dtrans/source/win32/clipb/WinClipboard.cxx index 3deada710780..b8c83e955c82 100644 --- a/dtrans/source/win32/clipb/WinClipboard.cxx +++ b/dtrans/source/win32/clipb/WinClipboard.cxx @@ -189,7 +189,7 @@ void SAL_CALL CWinClipboard::notifyAllClipboardListener( ) { aGuard.clear( ); - OInterfaceContainerHelper* pICHelper = rBHelper.aLC.getContainer( + OInterfaceContainerHelper2* pICHelper = rBHelper.aLC.getContainer( cppu::UnoType<XClipboardListener>::get()); if ( pICHelper ) diff --git a/dtrans/source/win32/dnd/sourcecontext.cxx b/dtrans/source/win32/dnd/sourcecontext.cxx index 84e54da21cfc..03ef66a43e5e 100644 --- a/dtrans/source/win32/dnd/sourcecontext.cxx +++ b/dtrans/source/win32/dnd/sourcecontext.cxx @@ -94,7 +94,7 @@ void SourceContext::fire_dragDropEnd( sal_Bool success, sal_Int8 effect) e.DragSourceContext= static_cast<XDragSourceContext*>( this); e.Source.set( static_cast<XDragSourceContext*>( this), UNO_QUERY); - OInterfaceContainerHelper* pContainer= rBHelper.getContainer( + OInterfaceContainerHelper2* pContainer= rBHelper.getContainer( cppu::UnoType<XDragSourceListener>::get()); if( pContainer) @@ -121,7 +121,7 @@ void SourceContext::fire_dropActionChanged( sal_Int8 dropAction, sal_Int8 userAc e.DragSourceContext= static_cast<XDragSourceContext*>( this); e.Source.set( static_cast<XDragSourceContext*>( this), UNO_QUERY); - OInterfaceContainerHelper* pContainer= rBHelper.getContainer( + OInterfaceContainerHelper2* pContainer= rBHelper.getContainer( cppu::UnoType<XDragSourceListener>::get()); if( pContainer) diff --git a/dtrans/source/win32/dnd/target.cxx b/dtrans/source/win32/dnd/target.cxx index d7247f9fc297..dccbe88c5539 100644 --- a/dtrans/source/win32/dnd/target.cxx +++ b/dtrans/source/win32/dnd/target.cxx @@ -488,7 +488,7 @@ HRESULT DropTarget::Drop( IDataObject * /*pDataObj*/, void DropTarget::fire_drop( const DropTargetDropEvent& dte) { - OInterfaceContainerHelper* pContainer= rBHelper.getContainer( cppu::UnoType<XDropTargetListener>::get()); + OInterfaceContainerHelper2* pContainer= rBHelper.getContainer( cppu::UnoType<XDropTargetListener>::get()); if( pContainer) { OInterfaceIteratorHelper iter( *pContainer); @@ -502,7 +502,7 @@ void DropTarget::fire_drop( const DropTargetDropEvent& dte) void DropTarget::fire_dragEnter( const DropTargetDragEnterEvent& e ) { - OInterfaceContainerHelper* pContainer= rBHelper.getContainer( cppu::UnoType<XDropTargetListener>::get()); + OInterfaceContainerHelper2* pContainer= rBHelper.getContainer( cppu::UnoType<XDropTargetListener>::get()); if( pContainer) { OInterfaceIteratorHelper iter( *pContainer); @@ -516,7 +516,7 @@ void DropTarget::fire_dragEnter( const DropTargetDragEnterEvent& e ) void DropTarget::fire_dragExit( const DropTargetEvent& dte ) { - OInterfaceContainerHelper* pContainer= rBHelper.getContainer( cppu::UnoType<XDropTargetListener>::get()); + OInterfaceContainerHelper2* pContainer= rBHelper.getContainer( cppu::UnoType<XDropTargetListener>::get()); if( pContainer) { @@ -531,7 +531,7 @@ void DropTarget::fire_dragExit( const DropTargetEvent& dte ) void DropTarget::fire_dragOver( const DropTargetDragEvent& dtde ) { - OInterfaceContainerHelper* pContainer= rBHelper.getContainer( cppu::UnoType<XDropTargetListener>::get()); + OInterfaceContainerHelper2* pContainer= rBHelper.getContainer( cppu::UnoType<XDropTargetListener>::get()); if( pContainer) { OInterfaceIteratorHelper iter( *pContainer ); @@ -545,7 +545,7 @@ void DropTarget::fire_dragOver( const DropTargetDragEvent& dtde ) void DropTarget::fire_dropActionChanged( const DropTargetDragEvent& dtde ) { - OInterfaceContainerHelper* pContainer= rBHelper.getContainer( cppu::UnoType<XDropTargetListener>::get()); + OInterfaceContainerHelper2* pContainer= rBHelper.getContainer( cppu::UnoType<XDropTargetListener>::get()); if( pContainer) { OInterfaceIteratorHelper iter( *pContainer); diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index f00be260e861..ce2549eb7711 100644 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/embed/EmbedMisc.hpp> #include <comphelper/processfactory.hxx> +#include <cppuhelper/interfacecontainer.hxx> #include <vcl/svapp.hxx> diff --git a/embeddedobj/source/general/intercept.cxx b/embeddedobj/source/general/intercept.cxx index c37ae995b879..e43a4c50de4e 100644 --- a/embeddedobj/source/general/intercept.cxx +++ b/embeddedobj/source/general/intercept.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/embed/EmbedStates.hpp> #include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> #include "intercept.hxx" #include "docholder.hxx" diff --git a/embeddedobj/source/inc/intercept.hxx b/embeddedobj/source/inc/intercept.hxx index a2c6f4fcc7ac..7df7f686d741 100644 --- a/embeddedobj/source/inc/intercept.hxx +++ b/embeddedobj/source/inc/intercept.hxx @@ -22,7 +22,7 @@ #include <osl/mutex.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> #include <com/sun/star/frame/XInterceptorInfo.hpp> #include <com/sun/star/frame/XDispatch.hpp> @@ -140,7 +140,7 @@ private: static css::uno::Sequence< OUString > m_aInterceptedURL; - cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; + comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; StatusChangeListenerContainer* m_pStatCL; }; diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index 6a7b9e471131..91492197e3a7 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -1437,7 +1437,7 @@ 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 != NULL ) { @@ -1729,7 +1729,7 @@ 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 != NULL ) { diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx index 9fdeb18b80a6..1abc8f176067 100644 --- a/embeddedobj/source/msole/olemisc.cxx +++ b/embeddedobj/source/msole/olemisc.cxx @@ -190,7 +190,7 @@ void OleEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange, sa { if ( m_pInterfaceContainer ) { - ::cppu::OInterfaceContainerHelper* pContainer = m_pInterfaceContainer->getContainer( + ::comphelper::OInterfaceContainerHelper2* pContainer = m_pInterfaceContainer->getContainer( cppu::UnoType<embed::XStateChangeListener>::get()); if ( pContainer != NULL ) { diff --git a/embedserv/source/embed/intercept.cxx b/embedserv/source/embed/intercept.cxx index 58fa93526501..cefff859e13c 100644 --- a/embedserv/source/embed/intercept.cxx +++ b/embedserv/source/embed/intercept.cxx @@ -52,7 +52,7 @@ Interceptor::addEventListener( if ( ! m_pDisposeEventListeners ) m_pDisposeEventListeners = - new cppu::OInterfaceContainerHelper( m_aMutex ); + new comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pDisposeEventListeners->addInterface( Listener ); } @@ -216,7 +216,7 @@ void Interceptor::generateFeatureStateEvent() if( i == 1 || (m_bLink && i != 5) ) continue; - cppu::OInterfaceContainerHelper* pICH = + comphelper::OInterfaceContainerHelper2* pICH = m_pStatCL->getContainer(m_aInterceptedURL[i]); uno::Sequence<uno::Reference<uno::XInterface> > aSeq; if(pICH) diff --git a/embedserv/source/inc/intercept.hxx b/embedserv/source/inc/intercept.hxx index ac226108ea01..49b8ae093aec 100644 --- a/embedserv/source/inc/intercept.hxx +++ b/embedserv/source/inc/intercept.hxx @@ -166,7 +166,7 @@ private: static css::uno::Sequence< OUString > m_aInterceptedURL; - cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; + comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; StatusChangeListenerContainer* m_pStatCL; sal_Bool m_bLink; diff --git a/embedserv/source/inc/xwin.hxx b/embedserv/source/inc/xwin.hxx index a5e9dbfc6329..5aeb7d5fd370 100644 --- a/embedserv/source/inc/xwin.hxx +++ b/embedserv/source/inc/xwin.hxx @@ -224,7 +224,7 @@ public: private: osl::Mutex m_aMutex; - cppu::OInterfaceContainerHelper *m_pDisposeEventListeners; + comphelper::OInterfaceContainerHelper2 *m_pDisposeEventListeners; HWND m_aHwnd; }; diff --git a/extensions/source/bibliography/datman.hxx b/extensions/source/bibliography/datman.hxx index 80caa4e10463..a2968b9f5c20 100644 --- a/extensions/source/bibliography/datman.hxx +++ b/extensions/source/bibliography/datman.hxx @@ -26,7 +26,7 @@ #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> #include <com/sun/star/form/runtime/XFormController.hpp> #include <cppuhelper/compbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/form/XLoadable.hpp> #include <comphelper/broadcasthelper.hxx> #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> @@ -94,7 +94,7 @@ private: css::uno::Any aUID; css::uno::Reference< css::sdbc::XResultSet > xBibCursor; - ::cppu::OInterfaceContainerHelper m_aLoadListeners; + ::comphelper::OInterfaceContainerHelper2 m_aLoadListeners; VclPtr< ::bib::BibView> pBibView; VclPtr<BibToolBar> pToolbar; diff --git a/extensions/source/logging/logger.cxx b/extensions/source/logging/logger.cxx index ee3c4b8adba3..6ed845cc0aa9 100644 --- a/extensions/source/logging/logger.cxx +++ b/extensions/source/logging/logger.cxx @@ -28,7 +28,7 @@ #include <com/sun/star/logging/XLoggerPool.hpp> #include <cppuhelper/basemutex.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/weakref.hxx> @@ -56,7 +56,7 @@ namespace logging public cppu::WeakImplHelper<css::logging::XLogger> { private: - cppu::OInterfaceContainerHelper m_aHandlers; + comphelper::OInterfaceContainerHelper2 m_aHandlers; oslInterlockedCount m_nEventNumber; // <attributes> diff --git a/extensions/source/propctrlr/eformshelper.cxx b/extensions/source/propctrlr/eformshelper.cxx index 53ce924cf45f..e88e939864be 100644 --- a/extensions/source/propctrlr/eformshelper.cxx +++ b/extensions/source/propctrlr/eformshelper.cxx @@ -242,7 +242,7 @@ namespace pcr { if ( !_bDoListen ) { - ::std::unique_ptr< ::cppu::OInterfaceIteratorHelper > pListenerIterator = m_aPropertyListeners.createIterator(); + ::std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > pListenerIterator = m_aPropertyListeners.createIterator(); while ( pListenerIterator->hasMoreElements() ) { PropertyEventTranslation* pTranslator = dynamic_cast< PropertyEventTranslation* >( pListenerIterator->next() ); @@ -276,7 +276,7 @@ namespace pcr } else { - ::std::unique_ptr< ::cppu::OInterfaceIteratorHelper > pListenerIterator = m_aPropertyListeners.createIterator(); + ::std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > pListenerIterator = m_aPropertyListeners.createIterator(); while ( pListenerIterator->hasMoreElements() ) { Reference< XPropertyChangeListener > xListener( pListenerIterator->next(), UNO_QUERY ); diff --git a/extensions/source/propctrlr/formgeometryhandler.cxx b/extensions/source/propctrlr/formgeometryhandler.cxx index 961b6bc18763..99f1e13c06f8 100644 --- a/extensions/source/propctrlr/formgeometryhandler.cxx +++ b/extensions/source/propctrlr/formgeometryhandler.cxx @@ -194,7 +194,7 @@ namespace pcr private: ::cppu::OWeakObject& m_rParent; - ::cppu::OInterfaceContainerHelper m_aPropertyChangeListeners; + ::comphelper::OInterfaceContainerHelper2 m_aPropertyChangeListeners; Reference< XShape > m_xShape; }; diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index edd4f081c81c..f08bff7cff98 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -305,8 +305,8 @@ namespace pcr throw NullPointerException(); // revoke old property change listeners - ::cppu::OInterfaceIteratorHelper iterRemove( m_aPropertyListeners ); - ::cppu::OInterfaceIteratorHelper iterReAdd( m_aPropertyListeners ); // this holds a copy of the container ... + ::comphelper::OInterfaceIteratorHelper2 iterRemove( m_aPropertyListeners ); + ::comphelper::OInterfaceIteratorHelper2 iterReAdd( m_aPropertyListeners ); // this holds a copy of the container ... while ( iterRemove.hasMoreElements() ) m_xComponent->removePropertyChangeListener( OUString(), static_cast< XPropertyChangeListener* >( iterRemove.next() ) ); diff --git a/extensions/source/propctrlr/genericpropertyhandler.hxx b/extensions/source/propctrlr/genericpropertyhandler.hxx index 58d8b63f15c8..384297a7db0e 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.hxx +++ b/extensions/source/propctrlr/genericpropertyhandler.hxx @@ -72,7 +72,7 @@ namespace pcr /// cache of our supported properties PropertyMap m_aProperties; /// property change listeners - ::cppu::OInterfaceContainerHelper m_aPropertyListeners; + ::comphelper::OInterfaceContainerHelper2 m_aPropertyListeners; ::std::map< css::uno::Type, ::rtl::Reference< IPropertyEnumRepresentation >, TypeLess > m_aEnumConverters; diff --git a/extensions/source/propctrlr/propcontroller.hxx b/extensions/source/propctrlr/propcontroller.hxx index 4bf94a7ad0e6..79e8bb9bde47 100644 --- a/extensions/source/propctrlr/propcontroller.hxx +++ b/extensions/source/propctrlr/propcontroller.hxx @@ -101,8 +101,8 @@ namespace pcr css::uno::Reference< css::frame::XFrame > m_xFrame; css::uno::Reference< css::awt::XWindow > m_xView; - ::cppu::OInterfaceContainerHelper m_aDisposeListeners; - ::cppu::OInterfaceContainerHelper m_aControlObservers; + ::comphelper::OInterfaceContainerHelper2 m_aDisposeListeners; + ::comphelper::OInterfaceContainerHelper2 m_aControlObservers; // meta data about the properties VclPtr<OPropertyBrowserView> m_pView; diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx index 7b968898c1b3..972be7e26e5b 100644 --- a/extensions/source/propctrlr/propertyhandler.cxx +++ b/extensions/source/propctrlr/propertyhandler.cxx @@ -78,8 +78,8 @@ namespace pcr return; // remove all old property change listeners - ::std::unique_ptr< ::cppu::OInterfaceIteratorHelper > removeListener = m_aPropertyListeners.createIterator(); - ::std::unique_ptr< ::cppu::OInterfaceIteratorHelper > readdListener = m_aPropertyListeners.createIterator(); // will copy the container as needed + ::std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > removeListener = m_aPropertyListeners.createIterator(); + ::std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > readdListener = m_aPropertyListeners.createIterator(); // will copy the container as needed while ( removeListener->hasMoreElements() ) removePropertyChangeListener( static_cast< XPropertyChangeListener* >( removeListener->next() ) ); OSL_ENSURE( m_aPropertyListeners.empty(), "PropertyHandler::inspect: derived classes are expected to forward the removePropertyChangeListener call to their base class (me)!" ); diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx index c3c83e283b87..9988994041ae 100644 --- a/extensions/source/propctrlr/standardcontrol.hxx +++ b/extensions/source/propctrlr/standardcontrol.hxx @@ -178,7 +178,7 @@ namespace pcr class OHyperlinkControl : public OHyperlinkControl_Base { private: - ::cppu::OInterfaceContainerHelper m_aActionListeners; + ::comphelper::OInterfaceContainerHelper2 m_aActionListeners; public: OHyperlinkControl( vcl::Window* _pParent, WinBits _nWinStyle ); diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx index 09c676ebe844..e49b950a6ffd 100644 --- a/forms/source/component/Button.cxx +++ b/forms/source/component/Button.cxx @@ -448,7 +448,7 @@ IMPL_LINK_NOARG_TYPED(OButtonControl, OnClick, void*, void) if (FormButtonType_PUSH == *static_cast<FormButtonType const *>(xSet->getPropertyValue(PROPERTY_BUTTONTYPE).getValue())) { // notify the action listeners for a push button - ::cppu::OInterfaceIteratorHelper aIter(m_aActionListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aActionListeners); ActionEvent aEvt(static_cast<XWeak*>(this), m_aActionCommand); while(aIter.hasMoreElements() ) { diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 60228c6c5a17..3f122a9fd5db 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -2151,7 +2151,7 @@ void ODatabaseForm::submit_impl(const Reference<XControl>& Control, const css::a if (_bAproveByListeners) { - ::cppu::OInterfaceIteratorHelper aIter(m_aSubmitListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aSubmitListeners); EventObject aEvt(static_cast<XWeak*>(this)); bool bCanceled = false; while (aIter.hasMoreElements() && !bCanceled) @@ -2944,7 +2944,7 @@ void ODatabaseForm::reload_impl(bool bMoveToFirst, const Reference< XInteraction // the approvement is done by the aggregate if (!m_aRowSetApproveListeners.getLength()) { - ::cppu::OInterfaceIteratorHelper aIter(m_aLoadListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aLoadListeners); aGuard.clear(); while (aIter.hasMoreElements()) @@ -2967,7 +2967,7 @@ void ODatabaseForm::reload_impl(bool bMoveToFirst, const Reference< XInteraction if (bSuccess) { - ::cppu::OInterfaceIteratorHelper aIter(m_aLoadListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aLoadListeners); aGuard.clear(); while (aIter.hasMoreElements()) static_cast<XLoadListener*>(aIter.next())->reloaded(aEvent); @@ -3047,7 +3047,7 @@ void SAL_CALL ODatabaseForm::rowSetChanged(const EventObject& /*event*/) throw( bool ODatabaseForm::impl_approveRowChange_throw( const EventObject& _rEvent, const bool _bAllowSQLException, ::osl::ClearableMutexGuard& _rGuard ) { - ::cppu::OInterfaceIteratorHelper aIter( m_aRowSetApproveListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aRowSetApproveListeners ); _rGuard.clear(); while ( aIter.hasMoreElements() ) { @@ -3092,7 +3092,7 @@ sal_Bool SAL_CALL ODatabaseForm::approveCursorMove(const EventObject& event) thr // Our aggregate doesn't have any ApproveRowSetListeners (expect ourself), as we re-routed the queryInterface // for XRowSetApproveBroadcaster-interface. // So we have to multiplex this approve request. - ::cppu::OInterfaceIteratorHelper aIter( m_aRowSetApproveListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aRowSetApproveListeners ); while ( aIter.hasMoreElements() ) { Reference< XRowSetApproveListener > xListener( static_cast< XRowSetApproveListener* >( aIter.next() ) ); @@ -3141,7 +3141,7 @@ sal_Bool SAL_CALL ODatabaseForm::approveRowChange(const RowChangeEvent& event) t // Our aggregate doesn't have any ApproveRowSetListeners (expect ourself), as we re-routed the queryInterface // for XRowSetApproveBroadcaster-interface. // So we have to multiplex this approve request. - ::cppu::OInterfaceIteratorHelper aIter( m_aRowSetApproveListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aRowSetApproveListeners ); while ( aIter.hasMoreElements() ) { Reference< XRowSetApproveListener > xListener( static_cast< XRowSetApproveListener* >( aIter.next() ) ); diff --git a/forms/source/component/DatabaseForm.hxx b/forms/source/component/DatabaseForm.hxx index 570747fc6a46..c15b68d1376b 100644 --- a/forms/source/component/DatabaseForm.hxx +++ b/forms/source/component/DatabaseForm.hxx @@ -160,10 +160,10 @@ class ODatabaseForm :public OFormComponents friend class OFormSubmitResetThread; // listener administration - ::cppu::OInterfaceContainerHelper m_aLoadListeners; - ::cppu::OInterfaceContainerHelper m_aRowSetApproveListeners; - ::cppu::OInterfaceContainerHelper m_aSubmitListeners; - ::cppu::OInterfaceContainerHelper m_aErrorListeners; + ::comphelper::OInterfaceContainerHelper2 m_aLoadListeners; + ::comphelper::OInterfaceContainerHelper2 m_aRowSetApproveListeners; + ::comphelper::OInterfaceContainerHelper2 m_aSubmitListeners; + ::comphelper::OInterfaceContainerHelper2 m_aErrorListeners; ResetListeners m_aResetListeners; ::osl::Mutex m_aResetSafety; css::uno::Any m_aCycle; diff --git a/forms/source/component/Edit.hxx b/forms/source/component/Edit.hxx index 6ed1bcbb6360..8a44722f7ed8 100644 --- a/forms/source/component/Edit.hxx +++ b/forms/source/component/Edit.hxx @@ -124,7 +124,7 @@ typedef ::cppu::ImplHelper3< css::awt::XFocusListener, class OEditControl : public OBoundControl ,public OEditControl_BASE { - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aChangeListeners; OUString m_aHtmlChangeValue; diff --git a/forms/source/component/File.cxx b/forms/source/component/File.cxx index 5a8c83df5cf1..cfc85461986f 100644 --- a/forms/source/component/File.cxx +++ b/forms/source/component/File.cxx @@ -238,7 +238,7 @@ void OFileControlModel::read(const Reference<css::io::XObjectInputStream>& _rxIn void SAL_CALL OFileControlModel::reset() throw ( css::uno::RuntimeException, std::exception) { - ::cppu::OInterfaceIteratorHelper aIter(m_aResetListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aResetListeners); EventObject aEvt(static_cast<XWeak*>(this)); bool bContinue = true; while (aIter.hasMoreElements() && bContinue) diff --git a/forms/source/component/File.hxx b/forms/source/component/File.hxx index 5f36753b7405..04cd3f7e0a5d 100644 --- a/forms/source/component/File.hxx +++ b/forms/source/component/File.hxx @@ -30,7 +30,7 @@ class OFileControlModel :public OControlModel ,public css::form::XReset { - ::cppu::OInterfaceContainerHelper m_aResetListeners; + ::comphelper::OInterfaceContainerHelper2 m_aResetListeners; OUString m_sDefaultValue; protected: diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index f1a364b17f8d..56a8ec4e3974 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -361,7 +361,7 @@ namespace frm m_aText = sText; TextEvent aEvt; aEvt.Source = *this; - ::cppu::OInterfaceIteratorHelper aIt( m_aTextListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIt( m_aTextListeners ); while( aIt.hasMoreElements() ) static_cast<XTextListener *>(aIt.next())->textChanged( aEvt ); } @@ -537,7 +537,7 @@ namespace frm setText(aNewText); TextEvent aEvt; aEvt.Source = *this; - ::cppu::OInterfaceIteratorHelper aIt( m_aTextListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIt( m_aTextListeners ); while( aIt.hasMoreElements() ) static_cast< XTextListener* >( aIt.next() )->textChanged( aEvt ); } diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 7d73658a3536..4ffc3dd01745 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -1883,7 +1883,7 @@ sal_Bool SAL_CALL OBoundControlModel::commit() throw(RuntimeException, std::exce // we reach this only if we're not working with an external binding if ( !hasField() ) return sal_True; - ::cppu::OInterfaceIteratorHelper aIter( m_aUpdateListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aUpdateListeners ); EventObject aEvent; aEvent.Source = static_cast< XWeak* >( this ); bool bSuccess = true; diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx index b69582c274e3..ee5a54d25a80 100644 --- a/forms/source/component/Grid.cxx +++ b/forms/source/component/Grid.cxx @@ -349,7 +349,7 @@ css::uno::Sequence<OUString> SAL_CALL OGridControlModel::getColumnTypes() throw // XReset void SAL_CALL OGridControlModel::reset() throw ( css::uno::RuntimeException, std::exception) { - ::cppu::OInterfaceIteratorHelper aIter(m_aResetListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aResetListeners); EventObject aEvt(static_cast<XWeak*>(this)); bool bContinue = true; while (aIter.hasMoreElements() && bContinue) diff --git a/forms/source/component/Grid.hxx b/forms/source/component/Grid.hxx index 168d524c5aad..2ce689601e24 100644 --- a/forms/source/component/Grid.hxx +++ b/forms/source/component/Grid.hxx @@ -64,7 +64,7 @@ class OGridControlModel :public OControlModel ,public FontControlModel ,public OGridControlModel_BASE { - ::cppu::OInterfaceContainerHelper m_aSelectListeners, + ::comphelper::OInterfaceContainerHelper2 m_aSelectListeners, m_aResetListeners, m_aRowSetChangeListeners; diff --git a/forms/source/component/ImageControl.hxx b/forms/source/component/ImageControl.hxx index 4185e575a0ff..791db89dae3f 100644 --- a/forms/source/component/ImageControl.hxx +++ b/forms/source/component/ImageControl.hxx @@ -150,7 +150,7 @@ class OImageControlControl : public OBoundControl , public OImageControlControl_Base { private: - ::cppu::OInterfaceContainerHelper m_aModifyListeners; + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; // XTypeProvider virtual css::uno::Sequence< css::uno::Type> _getTypes() override; diff --git a/forms/source/component/ListBox.hxx b/forms/source/component/ListBox.hxx index ae175a2171d4..702332eaef37 100644 --- a/forms/source/component/ListBox.hxx +++ b/forms/source/component/ListBox.hxx @@ -252,8 +252,8 @@ class OListBoxControl :public OBoundControl ,public IEventProcessor { private: - ::cppu::OInterfaceContainerHelper m_aChangeListeners; - ::cppu::OInterfaceContainerHelper m_aItemListeners; + ::comphelper::OInterfaceContainerHelper2 m_aChangeListeners; + ::comphelper::OInterfaceContainerHelper2 m_aItemListeners; css::uno::Any m_aCurrentSelection; Idle m_aChangeIdle; diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx index d65267d2f3fd..cfbfa5011eeb 100644 --- a/forms/source/component/clickableimage.cxx +++ b/forms/source/component/clickableimage.cxx @@ -178,7 +178,7 @@ namespace frm bool bCancelled = false; EventObject aEvent( static_cast< XWeak* >( this ) ); - ::cppu::OInterfaceIteratorHelper aIter( m_aApproveActionListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aApproveActionListeners ); while( !bCancelled && aIter.hasMoreElements() ) { // Every approveAction method must be thread-safe! diff --git a/forms/source/component/clickableimage.hxx b/forms/source/component/clickableimage.hxx index 78a11bf2f45a..3fd232303677 100644 --- a/forms/source/component/clickableimage.hxx +++ b/forms/source/component/clickableimage.hxx @@ -188,13 +188,13 @@ namespace frm private: OImageProducerThread_Impl* m_pThread; - ::cppu::OInterfaceContainerHelper m_aSubmissionVetoListeners; + ::comphelper::OInterfaceContainerHelper2 m_aSubmissionVetoListeners; ::std::unique_ptr< ControlFeatureInterception > m_pFeatureInterception; protected: - ::cppu::OInterfaceContainerHelper m_aApproveActionListeners; - ::cppu::OInterfaceContainerHelper m_aActionListeners; + ::comphelper::OInterfaceContainerHelper2 m_aApproveActionListeners; + ::comphelper::OInterfaceContainerHelper2 m_aActionListeners; OUString m_aActionCommand; // XSubmission diff --git a/forms/source/component/entrylisthelper.hxx b/forms/source/component/entrylisthelper.hxx index 1e3b14699030..80889887a07a 100644 --- a/forms/source/component/entrylisthelper.hxx +++ b/forms/source/component/entrylisthelper.hxx @@ -26,7 +26,7 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <cppuhelper/implbase3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> namespace frm @@ -53,7 +53,7 @@ namespace frm m_xListSource; /// our external list source css::uno::Sequence< OUString > m_aStringItems; /// "overridden" StringItemList property value - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aRefreshListeners; diff --git a/forms/source/component/errorbroadcaster.cxx b/forms/source/component/errorbroadcaster.cxx index 0e4330ed4db1..e619d0952401 100644 --- a/forms/source/component/errorbroadcaster.cxx +++ b/forms/source/component/errorbroadcaster.cxx @@ -75,7 +75,7 @@ namespace frm if ( m_aErrorListeners.getLength() ) { - ::cppu::OInterfaceIteratorHelper aIter( m_aErrorListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aErrorListeners ); while ( aIter.hasMoreElements() ) static_cast< XSQLErrorListener* >( aIter.next() )->errorOccured( _rError ); } diff --git a/forms/source/component/errorbroadcaster.hxx b/forms/source/component/errorbroadcaster.hxx index ec5c4d31859d..f5d036e0ef8c 100644 --- a/forms/source/component/errorbroadcaster.hxx +++ b/forms/source/component/errorbroadcaster.hxx @@ -22,7 +22,8 @@ #include <cppuhelper/implbase1.hxx> #include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp> -#include <cppuhelper/interfacecontainer.h> +#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/sdbc/SQLException.hpp> #include <com/sun/star/sdb/SQLErrorEvent.hpp> @@ -37,7 +38,7 @@ namespace frm { private: ::cppu::OBroadcastHelper& m_rBHelper; - ::cppu::OInterfaceContainerHelper m_aErrorListeners; + ::comphelper::OInterfaceContainerHelper2 m_aErrorListeners; protected: explicit OErrorBroadcaster( ::cppu::OBroadcastHelper& _rBHelper ); diff --git a/forms/source/helper/resettable.cxx b/forms/source/helper/resettable.cxx index 82dbde227487..de7db34de056 100644 --- a/forms/source/helper/resettable.cxx +++ b/forms/source/helper/resettable.cxx @@ -58,7 +58,7 @@ namespace frm bool ResetHelper::approveReset() { - ::cppu::OInterfaceIteratorHelper aIter( m_aResetListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aResetListeners ); EventObject aResetEvent( m_rParent ); bool bContinue = true; diff --git a/forms/source/inc/FormComponent.hxx b/forms/source/inc/FormComponent.hxx index d15b1217eeac..eb5118e89f5f 100644 --- a/forms/source/inc/FormComponent.hxx +++ b/forms/source/inc/FormComponent.hxx @@ -587,8 +587,8 @@ private: bool m_bValuePropertyMayBeVoid; ResetHelper m_aResetHelper; - ::cppu::OInterfaceContainerHelper m_aUpdateListeners; - ::cppu::OInterfaceContainerHelper m_aFormComponentListeners; + ::comphelper::OInterfaceContainerHelper2 m_aUpdateListeners; + ::comphelper::OInterfaceContainerHelper2 m_aFormComponentListeners; css::uno::Reference< css::form::binding::XValueBinding > m_xExternalBinding; diff --git a/forms/source/inc/InterfaceContainer.hxx b/forms/source/inc/InterfaceContainer.hxx index e274ec5e3ea5..a5f319ebe5f7 100644 --- a/forms/source/inc/InterfaceContainer.hxx +++ b/forms/source/inc/InterfaceContainer.hxx @@ -41,7 +41,7 @@ #include <com/sun/star/form/XFormComponent.hpp> #include <com/sun/star/util/XCloneable.hpp> #include <osl/mutex.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/component.hxx> #include <cppuhelper/implbase8.hxx> #include <unordered_map> @@ -100,7 +100,7 @@ protected: OInterfaceArray m_aItems; OInterfaceMap m_aMap; - ::cppu::OInterfaceContainerHelper m_aContainerListeners; + ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners; const css::uno::Type m_aElementType; diff --git a/forms/source/inc/resettable.hxx b/forms/source/inc/resettable.hxx index 2a5cb308ad1c..11a2db89777e 100644 --- a/forms/source/inc/resettable.hxx +++ b/forms/source/inc/resettable.hxx @@ -22,7 +22,7 @@ #include <com/sun/star/form/XResetListener.hpp> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> namespace cppu { @@ -53,7 +53,7 @@ namespace frm private: ::cppu::OWeakObject& m_rParent; - ::cppu::OInterfaceContainerHelper m_aResetListeners; + ::comphelper::OInterfaceContainerHelper2 m_aResetListeners; }; diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index 63aee56f9d5d..f78fa967b5a6 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -586,7 +586,7 @@ void SAL_CALL OInterfaceContainer::read( const Reference< XObjectInputStream >& } catch( const Exception& ) { - SAL_WARN("forms.misc", "OInterfaceContainerHelper::read: reading succeeded, but not inserting!" ); + SAL_WARN("forms.misc", "OInterfaceContainerHelper2::read: reading succeeded, but not inserting!" ); // create a placeholder xElement.set(lcl_createPlaceHolder( m_xContext ), css::uno::UNO_QUERY); if ( !xElement.is() ) diff --git a/forms/source/richtext/attributedispatcher.cxx b/forms/source/richtext/attributedispatcher.cxx index 768d3f28becb..abc6ab789283 100644 --- a/forms/source/richtext/attributedispatcher.cxx +++ b/forms/source/richtext/attributedispatcher.cxx @@ -112,7 +112,7 @@ namespace frm (void)_nAttributeId; FeatureStateEvent aEvent( buildStatusEvent() ); - ::cppu::OInterfaceIteratorHelper aIter( getStatusListeners() ); + ::comphelper::OInterfaceIteratorHelper2 aIter( getStatusListeners() ); while ( aIter.hasMoreElements() ) doNotify( static_cast< XStatusListener* >( aIter.next() ), aEvent ); } diff --git a/forms/source/richtext/featuredispatcher.cxx b/forms/source/richtext/featuredispatcher.cxx index 66740eb5afa2..1e0ec84b57db 100644 --- a/forms/source/richtext/featuredispatcher.cxx +++ b/forms/source/richtext/featuredispatcher.cxx @@ -107,7 +107,7 @@ namespace frm void ORichTextFeatureDispatcher::invalidateFeatureState_Broadcast() { FeatureStateEvent aEvent( buildStatusEvent() ); - ::cppu::OInterfaceIteratorHelper aIter( getStatusListeners() ); + ::comphelper::OInterfaceIteratorHelper2 aIter( getStatusListeners() ); while ( aIter.hasMoreElements() ) doNotify( static_cast< XStatusListener* >( aIter.next() ), aEvent ); } diff --git a/forms/source/richtext/featuredispatcher.hxx b/forms/source/richtext/featuredispatcher.hxx index 794947ff0764..b36a563c9d0f 100644 --- a/forms/source/richtext/featuredispatcher.hxx +++ b/forms/source/richtext/featuredispatcher.hxx @@ -22,7 +22,7 @@ #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/lang/DisposedException.hpp> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/implbase.hxx> #include <comphelper/broadcasthelper.hxx> @@ -39,7 +39,7 @@ namespace frm { private: css::util::URL m_aFeatureURL; - ::cppu::OInterfaceContainerHelper m_aStatusListeners; + ::comphelper::OInterfaceContainerHelper2 m_aStatusListeners; EditView* m_pEditView; bool m_bDisposed; @@ -49,7 +49,7 @@ namespace frm protected: inline const css::util::URL& getFeatureURL() const { return m_aFeatureURL; } - inline ::cppu::OInterfaceContainerHelper& getStatusListeners() { return m_aStatusListeners; } + inline ::comphelper::OInterfaceContainerHelper2& getStatusListeners() { return m_aStatusListeners; } inline bool isDisposed() const { return m_bDisposed; } inline void checkDisposed() const { if ( isDisposed() ) throw css::lang::DisposedException(); } diff --git a/forms/source/richtext/richtextmodel.hxx b/forms/source/richtext/richtextmodel.hxx index a08a89d3f8d9..f3ed47408040 100644 --- a/forms/source/richtext/richtextmodel.hxx +++ b/forms/source/richtext/richtextmodel.hxx @@ -95,7 +95,7 @@ namespace frm m_pEngine; bool m_bSettingEngineText; - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; public: diff --git a/fpicker/source/win32/filepicker/FilePicker.cxx b/fpicker/source/win32/filepicker/FilePicker.cxx index 729142919e27..2e4af6f5b550 100644 --- a/fpicker/source/win32/filepicker/FilePicker.cxx +++ b/fpicker/source/win32/filepicker/FilePicker.cxx @@ -179,7 +179,7 @@ OUString SAL_CALL CFilePicker::helpRequested(FilePickerEvent aEvent) const { OUString aHelpText; - ::cppu::OInterfaceContainerHelper* pICHelper = + ::comphelper::OInterfaceContainerHelper2* pICHelper = rBHelper.getContainer( cppu::UnoType<XFilePickerListener>::get()); if (pICHelper) diff --git a/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx b/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx index dffa6a3838c9..228e5febe193 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx @@ -302,7 +302,7 @@ void VistaFilePickerEventHandler::impl_sendEvent( EEventType eEventType, { static AsyncRequests aNotify(RequestHandlerRef(new AsyncPickerEvents())); - ::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; diff --git a/fpicker/source/win32/filepicker/asynceventnotifier.cxx b/fpicker/source/win32/filepicker/asynceventnotifier.cxx index 8ec54626006f..1f71602c1a76 100644 --- a/fpicker/source/win32/filepicker/asynceventnotifier.cxx +++ b/fpicker/source/win32/filepicker/asynceventnotifier.cxx @@ -263,7 +263,7 @@ void SAL_CALL CAsyncEventNotifier::run() std::unique_ptr<CEventNotification> EventNotification(getNextEventRecord()); removeNextEventRecord(); - ::cppu::OInterfaceContainerHelper* pICHelper = + ::comphelper::OInterfaceContainerHelper2* pICHelper = m_rBroadcastHelper.getContainer(cppu::UnoType<XFilePickerListener>::get()); if (pICHelper) diff --git a/framework/source/fwe/helper/undomanagerhelper.cxx b/framework/source/fwe/helper/undomanagerhelper.cxx index 5f71ed13a89a..e0a1d0db623b 100644 --- a/framework/source/fwe/helper/undomanagerhelper.cxx +++ b/framework/source/fwe/helper/undomanagerhelper.cxx @@ -21,7 +21,7 @@ #include <com/sun/star/lang/XComponent.hpp> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/exc_hlp.hxx> #include <comphelper/flagguard.hxx> #include <comphelper/asyncnotification.hxx> @@ -197,8 +197,8 @@ namespace framework bool m_bAPIActionRunning; bool m_bProcessingEvents; sal_Int32 m_nLockCount; - ::cppu::OInterfaceContainerHelper m_aUndoListeners; - ::cppu::OInterfaceContainerHelper m_aModifyListeners; + ::comphelper::OInterfaceContainerHelper2 m_aUndoListeners; + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; IUndoManagerImplementation& m_rUndoManagerImplementation; ::std::stack< bool > m_aContextVisibilities; #if OSL_DEBUG_LEVEL > 0 diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index ca4518c7d135..8ceb9572f462 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -2832,7 +2832,7 @@ void Frame::implts_sendFrameActionEvent( const css::frame::FrameAction& aAction // Send css::frame::FrameAction event to all listener. // Get container for right listener. // FOLLOW LINES ARE THREADSAFE!!! - // ( OInterfaceContainerHelper is synchronized with m_aListenerContainer! ) + // ( OInterfaceContainerHelper2 is synchronized with m_aListenerContainer! ) ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::frame::XFrameActionListener>::get()); if( pContainer != nullptr ) diff --git a/include/comphelper/interfacecontainer2.hxx b/include/comphelper/interfacecontainer2.hxx new file mode 100644 index 000000000000..228fc21bd529 --- /dev/null +++ b/include/comphelper/interfacecontainer2.hxx @@ -0,0 +1,304 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_COMPHELPER_INTERFACECONTAINER2_H +#define INCLUDED_COMPHELPER_INTERFACECONTAINER2_H + +#include <sal/config.h> + +#include <cstddef> +#include <functional> +#include <vector> +#include <utility> + +#include <osl/diagnose.h> +#include <osl/mutex.hxx> +#include <rtl/alloc.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/lang/EventObject.hpp> + +#include <com/sun/star/lang/DisposedException.hpp> +#include <cppuhelper/cppuhelperdllapi.h> + +/** */ //for docpp +namespace comphelper +{ + +namespace detail { + + /** + This is here to optimise space in the common case that there are zero or one + listeners. + */ + union element_alias2 + { + std::vector< css::uno::Reference< css::uno::XInterface > > *pAsVector; + css::uno::XInterface * pAsInterface; + element_alias2() : pAsInterface(NULL) {} + }; + +} + + +class OInterfaceContainerHelper2; +/** + This is the iterator of a InterfaceContainerHelper. Typically + one constructs an instance on the stack for one firing session. + It is not allowed to assign or copy an instance of this class. + + @see OInterfaceContainerHelper + */ +class CPPUHELPER_DLLPUBLIC OInterfaceIteratorHelper2 +{ +public: + /** + Create an iterator over the elements of the container. The iterator + copies the elements of the conatainer. A change to the container + during the lifetime of an iterator is allowed and does not + affect the iterator-instance. The iterator and the container take cares + themself for concurrent access, no additional guarding is necessary. + + Remark: The copy is on demand. The iterator copy the elements only if the container + change the contents. It is not allowed to destroy the container as long + as an iterator exist. + + @param rCont the container of the elements. + */ + OInterfaceIteratorHelper2( OInterfaceContainerHelper2 & rCont ); + + /** + Releases the connection to the container. + */ + ~OInterfaceIteratorHelper2(); + + /** Return true, if there are more elements in the iterator. */ + bool SAL_CALL hasMoreElements() const + { return nRemain != 0; } + /** Return the next element of the iterator. Calling this method if + hasMoreElements() has returned false, is an error. Cast the + returned pointer to the + */ + css::uno::XInterface * SAL_CALL next(); + + /** Removes the current element (the last one returned by next()) + from the underlying container. Calling this method before + next() has been called or calling it twice with no next() + inbetween is an error. + */ + void SAL_CALL remove(); + +private: + OInterfaceContainerHelper2 & rCont; + bool bIsList; + detail::element_alias2 aData; + sal_Int32 nRemain; + + OInterfaceIteratorHelper2( const OInterfaceIteratorHelper2 & ) + SAL_DELETED_FUNCTION; + OInterfaceIteratorHelper2 & operator = ( const OInterfaceIteratorHelper2 & ) + SAL_DELETED_FUNCTION; +}; + + +/** + A container of interfaces. To access the elements use an iterator. + This implementation is thread save. + + @see OInterfaceIteratorHelper + */ +class CPPUHELPER_DLLPUBLIC OInterfaceContainerHelper2 +{ +public: + // these are here to force memory de/allocation to sal lib. + inline static void * SAL_CALL operator new( size_t nSize ) + { return ::rtl_allocateMemory( nSize ); } + inline static void SAL_CALL operator delete( void * pMem ) + { ::rtl_freeMemory( pMem ); } + inline static void * SAL_CALL operator new( size_t, void * pMem ) + { return pMem; } + inline static void SAL_CALL operator delete( void *, void * ) + {} + + /** + Create an interface container. + + @param rMutex the mutex to protect multi thread access. + The lifetime must be longer than the lifetime + of this object. + */ + OInterfaceContainerHelper2( ::osl::Mutex & rMutex ); + /** + Release all interfaces. All iterators must be destroyed before + the container is destructed. + */ + ~OInterfaceContainerHelper2(); + /** + Return the number of Elements in the container. Only useful if you have acquired + the mutex. + */ + sal_Int32 SAL_CALL getLength() const; + + /** + Return all interfaces added to this container. + **/ + std::vector< css::uno::Reference< css::uno::XInterface > > SAL_CALL getElements() const; + + /** Inserts an element into the container. 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 rxIFace + 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 SAL_CALL addInterface( const css::uno::Reference< css::uno::XInterface > & rxIFace ); + /** Removes an element from the container. It uses interface equality to remove the interface. + + @param rxIFace + interface to be removed + @return + the new count of elements in the container + */ + sal_Int32 SAL_CALL removeInterface( const css::uno::Reference< css::uno::XInterface > & rxIFace ); + /** + Call disposing on all object in the container that + support XEventListener. Than clear the container. + */ + void SAL_CALL disposeAndClear( const css::lang::EventObject & rEvt ); + /** + Clears the container without calling disposing(). + */ + void SAL_CALL clear(); + + /** Executes a functor for each contained listener of specified type, e.g. + <code>forEach<awt::XPaintListener>(...</code>. + + If a css::lang::DisposedException occurs which relates to + the called listener, then that listener is removed from the container. + + @tparam ListenerT listener type + @tparam FuncT unary functor type, let your compiler deduce this for you + @param func unary functor object expecting an argument of type + css::uno::Reference<ListenerT> + */ + template <typename ListenerT, typename FuncT> + inline void forEach( FuncT const& func ); + + /** Calls a UNO listener method for each contained listener. + + The listener method must take a single argument of type EventT, + and return <code>void</code>. + + If a css::lang::DisposedException occurs which relates to + the called listener, then that listener is removed from the container. + + @tparam ListenerT UNO event listener type, let your compiler deduce this for you + @tparam EventT event type, let your compiler deduce this for you + @param NotificationMethod + Pointer to a method of a ListenerT interface. + @param Event + Event to notify to all contained listeners + + Example: +@code + awt::PaintEvent aEvent( static_cast< cppu::OWeakObject* >( this ), ... ); + listeners.notifyEach( &XPaintListener::windowPaint, aEvent ); +@endcode + */ + template< typename ListenerT, typename EventT > + inline void notifyEach( void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& ), const EventT& Event ); + +private: +friend class OInterfaceIteratorHelper2; + /** + bIsList == TRUE -> aData.pAsVector of type vector< XInterfaceSequence >, + otherwise aData.pAsInterface == of type (XEventListener *) + */ + detail::element_alias2 aData; + ::osl::Mutex & rMutex; + /** TRUE -> used by an iterator. */ + bool bInUse; + /** TRUE -> aData.pAsVector is of type Sequence< XInterfaceSequence >. */ + bool bIsList; + + OInterfaceContainerHelper2( const OInterfaceContainerHelper2 & ) + SAL_DELETED_FUNCTION; + OInterfaceContainerHelper2 & operator = ( const OInterfaceContainerHelper2 & ) + SAL_DELETED_FUNCTION; + + /* + Duplicate content of the conaitner and release the old one without destroying. + The mutex must be locked and the memberbInUse must be true. + */ + void copyAndResetInUse(); + +private: + template< typename ListenerT, typename EventT > + class NotifySingleListener + { + private: + typedef void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& ); + NotificationMethod m_pMethod; + const EventT& m_rEvent; + public: + NotifySingleListener( NotificationMethod method, const EventT& event ) : m_pMethod( method ), m_rEvent( event ) { } + + void operator()( const css::uno::Reference<ListenerT>& listener ) const + { + (listener.get()->*m_pMethod)( m_rEvent ); + } + }; +}; + +template <typename ListenerT, typename FuncT> +inline void OInterfaceContainerHelper2::forEach( FuncT const& func ) +{ + OInterfaceIteratorHelper2 iter( *this ); + while (iter.hasMoreElements()) { + css::uno::Reference<ListenerT> const xListener( iter.next(), css::uno::UNO_QUERY ); + if (xListener.is()) { + try { + func( xListener ); + } + catch (css::lang::DisposedException const& exc) { + if (exc.Context == xListener) + iter.remove(); + } + } + } +} + +template< typename ListenerT, typename EventT > +inline void OInterfaceContainerHelper2::notifyEach( void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& ), const EventT& Event ) +{ + forEach< ListenerT, NotifySingleListener< ListenerT, EventT > >( NotifySingleListener< ListenerT, EventT >( NotificationMethod, Event ) ); +} + +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/comphelper/listenernotification.hxx b/include/comphelper/listenernotification.hxx index fd11ce6574a4..95164393ddce 100644 --- a/include/comphelper/listenernotification.hxx +++ b/include/comphelper/listenernotification.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_COMPHELPER_LISTENERNOTIFICATION_HXX #define INCLUDED_COMPHELPER_LISTENERNOTIFICATION_HXX -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/lang/XEventListener.hpp> #include <comphelper/comphelperdllapi.h> @@ -57,7 +57,7 @@ namespace comphelper class COMPHELPER_DLLPUBLIC OListenerContainer { private: - ::cppu::OInterfaceContainerHelper m_aListeners; + ::comphelper::OInterfaceContainerHelper2 m_aListeners; public: /** sends a XEventObject::disposing notification to all listeners, and clears the @@ -79,9 +79,9 @@ namespace comphelper /** creates an iterator for looping through all registered listeners */ - ::std::unique_ptr< ::cppu::OInterfaceIteratorHelper > createIterator() + ::std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > createIterator() { - ::std::unique_ptr< ::cppu::OInterfaceIteratorHelper > pIterator( new ::cppu::OInterfaceIteratorHelper( m_aListeners ) ); + ::std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > pIterator( new ::comphelper::OInterfaceIteratorHelper2( m_aListeners ) ); return pIterator; } diff --git a/include/connectivity/parameters.hxx b/include/connectivity/parameters.hxx index b2a19b4925fc..e060604cc7b0 100644 --- a/include/connectivity/parameters.hxx +++ b/include/connectivity/parameters.hxx @@ -35,7 +35,7 @@ #include <connectivity/dbtoolsdllapi.hxx> #include <connectivity/paramwrapper.hxx> #include <unotools/sharedunocomponent.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> namespace dbtools @@ -98,7 +98,7 @@ namespace dbtools private: ::osl::Mutex& m_rMutex; - ::cppu::OInterfaceContainerHelper m_aParameterListeners; + ::comphelper::OInterfaceContainerHelper2 m_aParameterListeners; css::uno::Reference< css::uno::XComponentContext > m_xContext; diff --git a/include/connectivity/sdbcx/VCollection.hxx b/include/connectivity/sdbcx/VCollection.hxx index 3250a81bc20d..998cf7805bf6 100644 --- a/include/connectivity/sdbcx/VCollection.hxx +++ b/include/connectivity/sdbcx/VCollection.hxx @@ -32,7 +32,7 @@ #include <com/sun/star/sdbcx/XAppend.hpp> #include <com/sun/star/sdbcx/XDrop.hpp> #include <com/sun/star/sdbc/XColumnLocate.hpp> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <connectivity/CommonTools.hxx> #include <com/sun/star/container/XContainer.hpp> @@ -92,8 +92,8 @@ namespace connectivity protected: ::std::unique_ptr<IObjectCollection> m_pElements; - ::cppu::OInterfaceContainerHelper m_aContainerListeners; - ::cppu::OInterfaceContainerHelper m_aRefreshListeners; + ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners; + ::comphelper::OInterfaceContainerHelper2 m_aRefreshListeners; protected: ::cppu::OWeakObject& m_rParent; // parent of the collection diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx index ff68e5584c52..cbe5b8be6057 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -43,7 +43,7 @@ #include <com/sun/star/style/LineSpacing.hpp> #include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/weak.hxx> #include <cppuhelper/weakagg.hxx> #include <osl/diagnose.hxx> @@ -518,7 +518,7 @@ private: // for xComponent ::osl::Mutex maDisposeContainerMutex; - ::cppu::OInterfaceContainerHelper maDisposeListeners; + ::comphelper::OInterfaceContainerHelper2 maDisposeListeners; bool mbDisposing; protected: diff --git a/include/linguistic/lngprophelp.hxx b/include/linguistic/lngprophelp.hxx index 6039555734cb..c432b7bbe519 100644 --- a/include/linguistic/lngprophelp.hxx +++ b/include/linguistic/lngprophelp.hxx @@ -21,7 +21,7 @@ #define INCLUDED_LINGUISTIC_LNGPROPHELP_HXX #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <com/sun/star/beans/PropertyValues.hpp> #include <com/sun/star/linguistic2/XLinguProperties.hpp> @@ -60,7 +60,7 @@ class PropertyChgHelper : { css::uno::Sequence< OUString > aPropNames; css::uno::Reference< css::uno::XInterface > xMyEvtObj; - ::cppu::OInterfaceContainerHelper aLngSvcEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aLngSvcEvtListeners; css::uno::Reference< css::beans::XPropertySet > xPropSet; int nEvtFlags; // flags for event types allowed to be launched diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx index 25370fafe376..9fe961b3452a 100644 --- a/include/svx/fmgridif.hxx +++ b/include/svx/fmgridif.hxx @@ -67,7 +67,7 @@ public: // FmXModifyMultiplexer class SAL_WARN_UNUSED FmXModifyMultiplexer :public OWeakSubObject - ,public ::cppu::OInterfaceContainerHelper + ,public ::comphelper::OInterfaceContainerHelper2 ,public css::util::XModifyListener { public: @@ -81,7 +81,7 @@ public: // css::util::XModifyListener virtual void SAL_CALL modified(const css::lang::EventObject& Source) throw(css::uno::RuntimeException, std::exception) override; -// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators +// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); } void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); } }; @@ -90,7 +90,7 @@ public: // FmXUpdateMultiplexer class SAL_WARN_UNUSED FmXUpdateMultiplexer : public OWeakSubObject, - public ::cppu::OInterfaceContainerHelper, + public ::comphelper::OInterfaceContainerHelper2, public css::form::XUpdateListener { public: @@ -106,7 +106,7 @@ public: virtual sal_Bool SAL_CALL approveUpdate(const css::lang::EventObject &) throw(css::uno::RuntimeException, std::exception) override; virtual void SAL_CALL updated(const css::lang::EventObject &) throw(css::uno::RuntimeException, std::exception) override; -// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators +// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); } void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); } }; @@ -115,7 +115,7 @@ public: // FmXSelectionMultiplexer class SAL_WARN_UNUSED FmXSelectionMultiplexer :public OWeakSubObject - ,public ::cppu::OInterfaceContainerHelper + ,public ::comphelper::OInterfaceContainerHelper2 ,public css::view::XSelectionChangeListener { public: @@ -130,7 +130,7 @@ public: // css::view::XSelectionChangeListener virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) throw (css::uno::RuntimeException, std::exception) override; -// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators +// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); } void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); } }; @@ -139,7 +139,7 @@ public: // FmXGridControlMultiplexer class SAL_WARN_UNUSED FmXGridControlMultiplexer :public OWeakSubObject - ,public ::cppu::OInterfaceContainerHelper + ,public ::comphelper::OInterfaceContainerHelper2 ,public css::form::XGridControlListener { public: @@ -154,7 +154,7 @@ public: // css::view::XSelectionChangeListener virtual void SAL_CALL columnChanged( const css::lang::EventObject& _event ) throw (css::uno::RuntimeException, std::exception) override; -// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators +// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); } void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); } }; @@ -163,7 +163,7 @@ public: // FmXContainerMultiplexer class SAL_WARN_UNUSED FmXContainerMultiplexer : public OWeakSubObject, - public ::cppu::OInterfaceContainerHelper, + public ::comphelper::OInterfaceContainerHelper2, public css::container::XContainerListener { public: @@ -179,7 +179,7 @@ public: virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& Event) throw(css::uno::RuntimeException, std::exception) override; virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& Event) throw(css::uno::RuntimeException, std::exception) override; -// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators +// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); } void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); } }; @@ -336,7 +336,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC FmXGridPeer: { css::uno::Reference< css::container::XIndexContainer > m_xColumns; css::uno::Reference< css::sdbc::XRowSet > m_xCursor; - ::cppu::OInterfaceContainerHelper m_aModifyListeners, + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners, m_aUpdateListeners, m_aContainerListeners, m_aSelectionListeners, diff --git a/include/toolkit/awt/vclxtopwindow.hxx b/include/toolkit/awt/vclxtopwindow.hxx index 5335e700f3e0..1c0b6af7fb9b 100644 --- a/include/toolkit/awt/vclxtopwindow.hxx +++ b/include/toolkit/awt/vclxtopwindow.hxx @@ -46,7 +46,7 @@ protected: virtual vcl::Window* GetWindowImpl() = 0; - virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl() = 0; + virtual ::comphelper::OInterfaceContainerHelper2& GetTopWindowListenersImpl() = 0; VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer ); @@ -86,7 +86,7 @@ class TOOLKIT_DLLPUBLIC VCLXTopWindow: public VCLXTopWindow_Base, { protected: virtual vcl::Window* GetWindowImpl() override; - virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl() override; + virtual ::comphelper::OInterfaceContainerHelper2& GetTopWindowListenersImpl() override; public: VCLXTopWindow(bool bWHWND = false); diff --git a/include/toolkit/awt/vclxwindow.hxx b/include/toolkit/awt/vclxwindow.hxx index a353c4a44b43..67d6f7ed39a9 100644 --- a/include/toolkit/awt/vclxwindow.hxx +++ b/include/toolkit/awt/vclxwindow.hxx @@ -102,8 +102,8 @@ protected: bool bWithDefaults = false ); virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ); - ::cppu::OInterfaceContainerHelper& GetContainerListeners(); - ::cppu::OInterfaceContainerHelper& GetTopWindowListeners(); + ::comphelper::OInterfaceContainerHelper2& GetContainerListeners(); + ::comphelper::OInterfaceContainerHelper2& GetTopWindowListeners(); public: typedef ::std::function<void ()> Callback; diff --git a/include/toolkit/controls/controlmodelcontainerbase.hxx b/include/toolkit/controls/controlmodelcontainerbase.hxx index 87918266d03f..cf2e214721e0 100644 --- a/include/toolkit/controls/controlmodelcontainerbase.hxx +++ b/include/toolkit/controls/controlmodelcontainerbase.hxx @@ -79,7 +79,7 @@ public: protected: ContainerListenerMultiplexer maContainerListeners; - ::cppu::OInterfaceContainerHelper maChangeListeners; + ::comphelper::OInterfaceContainerHelper2 maChangeListeners; UnoControlModelHolderList maModels; AllGroups maGroups; diff --git a/include/toolkit/controls/unocontrol.hxx b/include/toolkit/controls/unocontrol.hxx index d31f49bcddce..a410c722add8 100644 --- a/include/toolkit/controls/unocontrol.hxx +++ b/include/toolkit/controls/unocontrol.hxx @@ -92,7 +92,7 @@ protected: MouseListenerMultiplexer maMouseListeners; MouseMotionListenerMultiplexer maMouseMotionListeners; PaintListenerMultiplexer maPaintListeners; - ::cppu::OInterfaceContainerHelper maModeChangeListeners; + ::comphelper::OInterfaceContainerHelper2 maModeChangeListeners; css::uno::Reference< css::uno::XInterface > mxContext; css::uno::Reference< css::awt::XControlModel > mxModel; diff --git a/include/toolkit/controls/unocontrols.hxx b/include/toolkit/controls/unocontrols.hxx index 31b92959b7c5..220c32aa933d 100644 --- a/include/toolkit/controls/unocontrols.hxx +++ b/include/toolkit/controls/unocontrols.hxx @@ -877,7 +877,7 @@ private: protected: std::unique_ptr<UnoControlListBoxModel_Data> m_xData; - ::cppu::OInterfaceContainerHelper m_aItemListListeners; + ::comphelper::OInterfaceContainerHelper2 m_aItemListListeners; }; diff --git a/include/toolkit/helper/listenermultiplexer.hxx b/include/toolkit/helper/listenermultiplexer.hxx index 49dab94db067..d1a1e6a11e07 100644 --- a/include/toolkit/helper/listenermultiplexer.hxx +++ b/include/toolkit/helper/listenermultiplexer.hxx @@ -43,7 +43,7 @@ #include <com/sun/star/view/XSelectionChangeListener.hpp> #include <com/sun/star/util/VetoException.hpp> #include <cppuhelper/weak.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <osl/mutex.hxx> #include <toolkit/helper/mutexhelper.hxx> #include <toolkit/helper/macros.hxx> @@ -54,7 +54,7 @@ class TOOLKIT_DLLPUBLIC ListenerMultiplexerBase : public MutexHelper, - public ::cppu::OInterfaceContainerHelper, + public ::comphelper::OInterfaceContainerHelper2, public css::uno::XInterface { private: diff --git a/include/toolkit/helper/macros.hxx b/include/toolkit/helper/macros.hxx index e844bd350677..20e7c7cbf30a 100644 --- a/include/toolkit/helper/macros.hxx +++ b/include/toolkit/helper/macros.hxx @@ -142,7 +142,7 @@ void ClassName::disposing( const css::lang::EventObject& ) throw(css::uno::Runti #define IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( ClassName, InterfaceName, MethodName, ParamType1 ) \ { \ ParamType1 aMulti( evt ); \ - ::cppu::OInterfaceIteratorHelper aIt( *this ); \ + ::comphelper::OInterfaceIteratorHelper2 aIt( *this ); \ while( aIt.hasMoreElements() ) \ { \ css::uno::Reference< InterfaceName > xListener( \ @@ -168,7 +168,7 @@ void ClassName::disposing( const css::lang::EventObject& ) throw(css::uno::Runti { \ EventType aMulti( evt ); \ aMulti.Source = &GetContext(); \ - ::cppu::OInterfaceIteratorHelper aIt( *this ); \ + ::comphelper::OInterfaceIteratorHelper2 aIt( *this ); \ while( aIt.hasMoreElements() ) \ { \ css::uno::Reference< InterfaceName > xListener( \ diff --git a/io/Library_io.mk b/io/Library_io.mk index cfe879f5e155..3468c9edca81 100644 --- a/io/Library_io.mk +++ b/io/Library_io.mk @@ -14,6 +14,7 @@ $(eval $(call gb_Library_use_external,io,boost_headers)) $(eval $(call gb_Library_use_udk_api,io)) $(eval $(call gb_Library_use_libraries,io,\ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/io/source/stm/opump.cxx b/io/source/stm/opump.cxx index 3386ba48966f..01faa23ae7d4 100644 --- a/io/source/stm/opump.cxx +++ b/io/source/stm/opump.cxx @@ -35,7 +35,7 @@ #include <uno/mapping.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/factory.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <osl/mutex.hxx> #include <osl/thread.h> @@ -44,6 +44,7 @@ using namespace osl; using namespace std; using namespace cppu; +using namespace comphelper; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::registry; @@ -63,7 +64,7 @@ namespace io_stm { Reference< XConnectable > m_xSucc; Reference< XInputStream > m_xInput; Reference< XOutputStream > m_xOutput; - OInterfaceContainerHelper m_cnt; + OInterfaceContainerHelper2 m_cnt; bool m_closeFired; void run(); @@ -123,7 +124,7 @@ Pump::~Pump() void Pump::fireError( const Any & exception ) { - OInterfaceIteratorHelper iter( m_cnt ); + OInterfaceIteratorHelper2 iter( m_cnt ); while( iter.hasMoreElements() ) { try @@ -151,7 +152,7 @@ void Pump::fireClose() if( bFire ) { - OInterfaceIteratorHelper iter( m_cnt ); + OInterfaceIteratorHelper2 iter( m_cnt ); while( iter.hasMoreElements() ) { try @@ -168,7 +169,7 @@ void Pump::fireClose() void Pump::fireStarted() { - OInterfaceIteratorHelper iter( m_cnt ); + OInterfaceIteratorHelper2 iter( m_cnt ); while( iter.hasMoreElements() ) { try @@ -184,7 +185,7 @@ void Pump::fireStarted() void Pump::fireTerminated() { - OInterfaceIteratorHelper iter( m_cnt ); + OInterfaceIteratorHelper2 iter( m_cnt ); while( iter.hasMoreElements() ) { try diff --git a/lingucomponent/Library_hyphen.mk b/lingucomponent/Library_hyphen.mk index 7e269f260251..5ea6cd8c0355 100644 --- a/lingucomponent/Library_hyphen.mk +++ b/lingucomponent/Library_hyphen.mk @@ -20,6 +20,7 @@ $(eval $(call gb_Library_set_include,hyphen,\ $(eval $(call gb_Library_use_sdk_api,hyphen)) $(eval $(call gb_Library_use_libraries,hyphen,\ + comphelper \ cppu \ cppuhelper \ i18nlangtag \ diff --git a/lingucomponent/Library_spell.mk b/lingucomponent/Library_spell.mk index 1afb78853b6a..408eb72afc9c 100644 --- a/lingucomponent/Library_spell.mk +++ b/lingucomponent/Library_spell.mk @@ -20,6 +20,7 @@ $(eval $(call gb_Library_set_include,spell,\ $(eval $(call gb_Library_use_sdk_api,spell)) $(eval $(call gb_Library_use_libraries,spell,\ + comphelper \ cppu \ cppuhelper \ i18nlangtag \ diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx index e59ab94497af..1f23dbbeef33 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx @@ -69,7 +69,7 @@ class Hyphenator : HDInfo * aDicts; sal_Int32 numdict; - ::cppu::OInterfaceContainerHelper aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; linguistic::PropertyHelper_Hyphenation* pPropHelper; bool bDisposing; diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx index ddb43ca9e1fc..b51a8040011b 100644 --- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx +++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx @@ -67,7 +67,7 @@ class MacSpellChecker : NSSpellChecker * macSpell; int macTag; // unique tag for this doc - ::cppu::OInterfaceContainerHelper aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; Reference< XPropertyChangeListener > xPropHelper; linguistic::PropertyHelper_Spell * pPropHelper; bool bDisposing; diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.hxx b/lingucomponent/source/spellcheck/spell/sspellimp.hxx index 0f42a8b42ca1..5abf0efe25d7 100644 --- a/lingucomponent/source/spellcheck/spell/sspellimp.hxx +++ b/lingucomponent/source/spellcheck/spell/sspellimp.hxx @@ -61,7 +61,7 @@ class SpellChecker : OUString * aDNames; sal_Int32 numdict; - ::cppu::OInterfaceContainerHelper aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; linguistic::PropertyHelper_Spelling* pPropHelper; bool bDisposing; diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.hxx b/lingucomponent/source/thesaurus/libnth/nthesimp.hxx index f7063996cd05..b39db99f7476 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.hxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.hxx @@ -66,7 +66,7 @@ class Thesaurus : { Sequence< Locale > aSuppLocales; - ::cppu::OInterfaceContainerHelper aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; linguistic::PropertyHelper_Thesaurus* pPropHelper; bool bDisposing; CharClass ** aCharSetInfo; diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx index d04e4f166f2c..e78127c97ff2 100644 --- a/linguistic/source/convdic.cxx +++ b/linguistic/source/convdic.cxx @@ -618,13 +618,7 @@ void SAL_CALL ConvDic::flush( ) // notify listeners EventObject aEvtObj; aEvtObj.Source = uno::Reference< XFlushable >( this ); - cppu::OInterfaceIteratorHelper aIt( aFlushListeners ); - while (aIt.hasMoreElements()) - { - uno::Reference< util::XFlushListener > xRef( aIt.next(), UNO_QUERY ); - if (xRef.is()) - xRef->flushed( aEvtObj ); - } + aFlushListeners.notifyEach( &util::XFlushListener::flushed, aEvtObj ); } diff --git a/linguistic/source/convdic.hxx b/linguistic/source/convdic.hxx index 4a3a0e45342c..fe5585bc6de0 100644 --- a/linguistic/source/convdic.hxx +++ b/linguistic/source/convdic.hxx @@ -24,7 +24,7 @@ #include <com/sun/star/util/XFlushable.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <memory> #include <set> @@ -79,7 +79,7 @@ class ConvDic : protected: - ::cppu::OInterfaceContainerHelper aFlushListeners; + ::comphelper::OInterfaceContainerHelper2 aFlushListeners; ConvMap aFromLeft; std::unique_ptr< ConvMap > pFromRight; // only available for bidirectional conversion dictionaries diff --git a/linguistic/source/convdiclist.hxx b/linguistic/source/convdiclist.hxx index dd02dee99340..ffa0ea5dd37a 100644 --- a/linguistic/source/convdiclist.hxx +++ b/linguistic/source/convdiclist.hxx @@ -52,7 +52,7 @@ class ConvDicList : }; - ::cppu::OInterfaceContainerHelper aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; ConvDicNameContainer *pNameContainer; css::uno::Reference< diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index cabbc3fe8a38..25311be0a06c 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -501,13 +501,7 @@ void DictionaryNeo::launchEvent(sal_Int16 nEvent, aEvt.nEvent = nEvent; aEvt.xDictionaryEntry = xEntry; - cppu::OInterfaceIteratorHelper aIt( aDicEvtListeners ); - while (aIt.hasMoreElements()) - { - uno::Reference< XDictionaryEventListener > xRef( aIt.next(), UNO_QUERY ); - if (xRef.is()) - xRef->processDictionaryEvent( aEvt ); - } + aDicEvtListeners.notifyEach( &XDictionaryEventListener::processDictionaryEvent, aEvt); } int DictionaryNeo::cmpDicEntry(const OUString& rWord1, diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx index e443d901273a..6b5ca473d8b4 100644 --- a/linguistic/source/dicimp.hxx +++ b/linguistic/source/dicimp.hxx @@ -25,7 +25,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <tools/solar.h> #include "defs.hxx" @@ -43,7 +43,7 @@ class DictionaryNeo : > { - ::cppu::OInterfaceContainerHelper aDicEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aDicEvtListeners; css::uno::Sequence< css::uno::Reference< css::linguistic2::XDictionaryEntry > > aEntries; OUString aDicName; diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index 147ff86056f6..020eaf782c66 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -66,7 +66,7 @@ class DicEvtListenerHelper : XDictionaryEventListener > { - cppu::OInterfaceContainerHelper aDicListEvtListeners; + comphelper::OInterfaceContainerHelper2 aDicListEvtListeners; uno::Sequence< DictionaryEvent > aCollectDicEvt; uno::Reference< XDictionaryList > xMyDicList; @@ -254,13 +254,7 @@ sal_Int16 DicEvtListenerHelper::FlushEvents() DictionaryListEvent aEvent( xMyDicList, nCondensedEvt, aDicEvents ); // pass on event - cppu::OInterfaceIteratorHelper aIt( aDicListEvtListeners ); - while (aIt.hasMoreElements()) - { - uno::Reference< XDictionaryListEventListener > xRef( aIt.next(), UNO_QUERY ); - if (xRef.is()) - xRef->processDictionaryListEvent( aEvent ); - } + aDicListEvtListeners.notifyEach( &XDictionaryListEventListener::processDictionaryListEvent, aEvent ); // clear "list" of events nCondensedEvt = 0; diff --git a/linguistic/source/dlistimp.hxx b/linguistic/source/dlistimp.hxx index 25ad796bc815..42c395ec4745 100644 --- a/linguistic/source/dlistimp.hxx +++ b/linguistic/source/dlistimp.hxx @@ -54,7 +54,7 @@ class DicList : LinguOptions aOpt; - ::cppu::OInterfaceContainerHelper aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; typedef std::vector< css::uno::Reference< css::linguistic2::XDictionary > > DictionaryVec_t; DictionaryVec_t aDicList; diff --git a/linguistic/source/gciterator.hxx b/linguistic/source/gciterator.hxx index a93957931fb1..a00618da3eac 100644 --- a/linguistic/source/gciterator.hxx +++ b/linguistic/source/gciterator.hxx @@ -114,8 +114,8 @@ class GrammarCheckingIterator: //! beware of initilization order ! struct MyMutex : public rtl::Static< osl::Mutex, MyMutex > {}; - cppu::OInterfaceContainerHelper m_aEventListeners; - cppu::OInterfaceContainerHelper m_aNotifyListeners; + comphelper::OInterfaceContainerHelper2 m_aEventListeners; + comphelper::OInterfaceContainerHelper2 m_aNotifyListeners; css::uno::Reference< css::i18n::XBreakIterator > m_xBreakIterator; mutable css::uno::Reference< css::util::XChangesBatch > m_xUpdateAccess; diff --git a/linguistic/source/lngopt.hxx b/linguistic/source/lngopt.hxx index 13a705d9fc9c..bec8f1004500 100644 --- a/linguistic/source/lngopt.hxx +++ b/linguistic/source/lngopt.hxx @@ -22,6 +22,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XFastPropertySet.hpp> #include <com/sun/star/beans/XPropertyAccess.hpp> @@ -76,7 +77,7 @@ class LinguProps : css::lang::XServiceInfo > { - ::cppu::OInterfaceContainerHelper aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; OPropertyListenerContainerHelper aPropListeners; SfxItemPropertyMap aPropertyMap; diff --git a/linguistic/source/lngprophelp.cxx b/linguistic/source/lngprophelp.cxx index 097756c7b0ac..9dc4588cba40 100644 --- a/linguistic/source/lngprophelp.cxx +++ b/linguistic/source/lngprophelp.cxx @@ -254,13 +254,7 @@ void PropertyChgHelper::RemoveAsPropListener() void PropertyChgHelper::LaunchEvent( const LinguServiceEvent &rEvt ) { - cppu::OInterfaceIteratorHelper aIt( aLngSvcEvtListeners ); - while (aIt.hasMoreElements()) - { - Reference< XLinguServiceEventListener > xRef( aIt.next(), UNO_QUERY ); - if (xRef.is()) - xRef->processLinguServiceEvent( rEvt ); - } + aLngSvcEvtListeners.notifyEach( &XLinguServiceEventListener::processLinguServiceEvent, rEvt ); } diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index 9c5919f11f47..c7a38ffe49a8 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -183,8 +183,8 @@ class LngSvcMgrListenerHelper : { LngSvcMgr &rMyManager; - ::cppu::OInterfaceContainerHelper aLngSvcMgrListeners; - ::cppu::OInterfaceContainerHelper aLngSvcEvtBroadcasters; + ::comphelper::OInterfaceContainerHelper2 aLngSvcMgrListeners; + ::comphelper::OInterfaceContainerHelper2 aLngSvcEvtBroadcasters; uno::Reference< linguistic2::XSearchableDictionaryList > xDicList; sal_Int16 nCombinedLngSvcEvt; @@ -276,13 +276,7 @@ void LngSvcMgrListenerHelper::Timeout() rMyManager.pSpellDsp->FlushSpellCache(); // pass event on to linguistic2::XLinguServiceEventListener's - cppu::OInterfaceIteratorHelper aIt( aLngSvcMgrListeners ); - while (aIt.hasMoreElements()) - { - uno::Reference< linguistic2::XLinguServiceEventListener > xRef( aIt.next(), uno::UNO_QUERY ); - if (xRef.is()) - xRef->processLinguServiceEvent( aEvtObj ); - } + aLngSvcMgrListeners.notifyEach( &linguistic2::XLinguServiceEventListener::processLinguServiceEvent, aEvtObj ); } } @@ -318,13 +312,7 @@ void SAL_CALL // we do keep the original event source here though... // pass event on to linguistic2::XDictionaryListEventListener's - cppu::OInterfaceIteratorHelper aIt( aLngSvcMgrListeners ); - while (aIt.hasMoreElements()) - { - uno::Reference< linguistic2::XDictionaryListEventListener > xRef( aIt.next(), uno::UNO_QUERY ); - if (xRef.is()) - xRef->processDictionaryListEvent( rDicListEvent ); - } + aLngSvcMgrListeners.notifyEach( &linguistic2::XDictionaryListEventListener::processDictionaryListEvent, rDicListEvent ); // "translate" DictionaryList event into linguistic2::LinguServiceEvent sal_Int16 nLngSvcEvt = 0; @@ -365,13 +353,7 @@ void LngSvcMgrListenerHelper::LaunchEvent( sal_Int16 nLngSvcEvtFlags ) static_cast<css::linguistic2::XLinguServiceManager*>(&rMyManager), nLngSvcEvtFlags ); // pass event on to linguistic2::XLinguServiceEventListener's - cppu::OInterfaceIteratorHelper aIt( aLngSvcMgrListeners ); - while (aIt.hasMoreElements()) - { - uno::Reference< linguistic2::XLinguServiceEventListener > xRef( aIt.next(), uno::UNO_QUERY ); - if (xRef.is()) - xRef->processLinguServiceEvent( aEvt ); - } + aLngSvcMgrListeners.notifyEach( &linguistic2::XLinguServiceEventListener::processLinguServiceEvent, aEvt ); } @@ -397,7 +379,7 @@ void LngSvcMgrListenerHelper::DisposeAndClear( const lang::EventObject &rEvtObj aLngSvcMgrListeners .disposeAndClear( rEvtObj ); // remove references to this object hold by the broadcasters - cppu::OInterfaceIteratorHelper aIt( aLngSvcEvtBroadcasters ); + comphelper::OInterfaceIteratorHelper2 aIt( aLngSvcEvtBroadcasters ); while (aIt.hasMoreElements()) { uno::Reference< linguistic2::XLinguServiceEventBroadcaster > xRef( aIt.next(), uno::UNO_QUERY ); diff --git a/linguistic/source/lngsvcmgr.hxx b/linguistic/source/lngsvcmgr.hxx index 0eee0605eddd..27a7aa86a038 100644 --- a/linguistic/source/lngsvcmgr.hxx +++ b/linguistic/source/lngsvcmgr.hxx @@ -21,7 +21,7 @@ #define INCLUDED_LINGUISTIC_SOURCE_LNGSVCMGR_HXX #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/uno/Reference.h> @@ -66,7 +66,7 @@ class LngSvcMgr : { friend class LngSvcMgrListenerHelper; - ::cppu::OInterfaceContainerHelper aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; css::uno::Reference< css::linguistic2::XSpellChecker > xSpellDsp; diff --git a/linguistic/workben/sprophelp.hxx b/linguistic/workben/sprophelp.hxx index d2dc229ba9e1..8e115a55805b 100644 --- a/linguistic/workben/sprophelp.hxx +++ b/linguistic/workben/sprophelp.hxx @@ -54,7 +54,7 @@ class PropertyChgHelper : { Sequence< OUString > aPropNames; Reference< XInterface > xMyEvtObj; - ::cppu::OInterfaceContainerHelper aLngSvcEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aLngSvcEvtListeners; Reference< XPropertySet > xPropSet; // disallow use of copy-constructor and assignment-operator diff --git a/linguistic/workben/sspellimp.hxx b/linguistic/workben/sspellimp.hxx index cb9232a9ad0a..7e70fdf0a4a2 100644 --- a/linguistic/workben/sspellimp.hxx +++ b/linguistic/workben/sspellimp.hxx @@ -53,7 +53,7 @@ class SpellChecker : > { Sequence< Locale > aSuppLocales; - ::cppu::OInterfaceContainerHelper aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; Reference< XPropertyChangeListener > xPropHelper; PropertyHelper_Spell * pPropHelper; sal_Bool bDisposing; diff --git a/package/inc/zipfileaccess.hxx b/package/inc/zipfileaccess.hxx index 1fab519ee35b..d324b0a4476c 100644 --- a/package/inc/zipfileaccess.hxx +++ b/package/inc/zipfileaccess.hxx @@ -28,7 +28,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/implbase.hxx> #include <mutexholder.hxx> @@ -46,7 +46,7 @@ class OZipFileAccess : public ::cppu::WeakImplHelper< css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::io::XInputStream > m_xContentStream; ZipFile* m_pZipFile; - ::cppu::OInterfaceContainerHelper* m_pListenersContainer; + ::comphelper::OInterfaceContainerHelper2* m_pListenersContainer; bool m_bDisposed; bool m_bOwnContent; diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx index 6c98e3ba106a..57ee9ea41bbb 100644 --- a/package/source/xstor/ocompinstream.cxx +++ b/package/source/xstor/ocompinstream.cxx @@ -270,7 +270,7 @@ void SAL_CALL OInputCompStream::addEventListener( const uno::Reference< lang::XE } if ( !m_pInterfaceContainer ) - m_pInterfaceContainer = new ::cppu::OInterfaceContainerHelper( m_rMutexRef->GetMutex() ); + m_pInterfaceContainer = new ::comphelper::OInterfaceContainerHelper2( m_rMutexRef->GetMutex() ); m_pInterfaceContainer->addInterface( xListener ); } diff --git a/package/source/xstor/ocompinstream.hxx b/package/source/xstor/ocompinstream.hxx index 404a98013991..7600f29aac55 100644 --- a/package/source/xstor/ocompinstream.hxx +++ b/package/source/xstor/ocompinstream.hxx @@ -28,7 +28,7 @@ #include <com/sun/star/embed/XExtendedStorageStream.hpp> #include <com/sun/star/embed/XRelationshipAccess.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include "mutexholder.hxx" @@ -43,7 +43,7 @@ protected: OWriteStream_Impl* m_pImpl; rtl::Reference<SotMutexHolder> m_rMutexRef; css::uno::Reference < css::io::XInputStream > m_xStream; - ::cppu::OInterfaceContainerHelper* m_pInterfaceContainer; + ::comphelper::OInterfaceContainerHelper2* m_pInterfaceContainer; css::uno::Sequence < css::beans::PropertyValue > m_aProperties; bool m_bDisposed; sal_Int32 m_nStorageType; diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx index 63248e7d108b..5a59c00e2cb2 100644 --- a/package/source/zippackage/zipfileaccess.cxx +++ b/package/source/zippackage/zipfileaccess.cxx @@ -431,7 +431,7 @@ void SAL_CALL OZipFileAccess::addEventListener( const uno::Reference< lang::XEve throw lang::DisposedException(THROW_WHERE ); if ( !m_pListenersContainer ) - m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutexHolder->GetMutex() ); + m_pListenersContainer = new ::comphelper::OInterfaceContainerHelper2( m_aMutexHolder->GetMutex() ); m_pListenersContainer->addInterface( xListener ); } diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index b8e5314f46f0..cc825ea36882 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -475,11 +475,11 @@ uno::Sequence< uno::Any > SAL_CALL OStyle::getPropertyDefaults( const uno::Seque struct OReportDefinitionImpl { uno::WeakReference< uno::XInterface > m_xParent; - ::cppu::OInterfaceContainerHelper m_aStorageChangeListeners; - ::cppu::OInterfaceContainerHelper m_aCloseListener; - ::cppu::OInterfaceContainerHelper m_aModifyListeners; - ::cppu::OInterfaceContainerHelper m_aLegacyEventListeners; - ::cppu::OInterfaceContainerHelper m_aDocEventListeners; + ::comphelper::OInterfaceContainerHelper2 m_aStorageChangeListeners; + ::comphelper::OInterfaceContainerHelper2 m_aCloseListener; + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; + ::comphelper::OInterfaceContainerHelper2 m_aLegacyEventListeners; + ::comphelper::OInterfaceContainerHelper2 m_aDocEventListeners; ::std::vector< uno::Reference< frame::XController> > m_aControllers; uno::Sequence< beans::PropertyValue > m_aArgs; diff --git a/reportdesign/source/core/inc/Functions.hxx b/reportdesign/source/core/inc/Functions.hxx index a0b20c8cb435..355a328759fd 100644 --- a/reportdesign/source/core/inc/Functions.hxx +++ b/reportdesign/source/core/inc/Functions.hxx @@ -22,6 +22,7 @@ #include <com/sun/star/report/XFunctions.hpp> #include <com/sun/star/report/XFunctionsSupplier.hpp> #include <cppuhelper/compbase.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/broadcasthelper.hxx> #include <com/sun/star/uno/XComponentContext.hpp> #include <list> @@ -38,7 +39,7 @@ namespace reportdesign public FunctionsBase { typedef ::std::list< css::uno::Reference< css::report::XFunction > > TFunctions; - ::cppu::OInterfaceContainerHelper m_aContainerListeners; + ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners; css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::WeakReference< css::report::XFunctionsSupplier > m_xParent; TFunctions m_aFunctions; diff --git a/reportdesign/source/core/inc/Groups.hxx b/reportdesign/source/core/inc/Groups.hxx index 44155ce1c113..88920da6849a 100644 --- a/reportdesign/source/core/inc/Groups.hxx +++ b/reportdesign/source/core/inc/Groups.hxx @@ -21,6 +21,7 @@ #include <com/sun/star/report/XGroups.hpp> #include <cppuhelper/compbase.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/broadcasthelper.hxx> #include <com/sun/star/uno/XComponentContext.hpp> #include <list> @@ -37,7 +38,7 @@ namespace reportdesign public GroupsBase { typedef ::std::list< css::uno::Reference< css::report::XGroup > > TGroups; - ::cppu::OInterfaceContainerHelper m_aContainerListeners; + ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners; css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::WeakReference< css::report::XReportDefinition > m_xParent; TGroups m_aGroups; diff --git a/reportdesign/source/core/inc/ReportControlModel.hxx b/reportdesign/source/core/inc/ReportControlModel.hxx index eca3b2194d5a..48b457041efb 100644 --- a/reportdesign/source/core/inc/ReportControlModel.hxx +++ b/reportdesign/source/core/inc/ReportControlModel.hxx @@ -28,7 +28,7 @@ #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <com/sun/star/lang/Locale.hpp> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> namespace reportdesign @@ -81,7 +81,7 @@ namespace reportdesign OReportControlModel(OReportControlModel&) = delete; void operator =(OReportControlModel&) = delete; public: - ::cppu::OInterfaceContainerHelper aContainerListeners; + ::comphelper::OInterfaceContainerHelper2 aContainerListeners; OReportComponentProperties aComponent; OFormatProperties aFormatProperties; css::container::XContainer* m_pOwner; diff --git a/reportdesign/source/core/inc/Section.hxx b/reportdesign/source/core/inc/Section.hxx index e72e545bf4cd..a42b607dca83 100644 --- a/reportdesign/source/core/inc/Section.hxx +++ b/reportdesign/source/core/inc/Section.hxx @@ -25,6 +25,7 @@ #include <comphelper/uno3.hxx> #include <comphelper/types.hxx> #include <cppuhelper/propertysetmixin.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XShapeGrouper.hpp> @@ -52,7 +53,7 @@ namespace reportdesign public SectionBase, public SectionPropertySet { - ::cppu::OInterfaceContainerHelper m_aContainerListeners; + ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners; css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage; css::uno::Reference< css::drawing::XShapeGrouper > m_xDrawPage_ShapeGrouper; diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx index 092a2a2edab5..2408d8a82e9f 100644 --- a/reportdesign/source/ui/inc/ReportController.hxx +++ b/reportdesign/source/ui/inc/ReportController.hxx @@ -48,6 +48,7 @@ #include <comphelper/propertystatecontainer.hxx> #include <comphelper/uno3.hxx> #include <cppuhelper/implbase5.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <dbaccess/dbsubcomponentcontroller.hxx> #include <svl/lstner.hxx> #include <svtools/transfer.hxx> @@ -86,7 +87,7 @@ namespace rptui { private: OModuleClient m_aModuleClient; - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aSelectionListeners; css::uno::Sequence< css::beans::PropertyValue> m_aCollapsedSections; diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index f4430e5c5f89..6dc18f6ffedc 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -49,7 +49,7 @@ #include <com/sun/star/sheet/opencl/OpenCLPlatform.hpp> #include <com/sun/star/util/XChangesNotifier.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <svl/itemprop.hxx> #include <vcl/event.hxx> #include <vcl/ITiledRenderable.hxx> @@ -101,7 +101,7 @@ private: css::uno::Reference<css::uno::XInterface> xChartDataProv; css::uno::Reference<css::uno::XInterface> xObjProvider; - ::cppu::OInterfaceContainerHelper maChangesListeners; + ::comphelper::OInterfaceContainerHelper2 maChangesListeners; bool FillRenderMarkData( const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& rOptions, diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx index 6aef98560e5c..a8e195ca19a9 100644 --- a/sc/inc/fielduno.hxx +++ b/sc/inc/fielduno.hxx @@ -37,6 +37,7 @@ #include <com/sun/star/util/DateTime.hpp> #include <cppuhelper/component.hxx> #include <cppuhelper/implbase.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <osl/mutex.hxx> #include <boost/noncopyable.hpp> @@ -63,7 +64,7 @@ private: ScAddress aCellPos; ScEditSource* mpEditSource; /// List of refresh listeners. - cppu::OInterfaceContainerHelper* mpRefreshListeners; + comphelper::OInterfaceContainerHelper2* mpRefreshListeners; /// mutex to lock the InterfaceContainerHelper osl::Mutex aMutex; @@ -129,7 +130,7 @@ private: ScEditSource* mpEditSource; /// List of refresh listeners. - cppu::OInterfaceContainerHelper* mpRefreshListeners; + comphelper::OInterfaceContainerHelper2* mpRefreshListeners; /// mutex to lock the InterfaceContainerHelper osl::Mutex aMutex; diff --git a/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx b/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx index 844bf114e222..f87caa44b271 100644 --- a/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx +++ b/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx @@ -62,7 +62,7 @@ void ScDrawModelBroadcaster::Notify( SfxBroadcaster&, if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) ) return; - ::cppu::OInterfaceIteratorHelper aIter( maEventListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( maEventListeners ); while( aIter.hasMoreElements() ) { uno::Reference < document::XEventListener > xListener( aIter.next(), uno::UNO_QUERY ); diff --git a/sc/source/ui/inc/DrawModelBroadcaster.hxx b/sc/source/ui/inc/DrawModelBroadcaster.hxx index bde6810533d4..b74ffccdaec9 100644 --- a/sc/source/ui/inc/DrawModelBroadcaster.hxx +++ b/sc/source/ui/inc/DrawModelBroadcaster.hxx @@ -21,7 +21,7 @@ #define INCLUDED_SC_SOURCE_UI_INC_DRAWMODELBROADCASTER_HXX #include <svl/lstner.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/implbase.hxx> #include <com/sun/star/document/XEventBroadcaster.hpp> @@ -31,7 +31,7 @@ class ScDrawModelBroadcaster : public SfxListener, public ::cppu::WeakImplHelper< css::document::XEventBroadcaster > { mutable ::osl::Mutex maListenerMutex; - ::cppu::OInterfaceContainerHelper maEventListeners; + ::comphelper::OInterfaceContainerHelper2 maEventListeners; SdrModel *mpDrawModel; public: diff --git a/sc/source/ui/unoobj/celllistsource.cxx b/sc/source/ui/unoobj/celllistsource.cxx index ae58c527aced..d7222686b20f 100644 --- a/sc/source/ui/unoobj/celllistsource.cxx +++ b/sc/source/ui/unoobj/celllistsource.cxx @@ -247,7 +247,7 @@ namespace calc EventObject aEvent; aEvent.Source.set(*this); - ::cppu::OInterfaceIteratorHelper aIter( m_aListEntryListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aListEntryListeners ); while ( aIter.hasMoreElements() ) { try diff --git a/sc/source/ui/unoobj/celllistsource.hxx b/sc/source/ui/unoobj/celllistsource.hxx index 538fe7e9edef..ceb2e1573991 100644 --- a/sc/source/ui/unoobj/celllistsource.hxx +++ b/sc/source/ui/unoobj/celllistsource.hxx @@ -22,6 +22,7 @@ #include <com/sun/star/form/binding/XListEntrySource.hpp> #include <cppuhelper/compbase4.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/propertycontainer.hxx> #include <comphelper/uno3.hxx> #include <comphelper/broadcasthelper.hxx> @@ -62,7 +63,7 @@ namespace calc m_xDocument; /// the document where our cell lives css::uno::Reference< css::table::XCellRange > m_xRange; /// the range of cells we're bound to - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aListEntryListeners; /// our listeners bool m_bInitialized; /// has XInitialization::initialize been called? diff --git a/sc/source/ui/unoobj/cellvaluebinding.cxx b/sc/source/ui/unoobj/cellvaluebinding.cxx index c34fb023ee87..8b73ac68cd93 100644 --- a/sc/source/ui/unoobj/cellvaluebinding.cxx +++ b/sc/source/ui/unoobj/cellvaluebinding.cxx @@ -451,7 +451,7 @@ namespace calc EventObject aEvent; aEvent.Source.set(*this); - ::cppu::OInterfaceIteratorHelper aIter( m_aModifyListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aModifyListeners ); while ( aIter.hasMoreElements() ) { try diff --git a/sc/source/ui/unoobj/cellvaluebinding.hxx b/sc/source/ui/unoobj/cellvaluebinding.hxx index 4979a5e979d6..94c8e63a170c 100644 --- a/sc/source/ui/unoobj/cellvaluebinding.hxx +++ b/sc/source/ui/unoobj/cellvaluebinding.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/form/binding/XValueBinding.hpp> #include <com/sun/star/util/XModifyBroadcaster.hpp> #include <cppuhelper/compbase5.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/propertycontainer.hxx> #include <comphelper/uno3.hxx> #include <comphelper/broadcasthelper.hxx> @@ -66,7 +67,7 @@ namespace calc m_xCell; /// the cell we're bound to, for double value access css::uno::Reference< css::text::XTextRange > m_xCellText; /// the cell we're bound to, for text access - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; /// our modify listeners bool m_bInitialized; /// has XInitialization::initialize been called? bool m_bListPos; /// constructed as ListPositionCellBinding? diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index f39c8698bde3..d250fbd8c2dd 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2678,7 +2678,7 @@ void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& r rChange.ReplacedElement <<= xRangeObj; } - ::cppu::OInterfaceIteratorHelper aIter( maChangesListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( maChangesListeners ); while ( aIter.hasMoreElements() ) { try diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index a0fa9df6daf5..8ec23e93a57e 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -410,35 +410,9 @@ void SAL_CALL ScCellFieldsObj::refresh( ) if (mpRefreshListeners) { // Call all listeners. - uno::Sequence< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElements()); - sal_uInt32 nLength(aListeners.getLength()); - if (nLength) - { - const uno::Reference< uno::XInterface >* pInterfaces = aListeners.getConstArray(); - if (pInterfaces) - { - lang::EventObject aEvent; - aEvent.Source.set(uno::Reference< util::XRefreshable >(this)); - sal_uInt32 i(0); - while (i < nLength) - { - try - { - while(i < nLength) - { - static_cast< util::XRefreshListener* >(pInterfaces->get())->refreshed(aEvent); - ++pInterfaces; - ++i; - } - } - catch(uno::RuntimeException&) - { - ++pInterfaces; - ++i; - } - } - } - } + lang::EventObject aEvent; + aEvent.Source.set(uno::Reference< util::XRefreshable >(this)); + mpRefreshListeners->notifyEach( &util::XRefreshListener::refreshed, aEvent ); } } @@ -449,7 +423,7 @@ void SAL_CALL ScCellFieldsObj::addRefreshListener( const uno::Reference< util::X { SolarMutexGuard aGuard; if (!mpRefreshListeners) - mpRefreshListeners = new cppu::OInterfaceContainerHelper(aMutex); + mpRefreshListeners = new comphelper::OInterfaceContainerHelper2(aMutex); mpRefreshListeners->addInterface(xListener); } } @@ -590,35 +564,9 @@ void SAL_CALL ScHeaderFieldsObj::refresh( ) if (mpRefreshListeners) { // Call all listeners. - uno::Sequence< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElements()); - sal_uInt32 nLength(aListeners.getLength()); - if (nLength) - { - const uno::Reference< uno::XInterface >* pInterfaces = aListeners.getConstArray(); - if (pInterfaces) - { - lang::EventObject aEvent; - aEvent.Source.set(uno::Reference< util::XRefreshable >(this)); - sal_uInt32 i(0); - while (i < nLength) - { - try - { - while(i < nLength) - { - static_cast< util::XRefreshListener* >(pInterfaces->get())->refreshed(aEvent); - ++pInterfaces; - ++i; - } - } - catch(uno::RuntimeException&) - { - ++pInterfaces; - ++i; - } - } - } - } + lang::EventObject aEvent; + aEvent.Source.set(uno::Reference< util::XRefreshable >(this)); + mpRefreshListeners->notifyEach( &util::XRefreshListener::refreshed, aEvent); } } @@ -629,7 +577,7 @@ void SAL_CALL ScHeaderFieldsObj::addRefreshListener( const uno::Reference< util: { SolarMutexGuard aGuard; if (!mpRefreshListeners) - mpRefreshListeners = new cppu::OInterfaceContainerHelper(aMutex); + mpRefreshListeners = new comphelper::OInterfaceContainerHelper2(aMutex); mpRefreshListeners->addInterface(xListener); } } diff --git a/scripting/Library_stringresource.mk b/scripting/Library_stringresource.mk index 1588fd4faff4..c70a054d1bc6 100644 --- a/scripting/Library_stringresource.mk +++ b/scripting/Library_stringresource.mk @@ -21,6 +21,7 @@ $(eval $(call gb_Library_use_external,stringresource,boost_headers)) $(eval $(call gb_Library_use_sdk_api,stringresource)) $(eval $(call gb_Library_use_libraries,stringresource,\ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index f37c4e8fc4e7..46d011d44543 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -701,7 +701,7 @@ void StringResourceImpl::implNotifyListeners() EventObject aEvent; aEvent.Source = static_cast< XInterface* >( static_cast<OWeakObject*>(this) ); - ::cppu::OInterfaceIteratorHelper it( m_aListenerContainer ); + ::comphelper::OInterfaceIteratorHelper2 it( m_aListenerContainer ); while( it.hasMoreElements() ) { Reference< XInterface > xIface = it.next(); diff --git a/scripting/source/stringresource/stringresource.hxx b/scripting/source/stringresource/stringresource.hxx index fc130b852e8e..4519f7cfa678 100644 --- a/scripting/source/stringresource/stringresource.hxx +++ b/scripting/source/stringresource/stringresource.hxx @@ -29,7 +29,7 @@ #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <osl/mutex.hxx> #include <unordered_map> @@ -103,7 +103,7 @@ protected: LocaleItem* m_pDefaultLocaleItem; bool m_bDefaultModified; - ::cppu::OInterfaceContainerHelper m_aListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aListenerContainer; LocaleItemVector m_aLocaleItemVector; LocaleItemVector m_aDeletedLocaleItemVector; diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 8aac204242c3..26af96182453 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -24,6 +24,7 @@ #include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/interfacecontainer.hxx> #include <boost/bind.hpp> #include <editeng/outliner.hxx> @@ -58,7 +59,7 @@ using ::osl::MutexGuard; using ::osl::ClearableMutexGuard; -using ::cppu::OInterfaceContainerHelper; +using ::comphelper::OInterfaceContainerHelper2; using ::com::sun::star::table::BorderLine; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; @@ -345,7 +346,7 @@ bool SdStyleSheet::IsUsed() const { MutexGuard aGuard( mrBHelper.rMutex ); - OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( cppu::UnoType<XModifyListener>::get() ); + cppu::OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( cppu::UnoType<XModifyListener>::get() ); if( pContainer ) { Sequence< Reference< XInterface > > aModifyListeners( pContainer->getElements() ); @@ -837,7 +838,7 @@ void SdStyleSheet::notifyModifyListener() { MutexGuard aGuard( mrBHelper.rMutex ); - OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( cppu::UnoType<XModifyListener>::get() ); + cppu::OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( cppu::UnoType<XModifyListener>::get() ); if( pContainer ) { EventObject aEvt( static_cast< OWeakObject * >( this ) ); diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 8976c21bf393..e9005a71f6ac 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -81,7 +81,7 @@ #include <boost/bind.hpp> -using ::cppu::OInterfaceContainerHelper; +using ::comphelper::OInterfaceContainerHelper2; using ::com::sun::star::animations::XAnimationNode; using ::com::sun::star::animations::XAnimationListener; using ::com::sun::star::awt::XWindow; diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index 28de15aabf3e..8aa17bdcfe58 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -26,6 +26,7 @@ #include <cppuhelper/implbase.hxx> #include "cppuhelper/basemutex.hxx" #include "cppuhelper/propertysetmixin.hxx" +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/awt/XActivateListener.hpp> #include <com/sun/star/presentation/XSlideShow.hpp> #include <com/sun/star/presentation/XSlideShowView.hpp> @@ -151,7 +152,7 @@ public: // css::presentation::XShapeEventListener: virtual void SAL_CALL click(const css::uno::Reference< css::drawing::XShape > & xShape, const css::awt::MouseEvent & aOriginalEvent) throw (css::uno::RuntimeException, std::exception) override; - ::cppu::OInterfaceContainerHelper maListeners; + ::comphelper::OInterfaceContainerHelper2 maListeners; rtl::Reference< SlideshowImpl > mxController; css::uno::Reference< css::presentation::XSlideShow > mxSlideShow; diff --git a/sd/source/ui/unoidl/unocpres.hxx b/sd/source/ui/unoidl/unocpres.hxx index c00e382d5f0d..94e60cbedb4d 100644 --- a/sd/source/ui/unoidl/unocpres.hxx +++ b/sd/source/ui/unoidl/unocpres.hxx @@ -24,7 +24,7 @@ #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <osl/mutex.hxx> #include <cppuhelper/implbase.hxx> @@ -45,7 +45,7 @@ private: // for xComponent ::osl::Mutex aDisposeContainerMutex; - ::cppu::OInterfaceContainerHelper aDisposeListeners; + ::comphelper::OInterfaceContainerHelper2 aDisposeListeners; bool bDisposing; public: 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 diff --git a/slideshow/source/engine/slide/shapemanagerimpl.cxx b/slideshow/source/engine/slide/shapemanagerimpl.cxx index de546680a4c4..e74b1ffa2f6d 100644 --- a/slideshow/source/engine/slide/shapemanagerimpl.cxx +++ b/slideshow/source/engine/slide/shapemanagerimpl.cxx @@ -144,7 +144,7 @@ bool ShapeManagerImpl::handleMouseReleased( awt::MouseEvent const& e ) // shape hit, and shape is visible. Raise // event. - boost::shared_ptr<cppu::OInterfaceContainerHelper> const pCont( + boost::shared_ptr<comphelper::OInterfaceContainerHelper2> const pCont( aCurrBroadcaster->second ); uno::Reference<drawing::XShape> const xShape( aCurrBroadcaster->first->getXShape() ); diff --git a/slideshow/source/engine/slide/shapemanagerimpl.hxx b/slideshow/source/engine/slide/shapemanagerimpl.hxx index 1e0fd8912312..3fd8fb7035c1 100644 --- a/slideshow/source/engine/slide/shapemanagerimpl.hxx +++ b/slideshow/source/engine/slide/shapemanagerimpl.hxx @@ -157,7 +157,7 @@ private: typedef std::map<ShapeSharedPtr, - boost::shared_ptr< ::cppu::OInterfaceContainerHelper >, + boost::shared_ptr< ::comphelper::OInterfaceContainerHelper2 >, Shape::lessThanShape> ShapeToListenersMap; typedef std::map<ShapeSharedPtr, sal_Int16, Shape::lessThanShape> ShapeToCursorMap; diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 008f5faacbd6..bdf15c87f31c 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -422,7 +422,7 @@ private: UnoViewContainer maViewContainer; /// all registered slide show listeners - cppu::OInterfaceContainerHelper maListenerContainer; + comphelper::OInterfaceContainerHelper2 maListenerContainer; /// map of vectors, containing all registered listeners for a shape ShapeEventListenerMap maShapeEventListeners; @@ -1855,8 +1855,8 @@ void SlideShowImpl::addShapeEventListener( aIter = maShapeEventListeners.insert( ShapeEventListenerMap::value_type( xShape, - boost::shared_ptr<cppu::OInterfaceContainerHelper>( - new cppu::OInterfaceContainerHelper(m_aMutex)))).first; + boost::shared_ptr<comphelper::OInterfaceContainerHelper2>( + new comphelper::OInterfaceContainerHelper2(m_aMutex)))).first; } // add new listener to broadcaster diff --git a/slideshow/source/inc/shapemaps.hxx b/slideshow/source/inc/shapemaps.hxx index 82607d5df675..87fce1eefd2d 100644 --- a/slideshow/source/inc/shapemaps.hxx +++ b/slideshow/source/inc/shapemaps.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_SHAPEMAPS_HXX #define INCLUDED_SLIDESHOW_SOURCE_INC_SHAPEMAPS_HXX -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/uno/Reference.hxx> #include <boost/shared_ptr.hpp> @@ -39,7 +39,7 @@ namespace slideshow { /// Maps XShape to shape listener typedef ::std::map< css::uno::Reference< css::drawing::XShape>, - boost::shared_ptr< ::cppu::OInterfaceContainerHelper > + boost::shared_ptr< ::comphelper::OInterfaceContainerHelper2 > > ShapeEventListenerMap; /// Maps XShape to mouse cursor diff --git a/slideshow/test/demoshow.cxx b/slideshow/test/demoshow.cxx index 9ca1a87d4c11..9b4dc810beb7 100644 --- a/slideshow/test/demoshow.cxx +++ b/slideshow/test/demoshow.cxx @@ -192,10 +192,10 @@ private: } uno::Reference< rendering::XSpriteCanvas > mxCanvas; - ::cppu::OInterfaceContainerHelper maPaintListeners; - ::cppu::OInterfaceContainerHelper maTransformationListeners; - ::cppu::OInterfaceContainerHelper maMouseListeners; - ::cppu::OInterfaceContainerHelper maMouseMotionListeners; + ::comphelper::OInterfaceContainerHelper2 maPaintListeners; + ::comphelper::OInterfaceContainerHelper2 maTransformationListeners; + ::comphelper::OInterfaceContainerHelper2 maMouseListeners; + ::comphelper::OInterfaceContainerHelper2 maMouseMotionListeners; basegfx::B2DHomMatrix maTransform; Size maSize; }; diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx index 599e0f95e513..bfaa072bba00 100644 --- a/sot/source/unoolestorage/xolesimplestorage.cxx +++ b/sot/source/unoolestorage/xolesimplestorage.cxx @@ -611,7 +611,7 @@ void SAL_CALL OLESimpleStorage::addEventListener( throw lang::DisposedException(); if ( !m_pListenersContainer ) - m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); + m_pListenersContainer = new ::comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pListenersContainer->addInterface( xListener ); } diff --git a/sot/source/unoolestorage/xolesimplestorage.hxx b/sot/source/unoolestorage/xolesimplestorage.hxx index bac3a4bce248..fb0042b04bd4 100644 --- a/sot/source/unoolestorage/xolesimplestorage.hxx +++ b/sot/source/unoolestorage/xolesimplestorage.hxx @@ -31,7 +31,8 @@ #include <com/sun/star/embed/XClassifiedObject.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> + #include <osl/mutex.hxx> #include <sot/stg.hxx> @@ -46,7 +47,7 @@ class OLESimpleStorage : public cppu::WeakImplHelper<css::embed::XOLESimpleStora SvStream* m_pStream; BaseStorage* m_pStorage; - ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners + ::comphelper::OInterfaceContainerHelper2* m_pListenersContainer; // list of listeners css::uno::Reference<css::uno::XComponentContext> m_xContext; bool m_bNoTemporaryCopy; diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx index 01cb71453c5c..2ee5a8b3b939 100644 --- a/svl/source/fsstor/fsstorage.cxx +++ b/svl/source/fsstor/fsstorage.cxx @@ -68,7 +68,7 @@ struct FSStorage_Impl ::ucbhelper::Content* m_pContent; sal_Int32 m_nMode; - ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners + ::comphelper::OInterfaceContainerHelper2* m_pListenersContainer; // list of listeners ::cppu::OTypeCollection* m_pTypeCollection; uno::Reference< uno::XComponentContext > m_xContext; @@ -1166,7 +1166,7 @@ void SAL_CALL FSStorage::addEventListener( throw lang::DisposedException(); if ( !m_pImpl->m_pListenersContainer ) - m_pImpl->m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); + m_pImpl->m_pListenersContainer = new ::comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pImpl->m_pListenersContainer->addInterface( xListener ); } diff --git a/svl/source/fsstor/oinputstreamcontainer.cxx b/svl/source/fsstor/oinputstreamcontainer.cxx index ec086fe2a4dc..3f2da4d68503 100644 --- a/svl/source/fsstor/oinputstreamcontainer.cxx +++ b/svl/source/fsstor/oinputstreamcontainer.cxx @@ -298,7 +298,7 @@ void SAL_CALL OFSInputStreamContainer::addEventListener( const uno::Reference< l throw lang::DisposedException(); if ( !m_pListenersContainer ) - m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); + m_pListenersContainer = new ::comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pListenersContainer->addInterface( xListener ); } diff --git a/svl/source/fsstor/oinputstreamcontainer.hxx b/svl/source/fsstor/oinputstreamcontainer.hxx index 007f23e962e1..cb53f2a67300 100644 --- a/svl/source/fsstor/oinputstreamcontainer.hxx +++ b/svl/source/fsstor/oinputstreamcontainer.hxx @@ -26,7 +26,7 @@ #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <osl/mutex.hxx> @@ -43,7 +43,7 @@ class OFSInputStreamContainer : public cppu::WeakImplHelper < css::io::XInputStr bool m_bDisposed; - ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners + ::comphelper::OInterfaceContainerHelper2* m_pListenersContainer; // list of listeners public: explicit OFSInputStreamContainer( const css::uno::Reference < css::io::XInputStream >& xStream ); diff --git a/svl/source/fsstor/ostreamcontainer.cxx b/svl/source/fsstor/ostreamcontainer.cxx index f5e92ec07723..4cad56aad361 100644 --- a/svl/source/fsstor/ostreamcontainer.cxx +++ b/svl/source/fsstor/ostreamcontainer.cxx @@ -266,7 +266,7 @@ void SAL_CALL OFSStreamContainer::addEventListener( const uno::Reference< lang:: throw lang::DisposedException(); if ( !m_pListenersContainer ) - m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); + m_pListenersContainer = new ::comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pListenersContainer->addInterface( xListener ); } diff --git a/svl/source/fsstor/ostreamcontainer.hxx b/svl/source/fsstor/ostreamcontainer.hxx index e4a441c9866d..6fc7f634c9b0 100644 --- a/svl/source/fsstor/ostreamcontainer.hxx +++ b/svl/source/fsstor/ostreamcontainer.hxx @@ -31,7 +31,7 @@ #include <com/sun/star/io/XAsyncOutputMonitor.hpp> #include <cppuhelper/weak.hxx> #include <cppuhelper/typeprovider.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <osl/mutex.hxx> class OFSStreamContainer : public cppu::OWeakObject, @@ -56,7 +56,7 @@ class OFSStreamContainer : public cppu::OWeakObject, bool m_bInputClosed; bool m_bOutputClosed; - ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners + ::comphelper::OInterfaceContainerHelper2* m_pListenersContainer; // list of listeners ::cppu::OTypeCollection* m_pTypeCollection; public: diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx index fd7de2b4ba8d..7a93209f2ac8 100644 --- a/svtools/source/hatchwindow/documentcloser.cxx +++ b/svtools/source/hatchwindow/documentcloser.cxx @@ -28,7 +28,7 @@ #include <com/sun/star/awt/XVclWindowPeer.hpp> #include <comphelper/processfactory.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <osl/mutex.hxx> #include <osl/thread.hxx> @@ -49,7 +49,7 @@ class ODocumentCloser : public ::cppu::WeakImplHelper< css::lang::XComponent, { ::osl::Mutex m_aMutex; css::uno::Reference< css::frame::XFrame > m_xFrame; - ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners + ::comphelper::OInterfaceContainerHelper2* m_pListenersContainer; // list of listeners bool m_bDisposed; @@ -208,7 +208,7 @@ void SAL_CALL ODocumentCloser::addEventListener( const uno::Reference< lang::XEv throw lang::DisposedException(); // TODO if ( !m_pListenersContainer ) - m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); + m_pListenersContainer = new ::comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pListenersContainer->addInterface( xListener ); } diff --git a/svx/source/accessibility/AccessibleFrameSelector.cxx b/svx/source/accessibility/AccessibleFrameSelector.cxx index 3a85aa885a4d..6faa1b547396 100644 --- a/svx/source/accessibility/AccessibleFrameSelector.cxx +++ b/svx/source/accessibility/AccessibleFrameSelector.cxx @@ -475,7 +475,7 @@ void AccFrameSelector::NotifyFocusListeners(bool bGetFocus) Reference < XAccessibleContext > xThis( this ); aEvent.Source = xThis; - ::cppu::OInterfaceIteratorHelper aIter( maFocusListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( maFocusListeners ); while( aIter.hasMoreElements() ) { Reference < XFocusListener > xListener( aIter.next(), UNO_QUERY ); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index c2d34589075b..6e589fe441f6 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -124,7 +124,7 @@ vcl::Font ImplCreateFont( const css::awt::FontDescriptor& rDescr ) FmXModifyMultiplexer::FmXModifyMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex ) :OWeakSubObject( rSource ) - ,OInterfaceContainerHelper( _rMutex ) + ,OInterfaceContainerHelper2( _rMutex ) { } @@ -158,7 +158,7 @@ void FmXModifyMultiplexer::modified(const EventObject& e) throw( RuntimeExceptio FmXUpdateMultiplexer::FmXUpdateMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex ) :OWeakSubObject( rSource ) - ,OInterfaceContainerHelper( _rMutex ) + ,OInterfaceContainerHelper2( _rMutex ) { } @@ -191,7 +191,7 @@ sal_Bool FmXUpdateMultiplexer::approveUpdate(const EventObject &e) throw( Runtim bool bResult = true; if (getLength()) { - ::cppu::OInterfaceIteratorHelper aIter(*this); + ::comphelper::OInterfaceIteratorHelper2 aIter(*this); while ( bResult && aIter.hasMoreElements() ) bResult = static_cast< XUpdateListener* >( aIter.next() )->approveUpdate( aMulti ); } @@ -209,7 +209,7 @@ void FmXUpdateMultiplexer::updated(const EventObject &e) throw( RuntimeException FmXSelectionMultiplexer::FmXSelectionMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex ) :OWeakSubObject( rSource ) - ,OInterfaceContainerHelper( _rMutex ) + ,OInterfaceContainerHelper2( _rMutex ) { } @@ -243,7 +243,7 @@ void SAL_CALL FmXSelectionMultiplexer::selectionChanged( const EventObject& _rEv FmXContainerMultiplexer::FmXContainerMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex ) :OWeakSubObject( rSource ) - ,OInterfaceContainerHelper( _rMutex ) + ,OInterfaceContainerHelper2( _rMutex ) { } @@ -293,7 +293,7 @@ void FmXContainerMultiplexer::elementReplaced(const ContainerEvent& e) throw( Ru FmXGridControlMultiplexer::FmXGridControlMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex ) :OWeakSubObject( rSource ) - ,OInterfaceContainerHelper( _rMutex ) + ,OInterfaceContainerHelper2( _rMutex ) { } @@ -1499,7 +1499,7 @@ sal_Bool FmXGridPeer::commit() throw( RuntimeException, std::exception ) return sal_True; EventObject aEvt(static_cast< ::cppu::OWeakObject* >(this)); - ::cppu::OInterfaceIteratorHelper aIter(m_aUpdateListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aUpdateListeners); bool bCancel = false; while (aIter.hasMoreElements() && !bCancel) if ( !static_cast< XUpdateListener* >( aIter.next() )->approveUpdate( aEvt ) ) diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index ac2b744ad6e1..45ebd249bbd0 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -4326,7 +4326,7 @@ IMPL_LINK_NOARG_TYPED(FmXListBoxCell, OnDoubleClick, ListBox&, void) { if (m_pBox) { - ::cppu::OInterfaceIteratorHelper aIt( m_aActionListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIt( m_aActionListeners ); css::awt::ActionEvent aEvent; aEvent.Source = *this; @@ -4686,7 +4686,7 @@ void SAL_CALL FmXFilterCell::setMaxTextLen( sal_Int16 /*nLen*/ ) throw( RuntimeE IMPL_LINK_NOARG_TYPED(FmXFilterCell, OnCommit, DbFilterField&, void) { - ::cppu::OInterfaceIteratorHelper aIt( m_aTextListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIt( m_aTextListeners ); css::awt::TextEvent aEvt; aEvt.Source = *this; while( aIt.hasMoreElements() ) diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index 3b3fe6edbde3..5d8895abaef4 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -3660,7 +3660,7 @@ sal_Bool SAL_CALL FormController::approveRowChange(const RowChangeEvent& _rEvent ::osl::ClearableMutexGuard aGuard( m_aMutex ); impl_checkDisposed_throw(); - ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aRowSetApproveListeners); bool bValid = true; if (aIter.hasMoreElements()) { @@ -3748,7 +3748,7 @@ sal_Bool SAL_CALL FormController::approveCursorMove(const EventObject& event) th ::osl::MutexGuard aGuard( m_aMutex ); impl_checkDisposed_throw(); - ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aRowSetApproveListeners); if (aIter.hasMoreElements()) { EventObject aEvt(event); @@ -3765,7 +3765,7 @@ sal_Bool SAL_CALL FormController::approveRowSetChange(const EventObject& event) ::osl::MutexGuard aGuard( m_aMutex ); impl_checkDisposed_throw(); - ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aRowSetApproveListeners); if (aIter.hasMoreElements()) { EventObject aEvt(event); @@ -3802,7 +3802,7 @@ void SAL_CALL FormController::errorOccured(const SQLErrorEvent& aEvent) throw( R ::osl::ClearableMutexGuard aGuard( m_aMutex ); impl_checkDisposed_throw(); - ::cppu::OInterfaceIteratorHelper aIter(m_aErrorListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aErrorListeners); if (aIter.hasMoreElements()) { SQLErrorEvent aEvt(aEvent); @@ -3875,7 +3875,7 @@ sal_Bool SAL_CALL FormController::approveParameter(const DatabaseParameterEvent& ::osl::MutexGuard aGuard( m_aMutex ); impl_checkDisposed_throw(); - ::cppu::OInterfaceIteratorHelper aIter(m_aParameterListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aParameterListeners); if (aIter.hasMoreElements()) { DatabaseParameterEvent aEvt(aEvent); @@ -3971,7 +3971,7 @@ sal_Bool SAL_CALL FormController::confirmDelete(const RowChangeEvent& aEvent) th ::osl::MutexGuard aGuard( m_aMutex ); impl_checkDisposed_throw(); - ::cppu::OInterfaceIteratorHelper aIter(m_aDeleteListeners); + ::comphelper::OInterfaceIteratorHelper2 aIter(m_aDeleteListeners); if (aIter.hasMoreElements()) { RowChangeEvent aEvt(aEvent); diff --git a/svx/source/form/formfeaturedispatcher.cxx b/svx/source/form/formfeaturedispatcher.cxx index 3f213db05755..f9016c7d3a8d 100644 --- a/svx/source/form/formfeaturedispatcher.cxx +++ b/svx/source/form/formfeaturedispatcher.cxx @@ -97,7 +97,7 @@ namespace svx } else { - ::cppu::OInterfaceIteratorHelper aIter( m_aStatusListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( m_aStatusListeners ); _rFreeForNotification.clear(); while ( aIter.hasMoreElements() ) diff --git a/svx/source/inc/AccessibleFrameSelector.hxx b/svx/source/inc/AccessibleFrameSelector.hxx index aff5046e2510..49439a74f800 100644 --- a/svx/source/inc/AccessibleFrameSelector.hxx +++ b/svx/source/inc/AccessibleFrameSelector.hxx @@ -31,7 +31,7 @@ #include <tools/resary.hxx> #include <tools/rc.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/accessibleeventnotifier.hxx> #include <svx/framebordertype.hxx> #include <vcl/vclptr.hxx> @@ -116,8 +116,8 @@ private: FrameBorderType meBorder; - ::cppu::OInterfaceContainerHelper maFocusListeners; - ::cppu::OInterfaceContainerHelper maPropertyListeners; + ::comphelper::OInterfaceContainerHelper2 maFocusListeners; + ::comphelper::OInterfaceContainerHelper2 maPropertyListeners; ResStringArray maNames; ResStringArray maDescriptions; diff --git a/svx/source/inc/formcontroller.hxx b/svx/source/inc/formcontroller.hxx index 410a6d858cdc..1e862e9ec2ae 100644 --- a/svx/source/inc/formcontroller.hxx +++ b/svx/source/inc/formcontroller.hxx @@ -74,6 +74,7 @@ #include <comphelper/broadcasthelper.hxx> #include <comphelper/proparrhlp.hxx> #include <cppuhelper/propshlp.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <vcl/timer.hxx> #include <vcl/idle.hxx> @@ -148,7 +149,7 @@ namespace svxform css::uno::Reference< css::form::runtime::XFormControllerContext > m_xFormControllerContext; css::uno::Sequence< css::uno::Reference< css::awt::XControl> > m_aControls; - ::cppu::OInterfaceContainerHelper + ::comphelper::OInterfaceContainerHelper2 m_aActivateListeners, m_aModifyListeners, m_aErrorListeners, diff --git a/svx/source/inc/formfeaturedispatcher.hxx b/svx/source/inc/formfeaturedispatcher.hxx index b6885b934583..58e1e77eb308 100644 --- a/svx/source/inc/formfeaturedispatcher.hxx +++ b/svx/source/inc/formfeaturedispatcher.hxx @@ -25,7 +25,7 @@ #include <com/sun/star/form/runtime/XFormOperations.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> namespace svx @@ -38,7 +38,7 @@ namespace svx { private: ::osl::Mutex& m_rMutex; - ::cppu::OInterfaceContainerHelper m_aStatusListeners; + ::comphelper::OInterfaceContainerHelper2 m_aStatusListeners; css::uno::Reference< css::form::runtime::XFormOperations > m_xFormOperations; const css::util::URL m_aFeatureURL; diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx index 04082d3ca5e6..9394d47a12d8 100644 --- a/svx/source/inc/gridcell.hxx +++ b/svx/source/inc/gridcell.hxx @@ -40,6 +40,7 @@ #include <com/sun/star/awt/XWindow.hpp> #include <comphelper/propmultiplex.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/component.hxx> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase2.hxx> @@ -717,11 +718,11 @@ protected: DbCellControl* m_pCellControl; private: - ::cppu::OInterfaceContainerHelper m_aWindowListeners; - ::cppu::OInterfaceContainerHelper m_aFocusListeners; - ::cppu::OInterfaceContainerHelper m_aKeyListeners; - ::cppu::OInterfaceContainerHelper m_aMouseListeners; - ::cppu::OInterfaceContainerHelper m_aMouseMotionListeners; + ::comphelper::OInterfaceContainerHelper2 m_aWindowListeners; + ::comphelper::OInterfaceContainerHelper2 m_aFocusListeners; + ::comphelper::OInterfaceContainerHelper2 m_aKeyListeners; + ::comphelper::OInterfaceContainerHelper2 m_aMouseListeners; + ::comphelper::OInterfaceContainerHelper2 m_aMouseMotionListeners; protected: virtual ~FmXGridCell(); @@ -870,8 +871,8 @@ private: OUString m_sValueOnEnter; protected: - ::cppu::OInterfaceContainerHelper m_aTextListeners; - ::cppu::OInterfaceContainerHelper m_aChangeListeners; + ::comphelper::OInterfaceContainerHelper2 m_aTextListeners; + ::comphelper::OInterfaceContainerHelper2 m_aChangeListeners; ::svt::IEditImplementation* m_pEditImplementation; bool m_bOwnEditImplementation; @@ -924,8 +925,8 @@ typedef ::cppu::ImplHelper2 < css::awt::XCheckBox class FmXCheckBoxCell : public FmXDataCell, public FmXCheckBoxCell_Base { - ::cppu::OInterfaceContainerHelper m_aItemListeners; - ::cppu::OInterfaceContainerHelper m_aActionListeners; + ::comphelper::OInterfaceContainerHelper2 m_aItemListeners; + ::comphelper::OInterfaceContainerHelper2 m_aActionListeners; OUString m_aActionCommand; VclPtr<CheckBox> m_pBox; @@ -969,7 +970,7 @@ typedef ::cppu::ImplHelper1 < css::awt::XListBox class FmXListBoxCell :public FmXTextCell ,public FmXListBoxCell_Base { - ::cppu::OInterfaceContainerHelper m_aItemListeners, + ::comphelper::OInterfaceContainerHelper2 m_aItemListeners, m_aActionListeners; VclPtr<ListBox> m_pBox; @@ -1024,7 +1025,7 @@ class FmXComboBoxCell :public FmXTextCell ,public FmXComboBoxCell_Base { private: - ::cppu::OInterfaceContainerHelper m_aItemListeners, + ::comphelper::OInterfaceContainerHelper2 m_aItemListeners, m_aActionListeners; VclPtr<ComboBox> m_pComboBox; @@ -1067,7 +1068,7 @@ typedef ::cppu::ImplHelper2 < css::awt::XTextComponent class FmXFilterCell :public FmXGridCell ,public FmXFilterCell_Base { - ::cppu::OInterfaceContainerHelper m_aTextListeners; + ::comphelper::OInterfaceContainerHelper2 m_aTextListeners; protected: virtual ~FmXFilterCell(); public: diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx index 9f64e1a655fd..a55b0e52b545 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx @@ -29,6 +29,7 @@ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/implbase.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <vcl/vclptr.hxx> @@ -119,7 +120,7 @@ private: bool m_bDisposed; ///Dispose call ready. bool m_bInDispose;///In dispose call osl::Mutex m_aContainerMutex; - cppu::OInterfaceContainerHelper m_aDisposeEventListeners; + comphelper::OInterfaceContainerHelper2 m_aDisposeEventListeners; }; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 7653b263f4c9..3bbdff48a8e8 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -123,7 +123,7 @@ struct SvxShapeImpl ::tools::WeakReference< SdrObject > mpCreatedObj; // for xComponent - ::cppu::OInterfaceContainerHelper maDisposeListeners; + ::comphelper::OInterfaceContainerHelper2 maDisposeListeners; svx::PropertyChangeNotifier maPropertyNotifier; SvxShapeImpl( SvxShape& _rAntiImpl, ::osl::Mutex& _rMutex ) diff --git a/svx/source/unodraw/unoshcol.cxx b/svx/source/unodraw/unoshcol.cxx index e28b50288056..5057ba801c9e 100644 --- a/svx/source/unodraw/unoshcol.cxx +++ b/svx/source/unodraw/unoshcol.cxx @@ -25,6 +25,7 @@ #include <cppuhelper/implbase3.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <osl/mutex.hxx> #include <rtl/ref.hxx> @@ -46,7 +47,7 @@ class SvxShapeCollection : public SvxShapeCollectionMutex { private: - cppu::OInterfaceContainerHelper maShapeContainer; + comphelper::OInterfaceContainerHelper2 maShapeContainer; cppu::OBroadcastHelper mrBHelper; @@ -229,10 +230,10 @@ uno::Any SAL_CALL SvxShapeCollection::getByIndex( sal_Int32 Index ) if( Index < 0 || Index >= getCount() ) throw lang::IndexOutOfBoundsException(); - uno::Sequence< Reference< uno::XInterface> > xElements( maShapeContainer.getElements() ); + std::vector< Reference< uno::XInterface> > xElements( maShapeContainer.getElements() ); - return uno::makeAny( Reference< drawing::XShape>(static_cast< drawing::XShape* >( xElements.getArray()[Index].get())) ); + return uno::makeAny( Reference< drawing::XShape>(static_cast< drawing::XShape* >( xElements[Index].get())) ); } // XElementAccess diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx index 935db3d705e1..1ed58e83fa8c 100644 --- a/sw/inc/unochart.hxx +++ b/sw/inc/unochart.hxx @@ -42,7 +42,7 @@ #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/table/XCell.hpp> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/weakref.hxx> @@ -135,9 +135,9 @@ class SwChartDataProvider : // all tables of the document. mutable Map_Set_DataSequenceRef_t aDataSequences; - ::cppu::OInterfaceContainerHelper aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; const SwDoc * pDoc; - bool bDisposed; + bool bDisposed; SwChartDataProvider( const SwChartDataProvider & ) = delete; SwChartDataProvider & operator = ( const SwChartDataProvider & ) = delete; @@ -251,8 +251,8 @@ class SwChartDataSequence : public SwChartDataSequenceBaseClass, public SwClient { - ::cppu::OInterfaceContainerHelper m_aEvtListeners; - ::cppu::OInterfaceContainerHelper m_aModifyListeners; + ::comphelper::OInterfaceContainerHelper2 m_aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; css::chart2::data::DataSequenceRole m_aRole; OUString m_aRowLabelText; @@ -362,8 +362,8 @@ SwChartLabeledDataSequenceBaseClass; class SwChartLabeledDataSequence : public SwChartLabeledDataSequenceBaseClass { - ::cppu::OInterfaceContainerHelper aEvtListeners; - ::cppu::OInterfaceContainerHelper aModifyListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aModifyListeners; css::uno::Reference< css::chart2::data::XDataSequence > xData; css::uno::Reference< css::chart2::data::XDataSequence > xLabels; diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx index e978aaa509b9..f79598e39934 100644 --- a/sw/inc/unotbl.hxx +++ b/sw/inc/unotbl.hxx @@ -33,7 +33,7 @@ #include <com/sun/star/table/XAutoFormattable.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/uno3.hxx> @@ -451,7 +451,7 @@ class SwXCellRange : public cppu::WeakImplHelper public SwClient { ::osl::Mutex m_Mutex; - ::cppu::OInterfaceContainerHelper m_ChartListeners; + ::comphelper::OInterfaceContainerHelper2 m_ChartListeners; SwRangeDescriptor aRgDesc; const SfxItemPropertySet* m_pPropSet; diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 817bdfd2ebc9..1ddc0af5a2fa 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -60,6 +60,7 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <cppuhelper/implbase.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <pagepreviewlayout.hxx> #include <dcontact.hxx> #include <svx/unoapi.hxx> @@ -120,7 +121,7 @@ class SwDrawModellListener_Impl : public SfxListener, public ::cppu::WeakImplHelper< document::XEventBroadcaster > { mutable ::osl::Mutex maListenerMutex; - ::cppu::OInterfaceContainerHelper maEventListeners; + ::comphelper::OInterfaceContainerHelper2 maEventListeners; SdrModel *mpDrawModel; protected: virtual ~SwDrawModellListener_Impl(); @@ -180,7 +181,7 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/, if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) ) return; - ::cppu::OInterfaceIteratorHelper aIter( maEventListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( maEventListeners ); while( aIter.hasMoreElements() ) { uno::Reference < document::XEventListener > xListener( aIter.next(), diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index e254fff477d8..0093fcdfa77b 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -19,7 +19,7 @@ #include <unobookmark.hxx> #include <osl/mutex.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> @@ -45,11 +45,11 @@ class SwXBookmark::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; SwDoc * m_pDoc; ::sw::mark::IMark * m_pRegisteredBookmark; OUString m_sMarkName; diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 5a251dd334d1..4bce779bc2f7 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -172,11 +172,11 @@ static osl::Mutex & GetChartMutex() } static void LaunchModifiedEvent( - ::cppu::OInterfaceContainerHelper &rICH, + ::comphelper::OInterfaceContainerHelper2 &rICH, const uno::Reference< uno::XInterface > &rxI ) { lang::EventObject aEvtObj( rxI ); - cppu::OInterfaceIteratorHelper aIt( rICH ); + comphelper::OInterfaceIteratorHelper2 aIt( rICH ); while (aIt.hasMoreElements()) { uno::Reference< util::XModifyListener > xRef( aIt.next(), uno::UNO_QUERY ); diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 289bce53e33f..e28803dd3be8 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -412,11 +412,11 @@ class SwXFieldMaster::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; SwDoc* m_pDoc; @@ -1127,11 +1127,11 @@ class SwXTextField::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; SwFormatField const* m_pFormatField; SwDoc * m_pDoc; @@ -2858,10 +2858,10 @@ sal_Bool SwXTextFieldMasters::hasElements() throw( uno::RuntimeException, std::e class SwXTextFieldTypes::Impl { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: - ::cppu::OInterfaceContainerHelper m_RefreshListeners; + ::comphelper::OInterfaceContainerHelper2 m_RefreshListeners; Impl() : m_RefreshListeners(m_Mutex) { } }; diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 36d69e20a3f6..b56143f683d4 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1142,11 +1142,11 @@ bool SwOLEProperties_Impl::AnyToItemSet( class SwXFrame::Impl { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; Impl() : m_EventListeners(m_Mutex) { } }; diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx index f805fc50f58f..101732863770 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -22,7 +22,7 @@ #include <utility> #include <osl/mutex.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> #include <comphelper/sequence.hxx> @@ -49,15 +49,15 @@ class SwXFootnote::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: SwXFootnote & m_rThis; uno::WeakReference<uno::XInterface> m_wThis; const bool m_bIsEndnote; - ::cppu::OInterfaceContainerHelper m_EventListeners; - bool m_bIsDescriptor; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; + bool m_bIsDescriptor; const SwFormatFootnote * m_pFormatFootnote; OUString m_sLabel; diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 8de8f1f35aa2..1d67b51125a2 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -30,6 +30,7 @@ #include <osl/mutex.hxx> #include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> #include <editeng/unolingu.hxx> @@ -318,7 +319,7 @@ class SwXDocumentIndex::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; @@ -1536,7 +1537,7 @@ class SwXDocumentIndexMark::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 SwXDocumentIndexMark & m_rThis; bool m_bInReplaceMark; @@ -1545,7 +1546,7 @@ public: uno::WeakReference<uno::XInterface> m_wThis; SfxItemPropertySet const& m_rPropSet; const TOXTypes m_eTOXType; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; bool m_bIsDescriptor; SwDepend m_TypeDepend; const SwTOXMark * m_pTOXMark; diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index f8d31c57cbb7..f2d976955da0 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -19,7 +19,7 @@ #include <unoparagraph.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <cmdid.h> @@ -105,12 +105,12 @@ class SwXParagraph::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: SwXParagraph & m_rThis; uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; SfxItemPropertySet const& m_rPropSet; bool m_bIsDescriptor; sal_Int32 m_nSelectionStartPos; diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx index 39650a219497..f90c4afb493a 100644 --- a/sw/source/core/unocore/unorefmk.cxx +++ b/sw/source/core/unocore/unorefmk.cxx @@ -22,7 +22,7 @@ #include <utility> #include <osl/mutex.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> @@ -46,11 +46,11 @@ class SwXReferenceMark::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; bool m_bIsDescriptor; SwDoc * m_pDoc; const SwFormatRefMark * m_pMarkFormat; @@ -637,11 +637,11 @@ class SwXMeta::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; ::std::unique_ptr<const TextRangeList_t> m_pTextPortions; // 3 possible states: not attached, attached, disposed bool m_bIsDisposed; diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 8c235fa89dcd..9f8333f1c7bd 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/text/SectionFileLink.hpp> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <cmdid.h> @@ -102,13 +102,13 @@ class SwXTextSection::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: SwXTextSection & m_rThis; uno::WeakReference<uno::XInterface> m_wThis; const SfxItemPropertySet & m_rPropSet; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; const bool m_bIndexHeader; bool m_bIsDescriptor; OUString m_sName; diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index bd6ced180468..e20b35bf9232 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -152,6 +152,23 @@ static void lcl_SendChartEvent(::cppu::OWeakObject & rSource, } static void lcl_SendChartEvent(::cppu::OWeakObject & rSource, + ::comphelper::OInterfaceContainerHelper2 & rListeners) +{ + if (!rListeners.getLength()) + return; + //TODO: find appropriate settings of the Event + chart::ChartDataChangeEvent event; + event.Source = & rSource; + event.Type = chart::ChartDataChangeType_ALL; + event.StartColumn = 0; + event.EndColumn = 1; + event.StartRow = 0; + event.EndRow = 1; + rListeners.notifyEach( + & chart::XChartDataChangeEventListener::chartDataChanged, event); +} + +static void lcl_SendChartEvent(::cppu::OWeakObject & rSource, ::cppu::OMultiTypeInterfaceContainerHelper & rListeners) { ::cppu::OInterfaceContainerHelper *const pContainer(rListeners.getContainer( @@ -1772,7 +1789,7 @@ void SwXTextTableCursor::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNe class SwXTextTable::Impl { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; diff --git a/sw/source/uibase/inc/unomailmerge.hxx b/sw/source/uibase/inc/unomailmerge.hxx index 59bceace1160..94e4c1f86cab 100644 --- a/sw/source/uibase/inc/unomailmerge.hxx +++ b/sw/source/uibase/inc/unomailmerge.hxx @@ -22,6 +22,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <unotools/configitem.hxx> #include <com/sun/star/task/XJob.hpp> @@ -75,9 +76,9 @@ class SwXMailMerge : { friend class MailMergeExecuteFinalizer; - cppu::OInterfaceContainerHelper m_aEvtListeners; - cppu::OInterfaceContainerHelper m_aMergeListeners; - OPropertyListenerContainerHelper m_aPropListeners; + comphelper::OInterfaceContainerHelper2 m_aEvtListeners; + comphelper::OInterfaceContainerHelper2 m_aMergeListeners; + OPropertyListenerContainerHelper m_aPropListeners; const SfxItemPropertySet* m_pPropSet; diff --git a/sw/source/uibase/inc/unotxvw.hxx b/sw/source/uibase/inc/unotxvw.hxx index d95c8e635b57..629d2fcdb254 100644 --- a/sw/source/uibase/inc/unotxvw.hxx +++ b/sw/source/uibase/inc/unotxvw.hxx @@ -18,8 +18,9 @@ */ #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_UNOTXVW_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_UNOTXVW_HXX + #include <sfx2/sfxbasecontroller.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/text/XTextViewCursor.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> @@ -58,7 +59,7 @@ class SwXTextView : public css::datatransfer::XTransferableSupplier, public SfxBaseController { - ::cppu::OInterfaceContainerHelper m_SelChangedListeners; + ::comphelper::OInterfaceContainerHelper2 m_SelChangedListeners; SwView* m_pView; const SfxItemPropertySet* m_pPropSet; // property map for SwXTextView properties diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index f8ff1a5370bf..8bb6332f686c 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -843,7 +843,7 @@ void SAL_CALL SwXMailMerge::cancel() throw (css::uno::RuntimeException, std::exc void SwXMailMerge::LaunchMailMergeEvent( const MailMergeEvent &rEvt ) const { - cppu::OInterfaceIteratorHelper aIt( const_cast<SwXMailMerge *>(this)->m_aMergeListeners ); + comphelper::OInterfaceIteratorHelper2 aIt( const_cast<SwXMailMerge *>(this)->m_aMergeListeners ); while (aIt.hasMoreElements()) { Reference< XMailMergeListener > xRef( aIt.next(), UNO_QUERY ); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 4a386fc8678f..2ebaf0efeacb 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -249,10 +249,10 @@ static void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell* pDocShell ) class SwXTextDocument::Impl { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: - ::cppu::OInterfaceContainerHelper m_RefreshListeners; + ::comphelper::OInterfaceContainerHelper2 m_RefreshListeners; Impl() : m_RefreshListeners(m_Mutex) { } diff --git a/toolkit/source/awt/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx index 1fcd4452ad2b..78bac8dd25bd 100644 --- a/toolkit/source/awt/stylesettings.cxx +++ b/toolkit/source/awt/stylesettings.cxx @@ -57,7 +57,7 @@ namespace toolkit struct WindowStyleSettings_Data { VCLXWindow* pOwningWindow; - ::cppu::OInterfaceContainerHelper aStyleChangeListeners; + ::comphelper::OInterfaceContainerHelper2 aStyleChangeListeners; WindowStyleSettings_Data( ::osl::Mutex& i_rListenerMutex, VCLXWindow& i_rOwningWindow ) : pOwningWindow( &i_rOwningWindow ) diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 13e79821e925..6929c5849045 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -157,9 +157,9 @@ class VCLXToolkit : public VCLXToolkitMutexHelper, oslModule hSvToolsLib; FN_SvtCreateWindow fnSvtCreateWindow; - ::cppu::OInterfaceContainerHelper m_aTopWindowListeners; - ::cppu::OInterfaceContainerHelper m_aKeyHandlers; - ::cppu::OInterfaceContainerHelper m_aFocusListeners; + ::comphelper::OInterfaceContainerHelper2 m_aTopWindowListeners; + ::comphelper::OInterfaceContainerHelper2 m_aKeyHandlers; + ::comphelper::OInterfaceContainerHelper2 m_aFocusListeners; ::Link<VclSimpleEvent&,void> m_aEventListenerLink; ::Link<VclWindowEvent&,bool> m_aKeyListenerLink; bool m_bEventListener; @@ -1774,13 +1774,13 @@ void VCLXToolkit::callTopWindowListeners( = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow(); if (pWindow->IsTopWindow()) { - css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > + std::vector< css::uno::Reference< css::uno::XInterface > > aListeners(m_aTopWindowListeners.getElements()); - if (aListeners.hasElements()) + if (!aListeners.empty()) { css::lang::EventObject aAwtEvent( static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer())); - for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i) + for (::sal_Int32 i = 0; i < (sal_Int32)aListeners.size(); ++i) { css::uno::Reference< css::awt::XTopWindowListener > xListener(aListeners[i], css::uno::UNO_QUERY); @@ -1803,10 +1803,10 @@ void VCLXToolkit::callTopWindowListeners( bool VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent, bool bPressed) { - css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > + std::vector< css::uno::Reference< css::uno::XInterface > > aHandlers(m_aKeyHandlers.getElements()); - if (aHandlers.hasElements()) + if (!aHandlers.empty()) { vcl::Window * pWindow = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow(); @@ -1826,7 +1826,7 @@ bool VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent, pKeyEvent->GetKeyCode().GetCode(), pKeyEvent->GetCharCode(), sal::static_int_cast< sal_Int16 >( pKeyEvent->GetKeyCode().GetFunction())); - for (::sal_Int32 i = 0; i < aHandlers.getLength(); ++i) + for (::sal_Int32 i = 0; i < (sal_Int32)aHandlers.size(); ++i) { css::uno::Reference< css::awt::XKeyHandler > xHandler( aHandlers[i], css::uno::UNO_QUERY); @@ -1855,9 +1855,9 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent, = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow(); if (pWindow->IsTopWindow()) { - css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > + std::vector< css::uno::Reference< css::uno::XInterface > > aListeners(m_aFocusListeners.getElements()); - if (aListeners.hasElements()) + if (!aListeners.empty()) { // Ignore the interior of compound controls when determining the // window that gets the focus next (see implementation in @@ -1876,7 +1876,7 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent, static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()), static_cast<sal_Int16>(pWindow->GetGetFocusFlags()), xNext, false); - for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i) + for (::sal_Int32 i = 0; i < (sal_Int32)aListeners.size(); ++i) { css::uno::Reference< css::awt::XFocusListener > xListener( aListeners[i], css::uno::UNO_QUERY); diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx index 967cb5f97e1b..a9853e17468b 100644 --- a/toolkit/source/awt/vclxtopwindow.cxx +++ b/toolkit/source/awt/vclxtopwindow.cxx @@ -260,7 +260,7 @@ vcl::Window* VCLXTopWindow::GetWindowImpl() return VCLXContainer::GetWindow(); } -::cppu::OInterfaceContainerHelper& VCLXTopWindow::GetTopWindowListenersImpl() +::comphelper::OInterfaceContainerHelper2& VCLXTopWindow::GetTopWindowListenersImpl() { return GetTopWindowListeners(); } diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index a1f4bb3ac7ad..444ac1a1c59c 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -97,8 +97,8 @@ private: bool mbDirectVisible; ::osl::Mutex maListenerContainerMutex; - ::cppu::OInterfaceContainerHelper maWindow2Listeners; - ::cppu::OInterfaceContainerHelper maDockableWindowListeners; + ::comphelper::OInterfaceContainerHelper2 maWindow2Listeners; + ::comphelper::OInterfaceContainerHelper2 maDockableWindowListeners; EventListenerMultiplexer maEventListeners; FocusListenerMultiplexer maFocusListeners; WindowListenerMultiplexer maWindowListeners; @@ -173,8 +173,8 @@ public: /** returns the container of registered XWindowListener2 listeners */ - inline ::cppu::OInterfaceContainerHelper& getWindow2Listeners() { return maWindow2Listeners; } - inline ::cppu::OInterfaceContainerHelper& getDockableWindowListeners(){ return maDockableWindowListeners; } + inline ::comphelper::OInterfaceContainerHelper2& getWindow2Listeners() { return maWindow2Listeners; } + inline ::comphelper::OInterfaceContainerHelper2& getDockableWindowListeners(){ return maDockableWindowListeners; } inline EventListenerMultiplexer& getEventListeners() { return maEventListeners; } inline FocusListenerMultiplexer& getFocusListeners() { return maFocusListeners; } inline WindowListenerMultiplexer& getWindowListeners() { return maWindowListeners; } @@ -416,7 +416,7 @@ namespace { struct CallWindow2Listener { - CallWindow2Listener( ::cppu::OInterfaceContainerHelper& i_rWindow2Listeners, const bool i_bEnabled, const EventObject& i_rEvent ) + CallWindow2Listener( ::comphelper::OInterfaceContainerHelper2& i_rWindow2Listeners, const bool i_bEnabled, const EventObject& i_rEvent ) :m_rWindow2Listeners( i_rWindow2Listeners ) ,m_bEnabled( i_bEnabled ) ,m_aEvent( i_rEvent ) @@ -428,7 +428,7 @@ namespace m_rWindow2Listeners.notifyEach( m_bEnabled ? &XWindowListener2::windowEnabled : &XWindowListener2::windowDisabled, m_aEvent ); } - ::cppu::OInterfaceContainerHelper& m_rWindow2Listeners; + ::comphelper::OInterfaceContainerHelper2& m_rWindow2Listeners; const bool m_bEnabled; const EventObject m_aEvent; }; @@ -774,7 +774,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) aEvent.bInteractive = pData->mbInteractive; Reference< XDockableWindowListener > xFirstListener; - ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() ); + ::comphelper::OInterfaceIteratorHelper2 aIter( mpImpl->getDockableWindowListeners() ); while ( aIter.hasMoreElements() && !xFirstListener.is() ) { xFirstListener.set( aIter.next(), UNO_QUERY ); @@ -816,7 +816,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) aEvent.Source = static_cast<cppu::OWeakObject*>(this); Reference< XDockableWindowListener > xFirstListener; - ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() ); + ::comphelper::OInterfaceIteratorHelper2 aIter( mpImpl->getDockableWindowListeners() ); while ( aIter.hasMoreElements() && !xFirstListener.is() ) { xFirstListener.set( aIter.next(), UNO_QUERY ); @@ -1340,12 +1340,12 @@ void VCLXWindow::GetPropertyIds( std::list< sal_uInt16 >& _out_rIds ) return ImplGetPropertyIds( _out_rIds, mpImpl->mbWithDefaultProps ); } -::cppu::OInterfaceContainerHelper& VCLXWindow::GetContainerListeners() +::comphelper::OInterfaceContainerHelper2& VCLXWindow::GetContainerListeners() { return mpImpl->getContainerListeners(); } -::cppu::OInterfaceContainerHelper& VCLXWindow::GetTopWindowListeners() +::comphelper::OInterfaceContainerHelper2& VCLXWindow::GetTopWindowListeners() { return mpImpl->getTopWindowListeners(); } diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index cf0c1ac6f36e..f137aeae762c 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -916,13 +916,11 @@ void ControlModelContainerBase::implNotifyTabModelChange( const OUString& _rAcce aEvent.Changes[ 0 ].Accessor <<= _rAccessor; - Sequence< Reference< XInterface > > aChangeListeners( maChangeListeners.getElements() ); - const Reference< XInterface >* pListener = aChangeListeners.getConstArray(); - const Reference< XInterface >* pListenerEnd = aChangeListeners.getConstArray() + aChangeListeners.getLength(); - for ( ; pListener != pListenerEnd; ++pListener ) + std::vector< Reference< XInterface > > aChangeListeners( maChangeListeners.getElements() ); + for ( const auto& rListener : aChangeListeners ) { - if ( pListener->is() ) - static_cast< XChangesListener* >( pListener->get() )->changesOccurred( aEvent ); + if ( rListener.is() ) + static_cast< XChangesListener* >( rListener.get() )->changesOccurred( aEvent ); } } diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx index 41d95d5f8824..99d3d3a8384a 100644 --- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx @@ -28,6 +28,7 @@ #include <comphelper/sequence.hxx> #include <comphelper/componentguard.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/supportsservice.hxx> @@ -84,7 +85,7 @@ public: private: typedef ::std::vector< css::uno::Reference< css::awt::grid::XGridColumn > > Columns; - ::cppu::OInterfaceContainerHelper m_aContainerListeners; + ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners; Columns m_aColumns; }; diff --git a/toolkit/source/controls/tree/treecontrol.cxx b/toolkit/source/controls/tree/treecontrol.cxx index ffc9109822e8..b8f17bddecce 100644 --- a/toolkit/source/controls/tree/treecontrol.cxx +++ b/toolkit/source/controls/tree/treecontrol.cxx @@ -490,7 +490,7 @@ void UnoTreeControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolk void SAL_CALL TreeEditListenerMultiplexer::nodeEditing( const Reference< XTreeNode >& Node ) throw (RuntimeException, css::util::VetoException, std::exception) { - ::cppu::OInterfaceIteratorHelper aIt( *this ); + ::comphelper::OInterfaceIteratorHelper2 aIt( *this ); while( aIt.hasMoreElements() ) { Reference< XTreeEditListener > xListener(static_cast< XTreeEditListener* >( aIt.next() ) ); @@ -514,7 +514,7 @@ void SAL_CALL TreeEditListenerMultiplexer::nodeEditing( const Reference< XTreeNo void SAL_CALL TreeEditListenerMultiplexer::nodeEdited( const Reference< XTreeNode >& Node, const OUString& NewText ) throw (RuntimeException, std::exception) { - ::cppu::OInterfaceIteratorHelper aIt( *this ); + ::comphelper::OInterfaceIteratorHelper2 aIt( *this ); while( aIt.hasMoreElements() ) { Reference< XTreeEditListener > xListener( static_cast< XTreeEditListener* >( aIt.next() ) ); diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx index 13c82aa32e6a..cce3444d2dd3 100644 --- a/toolkit/source/helper/listenermultiplexer.cxx +++ b/toolkit/source/helper/listenermultiplexer.cxx @@ -24,7 +24,7 @@ // class ListenerMultiplexerBase ListenerMultiplexerBase::ListenerMultiplexerBase( ::cppu::OWeakObject& rSource ) - : ::cppu::OInterfaceContainerHelper( GetMutex() ), mrContext( rSource ) + : ::comphelper::OInterfaceContainerHelper2( GetMutex() ), mrContext( rSource ) { } @@ -166,7 +166,7 @@ void TabListenerMultiplexer::changed( sal_Int32 evt, const css::uno::Sequence< c { sal_Int32 aMulti( evt ); css::uno::Sequence< css::beans::NamedValue > aMulti2( evt2 ); - ::cppu::OInterfaceIteratorHelper aIt( *this ); + ::comphelper::OInterfaceIteratorHelper2 aIt( *this ); while( aIt.hasMoreElements() ) { css::uno::Reference< css::awt::XTabListener > xListener( diff --git a/ucb/Library_srtrs1.mk b/ucb/Library_srtrs1.mk index 9cccba356753..d8acf21a48e7 100644 --- a/ucb/Library_srtrs1.mk +++ b/ucb/Library_srtrs1.mk @@ -17,6 +17,7 @@ $(eval $(call gb_Library_use_external,srtrs1,boost_headers)) $(eval $(call gb_Library_use_sdk_api,srtrs1)) $(eval $(call gb_Library_use_libraries,srtrs1,\ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/ucb/source/cacher/contentresultsetwrapper.cxx b/ucb/source/cacher/contentresultsetwrapper.cxx index ebad2c624f98..af67d8294ec8 100644 --- a/ucb/source/cacher/contentresultsetwrapper.cxx +++ b/ucb/source/cacher/contentresultsetwrapper.cxx @@ -33,6 +33,7 @@ using namespace com::sun::star::sdbc; using namespace com::sun::star::ucb; using namespace com::sun::star::uno; using namespace com::sun::star::util; +using namespace comphelper; using namespace cppu; @@ -427,7 +428,7 @@ void SAL_CALL ContentResultSetWrapper::addEventListener( const Reference< XEvent if ( !m_pDisposeEventListeners ) m_pDisposeEventListeners = - new OInterfaceContainerHelper( m_aContainerMutex ); + new OInterfaceContainerHelper2( m_aContainerMutex ); m_pDisposeEventListeners->addInterface( Listener ); } diff --git a/ucb/source/cacher/contentresultsetwrapper.hxx b/ucb/source/cacher/contentresultsetwrapper.hxx index baf84f181f2d..2570429eea7a 100644 --- a/ucb/source/cacher/contentresultsetwrapper.hxx +++ b/ucb/source/cacher/contentresultsetwrapper.hxx @@ -33,6 +33,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> @@ -132,7 +133,7 @@ private: bool m_bDisposed; ///Dispose call ready. bool m_bInDispose;///In dispose call osl::Mutex m_aContainerMutex; - cppu::OInterfaceContainerHelper* + comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; PropertyChangeListenerContainer_Impl* m_pPropertyChangeListeners; diff --git a/ucb/source/cacher/dynamicresultsetwrapper.cxx b/ucb/source/cacher/dynamicresultsetwrapper.cxx index b3f30b3c7115..27024a6674bd 100644 --- a/ucb/source/cacher/dynamicresultsetwrapper.cxx +++ b/ucb/source/cacher/dynamicresultsetwrapper.cxx @@ -30,7 +30,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::sdbc; using namespace com::sun::star::ucb; using namespace com::sun::star::uno; -using namespace cppu; +using namespace comphelper; @@ -178,7 +178,7 @@ void SAL_CALL DynamicResultSetWrapper::addEventListener( const Reference< XEvent if ( !m_pDisposeEventListeners ) m_pDisposeEventListeners = - new OInterfaceContainerHelper( m_aContainerMutex ); + new OInterfaceContainerHelper2( m_aContainerMutex ); m_pDisposeEventListeners->addInterface( Listener ); } diff --git a/ucb/source/cacher/dynamicresultsetwrapper.hxx b/ucb/source/cacher/dynamicresultsetwrapper.hxx index e04f75875a67..70e481cee331 100644 --- a/ucb/source/cacher/dynamicresultsetwrapper.hxx +++ b/ucb/source/cacher/dynamicresultsetwrapper.hxx @@ -24,6 +24,7 @@ #include <osl/conditn.hxx> #include <ucbhelper/macros.hxx> #include <cppuhelper/weak.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/interfacecontainer.hxx> @@ -46,7 +47,7 @@ private: bool m_bDisposed; ///Dispose call ready. bool m_bInDispose;///In dispose call osl::Mutex m_aContainerMutex; - cppu::OInterfaceContainerHelper* + comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; protected: css::uno::Reference< css::ucb::XDynamicResultSetListener > diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx index b25e266b9c53..0798bb060e55 100644 --- a/ucb/source/core/ucb.cxx +++ b/ucb/source/core/ucb.cxx @@ -25,7 +25,7 @@ *************************************************************************/ #include <osl/diagnose.h> #include <comphelper/processfactory.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/ucb/GlobalTransferCommandArgument2.hpp> #include <com/sun/star/ucb/XCommandInfo.hpp> @@ -44,7 +44,7 @@ #include "ucb.hxx" -using namespace cppu; +using namespace comphelper; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::ucb; @@ -318,7 +318,7 @@ void SAL_CALL UniversalContentBroker::addEventListener( throw( css::uno::RuntimeException, std::exception ) { if ( !m_pDisposeEventListeners ) - m_pDisposeEventListeners = new OInterfaceContainerHelper( m_aMutex ); + m_pDisposeEventListeners = new OInterfaceContainerHelper2( m_aMutex ); m_pDisposeEventListeners->addInterface( Listener ); } diff --git a/ucb/source/core/ucb.hxx b/ucb/source/core/ucb.hxx index a280832b2372..e8ee6d871628 100644 --- a/ucb/source/core/ucb.hxx +++ b/ucb/source/core/ucb.hxx @@ -46,7 +46,7 @@ -namespace cppu { class OInterfaceContainerHelper; } +namespace comphelper { class OInterfaceContainerHelper2; } namespace com { namespace sun { namespace star { namespace ucb { class XCommandInfo; @@ -209,7 +209,7 @@ private: css::uno::Sequence< css::uno::Any > m_aArguments; ProviderMap_Impl m_aProviders; osl::Mutex m_aMutex; - cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; + comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; sal_Int32 m_nCommandId; }; diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx index 2d88f2cff660..57e73057aba7 100644 --- a/ucb/source/core/ucbstore.cxx +++ b/ucb/source/core/ucbstore.cxx @@ -29,6 +29,7 @@ #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertySetInfoChange.hpp> #include <com/sun/star/configuration/theDefaultProvider.hpp> @@ -47,6 +48,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::ucb; using namespace com::sun::star::uno; using namespace com::sun::star::util; +using namespace comphelper; using namespace cppu; @@ -1094,8 +1096,8 @@ struct PersistentPropertySet_Impl OUString m_aKey; OUString m_aFullKey; osl::Mutex m_aMutex; - OInterfaceContainerHelper* m_pDisposeEventListeners; - OInterfaceContainerHelper* m_pPropSetChangeListeners; + OInterfaceContainerHelper2* m_pDisposeEventListeners; + OInterfaceContainerHelper2* m_pPropSetChangeListeners; PropertyListeners_Impl* m_pPropertyChangeListeners; PersistentPropertySet_Impl( PropertySetRegistry& rCreator, @@ -1197,7 +1199,7 @@ void SAL_CALL PersistentPropertySet::addEventListener( { if ( !m_pImpl->m_pDisposeEventListeners ) m_pImpl->m_pDisposeEventListeners = - new OInterfaceContainerHelper( m_pImpl->m_aMutex ); + new OInterfaceContainerHelper2( m_pImpl->m_aMutex ); m_pImpl->m_pDisposeEventListeners->addInterface( Listener ); } @@ -1813,7 +1815,7 @@ void SAL_CALL PersistentPropertySet::addPropertySetInfoChangeListener( { if ( !m_pImpl->m_pPropSetChangeListeners ) m_pImpl->m_pPropSetChangeListeners = - new OInterfaceContainerHelper( m_pImpl->m_aMutex ); + new OInterfaceContainerHelper2( m_pImpl->m_aMutex ); m_pImpl->m_pPropSetChangeListeners->addInterface( Listener ); } @@ -2144,7 +2146,7 @@ void PersistentPropertySet::notifyPropertySetInfoChange( return; // Notify event listeners. - OInterfaceIteratorHelper aIter( *( m_pImpl->m_pPropSetChangeListeners ) ); + OInterfaceIteratorHelper2 aIter( *( m_pImpl->m_pPropSetChangeListeners ) ); while ( aIter.hasMoreElements() ) { // Propagate event. diff --git a/ucb/source/sorter/sortdynres.cxx b/ucb/source/sorter/sortdynres.cxx index 4487e979918c..b9aae2f37ca2 100644 --- a/ucb/source/sorter/sortdynres.cxx +++ b/ucb/source/sorter/sortdynres.cxx @@ -19,7 +19,7 @@ #include <vector> #include <sortdynres.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <com/sun/star/ucb/ContentResultSetCapability.hpp> #include <com/sun/star/ucb/ListActionType.hpp> @@ -33,7 +33,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::sdbc; using namespace com::sun::star::ucb; using namespace com::sun::star::uno; -using namespace cppu; +using namespace comphelper; // The mutex to synchronize access to containers. @@ -158,7 +158,7 @@ void SAL_CALL SortedDynamicResultSet::addEventListener( if ( !mpDisposeEventListeners ) mpDisposeEventListeners = - new OInterfaceContainerHelper( getContainerMutex() ); + new OInterfaceContainerHelper2( getContainerMutex() ); mpDisposeEventListeners->addInterface( Listener ); } diff --git a/ucb/source/sorter/sortdynres.hxx b/ucb/source/sorter/sortdynres.hxx index ebc6a6757d77..6931eaa237ad 100644 --- a/ucb/source/sorter/sortdynres.hxx +++ b/ucb/source/sorter/sortdynres.hxx @@ -31,8 +31,8 @@ #include "sortresult.hxx" -namespace cppu { - class OInterfaceContainerHelper; +namespace comphelper { + class OInterfaceContainerHelper2; } #define DYNAMIC_RESULTSET_SERVICE_NAME "com.sun.star.ucb.SortedDynamicResultSet" @@ -44,7 +44,7 @@ class SortedDynamicResultSet: public cppu::WeakImplHelper < css::lang::XServiceInfo, css::ucb::XDynamicResultSet > { - cppu::OInterfaceContainerHelper *mpDisposeEventListeners; + comphelper::OInterfaceContainerHelper2 *mpDisposeEventListeners; css::uno::Reference < css::ucb::XDynamicResultSetListener > mxListener; css::uno::Reference < css::ucb::XDynamicResultSetListener > mxOwnListener; diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx index 945fee5c9834..f113cc9fffce 100644 --- a/ucb/source/sorter/sortresult.cxx +++ b/ucb/source/sorter/sortresult.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/ucb/XAnyCompareFactory.hpp> #include <cppuhelper/implbase.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <osl/diagnose.h> #include <memory> @@ -40,6 +41,7 @@ using namespace com::sun::star::sdbc; using namespace com::sun::star::ucb; using namespace com::sun::star::uno; using namespace com::sun::star::util; +using namespace comphelper; using namespace cppu; @@ -238,7 +240,7 @@ void SAL_CALL SortedResultSet::addEventListener( if ( !mpDisposeEventListeners ) mpDisposeEventListeners = - new OInterfaceContainerHelper( getContainerMutex() ); + new OInterfaceContainerHelper2( getContainerMutex() ); mpDisposeEventListeners->addInterface( Listener ); } diff --git a/ucb/source/sorter/sortresult.hxx b/ucb/source/sorter/sortresult.hxx index 5f45da992782..c93863d1e893 100644 --- a/ucb/source/sorter/sortresult.hxx +++ b/ucb/source/sorter/sortresult.hxx @@ -37,8 +37,8 @@ #include <cppuhelper/implbase.hxx> #include <deque> -namespace cppu { - class OInterfaceContainerHelper; +namespace comphelper { + class OInterfaceContainerHelper2; } @@ -123,7 +123,7 @@ class SortedResultSet: public cppu::WeakImplHelper < css::sdbc::XResultSetMetaDataSupplier, css::beans::XPropertySet > { - cppu::OInterfaceContainerHelper *mpDisposeEventListeners; + comphelper::OInterfaceContainerHelper2 *mpDisposeEventListeners; PropertyChangeListeners_Impl *mpPropChangeListeners; PropertyChangeListeners_Impl *mpVetoChangeListeners; diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index 030c487e0588..68ae2bd50310 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -186,7 +186,7 @@ BaseContent::addEventListener( const Reference< lang::XEventListener >& Listener if ( ! m_pDisposeEventListeners ) m_pDisposeEventListeners = - new cppu::OInterfaceContainerHelper( m_aEventListenerMutex ); + new comphelper::OInterfaceContainerHelper2( m_aEventListenerMutex ); m_pDisposeEventListeners->addInterface( Listener ); } @@ -208,9 +208,9 @@ BaseContent::dispose() throw( RuntimeException, std::exception ) { lang::EventObject aEvt; - cppu::OInterfaceContainerHelper* pDisposeEventListeners; - cppu::OInterfaceContainerHelper* pContentEventListeners; - cppu::OInterfaceContainerHelper* pPropertySetInfoChangeListeners; + comphelper::OInterfaceContainerHelper2* pDisposeEventListeners; + comphelper::OInterfaceContainerHelper2* pContentEventListeners; + comphelper::OInterfaceContainerHelper2* pPropertySetInfoChangeListeners; PropertyListeners* pPropertyListener; { @@ -545,7 +545,7 @@ BaseContent::addContentEventListener( if ( ! m_pContentEventListeners ) m_pContentEventListeners = - new cppu::OInterfaceContainerHelper( m_aEventListenerMutex ); + new comphelper::OInterfaceContainerHelper2( m_aEventListenerMutex ); m_pContentEventListeners->addInterface( Listener ); @@ -688,7 +688,7 @@ BaseContent::addPropertySetInfoChangeListener( { osl::MutexGuard aGuard( m_aMutex ); if( ! m_pPropertySetInfoChangeListeners ) - m_pPropertySetInfoChangeListeners = new cppu::OInterfaceContainerHelper( m_aEventListenerMutex ); + m_pPropertySetInfoChangeListeners = new comphelper::OInterfaceContainerHelper2( m_aEventListenerMutex ); m_pPropertySetInfoChangeListeners->addInterface( Listener ); } @@ -1262,10 +1262,12 @@ BaseContent::cDEL() ContentEventNotifier* p; if( m_pContentEventListeners ) + { p = new ContentEventNotifier( m_pMyShell, this, m_xContentIdentifier, m_pContentEventListeners->getElements() ); + } else p = nullptr; diff --git a/ucb/source/ucp/file/bc.hxx b/ucb/source/ucp/file/bc.hxx index d35a139af6b3..b798caef1008 100644 --- a/ucb/source/ucp/file/bc.hxx +++ b/ucb/source/ucp/file/bc.hxx @@ -24,7 +24,7 @@ #include "rtl/ustring.hxx" #include <cppuhelper/weak.hxx> #include <ucbhelper/macros.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -275,9 +275,9 @@ namespace fileaccess { osl::Mutex m_aMutex; osl::Mutex m_aEventListenerMutex; - cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; - cppu::OInterfaceContainerHelper* m_pContentEventListeners; - cppu::OInterfaceContainerHelper* m_pPropertySetInfoChangeListeners; + comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; + comphelper::OInterfaceContainerHelper2* m_pContentEventListeners; + comphelper::OInterfaceContainerHelper2* m_pPropertySetInfoChangeListeners; PropertyListeners* m_pPropertyListener; diff --git a/ucb/source/ucp/file/filnot.cxx b/ucb/source/ucp/file/filnot.cxx index f8b496287c52..7c2958d7ccec 100644 --- a/ucb/source/ucp/file/filnot.cxx +++ b/ucb/source/ucp/file/filnot.cxx @@ -35,7 +35,7 @@ using namespace com::sun::star::ucb; ContentEventNotifier::ContentEventNotifier( shell* pMyShell, const uno::Reference< XContent >& xCreatorContent, const uno::Reference< XContentIdentifier >& xCreatorId, - const uno::Sequence< uno::Reference< uno::XInterface > >& sListeners ) + const std::vector< uno::Reference< uno::XInterface > >& sListeners ) : m_pMyShell( pMyShell ), m_xCreatorContent( xCreatorContent ), m_xCreatorId( xCreatorId ), @@ -48,7 +48,7 @@ ContentEventNotifier::ContentEventNotifier( shell* pMyShell, const uno::Reference< XContent >& xCreatorContent, const uno::Reference< XContentIdentifier >& xCreatorId, const uno::Reference< XContentIdentifier >& xOldId, - const uno::Sequence< uno::Reference< uno::XInterface > >& sListeners ) + const std::vector< uno::Reference< uno::XInterface > >& sListeners ) : m_pMyShell( pMyShell ), m_xCreatorContent( xCreatorContent ), m_xCreatorId( xCreatorId ), @@ -71,9 +71,9 @@ void ContentEventNotifier::notifyChildInserted( const OUString& aChildName ) xChildContent, m_xCreatorId ); - for( sal_Int32 i = 0; i < m_sListeners.getLength(); ++i ) + for( const auto& r : m_sListeners ) { - uno::Reference< XContentEventListener > ref( m_sListeners[i],uno::UNO_QUERY ); + uno::Reference< XContentEventListener > ref( r, uno::UNO_QUERY ); if( ref.is() ) ref->contentEvent( aEvt ); } @@ -88,9 +88,9 @@ void ContentEventNotifier::notifyDeleted() m_xCreatorId ); - for( sal_Int32 i = 0; i < m_sListeners.getLength(); ++i ) + for( const auto& r : m_sListeners ) { - uno::Reference< XContentEventListener > ref( m_sListeners[i],uno::UNO_QUERY ); + uno::Reference< XContentEventListener > ref( r, uno::UNO_QUERY ); if( ref.is() ) ref->contentEvent( aEvt ); } @@ -117,9 +117,9 @@ void ContentEventNotifier::notifyRemoved( const OUString& aChildName ) xDeletedContent, m_xCreatorId ); - for( sal_Int32 i = 0; i < m_sListeners.getLength(); ++i ) + for( const auto& r : m_sListeners ) { - uno::Reference< XContentEventListener > ref( m_sListeners[i],uno::UNO_QUERY ); + uno::Reference< XContentEventListener > ref( r, uno::UNO_QUERY ); if( ref.is() ) ref->contentEvent( aEvt ); } @@ -132,9 +132,9 @@ void ContentEventNotifier::notifyExchanged() m_xCreatorContent, m_xOldId ); - for( sal_Int32 i = 0; i < m_sListeners.getLength(); ++i ) + for( const auto& r : m_sListeners ) { - uno::Reference< XContentEventListener > ref( m_sListeners[i],uno::UNO_QUERY ); + uno::Reference< XContentEventListener > ref( r, uno::UNO_QUERY ); if( ref.is() ) ref->contentEvent( aEvt ); } @@ -149,7 +149,7 @@ void ContentEventNotifier::notifyExchanged() PropertySetInfoChangeNotifier::PropertySetInfoChangeNotifier( const uno::Reference< XContent >& xCreatorContent, - const uno::Sequence< uno::Reference< uno::XInterface > >& sListeners ) + const std::vector< uno::Reference< uno::XInterface > >& sListeners ) : m_xCreatorContent( xCreatorContent ), m_sListeners( sListeners ) { @@ -165,9 +165,9 @@ PropertySetInfoChangeNotifier::notifyPropertyAdded( const OUString & aPropertyNa -1, beans::PropertySetInfoChange::PROPERTY_INSERTED ); - for( sal_Int32 i = 0; i < m_sListeners.getLength(); ++i ) + for( const auto& r : m_sListeners ) { - uno::Reference< beans::XPropertySetInfoChangeListener > ref( m_sListeners[i],uno::UNO_QUERY ); + uno::Reference< beans::XPropertySetInfoChangeListener > ref( r, uno::UNO_QUERY ); if( ref.is() ) ref->propertySetInfoChange( aEvt ); } @@ -182,9 +182,9 @@ PropertySetInfoChangeNotifier::notifyPropertyRemoved( const OUString & aProperty -1, beans::PropertySetInfoChange::PROPERTY_REMOVED ); - for( sal_Int32 i = 0; i < m_sListeners.getLength(); ++i ) + for( const auto& r : m_sListeners ) { - uno::Reference< beans::XPropertySetInfoChangeListener > ref( m_sListeners[i],uno::UNO_QUERY ); + uno::Reference< beans::XPropertySetInfoChangeListener > ref( r, uno::UNO_QUERY ); if( ref.is() ) ref->propertySetInfoChange( aEvt ); } diff --git a/ucb/source/ucp/file/filnot.hxx b/ucb/source/ucp/file/filnot.hxx index be304b821447..ffecfe7910b1 100644 --- a/ucb/source/ucp/file/filnot.hxx +++ b/ucb/source/ucp/file/filnot.hxx @@ -25,6 +25,7 @@ #include <com/sun/star/ucb/XContentIdentifier.hpp> #include "filglob.hxx" #include <unordered_map> +#include <vector> namespace fileaccess { @@ -37,21 +38,21 @@ namespace fileaccess { css::uno::Reference< css::ucb::XContent > m_xCreatorContent; css::uno::Reference< css::ucb::XContentIdentifier > m_xCreatorId; css::uno::Reference< css::ucb::XContentIdentifier > m_xOldId; - css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > m_sListeners; + std::vector< css::uno::Reference< css::uno::XInterface > > m_sListeners; public: ContentEventNotifier( shell* pMyShell, const css::uno::Reference< css::ucb::XContent >& xCreatorContent, const css::uno::Reference< css::ucb::XContentIdentifier >& xCreatorId, - const css::uno::Sequence< css::uno::Reference< css::uno::XInterface > >& sListeners ); + const std::vector< css::uno::Reference< css::uno::XInterface > >& sListeners ); ContentEventNotifier( shell* pMyShell, const css::uno::Reference< css::ucb::XContent >& xCreatorContent, const css::uno::Reference< css::ucb::XContentIdentifier >& xCreatorId, const css::uno::Reference< css::ucb::XContentIdentifier >& xOldId, - const css::uno::Sequence< css::uno::Reference< css::uno::XInterface > >& sListeners ); + const std::vector< css::uno::Reference< css::uno::XInterface > >& sListeners ); void notifyChildInserted( const OUString& aChildName ); void notifyDeleted(); @@ -64,11 +65,11 @@ namespace fileaccess { { private: css::uno::Reference< css::ucb::XContent > m_xCreatorContent; - css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > m_sListeners; + std::vector< css::uno::Reference< css::uno::XInterface > > m_sListeners; public: PropertySetInfoChangeNotifier( const css::uno::Reference< css::ucb::XContent >& xCreatorContent, - const css::uno::Sequence< css::uno::Reference< css::uno::XInterface > >& sListeners ); + const std::vector< css::uno::Reference< css::uno::XInterface > >& sListeners ); void SAL_CALL notifyPropertyAdded( const OUString & aPropertyName ); void SAL_CALL notifyPropertyRemoved( const OUString & aPropertyName ); diff --git a/ucb/source/ucp/file/filrset.cxx b/ucb/source/ucp/file/filrset.cxx index 1210817e360e..03ecedd53eb8 100644 --- a/ucb/source/ucp/file/filrset.cxx +++ b/ucb/source/ucp/file/filrset.cxx @@ -114,7 +114,7 @@ XResultSet_impl::addEventListener( if ( ! m_pDisposeEventListeners ) m_pDisposeEventListeners = - new cppu::OInterfaceContainerHelper( m_aEventListenerMutex ); + new comphelper::OInterfaceContainerHelper2( m_aEventListenerMutex ); m_pDisposeEventListeners->addInterface( Listener ); } @@ -161,7 +161,7 @@ XResultSet_impl::dispose() void XResultSet_impl::rowCountChanged() { sal_Int32 aOldValue,aNewValue; - uno::Sequence< uno::Reference< uno::XInterface > > seq; + std::vector< uno::Reference< uno::XInterface > > seq; { osl::MutexGuard aGuard( m_aMutex ); if( m_pRowCountListeners ) @@ -175,10 +175,10 @@ void XResultSet_impl::rowCountChanged() aEv.PropertyHandle = -1; aEv.OldValue <<= aOldValue; aEv.NewValue <<= aNewValue; - for( sal_Int32 i = 0; i < seq.getLength(); ++i ) + for( const auto& r : seq ) { uno::Reference< beans::XPropertyChangeListener > listener( - seq[i], uno::UNO_QUERY ); + r, uno::UNO_QUERY ); if( listener.is() ) listener->propertyChange( aEv ); } @@ -187,7 +187,7 @@ void XResultSet_impl::rowCountChanged() void XResultSet_impl::isFinalChanged() { - uno::Sequence< uno::Reference< XInterface > > seq; + std::vector< uno::Reference< XInterface > > seq; { osl::MutexGuard aGuard( m_aMutex ); if( m_pIsFinalListeners ) @@ -202,10 +202,10 @@ void XResultSet_impl::isFinalChanged() bool tval = true; aEv.OldValue <<= fval; aEv.NewValue <<= tval; - for( sal_Int32 i = 0; i < seq.getLength(); ++i ) + for( const auto& r : seq ) { uno::Reference< beans::XPropertyChangeListener > listener( - seq[i], uno::UNO_QUERY ); + r, uno::UNO_QUERY ); if( listener.is() ) listener->propertyChange( aEv ); } @@ -797,7 +797,7 @@ void SAL_CALL XResultSet_impl::addPropertyChangeListener( osl::MutexGuard aGuard( m_aMutex ); if ( ! m_pIsFinalListeners ) m_pIsFinalListeners = - new cppu::OInterfaceContainerHelper( m_aEventListenerMutex ); + new comphelper::OInterfaceContainerHelper2( m_aEventListenerMutex ); m_pIsFinalListeners->addInterface( xListener ); } @@ -806,7 +806,7 @@ void SAL_CALL XResultSet_impl::addPropertyChangeListener( osl::MutexGuard aGuard( m_aMutex ); if ( ! m_pRowCountListeners ) m_pRowCountListeners = - new cppu::OInterfaceContainerHelper( m_aEventListenerMutex ); + new comphelper::OInterfaceContainerHelper2( m_aEventListenerMutex ); m_pRowCountListeners->addInterface( xListener ); } else diff --git a/ucb/source/ucp/file/filrset.hxx b/ucb/source/ucp/file/filrset.hxx index 505994b5519a..cfea9e6c5bdf 100644 --- a/ucb/source/ucp/file/filrset.hxx +++ b/ucb/source/ucp/file/filrset.hxx @@ -22,7 +22,7 @@ #include <vector> #include <osl/file.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/ucb/XContentAccess.hpp> #include <com/sun/star/sdbc/XCloseable.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -604,10 +604,10 @@ class XResultSet_impl : public Notifier, osl::Mutex m_aMutex; osl::Mutex m_aEventListenerMutex; - cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; + comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; - cppu::OInterfaceContainerHelper* m_pRowCountListeners; - cppu::OInterfaceContainerHelper* m_pIsFinalListeners; + comphelper::OInterfaceContainerHelper2* m_pRowCountListeners; + comphelper::OInterfaceContainerHelper2* m_pIsFinalListeners; css::uno::Reference< css::ucb::XDynamicResultSetListener > m_xListener; bool m_bStatic; diff --git a/ucb/source/ucp/ftp/ftpresultsetbase.cxx b/ucb/source/ucp/ftp/ftpresultsetbase.cxx index 12acee990451..fde89797120e 100644 --- a/ucb/source/ucp/ftp/ftpresultsetbase.cxx +++ b/ucb/source/ucp/ftp/ftpresultsetbase.cxx @@ -105,7 +105,7 @@ ResultSetBase::addEventListener( if ( ! m_pDisposeEventListeners ) m_pDisposeEventListeners = - new cppu::OInterfaceContainerHelper( m_aMutex ); + new comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pDisposeEventListeners->addInterface( Listener ); } @@ -567,7 +567,7 @@ void SAL_CALL ResultSetBase::addPropertyChangeListener( osl::MutexGuard aGuard( m_aMutex ); if ( ! m_pIsFinalListeners ) m_pIsFinalListeners = - new cppu::OInterfaceContainerHelper( m_aMutex ); + new comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pIsFinalListeners->addInterface( xListener ); } @@ -576,7 +576,7 @@ void SAL_CALL ResultSetBase::addPropertyChangeListener( osl::MutexGuard aGuard( m_aMutex ); if ( ! m_pRowCountListeners ) m_pRowCountListeners = - new cppu::OInterfaceContainerHelper( m_aMutex ); + new comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pRowCountListeners->addInterface( xListener ); } else diff --git a/ucb/source/ucp/ftp/ftpresultsetbase.hxx b/ucb/source/ucp/ftp/ftpresultsetbase.hxx index b98e7f8756f0..6cfcaee8ce14 100644 --- a/ucb/source/ucp/ftp/ftpresultsetbase.hxx +++ b/ucb/source/ucp/ftp/ftpresultsetbase.hxx @@ -21,7 +21,7 @@ #include <vector> #include <cppuhelper/weak.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/ucb/XContentAccess.hpp> #include <com/sun/star/sdbc/XCloseable.hpp> @@ -537,10 +537,10 @@ namespace ftp { m_sProperty; osl::Mutex m_aMutex; - cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; + comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; - cppu::OInterfaceContainerHelper* m_pRowCountListeners; - cppu::OInterfaceContainerHelper* m_pIsFinalListeners; + comphelper::OInterfaceContainerHelper2* m_pRowCountListeners; + comphelper::OInterfaceContainerHelper2* m_pIsFinalListeners; }; diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx index 398a044047a9..d9b9e8ce2e53 100644 --- a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx +++ b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx @@ -31,7 +31,7 @@ #include "osl/doublecheckedlocking.h" #include <comphelper/processfactory.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> @@ -322,7 +322,7 @@ void SAL_CALL HierarchyDataSource::addEventListener( if ( !m_pDisposeEventListeners ) m_pDisposeEventListeners - = new cppu::OInterfaceContainerHelper( m_aMutex ); + = new comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pDisposeEventListeners->addInterface( Listener ); } diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.hxx b/ucb/source/ucp/hierarchy/hierarchydatasource.hxx index 8ee2ac3d2a6e..dc750fc2b0a1 100644 --- a/ucb/source/ucp/hierarchy/hierarchydatasource.hxx +++ b/ucb/source/ucp/hierarchy/hierarchydatasource.hxx @@ -29,7 +29,7 @@ #include <cppuhelper/weak.hxx> #include <ucbhelper/macros.hxx> -namespace cppu { class OInterfaceContainerHelper; } +namespace comphelper { class OInterfaceContainerHelper2; } namespace hierarchy_ucp { @@ -44,7 +44,7 @@ class HierarchyDataSource : public cppu::OWeakObject, osl::Mutex m_aMutex; css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider; - cppu::OInterfaceContainerHelper * m_pDisposeEventListeners; + comphelper::OInterfaceContainerHelper2 * m_pDisposeEventListeners; public: explicit HierarchyDataSource( const css::uno::Reference< css::uno::XComponentContext > & rxContext ); diff --git a/ucbhelper/source/provider/resultset.cxx b/ucbhelper/source/provider/resultset.cxx index 8328bac45bdb..48a360961229 100644 --- a/ucbhelper/source/provider/resultset.cxx +++ b/ucbhelper/source/provider/resultset.cxx @@ -1466,14 +1466,7 @@ void ResultSet::propertyChanged( const beans::PropertyChangeEvent& rEvt ) rEvt.PropertyName ); if ( pPropsContainer ) { - cppu::OInterfaceIteratorHelper aIter( *pPropsContainer ); - while ( aIter.hasMoreElements() ) - { - uno::Reference< beans::XPropertyChangeListener > xListener( - aIter.next(), uno::UNO_QUERY ); - if ( xListener.is() ) - xListener->propertyChange( rEvt ); - } + pPropsContainer->notifyEach(&beans::XPropertyChangeListener::propertyChange, rEvt); } // Notify listeners interested in all properties. diff --git a/ucbhelper/source/provider/resultsethelper.cxx b/ucbhelper/source/provider/resultsethelper.cxx index c6a8129026cb..4ed6a51fce54 100644 --- a/ucbhelper/source/provider/resultsethelper.cxx +++ b/ucbhelper/source/provider/resultsethelper.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/ucb/WelcomeDynamicResultSetStruct.hpp> #include <com/sun/star/ucb/CachedDynamicResultSetStubFactory.hpp> #include <com/sun/star/ucb/XSourceInitialization.hpp> -#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/interfacecontainer.h> #include <ucbhelper/resultsethelper.hxx> #include <ucbhelper/getcomponentcontext.hxx> diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx index f4ef8fe0f8bb..0266ef118a03 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx @@ -104,7 +104,7 @@ ResultSetBase::addEventListener( if ( ! m_pDisposeEventListeners ) m_pDisposeEventListeners = - new cppu::OInterfaceContainerHelper( m_aMutex ); + new comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pDisposeEventListeners->addInterface( Listener ); } @@ -560,7 +560,7 @@ void SAL_CALL ResultSetBase::addPropertyChangeListener( osl::MutexGuard aGuard( m_aMutex ); if ( ! m_pIsFinalListeners ) m_pIsFinalListeners = - new cppu::OInterfaceContainerHelper( m_aMutex ); + new comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pIsFinalListeners->addInterface( xListener ); } @@ -569,7 +569,7 @@ void SAL_CALL ResultSetBase::addPropertyChangeListener( osl::MutexGuard aGuard( m_aMutex ); if ( ! m_pRowCountListeners ) m_pRowCountListeners = - new cppu::OInterfaceContainerHelper( m_aMutex ); + new comphelper::OInterfaceContainerHelper2( m_aMutex ); m_pRowCountListeners->addInterface( xListener ); } else diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx index c9660f2b9f00..fc2cf624fb91 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx @@ -21,7 +21,7 @@ #include <vector> #include <cppuhelper/weak.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/ucb/XContentAccess.hpp> #include <com/sun/star/sdbc/XCloseable.hpp> @@ -548,10 +548,10 @@ namespace chelp { css::uno::Sequence< css::beans::Property > m_sProperty; osl::Mutex m_aMutex; - cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; + comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; - cppu::OInterfaceContainerHelper* m_pRowCountListeners; - cppu::OInterfaceContainerHelper* m_pIsFinalListeners; + comphelper::OInterfaceContainerHelper2* m_pRowCountListeners; + comphelper::OInterfaceContainerHelper2* m_pIsFinalListeners; }; |