[Libreoffice-commits] core.git: sw/inc sw/source

Bjoern Michaelsen (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 23 13:52:17 UTC 2019


 sw/inc/unobaseclass.hxx            |    4 ----
 sw/source/core/inc/unoport.hxx     |    8 +++-----
 sw/source/core/unocore/unoobj2.cxx |   19 -------------------
 sw/source/core/unocore/unoport.cxx |   17 +++++------------
 4 files changed, 8 insertions(+), 40 deletions(-)

New commits:
commit 9f1352381eb54d3fc822cd56060a69bd51f62a21
Author:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Mon Sep 23 10:16:30 2019 +0200
Commit:     Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Mon Sep 23 15:51:25 2019 +0200

    UnoBaseClass: remove remaining leftover SwClient bits
    
    Change-Id: Ic7bc826b2d08701eaf4914fd4d5e019fd407cfb8
    Reviewed-on: https://gerrit.libreoffice.org/79390
    Tested-by: Jenkins
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/sw/inc/unobaseclass.hxx b/sw/inc/unobaseclass.hxx
index 5ca6bd074873..289d5f0b7ee1 100644
--- a/sw/inc/unobaseclass.hxx
+++ b/sw/inc/unobaseclass.hxx
@@ -29,7 +29,6 @@
 #include <vcl/svapp.hxx>
 
 class SfxPoolItem;
-class SwClient;
 class SwDoc;
 class SwUnoTableCursor;
 
@@ -84,9 +83,6 @@ public:
     ~UnoActionRemoveContext() COVERITY_NOEXCEPT_FALSE;
 };
 
-/// helper function for implementing SwClient::Modify
-void ClientModify(SwClient* pClient, const SfxPoolItem *pOld, const SfxPoolItem *pNew);
-
 namespace sw {
     template<typename T>
     struct UnoImplPtrDeleter
diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx
index afe00a0e81ee..5072f33c4ea7 100644
--- a/sw/source/core/inc/unoport.hxx
+++ b/sw/source/core/inc/unoport.hxx
@@ -35,9 +35,9 @@
 #include <cppuhelper/implbase.hxx>
 
 #include <svl/itemprop.hxx>
+#include <svl/listener.hxx>
 
 #include <unocrsr.hxx>
-#include <calbck.hxx>
 
 namespace com::sun::star::beans { struct PropertyValue; }
 namespace com::sun::star::text { class XTextField; }
@@ -87,7 +87,7 @@ class SwXTextPortion : public cppu::WeakImplHelper
     css::lang::XUnoTunnel,
     css::lang::XServiceInfo
 >,
-    public SwClient
+    public SvtListener
 {
 private:
 
@@ -113,7 +113,6 @@ private:
     std::unique_ptr< css::uno::Any > m_pRubyPosition;
     sw::UnoCursorPointer m_pUnoCursor;
 
-    sw::WriterMultiListener m_aDepends;
     SwFrameFormat*                  m_pFrameFormat;
     const SwTextPortionType     m_ePortionType;
 
@@ -145,8 +144,7 @@ protected:
 
     virtual ~SwXTextPortion() override;
 
-    //SwClient
-    virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override;
+    virtual void Notify(const SfxHint& rHint) override;
 
 public:
     SwXTextPortion(const SwUnoCursor* pPortionCursor, css::uno::Reference< css::text::XText > const& rParent, SwTextPortionType   eType   );
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 004de650992d..502e2e74c2dd 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -293,25 +293,6 @@ UnoActionRemoveContext::~UnoActionRemoveContext() COVERITY_NOEXCEPT_FALSE
     }
 }
 
-void ClientModify(SwClient* pClient, const SfxPoolItem *pOld, const SfxPoolItem *pNew)
-{
-    switch( pOld ? pOld->Which() : 0 )
-    {
-    case RES_REMOVE_UNO_OBJECT:
-    case RES_OBJECTDYING:
-        if( static_cast<void*>(pClient->GetRegisteredIn()) == static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject )
-            pClient->EndListeningAll();
-        break;
-
-    case RES_FMT_CHG:
-        // Is the move to the new one finished and will the old one be deleted?
-        if( static_cast<const SwFormatChg*>(pNew)->pChangedFormat == pClient->GetRegisteredIn() &&
-            static_cast<const SwFormatChg*>(pOld)->pChangedFormat->IsFormatInDTOR() )
-            pClient->EndListeningAll();
-        break;
-    }
-}
-
 void SwUnoCursorHelper::SetCursorAttr(SwPaM & rPam,
         const SfxItemSet& rSet,
         const SetAttrMode nAttrMode, const bool bTableMode)
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 3e580633b0ab..319f1c51dbd4 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -72,7 +72,6 @@ SwXTextPortion::SwXTextPortion(
             ?  PROPERTY_MAP_REDLINE_PORTION
             :  PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
     , m_xParentText(rParent)
-    , m_aDepends(*this)
     , m_pFrameFormat(nullptr)
     , m_ePortionType(eType)
     , m_bIsCollapsed(false)
@@ -87,12 +86,11 @@ SwXTextPortion::SwXTextPortion(
     : m_pPropSet(aSwMapProvider.GetPropertySet(
                     PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
     , m_xParentText(rParent)
-    , m_aDepends(*this)
     , m_pFrameFormat(&rFormat)
     , m_ePortionType(PORTION_FRAME)
     , m_bIsCollapsed(false)
 {
-    m_aDepends.StartListening(&rFormat);
+    StartListening(rFormat.GetNotifier());
     init( pPortionCursor);
 }
 
@@ -109,7 +107,6 @@ SwXTextPortion::SwXTextPortion(
     , m_pRubyAdjust ( bIsEnd ? nullptr : new uno::Any )
     , m_pRubyIsAbove( bIsEnd ? nullptr : new uno::Any )
     , m_pRubyPosition( bIsEnd ? nullptr : new uno::Any )
-    , m_aDepends(*this)
     , m_pFrameFormat(nullptr)
     , m_ePortionType( bIsEnd ? PORTION_RUBY_END : PORTION_RUBY_START )
     , m_bIsCollapsed(false)
@@ -131,7 +128,7 @@ SwXTextPortion::~SwXTextPortion()
 {
     SolarMutexGuard aGuard;
     m_pUnoCursor.reset(nullptr);
-    m_aDepends.EndListeningAll();
+    EndListeningAll();
 }
 
 uno::Reference< text::XText >  SwXTextPortion::getText()
@@ -820,14 +817,10 @@ uno::Sequence< OUString > SwXTextPortion::getSupportedServiceNames()
             "com.sun.star.style.ParagraphPropertiesComplex" };
 }
 
-void SwXTextPortion::SwClientNotify(const SwModify&, const SfxHint& rHint)
+void SwXTextPortion::Notify(const SfxHint& rHint)
 {
-    if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
-    {
-        ClientModify(this, pLegacyHint->m_pOld, pLegacyHint->m_pNew);
-        if(!m_aDepends.IsListeningTo(m_pFrameFormat))
-            m_pFrameFormat = nullptr;
-    }
+    if(rHint.GetId() == SfxHintId::Dying)
+        m_pFrameFormat = nullptr;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list