sw/source/filter/ww8/docxattributeoutput.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
New commits: commit 8054b261ffd858d9f10c494e7eff27b4f29bce6f Author: Justin Luth <[email protected]> AuthorDate: Sat Nov 15 14:08:13 2025 -0500 Commit: Miklos Vajna <[email protected]> CommitDate: Mon Nov 17 09:30:51 2025 +0100 tdf#169413 docx export: don't write themes twice in w:rFonts A round-trip was reported as corrupt by both Writer and Word. This probably started in 6.0 with tdf#38778 although a bibisect pointed to my 24.2 patch for tdf#108505. Although I'm not exactly sure what triggers this, grabBag was doubling up the bug report's conf12.docx w:cstheme in rFonts which looked like <w:rFonts w:cstheme="minorHAnsi" w:cs="Calibri" w:cstheme="minorHAnsi"/> and duplicate entries are invalid XML - even firefox complains. Change-Id: Id9561b940c2c536147422e10a8c1d37ea51c2e78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194057 Reviewed-by: Justin Luth <[email protected]> Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194064 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 73270861d7ca..8d66c5828683 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3134,7 +3134,7 @@ void DocxAttributeOutput::CmdEndField_Impl(SwTextNode const*const pNode, /// </w:rPr> /// <w:fldChar w:fldCharType="begin" /> /// </w:r> -/// <w:r> +/// <w:r> /// <w:rPr> /// <!-- properties written with DoWriteFieldRunProperties() /// </w:rPr> @@ -10224,19 +10224,22 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem ) { if ( rGrabBagElement.second >>= sOriginalValue ) bWriteCSTheme = - ( m_pFontsAttrList->getOptionalValue( FSNS( XML_w, XML_cs ) ) == sOriginalValue ); + (m_pFontsAttrList->getOptionalValue(FSNS( XML_w, XML_cs)) == sOriginalValue) + && !m_pFontsAttrList->hasAttribute(FSNS(XML_w, XML_cstheme)); } else if ( m_pFontsAttrList.is() && rGrabBagElement.first == "CharThemeFontNameAscii" ) { if ( rGrabBagElement.second >>= sOriginalValue ) bWriteAsciiTheme = - ( m_pFontsAttrList->getOptionalValue( FSNS( XML_w, XML_ascii ) ) == sOriginalValue ); + (m_pFontsAttrList->getOptionalValue(FSNS( XML_w, XML_ascii)) == sOriginalValue) + && !m_pFontsAttrList->hasAttribute(FSNS(XML_w, XML_asciiTheme)); } else if ( m_pFontsAttrList.is() && rGrabBagElement.first == "CharThemeFontNameEastAsia" ) { if ( rGrabBagElement.second >>= sOriginalValue ) bWriteEastAsiaTheme = - ( m_pFontsAttrList->getOptionalValue( FSNS( XML_w, XML_eastAsia ) ) == sOriginalValue ); + (m_pFontsAttrList->getOptionalValue(FSNS(XML_w, XML_eastAsia)) == sOriginalValue) + && !m_pFontsAttrList->hasAttribute(FSNS(XML_w, XML_eastAsiaTheme)); } }
