diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-05-03 08:39:31 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-05-07 22:48:15 +0200 |
commit | 6eb8d90a8f1d54e3160c60c6db9964b4484378ab (patch) | |
tree | d987285fc5c5e2b115a77775ba29f33990f74619 /writerfilter/source | |
parent | Collabora Office: remove Safe Mode from menus and Windows start menu (diff) | |
download | core-6eb8d90a8f1d54e3160c60c6db9964b4484378ab.tar.gz core-6eb8d90a8f1d54e3160c60c6db9964b4484378ab.zip |
tdf#107033 DOCX import: fix unexpected missing footnote separator
Regression from commit 330b860205c7ba69dd6603f65324d0f89ad9cd5f
(fdo#68787 DOCX import: handle when w:separator is missing for
footnotes, 2013-09-04), the problem was footnote settings were modified
also in case there were no footnotes at all in the document.
Make the bug scenario and the original one working at the same time by
touching footnote settings only in case there is at least one footnote
in the current section.
(cherry picked from commit e79ef12b7a904f17d4147fa409d055c12b70f952)
Change-Id: I163d11769cbd97957662607fbedfba404181e002
Reviewed-on: https://gerrit.libreoffice.org/37228
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
(cherry picked from commit cc6a55d687581db1a174b2a7d01f8a62887b5e24)
Diffstat (limited to 'writerfilter/source')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 15 |
3 files changed, 21 insertions, 4 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 8e261740a400..5ae6f3f2b14f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -236,6 +236,7 @@ DomainMapper_Impl::DomainMapper_Impl( m_nTableDepth(0), m_nTableCellDepth(0), m_nLastTableCellParagraphDepth(0), + m_bHasFtn(false), m_bHasFtnSep(false), m_bIgnoreNextPara(false), m_bIgnoreNextTab(false), @@ -5342,6 +5343,9 @@ void DomainMapper_Impl::substream(Id rName, propSize[i] = m_aPropertyStacks[i].size(); } #endif + // Save "has footnote" state, which is specific to a section in the body + // text, so state from substreams is not relevant. + bool bHasFtn = m_bHasFtn; //finalize any waiting frames before starting alternate streams CheckUnregisteredFrameConversion(); @@ -5411,12 +5415,14 @@ void DomainMapper_Impl::substream(Id rName, getTableManager().endLevel(); popTableManager(); + m_bHasFtn = bHasFtn; switch(rName) { case NS_ooxml::LN_footnote: case NS_ooxml::LN_endnote: m_pTableHandler->setHadFootOrEndnote(true); + m_bHasFtn = true; break; } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index b86938df337f..7bd388025305 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -835,7 +835,9 @@ public: /// Table cell depth of the last finished paragraph. sal_Int32 m_nLastTableCellParagraphDepth; - /// If the document has a footnote separator. + /// If the current section has footnotes. + bool m_bHasFtn; + /// If the current section has a footnote separator. bool m_bHasFtnSep; /// If the next newline should be ignored, used by the special footnote separator paragraph. diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index cea2dc473a8d..0e7f0678aed3 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1037,9 +1037,18 @@ void SectionPropertyMap::HandleMarginsHeaderFooter(bool bFirstPage, DomainMapper if (rDM_Impl.m_oBackgroundColor) Insert(PROP_BACK_COLOR, uno::makeAny(*rDM_Impl.m_oBackgroundColor)); - if (!rDM_Impl.m_bHasFtnSep) - // Set footnote line width to zero, document has no footnote separator. - Insert(PROP_FOOTNOTE_LINE_RELATIVE_WIDTH, uno::makeAny(sal_Int32(0))); + if (rDM_Impl.m_bHasFtn) + { + // Check for missing footnote separator only in case there is at least + // one footnote. + if (!rDM_Impl.m_bHasFtnSep) + { + // Set footnote line width to zero, document has no footnote separator. + Insert(PROP_FOOTNOTE_LINE_RELATIVE_WIDTH, uno::makeAny(sal_Int32(0))); + rDM_Impl.m_bHasFtn = false; + } + rDM_Impl.m_bHasFtnSep = false; + } /*** if headers/footers are available then the top/bottom margins of the header/footer are copied to the top/bottom margin of the page |