sw/source/filter/ww8/docxattributeoutput.cxx |  105 +++++++++++++--------------
 1 file changed, 53 insertions(+), 52 deletions(-)

New commits:
commit 13aefe6932282eaa318eb548bca2d9c930c87266
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Nov 28 14:15:22 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Wed Dec 3 11:11:38 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]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194945

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1add4cee78ce..7089eb1b85a0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -826,20 +826,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())
     {
@@ -851,6 +850,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);
@@ -861,18 +869,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)
@@ -2544,6 +2544,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
@@ -2561,14 +2569,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);
commit 9cf3f70df2f1c7a99507ad503b7c57f28f3e5aa5
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Nov 28 13:53:54 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Wed Dec 3 11:11:29 2025 +0100

    officeotron: wrong ordering of elements under sdtPr
    
    Change-Id: I302a7796f3794148d6c72ecb2295f291bdf807ae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194782
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194944

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 614305bf4033..1add4cee78ce 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2631,21 +2631,6 @@ void DocxAttributeOutput::WriteContentControlStart()
 
     m_pSerializer->startElementNS(XML_w, XML_sdt);
     m_pSerializer->startElementNS(XML_w, XML_sdtPr);
-    if (!m_pContentControl->GetPlaceholderDocPart().isEmpty())
-    {
-        m_pSerializer->startElementNS(XML_w, XML_placeholder);
-        m_pSerializer->singleElementNS(XML_w, XML_docPart, FSNS(XML_w, 
XML_val),
-                                       
m_pContentControl->GetPlaceholderDocPart());
-        m_pSerializer->endElementNS(XML_w, XML_placeholder);
-    }
-
-    if (!m_pContentControl->GetDataBindingPrefixMappings().isEmpty() || 
!m_pContentControl->GetDataBindingXpath().isEmpty() || 
!m_pContentControl->GetDataBindingStoreItemID().isEmpty())
-    {
-        m_pSerializer->singleElementNS( XML_w, XML_dataBinding,
-            FSNS(XML_w, XML_prefixMappings), 
m_pContentControl->GetDataBindingPrefixMappings(),
-            FSNS(XML_w, XML_xpath), m_pContentControl->GetDataBindingXpath(),
-            FSNS(XML_w, XML_storeItemID), 
m_pContentControl->GetDataBindingStoreItemID());
-    }
 
     if (!m_pContentControl->GetColor().isEmpty())
     {
@@ -2677,25 +2662,41 @@ void DocxAttributeOutput::WriteContentControlStart()
                                        
OString::number(m_pContentControl->GetId()));
     }
 
-    if (m_pContentControl->GetTabIndex())
-    {
-        // write the unsigned value as if it were signed since that is all we 
can import
-        const sal_Int32 nTabIndex = 
static_cast<sal_Int32>(m_pContentControl->GetTabIndex());
-        m_pSerializer->singleElementNS(XML_w, XML_tabIndex, FSNS(XML_w, 
XML_val),
-                                       OString::number(nTabIndex));
-    }
-
     if (!m_pContentControl->GetLock().isEmpty())
     {
         m_pSerializer->singleElementNS(XML_w, XML_lock, FSNS(XML_w, XML_val),
                                        m_pContentControl->GetLock());
     }
 
+    if (!m_pContentControl->GetPlaceholderDocPart().isEmpty())
+    {
+        m_pSerializer->startElementNS(XML_w, XML_placeholder);
+        m_pSerializer->singleElementNS(XML_w, XML_docPart, FSNS(XML_w, 
XML_val),
+                                       
m_pContentControl->GetPlaceholderDocPart());
+        m_pSerializer->endElementNS(XML_w, XML_placeholder);
+    }
+
     if (m_pContentControl->GetShowingPlaceHolder())
     {
         m_pSerializer->singleElementNS(XML_w, XML_showingPlcHdr);
     }
 
+    if (!m_pContentControl->GetDataBindingPrefixMappings().isEmpty() || 
!m_pContentControl->GetDataBindingXpath().isEmpty() || 
!m_pContentControl->GetDataBindingStoreItemID().isEmpty())
+    {
+        m_pSerializer->singleElementNS( XML_w, XML_dataBinding,
+            FSNS(XML_w, XML_prefixMappings), 
m_pContentControl->GetDataBindingPrefixMappings(),
+            FSNS(XML_w, XML_xpath), m_pContentControl->GetDataBindingXpath(),
+            FSNS(XML_w, XML_storeItemID), 
m_pContentControl->GetDataBindingStoreItemID());
+    }
+
+    if (m_pContentControl->GetTabIndex())
+    {
+        // write the unsigned value as if it were signed since that is all we 
can import
+        const sal_Int32 nTabIndex = 
static_cast<sal_Int32>(m_pContentControl->GetTabIndex());
+        m_pSerializer->singleElementNS(XML_w, XML_tabIndex, FSNS(XML_w, 
XML_val),
+                                       OString::number(nTabIndex));
+    }
+
     if (m_pContentControl->GetPicture())
     {
         m_pSerializer->singleElementNS(XML_w, XML_picture);

Reply via email to