sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |    2 --
 sw/source/filter/ww8/docxattributeoutput.cxx |   12 ++++++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit b976fe00933f97892896d0e9a3f67b82ae807bcd
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Jan 14 19:02:11 2026 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Jan 20 10:34:45 2026 +0100

    officeotron: tabIndex=-1 is invalid
    
    since the value is constrained by the spec to be unsigned.
    
    Change-Id: I9b40b6fc9634cbe5c0e848ba15c9ce7918b2f067
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197291
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197431
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197597

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 17976d7eab95..a2a1360388c9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -424,7 +424,6 @@ CPPUNIT_TEST_FIXTURE(Test, testDateContentControlExport)
     xContentControlProps->setPropertyValue(u"Alias"_ustr, 
uno::Any(u"myalias"_ustr));
     xContentControlProps->setPropertyValue(u"Tag"_ustr, 
uno::Any(u"mytag"_ustr));
     xContentControlProps->setPropertyValue(u"Id"_ustr, 
uno::Any(static_cast<sal_Int32>(123)));
-    xContentControlProps->setPropertyValue(u"TabIndex"_ustr, 
uno::Any(sal_uInt32(4294967295))); // -1
     xContentControlProps->setPropertyValue(u"Lock"_ustr, 
uno::Any(u"sdtLocked"_ustr));
 
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
@@ -451,7 +450,6 @@ CPPUNIT_TEST_FIXTURE(Test, testDateContentControlExport)
     assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:alias", "val", u"myalias");
     assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:tag", "val", u"mytag");
     assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:id", "val", u"123");
-    assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:tabIndex", "val", u"-1");
     assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:lock", "val", u"sdtLocked");
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4fa0832314a1..5df8fce98e69 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2712,8 +2712,9 @@ void DocxAttributeOutput::WriteContentControlStart()
     {
         // 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 (nTabIndex != -1)
+            m_pSerializer->singleElementNS(XML_w, XML_tabIndex, FSNS(XML_w, 
XML_val),
+                                           OString::number(nTabIndex));
     }
 
     if (m_pContentControl->GetPicture())
commit 42f69aa7cbd2527536bb20c3320646485d23a159
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Jan 14 14:00:45 2026 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Jan 20 10:34:38 2026 +0100

    officeotron: w:val attribute is required for w:shd
    
    we end up with
    
      <w:shd w:fill="548DD4"/>
    
    I forced a default value of "clear" in the absense of any better idea.
    
    Change-Id: I6e680f18aca3bc71743b42da4e152a664e9d9303
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197289
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197429
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197596

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 01de6e6cb10a..4fa0832314a1 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -10455,6 +10455,7 @@ void DocxAttributeOutput::ParaGrabBag(const 
SfxGrabBagItem& rItem)
             uno::Sequence<beans::PropertyValue> aGrabBagSeq;
             rGrabBagElement.second >>= aGrabBagSeq;
 
+            bool bAddedValAttr = false;
             for (const auto& rProp : aGrabBagSeq)
             {
                 OUString sVal = rProp.Value.get<OUString>();
@@ -10463,7 +10464,10 @@ void DocxAttributeOutput::ParaGrabBag(const 
SfxGrabBagItem& rItem)
                     continue;
 
                 if (rProp.Name == "val")
+                {
                     AddToAttrList(m_pBackgroundAttrList, FSNS(XML_w, XML_val), 
sVal);
+                    bAddedValAttr = true;
+                }
                 else if (rProp.Name == "color")
                     AddToAttrList(m_pBackgroundAttrList, FSNS(XML_w, 
XML_color), sVal);
                 else if (rProp.Name == "themeColor")
@@ -10483,6 +10487,9 @@ void DocxAttributeOutput::ParaGrabBag(const 
SfxGrabBagItem& rItem)
                 else if (rProp.Name == "originalColor")
                     rProp.Value >>= m_sOriginalBackgroundColor;
             }
+            // w:val attribute is required
+            if (!bAddedValAttr)
+                AddToAttrList(m_pBackgroundAttrList, FSNS(XML_w, XML_val), 
"clear");
         }
         else if (rGrabBagElement.first == "SdtPr")
         {

Reply via email to