sw/inc/calbck.hxx                                     |   12 ++--
 sw/inc/deletelistener.hxx                             |    6 +-
 sw/inc/fchrfmt.hxx                                    |    2 
 sw/inc/swevent.hxx                                    |    4 -
 sw/inc/tox.hxx                                        |    2 
 sw/qa/core/uwriter.cxx                                |   14 ++--
 sw/source/core/attr/calbck.cxx                        |   53 ++++++++----------
 sw/source/core/attr/format.cxx                        |   10 +--
 sw/source/core/crsr/callnk.cxx                        |    2 
 sw/source/core/crsr/crsrsh.cxx                        |    4 -
 sw/source/core/doc/docdesc.cxx                        |    2 
 sw/source/core/doc/docfmt.cxx                         |   18 +++---
 sw/source/core/doc/fmtcol.cxx                         |    2 
 sw/source/core/doc/lineinfo.cxx                       |    4 -
 sw/source/core/doc/number.cxx                         |    4 -
 sw/source/core/doc/tblrwcl.cxx                        |    4 -
 sw/source/core/docnode/ndtbl.cxx                      |    4 -
 sw/source/core/docnode/ndtbl1.cxx                     |    4 -
 sw/source/core/docnode/node.cxx                       |    5 +
 sw/source/core/docnode/section.cxx                    |    2 
 sw/source/core/layout/atrfrm.cxx                      |   17 ++---
 sw/source/core/layout/colfrm.cxx                      |    2 
 sw/source/core/layout/ssfrm.cxx                       |    4 -
 sw/source/core/layout/tabfrm.cxx                      |    8 +-
 sw/source/core/layout/wsfrm.cxx                       |    2 
 sw/source/core/para/paratr.cxx                        |    2 
 sw/source/core/table/swtable.cxx                      |   24 ++++----
 sw/source/core/text/txtfrm.cxx                        |    2 
 sw/source/core/tox/tox.cxx                            |    6 +-
 sw/source/core/txtnode/atrfld.cxx                     |   10 +--
 sw/source/core/txtnode/atrtox.cxx                     |    2 
 sw/source/core/txtnode/attrcontentcontrol.cxx         |    2 
 sw/source/core/txtnode/fmtatr2.cxx                    |    2 
 sw/source/core/txtnode/thints.cxx                     |    4 -
 sw/source/core/txtnode/txtatr2.cxx                    |    4 -
 sw/source/core/undo/rolbck.cxx                        |    2 
 sw/source/core/undo/untbl.cxx                         |    2 
 sw/source/filter/ww8/ww8par.cxx                       |    4 -
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |    4 -
 39 files changed, 130 insertions(+), 131 deletions(-)

New commits:
commit b2ab2c862c289d1ab6aabd3de21f4ea45f7a4aed
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Apr 29 14:24:25 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Apr 30 11:16:34 2024 +0200

    SwModify::Add/Remove always derefs arg
    
    an effort to remove C6011 Dereferencing NULL pointer 'pDepend'
    
    Change-Id: If9e7b7be25ece3df60ada09e5c83d03aebe9c535
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166865
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index f4133a2853fa..59a20220da1d 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -198,8 +198,8 @@ public:
 
     virtual ~SwModify() override;
 
-    void Add(SwClient *pDepend);
-    SwClient* Remove(SwClient *pDepend);
+    void Add(SwClient& rDepend);
+    void Remove(SwClient& rDepend);
     bool HasWriterListeners() const { return m_pWriterListeners; }
     bool HasOnlyOneListener() const { return m_pWriterListeners && 
m_pWriterListeners->IsLast(); }
 
@@ -248,7 +248,7 @@ namespace sw
         ListenerEntry& operator=(ListenerEntry&& other) noexcept
         {
             m_pToTell = other.m_pToTell;
-            other.GetRegisteredIn()->Add(this);
+            other.GetRegisteredIn()->Add(*this);
             other.EndListeningAll();
             return *this;
         }
@@ -275,8 +275,8 @@ namespace sw
     };
     class ClientIteratorBase : public sw::Ring< ::sw::ClientIteratorBase >
     {
-            friend SwClient* SwModify::Remove(SwClient*);
-            friend void SwModify::Add(SwClient*);
+            friend void SwModify::Remove(SwClient&);
+            friend void SwModify::Add(SwClient&);
         protected:
             const SwModify& m_rRoot;
             // the current object in an iteration
@@ -424,7 +424,7 @@ SwClient::SwClient( SwModify* pToRegisterIn )
     : m_pRegisteredIn( nullptr )
 {
     if(pToRegisterIn)
-        pToRegisterIn->Add(this);
+        pToRegisterIn->Add(*this);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/deletelistener.hxx b/sw/inc/deletelistener.hxx
index 4d0b142c3561..023e5e638720 100644
--- a/sw/inc/deletelistener.hxx
+++ b/sw/inc/deletelistener.hxx
@@ -25,7 +25,7 @@ private:
         auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
         if (pLegacy->GetWhich() == RES_OBJECTDYING)
         {
-            m_pModify->Remove(this);
+            m_pModify->Remove(*this);
             m_pModify = nullptr;
         }
     }
@@ -34,7 +34,7 @@ public:
     SwDeleteListener(SwModify& rModify)
         : m_pModify(&rModify)
     {
-        m_pModify->Add(this);
+        m_pModify->Add(*this);
     }
 
     bool WasDeleted() const { return !m_pModify; }
@@ -43,7 +43,7 @@ public:
     {
         if (!m_pModify)
             return;
-        m_pModify->Remove(this);
+        m_pModify->Remove(*this);
     }
 };
 
diff --git a/sw/inc/fchrfmt.hxx b/sw/inc/fchrfmt.hxx
index aa9caa0f9b9f..0a937b57e0f2 100644
--- a/sw/inc/fchrfmt.hxx
+++ b/sw/inc/fchrfmt.hxx
@@ -65,7 +65,7 @@ public:
     void SetCharFormat( SwFormat* pFormat )
     {
         assert(!pFormat->IsDefault()); // expose cases that lead to 
use-after-free
-        pFormat->Add(this);
+        pFormat->Add(*this);
     }
     SwCharFormat* GetCharFormat() const { return 
const_cast<SwCharFormat*>(static_cast<const SwCharFormat*>(GetRegisteredIn())); 
}
 
diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx
index 62bd39429a13..11e33ef3ef93 100644
--- a/sw/inc/swevent.hxx
+++ b/sw/inc/swevent.hxx
@@ -85,10 +85,10 @@ struct SwCallMouseEvent final
     }
 
     void Set( SwCallEventObjectType eTyp, const SwFrameFormat* pFormat )
