diff options
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 20 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 3 |
3 files changed, 14 insertions, 12 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index db4299d582b3..0a95e6c44cd6 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3874,14 +3874,18 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData) m_pSerializer->startElementNS(XML_w, XML_pPr); - OString sStyleName; - if (auto format = m_rExport.m_rDoc.FindTextFormatCollByName(sParaStyleName)) - if (auto slot = m_rExport.m_pStyles->GetSlot(format); slot != 0xfff) - sStyleName = m_rExport.m_pStyles->GetStyleId(slot); - if (sStyleName.isEmpty()) - sStyleName = MSWordStyles::CreateStyleId(sParaStyleName); - if ( !sStyleName.isEmpty() ) - m_pSerializer->singleElementNS(XML_w, XML_pStyle, FSNS(XML_w, XML_val), sStyleName); + if (!sParaStyleName.isEmpty()) + { + OString sStyleName; + if (auto format = m_rExport.m_rDoc.FindTextFormatCollByName(sParaStyleName)) + if (auto slot = m_rExport.m_pStyles->GetSlot(format); slot != 0xfff) + sStyleName = m_rExport.m_pStyles->GetStyleId(slot); + // If the style name is empty at this point, this is a bug, meaning that we + // failed to output the style to styles.xml properly + assert(!sStyleName.isEmpty()); + if (!sStyleName.isEmpty()) + m_pSerializer->singleElementNS(XML_w, XML_pStyle, FSNS(XML_w, XML_val), sStyleName); + } // The 'm_rExport.SdrExporter().getFlyAttrList()', 'm_pParagraphSpacingAttrList' are used to hold information // that should be collected by different properties in the core, and are all flushed together diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 72fca1b3696f..21d11894f2d5 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -381,7 +381,8 @@ void MSWordStyles::BuildWwNames() } } -OString MSWordStyles::CreateStyleId(std::u16string_view aName) +/// create style id using only ASCII characters of the style name +static OString CreateStyleId(std::u16string_view aName) { OStringBuffer aStyleIdBuf(aName.size()); for (size_t i = 0; i < aName.size(); ++i) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index cf5d0bfa104b..b44575a89bab 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -1633,9 +1633,6 @@ public: /// Get slot of the style (rFormat). sal_uInt16 GetSlot( const SwFormat* pFormat ) const; - /// create style id using only ASCII characters of the style name - static OString CreateStyleId(std::u16string_view aName); - /// Get styleId of the nSlot-th style (nSlot is its position in m_aStyles). OString const & GetStyleId(sal_uInt16 nSlot) const; |