sw/inc/fesh.hxx                         |    7 ++++---
 sw/inc/unochart.hxx                     |   12 ++++++------
 sw/source/core/access/accmap.cxx        |   10 ++++------
 sw/source/core/frmedt/fecopy.cxx        |    2 +-
 sw/source/core/unocore/unobkm.cxx       |    6 +++---
 sw/source/core/unocore/unochart.cxx     |   10 +++-------
 sw/source/core/unocore/unofield.cxx     |   14 +++++++-------
 sw/source/core/unocore/unoframe.cxx     |    6 +++---
 sw/source/core/unocore/unoftn.cxx       |    6 +++---
 sw/source/core/unocore/unoidx.cxx       |    6 +++---
 sw/source/core/unocore/unoparagraph.cxx |    6 +++---
 sw/source/core/unocore/unorefmk.cxx     |   10 +++++-----
 sw/source/core/unocore/unosect.cxx      |    6 +++---
 sw/source/core/unocore/unotbl.cxx       |   10 +++++-----
 sw/source/uibase/dochdl/swdtflvr.cxx    |    8 ++------
 sw/source/uibase/inc/unomailmerge.hxx   |    5 +++--
 sw/source/uibase/inc/unotxvw.hxx        |    4 ++--
 sw/source/uibase/uno/unotxdoc.cxx       |   10 ++++++----
 sw/source/uibase/uno/unotxvw.cxx        |   24 +++++++-----------------
 19 files changed, 73 insertions(+), 89 deletions(-)

New commits:
commit 74d827c1757b991f926df80d30a8d2549201d0b9
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Nov 28 18:37:34 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Dec 1 08:46:57 2021 +0100

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

diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index b7fff37b5ee4..4b7ec6a9d973 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SW_INC_FESH_HXX
 
 #include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/text/XPasteListener.hpp>
 
 #include <svx/svdobj.hxx>
 #include "swdllapi.h"
@@ -30,7 +31,7 @@
 #include <sot/formats.hxx>
 #include <rtl/ustring.hxx>
 #include <o3tl/typed_flags_set.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 
 #include <vector>
 #include <memory>
@@ -205,7 +206,7 @@ private:
     std::unique_ptr<SdrDropMarkerOverlay> m_pChainTo;
     std::unique_ptr<SdrDropMarkerOverlay> m_pChainFrom;
     bool m_bCheckForOLEInCaption;
-    comphelper::OInterfaceContainerHelper2 m_aPasteListeners;
+    comphelper::OInterfaceContainerHelper3<css::text::XPasteListener> 
m_aPasteListeners;
     /// insert table rows or columns instead of overwriting the existing table 
cells
     SwTable::SearchType m_eTableInsertMode;
     /// table copied to the clipboard by the last private copy
@@ -566,7 +567,7 @@ public:
     void Paste( SvStream& rStm, SwPasteSdr nAction, const Point* pPt );
     bool Paste( const Graphic &rGrf, const OUString& rURL );
 
-    comphelper::OInterfaceContainerHelper2& GetPasteListeners();
+    comphelper::OInterfaceContainerHelper3<css::text::XPasteListener>& 
GetPasteListeners();
 
     bool IsAlignPossible() const;
     void SetCalcFieldValueHdl(Outliner* pOutliner);
diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx
index 49f8a295dfe1..632efdee5530 100644
--- a/sw/inc/unochart.hxx
+++ b/sw/inc/unochart.hxx
@@ -39,7 +39,7 @@
 #include <com/sun/star/util/XModifiable.hpp>
 #include <com/sun/star/util/XModifyListener.hpp>
 
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/weakref.hxx>
 
@@ -125,7 +125,7 @@ class SwChartDataProvider final :
     // all tables of the document.
     mutable Map_Set_DataSequenceRef_t       m_aDataSequences;
 
-    ::comphelper::OInterfaceContainerHelper2      m_aEventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
m_aEventListeners;
     const SwDoc *                           m_pDoc;
     bool                                    m_bDisposed;
 
