From 1970a686273c5d4fc1eeb4430283e37085d9f647 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 31 Oct 2017 09:48:33 +0100 Subject: tdf#113408 RTF import style dedup: separate paragraph and character handling The problem was that the paragraph in question had no left margin, while it should have one. The reason for this is that the style deduplication logic took both the current paragraph and character style, but the direct formatting only contained character formatting, so it tried to emit the default values for all paragraph formatting. This started to show up after commit 657c6cc3acec0528209a8584b838cd6de581c437 (tdf#104228 RTF import: fix override of style left/right para margin, 2016-12-13), but the root cause is much older, it was there since commit 321d7ec2071472b3765a00806715e7ad9f8a306f (fdo#82078 RTF import: fix bold text spilling over to non-bold text, 2014-09-06). Change-Id: If03240a85cc9de89afe9111c2d29de2672e407bf Reviewed-on: https://gerrit.libreoffice.org/44097 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/qa/extras/rtfexport/data/tdf113408.rtf | 24 ++++++++++++++++++++++++ sw/qa/extras/rtfexport/rtfexport.cxx | 6 ++++++ 2 files changed, 30 insertions(+) create mode 100644 sw/qa/extras/rtfexport/data/tdf113408.rtf (limited to 'sw/qa/extras') diff --git a/sw/qa/extras/rtfexport/data/tdf113408.rtf b/sw/qa/extras/rtfexport/data/tdf113408.rtf new file mode 100644 index 000000000000..60d9bc98d70f --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf113408.rtf @@ -0,0 +1,24 @@ +{\rtf1\adeflang1037\ansi\ansicpg1252\uc1\adeff1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs1025 +{\fonttbl +{\f0\fbidi \froman\fcharset238\fprq2 Times New Roman;} +} +{\stylesheet +{Normal;} +{\s66\li720\ri0 List Paragraph;} +} +{\*\listtable +{\list\listtemplateid1275618250\listhybrid +{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0 +\levelstartat1\levelspace0\levelindent0 +{\leveltext\leveltemplateid67698703\'02\'00.;} +{\levelnumbers\'01;} +\rtlch\fcs1 \af0 \fbias0 \fi-360\li720 } +{\listname ;} +\listid1880166401} +} +{\*\listoverridetable +{\listoverride\listid1880166401\listoverridecount0\ls9} +} +\paperw12240\paperh15840\margl1440\margr1440\margt1800\margb1440\gutter0\viewkind1 +\pard \s66\li720\ri0\itap0 \par +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 5923007b8d3a..1d75996fcdda 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -743,6 +743,12 @@ DECLARE_RTFEXPORT_TEST(testPictureWrapPolygon, "picture-wrap-polygon.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-67)), getProperty(getShape(1), "VertOrientPosition")); } +DECLARE_RTFEXPORT_TEST(testTdf113408, "tdf113408.rtf") +{ + // This was 0, left margin was not inherited from style properly. + CPPUNIT_ASSERT_EQUAL(static_cast(1270), getProperty(getParagraph(1), "ParaLeftMargin")); +} + DECLARE_RTFEXPORT_TEST(testAbi10039, "abi10039.odt") { // Make sure we don't just crash on export, and additionally the shape should not be inline (as it's at-page anchored originally). -- cgit