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.behrens@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 0000000..f8e27e5
--- /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 276bdd9..65b8ac9 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 04df49b..2edfec8 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)
{