sw/qa/extras/rtfexport/data/tdf148515.rtf | 14 ++++++++++++++ sw/qa/extras/rtfexport/rtfexport4.cxx | 19 +++++++++++++++++++ writerfilter/source/rtftok/rtfsprm.cxx | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-)
New commits: commit 3a05acb8f0d94728ea6cbfd7a69dac6ffa7ffc68 Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Thu Apr 21 10:04:50 2022 +0300 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Wed Apr 27 00:56:10 2022 +0200 tdf#148515: RTF filter: do not use char prop defaults for tables During deduplication of table row (when nStyleType == 0) we should not deduplicate character properties against default style: this leads to invalid default settings for table rows/cells. Attempts to do so are already made during \pard processing when default style is checked if it is paragraph style. But this is not enough: style definition can contain paragraph and character properties as well. Change-Id: If520c5a248897728b7de08a017136ca1a01a5f13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132943 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/sw/qa/extras/rtfexport/data/tdf148515.rtf b/sw/qa/extras/rtfexport/data/tdf148515.rtf new file mode 100644 index 000000000000..f8e27e577425 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf148515.rtf @@ -0,0 +1,14 @@ +{\rtf1\ansi +{\fonttbl +{\f1 Impact;} +} + +{\stylesheet +{\fs20\f1\af1 Normal;} +} + +\trowd\cellx5000\cellx10000 +\pard\intbl\f1\fs10 XXXXXX\cell +\pard\intbl\cell +\row +} diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 276bdd963b26..65b8ac90954c 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -646,6 +646,25 @@ DECLARE_RTFEXPORT_TEST(testTdf139948, "tdf139948.rtf") sal_uInt32(0), getProperty<table::BorderLine2>(getParagraph(5), "BottomBorder").LineWidth); } +DECLARE_RTFEXPORT_TEST(testTdf148515, "tdf148515.rtf") +{ + uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY); + + uno::Reference<text::XTextRange> xCell1(xTable->getCellByName("A1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("XXXXXX"), xCell1->getString()); + CPPUNIT_ASSERT_EQUAL( + 5.0f, + getProperty<float>(getRun(getParagraphOfText(1, xCell1->getText()), 1), "CharHeight")); + + uno::Reference<text::XTextRange> xCell2(xTable->getCellByName("B1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(""), xCell2->getString()); + CPPUNIT_ASSERT_EQUAL( + 5.0f, + getProperty<float>(getRun(getParagraphOfText(1, xCell2->getText()), 1), "CharHeight")); + + CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(getRun(getParagraph(2), 1), "CharHeight")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx index 04df49bc0287..2edfec829edf 100644 --- a/writerfilter/source/rtftok/rtfsprm.cxx +++ b/writerfilter/source/rtftok/rtfsprm.cxx @@ -159,7 +159,7 @@ void RTFSprms::eraseLast(Id nKeyword) static RTFValue::Pointer_t getDefaultSPRM(Id const id, Id nStyleType) { - if (!nStyleType || nStyleType == NS_ooxml::LN_Value_ST_StyleType_character) + if (nStyleType == NS_ooxml::LN_Value_ST_StyleType_character) { switch (id) {