sw/qa/core/data/ww8/pass/ofz34749-1.doc |binary sw/source/filter/ww8/ww8par.hxx | 8 ++++++++ sw/source/filter/ww8/ww8par6.cxx | 3 +++ 3 files changed, 11 insertions(+)
New commits: commit 7bbd2a6455df39218de4dd3ae918fd4ab9082a7c Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Jul 1 14:56:45 2021 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Nov 16 20:31:54 2021 +0100 ofz#34749 don't remove trailing paragraph if something got anchored to it Change-Id: Ic6eec2f9829c415abd4f2628bc51efbf98f918fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118228 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit e803875fbb86b24b39fcd9adcf7df40ed255ea8f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125289 Tested-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/qa/core/data/ww8/pass/ofz34749-1.doc b/sw/qa/core/data/ww8/pass/ofz34749-1.doc new file mode 100644 index 000000000000..d657a71b5245 Binary files /dev/null and b/sw/qa/core/data/ww8/pass/ofz34749-1.doc differ diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index c15c07afb7fa..a0d500a6eb81 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -916,6 +916,14 @@ public: explicit wwExtraneousParas(SwDoc &rDoc) : m_rDoc(rDoc) {} ~wwExtraneousParas() { delete_all_from_doc(); } void insert(SwTextNode *pTextNode) { m_aTextNodes.insert(pTextNode); } + void check_anchor_destination(SwTextNode *pTextNode) + { + auto it = m_aTextNodes.find(pTextNode); + if (it == m_aTextNodes.end()) + return; + SAL_WARN("sw.ww8", "It is unexpected to anchor something in a para scheduled for removal"); + m_aTextNodes.erase(it); + } void delete_all_from_doc(); }; diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index c7dc9724a4b3..9f12bcce353e 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2359,6 +2359,9 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo, const WW8_TablePos *p } else { + // ofz#34749 we shouldn't anchor anything into an 'extra' paragraph scheduled for + // removal at end of import, but check if that scenario is happening + m_aExtraneousParas.check_anchor_destination(m_pPaM->GetNode().GetTextNode()); m_xSFlyPara->pFlyFormat = m_rDoc.MakeFlySection(WW8SwFlyPara::eAnchor, m_pPaM->GetPoint(), &aFlySet); OSL_ENSURE(m_xSFlyPara->pFlyFormat->GetAnchor().GetAnchorId() ==