[Libreoffice-commits] core.git: sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Tue Nov 17 21:21:10 UTC 2020
sw/source/core/crsr/pam.cxx | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
New commits:
commit 93b1adf7442839dcfbf16660b1fbe1139f14a4d0
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 17 17:58:33 2020 +0100
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Tue Nov 17 22:20:30 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
Change-Id: I948ddefa3acece8809e4bf3d2beee6cec3ed56f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106022
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 5f9e3877f1e6..b44a2cb2a73f 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -1121,15 +1121,24 @@ OUString SwPaM::GetText() const
void SwPaM::InvalidatePaM()
{
- const SwNode& pNd = GetNode();
- SwTextNode* pTextNd = const_cast<SwTextNode*>(pNd.GetTextNode());
- if(!pTextNd)
- return;
- // pretend that the PaM marks inserted text to recalc the portion...
- SwInsText aHint(
- Start()->nContent.GetIndex(),
- End()->nContent.GetIndex() - Start()->nContent.GetIndex() + 1);
- pTextNd->TriggerNodeUpdate(sw::LegacyModifyHint(nullptr, &aHint));
+ for (SwNodeIndex index = Start()->nNode; index != End()->nNode; ++index)
+ {
+ 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
+ : End()->nNode.GetNode().GetTextNode()->Len() - nStart,
+ 0);
+ pTextNode->TriggerNodeUpdate(sw::LegacyModifyHint(nullptr, &aHint));
+ }
+ // other node types not invalidated
+ }
}
void SwPaM::dumpAsXml(xmlTextWriterPtr pWriter) const
More information about the Libreoffice-commits
mailing list