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

Bjoern Michaelsen (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 13 08:51:23 UTC 2020


 sw/source/core/inc/rolbck.hxx  |    6 ++----
 sw/source/core/undo/rolbck.cxx |   21 ++++++++-------------
 2 files changed, 10 insertions(+), 17 deletions(-)

New commits:
commit 9ccfe6645cd92b6eb870bfe3d6484c7318c75af4
Author:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Thu Sep 10 21:13:37 2020 +0200
Commit:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Sun Sep 13 10:50:43 2020 +0200

    SwRegHistory: SwClient no more
    
    Change-Id: Ifd43ff792612baba104d4cf09e3ee9bb6ed1c7a9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102409
    Tested-by: Jenkins
    Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index 3a87e24bd705..087ef74b58d2 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -408,7 +408,7 @@ public:
     void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
-class SwRegHistory : public SwClient
+class SwRegHistory final: public SwClient
 {
 private:
     o3tl::sorted_vector<sal_uInt16> m_WhichIdSet;
@@ -417,13 +417,11 @@ private:
 
     void MakeSetWhichIds();
 
-protected:
-    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) override;
-
 public:
     SwRegHistory( SwHistory* pHst );
     SwRegHistory( const SwNode& rNd, SwHistory* pHst );
     SwRegHistory( SwModify* pRegIn, const SwNode& rNd, SwHistory* pHst );
+    virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override;
 
     /// @return true if at least 1 item was inserted
     bool InsertItems( const SfxItemSet& rSet,
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 8781efef0f05..f26980f752f6 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -1378,32 +1378,27 @@ SwRegHistory::SwRegHistory( const SwNode& rNd, SwHistory* pHst )
     MakeSetWhichIds();
 }
 
-void SwRegHistory::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+void SwRegHistory::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
-    if ( !(m_pHistory && pNew && pOld != pNew) )
+    auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
+    if ( !(m_pHistory && pLegacyHint && pLegacyHint->m_pNew && pLegacyHint->m_pOld != pLegacyHint->m_pNew) )
         return;
 
-    if ( pNew->Which() < POOLATTR_END )
+    if ( pLegacyHint->m_pNew->Which() < POOLATTR_END )
     {
-        if(RES_UPDATE_ATTR == pNew->Which())
+        if(RES_UPDATE_ATTR == pLegacyHint->m_pNew->Which())
         {
-            // const SfxItemPool& rPool = static_cast< const SwUpdateAttr* >(pNew)->GetSfxItemPool();
-
-            m_pHistory->Add(
-                // rPool,
-                pOld,
-                pNew,
-                m_nNodeIndex);
+            m_pHistory->Add(pLegacyHint->m_pOld, pLegacyHint->m_pNew, m_nNodeIndex);
         }
         else
         {
             OSL_ENSURE(false, "Unexpected update attribute (!)");
         }
     }
-    else if (pOld && RES_ATTRSET_CHG == pNew->Which())
+    else if (pLegacyHint->m_pOld && RES_ATTRSET_CHG == pLegacyHint->m_pNew->Which())
     {
         std::unique_ptr<SwHistoryHint> pNewHstr;
-        const SfxItemSet& rSet = *static_cast< const SwAttrSetChg* >(pOld)->GetChgSet();
+        const SfxItemSet& rSet = *static_cast< const SwAttrSetChg* >(pLegacyHint->m_pOld)->GetChgSet();
 
         if ( 1 < rSet.Count() )
         {


More information about the Libreoffice-commits mailing list