sw/source/core/doc/fmtcol.cxx |   31 +++++++------------------------
 1 file changed, 7 insertions(+), 24 deletions(-)

New commits:
commit 49763e1fc4ec4308d52a3d578246ecc4ad3108b2
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Tue Jul 2 20:43:33 2024 -0400
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Aug 2 13:00:56 2024 +0200

    tdf#134204 : notify change unless all properties are handled #3
    
    So, hopefully all the logic is nice and tidy now.
    
    Change-Id: I9016cc07bdcf0297961e4d2c2456bb2fe9fbde3b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169899
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 1fa2ceca4831..e6c4c16310a4 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -238,21 +238,7 @@ void SwTextFormatColl::SwClientNotify(const SwModify& 
rModify, const SfxHint& rH
                                                         this, pNewNumRuleItem 
);
     }
 
-    // There are three situations that trigger this notify
-    // A.) a single format change: potentially dead code?
-    // B.) a new parent (bNewParent): unknown number of potential changes 
involved
-    // C.) a set of changes: a known number of changes.
-
-    // Do we need to notify anyone that we have changed?
-    // yes(1) - if we ourselves are the ones that caused the change
-    //    -that seems puzzling to me, but very true at least for pNewChgSet
-    //        -THIS IS the INITIAL SwClientNotify CALL IN THAT CASE
-    // yes(2) - if we ourselves did not have that value set (we inherited a 
change)
-    // yes(3) - if we had a relative value that changed because the parent 
changed
-    //     - the SetFormatAttr triggers its own notify, but only about that 
ONE PROPERTY
-    // no - if the parents value changed, but our value was absolute (or 
unchanged relative)
-    //     - (4) but only if ALL the properties were unchanged
-    bool bContinue = true; // #1, #2
+    sal_uInt32 nNoNotify = 0; // track handled changes: no need to notify if 
all are handled here
 
     // Check against the own attributes
     const SvxFirstLineIndentItem 
*pOldFirstLineIndent(GetItemIfSet(RES_MARGIN_FIRSTLINE, false));
@@ -274,7 +260,7 @@ void SwTextFormatColl::SwClientNotify(const SwModify& 
rModify, const SfxHint& rH
             {
                 SetFormatAttr(aNew); // triggered separate notification about 
only this one property
             }
-            bContinue = pOldChgSet && pOldChgSet->GetChgSet()->Count() > 1; // 
#3, #4
+            ++nNoNotify;
         }
     }
     const SvxTextLeftMarginItem 
*pOldTextLeftMargin(GetItemIfSet(RES_MARGIN_TEXTLEFT, false));
@@ -297,7 +283,7 @@ void SwTextFormatColl::SwClientNotify(const SwModify& 
rModify, const SfxHint& rH
             {
                 SetFormatAttr( aNew );
             }
-            bContinue = pOldChgSet && pOldChgSet->GetChgSet()->Count() > 1;
+            ++nNoNotify;
         }
     }
     const SvxRightMarginItem *pOldRightMargin(GetItemIfSet(RES_MARGIN_RIGHT, 
false));
@@ -318,7 +304,7 @@ void SwTextFormatColl::SwClientNotify(const SwModify& 
rModify, const SfxHint& rH
             {
                 SetFormatAttr( aNew );
             }
-            bContinue = pOldChgSet && pOldChgSet->GetChgSet()->Count() > 1;
+            ++nNoNotify;
         }
     }
 
@@ -345,7 +331,7 @@ void SwTextFormatColl::SwClientNotify(const SwModify& 
rModify, const SfxHint& rH
         {
             SetFormatAttr( aNew );
         }
-        bContinue = pOldChgSet && pOldChgSet->GetChgSet()->Count() > 1;
+        ++nNoNotify;
     }
 
     for (size_t nC = 0; nC < SAL_N_ELEMENTS(aFontSizeArr); ++nC)
@@ -368,15 +354,12 @@ void SwTextFormatColl::SwClientNotify(const SwModify& 
rModify, const SfxHint& rH
                     SetFormatAttr( aNew );
                 }
             }
-            bContinue = pOldChgSet && pOldChgSet->GetChgSet()->Count() > 1;
+            ++nNoNotify;
         }
     }
 
     // if the parent changed, we can't know how many properties are involved: 
always notify a change
-    if (!bContinue && bNewParent) // #4
-        bContinue = true;
-
-    if( bContinue )
+    if (bNewParent || !nNoNotify || (pOldChgSet && 
pOldChgSet->GetChgSet()->Count() > nNoNotify))
         SwFormatColl::SwClientNotify(rModify, rHint);
 }
 

Reply via email to