diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-11-17 17:58:33 +0100 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2020-11-19 02:17:04 +0100 |
commit | cb9ec4a95b0f2ac3db6cb51678bd55f73c44c874 (patch) | |
tree | b8b2986b910970be3e43c89b5c82bc470a3bff90 | |
parent | 6d9cc23a057ceccae1398e0c89596c5599404666 (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
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106022
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@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@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@ubuntu.com>
-rw-r--r-- | sw/source/core/crsr/pam.cxx | 24 |
1 files changed, 16 insertions, 8 deletions
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 } } |