summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-08-02 18:55:55 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-08-03 19:43:19 +0000
commitaed0f1e27be04ecd43b2edd3885c1f2eea0a3de9 (patch)
treea9aed1a7e6706988d1d1e8fdce211f49925a74bb /sw
parentd2dd174ac05d7c2844c5e60169128e2a02d4311b (diff)
fdo#81944: writerfilter: RTF import: don't drop fonts in stylesheet
The font definitions in the style sheet meet an untimely death in StyleSheetTable::lcl_sprm(), which special-cases LN_EG_RPrBase_rFonts, routing it into TblStylePrHandler. Avoid this by sending style entries to the domain mapper in the same way as the OOXML tokenizer, i.e., with paragraph and run properties nested below CT_Style_pPr/rPr. This reveals that the CT_Style_basedOn was wrongly handled as paragraph property. Change-Id: Ic724ba48fe36bf782b1b430bdafdb1df480d5ad3 (cherry picked from commit f8e8e476aa0a5576234dbb4daac9dc299e044e61) Reviewed-on: https://gerrit.libreoffice.org/10698 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfimport/data/fdo81944.rtf15
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx13
2 files changed, 28 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo81944.rtf b/sw/qa/extras/rtfimport/data/fdo81944.rtf
new file mode 100644
index 000000000000..780e9bd8a599
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo81944.rtf
@@ -0,0 +1,15 @@
+{\rtf1
+
+{\fonttbl
+{\f38\fbidi \fswiss\fcharset0\fprq2 Segoe UI;}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2 Times New Roman;}
+}
+
+{\stylesheet
+{\qc \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \f38\fs18\lang1033\langfe1033 Normal;}
+}
+
+\pard
+
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index ca603212fb31..44d49da79e14 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1163,6 +1163,19 @@ DECLARE_RTFIMPORT_TEST(testPageBackground, "page-background.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor"));
}
+DECLARE_RTFIMPORT_TEST(testFdo81944, "fdo81944.rtf")
+{
+ // font properties in style were not imported
+ uno::Reference<beans::XPropertySet> xPropertySet(
+ getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY);
+ uno::Reference<style::XStyle> xStyle(xPropertySet, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("Segoe UI"), getProperty<OUString>(xStyle, "CharFontName"));
+ CPPUNIT_ASSERT_EQUAL(9.0f, getProperty<float>(xStyle, "CharHeight"));
+ // not sure if this should be set on Asian or Complex or both?
+ CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"), getProperty<OUString>(xStyle, "CharFontNameComplex"));
+ CPPUNIT_ASSERT_EQUAL(11.0f, getProperty<float>(xStyle, "CharHeightComplex"));
+}
+
DECLARE_RTFIMPORT_TEST(testFdo62044, "fdo62044.rtf")
{
// The problem was that RTF import during copy&paste did not ignore existing paragraph styles.