-        { Clear(); eType = eTyp; PTR.pFormat = pFormat; PTR.IMAP.pIMapObj = 
nullptr; assert(pFormat); const_cast<SwFrameFormat*>(pFormat)->Add(this); }
+        { Clear(); eType = eTyp; PTR.pFormat = pFormat; PTR.IMAP.pIMapObj = 
nullptr; assert(pFormat); const_cast<SwFrameFormat*>(pFormat)->Add(*this); }
 
     void Set( const SwFrameFormat* pFormat, const IMapObject* pIMapObj )
-        { Clear(); eType = EVENT_OBJECT_IMAGEMAP; PTR.pFormat = pFormat; 
PTR.IMAP.pIMapObj = pIMapObj; assert(pFormat); 
const_cast<SwFrameFormat*>(pFormat)->Add(this); }
+        { Clear(); eType = EVENT_OBJECT_IMAGEMAP; PTR.pFormat = pFormat; 
PTR.IMAP.pIMapObj = pIMapObj; assert(pFormat); 
const_cast<SwFrameFormat*>(pFormat)->Add(*this); }
 
     void Set( const SwFormatINetFormat* pINetAttr )
         { Clear(); eType = EVENT_OBJECT_INETATTR; PTR.pINetAttr = pINetAttr; 
PTR.IMAP.pIMapObj = nullptr; }
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index bd1c25f50668..bd5e89101341 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -466,7 +466,7 @@ public:
     virtual void SwClientNotify(const SwModify& rMod, const SfxHint& rHint) 
override
     {
         if(dynamic_cast<const sw::DocumentDyingHint*>(&rHint))
-            GetRegisteredIn()->Remove(this);
+            GetRegisteredIn()->Remove(*this);
         else
             SwClient::SwClientNotify(rMod, rHint);
     }
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 8171b318818f..2e8cb307a032 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1671,10 +1671,10 @@ void SwDocTest::testClientModify()
     
CPPUNIT_ASSERT_EQUAL(static_cast<SwModify*>(nullptr),aClient1.GetRegisteredIn());
     
CPPUNIT_ASSERT_EQUAL(static_cast<SwModify*>(nullptr),aClient2.GetRegisteredIn());
     
CPPUNIT_ASSERT_EQUAL(static_cast<SwModify*>(nullptr),aClient2.GetRegisteredIn());
-    aMod.Add(&aClient1);
+    aMod.Add(aClient1);
     CPPUNIT_ASSERT(aMod.HasWriterListeners());
     CPPUNIT_ASSERT(aMod.HasOnlyOneListener());
-    aMod.Add(&aClient2);
+    aMod.Add(aClient2);
     
CPPUNIT_ASSERT_EQUAL(static_cast<SwModify*>(&aMod),aClient1.GetRegisteredIn());
     CPPUNIT_ASSERT_EQUAL(static_cast<SwModify*>(&aMod), 
aClient2.GetRegisteredIn());
     CPPUNIT_ASSERT(aMod.HasWriterListeners());
@@ -1716,7 +1716,7 @@ void SwDocTest::testClientModify()
         }
         CPPUNIT_ASSERT_EQUAL(2,nCount);
     }
-    aMod.Add(&aOtherClient1);
+    aMod.Add(aOtherClient1);
     CPPUNIT_ASSERT_EQUAL(0,aOtherClient1.m_nModifyCount);
     {
         int nCount = 0;
@@ -1729,7 +1729,7 @@ void SwDocTest::testClientModify()
         CPPUNIT_ASSERT_EQUAL(2,nCount);
     }
     CPPUNIT_ASSERT_EQUAL(0,aOtherClient1.m_nModifyCount);
-    aMod.Remove(&aOtherClient1);
+    aMod.Remove(aOtherClient1);
     
CPPUNIT_ASSERT_EQUAL(static_cast<SwModify*>(&aMod),aClient1.GetRegisteredIn());
     
CPPUNIT_ASSERT_EQUAL(static_cast<SwModify*>(&aMod),aClient2.GetRegisteredIn());
     
CPPUNIT_ASSERT_EQUAL(static_cast<SwModify*>(nullptr),aOtherClient1.GetRegisteredIn());
@@ -1739,7 +1739,7 @@ void SwDocTest::testClientModify()
         SwIterator<TestClient,SwModify> aIter(aMod);
         for(TestClient* pClient = aIter.First(); pClient ; pClient = 
aIter.Next())
         {
-            aMod.Remove(pClient);
+            aMod.Remove(*pClient);
             ++nCount;
         }
         CPPUNIT_ASSERT_EQUAL(2,nCount);
@@ -1765,7 +1765,7 @@ void SwDocTest::testBroadcastingModify()
     TestClient aClient;
     TestListener aListener;
 
-    aMod.Add(&aClient);
+    aMod.Add(aClient);
     aListener.StartListening(aMod.GetNotifier());
 
     aMod.CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
@@ -1789,7 +1789,7 @@ void SwDocTest::testWriterMultiListener()
     int nPreDeathChangedCount;
     {
         TestModify aTempMod;
-        aMod.Add(&aTempMod);
+        aMod.Add(aTempMod);
         aMulti.StartListening(&aTempMod);
         nPreDeathChangedCount = aClient.m_nModifyChangedCount;
     }
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index a58cd89baf45..b14b479cc988 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -60,7 +60,7 @@ SwClient::SwClient(SwClient&& o) noexcept
 {
     if(o.m_pRegisteredIn)
     {
-        o.m_pRegisteredIn->Add(this);
+        o.m_pRegisteredIn->Add(*this);
         o.EndListeningAll();
     }
 }
@@ -71,7 +71,7 @@ SwClient::~SwClient()
         DBG_TESTSOLARMUTEX();
     OSL_ENSURE( !m_pRegisteredIn || m_pRegisteredIn->HasWriterListeners(), 
"SwModify still known, but Client already disconnected!" );
     if( m_pRegisteredIn && m_pRegisteredIn->HasWriterListeners() )
