summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapper_Impl.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-07-06 09:23:40 +0200
committerCaolán McNamara <caolanm@redhat.com>2015-07-08 11:46:16 +0000
commit16626008162545d3caec72fbffc4c19a79326a74 (patch)
treeb4fa9d588eac512fb8a3c4802656920357895341 /writerfilter/source/dmapper/DomainMapper_Impl.cxx
parent21d5e7bbb5ba986a3fd2b4194f83c18003fc3bac (diff)
tdf#90611 DOCX import: fix missing paragraph style on footnotes
One one hand, a problem since commit 330b860205c7ba69dd6603f65324d0f89ad9cd5f (fdo#68787 DOCX import: handle when w:separator is missing for footnotes, 2013-09-04) was that the type attribute from <w:footnote w:type="separator"> resulted in two ooxml:CT_FtnEdn_type tokens, ignoring too many paragraph ends for footnotes, which resulted in missing paragraph style on footnotes. On the other hand, fixing the first problem showed that it wasn't correct that commit 9389cf78e304a5a99bcf1745b9388e14ac36281a (cp#1000018 RTF import: empty para at the end of footnote text got lost, 2013-11-15) unconditionally removed the RemoveLastParagraph() call in DomainMapper_Impl::PopFootOrEndnote(). It turns out that RTF and DOCX have different semantics here, the footnote is always within a <p></p> pair in DOCX, while in RTF a \par at the end of a footnote means an empty paragraph. Fix that by conditionally restoring the removed RemoveLastParagraph() call. (cherry picked from commit 519b34300f73b1e08f6194d6ba49d4fc010cf186) Change-Id: I33020ac761c94addfec8164a17863565e4453b07 Reviewed-on: https://gerrit.libreoffice.org/16810 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper_Impl.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 944fdf32e109..5ff66e97ac26 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -208,6 +208,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bInHeaderFooterImport( false ),
m_bDiscardHeaderFooter( false ),
m_bInFootOrEndnote(false),
+ m_bSeenFootOrEndnoteSeparator(false),
m_bLineNumberingSet( false ),
m_bIsInFootnoteProperties( false ),
m_bIsCustomFtnMark( false ),
@@ -1747,6 +1748,9 @@ void DomainMapper_Impl::PushAnnotation()
void DomainMapper_Impl::PopFootOrEndnote()
{
+ if (!IsRTFImport())
+ RemoveLastParagraph();
+
// In case the foot or endnote did not contain a tab.
m_bIgnoreNextTab = false;
@@ -1759,9 +1763,18 @@ void DomainMapper_Impl::PopFootOrEndnote()
return;
}
m_aRedlines.pop();
+ m_bSeenFootOrEndnoteSeparator = false;
m_bInFootOrEndnote = false;
}
+void DomainMapper_Impl::SeenFootOrEndnoteSeparator()
+{
+ if (!m_bSeenFootOrEndnoteSeparator)
+ {
+ m_bSeenFootOrEndnoteSeparator = true;
+ m_bIgnoreNextPara = true;
+ }
+}
void DomainMapper_Impl::PopAnnotation()
{