diff options
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf89702.docx | bin | 0 -> 13147 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 14 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 16 |
3 files changed, 24 insertions, 6 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf89702.docx b/sw/qa/extras/ooxmlimport/data/tdf89702.docx Binary files differnew file mode 100644 index 000000000000..5542d1cbe575 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf89702.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 2bac72a10ed9..b4f85571a7fa 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2735,6 +2735,20 @@ DECLARE_OOXMLIMPORT_TEST(testTdf90611, "tdf90611.docx") CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(getParagraphOfText(1, xFootnoteText), "CharHeight")); } +DECLARE_OOXMLIMPORT_TEST(testTdf89702, "tdf89702.docx") +{ + // Get the first paragraph's numbering style's 2nd level's character style name. + uno::Reference<text::XTextRange> xParagraph = getParagraph(1); + auto xLevels = getProperty< uno::Reference<container::XIndexAccess> >(xParagraph, "NumberingRules"); + uno::Sequence<beans::PropertyValue> aLevel; + xLevels->getByIndex(1) >>= aLevel; // 2nd level + OUString aCharStyleName = std::find_if(aLevel.begin(), aLevel.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "CharStyleName"; })->Value.get<OUString>(); + + // Make sure that the font name is Arial, this was Verdana. + uno::Reference<beans::XPropertySet> xStyle(getStyles("CharacterStyles")->getByName(aCharStyleName), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty<OUString>(xStyle, "CharFontName")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 5ff66e97ac26..515d6fe0514c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -5042,12 +5042,16 @@ uno::Reference<beans::XPropertySet> DomainMapper_Impl::GetCurrentNumberingCharSt uno::Reference<container::XIndexAccess> xLevels = GetCurrentNumberingRules(&nListLevel); if (!xLevels.is()) { - // Looking up the paragraph context explicitly (and not just taking - // the top context) is necessary for RTF, where formatting of a run - // and of the paragraph mark is not separated. - PropertyMapPtr pContext = GetTopContextOfType(CONTEXT_PARAGRAPH); - if (!pContext) - return xRet; + PropertyMapPtr pContext = m_pTopContext; + if (IsRTFImport()) + { + // Looking up the paragraph context explicitly (and not just taking + // the top context) is necessary for RTF, where formatting of a run + // and of the paragraph mark is not separated. + pContext = GetTopContextOfType(CONTEXT_PARAGRAPH); + if (!pContext) + return xRet; + } // In case numbering rules is not found via a style, try the direct formatting instead. boost::optional<PropertyMap::Property> oProp = pContext->getProperty(PROP_NUMBERING_RULES); |