summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-08-15 22:34:13 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-08-16 08:14:27 +0200
commit9dd82d0d68065ab95e20a1a489f4130299a8669e (patch)
treeb43cc7b85bac6c6f7770a17bdb36092bf8c2e55d /sw
parentc0cb8cb25cc028e8f4f4bc06ae1a07882cd8dbfd (diff)
tdf#107480 RTF import: fix HTML automatic spacing in styles
\htmautsp changes the meaning of \sbauto and \saauto, but the auto keywords may appear early in style definitions before \htmautsp arrives. This wasn't a problem before commit 1be0a3fa9ebb22b607c54b47739d4467acfed259 (n#825305: writerfilter RTF import: override style properties like Word, 2014-06-17), as there the right auto keyword interpretation was repeated as direct formatting. So fix the regression by not deduplicating these keywords, which brings back the correct layout. A larger rework is necessary in the future to delay the parsing of the stylesheet table, that would be a cleaner approach. Change-Id: I783d2175483bc80ead0a511ad15c4b75e4ab663c Reviewed-on: https://gerrit.libreoffice.org/41187 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfexport/data/tdf107480.rtf16
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx7
2 files changed, 23 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf107480.rtf b/sw/qa/extras/rtfexport/data/tdf107480.rtf
new file mode 100644
index 000000000000..2edd895e02ab
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf107480.rtf
@@ -0,0 +1,16 @@
+{\rtf1
+{\fonttbl
+{\f0 Times New Roman;}
+}
+{\stylesheet
+{\snext0 Normal;}
+{\s3 \sbauto1\saauto1 heading 3;}
+}
+\paperw11906\paperh16838\margl1701\margr850\margt1134\margb1134
+\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine
+\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
+\asianbrkrule\newtblstyruls\nogrowautofit \fet0\sectd \linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sftnbj
+\htmautsp
+\pard\plain \s3 \sbauto1\saauto1
+1.\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 0d5efe90272c..8819a6561db8 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1210,6 +1210,13 @@ DECLARE_RTFEXPORT_TEST(testTdf107620, "tdf107620.docx")
CPPUNIT_ASSERT(!bAddParaTableSpacing);
}
+DECLARE_RTFEXPORT_TEST(testTdf107480, "tdf107480.rtf")
+{
+ // These were 176 (100 twips), as \htmautsp was parsed too late.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
+}
+
DECLARE_RTFEXPORT_TEST(testWatermark, "watermark.rtf")
{
uno::Reference<text::XTextRange> xShape(getShape(1), uno::UNO_QUERY);