sfx2/source/doc/SfxDocumentMetaData.cxx    |    9 ++++-----
 sfx2/source/view/sfxbasecontroller.cxx     |    4 ++--
 sfx2/source/view/userinputinterception.cxx |   20 +++++++-------------
 3 files changed, 13 insertions(+), 20 deletions(-)

New commits:
commit aa25ddc572493c85320ddee439013321f67544d0
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Nov 28 10:10:19 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Nov 28 18:11:22 2021 +0100

    use more OInterfaceContainerHelper3 in sfx2
    
    Change-Id: Ia14f70bf4b09109e987fd7b432dcc1a5a9b10ad2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125972
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx 
b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 1abdb68d778d..04d1fadf5838 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -67,7 +67,7 @@
 #include <osl/mutex.hxx>
 #include <comphelper/fileformat.h>
 #include <cppuhelper/basemutex.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <unotools/mediadescriptor.hxx>
 #include <comphelper/sequence.hxx>
@@ -239,7 +239,7 @@ protected:
     const css::uno::Reference< css::uno::XComponentContext > m_xContext;
 
     /// for notification
-    ::comphelper::OInterfaceContainerHelper2 m_NotifyListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener> 
m_NotifyListeners;
     /// flag: false means not initialized yet, or disposed
     bool m_isInitialized;
     /// flag
@@ -2123,11 +2123,10 @@ void SfxDocumentMetaData::createUserDefined()
         m_xUserDefined, css::uno::UNO_QUERY);
     if (xMB.is())
     {
-        const std::vector<css::uno::Reference<css::uno::XInterface> >
+        const std::vector<css::uno::Reference<css::util::XModifyListener> >
             listeners(m_NotifyListeners.getElements());
         for (const auto& l : listeners) {
-            xMB->addModifyListener(
-                css::uno::Reference< css::util::XModifyListener >(l, 
css::uno::UNO_QUERY) );
+            xMB->addModifyListener(l);
         }
     }
 }
diff --git a/sfx2/source/view/sfxbasecontroller.cxx 
b/sfx2/source/view/sfxbasecontroller.cxx
index b6abf029dc67..9760b6802cb7 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -40,7 +40,7 @@
 #include <com/sun/star/lang/XEventListener.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <comphelper/multicontainer2.hxx>
 #include <sfx2/viewsh.hxx>
 #include <sfx2/docfac.hxx>
@@ -354,7 +354,7 @@ struct IMPL_SfxBaseController_DataContainer
     Reference< XCloseListener >             m_xCloseListener        ;
     ::sfx2::UserInputInterception           m_aUserInputInterception;
     ::comphelper::OMultiTypeInterfaceContainerHelper2      
m_aListenerContainer    ;
-    ::comphelper::OInterfaceContainerHelper2               
m_aInterceptorContainer ;
+    ::comphelper::OInterfaceContainerHelper3<ui::XContextMenuInterceptor> 
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 ca1a1fd3f622..f1f0d365d3c4 100644
--- a/sfx2/source/view/userinputinterception.cxx
+++ b/sfx2/source/view/userinputinterception.cxx
@@ -30,7 +30,7 @@
 #include <com/sun/star/awt/XWindowPeer.hpp>
 #include <com/sun/star/uno/XInterface.hpp>
 
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <cppuhelper/weak.hxx>
 #include <vcl/event.hxx>
 #include <vcl/window.hxx>
@@ -58,8 +58,8 @@ namespace sfx2
     {
     public:
         ::cppu::OWeakObject&                m_rControllerImpl;
-        ::comphelper::OInterfaceContainerHelper2   m_aKeyHandlers;
-        ::comphelper::OInterfaceContainerHelper2   m_aMouseClickHandlers;
+        ::comphelper::OInterfaceContainerHelper3<XKeyHandler> m_aKeyHandlers;
+        ::comphelper::OInterfaceContainerHelper3<XMouseClickHandler> 
m_aMouseClickHandlers;
 
     public:
         UserInputInterception_Data( ::cppu::OWeakObject& _rControllerImpl, 
::osl::Mutex& _rMutex )
@@ -186,13 +186,10 @@ namespace sfx2
                 if ( _rEvent.GetWindow() )
                     aEvent.Source = 
_rEvent.GetWindow()->GetComponentInterface();
 
-                ::comphelper::OInterfaceIteratorHelper2 aIterator( 
m_pData->m_aKeyHandlers );
+                ::comphelper::OInterfaceIteratorHelper3 aIterator( 
m_pData->m_aKeyHandlers );
                 while ( aIterator.hasMoreElements() )
                 {
-                    Reference< XKeyHandler > xHandler( static_cast< 
XKeyHandler* >( aIterator.next() ) );
-                    if ( !xHandler.is() )
-                        continue;
-
+                    Reference< XKeyHandler > xHandler( aIterator.next() );
                     try
                     {
                         if ( nType == MouseNotifyEvent::KEYINPUT )
@@ -224,13 +221,10 @@ namespace sfx2
                 if ( _rEvent.GetWindow() )
                     aEvent.Source = 
_rEvent.GetWindow()->GetComponentInterface();
 
-                ::comphelper::OInterfaceIteratorHelper2 aIterator( 
m_pData->m_aMouseClickHandlers );
+                ::comphelper::OInterfaceIteratorHelper3 aIterator( 
m_pData->m_aMouseClickHandlers );
                 while ( aIterator.hasMoreElements() )
                 {
-                    Reference< XMouseClickHandler > xHandler( static_cast< 
XMouseClickHandler* >( aIterator.next() ) );
-                    if ( !xHandler.is() )
-                        continue;
-
+                    Reference< XMouseClickHandler > xHandler( aIterator.next() 
);
                     try
                     {
                         if ( nType == MouseNotifyEvent::MOUSEBUTTONDOWN )

Reply via email to