sw/source/filter/ww8/docxattributeoutput.cxx |    9 +++++++++
 sw/source/filter/ww8/docxattributeoutput.hxx |    1 +
 2 files changed, 10 insertions(+)

New commits:
commit 515f93555d327eb5589494837be10ae999027ff0
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Nov 25 21:12:42 2025 +0200
Commit:     Miklos Vajna <[email protected]>
CommitDate: Thu Nov 27 15:50:15 2025 +0100

    officeotron: avoid writing <w:i/> twice
    
    Change-Id: I58f9d359aa66155e17686695642317948b839b09
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194527
    Reviewed-by: Miklos Vajna <[email protected]>
    Code-Style: Noel Grandin <[email protected]>
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Noel Grandin <[email protected]>
    (cherry picked from commit fccc099e54e5a8c8a913425d8ffde8eb515dfebe)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194639
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index de6ca5746089..a370869514b7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3349,6 +3349,7 @@ void DocxAttributeOutput::InitCollectedRunProperties()
     m_pEastAsianLayoutAttrList = nullptr;
     m_pCharLangAttrList = nullptr;
     m_oFontSize.reset();
+    m_bCharPostureWritten = false;
 
     // Write the elements in the spec order
     static const sal_Int32 aOrder[] =
@@ -8174,6 +8175,10 @@ void DocxAttributeOutput::CharLanguage( const 
SvxLanguageItem& rLanguage )
 
 void DocxAttributeOutput::CharPosture( const SvxPostureItem& rPosture )
 {
+    if (m_bCharPostureWritten) // avoid writing this twice
+        return;
+    m_bCharPostureWritten = true;
+
     if ( rPosture.GetPosture() != ITALIC_NONE )
         m_pSerializer->singleElementNS(XML_w, XML_i);
     else
@@ -8295,6 +8300,10 @@ void DocxAttributeOutput::CharFontCJK( const 
SvxFontItem& rFont )
 
 void DocxAttributeOutput::CharPostureCJK( const SvxPostureItem& rPosture )
 {
+    if (m_bCharPostureWritten) // avoid writing this twice
+        return;
+    m_bCharPostureWritten = true;
+
     if ( rPosture.GetPosture() != ITALIC_NONE )
         m_pSerializer->singleElementNS(XML_w, XML_i);
     else
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index 7b937c650df3..8c34daa0407a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -836,6 +836,7 @@ private:
     rtl::Reference<sax_fastparser::FastAttributeList> 
m_pParagraphSpacingAttrList;
     rtl::Reference<sax_fastparser::FastAttributeList> m_pHyperlinkAttrList;
     std::optional<double> m_oFontSize;
+    bool m_bCharPostureWritten;
     std::shared_ptr<SwContentControl> m_pContentControl;
     /// If the current SDT around runs should be ended before the current run.
     bool m_bEndCharSdt;

Reply via email to