summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-02-25 21:38:48 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-02-26 08:56:48 +0100
commitb7dabb80f45a65713f114c61e1d695f3f8093812 (patch)
tree40092f7a59f8e81d12341504091e376f22ed688d /sw
parent984a0c79cb57789cff6416900fc363eefead44db (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. Change-Id: I99f2020b8bef237849fd622b25ac5ef0516d69e4 Reviewed-on: https://gerrit.libreoffice.org/68361 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfexport/data/tdf123393.rtf14
-rw-r--r--sw/qa/extras/rtfexport/rtfexport5.cxx13
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/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx
index fb5e0b8f4168..2fb059831e97 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -657,6 +657,19 @@ DECLARE_RTFEXPORT_TEST(testFdo84679, "fdo84679.rtf")
getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaBottomMargin"));
}
+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"));
+}
+
DECLARE_RTFEXPORT_TEST(testFdo83464, "fdo83464.rtf")
{
// Problem was that the text in the textframe had wrong font.