[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Aug 17 19:12:25 UTC 2017


 sw/qa/extras/rtfexport/data/tdf107480.rtf |   16 ++++++++++++++++
 sw/qa/extras/rtfexport/rtfexport.cxx      |    7 +++++++
 writerfilter/source/rtftok/rtfsprm.cxx    |    4 ++++
 3 files changed, 27 insertions(+)

New commits:
commit 6e8c6f08cfc34ab59ef359152725aeae940f2654
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Aug 15 22:34:13 2017 +0200

    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.
    
    (cherry picked from commit 9dd82d0d68065ab95e20a1a489f4130299a8669e)
    
    Change-Id: I783d2175483bc80ead0a511ad15c4b75e4ab663c
    Reviewed-on: https://gerrit.libreoffice.org/41203
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

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 bfa59514ff59..b31a66a30f6e 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1211,6 +1211,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);
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx
index a1d0605a248b..7d0129cf2b5f 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -168,6 +168,10 @@ static bool isSPRMDeduplicateBlacklist(Id nId)
     // possibly from the numbering.
     case NS_ooxml::LN_CT_Ind_left:
     case NS_ooxml::LN_CT_Ind_right:
+    // \htmautsp arrives after the style table, so only the non-style value is
+    // correct, keep these.
+    case NS_ooxml::LN_CT_Spacing_beforeAutospacing:
+    case NS_ooxml::LN_CT_Spacing_afterAutospacing:
         return true;
 
     default:


More information about the Libreoffice-commits mailing list