From f575f70b8303ba187f6989920281ff02e7a431c9 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 22 Jun 2017 13:41:30 +0200 Subject: tdf#108682 DOCX import: fix for negative values I didn't find UI in Word to create the equivalent markup when you set line spacing to exactly 13pt for new documents is: The OOXML spec and Microsoft's implementer notes ([MS-OI29500]) is also pretty silent about what a negative value means. However, if this markup is converted to WW8 by Word, then the WW8 LPSD structure is like this (as presented by doc-dumper): For the 0xfefc value the [MS-DOC] spec clearly states that means the type of the spacing is "exactly", with the value of 0x10000-0xfefc, i.e. the same 260 twips. Change-Id: I84b485d02dea49c610b6df2e06ccce03e1d29d21 Reviewed-on: https://gerrit.libreoffice.org/39091 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sw/qa/extras/ooxmlexport/data/tdf108682.docx | Bin 0 -> 12653 bytes sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 11 +++++++++++ 2 files changed, 11 insertions(+) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf108682.docx (limited to 'sw') diff --git a/sw/qa/extras/ooxmlexport/data/tdf108682.docx b/sw/qa/extras/ooxmlexport/data/tdf108682.docx new file mode 100644 index 000000000000..1364025b826c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf108682.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 39af9d435af7..93f3f320f27d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #include @@ -694,6 +696,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107618, "tdf107618.doc") CPPUNIT_ASSERT_EQUAL(true, getProperty(xPageStyle, "HeaderIsOn")); } +DECLARE_OOXMLEXPORT_TEST(testTdf108682, "tdf108682.docx") +{ + auto aLineSpacing = getProperty(getParagraph(1), "ParaLineSpacing"); + // This was style::LineSpacingMode::PROP. + CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::FIX, aLineSpacing.Mode); + // 260 twips in mm100, this was a negative value. + CPPUNIT_ASSERT_EQUAL(static_cast(459), aLineSpacing.Height); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit