sw/qa/extras/rtfexport/data/tdf122455.rtf | 21 ++++++++++++++++ sw/qa/extras/rtfexport/rtfexport3.cxx | 8 ++++++ sw/qa/extras/rtfimport/data/tdf122430.rtf | 31 +++++++++++++++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 7 +++++ sw/source/filter/ww8/rtfattributeoutput.cxx | 1 writerfilter/source/rtftok/rtfdispatchflag.cxx | 8 ++++++ 6 files changed, 76 insertions(+)
New commits: commit 63ee1e1b27b5a9b6b221a78a4567f76cba2a1adb Author: Miklos Vajna <[email protected]> AuthorDate: Mon Jan 28 21:50:54 2019 +0100 Commit: Christian Lohmaier <[email protected]> CommitDate: Mon Feb 11 14:54:53 2019 +0100 tdf#122430 RTF import: fix lost font size on footnote start This become more visible since commit 49614a9ea971ff7f370f863ce8a2735aab973cee (tdf#119599 RTF import: fix missing deduplication of font size, 2018-09-24) as now incorrect font size from style affects the rendering result. Change-Id: I5b339337f021e2fc359f6fc5f5aa2ed0bcf844b9 Reviewed-on: https://gerrit.libreoffice.org/67034 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit e45fbf479944b9ec940bdddfa8ee7d523244a9ba) Reviewed-on: https://gerrit.libreoffice.org/67122 Reviewed-by: Christian Lohmaier <[email protected]> diff --git a/sw/qa/extras/rtfimport/data/tdf122430.rtf b/sw/qa/extras/rtfimport/data/tdf122430.rtf new file mode 100644 index 000000000000..fc1a80f532c9 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf122430.rtf @@ -0,0 +1,31 @@ +{\rtf1\ansi\deff0\adeflang1025 +{\fonttbl +{\f0\froman\fprq2\fcharset0 Times New Roman;} +{\f1\froman\fprq2\fcharset2 Symbol;} +{\f2\fswiss\fprq2\fcharset0 Arial;} +{\f3\froman\fprq2\fcharset0 Arial;} +{\f4\froman\fprq2\fcharset0 Cambria;} +{\f5\froman\fprq2\fcharset0 Calibri;} +{\f6\fnil\fprq2\fcharset0 Microsoft YaHei;} +{\f7\fnil\fprq2\fcharset0 Cambria;} +{\f8\fnil\fprq2\fcharset0 Times New Roman;} +{\f9\fnil\fprq2\fcharset0 Lucida Sans;} +{\f10\fswiss\fprq0\fcharset128 Lucida Sans;} +} +{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;} +{\stylesheet +{\s0\snext0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af7\langfe1081\dbch\af7\afs24\alang1081\loch\f0\fs24\lang1040 Normal;} +{\s43\snext43\ql\nowidctlpar\hyphpar0\faauto\li0\ri0\lin0\rin0\fi0\sb240\sa120\keepn\ltrpar\cf1\b\kerning1\dbch\af7\langfe1040\dbch\af9\afs24\alang1081\loch\f3\fs36\lang1040 Titolo 1;} +{\s61\sbasedon0\snext61\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af7\langfe1081\dbch\af7\afs24\loch\f0\fs24\lang1040 Footnote;} +} +\pard\plain \s43\ql\nowidctlpar\hyphpar0\faauto\li0\ri0\lin0\rin0\fi0\sb240\sa120\keepn\ltrpar\cf1\b\kerning1\dbch\af7\langfe1040\dbch\af9\afs24\alang1081\loch\f3\fs36\lang1040\sb240\sa120 +{ +{\super 1 +{\*\footnote 1\pard\plain \s61\fs24 +{\cf1\kerning1\dbch\af7\langfe1040\rtlch \ltrch\rtlch \ltrch\loch\fs20\lang1040 +\tab A} +} +} +} +A +\par} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 233d987e5db0..f09169ed77d3 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -354,6 +354,13 @@ DECLARE_RTFIMPORT_TEST(testTdf112211_2, "tdf112211-2.rtf") CPPUNIT_ASSERT_LESS(300, nWidth); } +DECLARE_RTFIMPORT_TEST(testTdf122430, "tdf122430.rtf") +{ + // Without the accompanying fix in place, this test would have failed with + // 'Expected: 18, Actual : 12', i.e. the font was smaller than expected. + CPPUNIT_ASSERT_EQUAL(18.0f, getProperty<float>(getRun(getParagraph(1), 2), "CharHeight")); +} + DECLARE_RTFIMPORT_TEST(testFdo49892, "fdo49892.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index 833b38d16876..b68262ff265e 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -773,6 +773,14 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_SUPER: { + // Make sure character properties are not lost if the document + // starts with a footnote. + if (!isStyleSheetImport()) + { + checkFirstRun(); + checkNeedPap(); + } + if (!m_aStates.top().pCurrentBuffer) m_aStates.top().pCurrentBuffer = &m_aSuperBuffer; commit b22e65d4b44f9a778c372929a7461ba5b17f7314 Author: Miklos Vajna <[email protected]> AuthorDate: Mon Jan 14 20:27:23 2019 +0100 Commit: Christian Lohmaier <[email protected]> CommitDate: Mon Feb 11 14:54:44 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 <[email protected]> (cherry picked from commit 57d3c927eff495702cd12f2a15ef0763f51977a7) Reviewed-on: https://gerrit.libreoffice.org/66398 Reviewed-by: Christian Lohmaier <[email protected]> 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()); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
