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

Bjoern Michaelsen bjoern.michaelsen at libreoffice.org
Sat May 12 21:20:51 UTC 2018


 sw/inc/ndtxt.hxx                         |    5 ++++-
 sw/source/core/unocore/unotextmarkup.cxx |   22 +++++++++++++---------
 2 files changed, 17 insertions(+), 10 deletions(-)

New commits:
commit 877242c09e0c2aebb2c437c8733c4d4c6774b2eb
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
Date:   Thu May 10 10:51:42 2018 +0200

    dont use SwClient/SwModify in unocore: TextMarkup
    
    Change-Id: I160ca544122609a5c35b6bf2739581769cd46295
    Reviewed-on: https://gerrit.libreoffice.org/54157
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 1fa043fcd44a..50cc3a75172f 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -70,7 +70,10 @@ namespace com { namespace sun { namespace star {
 typedef std::set< sal_Int32 > SwSoftPageBreakList;
 
 /// SwTextNode is a paragraph in the document model.
-class SW_DLLPUBLIC SwTextNode: public SwContentNode, public ::sfx2::Metadatable
+class SW_DLLPUBLIC SwTextNode
+    : public SwContentNode
+    , public ::sfx2::Metadatable
+    , public sw::BroadcasterMixin
 {
     friend class SwContentNode;
     /// For creating the first TextNode.
diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx
index 094e5909613f..1cd5d76e779a 100644
--- a/sw/source/core/unocore/unotextmarkup.cxx
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -19,6 +19,7 @@
 
 #include <unotextmarkup.hxx>
 
+#include <svl/listener.hxx>
 #include <vcl/svapp.hxx>
 #include <SwSmartTagMgr.hxx>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
@@ -43,20 +44,20 @@
 using namespace ::com::sun::star;
 
 struct SwXTextMarkup::Impl
-    : public SwClient
+    : public SvtListener
 {
     SwTextNode* m_pTextNode;
     ModelToViewHelper const m_ConversionMap;
 
-    Impl(SwTextNode *const pTextNode, const ModelToViewHelper& rMap)
-        : SwClient(pTextNode)
-        , m_pTextNode(pTextNode)
+    Impl(SwTextNode* const pTextNode, const ModelToViewHelper& rMap)
+        : m_pTextNode(pTextNode)
         , m_ConversionMap(rMap)
     {
+        if(m_pTextNode)
+            StartListening(pTextNode->GetNotifier());
     }
 
-    // SwClient
-    virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override;
+    virtual void Notify(const SfxHint& rHint) override;
 };
 
 SwXTextMarkup::SwXTextMarkup(
@@ -77,6 +78,7 @@ SwTextNode* SwXTextMarkup::GetTextNode()
 void SwXTextMarkup::ClearTextNode()
 {
     m_pImpl->m_pTextNode = nullptr;
+    m_pImpl->EndListeningAll();
 }
 
 const ModelToViewHelper& SwXTextMarkup::GetConversionMap()
@@ -474,11 +476,13 @@ void SAL_CALL SwXTextMarkup::commitMultiTextMarkup(
         finishGrammarCheck(*m_pImpl->m_pTextNode);
 }
 
-void SwXTextMarkup::Impl::Modify( const SfxPoolItem* /*pOld*/, const SfxPoolItem* /*pNew*/ )
+void SwXTextMarkup::Impl::Notify(const SfxHint& rHint)
 {
     DBG_TESTSOLARMUTEX();
-    EndListeningAll();
-    m_pTextNode = nullptr;
+    if(rHint.GetId() == SfxHintId::Dying)
+    {
+        m_pTextNode = nullptr;
+    }
 }
 
 SwXStringKeyMap::SwXStringKeyMap()


More information about the Libreoffice-commits mailing list