sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 3 sw/source/filter/ww8/docxattributeoutput.cxx | 92 +++++++++++++-------------- 2 files changed, 46 insertions(+), 49 deletions(-)
New commits: commit 2b6e7bf5c0e9166fb10082267136ed6b899c7582 Author: Noel Grandin <[email protected]> AuthorDate: Wed Dec 10 18:16:30 2025 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Fri Dec 12 14:03:36 2025 +0100 officeotron: elements under w:pPr element in wrong order re-use existing logic to make this output in spec-compliant order Change-Id: I5de88629295ee3eac1852fe67eedea4f1be7c087 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195394 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 230d4251446e..81637e3bd434 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -683,9 +683,6 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo79668) { createSwDoc("fdo79668.docx"); - //FIXME: validation error in OOXML export: Errors: 12 - skipValidation(); - saveAndReload(TestFilter::DOCX); // fdo#79668: Document was Crashing on DebugUtil build while Saving // because of repeated attribute value in same element. diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 006fad2f8250..1364be083a1b 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1476,55 +1476,55 @@ void DocxAttributeOutput::StartParagraphProperties() } } +// Write the elements in the spec order +const sal_Int32 aParagraphPropertiesOrder[] = +{ + FSNS( XML_w, XML_pStyle ), + FSNS( XML_w, XML_keepNext ), + FSNS( XML_w, XML_keepLines ), + FSNS( XML_w, XML_pageBreakBefore ), + FSNS( XML_w, XML_framePr ), + FSNS( XML_w, XML_widowControl ), + FSNS( XML_w, XML_numPr ), + FSNS( XML_w, XML_suppressLineNumbers ), + FSNS( XML_w, XML_pBdr ), + FSNS( XML_w, XML_shd ), + FSNS( XML_w, XML_tabs ), + FSNS( XML_w, XML_suppressAutoHyphens ), + FSNS( XML_w, XML_kinsoku ), + FSNS( XML_w, XML_wordWrap ), + FSNS( XML_w, XML_overflowPunct ), + FSNS( XML_w, XML_topLinePunct ), + FSNS( XML_w, XML_autoSpaceDE ), + FSNS( XML_w, XML_autoSpaceDN ), + FSNS( XML_w, XML_bidi ), + FSNS( XML_w, XML_adjustRightInd ), + FSNS( XML_w, XML_snapToGrid ), + FSNS( XML_w, XML_spacing ), + FSNS( XML_w, XML_ind ), + FSNS( XML_w, XML_contextualSpacing ), + FSNS( XML_w, XML_mirrorIndents ), + FSNS( XML_w, XML_suppressOverlap ), + FSNS( XML_w, XML_jc ), + FSNS( XML_w, XML_textDirection ), + FSNS( XML_w, XML_textAlignment ), + FSNS( XML_w, XML_textboxTightWrap ), + FSNS( XML_w, XML_outlineLvl ), + FSNS( XML_w, XML_divId ), + FSNS( XML_w, XML_cnfStyle ), + FSNS( XML_w, XML_rPr ), + FSNS( XML_w, XML_sectPr ), + FSNS( XML_w, XML_pPrChange ) +}; + void DocxAttributeOutput::InitCollectedParagraphProperties() { m_pLRSpaceAttrList.clear(); m_pParagraphSpacingAttrList.clear(); - // Write the elements in the spec order - static const sal_Int32 aOrder[] = - { - FSNS( XML_w, XML_pStyle ), - FSNS( XML_w, XML_keepNext ), - FSNS( XML_w, XML_keepLines ), - FSNS( XML_w, XML_pageBreakBefore ), - FSNS( XML_w, XML_framePr ), - FSNS( XML_w, XML_widowControl ), - FSNS( XML_w, XML_numPr ), - FSNS( XML_w, XML_suppressLineNumbers ), - FSNS( XML_w, XML_pBdr ), - FSNS( XML_w, XML_shd ), - FSNS( XML_w, XML_tabs ), - FSNS( XML_w, XML_suppressAutoHyphens ), - FSNS( XML_w, XML_kinsoku ), - FSNS( XML_w, XML_wordWrap ), - FSNS( XML_w, XML_overflowPunct ), - FSNS( XML_w, XML_topLinePunct ), - FSNS( XML_w, XML_autoSpaceDE ), - FSNS( XML_w, XML_autoSpaceDN ), - FSNS( XML_w, XML_bidi ), - FSNS( XML_w, XML_adjustRightInd ), - FSNS( XML_w, XML_snapToGrid ), - FSNS( XML_w, XML_spacing ), - FSNS( XML_w, XML_ind ), - FSNS( XML_w, XML_contextualSpacing ), - FSNS( XML_w, XML_mirrorIndents ), - FSNS( XML_w, XML_suppressOverlap ), - FSNS( XML_w, XML_jc ), - FSNS( XML_w, XML_textDirection ), - FSNS( XML_w, XML_textAlignment ), - FSNS( XML_w, XML_textboxTightWrap ), - FSNS( XML_w, XML_outlineLvl ), - FSNS( XML_w, XML_divId ), - FSNS( XML_w, XML_cnfStyle ), - FSNS( XML_w, XML_rPr ), - FSNS( XML_w, XML_sectPr ), - FSNS( XML_w, XML_pPrChange ) - }; - // postpone the output so that we can later [in EndParagraphProperties()] // prepend the properties before the run - m_pSerializer->mark(Tag_InitCollectedParagraphProperties, comphelper::containerToSequence(aOrder)); + m_pSerializer->mark(Tag_InitCollectedParagraphProperties, comphelper::containerToSequence(aParagraphPropertiesOrder)); } void DocxAttributeOutput::WriteCollectedParagraphProperties() @@ -4297,10 +4297,10 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData) const UIName & sParaStyleName = pFormattingChanges->GetFormatName(); if (pChangesSet || !sParaStyleName.isEmpty()) { - m_pSerializer->mark(Tag_Redline_2); - m_pSerializer->startElementNS(XML_w, XML_pPr); + m_pSerializer->mark(Tag_Redline_2, comphelper::containerToSequence(aParagraphPropertiesOrder)); + if (!sParaStyleName.isEmpty()) { OString sStyleName; @@ -4337,9 +4337,9 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData) m_pLRSpaceAttrList = std::move(pLRSpaceAttrList_Original); m_pParagraphSpacingAttrList = std::move(pParagraphSpacingAttrList_Original); - m_pSerializer->endElementNS( XML_w, XML_pPr ); + m_pSerializer->mergeTopMarks(Tag_Redline_2); - m_pSerializer->mergeTopMarks(Tag_Redline_2, sax_fastparser::MergeMarks::PREPEND); + m_pSerializer->endElementNS( XML_w, XML_pPr ); } } }
