summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-07-01 14:56:45 +0100
committerAndras Timar <andras.timar@collabora.com>2021-11-24 14:56:37 +0100
commitaf5ae19fe70aafd1be9ddaba692a7664219b53f9 (patch)
treec67419945dece761c3b040a7f9baa4d4818142cb /sw
parent380e289dbbdbf91bf479817bad1b8ec53bc28bc9 (diff)
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 <caolanm@redhat.com> (cherry picked from commit e803875fbb86b24b39fcd9adcf7df40ed255ea8f)
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/core/data/ww8/pass/ofz34749-1.docbin0 -> 49370 bytes
-rw-r--r--sw/source/filter/ww8/ww8par.hxx8
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx3
3 files changed, 11 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/ofz34749-1.doc
Binary files differ
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index cf90848fc619..483d0b6ce470 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -925,6 +925,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 0c6b89b1bd5a..cb15bbd96aa4 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2455,6 +2455,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() ==