summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-01-28 21:50:54 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2019-02-11 14:54:53 +0100
commit63ee1e1b27b5a9b6b221a78a4567f76cba2a1adb (patch)
treec27e74fd019e3fd69c6fa5057753c3e383e6c022
parentb22e65d4b44f9a778c372929a7461ba5b17f7314 (diff)
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 <vmiklos@collabora.com> (cherry picked from commit e45fbf479944b9ec940bdddfa8ee7d523244a9ba) Reviewed-on: https://gerrit.libreoffice.org/67122 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sw/qa/extras/rtfimport/data/tdf122430.rtf31
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx7
-rw-r--r--writerfilter/source/rtftok/rtfdispatchflag.cxx8
3 files changed, 46 insertions, 0 deletions
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;