summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorJan-Marek Glogowski <jan-marek.glogowski@extern.cib.de>2020-02-04 14:29:46 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2020-02-05 02:38:29 +0100
commit7d886eec953efa593708db9560d0e69ac12c99cf (patch)
tree9978b8f1b157706e0c277d090813a3babd5cbf99 /writerfilter
parentc161478ed50f6ee8878335db113f8850a136615b (diff)
tdf#129912 correctly stop unstyled footnote parsing
The bug document somehow manages to generated a footnote, which never terminates the format loop in SwTextFrame::Format_. It contains an unstyled footnote, which I wasn't able to reproduce to create in Word. So I manually edited the XML of the included unit test document, which I used to develop the original patch, and which reproduces the broken parsing behaviour. This patch correctly stops the parsing of the custom footnote reference, if the text run containing the footnote reference is finished, which also fixes loading the bug document. The unit test checks various footnote variants, which represent different problems I found when developing the custom footnote parsing in commit a991ad93dcd6807d0eacd11a50c2ae43a2cfb882 ("tdf#121441 improve DOCX footnote import") and now also includes an unstyled one. It also contains a (still?) broken footnote test, with a complex differing footnote. Change-Id: I748955285d76b6f3122d1da5d8823068f3d7633f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87981 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx1
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx7
2 files changed, 7 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 83237017ea84..aa8e7f02d6b0 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -957,7 +957,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
break;
case NS_ooxml::LN_CT_FtnEdnRef_id:
// footnote or endnote reference id - not needed
- m_pImpl->StartCustomFootnote(m_pImpl->GetTopContext());
break;
case NS_ooxml::LN_CT_Color_themeColor:
m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "themeColor", TDefTableHandler::getThemeColorTypeString(nIntValue));
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index fe4570e2286c..54e76f987ed8 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -687,6 +687,13 @@ void DomainMapper_Impl::PopProperties(ContextType eId)
deferredCharacterProperties.clear();
}
+ if (!IsInFootOrEndnote() && IsInCustomFootnote() && !m_aPropertyStacks[eId].empty())
+ {
+ PropertyMapPtr pRet = m_aPropertyStacks[eId].top();
+ if (pRet->GetFootnote().is() && m_pFootnoteContext.is())
+ EndCustomFootnote();
+ }
+
m_aPropertyStacks[eId].pop();
m_aContextStack.pop();
if(!m_aContextStack.empty() && !m_aPropertyStacks[m_aContextStack.top()].empty())