sw/inc/ndtxt.hxx                  |    3 -
 sw/source/core/txtnode/atrfld.cxx |   12 +---
 sw/source/core/txtnode/ndtxt.cxx  |  103 +++++++++++++++++++-------------------
 3 files changed, 59 insertions(+), 59 deletions(-)

New commits:
commit 50e08fe9b0f78badc55fce2ac392de9724ff8906
Author:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
AuthorDate: Fri Oct 30 19:21:00 2020 +0100
Commit:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
CommitDate: Sat Oct 31 12:37:41 2020 +0100

    atrfld: ModifyNotification no more ...
    
    Change-Id: I9a5dc35a71725969bc4b75f0444ba663271e3228
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105079
    Tested-by: Jenkins
    Reviewed-by: Bjoern Michaelsen <bjoern.michael...@libreoffice.org>

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 539db67906cf..7b37dc152687 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -202,11 +202,12 @@ public:
     /// End: Data collected during idle time
 
 protected:
-    /// for hanging TextFormatCollections somewhere else (Outline-Numbering!)
     virtual void SwClientNotify( const SwModify&, const SfxHint& ) override;
 
 public:
     using SwContentNode::GetAttr;
+    /// for hanging TextFormatCollections somewhere else (Outline-Numbering!)
+    void TriggerNodeUpdate(const sw::LegacyModifyHint&);
 
     const OUString& GetText() const { return m_Text; }
 
diff --git a/sw/source/core/txtnode/atrfld.cxx 
b/sw/source/core/txtnode/atrfld.cxx
index a2008e7c4393..da3ef375c304 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -373,9 +373,7 @@ void SwFormatField::UpdateTextNode(const SfxPoolItem* pOld, 
const SfxPoolItem* p
         }
     }
     if(bTriggerNode)
