sw/source/filter/ww8/docxattributeoutput.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
New commits: commit ada2f4f515745bc5bdc8cbc1191da990627cab3e Author: Noel Grandin <[email protected]> AuthorDate: Wed Oct 29 12:23:39 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Nov 1 19:06:54 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]> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index e811fc5c2002..480446f359cb 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1447,14 +1447,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() @@ -1619,9 +1619,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. @@ -1708,6 +1705,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 d0785cc9641dbc0388dd9d0a3c2516e09d83ad91 Author: Noel Grandin <[email protected]> AuthorDate: Tue Oct 28 16:07:09 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Nov 1 19:06:45 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]> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index dba1bb0037a0..e811fc5c2002 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3169,6 +3169,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() ) @@ -3183,6 +3185,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 ); }
