diff options
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf95213.docx | bin | 0 -> 17747 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 14 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.hxx | 2 |
9 files changed, 25 insertions, 10 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 0507fcca7693..9deea3e1eb2a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -501,7 +501,7 @@ DECLARE_OOXMLEXPORT_TEST(testfdo76934, "fdo76934.docx") return; // Ensure that after fix LO is preserving AutoSpacing property in styles.xml - assertXPath ( pXmlDoc, "/w:styles[1]/w:style[36]/w:pPr[1]/w:spacing[1]", "beforeAutospacing", "1" ); + assertXPath ( pXmlDoc, "/w:styles[1]/w:style[@w:styleId='Title']/w:pPr[1]/w:spacing[1]", "beforeAutospacing", "1" ); } DECLARE_OOXMLEXPORT_TEST(testfdo79540, "fdo79540.docx") diff --git a/sw/qa/extras/ooxmlimport/data/tdf95213.docx b/sw/qa/extras/ooxmlimport/data/tdf95213.docx Binary files differnew file mode 100644 index 000000000000..831d543b903f --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf95213.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 714704cb6544..fe67d762292b 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -3033,6 +3033,20 @@ DECLARE_OOXMLIMPORT_TEST(testTdf92045, "tdf92045.docx") CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(getRun(getParagraph(1), 1), "CharFlash")); } +DECLARE_OOXMLIMPORT_TEST(testTdf95213, "tdf95213.docx") +{ + // Get the second paragraph's numbering style's 2nd level's character style name. + uno::Reference<text::XTextRange> xParagraph = getParagraph(2); + auto xLevels = getProperty< uno::Reference<container::XIndexAccess> >(xParagraph, "NumberingRules"); + uno::Sequence<beans::PropertyValue> aLevel; + xLevels->getByIndex(1) >>= aLevel; // 2nd level + OUString aName = std::find_if(aLevel.begin(), aLevel.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "CharStyleName"; })->Value.get<OUString>(); + + uno::Reference<beans::XPropertySet> xStyle(getStyles("CharacterStyles")->getByName(aName), uno::UNO_QUERY); + // This was awt::FontWeight::BOLD. + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(xStyle, "CharWeight")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index d61818cc3898..d54127b4d3a4 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3081,7 +3081,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) { PropertyMapPtr pContext = m_pImpl->GetTopContext(); PropertyValueVector_t aProps = comphelper::sequenceToContainer< PropertyValueVector_t >(pContext->GetPropertyValues()); - OUString sStyle = getOrCreateCharStyle(aProps); + OUString sStyle = getOrCreateCharStyle(aProps, /*bAlwaysCreate=*/false); m_pImpl->SetRubyText(sText,sStyle); return; } @@ -3542,10 +3542,10 @@ uno::Reference< text::XTextRange > DomainMapper::GetCurrentTextRange() return m_pImpl->GetTopTextAppend()->getEnd(); } -OUString DomainMapper::getOrCreateCharStyle( PropertyValueVector_t& rCharProperties ) +OUString DomainMapper::getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate ) { StyleSheetTablePtr pStyleSheets = m_pImpl->GetStyleSheetTable(); - return pStyleSheets->getOrCreateCharStyle( rCharProperties ); + return pStyleSheets->getOrCreateCharStyle( rCharProperties, bAlwaysCreate ); } StyleSheetTablePtr DomainMapper::GetStyleSheetTable( ) diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx index c5a229984a4f..ddf1ac304509 100644 --- a/writerfilter/source/dmapper/DomainMapper.hxx +++ b/writerfilter/source/dmapper/DomainMapper.hxx @@ -104,7 +104,7 @@ public: css::uno::Reference<css::lang::XMultiServiceFactory> GetTextFactory() const; css::uno::Reference<css::text::XTextRange> GetCurrentTextRange(); - OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties ); + OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate ); std::shared_ptr< StyleSheetTable > GetStyleSheetTable( ); GraphicZOrderHelper* graphicZOrderHelper(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index ec4304b54f70..605a758894cc 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2994,7 +2994,7 @@ void DomainMapper_Impl::handleRubyEQField( FieldContextPtr pContext) pRubyContext->Insert(PROP_CHAR_HEIGHT_ASIAN, aVal); } PropertyValueVector_t aProps = comphelper::sequenceToContainer< PropertyValueVector_t >(pRubyContext->GetPropertyValues()); - aInfo.sRubyStyle = m_rDMapper.getOrCreateCharStyle(aProps); + aInfo.sRubyStyle = m_rDMapper.getOrCreateCharStyle(aProps, /*bAlwaysCreate=*/false); PropertyMapPtr pCharContext(new PropertyMap()); if (m_pLastCharacterContext.get()) pCharContext->InsertProps(m_pLastCharacterContext); diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 36f979bec396..c9275755f41e 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -567,7 +567,7 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper, //create (or find) a character style containing the character // attributes of the symbol and apply it to the numbering level - OUString sStyle = rDMapper.getOrCreateCharStyle( aStyleProps ); + OUString sStyle = rDMapper.getOrCreateCharStyle( aStyleProps, /*bAlwaysCreate=*/true ); aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_CHAR_STYLE_NAME), sStyle)); } diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index e9b22182d04c..b02cefaa0625 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -1519,11 +1519,12 @@ void StyleSheetTable::applyDefaults(bool bParaProperties) } -OUString StyleSheetTable::getOrCreateCharStyle( PropertyValueVector_t& rCharProperties ) +OUString StyleSheetTable::getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate ) { //find out if any of the styles already has the required properties then return its name OUString sListLabel = m_pImpl->HasListCharStyle(rCharProperties); - if( !sListLabel.isEmpty() ) + // Don't try to reuse an existing character style if requested. + if( !sListLabel.isEmpty() && !bAlwaysCreate) return sListLabel; const char cListLabel[] = "ListLabel "; uno::Reference< style::XStyleFamiliesSupplier > xStylesSupplier( m_pImpl->m_xTextDocument, uno::UNO_QUERY_THROW ); diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx index 87faa6912416..0693f3c56800 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.hxx +++ b/writerfilter/source/dmapper/StyleSheetTable.hxx @@ -102,7 +102,7 @@ public: OUString ConvertStyleName( const OUString& rWWName, bool bExtendedSearch = false ); - OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties ); + OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate ); /// Returns the default character properties. PropertyMapPtr GetDefaultCharProps(); |