[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 19 01:17:42 UTC 2020


 sw/source/core/crsr/pam.cxx |   24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

New commits:
commit cb9ec4a95b0f2ac3db6cb51678bd55f73c44c874
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 17 17:58:33 2020 +0100
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Thu Nov 19 02:17:04 2020 +0100

    sw_redlinehide: replace bogus implementation of SwPaM::InvalidatePaM()
    
    Sending SwInsText will mess up merged paragraphs. Instead, send
    SwUpdateAttr with which-id 0, which results in InvalidateRange_() being
    called with at least 1 character.
    
    This appears to be called only by fieldmark UI, and now asserts in
    UITest_writer_tests5 DateFormFieldPropertiesDialog.dateFormFieldDialog.test_date_field_with_custom_format
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106022
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 93b1adf7442839dcfbf16660b1fbe1139f14a4d0)
    
    sw_redlinehide: use correct node in SwPaM::InvalidatePaM()
    (oopsie from 93b1adf7442839dcfbf16660b1fbe1139f14a4d0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106046
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 53c69d392b1e55267a44994a889688cc80fbbd98)
    
    Change-Id: I948ddefa3acece8809e4bf3d2beee6cec3ed56f5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106065
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 0473d8bacfd1..d1fccd357f5e 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -1121,15 +1121,23 @@ OUString SwPaM::GetText() const
 
 void SwPaM::InvalidatePaM()
 {
-    const SwNode &_pNd = GetNode();
-    const SwTextNode *_pTextNd = _pNd.GetTextNode();
-    if (_pTextNd != nullptr)
+    for (SwNodeIndex index = Start()->nNode; index <= End()->nNode; ++index)
     {
-        // pretend that the PaM marks inserted text to recalc the portion...
-        SwInsText aHint( Start()->nContent.GetIndex(),
-                        End()->nContent.GetIndex() - Start()->nContent.GetIndex() + 1 );
-        SwModify *_pModify=const_cast<SwModify*>(static_cast<SwModify const *>(_pTextNd));
-        _pModify->ModifyNotification( nullptr, &aHint);
+        if (SwTextNode *const pTextNode = index.GetNode().GetTextNode())
+        {
+            // pretend that the PaM marks changed formatting to reformat...
+            sal_Int32 const nStart(
+                index == Start()->nNode ? Start()->nContent.GetIndex() : 0);
+            // this should work even for length of 0
+            SwUpdateAttr const aHint(
+                nStart,
+                index == End()->nNode
+                    ? End()->nContent.GetIndex() - nStart
+                    : pTextNode->Len() - nStart,
+                0);
+            pTextNode->CallSwClientNotify(sw::LegacyModifyHint(&aHint, &aHint));
+        }
+        // other node types not invalidated
     }
 }
 


More information about the Libreoffice-commits mailing list