-        m_pRegisteredIn->Remove( this );
+        m_pRegisteredIn->Remove(*this);
 }
 
 std::optional<sw::ModifyChangedHint> SwClient::CheckRegistration( const 
SfxPoolItem* pOld )
@@ -94,7 +94,7 @@ std::optional<sw::ModifyChangedHint> 
SwClient::CheckRegistration( const SfxPoolI
     {
         // if the dying object itself was listening at an SwModify, I take over
         // adding myself to pAbove will automatically remove me from my 
current pRegisteredIn
-        pAbove->Add(this);
+        pAbove->Add(*this);
     }
     else
     {
@@ -110,7 +110,7 @@ void SwClient::CheckRegistrationFormat(SwFormat& rOld)
     auto pNew = rOld.DerivedFrom();
     SAL_INFO("sw.core", "reparenting " << typeid(*this).name() << " at " << 
this << " from " << typeid(rOld).name() << " at " << &rOld << " to "  << 
typeid(*pNew).name() << " at " << pNew);
     assert(pNew);
-    pNew->Add(this);
+    pNew->Add(*this);
     const SwFormatChg aOldFormat(&rOld);
     const SwFormatChg aNewFormat(pNew);
     const sw::LegacyModifyHint aHint(&aOldFormat, &aNewFormat);
@@ -128,7 +128,7 @@ void SwClient::SwClientNotify(const SwModify&, const 
SfxHint& rHint)
 void SwClient::StartListeningToSameModifyAs(const SwClient& other)
 {
     if(other.m_pRegisteredIn)
-        other.m_pRegisteredIn->Add(this);
+        other.m_pRegisteredIn->Add(*this);
     else
         EndListeningAll();
 }
@@ -136,7 +136,7 @@ void SwClient::StartListeningToSameModifyAs(const SwClient& 
other)
 void SwClient::EndListeningAll()
 {
     if(m_pRegisteredIn)
-        m_pRegisteredIn->Remove(this);
+        m_pRegisteredIn->Remove(*this);
 }
 
 SwModify::~SwModify()
@@ -169,7 +169,7 @@ bool SwModify::GetInfo( SfxPoolItem& rInfo ) const
     return true;
 }
 
-void SwModify::Add( SwClient* pDepend )
+void SwModify::Add(SwClient& rDepend)
 {
     DBG_TESTSOLARMUTEX();
 #ifdef DBG_UTIL
@@ -185,44 +185,44 @@ void SwModify::Add( SwClient* pDepend )
     }
 #endif
 
-    if(pDepend->m_pRegisteredIn == this)
+    if (rDepend.m_pRegisteredIn == this)
         return;
 
     // deregister new client in case it is already registered elsewhere
-    if( pDepend->m_pRegisteredIn != nullptr )
-        pDepend->m_pRegisteredIn->Remove( pDepend );
+    if( rDepend.m_pRegisteredIn != nullptr )
+        rDepend.m_pRegisteredIn->Remove(rDepend);
 
     if( !m_pWriterListeners )
     {
         // first client added
-        m_pWriterListeners = pDepend;
+        m_pWriterListeners = &rDepend;
         m_pWriterListeners->m_pLeft = nullptr;
         m_pWriterListeners->m_pRight = nullptr;
     }
     else
     {
         // append client
-        pDepend->m_pRight = m_pWriterListeners->m_pRight;
-        m_pWriterListeners->m_pRight = pDepend;
-        pDepend->m_pLeft = m_pWriterListeners;
-        if( pDepend->m_pRight )
-            pDepend->m_pRight->m_pLeft = pDepend;
+        rDepend.m_pRight = m_pWriterListeners->m_pRight;
+        m_pWriterListeners->m_pRight = &rDepend;
+        rDepend.m_pLeft = m_pWriterListeners;
+        if( rDepend.m_pRight )
+            rDepend.m_pRight->m_pLeft = &rDepend;
     }
 
     // connect client to me
-    pDepend->m_pRegisteredIn = this;
+    rDepend.m_pRegisteredIn = this;
 }
 
-SwClient* SwModify::Remove( SwClient* pDepend )
+void SwModify::Remove(SwClient& rDepend)
 {
     DBG_TESTSOLARMUTEX();
-    assert(pDepend->m_pRegisteredIn == this);
+    assert(rDepend.m_pRegisteredIn == this);
 
     // SwClient is my listener
     // remove it from my list
-    ::sw::WriterListener* pR = pDepend->m_pRight;
-    ::sw::WriterListener* pL = pDepend->m_pLeft;
-    if( m_pWriterListeners == pDepend )
+    ::sw::WriterListener* pR = rDepend.m_pRight;
+    ::sw::WriterListener* pL = rDepend.m_pLeft;
+    if( m_pWriterListeners == &rDepend )
         m_pWriterListeners = pL ? pL : pR;
 
     if( pL )
@@ -236,7 +236,7 @@ SwClient* SwModify::Remove( SwClient* pDepend )
         for(auto& rIter : 
sw::ClientIteratorBase::s_pClientIters->GetRingContainer())
         {
             if (&rIter.m_rRoot == this &&
-                (rIter.m_pCurrent == pDepend || rIter.m_pPosition == pDepend))
+                (rIter.m_pCurrent == &rDepend || rIter.m_pPosition == 
&rDepend))
             {
                 // if object being removed is the current or next object in an
                 // iterator, advance this iterator
@@ -244,10 +244,9 @@ SwClient* SwModify::Remove( SwClient* pDepend )
             }
         }
     }
-    pDepend->m_pLeft = nullptr;
-    pDepend->m_pRight = nullptr;
-    pDepend->m_pRegisteredIn = nullptr;
-    return pDepend;
+    rDepend.m_pLeft = nullptr;
+    rDepend.m_pRight = nullptr;
+    rDepend.m_pRegisteredIn = nullptr;
 }
 
 sw::WriterMultiListener::WriterMultiListener(SwClient& rToTell)
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index fb03edef251b..bcc8920cce73 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -52,7 +52,7 @@ SwFormat::SwFormat( SwAttrPool& rPool, const char* pFormatNm,
 
     if( pDrvdFrame )
     {
-        pDrvdFrame->Add(this);
+        pDrvdFrame->Add(*this);
         m_aSet.SetParent( &pDrvdFrame->m_aSet );
     }
 }
@@ -73,7 +73,7 @@ SwFormat::SwFormat( SwAttrPool& rPool, OUString aFormatNm,
 
     if( pDrvdFrame )
     {
-        pDrvdFrame->Add(this);
+        pDrvdFrame->Add(*this);
         m_aSet.SetParent( &pDrvdFrame->m_aSet );
     }
 }
@@ -94,7 +94,7 @@ SwFormat::SwFormat( const SwFormat& rFormat ) :
 
     if( auto pDerived = rFormat.DerivedFrom() )
     {
-        pDerived->Add(this);
+        pDerived->Add(*this);
         m_aSet.SetParent( &pDerived->m_aSet );
     }
     // a few special treatments for attributes
@@ -257,7 +257,7 @@ void SwFormat::SwClientNotify(const SwModify&, const 
SfxHint& rHint)
                 if(pFormat->GetRegisteredIn())
                 {
                     // if parent so register in new parent
-                    pFormat->DerivedFrom()->Add(this);
+                    pFormat->DerivedFrom()->Add(*this);
                     m_aSet.SetParent(&DerivedFrom()->m_aSet);
                 }
                 else
@@ -354,7 +354,7 @@ bool SwFormat::SetDerivedFrom(SwFormat *pDerFrom)
     InvalidateInSwCache(RES_ATTRSET_CHG);
     InvalidateInSwFntCache(RES_ATTRSET_CHG);
 
