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>
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 5f9e387..b44a2cb 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