summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-11-17 17:58:33 +0100
committerMichael Stahl <michael.stahl@cib.de>2020-11-17 22:20:30 +0100
commit93b1adf7442839dcfbf16660b1fbe1139f14a4d0 (patch)
tree6737132890d44d1e3f776f951bb0852a436f7983 /sw
parent00abbf7592fc5117fa2bd1c8812e2d2841e90df0 (diff)
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@cib.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/crsr/pam.cxx27
1 files changed, 18 insertions, 9 deletions
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