-    {
-        pTextNd->ModifyNotification(pNodeOld, pNodeNew);
-    }
+        pTextNd->TriggerNodeUpdate(sw::LegacyModifyHint(pNodeOld, pNodeNew));
     if(bExpand)
     {
         mpTextField->ExpandTextField( pOld == nullptr && pNew == nullptr );
@@ -476,9 +474,7 @@ void SwTextField::ExpandTextField(const bool bForceNotify) 
const
         if ( bSameExpandSimpleNotification )
         {
             if( bHiddenParaChanged )
-            {
-                m_pTextNode->ModifyNotification( nullptr, nullptr );
-            }
+                m_pTextNode->TriggerNodeUpdate(sw::LegacyModifyHint(nullptr, 
nullptr));
             if ( !bForceNotify )
             {
                 // done, if no further notification forced.
@@ -559,9 +555,7 @@ void SwTextField::NotifyContentChange(SwFormatField& 
rFormatField)
 {
     //if not in undo section notify the change
     if (m_pTextNode && m_pTextNode->GetNodes().IsDocNodes())
-    {
-        m_pTextNode->ModifyNotification(nullptr, &rFormatField);
-    }
+        m_pTextNode->TriggerNodeUpdate(sw::LegacyModifyHint(nullptr, 
&rFormatField));
 }
 
 /*static*/
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index b2141ba2a7b9..f3e93f934c10 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -5238,71 +5238,76 @@ bool SwTextNode::IsInContent() const
     return !GetDoc().IsInHeaderFooter( SwNodeIndex(*this) );
 }
 
-void SwTextNode::SwClientNotify( const SwModify& rModify, const SfxHint& rHint 
)
+void SwTextNode::TriggerNodeUpdate(const sw::LegacyModifyHint& rHint)
 {
-    if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+    const auto pOldValue = rHint.m_pOld;
+    const auto pNewValue = rHint.m_pNew;
+    bool bWasNotifiable = m_bNotifiable;
+    m_bNotifiable = false;
+
+    // Override Modify so that deleting styles works properly (outline
+    // numbering!).
+    // Never call ChgTextCollUpdateNum for Nodes in Undo.
+    if( pOldValue
+            && pNewValue
+            && RES_FMT_CHG == pOldValue->Which()
+            && GetRegisteredIn() == static_cast<const 
SwFormatChg*>(pNewValue)->pChangedFormat
+            && GetNodes().IsDocNodes() )
     {
-        bool bWasNotifiable = m_bNotifiable;
-        m_bNotifiable = false;
+        ChgTextCollUpdateNum(
+                static_cast<const SwTextFormatColl*>(static_cast<const 
SwFormatChg*>(pOldValue)->pChangedFormat),
+                static_cast<const SwTextFormatColl*>(static_cast<const 
SwFormatChg*>(pNewValue)->pChangedFormat) );
+    }
 
-        const auto pOldValue = pLegacyHint->m_pOld;
-        const auto pNewValue = pLegacyHint->m_pNew;
-        // Override Modify so that deleting styles works properly (outline
-        // numbering!).
-        // Never call ChgTextCollUpdateNum for Nodes in Undo.
-        if( pOldValue
-                && pNewValue
-                && RES_FMT_CHG == pOldValue->Which()
-                && GetRegisteredIn() == static_cast<const 
SwFormatChg*>(pNewValue)->pChangedFormat
-                && GetNodes().IsDocNodes() )
-        {
-            ChgTextCollUpdateNum(
-                    static_cast<const SwTextFormatColl*>(static_cast<const 
SwFormatChg*>(pOldValue)->pChangedFormat),
-                    static_cast<const SwTextFormatColl*>(static_cast<const 
SwFormatChg*>(pNewValue)->pChangedFormat) );
-        }
+    // reset fill information
+    if (maFillAttributes && pNewValue)
+    {
+        const sal_uInt16 nWhich = pNewValue->Which();
+        bool bReset(RES_FMT_CHG == nWhich); // ..on format change (e.g. style 
changed)
 
-        // reset fill information
-        if (maFillAttributes && pNewValue)
+        if(!bReset && RES_ATTRSET_CHG == nWhich) // ..on ItemChange from 
DrawingLayer FillAttributes
         {
-            const sal_uInt16 nWhich = pNewValue->Which();
-            bool bReset(RES_FMT_CHG == nWhich); // ..on format change (e.g. 
style changed)
-
-            if(!bReset && RES_ATTRSET_CHG == nWhich) // ..on ItemChange from 
DrawingLayer FillAttributes
-            {
-                SfxItemIter aIter(*static_cast<const 
SwAttrSetChg*>(pNewValue)->GetChgSet());
-
-                for(const SfxPoolItem* pItem = aIter.GetCurItem(); pItem && 
!bReset; pItem = aIter.NextItem())
-                {
-                    bReset = !IsInvalidItem(pItem) && pItem->Which() >= 
XATTR_FILL_FIRST && pItem->Which() <= XATTR_FILL_LAST;
-                }
-            }
+            SfxItemIter aIter(*static_cast<const 
SwAttrSetChg*>(pNewValue)->GetChgSet());
 
-            if(bReset)
+            for(const SfxPoolItem* pItem = aIter.GetCurItem(); pItem && 
!bReset; pItem = aIter.NextItem())
             {
-                maFillAttributes.reset();
+                bReset = !IsInvalidItem(pItem) && pItem->Which() >= 
XATTR_FILL_FIRST && pItem->Which() <= XATTR_FILL_LAST;
             }
         }
 
-        if ( !mbInSetOrResetAttr )
+        if(bReset)
         {
-            HandleModifyAtTextNode( *this, pOldValue, pNewValue );
+            maFillAttributes.reset();
         }
+    }
 
-        SwContentNode::SwClientNotify(rModify, rHint);
+    if ( !mbInSetOrResetAttr )
+    {
+        HandleModifyAtTextNode( *this, pOldValue, pNewValue );
+    }
 
-        SwDoc& rDoc = GetDoc();
-        // #125329# - assure that text node is in document nodes array
-        if ( !rDoc.IsInDtor() && &rDoc.GetNodes() == &GetNodes() )
-        {
-            rDoc.GetNodes().UpdateOutlineNode(*this);
-        }
+    SwContentNode::SwClientNotify(*this, rHint);
 
-        m_bNotifiable = bWasNotifiable;
+    SwDoc& rDoc = GetDoc();
+    // #125329# - assure that text node is in document nodes array
+    if ( !rDoc.IsInDtor() && &rDoc.GetNodes() == &GetNodes() )
+    {
+        rDoc.GetNodes().UpdateOutlineNode(*this);
+    }
 
-        if (pOldValue && (RES_REMOVE_UNO_OBJECT == pOldValue->Which()))
-        {   // invalidate cached uno object
-            
SetXParagraph(css::uno::Reference<css::text::XTextContent>(nullptr));
-        }
+    m_bNotifiable = bWasNotifiable;
+
+    if (pOldValue && (RES_REMOVE_UNO_OBJECT == pOldValue->Which()))
+    {   // invalidate cached uno object
+        SetXParagraph(css::uno::Reference<css::text::XTextContent>(nullptr));
+    }
+}
+
+void SwTextNode::SwClientNotify( const SwModify& rModify, const SfxHint& rHint 
)
+{
+    if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+    {
+        TriggerNodeUpdate(*pLegacyHint);
     }
     else if (dynamic_cast<const SwAttrHint*>(&rHint))
     {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to