From 946fee3ef1e319ad63a599b72dbd55ef52cbc640 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Fri, 30 Mar 2018 21:22:44 +0300 Subject: tdf#106062 ooxmlimport: skip fake tab only on hanging indent Export has changed, so that it only exports a tab when the footnote paragraph has a hanging indent. Adjusting the import code to match that change. Please test with MSO before flagging this patch as a regression. Certainly there will be some documents previously saved by LO which will now, in LO, show an extra tab character after the footnote. Any previously saved document without a hanging indent will display this extra tab. However, MSO has always seen that extra tab, so these patches are enhancing compatibility. This patch corrects several incorrect assumptions: -The paragraph style is not necessarily "Footnote". -The paragraph may have directly defined a hanging margin. -An aesthetic tab is needed on a hanging indent, not a defined margin. Change-Id: Ieaa76448ce202d92efdb8d1fc04ba2674ed120ba Reviewed-on: https://gerrit.libreoffice.org/52172 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna --- .../ooxmlexport/data/tdf106062_nonHangingFootnote.odt | Bin 0 -> 14255 bytes sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 9 +++++++++ 2 files changed, 9 insertions(+) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf106062_nonHangingFootnote.odt (limited to 'sw') diff --git a/sw/qa/extras/ooxmlexport/data/tdf106062_nonHangingFootnote.odt b/sw/qa/extras/ooxmlexport/data/tdf106062_nonHangingFootnote.odt new file mode 100644 index 000000000000..af5e225ea08c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf106062_nonHangingFootnote.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 24397c8688a6..9a10e7d0f2cb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -917,6 +917,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf105095, "tdf105095.docx") CPPUNIT_ASSERT_EQUAL( OUString("\tfootnote"), xTextRange->getString() ); } +DECLARE_OOXMLEXPORT_TEST(testTdf106062_nonHangingFootnote, "tdf106062_nonHangingFootnote.odt") +{ + uno::Reference xFootnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); + uno::Reference xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); + // This failed, tab between the footnote number and the footnote content was lost on import. + CPPUNIT_ASSERT_MESSAGE( "Footnote starts with a tab", xTextRange->getString().startsWith("\t") ); +} + DECLARE_OOXMLEXPORT_TEST( testActiveXCheckbox, "activex_checkbox.docx" ) { uno::Reference xControlShape( getShape(1), uno::UNO_QUERY ); -- cgit v1.2.3