sw/inc/formatlinebreak.hxx               |    5 +----
 sw/source/core/txtnode/attrlinebreak.cxx |   15 ---------------
 sw/source/core/unocore/unolinebreak.cxx  |    6 ++----
 3 files changed, 3 insertions(+), 23 deletions(-)

New commits:
commit 087604aa3c31e9e1586fa448edfc554b0131575d
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Jan 16 15:14:52 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Jan 16 18:23:22 2025 +0100

    Simplify SwFormatLineBreak/SwXLineBreak interaction
    
    No need to use BroadcastingModify here, both sides hold a pointer
    to a concrete class.
    And we only need to deal with destruction in one direction,
    because the other direction uses a weak reference.
    
    Change-Id: If15d515d83e695c92614c8335356ce2f32db8dcc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180353
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sw/inc/formatlinebreak.hxx b/sw/inc/formatlinebreak.hxx
index c7c16e5faded..7434e047b45e 100644
--- a/sw/inc/formatlinebreak.hxx
+++ b/sw/inc/formatlinebreak.hxx
@@ -44,7 +44,7 @@ enum class SwLineBreakClear
 
 /// SfxPoolItem subclass that wraps an SwLineBreakClear.
 class SW_DLLPUBLIC SwFormatLineBreak final : public 
SfxEnumItem<SwLineBreakClear>,
-                                             public sw::BroadcastingModify
+                                             public SvtBroadcaster
 {
     /// The SwTextAttr that knows the position of the line break in the doc 
model.
     SwTextLineBreak* m_pTextAttr;
@@ -66,9 +66,6 @@ public:
     /// See SfxPoolItem::Clone().
     SwFormatLineBreak* Clone(SfxItemPool* pPool = nullptr) const override;
 
-    /// See SwModify::SwClientNotify().
-    void SwClientNotify(const SwModify&, const SfxHint&) override;
-
     sal_uInt16 GetValueCount() const override;
 
     rtl::Reference<SwXTextRange> GetAnchor() const;
diff --git a/sw/source/core/txtnode/attrlinebreak.cxx 
b/sw/source/core/txtnode/attrlinebreak.cxx
index 1e5a1adcebca..af9f94848656 100644
--- a/sw/source/core/txtnode/attrlinebreak.cxx
+++ b/sw/source/core/txtnode/attrlinebreak.cxx
@@ -34,7 +34,6 @@ using namespace com::sun::star;
 
 SwFormatLineBreak::SwFormatLineBreak(SwLineBreakClear eClear)
     : SfxEnumItem(RES_TXTATR_LINEBREAK, eClear)
-    , sw::BroadcastingModify()
     , m_pTextAttr(nullptr)
 {
     setNonShareable();
@@ -58,20 +57,6 @@ SwFormatLineBreak* SwFormatLineBreak::Clone(SfxItemPool*) 
const
     return new SwFormatLineBreak(GetValue());
 }
 
-void SwFormatLineBreak::SwClientNotify(const SwModify&, const SfxHint& rHint)
-{
-    if (SfxHintId::SwRemoveUnoObject == rHint.GetId())
-    {
-        CallSwClientNotify(rHint);
-        SetXLineBreak(nullptr);
-    }
-    else if (rHint.GetId() == SfxHintId::SwLegacyModify
-             || rHint.GetId() == SfxHintId::SwFormatChange
-             || rHint.GetId() == SfxHintId::SwAttrSetChange
-             || rHint.GetId() == SfxHintId::SwObjectDying)
-        CallSwClientNotify(rHint);
-}
-
 sal_uInt16 SwFormatLineBreak::GetValueCount() const
 {
     return static_cast<sal_uInt16>(SwLineBreakClear::LAST) + 1;
diff --git a/sw/source/core/unocore/unolinebreak.cxx 
b/sw/source/core/unocore/unolinebreak.cxx
index 71f2c47a7fe0..82cdf8512c07 100644
--- a/sw/source/core/unocore/unolinebreak.cxx
+++ b/sw/source/core/unocore/unolinebreak.cxx
@@ -49,9 +49,7 @@ public:
         , m_eClear(SwLineBreakClear::NONE)
     {
         if (m_pFormatLineBreak)
-        {
-            StartListening(m_pFormatLineBreak->GetNotifier());
-        }
+            StartListening(*m_pFormatLineBreak);
     }
 
     const SwFormatLineBreak* GetLineBreakFormat() const;
@@ -167,7 +165,7 @@ void SAL_CALL SwXLineBreak::attach(const 
uno::Reference<text::XTextRange>& xText
         m_pImpl->EndListeningAll();
         auto pLineBreak = 
const_cast<SwFormatLineBreak*>(&pTextAttr->GetLineBreak());
         m_pImpl->m_pFormatLineBreak = pLineBreak;
-        m_pImpl->StartListening(pLineBreak->GetNotifier());
+        m_pImpl->StartListening(*pLineBreak);
     }
     m_pImpl->m_bIsDescriptor = false;
 }

Reply via email to