diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-01-14 20:27:23 +0100 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2019-02-11 14:54:44 +0100 |
commit | b22e65d4b44f9a778c372929a7461ba5b17f7314 (patch) | |
tree | fd2f9dbd57db66973caec3e7e84ffc96f90a6658 | |
parent | ad32ff8f41e452156a2d16119b60542de11b42c8 (diff) |
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@collabora.com>
(cherry picked from commit 57d3c927eff495702cd12f2a15ef0763f51977a7)
Reviewed-on: https://gerrit.libreoffice.org/66398
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf122455.rtf | 21 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport3.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 1 |
3 files changed, 30 insertions, 0 deletions
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 e1ca5c9b709b..e4a069464335 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -211,6 +211,14 @@ DECLARE_RTFEXPORT_TEST(testTdf121623, "tdf121623.rtf") CPPUNIT_ASSERT_EQUAL(1, getPages()); } +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 0d06d47368aa..aad9b6a9e21d 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1525,6 +1525,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()); } |