diff options
-rw-r--r-- | sw/qa/extras/rtfimport/data/cs-bold.rtf | 12 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 12 |
3 files changed, 29 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfimport/data/cs-bold.rtf b/sw/qa/extras/rtfimport/data/cs-bold.rtf new file mode 100644 index 000000000000..8be0f2702fee --- /dev/null +++ b/sw/qa/extras/rtfimport/data/cs-bold.rtf @@ -0,0 +1,12 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0 +{\stylesheet +{\ql \li0\ri0\sl240\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \f40\fs18\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 +\snext0 \sqformat \spriority14 \styrsid11343869 Normal;} +{\*\cs73 \additive \rtlch\fcs1 \ab\af0 \ltrch\fcs0 \b +\sbasedon10 \sqformat \spriority22 \styrsid12276622 Strong;} +} +\pard +{\rtlch\fcs1 \ab\af40\afs18 \ltrch\fcs0 +\cs73\b\f41\fs18\lang9\langfe1033\langnp9\insrsid12276622\charrsid12797106 bold} +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index ec58d4ca6c03..acd78d0461fe 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1926,6 +1926,12 @@ DECLARE_RTFIMPORT_TEST(testFdo82078, "fdo82078.rtf") CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(getRun(getParagraph(1), 2), "CharWeight")); } +DECLARE_RTFIMPORT_TEST(testCsBold, "cs-bold.rtf") +{ + // This was awt::FontWeight::NORMAL, i.e. the first run was bold, when it should be bold (applied character style without direct formatting). + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(getParagraph(1), 1), "CharWeight")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index a4bd1ddeca16..4cad765d549f 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -458,7 +458,17 @@ writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::getProperties(RT RTFReferenceProperties& rCharProps = *(RTFReferenceProperties*)itChar->second.get(); RTFSprms& rCharStyleSprms = rCharProps.getSprms(); for (RTFSprms::Iterator_t itSprm = rCharStyleSprms.begin(); itSprm != rCharStyleSprms.end(); ++itSprm) - aStyleSprms.set(itSprm->first, itSprm->second); + { + // createStyleProperties() puts properties to rPr, but here we need a flat list. + if (itSprm->first == NS_ooxml::LN_CT_Style_rPr) + { + RTFSprms& rRPrSprms = itSprm->second->getSprms(); + for (RTFSprms::Iterator_t itRPrSprm = rRPrSprms.begin(); itRPrSprm != rRPrSprms.end(); ++itRPrSprm) + aStyleSprms.set(itRPrSprm->first, itRPrSprm->second); + } + else + aStyleSprms.set(itSprm->first, itSprm->second); + } RTFSprms& rCharStyleAttributes = rCharProps.getAttributes(); for (RTFSprms::Iterator_t itAttr = rCharStyleAttributes.begin(); itAttr != rCharStyleAttributes.end(); ++itAttr) |