sw/inc/calbck.hxx               |    3 +++
 sw/source/core/attr/calbck.cxx  |    8 ++++++++
 sw/source/core/attr/format.cxx  |   25 ++++++++-----------------
 sw/source/core/docnode/node.cxx |   28 +++++-----------------------
 4 files changed, 24 insertions(+), 40 deletions(-)

New commits:
commit 9542f3bd21278e3a5a684cf52d58b31d13d9cbc7
Author:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
AuthorDate: Wed Oct 28 23:00:38 2020 +0100
Commit:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
CommitDate: Thu Oct 29 20:26:34 2020 +0100

    move ClientNotifyAttrChg to calbck.hxx ...
    
    ... and also use it from SwNode.
    
    Change-Id: Icc71eabbc918aa7d61fb0bb4b72c3dd7d91cdbff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104981
    Tested-by: Jenkins
    Reviewed-by: Bjoern Michaelsen <bjoern.michael...@libreoffice.org>

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 62742cb1cab5..020697b285b8 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -33,6 +33,7 @@
 
 class SwModify;
 class SfxPoolItem;
+class SwAttrSet;
 
 /*
     SwModify and SwClient cooperate in propagating attribute changes.
@@ -229,6 +230,8 @@ template<typename TElementType, typename TSource, 
sw::IteratorMode eMode> class
 
 namespace sw
 {
+    void ClientNotifyAttrChg(SwModify& rModify, const SwAttrSet& aSet, 
SwAttrSet& aOld, SwAttrSet& aNew);
+
     // this class is part of the migration: it still forwards the "old"
     // SwModify events and announces them both to the old SwClients still
     // registered and also to the new SvtListeners.
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 4eb04a5ede98..c3eda1a29e64 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -378,4 +378,12 @@ void sw::BroadcastingModify::CallSwClientNotify(const 
SfxHint& rHint) const
     SwModify::CallSwClientNotify(rHint);
     const_cast<BroadcastingModify*>(this)->GetNotifier().Broadcast(rHint);
 }
+
+void sw::ClientNotifyAttrChg(SwModify& rModify, const SwAttrSet& aSet, 
SwAttrSet& aOld, SwAttrSet& aNew)
+{
+    const SwAttrSetChg aChgOld(aSet, aOld);
+    const SwAttrSetChg aChgNew(aSet, aNew);
+    const sw::LegacyModifyHint aHint(&aChgOld, &aChgNew);
+    rModify.SwClientNotify(rModify, aHint);
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 3c6cb61ce235..5d23ca14303a 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -35,15 +35,6 @@
 
 using namespace com::sun::star;
 
-namespace {
-    void lcl_SwClientNotify(SwModify& rModify, const SwAttrSet& aSet, 
SwAttrSet& aOld, SwAttrSet& aNew)
-    {
-        const SwAttrSetChg aChgOld(aSet, aOld);
-        const SwAttrSetChg aChgNew(aSet, aNew);
-        const sw::LegacyModifyHint aHint(&aChgOld, &aChgNew);
-        rModify.SwClientNotify(rModify, aHint);
-    }
-}
 
 SwFormat::SwFormat( SwAttrPool& rPool, const char* pFormatNm,
               const sal_uInt16* pWhichRanges, SwFormat *pDrvdFrame,
@@ -138,7 +129,7 @@ SwFormat &SwFormat::operator=(const SwFormat& rFormat)
     // create PoolItem attribute for Modify
     if( aOld.Count() )
     {
-        lcl_SwClientNotify(*this, m_aSet, aOld, aNew);
+        sw::ClientNotifyAttrChg(*this, m_aSet, aOld, aNew);
     }
 
     if(GetRegisteredIn() != rFormat.GetRegisteredIn())
@@ -506,7 +497,7 @@ bool SwFormat::SetFormatAttr( const SfxPoolItem& rAttr )
             if(bRet)
             {
                 m_aSet.SetModifyAtAttr(this);
-                lcl_SwClientNotify(*this, m_aSet, aOld, aNew);
+                sw::ClientNotifyAttrChg(*this, m_aSet, aOld, aNew);
             }
         }
 
@@ -542,7 +533,7 @@ bool SwFormat::SetFormatAttr( const SfxPoolItem& rAttr )
             // some special treatments for attributes
             m_aSet.SetModifyAtAttr( this );
 
-            lcl_SwClientNotify(*this, m_aSet, aOld, aNew);
+            sw::ClientNotifyAttrChg(*this, m_aSet, aOld, aNew);
         }
     }
     return bRet;
@@ -606,7 +597,7 @@ bool SwFormat::SetFormatAttr( const SfxItemSet& rSet )
                 if(bRet)
                 {
                     m_aSet.SetModifyAtAttr(this);
-                    lcl_SwClientNotify(*this, m_aSet, aOld, aNew);
+                    sw::ClientNotifyAttrChg(*this, m_aSet, aOld, aNew);
                 }
             }
 
@@ -640,7 +631,7 @@ bool SwFormat::SetFormatAttr( const SfxItemSet& rSet )
         {
             // some special treatments for attributes
             m_aSet.SetModifyAtAttr( this );
-            lcl_SwClientNotify(*this, m_aSet, aOld, aNew);
+            sw::ClientNotifyAttrChg(*this, m_aSet, aOld, aNew);
         }
     }
     return bRet;
@@ -671,7 +662,7 @@ bool SwFormat::ResetFormatAttr( sal_uInt16 nWhich1, 
sal_uInt16 nWhich2 )
               aNew( *m_aSet.GetPool(), m_aSet.GetRanges() );
     bool bRet = 0 != m_aSet.ClearItem_BC( nWhich1, nWhich2, &aOld, &aNew );
     if( bRet )
-        lcl_SwClientNotify(*this, m_aSet, aOld, aNew);
+        sw::ClientNotifyAttrChg(*this, m_aSet, aOld, aNew);
     return bRet;
 }
 
@@ -696,7 +687,7 @@ sal_uInt16 SwFormat::ResetAllFormatAttr()
               aNew( *m_aSet.GetPool(), m_aSet.GetRanges() );
     bool bRet = 0 != m_aSet.ClearItem_BC( 0, &aOld, &aNew );
     if( bRet )
-        lcl_SwClientNotify(*this, m_aSet, aOld, aNew);
+        sw::ClientNotifyAttrChg(*this, m_aSet, aOld, aNew);
     return aNew.Count();
 }
 
@@ -723,7 +714,7 @@ void SwFormat::DelDiffs( const SfxItemSet& rSet )
               aNew( *m_aSet.GetPool(), m_aSet.GetRanges() );
     bool bRet = 0 != m_aSet.Intersect_BC( rSet, &aOld, &aNew );
     if( bRet )
-        lcl_SwClientNotify(*this, m_aSet, aOld, aNew);
+        sw::ClientNotifyAttrChg(*this, m_aSet, aOld, aNew);
 }
 
 /** SwFormat::IsBackgroundTransparent
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 317c149faeb2..25aeec655363 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1565,11 +1565,7 @@ bool SwContentNode::SetAttr(const SfxPoolItem& rAttr )
                   aNew( *GetpSwAttrSet()->GetPool(), 
GetpSwAttrSet()->GetRanges() );
         bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, 
&aNew );
         if( bRet )
-        {
-            SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
-            SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
-            ModifyNotification( &aChgOld, &aChgNew ); // Send all changed ones
-        }
+            sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
     }
     return bRet;
 }
@@ -1640,12 +1636,7 @@ bool SwContentNode::SetAttr( const SfxItemSet& rSet )
                   aNew( *GetpSwAttrSet()->GetPool(), 
GetpSwAttrSet()->GetRanges() );
         bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, 
&aNew );
         if( bRet )
-        {
-            // Some special treatment for Attributes
-            SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
-            SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
-            ModifyNotification( &aChgOld, &aChgNew ); // Send out all changed 
ones
-        }
+            sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
     }
     return bRet;
 }
@@ -1690,9 +1681,7 @@ bool SwContentNode::ResetAttr( sal_uInt16 nWhich1, 
sal_uInt16 nWhich2 )
 
     if( bRet )
     {
-        SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
-        SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
-        ModifyNotification( &aChgOld, &aChgNew ); // All changed ones are sent
+        sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
 
         if( !GetpSwAttrSet()->Count() ) // Empty?, delete it
             mpAttrSet.reset();
@@ -1727,11 +1716,7 @@ bool SwContentNode::ResetAttr( const 
std::vector<sal_uInt16>& rWhichArr )
                 ++nDel;
 
         if( nDel )
-        {
-            SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
-            SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
-            ModifyNotification( &aChgOld, &aChgNew ); // All changed ones are 
sent
-        }
+            sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
     }
     if( !GetpSwAttrSet()->Count() ) // Empty?, delete it
         mpAttrSet.reset();
@@ -1766,10 +1751,7 @@ sal_uInt16 SwContentNode::ResetAllAttr()
 
     if( bRet )
     {
-        SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
-        SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
-        ModifyNotification( &aChgOld, &aChgNew ); // All changed ones are sent
-
+        sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
         if( !GetpSwAttrSet()->Count() ) // Empty? Delete
             mpAttrSet.reset();
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to