-    pDerFrom->Add( this );
+    pDerFrom->Add(*this);
     m_aSet.SetParent( &pDerFrom->m_aSet );
 
     SwFormatChg aOldFormat( this );
diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx
index e3f08add1e30..4127006b1bed 100644
--- a/sw/source/core/crsr/callnk.cxx
+++ b/sw/source/core/crsr/callnk.cxx
@@ -136,7 +136,7 @@ void SwCallLink::ImplDestroy()
 
     // Register the Shell as dependent at the current Node. By doing this all
     // attribute changes can be signaled over the link.
-    pCNd->Add( &m_rShell );
+    pCNd->Add(m_rShell);
 
     const bool bCurrentHasSelection = (*pCurrentCursor->GetPoint() != 
*pCurrentCursor->GetMark());
 
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 58aa478d4d43..58396b6f2890 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3310,7 +3310,7 @@ SwCursorShell::SwCursorShell( SwCursorShell& rShell, 
vcl::Window *pInitWin )
     CurrShell aCurr( this );
     // only keep the position of the current cursor of the copy shell
     m_pCurrentCursor = new SwShellCursor( *this, 
*(rShell.m_pCurrentCursor->GetPoint()) );
-    m_pCurrentCursor->GetPointContentNode()->Add( this );
+    m_pCurrentCursor->GetPointContentNode()->Add(*this);
 
     m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd =
     m_bGCAttr = m_bIgnoreReadonly = m_bSelTableCells = m_bBasicHideCursor =
@@ -3355,7 +3355,7 @@ SwCursorShell::SwCursorShell( SwDoc& rDoc, vcl::Window 
*pInitWin,
 
     // Register shell as dependent at current node. As a result all attribute
     // changes can be forwarded via the Link.
-    pCNd->Add( this );
+    pCNd->Add(*this);
 
     m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd =
     m_bGCAttr = m_bIgnoreReadonly = m_bSelTableCells = m_bBasicHideCursor =
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index fc9a104d8c9d..a8e803957bc6 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -461,7 +461,7 @@ void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged 
)
             auto lDelHFFormat = [this](SwClient* pToRemove, SwFrameFormat* 
pFormat)
             {
                 // Code taken from lcl_DelHFFormat
-                pFormat->Remove(pToRemove);
+                pFormat->Remove(*pToRemove);
                 SwFormatContent& rCnt = 
const_cast<SwFormatContent&>(pFormat->GetContent());
                 if (rCnt.GetContentIdx())
                 {
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index a5c1e4c29c55..5c77223c8538 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -574,29 +574,29 @@ void SwDoc::SetDefault( const SfxItemSet& rSet )
 
         if (isCHRATR(nWhich) || isTXTATR(nWhich))
         {
-            aCallMod.Add( mpDfltTextFormatColl.get() );
-            aCallMod.Add( mpDfltCharFormat.get() );
+            aCallMod.Add(*mpDfltTextFormatColl);
+            aCallMod.Add(*mpDfltCharFormat);
             bCheckSdrDflt = nullptr != pSdrPool;
         }
         else if ( isPARATR(nWhich) ||
                   isPARATR_LIST(nWhich) )
         {
-            aCallMod.Add( mpDfltTextFormatColl.get() );
+            aCallMod.Add(*mpDfltTextFormatColl);
             bCheckSdrDflt = nullptr != pSdrPool;
         }
         else if (isGRFATR(nWhich))
         {
-            aCallMod.Add( mpDfltGrfFormatColl.get() );
+            aCallMod.Add(*mpDfltGrfFormatColl);
         }
         else if (isFRMATR(nWhich) || isDrawingLayerAttribute(nWhich) )
         {
-            aCallMod.Add( mpDfltGrfFormatColl.get() );
-            aCallMod.Add( mpDfltTextFormatColl.get() );
-            aCallMod.Add( mpDfltFrameFormat.get() );
+            aCallMod.Add(*mpDfltGrfFormatColl);
+            aCallMod.Add(*mpDfltTextFormatColl);
+            aCallMod.Add(*mpDfltFrameFormat);
         }
         else if (isBOXATR(nWhich))
         {
-            aCallMod.Add( mpDfltFrameFormat.get() );
+            aCallMod.Add(*mpDfltFrameFormat);
         }
 
         // also copy the defaults
@@ -670,7 +670,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet )
     // remove the default formats from the object again
     SwIterator<SwClient, sw::BroadcastingModify> aClientIter(aCallMod);
     for(SwClient* pClient = aClientIter.First(); pClient; pClient = 
aClientIter.Next())
-        aCallMod.Remove( pClient );
+        aCallMod.Remove(*pClient);
 
     getIDocumentState().SetModified();
 }
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 02f2cb5bc2fd..96274bb5b5d3 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -595,7 +595,7 @@ SwCollCondition::~SwCollCondition()
 
 void SwCollCondition::RegisterToFormat( SwFormat& rFormat )
 {
-    rFormat.Add( this );
+    rFormat.Add(*this);
 }
 
 bool SwCollCondition::operator==( const SwCollCondition& rCmp ) const
diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx
index 628e90e32198..94d2b02bd72a 100644
--- a/sw/source/core/doc/lineinfo.cxx
+++ b/sw/source/core/doc/lineinfo.cxx
@@ -101,7 +101,7 @@ SwCharFormat* SwLineNumberInfo::GetCharFormat( 
IDocumentStylePoolAccess& rIDSPA
     if ( !GetRegisteredIn() )
     {
         SwCharFormat* pFormat = rIDSPA.GetCharFormatFromPool( 
RES_POOLCHR_LINENUM );
-        pFormat->Add( const_cast<SwLineNumberInfo*>(this) );
+        pFormat->Add(const_cast<SwLineNumberInfo&>(*this));
     }
     return const_cast<SwCharFormat*>(static_cast<const 
SwCharFormat*>(GetRegisteredIn()));
 }
@@ -109,7 +109,7 @@ SwCharFormat* SwLineNumberInfo::GetCharFormat( 
IDocumentStylePoolAccess& rIDSPA
 void SwLineNumberInfo::SetCharFormat( SwCharFormat *pChFormat )
 {
     OSL_ENSURE( pChFormat, "SetCharFormat, 0 is not a valid pointer" );
-    pChFormat->Add( this );
+    pChFormat->Add(*this);
 }
 
 void SwLineNumberInfo::SwClientNotify(const SwModify&, const SfxHint& rHint)
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index b842c9e9a391..c92d2af29a7d 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -230,7 +230,7 @@ SwNumFormat::SwNumFormat(const SvxNumberFormat& rNumFormat, 
SwDoc* pDoc)
                         ? 
pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool( nId )
                         : pDoc->MakeCharFormat( rCharStyleName, nullptr );
         }
-        pCFormat->Add( this );
+        pCFormat->Add(*this);
     }
     else
         EndListeningAll();
