diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-02-25 21:38:48 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-02-26 13:49:15 +0100 |
commit | bfc0eca6cfabfe6950de3345554318150a531d44 (patch) | |
tree | 5d98007693dfd828d79bf199cf47c4f39c2d5e87 /sw | |
parent | 919ee53d6169bff6788723703b0fcb0c9e4ad8be (diff) |
tdf#123393 RTF import: fix too big font size in table cell
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 <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf123393.rtf | 14 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport3.cxx | 13 |
2 files changed, 27 insertions, 0 deletions
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<double>(getRun(getParagraph(1), 1), "CharHeight")); } +DECLARE_RTFEXPORT_TEST(testTdf123393, "tdf123393.rtf") +{ + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XTextRange> 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<float>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharHeight")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |