sc/qa/unit/subsequent_export_test4.cxx |   20 +++++++++++++++++++-
 sc/source/filter/excel/xeescher.cxx    |    5 +++++
 2 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit adc1871aaa71183353476be638cdc1ad1c4ebcaa
Author:     Justin Luth <[email protected]>
AuthorDate: Mon Dec 8 20:17:31 2025 -0500
Commit:     Miklos Vajna <[email protected]>
CommitDate: Wed Dec 10 16:22:42 2025 +0100

    xlsx: export activeX control's 3D/Flat style
    
    make CppunitTest_sc_subsequent_export_test4 \
        CPPUNIT_TEST_NAME=testCheckboxFormControlXlsxExport
    
    Change-Id: I2a059254e212eabf3a2d90d510167236154ac24b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195262
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195322
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index 9260ae0bb3e6..f9171f165822 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -47,6 +47,7 @@
 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
 #include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
 #include <com/sun/star/drawing/XDrawPage.hpp>
 #include <com/sun/star/drawing/XDrawPages.hpp>
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
@@ -1146,13 +1147,30 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, 
testCheckboxFormControlXlsxExport)
     createScDoc("xlsx/checkbox-form-control.xlsx");
 
     // When exporting to XLSX:
-    save(u"Calc Office Open XML"_ustr);
+    saveAndReload(TestFilter::XLSX);
 
     // Then make sure its VML markup is written and it has a correct position 
+ size:
     xmlDocUniquePtr pDoc = parseExport(u"xl/drawings/vmlDrawing1.vml"_ustr);
     // Without the fix in place, this test would have failed as there was no 
such stream.
     CPPUNIT_ASSERT(pDoc);
     assertXPathContent(pDoc, "/xml/v:shape/xx:ClientData/xx:Anchor", u"1, 22, 
3, 3, 3, 30, 6, 1");
+
+    // reloaded document: make sure it still has a flat (non-3d) look
+    uno::Reference<drawing::XDrawPagesSupplier> 
xDrawPagesSupplier(mxComponent, UNO_QUERY_THROW);
+    uno::Reference<container::XIndexAccess> xIA_DrawPage(
+        xDrawPagesSupplier->getDrawPages()->getByIndex(0), UNO_QUERY_THROW);
+    uno::Reference<drawing::XControlShape> 
xControlShape(xIA_DrawPage->getByIndex(0),
+                                                         UNO_QUERY_THROW);
+    uno::Reference<beans::XPropertySet> 
xPropertySet(xControlShape->getControl(), uno::UNO_QUERY);
+
+    OUString sLabel;
+    xPropertySet->getPropertyValue(u"Label"_ustr) >>= sLabel;
+    CPPUNIT_ASSERT_EQUAL(u"Check Box 1"_ustr, sLabel);
+
+    sal_Int16 nStyle;
+    xPropertySet->getPropertyValue(u"VisualEffect"_ustr) >>= nStyle;
+    // without the fix, this was 1 (3d)
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nStyle); // flat
 }
 
 CPPUNIT_TEST_FIXTURE(ScExportTest4, testButtonFormControlXlsxExport)
diff --git a/sc/source/filter/excel/xeescher.cxx 
b/sc/source/filter/excel/xeescher.cxx
index cea62fbcd8a6..2c89aec0d320 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1102,6 +1102,7 @@ public:
                            const tools::Rectangle& rAreaFrom, const 
tools::Rectangle& rAreaTo,
                            const OUString& sControlName, const OUString& 
sFmlaLink,
                            OUString aLabel, OUString aMacroName, sal_Int16 
nState);
+    bool m_bLook3d = true;
 
 protected:
     using VMLExport::StartShape;
@@ -1180,6 +1181,9 @@ void VmlFormControlExporter::EndShape(sal_Int32 
nShapeElement)
         XclXmlUtils::WriteElement(pVmlDrawing, FSNS(XML_x, XML_Checked), "1");
     }
 
+    if (!m_bLook3d)
+        pVmlDrawing->singleElement(FSNS(XML_x, XML_NoThreeD));
+
     // XclExpOcxControlObj::WriteSubRecs() has the same fixed values.
     if (m_nObjType == EXC_OBJTYPE_BUTTON)
     {
@@ -1216,6 +1220,7 @@ void XclExpTbxControlObj::SaveVml(XclExpXmlStream& rStrm)
                                                 mnState);
     aFormControlExporter.SetSkipwzName(true);  // use XML_id for legacyid, not 
XML_ID
     aFormControlExporter.OverrideShapeIDGen(true, "_x0000_s"_ostr);
+    aFormControlExporter.m_bLook3d = !mbFlatButton;
     aFormControlExporter.AddSdrObject(*pObj, /*bIsFollowingTextFlow=*/false, 
/*eHOri=*/-1,
                                       /*eVOri=*/-1, /*eHRel=*/-1, /*eVRel=*/-1,
                                       /*pWrapAttrList=*/nullptr, 
/*bOOxmlExport=*/true, mnShapeId);

Reply via email to