@@ -232,8 +232,8 @@ class SwChartDataSequence final :
     public SvtListener
 {
     SwFrameFormat* m_pFormat;
-    ::comphelper::OInterfaceContainerHelper2          m_aEvtListeners;
-    ::comphelper::OInterfaceContainerHelper2          m_aModifyListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
m_aEvtListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener> 
m_aModifyListeners;
     css::chart2::data::DataSequenceRole               m_aRole;
 
     OUString  m_aRowLabelText;
@@ -328,8 +328,8 @@ SwChartLabeledDataSequenceBaseClass;
 class SwChartLabeledDataSequence final :
     public SwChartLabeledDataSequenceBaseClass
 {
-    ::comphelper::OInterfaceContainerHelper2                           
m_aEventListeners;
-    ::comphelper::OInterfaceContainerHelper2                           
m_aModifyListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
m_aEventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener> 
m_aModifyListeners;
 
     css::uno::Reference< css::chart2::data::XDataSequence >     m_xData;
     css::uno::Reference< css::chart2::data::XDataSequence >     m_xLabels;
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 62a5f61c5c2b..7234a571a72c 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -62,7 +62,7 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/document/XShapeEventBroadcaster.hpp>
 #include <cppuhelper/implbase.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <pagepreviewlayout.hxx>
 #include <dcontact.hxx>
 #include <svx/unoapi.hxx>
@@ -133,7 +133,7 @@ class SwDrawModellListener_Impl : public SfxListener,
     public ::cppu::WeakImplHelper< document::XShapeEventBroadcaster >
 {
     mutable ::osl::Mutex maListenerMutex;
-    ::comphelper::OInterfaceContainerHelper2 maEventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::document::XEventListener> 
maEventListeners;
     std::unordered_multimap<css::uno::Reference< css::drawing::XShape >, 
css::uno::Reference< css::document::XShapeEventListener >> maShapeListeners;
     SdrModel *mpDrawModel;
 protected:
@@ -224,14 +224,12 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& 
/*rBC*/,
     if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) )
         return;
 
-    ::comphelper::OInterfaceIteratorHelper2 aIter( maEventListeners );
+    ::comphelper::OInterfaceIteratorHelper3 aIter( maEventListeners );
     while( aIter.hasMoreElements() )
     {
-        uno::Reference < document::XEventListener > xListener( aIter.next(),
-                                                uno::UNO_QUERY );
         try
         {
-            xListener->notifyEvent( aEvent );
+            aIter.next()->notifyEvent( aEvent );
         }
         catch( uno::RuntimeException const & )
         {
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 7a57c5f4e709..adc55dbfe9d2 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1204,7 +1204,7 @@ void SwFEShell::PastePages( SwFEShell& rToFill, 
sal_uInt16 nStartPage, sal_uInt1
     EndAllAction();
 }
 
-comphelper::OInterfaceContainerHelper2& SwFEShell::GetPasteListeners() { 
return m_aPasteListeners; }
+comphelper::OInterfaceContainerHelper3<css::text::XPasteListener>& 
SwFEShell::GetPasteListeners() { return m_aPasteListeners; }
 
 bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFormat, Graphic& rGrf 
) const
 {
diff --git a/sw/source/core/unocore/unobkm.cxx 
b/sw/source/core/unocore/unobkm.cxx
index d7f6d706343a..60d6c47d50b2 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -19,7 +19,7 @@
 
 #include <unobookmark.hxx>
 
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <comphelper/sequence.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
@@ -45,11 +45,11 @@ class SwXBookmark::Impl
     : public SvtListener
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
 
 public:
     uno::WeakReference<uno::XInterface> m_wThis;
-    ::comphelper::OInterfaceContainerHelper2 m_EventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
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 e5116fed96cf..4ae947545c9b 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -156,17 +156,13 @@ static osl::Mutex &    GetChartMutex()
 }
 
 static void LaunchModifiedEvent(
-        ::comphelper::OInterfaceContainerHelper2 &rICH,
+        ::comphelper::OInterfaceContainerHelper3<util::XModifyListener> &rICH,
         const uno::Reference< uno::XInterface > &rxI )
 {
     lang::EventObject aEvtObj( rxI );
-    comphelper::OInterfaceIteratorHelper2 aIt( rICH );
+    comphelper::OInterfaceIteratorHelper3 aIt( rICH );
     while (aIt.hasMoreElements())
-    {
-        uno::Reference< util::XModifyListener > xRef( aIt.next(), 
uno::UNO_QUERY );
-        if (xRef.is())
-            xRef->modified( aEvtObj );
-    }
+        aIt.next()->modified( aEvtObj );
 }
 
 /**
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index 176ecc5f56e6..9b2d96f679ee 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -43,7 +43,7 @@
 #include <sfx2/linkmgr.hxx>
 #include <editsh.hxx>
 #include <viewsh.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <comphelper/string.hxx>
 #include <cppuhelper/supportsservice.hxx>
@@ -405,11 +405,11 @@ class SwXFieldMaster::Impl
     : public SvtListener
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
 
 public:
     uno::WeakReference<uno::XInterface> m_wThis;
-    ::comphelper::OInterfaceContainerHelper2 m_EventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
m_EventListeners;
 
     SwDoc*          m_pDoc;
     SwFieldType* m_pType;
@@ -1085,13 +1085,13 @@ class SwXTextField::Impl
     : public SvtListener
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
     SwFieldType* m_pFieldType;
     SwFormatField* m_pFormatField;
 
 public:
     uno::WeakReference<uno::XInterface> m_wThis;
-    ::comphelper::OInterfaceContainerHelper2 m_EventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
m_EventListeners;
 
     SwDoc* m_pDoc;
     rtl::Reference<SwTextAPIObject> m_xTextObject;
@@ -2828,10 +2828,10 @@ sal_Bool SwXTextFieldMasters::hasElements()
 class SwXTextFieldTypes::Impl
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
 
 public:
-    ::comphelper::OInterfaceContainerHelper2 m_RefreshListeners;
+    ::comphelper::OInterfaceContainerHelper3<util::XRefreshListener> 
m_RefreshListeners;
 
     Impl() : m_RefreshListeners(m_Mutex) { }
 };
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index e4e73fe4460f..cefcd9ae3666 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -109,7 +109,7 @@
 #include <fmtfollowtextflow.hxx>
 #include <fmtwrapinfluenceonobjpos.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <sal/log.hxx>
@@ -1152,11 +1152,11 @@ bool SwOLEProperties_Impl::AnyToItemSet(
 class SwXFrame::Impl
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
 
 public:
     uno::WeakReference<uno::XInterface> m_wThis;
-    ::comphelper::OInterfaceContainerHelper2 m_EventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
m_EventListeners;
 
     Impl() : m_EventListeners(m_Mutex) { }
 };
diff --git a/sw/source/core/unocore/unoftn.cxx 
b/sw/source/core/unocore/unoftn.cxx
index 4e4c95b177d2..c00100d440fc 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -19,7 +19,7 @@
 
 #include <sal/config.h>
 
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <comphelper/sequence.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
@@ -62,14 +62,14 @@ class SwXFootnote::Impl
     : public SvtListener
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
 
 public:
 
     SwXFootnote& m_rThis;
     uno::WeakReference<uno::XInterface> m_wThis;
     const bool m_bIsEndnote;
-    ::comphelper::OInterfaceContainerHelper2 m_EventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
m_EventListeners;
     bool m_bIsDescriptor;
     SwFormatFootnote* m_pFormatFootnote;
     OUString m_sLabel;
diff --git a/sw/source/core/unocore/unoidx.cxx 
b/sw/source/core/unocore/unoidx.cxx
index 5e2e39a49a21..370d41a177d9 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -32,7 +32,7 @@
 
 #include <osl/mutex.hxx>
 #include <cppuhelper/interfacecontainer.h>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <comphelper/multicontainer2.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <tools/UnitConversion.hxx>
@@ -1478,7 +1478,7 @@ lcl_TypeToPropertyMap_Mark(const TOXTypes eType)
 class SwXDocumentIndexMark::Impl final: public SvtListener
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
     SwXDocumentIndexMark & m_rThis;
     bool m_bInReplaceMark;
 
@@ -1487,7 +1487,7 @@ public:
     uno::WeakReference<uno::XInterface> m_wThis;
     SfxItemPropertySet const& m_rPropSet;
     const TOXTypes m_eTOXType;
-    ::comphelper::OInterfaceContainerHelper2 m_EventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
m_EventListeners;
     bool m_bIsDescriptor;
     const SwTOXType* m_pTOXType;
     const SwTOXMark* m_pTOXMark;
diff --git a/sw/source/core/unocore/unoparagraph.cxx 
b/sw/source/core/unocore/unoparagraph.cxx
index 411263562a6c..92ed2214d565 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -19,7 +19,7 @@
 
 #include <unoparagraph.hxx>
 
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <cppuhelper/exc_hlp.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <osl/diagnose.h>
@@ -113,12 +113,12 @@ class SwXParagraph::Impl
     : public SvtListener
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
 
 public:
     SwXParagraph& m_rThis;
     uno::WeakReference<uno::XInterface> m_wThis;
-    ::comphelper::OInterfaceContainerHelper2 m_EventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
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 1bc65943175f..f59ecbedaeb4 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -20,7 +20,7 @@
 #include <memory>
 #include <utility>
 
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <cppuhelper/exc_hlp.hxx>
@@ -64,11 +64,11 @@ class SwXReferenceMark::Impl
     : public SvtListener
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
 
 public:
     uno::WeakReference<uno::XInterface> m_wThis;
-    ::comphelper::OInterfaceContainerHelper2 m_EventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
m_EventListeners;
     bool m_bIsDescriptor;
     SwDoc* m_pDoc;
     const SwFormatRefMark* m_pMarkFormat;
@@ -603,11 +603,11 @@ SwXMetaText::createTextCursorByRange(
 class SwXMeta::Impl : public SvtListener
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
 
 public:
     uno::WeakReference<uno::XInterface> m_wThis;
-    ::comphelper::OInterfaceContainerHelper2 m_EventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
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 116524f89822..b6d58608853e 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -24,7 +24,7 @@
 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
 #include <com/sun/star/text/SectionFileLink.hpp>
 
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <cppuhelper/exc_hlp.hxx>
 #include <cppuhelper/supportsservice.hxx>
 
@@ -110,13 +110,13 @@ class SwXTextSection::Impl
     : public SvtListener
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
 
 public:
     SwXTextSection &            m_rThis;
     uno::WeakReference<uno::XInterface> m_wThis;
     const SfxItemPropertySet &  m_rPropSet;
-    ::comphelper::OInterfaceContainerHelper2 m_EventListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
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 4ce35ed11d4a..d6c24af4065c 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -96,7 +96,7 @@
 #include <sortopt.hxx>
 #include <sal/log.hxx>
 #include <editeng/frmdiritem.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <comphelper/string.hxx>
 #include <cppuhelper/supportsservice.hxx>
@@ -148,7 +148,7 @@ namespace
 
     void lcl_SendChartEvent(
             uno::Reference<uno::XInterface> const& xSource,
-            ::comphelper::OInterfaceContainerHelper2& rListeners)
+            
::comphelper::OInterfaceContainerHelper3<chart::XChartDataChangeEventListener>& 
rListeners)
     {
         rListeners.notifyEach(
                 &chart::XChartDataChangeEventListener::chartDataChanged,
@@ -1905,7 +1905,7 @@ class SwXTextTable::Impl
 {
 private:
     SwFrameFormat* m_pFrameFormat;
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
 
 public:
     uno::WeakReference<uno::XInterface> m_wThis;
@@ -3114,12 +3114,12 @@ class SwXCellRange::Impl
     : public SvtListener
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
     SwFrameFormat* m_pFrameFormat;
 
 public:
     uno::WeakReference<uno::XInterface> m_wThis;
-    ::comphelper::OInterfaceContainerHelper2 m_ChartListeners;
+    
::comphelper::OInterfaceContainerHelper3<chart::XChartDataChangeEventListener> 
m_ChartListeners;
 
     sw::UnoCursorPointer m_pTableCursor;
 
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index 7c9917a83825..8245b420295a 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1369,13 +1369,9 @@ SwPasteContext::~SwPasteContext()
         // Invoke the listeners.
         uno::Sequence<beans::PropertyValue> aEvent{ aPropertyValue };
 
-        comphelper::OInterfaceIteratorHelper2 
it(m_rWrtShell.GetPasteListeners());
+        comphelper::OInterfaceIteratorHelper3 
it(m_rWrtShell.GetPasteListeners());
         while (it.hasMoreElements())
-        {
-            uno::Reference<text::XPasteListener> xListener(it.next(), 
UNO_QUERY);
-            if (xListener.is())
-                xListener->notifyPasteEvent(aEvent);
-        }
+            it.next()->notifyPasteEvent(aEvent);
     }
     catch (const uno::Exception& rException)
     {
diff --git a/sw/source/uibase/inc/unomailmerge.hxx 
b/sw/source/uibase/inc/unomailmerge.hxx
index c94d385adb05..050e99ce806b 100644
--- a/sw/source/uibase/inc/unomailmerge.hxx
+++ b/sw/source/uibase/inc/unomailmerge.hxx
@@ -23,6 +23,7 @@
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/interfacecontainer.hxx>
 #include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <comphelper/multiinterfacecontainer2.hxx>
 
 #include <com/sun/star/task/XJob.hpp>
@@ -76,8 +77,8 @@ class SwXMailMerge final :
 {
     friend class MailMergeExecuteFinalizer;
 
-    comphelper::OInterfaceContainerHelper2     m_aEvtListeners;
-    comphelper::OInterfaceContainerHelper2     m_aMergeListeners;
+    comphelper::OInterfaceContainerHelper3<css::lang::XEventListener>  
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 614f2ac2749d..9608ed619be0 100644
--- a/sw/source/uibase/inc/unotxvw.hxx
+++ b/sw/source/uibase/inc/unotxvw.hxx
@@ -20,7 +20,7 @@
 #define INCLUDED_SW_SOURCE_UIBASE_INC_UNOTXVW_HXX
 
 #include <sfx2/sfxbasecontroller.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <com/sun/star/text/XTextViewCursor.hpp>
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 #include <com/sun/star/text/XTextViewTextRangeSupplier.hpp>
@@ -61,7 +61,7 @@ class SwXTextView final :
     public css::datatransfer::XTransferableTextSupplier,
     public SfxBaseController
 {
-    ::comphelper::OInterfaceContainerHelper2 m_SelChangedListeners;
+    
::comphelper::OInterfaceContainerHelper3<css::view::XSelectionChangeListener> 
m_SelChangedListeners;
 
     SwView*                     m_pView;
     const SfxItemPropertySet*   m_pPropSet;   // property map for SwXTextView 
properties
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 698e31cccdd0..60d5b2b9e4ce 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -259,10 +259,10 @@ static void lcl_DisposeView( SfxViewFrame* pToClose, 
SwDocShell const * pDocShel
 class SwXTextDocument::Impl
 {
 private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
 
 public:
-    ::comphelper::OInterfaceContainerHelper2 m_RefreshListeners;
+    ::comphelper::OInterfaceContainerHelper3<css::util::XRefreshListener> 
m_RefreshListeners;
 
     Impl() : m_RefreshListeners(m_Mutex) { }
 
@@ -2166,14 +2166,16 @@ void SAL_CALL SwXTextDocument::addRefreshListener(
         const Reference<util::XRefreshListener> & xListener)
 {
     // no need to lock here as m_pImpl is const and container threadsafe
-    m_pImpl->m_RefreshListeners.addInterface(xListener);
+    if (xListener)
+        m_pImpl->m_RefreshListeners.addInterface(xListener);
 }
 
 void SAL_CALL SwXTextDocument::removeRefreshListener(
         const Reference<util::XRefreshListener> & xListener)
 {
     // no need to lock here as m_pImpl is const and container threadsafe
-    m_pImpl->m_RefreshListeners.removeInterface(xListener);
+    if (xListener)
+        m_pImpl->m_RefreshListeners.removeInterface(xListener);
 }
 
 void SwXTextDocument::updateLinks(  )
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 7e133b9e78c2..d1636de920e9 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -718,28 +718,18 @@ void SwXTextView::NotifySelChanged()
             &view::XSelectionChangeListener::selectionChanged, aEvent);
 }
 
-namespace {
-    struct DispatchListener
-    {
-        URL const & m_rURL;
-        Sequence<PropertyValue> const& m_rSeq;
-        explicit DispatchListener(URL const& rURL,
-                Sequence<PropertyValue> const& rSeq)
-            : m_rURL(rURL), m_rSeq(rSeq) { }
-        void operator()(uno::Reference<XDispatch> const & xListener) const
-        {
-            xListener->dispatch(m_rURL, m_rSeq);
-        }
-    };
-}
-
 void SwXTextView::NotifyDBChanged()
 {
     URL aURL;
     aURL.Complete = OUString::createFromAscii(SwXDispatch::GetDBChangeURL());
 
-    m_SelChangedListeners.forEach<XDispatch>(
-            DispatchListener(aURL, {}));
+    m_SelChangedListeners.forEach(
+        [&aURL] (const uno::Reference<XSelectionChangeListener>& xListener)
+        {
+            uno::Reference<XDispatch> xDispatch(xListener, UNO_QUERY);
+            if (xDispatch)
+                xDispatch->dispatch(aURL, {});
+        });
 }
 
 uno::Reference< beans::XPropertySetInfo > SAL_CALL 
SwXTextView::getPropertySetInfo(  )

Reply via email to