summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-07-04 08:51:53 +0200
committerMichael Stahl <mstahl@redhat.com>2017-07-04 13:30:08 +0200
commit10019608fd49c9d96b7015f982f40b1c09bc8b14 (patch)
treefcde61f06bf866aa15cdd788174cbe452fbba664 /sw
parentdb85aebb7119181f9d96385006e52384c5457600 (diff)
tdf#105095 DOCX import: conditionally ignore leading tab in footnotes
Commit b38629ae210b204a6d24d6e9c5c62eaaf563d494 (cp#1000017 DOCX/RTF import: avoid fake tab char in footnotes, 2013-12-05) added code to strip leading tabs from footnote text to improve odt->docx->odt rountrip experience. Turns out that this is correct only in case the gap between the footnote number and the content is provided by a paragraph margin. In case there is no such margin, then the tab is wanted; so only conditionally ignore such leading tab characters. (cherry picked from commit abc440a691efb872afac385ce5ed28cd5db56c8c) Change-Id: I9d419bf2fd3b4899208489210cbe9809a2ab0736 Reviewed-on: https://gerrit.libreoffice.org/39494 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf105095.docxbin0 -> 15756 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport8.cxx7
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx10
3 files changed, 16 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf105095.docx b/sw/qa/extras/ooxmlexport/data/tdf105095.docx
new file mode 100644
index 000000000000..0a6a7a2ac326
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf105095.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 0981a6efb135..07d33865f7e7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -1988,7 +1988,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf90810, "tdf90810short.docx")
uno::Reference<text::XFootnote> xFootnote(xFootnoteIdxAcc->getByIndex(0), uno::UNO_QUERY);
uno::Reference<text::XText> xFootnoteText(xFootnote, uno::UNO_QUERY);
rtl::OUString sFootnoteText = xFootnoteText->getString();
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(90), sFootnoteText.getLength());
+ // Original document doesn't have a leading tab in the footnote, but the
+ // export adds one unconditionally.
+ if (mbExported)
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(91), sFootnoteText.getLength());
+ else
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(90), sFootnoteText.getLength());
}
DECLARE_OOXMLEXPORT_TEST(testTdf89165, "tdf89165.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 97caff77803c..81692f745778 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -605,6 +605,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf100075, "tdf100075.docx")
CPPUNIT_ASSERT(getProperty<sal_Int32>(xFrame1, "Height") > getProperty<sal_Int32>(xFrame2, "Height"));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf105095, "tdf105095.docx")
+{
+ uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
+ // This failed, tab between the footnote number and the footnote content
+ // was lost on import.
+ CPPUNIT_ASSERT(xTextRange->getString().endsWith("\tfootnote"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */