From 67a0889450daa6b9c9c799dab2d9da3a5044cb5d Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 19 Jun 2017 21:43:10 +0200 Subject: tdf#108416 RTF import: fix unexpected bold list numbering Some paragraph-level run properties affect the current list style since commit 2123ede032ca64f696ef54af4ad3238974ca2b5d (n#758883 dmapper: paragraph-level run props should affect numberings as well, 2012-06-19). This was extended for any run properties in case of RTF since commit c1f8437dbed0e8b989e41a345ef7e658a6e8a4cd (fdo#83465 RTF import: handle font of numbering, 2014-09-25), as RTF doesn't really separate the paragraph-level and the other run properties. However, field formatting clearly should affect only the field itself, so disable this mechanism in that context. Change-Id: I6df7488e99e44f3ba7e17bf09ce590c88151e043 Reviewed-on: https://gerrit.libreoffice.org/38980 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sw/qa/extras/rtfimport/data/tdf108416.rtf | 18 ++++++++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 8 ++++++++ 2 files changed, 26 insertions(+) create mode 100644 sw/qa/extras/rtfimport/data/tdf108416.rtf (limited to 'sw') diff --git a/sw/qa/extras/rtfimport/data/tdf108416.rtf b/sw/qa/extras/rtfimport/data/tdf108416.rtf new file mode 100644 index 000000000000..5d38d0741068 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf108416.rtf @@ -0,0 +1,18 @@ +{\rtf1\adeflang1025 +{\*\listtable +{\list\listtemplateid492320832\listhybrid +{\listlevel\levelnfc0\levelnfcn0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid510954734\'03(\'00);}{\levelnumbers\'02;}\rtlch\fcs1\af0} +{\listname ;}\listid1847935044} +} +{\*\listoverridetable +{\listoverride\listid1847935044\listoverridecount0\ls3} +} +\pard\plain asdf asdf asdf asdf asdf asdf asdf asdf\par +\pard \ls3 +{before field } +{\field +{\*\fldinst {\b MERGEFIELD "ZADDFIELDCON_BEGDADE" }} +{\fldrslt {\b 01.08.2017}} +} +{ after\par } +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index f199cbedfe79..fe52bed1cf87 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2430,6 +2430,14 @@ DECLARE_RTFIMPORT_TEST(testTdf86814, "tdf86814.rtf") CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty(getRun(getParagraph(1), 1), "CharWeight")); } +DECLARE_RTFIMPORT_TEST(testTdf108416, "tdf108416.rtf") +{ + uno::Reference xCharacterStyles(getStyles("CharacterStyles")); + uno::Reference xListLabel(xCharacterStyles->getByName("ListLabel 1"), uno::UNO_QUERY); + // This was awt::FontWeight::BOLD, list numbering got an unexpected bold formatting. + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty(xListLabel, "CharWeight")); +} + DECLARE_RTFIMPORT_TEST(testTdf90315, "tdf90315.rtf") { uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); -- cgit