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

Bjoern Michaelsen (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 2 21:34:47 UTC 2020


 svl/source/items/poolitem.cxx     |    1 -
 sw/inc/hintids.hxx                |    2 --
 sw/inc/hints.hxx                  |   14 +++++++-------
 sw/inc/node.hxx                   |    4 +---
 sw/source/core/attr/hints.cxx     |    5 -----
 sw/source/core/docnode/node.cxx   |   23 +++++++++++++++--------
 sw/source/filter/xml/xmlfmt.cxx   |    7 ++-----
 sw/source/uibase/app/docstyle.cxx |    4 +---
 8 files changed, 26 insertions(+), 34 deletions(-)

New commits:
commit 5f9650e54247f1c27749ad4e4268aae69dabd47e
Author:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Mon Nov 2 19:08:23 2020 +0100
Commit:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Mon Nov 2 22:34:11 2020 +0100

    move SwCondCollCondChg on top of SfxHint
    
    ... and get rid of ModifyNotifications along the way.
    
    Change-Id: I10fc9d24743d50cef771ff63dae004d31dce1846
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105195
    Tested-by: Jenkins
    Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index 0d6513f70483..ed888a09c8de 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -443,7 +443,6 @@
 //     class SwTableFormulaUpdate : public SwMsgPoolItem
 //     class SwAutoFormatGetDocNode: public SwMsgPoolItem
 //     class SwAttrSetChg: public SwMsgPoolItem
-//     class SwCondCollCondChg: public SwMsgPoolItem
 //     class SwVirtPageNumInfo: public SwMsgPoolItem
 //     class SwFindNearestNode : public SwMsgPoolItem
 //     class SwStringMsgPoolItem : public SwMsgPoolItem
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index f8b05e9a080c..021aac0be963 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -136,7 +136,6 @@ class SwDelText;
 class SwRefMarkFieldUpdate;
 class SwTableFormulaUpdate;
 class SwAutoFormatGetDocNode;
-class SwCondCollCondChg;
 class SwVirtPageNumInfo;
 class SwFindNearestNode;
 class SwStringMsgPoolItem;
@@ -428,7 +427,6 @@ constexpr TypedWhichId<SwMsgPoolItem> RES_SECTION_NOT_HIDDEN (173);
 constexpr TypedWhichId<SwMsgPoolItem> RES_GRAPHIC_ARRIVED (174);
 constexpr TypedWhichId<SwMsgPoolItem> RES_GRAPHIC_PIECE_ARRIVED (175);
 constexpr TypedWhichId<SwMsgPoolItem> RES_HIDDENPARA_PRINT (176);
-constexpr TypedWhichId<SwCondCollCondChg> RES_CONDCOLL_CONDCHG (177);
 constexpr TypedWhichId<SwVirtPageNumInfo> RES_VIRTPAGENUM_INFO (178);
 constexpr TypedWhichId<SwPtrMsgPoolItem> RES_REMOVE_UNO_OBJECT (179);
 constexpr TypedWhichId<SwMsgPoolItem> RES_GRF_REREAD_AND_INCACHE (180);
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 9a79579c16ef..6b3073e6a739 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -32,6 +32,7 @@ class SwPageFrame;
 class SwFrame;
 class SwHistory;
 class SwTextNode;
+class SwTextFormatColl;
 
 // Base class for all Message-Hints:
 // "Overhead" of SfxPoolItem is handled here
@@ -128,6 +129,12 @@ public:
     RedlineUnDelText(sal_Int32 nS, sal_Int32 nL);
 };
 
+class CondCollCondChg final : public SfxHint
+{
+public:
+    const SwTextFormatColl& m_rColl;
+    CondCollCondChg(const SwTextFormatColl& rColl) : m_rColl(rColl) {};
+};
 }
 
 class SwUpdateAttr final : public SwMsgPoolItem
@@ -251,13 +258,6 @@ public:
 #endif
 };
 
-class SwCondCollCondChg final : public SwMsgPoolItem
-{
-public:
-    SwFormat *pChangedFormat;
-    SwCondCollCondChg( SwFormat *pFormat );
-};
-
 class SwVirtPageNumInfo final : public SwMsgPoolItem
 {
     const SwPageFrame *m_pPage;
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 7aa3fe8525bb..c69347fde410 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -454,14 +454,12 @@ public:
     virtual SwFormatColl* ChgFormatColl( SwFormatColl* );
     SwFormatColl* GetFormatColl() const { return const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(GetRegisteredIn())); }
 
