sw/source/filter/ww8/docxattributeoutput.cxx |   58 +++++++++++++--------------
 1 file changed, 29 insertions(+), 29 deletions(-)

New commits:
commit 370385ca2b9bd4f9b585b2ba9bba5ce66d69d679
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Nov 28 14:15:22 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Dec 2 09:57:33 2025 +0100

    officeotron: wrong ordering of elements under sdtPr
    
    Change-Id: Idf3fa8d64f93a1b59321b7d0303e33e39254180d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194783
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 108e88a8956befe90c987d9634713fd707d8fc91)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194897
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 436158bf3c58..34c8a9966235 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -825,20 +825,19 @@ void SdtBlockHelper::WriteSdtBlock(const 
::sax_fastparser::FSHelperPtr& pSeriali
 
 void SdtBlockHelper::WriteExtraParams(const ::sax_fastparser::FSHelperPtr& 
pSerializer)
 {
+    if (!m_aAlias.isEmpty())
+        pSerializer->singleElementNS(XML_w, XML_alias, FSNS(XML_w, XML_val), 
m_aAlias);
+
+    if (!m_aTag.isEmpty())
+        pSerializer->singleElementNS(XML_w, XML_tag, FSNS(XML_w, XML_val), 
m_aTag);
+
     if (m_nId)
     {
         pSerializer->singleElementNS(XML_w, XML_id, FSNS(XML_w, XML_val), 
OString::number(m_nId));
     }
 
-    if (m_pDataBindingAttrs.is())
-    {
-        pSerializer->singleElementNS(XML_w, XML_dataBinding, 
detachFrom(m_pDataBindingAttrs));
-    }
-
-    if (m_pTextAttrs.is())
-    {
-        pSerializer->singleElementNS(XML_w, XML_text, 
detachFrom(m_pTextAttrs));
-    }
+    if (!m_aLock.isEmpty())
+        pSerializer->singleElementNS(XML_w, XML_lock, FSNS(XML_w, XML_val), 
m_aLock);
 
     if (!m_aPlaceHolderDocPart.isEmpty())
     {
@@ -850,6 +849,15 @@ void SdtBlockHelper::WriteExtraParams(const 
::sax_fastparser::FSHelperPtr& pSeri
     if (m_bShowingPlaceHolder)
         pSerializer->singleElementNS(XML_w, XML_showingPlcHdr);
 
+    if (m_pDataBindingAttrs.is())
+    {
+        pSerializer->singleElementNS(XML_w, XML_dataBinding, 
detachFrom(m_pDataBindingAttrs));
+    }
+
+    if (m_nTabIndex)
+        pSerializer->singleElementNS(XML_w, XML_tabIndex, FSNS(XML_w, XML_val),
+                                     OString::number(m_nTabIndex));
+
     if (!m_aColor.isEmpty())
     {
         pSerializer->singleElementNS(XML_w15, XML_color, FSNS(XML_w, XML_val), 
m_aColor);
@@ -860,18 +868,10 @@ void SdtBlockHelper::WriteExtraParams(const 
::sax_fastparser::FSHelperPtr& pSeri
         pSerializer->singleElementNS(XML_w15, XML_appearance, FSNS(XML_w15, 
XML_val), m_aAppearance);
     }
 
-    if (!m_aAlias.isEmpty())
-        pSerializer->singleElementNS(XML_w, XML_alias, FSNS(XML_w, XML_val), 
m_aAlias);
-
-    if (!m_aTag.isEmpty())
-        pSerializer->singleElementNS(XML_w, XML_tag, FSNS(XML_w, XML_val), 
m_aTag);
-
-    if (m_nTabIndex)
-        pSerializer->singleElementNS(XML_w, XML_tabIndex, FSNS(XML_w, XML_val),
-                                     OString::number(m_nTabIndex));
-
-    if (!m_aLock.isEmpty())
-        pSerializer->singleElementNS(XML_w, XML_lock, FSNS(XML_w, XML_val), 
m_aLock);
+    if (m_pTextAttrs.is())
+    {
+        pSerializer->singleElementNS(XML_w, XML_text, 
detachFrom(m_pTextAttrs));
+    }
 }
 
 void SdtBlockHelper::EndSdtBlock(const ::sax_fastparser::FSHelperPtr& 
pSerializer)
@@ -2550,6 +2550,14 @@ void DocxAttributeOutput::WriteFormDateStart(const 
OUString& sFullDate, const OU
     m_pSerializer->startElementNS(XML_w, XML_sdt);
     m_pSerializer->startElementNS(XML_w, XML_sdtPr);
 
+    if (aGrabBagSdt.hasElements())
+    {
+        // There are some extra sdt parameters came from grab bag
+        SdtBlockHelper aSdtBlock;
+        aSdtBlock.GetSdtParamsFromGrabBag(aGrabBagSdt);
+        aSdtBlock.WriteExtraParams(m_pSerializer);
+    }
+
     if(!sFullDate.isEmpty())
         m_pSerializer->startElementNS(XML_w, XML_date, FSNS(XML_w, 
XML_fullDate), sFullDate);
     else
@@ -2567,14 +2575,6 @@ void DocxAttributeOutput::WriteFormDateStart(const 
OUString& sFullDate, const OU
                                    FSNS(XML_w, XML_val), "gregorian");
     m_pSerializer->endElementNS(XML_w, XML_date);
 
-    if (aGrabBagSdt.hasElements())
-    {
-        // There are some extra sdt parameters came from grab bag
-        SdtBlockHelper aSdtBlock;
-        aSdtBlock.GetSdtParamsFromGrabBag(aGrabBagSdt);
-        aSdtBlock.WriteExtraParams(m_pSerializer);
-    }
-
     m_pSerializer->endElementNS(XML_w, XML_sdtPr);
 
     m_pSerializer->startElementNS(XML_w, XML_sdtContent);

Reply via email to