sw/source/filter/ww8/docxattributeoutput.cxx |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 935d4d58ae50407cd9d7d3119d7ea176686d9d6b
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Oct 29 12:23:39 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Nov 4 09:36:33 2025 +0100

    mso-test: fix order of w:pStyle and w:rPr elements
    
    When loading and then saving the document from forum-mso-en-10184.docx,
    the ordering of elements under w:pPr was wrong in two different ways.
    
    Change-Id: Ia99b759a871d5d324ec4c6689de3eb5dcf9c4f9b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193142
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>
    (cherry picked from commit a43482e27644e45bd13d6eed3f550e3843cc1e58)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193251
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193335

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 2480b397d311..ca5575540159 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1448,14 +1448,14 @@ void DocxAttributeOutput::StartParagraphProperties()
     m_pSerializer->startElementNS(XML_w, XML_pPr);
     m_bOpenedParaPr = true;
 
+    InitCollectedParagraphProperties();
+
     // and output the section break now (if it appeared)
     if (m_pSectionInfo && m_rExport.m_nTextTyp == TXT_MAINTEXT)
     {
         m_rExport.SectionProperties( *m_pSectionInfo );
         m_pSectionInfo.reset();
     }
-
-    InitCollectedParagraphProperties();
 }
 
 void DocxAttributeOutput::InitCollectedParagraphProperties()
@@ -1621,9 +1621,6 @@ void DocxAttributeOutput::EndParagraphProperties(const 
SfxItemSet& rParagraphMar
         PopulateFrameProperties(&rFrameFormat, aSize);
     }
 
-    // Merge the marks for the ordered elements
-    m_pSerializer->mergeTopMarks(Tag_InitCollectedParagraphProperties);
-
     // Write 'Paragraph Mark' properties
     m_pSerializer->startElementNS(XML_w, XML_rPr);
     // mark() before paragraph mark properties child elements.
@@ -1710,6 +1707,9 @@ void DocxAttributeOutput::EndParagraphProperties(const 
SfxItemSet& rParagraphMar
         m_aFramePr.SetUseFrameTextDirection(true);
     }
 
+    // Merge the marks for the ordered elements
+    m_pSerializer->mergeTopMarks(Tag_InitCollectedParagraphProperties);
+
     m_pSerializer->endElementNS( XML_w, XML_pPr );
 
     if (m_rExport.m_bHasBailsMetaData)
commit 08258886e7e5c8e0737fe2bf367aba7f7d5a35e1
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Oct 28 16:07:09 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Nov 4 09:36:26 2025 +0100

    mso-test: emit w:sz in correct order in document.xml
    
    When loading and then saving the document from forum-mso-en4-364124.docx,
    we end up with incorrect ordering of w:sz under w:rPr in document.xml
    
    Re-use our existing ordering logic to get the right order here.
    
    Change-Id: Ide57bd44b59033cd8cd6e885e8b9578a87314856
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193097
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit 43e293e744bfe153d74e3f20cd4235636f51ef36)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193250
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193334

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 2c9fdf81e28d..2480b397d311 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3170,6 +3170,8 @@ void DocxAttributeOutput::DoWriteFieldRunProperties( 
const SwTextNode * pNode, s
 
     {
         m_pSerializer->startElementNS(XML_w, XML_rPr);
+        // mark() before child elements.
+        InitCollectedRunProperties();
 
         // 1. output webHidden flag
         if(GetExport().m_bHideTabLeaderAndPageNumbers && 
m_pHyperlinkAttrList.is() )
@@ -3184,6 +3186,9 @@ void DocxAttributeOutput::DoWriteFieldRunProperties( 
const SwTextNode * pNode, s
         // 3. write the character properties
         WriteCollectedRunProperties();
 
+        // Merge the marks for the ordered elements
+        m_pSerializer->mergeTopMarks(Tag_InitCollectedRunProperties);
+
         m_pSerializer->endElementNS( XML_w, XML_rPr );
     }
 
commit 8046bdb80f531db8a68cef9ad61889c9eb3f9b67
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Oct 29 10:56:33 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Nov 4 09:36:20 2025 +0100

    mso-test: fix order of webHidden element
    
    When loading and then saving the document from forum-mso-en-11578.docx,
    the w:webHidden element under the w:rPr element is in the wrong order.
    
    Change-Id: I56bf4e989d4d0345bb79a7f95860371085bd49bf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193131
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit 4f8e10e92d593019054f393467a6448aa478bfc8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193249
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193333

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 7fbf8205777b..2c9fdf81e28d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3312,11 +3312,12 @@ void DocxAttributeOutput::StartRunProperties()
 
     m_pSerializer->startElementNS(XML_w, XML_rPr);
 
+    InitCollectedRunProperties();
+
     if(GetExport().m_bHideTabLeaderAndPageNumbers && m_pHyperlinkAttrList.is() 
)
     {
         m_pSerializer->singleElementNS(XML_w, XML_webHidden);
     }
-    InitCollectedRunProperties();
 
     assert( !m_oPostponedGraphic );
     m_oPostponedGraphic.emplace();

Reply via email to