-//FEATURE::CONDCOLL
     inline SwFormatColl& GetAnyFormatColl() const;
     void SetCondFormatColl( SwFormatColl* );
     inline SwFormatColl* GetCondFormatColl() const;
 
     bool IsAnyCondition( SwCollCondition& rTmp ) const;
-    void ChkCondColl();
-//FEATURE::CONDCOLL
+    void ChkCondColl(const SwTextFormatColl* pColl = nullptr);
 
     /** Invalidates NumRule at the node. NumRule is updated
        on EndAction of a Shell at the latest. */
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
index b8d626e1b45f..56288c840bbe 100644
--- a/sw/source/core/attr/hints.cxx
+++ b/sw/source/core/attr/hints.cxx
@@ -165,11 +165,6 @@ const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
 }
 #endif
 
-SwCondCollCondChg::SwCondCollCondChg( SwFormat *pFormat )
-    : SwMsgPoolItem( RES_CONDCOLL_CONDCHG ), pChangedFormat( pFormat )
-{
-}
-
 SwVirtPageNumInfo::SwVirtPageNumInfo( const SwPageFrame *pPg ) :
     SwMsgPoolItem( RES_VIRTPAGENUM_INFO ), m_pPage( nullptr ), m_pOrigPage( pPg ), m_pFrame( nullptr )
 {
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index c13ffe5620ed..076fd4c545bd 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1150,13 +1150,6 @@ void SwContentNode::SwClientNotify( const SwModify&, const SfxHint& rHint)
                 }
                 break;
 
-            case RES_CONDCOLL_CONDCHG:
-                if(pLegacyHint->m_pNew
-                        && static_cast<const SwCondCollCondChg*>(pLegacyHint->m_pNew)->pChangedFormat == GetRegisteredIn()
-                        && &GetNodes() == &GetDoc().GetNodes() )
-                    ChkCondColl();
-                return;    // Do not pass through to the base class/Frames
-
             case RES_ATTRSET_CHG:
                 if (GetNodes().IsDocNodes()
                         && IsTextNode()
@@ -1195,6 +1188,10 @@ void SwContentNode::SwClientNotify( const SwModify&, const SfxHint& rHint)
     {
         m_pCondColl = const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(pModifyChangedHint->m_pNew));
     }
+    else if(auto pCondCollCondChgHint = dynamic_cast<const sw::CondCollCondChg*>(&rHint))
+    {
+        ChkCondColl(&pCondCollCondChgHint->m_rColl);
+    }
 }
 
 bool SwContentNode::InvalidateNumRule()
@@ -2006,8 +2003,18 @@ bool SwContentNode::IsAnyCondition( SwCollCondition& rTmp ) const
     return false;
 }
 
-void SwContentNode::ChkCondColl()
+void SwContentNode::ChkCondColl(const SwTextFormatColl* pColl)
 {
+    if(pColl != GetRegisteredIn())
+    {
+        SAL_WARN("sw.core", "Wrong cond collection, skipping check of Cond Colls.");
+        return;
+    }
+    if(&GetNodes() != &GetDoc().GetNodes())
+    {
+        SAL_WARN("sw.core", "Nodes amiss, skipping check of Cond Colls.");
+        return;
+    }
     // Check, just to be sure
     if( RES_CONDTXTFMTCOLL != GetFormatColl()->Which() )
         return;
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index 80d808aeeaec..789d6ed410f9 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -1044,11 +1044,8 @@ void SwXMLImport::UpdateTextCollConditions( SwDoc *pDoc )
                 default: break;
                 }
             }
-            if( bSendModify )
-            {
-                SwCondCollCondChg aMsg( pColl );
-                pColl->ModifyNotification( &aMsg, &aMsg );
-            }
+            if(bSendModify)
+                pColl->GetNotifier().Broadcast(sw::CondCollCondChg(*pColl));
         }
     }
 }
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 9f594d1ceada..6c10b11eb65a 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -1504,9 +1504,7 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet,
                     }
                 }
 
-                // Update document to new conditions
-                SwCondCollCondChg aMsg( pColl );
-                pColl->ModifyNotification( &aMsg, &aMsg );
+                pColl->GetNotifier().Broadcast(sw::CondCollCondChg(*pColl));
             }
             else if( pCondItem && !pColl->HasWriterListeners() )
             {


More information about the Libreoffice-commits mailing list