@@ -288,7 +288,7 @@ bool SwNumFormat::operator==( const SwNumFormat& 
rNumFormat) const
 void SwNumFormat::SetCharFormat( SwCharFormat* pChFormat)
 {
     if( pChFormat )
-        pChFormat->Add( this );
+        pChFormat->Add(*this);
     else
         EndListeningAll();
 }
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 8d3f9d5562b2..bdc3de520976 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -3272,13 +3272,13 @@ void SwShareBoxFormats::ChangeFrameFormat( SwTableBox* 
pBox, SwTableLine* pLn,
     if( pBox )
     {
         pOld = pBox->GetFrameFormat();
-        pOld->Add( &aCl );
+        pOld->Add(aCl);
         pBox->ChgFrameFormat( static_cast<SwTableBoxFormat*>(&rFormat) );
     }
     else if( pLn )
     {
         pOld = pLn->GetFrameFormat();
-        pOld->Add( &aCl );
+        pOld->Add(aCl);
         pLn->ChgFrameFormat( static_cast<SwTableLineFormat*>(&rFormat) );
     }
     if( pOld && pOld->HasOnlyOneListener() )
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 7cb12d996ef9..509a3d18340c 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1007,7 +1007,7 @@ lcl_SetTableBoxWidths(SwTable & rTable, size_t const 
nMaxBoxes,
             {
                 // Have to do an Add here, because the BoxFormat
                 // is still needed by the caller
-                pNewFormat->Add( rLns[ nTmpLine ]->GetTabBoxes()[ n ] );
+                pNewFormat->Add(*rLns[nTmpLine]->GetTabBoxes()[n]);
             }
 
             nLastPos = (*pPositions)[ n ];
@@ -1379,7 +1379,7 @@ lcl_SetTableBoxWidths2(SwTable & rTable, size_t const 
nMaxBoxes,
             size_t nWidth = nMaxBoxes ? USHRT_MAX / nMaxBoxes : USHRT_MAX;
             pNewFormat->SetFormatAttr( SwFormatFrameSize(SwFrameSize::Variable,
                         nWidth * (nMissing + 1)) );
-            pNewFormat->Add(rBoxes.back());
+            pNewFormat->Add(*rBoxes.back());
         }
     }
     size_t nWidth = nMaxBoxes ? USHRT_MAX / nMaxBoxes : USHRT_MAX;
diff --git a/sw/source/core/docnode/ndtbl1.cxx 
b/sw/source/core/docnode/ndtbl1.cxx
index 49b93463a429..0dd89a1541e9 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -90,14 +90,14 @@ SwTableFormatCmp::SwTableFormatCmp(SwFrameFormat* pO, 
SwFrameFormat* pN, sal_Int
     , m_nType(nT)
 {
     if (m_pOld)
-        m_pOld->Add(this);
+        m_pOld->Add(*this);
 }
 
 SwTableFormatCmp::~SwTableFormatCmp()
 {
     if (m_pOld)
     {
-        m_pOld->Remove(this);
+        m_pOld->Remove(*this);
         if (!m_pOld->HasWriterListeners())
             delete m_pOld;
     }
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index bdabf7726a5e..a762565ccfda 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1080,7 +1080,7 @@ SwContentNode::SwContentNode( const SwNode& rWhere, const 
SwNodeType nNdType,
     , mbSetModifyAtAttr( false )
 {
     if(pColl)
-        pColl->Add(this);
+        pColl->Add(*this);
 }
 
 SwContentNode::~SwContentNode()
@@ -1099,6 +1099,7 @@ SwContentNode::~SwContentNode()
         const_cast<SwAttrSet*>(mpAttrSet.get())->SetModifyAtAttr( nullptr );
     InvalidateInSwCache(RES_OBJECTDYING);
 }
+
 void SwContentNode::UpdateAttr(const SwUpdateAttr& rUpdate)
 {
     if (GetNodes().IsDocNodes()
@@ -1255,7 +1256,7 @@ SwFormatColl *SwContentNode::ChgFormatColl( SwFormatColl 
*pNewColl )
 
     if( pNewColl != pOldColl )
     {
-        pNewColl->Add( this );
+        pNewColl->Add(*this);
 
         // Set the Parent of out AutoAttributes to the new Collection
         if( GetpSwAttrSet() )
diff --git a/sw/source/core/docnode/section.cxx 
b/sw/source/core/docnode/section.cxx
index dd3dcdb9e98c..fce8e27ec3ce 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -223,7 +223,7 @@ SwSection::~SwSection()
     }
     else
     {
-        pFormat->Remove( this ); // remove
+        pFormat->Remove(*this); // remove
         SvtListener::EndListeningAll();
 
         if (SectionType::Content != m_Data.GetType())
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 663da028cb15..3a4941187511 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -151,7 +151,7 @@ static void lcl_DelHFFormat( SwClient *pToRemove, 
SwFrameFormat *pFormat )
     //If the client is the last one who uses this format, then we have to 
delete
     //it - before this is done, we may need to delete the content-section.
     SwDoc* pDoc = pFormat->GetDoc();
-    pFormat->Remove( pToRemove );
+    pFormat->Remove(*pToRemove);
     if( pDoc->IsInDtor() )
     {
         delete pFormat;
@@ -527,7 +527,7 @@ SwFormatHeader* SwFormatHeader::Clone( SfxItemPool* ) const
 
 void SwFormatHeader::RegisterToFormat( SwFormat& rFormat )
 {
-    rFormat.Add(this);
+    rFormat.Add(*this);
 }
 
 // Partially implemented inline in hxx
@@ -560,7 +560,7 @@ SwFormatFooter::SwFormatFooter( bool bOn )
 
 void SwFormatFooter::RegisterToFormat( SwFormat& rFormat )
 {
-    rFormat.Add(this);
+    rFormat.Add(*this);
 }
 
 bool SwFormatFooter::operator==( const SfxPoolItem& rAttr ) const
@@ -722,7 +722,7 @@ void SwFormatPageDesc::SwClientNotify(const SwModify&, 
const SfxHint& rHint)
 
 void SwFormatPageDesc::RegisterToPageDesc( SwPageDesc& rDesc )
 {
-    rDesc.Add( this );
+    rDesc.Add(*this);
 }
 
 bool SwFormatPageDesc::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
@@ -2183,7 +2183,7 @@ SwFormatChain* SwFormatChain::Clone( SfxItemPool* ) const
 void SwFormatChain::SetPrev( SwFlyFrameFormat *pFormat )
 {
     if ( pFormat )
-        pFormat->Add( &m_aPrev );
+        pFormat->Add(m_aPrev);
     else
         m_aPrev.EndListeningAll();
 }
@@ -2191,7 +2191,7 @@ void SwFormatChain::SetPrev( SwFlyFrameFormat *pFormat )
 void SwFormatChain::SetNext( SwFlyFrameFormat *pFormat )
 {
     if ( pFormat )
-        pFormat->Add( &m_aNext );
+        pFormat->Add(m_aNext);
     else
         m_aNext.EndListeningAll();
 }
@@ -2760,7 +2760,7 @@ void SwFrameFormat::SwClientNotify(const SwModify& rMod, 
const SfxHint& rHint)
 
 void SwFrameFormat::RegisterToFormat( SwFormat& rFormat )
 {
-    rFormat.Add( this );
+    rFormat.Add(*this);
 }
 
 /// Delete all Frames that are registered in aDepend.
@@ -3664,7 +3664,7 @@ drawinglayer::attribute::SdrAllFillAttributesHelperPtr 
SwFrameFormat::getSdrAllF
 
 void SwFrameFormat::MoveTableBox(SwTableBox& rTableBox, const SwFrameFormat* 
pOldFormat)
 {
-    Add(&rTableBox);
+    Add(rTableBox);
     if(!pOldFormat)
         return;
     const auto& rOld = pOldFormat->GetFormatAttr(RES_BOXATR_FORMAT);
@@ -3673,7 +3673,6 @@ void SwFrameFormat::MoveTableBox(SwTableBox& rTableBox, 
const SwFrameFormat* pOl
         SwClientNotify(*this, sw::LegacyModifyHint(&rOld, &rNew));
 }
 
-
 bool SwFrameFormat::IsVisible() const
 {
     return SwIterator<SwFrame, SwFrameFormat>(*this).First();
diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx
index 872bdc44aef1..9847464b0758 100644
--- a/sw/source/core/layout/colfrm.cxx
+++ b/sw/source/core/layout/colfrm.cxx
@@ -54,7 +54,7 @@ void SwColumnFrame::DestroyImpl()
     {
         //I'm the only one, delete the format.
         //Get default format before, so the base class can cope with it.
-        pDoc->GetDfltFrameFormat()->Add( this );
+        pDoc->GetDfltFrameFormat()->Add(*this);
         // tdf#134009, like #i32968# avoid SwUndoFrameFormatDelete creation,
         // the format is owned by the SwColumnFrame, see lcl_AddColumns()
         ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index c36a7de33e5f..0c4934cdb495 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -413,7 +413,7 @@ void SwLayoutFrame::SetFrameFormat(SwFrameFormat* pNew)
     if(pNew == GetFormat())
         return;
     const SwFormatChg aOldFormat(GetFormat());
-    pNew->Add(this);
+    pNew->Add(*this);
     const SwFormatChg aNewFormat(pNew);
     SwClientNotify(*pNew, sw::LegacyModifyHint(&aOldFormat, &aNewFormat));
 }
@@ -480,7 +480,7 @@ void SwTextFrame::RegisterToNode(SwTextNode & rNode, bool 
const isForceNodeAsFir
     m_pMergedPara = sw::CheckParaRedlineMerge(*this, rFirstNode, 
sw::FrameMode::New);
     if (!m_pMergedPara)
     {
-        rNode.Add(this);
+        rNode.Add(*this);
     }
 }
 
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index e8ec84faad83..41ea720609b1 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -4411,7 +4411,7 @@ void SwRowFrame::DestroyImpl()
     sw::BroadcastingModify* pMod = GetFormat();
     if( pMod )
     {
-        pMod->Remove( this );
+        pMod->Remove(*this);
         if( !pMod->HasWriterListeners() )
             delete pMod;
     }
@@ -4479,7 +4479,7 @@ void SwRowFrame::SwClientNotify(const SwModify& rModify, 
const SfxHint& rHint)
 
         if(GetTabLine() != &pMoveTableLineHint->m_rTableLine)
             return;
-        
const_cast<SwFrameFormat*>(&pMoveTableLineHint->m_rNewFormat)->Add(this);
+        
const_cast<SwFrameFormat*>(&pMoveTableLineHint->m_rNewFormat)->Add(*this);
         InvalidateAll();
         ReinitializeFrameSizeAttrFlags();
         return;
@@ -5508,7 +5508,7 @@ void SwCellFrame::DestroyImpl()
         }
 #endif
 
-        pMod->Remove( this );
+        pMod->Remove(*this);
         if( !pMod->HasWriterListeners() )
             delete pMod;
     }
@@ -6059,7 +6059,7 @@ void SwCellFrame::SwClientNotify(const SwModify& rMod, 
const SfxHint& rHint)
     {
         if(GetTabBox() != &pMoveTableBoxHint->m_rTableBox)
             return;
-        
const_cast<SwFrameFormat*>(&pMoveTableBoxHint->m_rNewFormat)->Add(this);
+        
const_cast<SwFrameFormat*>(&pMoveTableBoxHint->m_rNewFormat)->Add(*this);
         InvalidateAll();
         ReinitializeFrameSizeAttrFlags();
         SetDerivedVert(false);
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 28c3238b16d6..cab4f4e48ef8 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -367,7 +367,7 @@ bool SwFrame::KnowsFormat( const SwFormat& rFormat ) const
 
 void SwFrame::RegisterToFormat( SwFormat& rFormat )
 {
-    rFormat.Add( this );
+    rFormat.Add(*this);
 }
 
 void SwFrame::CheckDir( SvxFrameDirection nDir, bool bVert, bool bOnlyBiDi, 
bool bBrowse )
diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx
index 2c8aa82ecf8a..a2e30f0c8a31 100644
--- a/sw/source/core/para/paratr.cxx
+++ b/sw/source/core/para/paratr.cxx
@@ -69,7 +69,7 @@ void SwFormatDrop::SetCharFormat( SwCharFormat *pNew )
     // Rewire
     EndListeningAll();
     if(pNew)
-        pNew->Add( this );
+        pNew->Add(*this);
 }
 
 bool SwFormatDrop::GetInfo( SfxPoolItem& ) const
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 53ab9bbc465b..38314d25ecf6 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -229,7 +229,7 @@ SwTable::~SwTable()
 
     // the table can be deleted if it's the last client of the FrameFormat
     SwTableFormat* pFormat = GetFrameFormat();
-    pFormat->Remove( this );               // remove
+    pFormat->Remove(*this);               // remove
 
     if( !pFormat->HasWriterListeners() )
         pFormat->GetDoc()->DelTableFrameFormat( pFormat );   // and delete
@@ -1479,7 +1479,7 @@ SwTableLine::~SwTableLine()
     }
     // the TabelleLine can be deleted if it's the last client of the 
FrameFormat
     sw::BroadcastingModify* pMod = GetFrameFormat();
-    pMod->Remove( this );               // remove,
+    pMod->Remove(*this);               // remove,
     if( !pMod->HasWriterListeners() )
         delete pMod;    // and delete
 }
@@ -1508,7 +1508,7 @@ SwFrameFormat* SwTableLine::ClaimFrameFormat()
                     pFrame->RegisterToFormat( *pNewFormat );
 
             // register myself
-            pNewFormat->Add( this );
+            pNewFormat->Add(*this);
             pRet = pNewFormat;
             break;
         }
@@ -1522,7 +1522,7 @@ void SwTableLine::ChgFrameFormat(SwTableLineFormat* 
pNewFormat)
     auto pOld = GetFrameFormat();
     pOld->CallSwClientNotify(sw::TableLineFormatChanged(*pNewFormat, *this));
     // Now, re-register self.
-    pNewFormat->Add(this);
+    pNewFormat->Add(*this);
     if(!pOld->HasWriterListeners())
         delete pOld;
 }
@@ -2021,7 +2021,7 @@ SwTableBox::SwTableBox( SwTableBoxFormat* pFormat, 
sal_uInt16 nLines, SwTableLin
     , mbDirectFormatting(false)
 {
     m_aLines.reserve( nLines );
-    CheckBoxFormat( pFormat )->Add( this );
+    CheckBoxFormat( pFormat )->Add(*this);
 }
 
 SwTableBox::SwTableBox( SwTableBoxFormat* pFormat, const SwNodeIndex &rIdx,
@@ -2033,7 +2033,7 @@ SwTableBox::SwTableBox( SwTableBoxFormat* pFormat, const 
SwNodeIndex &rIdx,
     , mbDummyFlag(false)
     , mbDirectFormatting(false)
 {
-    CheckBoxFormat( pFormat )->Add( this );
+    CheckBoxFormat( pFormat )->Add(*this);
 
     m_pStartNode = rIdx.GetNode().GetStartNode();
 
@@ -2055,7 +2055,7 @@ SwTableBox::SwTableBox( SwTableBoxFormat* pFormat, const 
SwStartNode& rSttNd, Sw
     , mbDummyFlag(false)
     , mbDirectFormatting(false)
 {
-    CheckBoxFormat( pFormat )->Add( this );
+    CheckBoxFormat( pFormat )->Add(*this);
 
     // insert into the table
     const SwTableNode* pTableNd = m_pStartNode->FindTableNode();
@@ -2090,7 +2090,7 @@ SwTableBox::~SwTableBox()
 
     // the TabelleBox can be deleted if it's the last client of the FrameFormat
     sw::BroadcastingModify* pMod = GetFrameFormat();
-    pMod->Remove( this );               // remove,
+    pMod->Remove(*this);               // remove,
     if( !pMod->HasWriterListeners() )
         delete pMod;    // and delete
 }
@@ -2147,7 +2147,7 @@ SwFrameFormat* SwTableBox::ClaimFrameFormat()
                     pCell->RegisterToFormat( *pNewFormat );
 
             // re-register myself
-            pNewFormat->Add( this );
+            pNewFormat->Add(*this);
             pRet = pNewFormat;
             break;
         }
@@ -2164,7 +2164,7 @@ void SwTableBox::ChgFrameFormat(SwTableBoxFormat* 
pNewFormat, bool bNeedToReregi
     if(bNeedToReregister)
         pOld->CallSwClientNotify(sw::TableBoxFormatChanged(*pNewFormat, 
*this));
     // Now, re-register self.
-    pNewFormat->Add(this);
+    pNewFormat->Add(*this);
     if(!pOld->HasWriterListeners())
         delete pOld;
 }
@@ -3224,7 +3224,7 @@ const SwTableBox * SwTableCellInfo::getTableBox() const
 
 void SwTable::RegisterToFormat( SwFormat& rFormat )
 {
-    rFormat.Add( this );
+    rFormat.Add(*this);
 }
 
 bool SwTable::HasLayout() const
@@ -3236,7 +3236,7 @@ bool SwTable::HasLayout() const
 
 void SwTableBox::RegisterToFormat( SwFormat& rFormat )
 {
-    rFormat.Add( this );
+    rFormat.Add(*this);
 }
 
 // free's any remaining child objects
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 4ce78faf1e4f..8e5a1a904b80 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1400,7 +1400,7 @@ void 
SwTextFrame::SetMergedPara(std::unique_ptr<sw::MergedPara> p)
         }
         else
         {
-            pFirst->Add(this); // must register at node again
+            pFirst->Add(*this); // must register at node again
         }
     }
     // postcondition: frame must be listening somewhere
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index bdbe4ae8cbb5..ef38ff3a17b6 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -240,7 +240,7 @@ SwTOXType::SwTOXType(const SwTOXType& rCopy)
     , m_eType(rCopy.m_eType)
 {
     if (auto pRegisteredIn = const_cast<SwTOXType&>(rCopy).GetRegisteredIn())
-        pRegisteredIn->Add(this);
+        pRegisteredIn->Add(*this);
 }
 
 const TranslateId STR_POOLCOLL_TOX_ARY[] =
@@ -571,7 +571,7 @@ SwTOXBase::SwTOXBase( const SwTOXBase& rSource, SwDoc* pDoc 
)
 
 void SwTOXBase::RegisterToTOXType( SwTOXType& rType )
 {
-    rType.Add( this );
+    rType.Add(*this);
 }
 
 void SwTOXBase::CopyTOXBase( SwDoc* pDoc, const SwTOXBase& rSource )
@@ -601,7 +601,7 @@ void SwTOXBase::CopyTOXBase( SwDoc* pDoc, const SwTOXBase& 
rSource )
         if( !bFound )
             pType = const_cast<SwTOXType*>(pDoc->InsertTOXType( *pType ));
     }
-    pType->Add( this );
+    pType->Add(*this);
 
     m_nCreateType = rSource.m_nCreateType;
     m_aTitle      = rSource.m_aTitle;
diff --git a/sw/source/core/txtnode/atrfld.cxx 
b/sw/source/core/txtnode/atrfld.cxx
index 5907e5014298..c967a95ee22f 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -60,7 +60,7 @@ SwFormatField::SwFormatField( const SwField &rField )
     , mpTextField( nullptr )
 {
     setNonShareable();
-    rField.GetTyp()->Add(this);
+    rField.GetTyp()->Add(*this);
     if ( mpField->GetTyp()->Which() == SwFieldIds::Input )
     {
         // input field in-place editing
@@ -101,7 +101,7 @@ SwFormatField::SwFormatField( const SwFormatField& rAttr )
     if ( !rAttr.mpField )
         return;
 
-    rAttr.mpField->GetTyp()->Add(this);
+    rAttr.mpField->GetTyp()->Add(*this);
     mpField = rAttr.mpField->CopyField();
     if ( mpField->GetTyp()->Which() == SwFieldIds::Input )
     {
@@ -165,14 +165,14 @@ SwFormatField::~SwFormatField()
     if( bDel )
     {
         // unregister before deleting
-        pType->Remove( this );
+        pType->Remove(*this);
         delete pType;
     }
 }
 
 void SwFormatField::RegisterToFieldType( SwFieldType& rType )
 {
-    rType.Add(this);
+    rType.Add(*this);
 }
 
 void SwFormatField::SetField(std::unique_ptr<SwField> _pField)
@@ -601,7 +601,7 @@ void SwTextField::CopyTextField( SwTextField *pDest ) const
         }
 
         OSL_ENSURE( pFieldType, "unknown FieldType" );
-        pFieldType->Add( &rDestFormatField ); // register at the field type
+        pFieldType->Add(rDestFormatField); // register at the field type
         rDestFormatField.GetField()->ChgTyp( pFieldType );
     }
 
diff --git a/sw/source/core/txtnode/atrtox.cxx 
b/sw/source/core/txtnode/atrtox.cxx
index a18e35a28db2..17093db9be0b 100644
--- a/sw/source/core/txtnode/atrtox.cxx
+++ b/sw/source/core/txtnode/atrtox.cxx
@@ -87,7 +87,7 @@ void SwTextTOXMark::CopyTOXMark( SwDoc& rDoc )
     }
 
     // register at target tox type
-    const_cast<SwTOXType*>(pType)->Add( &rTOX );
+    const_cast<SwTOXType*>(pType)->Add(rTOX);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/attrcontentcontrol.cxx 
b/sw/source/core/txtnode/attrcontentcontrol.cxx
index 6f8e7fa3511c..29b27baf77d0 100644
--- a/sw/source/core/txtnode/attrcontentcontrol.cxx
+++ b/sw/source/core/txtnode/attrcontentcontrol.cxx
@@ -247,7 +247,7 @@ void SwContentControl::NotifyChangeTextNode(SwTextNode* 
pTextNode)
     m_pTextNode = pTextNode;
     if (m_pTextNode && (GetRegisteredIn() != m_pTextNode))
     {
-        m_pTextNode->Add(this);
+        m_pTextNode->Add(*this);
     }
     else if (!m_pTextNode)
     {
diff --git a/sw/source/core/txtnode/fmtatr2.cxx 
b/sw/source/core/txtnode/fmtatr2.cxx
index f5c0cee1cdb7..f36f3508d449 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -704,7 +704,7 @@ void Meta::NotifyChangeTextNode(SwTextNode *const pTextNode)
     m_pTextNode = pTextNode;
     if (m_pTextNode && (GetRegisteredIn() != m_pTextNode))
     {
-        m_pTextNode->Add(this);
+        m_pTextNode->Add(*this);
     }
     else if (!m_pTextNode)
     {
diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index c684b005504f..5da054405ef5 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -222,7 +222,7 @@ void SwTextINetFormat::InitINetFormat(SwTextNode & rNode)
     ChgTextNode(&rNode);
     SwCharFormat * const pFormat(
          
rNode.GetDoc().getIDocumentStylePoolAccess().GetCharFormatFromPool(RES_POOLCHR_INET_NORMAL)
 );
-    pFormat->Add( this );
+    pFormat->Add(*this);
 }
 
 void SwTextRuby::InitRuby(SwTextNode & rNode)
@@ -230,7 +230,7 @@ void SwTextRuby::InitRuby(SwTextNode & rNode)
     ChgTextNode(&rNode);
     SwCharFormat * const pFormat(
         
rNode.GetDoc().getIDocumentStylePoolAccess().GetCharFormatFromPool(RES_POOLCHR_RUBYTEXT)
 );
-    pFormat->Add( this );
+    pFormat->Add(*this);
 }
 
 /**
diff --git a/sw/source/core/txtnode/txtatr2.cxx 
b/sw/source/core/txtnode/txtatr2.cxx
index 0fc95bd6451c..02cdf30087ea 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -169,7 +169,7 @@ SwCharFormat* SwTextINetFormat::GetCharFormat()
     }
 
     if ( pRet )
-        pRet->Add( this );
+        pRet->Add(*this);
     else
         EndListeningAll();
 
@@ -270,7 +270,7 @@ SwCharFormat* SwTextRuby::GetCharFormat()
     }
 
     if( pRet )
-        pRet->Add( this );
+        pRet->Add(*this);
     else
         EndListeningAll();
 
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 7e54ef4a66dc..0a509780503c 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -1484,7 +1484,7 @@ void SwRegHistory::RegisterInModify( 
sw::BroadcastingModify* pRegIn, const SwNod
 {
     if ( m_pHistory && pRegIn )
     {
-        pRegIn->Add( this );
+        pRegIn->Add(*this);
         m_nNodeIndex = rNd.GetIndex();
         MakeSetWhichIds();
     }
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 5c5c88f74c24..5da8e4012652 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1117,7 +1117,7 @@ void SaveTable::NewFrameFormatForLine(const SwTableLine& 
rTableLn, sal_uInt16 nF
     if(!pFormat)
         pFormat = 
&CreateNewFormat(*pOldFormat->GetDoc()->MakeTableLineFormat(), nFormatPos);
     pOldFormat->CallSwClientNotify(sw::MoveTableLineHint(*pFormat, rTableLn));
-    pFormat->Add(const_cast<SwTableLine*>(&rTableLn));
+    pFormat->Add(const_cast<SwTableLine&>(rTableLn));
     KillEmptyFrameFormat(*pOldFormat);
 }
 
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index bbdc70048c01..958396d2d54d 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4732,7 +4732,7 @@ void wwExtraneousParas::remove_if_present(SwModify* 
pModify)
 TextNodeListener::TextNodeListener(SwTextNode* pTextNode)
     : m_pTextNode(pTextNode)
 {
-    m_pTextNode->Add(this);
+    m_pTextNode->Add(*this);
 }
 
 TextNodeListener::~TextNodeListener()
@@ -4756,7 +4756,7 @@ void TextNodeListener::SwClientNotify(const SwModify& 
rModify, const SfxHint& rH
 
 void TextNodeListener::StopListening(SwModify* pTextNode)
 {
-    pTextNode->Remove(this);
+    pTextNode->Remove(*this);
     m_pTextNode = nullptr;
 }
 
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx 
b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index ad8ff4b0df37..ec02dd111bc1 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -73,7 +73,7 @@ 
WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent)
 
         // tdf#154629 listen to know if the shell destructs before this panel 
does,
         // which can happen on entering print preview
-        m_pShell->Add(this);
+        m_pShell->Add(*this);
     }
 
     // Update panel on start
@@ -100,7 +100,7 @@ WriterInspectorTextPanel::~WriterInspectorTextPanel()
     if (m_pShell)
     {
         m_pShell->SetChgLnk(m_oldLink);
-        m_pShell->Remove(this);
+        m_pShell->Remove(*this);
     }
 }
 

Reply via email to