[Libreoffice-commits] core.git: sw/qa sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 15 08:22:13 UTC 2019


 sw/qa/extras/rtfexport/data/tdf122455.rtf   |   21 +++++++++++++++++++++
 sw/qa/extras/rtfexport/rtfexport3.cxx       |    8 ++++++++
 sw/source/filter/ww8/rtfattributeoutput.cxx |    1 +
 3 files changed, 30 insertions(+)

New commits:
commit 57d3c927eff495702cd12f2a15ef0763f51977a7
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Jan 14 20:27:23 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Jan 15 09:21:49 2019 +0100

    tdf#122455 RTF export: fix font style from list def leaking into first para
    
    This was a problem since RtfAttributeOutput::NumberingLevel() started to
    use OutputItemSet() or when m_aStyles and m_aStylesEnd was separated,
    but both were already like this in commit
    5bbc027d5dae3472223538b13933ff821e027737 (cws-vmiklos01.diff: Better RTF
    export filter, 2010-09-17).
    
    If m_aStylesEnd is not consumed by NumberingLevel(), then the first run
    will include its contents, which is incorrect.
    
    Change-Id: Ifc93ae5f0057102fab636febae5ee2462361878e
    Reviewed-on: https://gerrit.libreoffice.org/66332
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/rtfexport/data/tdf122455.rtf b/sw/qa/extras/rtfexport/data/tdf122455.rtf
new file mode 100644
index 000000000000..12e0948a0ba5
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf122455.rtf
@@ -0,0 +1,21 @@
+{\rtf1
+{\stylesheet
+{\s1\fs32 Intestazione 1;}
+}
+{\*\listtable
+{\list\listtemplateid1
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0
+\fi-432\li432}
+\listid1}
+{\list\listtemplateid4
+{\listlevel\levelnfc23\leveljc0\levelstartat1\levelfollow0
+\dbch\af3\fi-360\li720}
+\listid4}
+}
+{\listoverridetable
+{\listoverride\listid1\listoverridecount0\ls1}
+{\listoverride\listid4\listoverridecount0\ls4}
+}
+\pard\plain\s1\fs32\ls1 first\par
+\pard\plain\ls4\fs64 second\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 13b0524d43bc..9faa2f83c392 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -236,6 +236,14 @@ DECLARE_RTFEXPORT_TEST(testUlw, "ulw.rtf")
     CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(1), 1), "CharWordMode"));
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf122455, "tdf122455.rtf")
+{
+    // Without the accompanying fix in place, this test would have failed with
+    // 'Expected: 16; Actual  : 32', the font size from a list definition
+    // leaked into the first run's character properties.
+    CPPUNIT_ASSERT_EQUAL(16.0, getProperty<double>(getRun(getParagraph(1), 1), "CharHeight"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 34f8bb5843e8..845ac653fd73 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1532,6 +1532,7 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart,
         }
         m_rExport.OutputItemSet(*pOutSet, false, true, i18n::ScriptType::LATIN,
                                 m_rExport.m_bExportModeRTF);
+        m_aStyles.append(m_aStylesEnd.makeStringAndClear());
         m_rExport.Strm().WriteCharPtr(m_aStyles.makeStringAndClear().getStr());
     }
 


More information about the Libreoffice-commits mailing list