diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2024-02-21 10:22:12 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-02-21 12:33:12 +0100 |
commit | 833abb4a197561c34ec59cceb9d7d8a46f6b17ce (patch) | |
tree | 45a37aa2fda03b37a18a960458326e36e887e892 /sc/source | |
parent | 4b0c46dc61df243cda94f4a0af8946e076d1af54 (diff) |
tdf#159815 DOCX import: fix redlined to-char image followed by inline SDT
The 2nd para of the bugdoc has a leading word, then a redlined anchored
shape, finally a redlined checkbox content control. The Writer import
result's content control starts at para start, while it should only
start after the anchored shape.
What happens is that writerfilter::dmapper::DomainMapper_Impl::PushSdt()
gets called to remember the SDT start, then
DomainMapper_Impl::applyToggleAttributes() deletes some content since
commit 8726cf692299ea262a7455adcf6ec25451c7869d (tdf#142700 DOCX: fix
lost track changes of images, 2021-07-08), which invalidates the SDT
start position, finally PopSdt gets called, but that fails because our
start position is no longer valid. This used to abort the import
process. Since commit 1b0f67018fa1d514ebca59e081efdd24c1d7811b (docx
import: correct redline content-controls, 2024-02-20), the import
finishes the but start of the SDT is incorrect: it's at the para start,
while it should start in the middle of the paragraph. The direct reason
for the invalidation is a call to SwXTextRange::Impl::Notify(), which is
from a content deletion from applyToggleAttributes().
Fix the problem by not deleting content when we're past PushSdt() and we
haven't called PopSdt(): extract the redlined anchored shape code into a
new DomainMapper_Impl::MergeAtContentImageRedlineWithNext() and call
that also in DomainMapper_Impl::PushSdt() early, so it won't be called
when we're in the middle of an SDT.
This way createTextCursorByRange() should not fail, so warn in case it
still fails in DomainMapper_Impl::PopSdt().
Change-Id: Ic4198804a92088ec268203d44c0da2d6997754b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163678
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sc/source')
0 files changed, 0 insertions, 0 deletions