From bfc0eca6cfabfe6950de3345554318150a531d44 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 25 Feb 2019 21:38:48 +0100 Subject: tdf#123393 RTF import: fix too big font size in table cell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The reason was that A2 had an explicit paragraph style reference, but A1 did not, so table buffering caused A2 style to affect A1 style as well. Combine this with style deduplication, and then A2 style considered the direct formatting (font size) in A1 to be redundant, so it was lost on import. Fix the problem by moving the copy&pasted properties buffering to a single function, and there buffering not only the properties, but also the active style index. (cherry picked from commit b7dabb80f45a65713f114c61e1d695f3f8093812) Change-Id: I99f2020b8bef237849fd622b25ac5ef0516d69e4 Reviewed-on: https://gerrit.libreoffice.org/68373 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/qa/extras/rtfexport/data/tdf123393.rtf | 14 ++++++++++++++ sw/qa/extras/rtfexport/rtfexport3.cxx | 13 +++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 sw/qa/extras/rtfexport/data/tdf123393.rtf (limited to 'sw') diff --git a/sw/qa/extras/rtfexport/data/tdf123393.rtf b/sw/qa/extras/rtfexport/data/tdf123393.rtf new file mode 100644 index 000000000000..381b038d314c --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf123393.rtf @@ -0,0 +1,14 @@ +{\rtf1 +{\fonttbl +{\f0 Times New Roman;} +} +{\stylesheet +{\s0\fs20 Normal;} +{\s31\fs14 Body Text 3;} +} +Before\par +\trowd\cellx2694\cellx4678 +\pard\intbl\fs14 A1\cell +\pard\intbl\s31\fs14 B1\cell\row +\pard\plain After\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index e4a069464335..576f7b6c85b8 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -219,6 +219,19 @@ DECLARE_RTFEXPORT_TEST(testTdf122455, "tdf122455.rtf") CPPUNIT_ASSERT_EQUAL(16.0, getProperty(getRun(getParagraph(1), 1), "CharHeight")); } +DECLARE_RTFEXPORT_TEST(testTdf123393, "tdf123393.rtf") +{ + uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); + uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); + // Without the accompanying fix in place, this test would have failed with + // 'Expected: 7; Actual : 10', i.e. font size was too large. + CPPUNIT_ASSERT_EQUAL( + 7.f, getProperty(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharHeight")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit