diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-06-26 15:47:54 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-06-26 18:09:05 +0200 |
commit | 0416ee7831fb8682a1ca1b90728aa32b9e976be1 (patch) | |
tree | 423605e8af73e4ff8b19edeb5ff70e3ec8e4a612 /sw | |
parent | 8d6eb11d6965ee93e72513f5e01b67f598edf6c3 (diff) |
bnc#823675 RTF import: fix import of numbering bullet associated font
There were multiple problems here:
- \f had a special handler for the listlevel destination, \af had not
- in case of multiple \f or \af, the first one is used for the bullet
font
- in case only \af is used for the bullet font, its value should be used
for \f as well
Change-Id: I6631504c1aa9f2e0792a3469a5fdce5b7bd49518
(cherry picked from commit 55162d7422a3b175c7fe9c175e0dec91b1932b6a)
Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/rtfimport/data/n823675.rtf | 27 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 22 |
2 files changed, 49 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/n823675.rtf b/sw/qa/extras/rtfimport/data/n823675.rtf new file mode 100644 index 000000000000..a8a2bd313478 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/n823675.rtf @@ -0,0 +1,27 @@ +{\rtf1 +{\fonttbl +{\f0\fbidi \froman\fcharset0\fprq2 +Times New Roman;} +{\f2\fbidi \fmodern\fcharset0\fprq1 +Courier New;} +{\f3\fbidi \froman\fcharset2\fprq2 +Symbol;} +{\fdbminor\f31505\fbidi \froman\fcharset136\fprq2 +PMingLiU;} +} +{\*\listtable +{\list\listtemplateid1917372094 +{\listlevel\levelnfc23 +\leveljc0\levelfollow0\levelstartat0 +{\leveltext\'01\u-3913 ?;} +{\levelnumbers;} +\loch\af3\hich\af3\dbch\af31505 \fi-360\li720\lin720 } +\listid1377391170} +} +{\*\listoverridetable +{\listoverride\listid1377391170\listoverridecount0\ls1} +} +\pard\plain +\ls1 +This\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 84d59c0b69af..9dfb1b641ed0 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -25,6 +25,7 @@ * instead of those above. */ +#include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> @@ -153,6 +154,7 @@ public: void testN825305(); void testParaBottomMargin(); void testN823655(); + void testN823675(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -275,6 +277,7 @@ void Test::run() {"n825305.rtf", &Test::testN825305}, {"para-bottom-margin.rtf", &Test::testParaBottomMargin}, {"n823655.rtf", &Test::testN823655}, + {"n823675.rtf", &Test::testN823675}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { @@ -1278,6 +1281,25 @@ void Test::testN823655() CPPUNIT_ASSERT_EQUAL(sal_Int32(286), aCoordinates[0].Second.Value.get<sal_Int32>()); } +void Test::testN823675() +{ + uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aProps; + xLevels->getByIndex(0) >>= aProps; // 1st level + awt::FontDescriptor aFont; + + for (int i = 0; i < aProps.getLength(); ++i) + { + const beans::PropertyValue& rProp = aProps[i]; + + if (rProp.Name == "BulletFont") + aFont = rProp.Value.get<awt::FontDescriptor>(); + } + // This was empty, i.e. no font name was set for the bullet numbering. + CPPUNIT_ASSERT_EQUAL(OUString("Symbol"), aFont.Name); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); |