sc/qa/unit/subsequent_export_test4.cxx | 6 +++--- sc/qa/unit/subsequent_filters_test3.cxx | 25 +++++++++++++++++++++++++ sc/source/filter/excel/xeescher.cxx | 13 +++++++++++-- sc/source/filter/inc/xeescher.hxx | 1 + sfx2/source/appl/appopen.cxx | 2 +- 5 files changed, 41 insertions(+), 6 deletions(-)
New commits: commit c66d5fb209c52037f0280fd2b131946fcfd12e43 Author: Justin Luth <[email protected]> AuthorDate: Wed Dec 10 16:40:39 2025 -0500 Commit: Justin Luth <[email protected]> CommitDate: Fri Dec 12 18:40:52 2025 +0100 tdf#165180 'Calc Office Open XML' is also an Excel variant This was introduced with commit 4de186f43456baf1de162aefa5f76d76e0817e5e Author: Kohei Yoshida on Thu Sep 16 10:37:52 2010 calc-jump-on-formula-ref-sfx2.diff: Migrated There are no clear instructions or unit tests to know exactly how to test this, but it seems clear enough that it should continue to work when loaded with an Excel 2010 filter. Change-Id: I550ee20b9bac4ce0dac596b600647665598d1246 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195411 Reviewed-by: Justin Luth <[email protected]> Tested-by: Jenkins Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195549 diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 508a703f0ff1..457cda2bc9a1 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -578,7 +578,7 @@ bool lcl_isFilterNativelySupported(const SfxFilter& rFilter) const OUString& aName = rFilter.GetFilterName(); // We can handle all Excel variants natively. - return aName.startsWith("MS Excel"); + return aName.startsWith("MS Excel") || aName.startsWith("Calc Office Open XML"); } } commit ce49c30a8719426518a40721b02a4b0931286dde Author: Justin Luth <[email protected]> AuthorDate: Wed Dec 10 12:17:55 2025 -0500 Commit: Justin Luth <[email protected]> CommitDate: Fri Dec 12 18:40:39 2025 +0100 xlsx: export activeX control background color make CppunitTest_sc_subsequent_filters_test3 \ CPPUNIT_TEST_NAME=testActiveXCheckboxXLSX Change-Id: I0ff17e37e315bfa8e677fe0a5fde6540f42c06ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195405 Tested-by: Jenkins Reviewed-by: Justin Luth <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195548 diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index c5796a169842..3be04f558a42 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1105,10 +1105,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCheckboxFormControlXlsxExport) // without the fix, this was 1 (3d) CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nStyle); // flat - Color aColor; + Color aColor(COL_TRANSPARENT); xPropertySet->getPropertyValue(u"BackgroundColor"_ustr) >>= aColor; - // without the fix, this was white - CPPUNIT_ASSERT_EQUAL(COL_BLACK, aColor); // black apparently == transparent + // without the fix, this was COL_WHITE + CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT, aColor); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testButtonFormControlXlsxExport) diff --git a/sc/qa/unit/subsequent_filters_test3.cxx b/sc/qa/unit/subsequent_filters_test3.cxx index 11aaaae11bb7..fb5343932ac7 100644 --- a/sc/qa/unit/subsequent_filters_test3.cxx +++ b/sc/qa/unit/subsequent_filters_test3.cxx @@ -552,6 +552,31 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testActiveXCheckboxXLSX) sal_Int16 nState; xPropertySet->getPropertyValue(u"State"_ustr) >>= nState; CPPUNIT_ASSERT_EQUAL(sal_Int16(1), nState); + + saveAndReload(TestFilter::XLSX); + + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, UNO_QUERY_THROW); + xIA_DrawPage.set(xDrawPagesSupplier->getDrawPages()->getByIndex(0), UNO_QUERY_THROW); + xControlShape.set(xIA_DrawPage->getByIndex(0), UNO_QUERY_THROW); + xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); + + xPropertySet->getPropertyValue(u"Label"_ustr) >>= sLabel; + CPPUNIT_ASSERT_EQUAL(u"Custom Caption"_ustr, sLabel); + + sal_Int16 nStyle; + xPropertySet->getPropertyValue(u"VisualEffect"_ustr) >>= nStyle; + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), nStyle); // 3d + + nColor = COL_TRANSPARENT; + xPropertySet->getPropertyValue(u"BackgroundColor"_ustr) >>= nColor; + // without the fix, this was COL_WHITE + CPPUNIT_ASSERT_EQUAL(Color(0x316ac5), nColor); + + xPropertySet->getPropertyValue(u"TextColor"_ustr) >>= nColor; + //CPPUNIT_ASSERT_EQUAL(Color(0xD4D0C8), nColor); + + xPropertySet->getPropertyValue(u"State"_ustr) >>= nState; + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), nState); } CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf60673) diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index dfc43605c732..5daf880b1a5a 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -721,6 +721,10 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference< aPropOpt.AddOpt( ESCHER_Prop_wzDescription, aAltTxt ); } + ::Color aBackColor; + if (aCtrlProp.GetProperty(aBackColor, u"BackgroundColor"_ustr)) + moBackgroundFill = aBackColor; + // write DFF property set to stream aPropOpt.Commit( mrEscherEx.GetStream() ); @@ -1103,6 +1107,7 @@ public: const OUString& sControlName, const OUString& sFmlaLink, OUString aLabel, OUString aMacroName, sal_Int16 nState); bool m_bLook3d = true; + std::optional<Color> m_oBackgroundFill; protected: using VMLExport::StartShape; @@ -1138,8 +1143,11 @@ sal_Int32 VmlFormControlExporter::StartShape() if (!m_sControlName.isEmpty()) AddShapeAttribute(XML_id, m_sControlName.toUtf8()); - // control background: set filled as false so the control is transparent instead of white - AddShapeAttribute(XML_filled, "f"); + if (m_oBackgroundFill.has_value()) + AddShapeAttribute(XML_fillcolor, + OUString("#" + m_oBackgroundFill->AsRGBHexString()).toUtf8()); + else + AddShapeAttribute(XML_filled, "f"); return VMLExport::StartShape(); } @@ -1224,6 +1232,7 @@ void XclExpTbxControlObj::SaveVml(XclExpXmlStream& rStrm) aFormControlExporter.SetSkipwzName(true); // use XML_id for legacyid, not XML_ID aFormControlExporter.OverrideShapeIDGen(true, "_x0000_s"_ostr); aFormControlExporter.m_bLook3d = !mbFlatButton; + aFormControlExporter.m_oBackgroundFill = moBackgroundFill; aFormControlExporter.AddSdrObject(*pObj, /*bIsFollowingTextFlow=*/false, /*eHOri=*/-1, /*eVOri=*/-1, /*eHRel=*/-1, /*eVRel=*/-1, /*pWrapAttrList=*/nullptr, /*bOOxmlExport=*/true, mnShapeId); diff --git a/sc/source/filter/inc/xeescher.hxx b/sc/source/filter/inc/xeescher.hxx index 942c04853a9a..bca4b8801ef2 100644 --- a/sc/source/filter/inc/xeescher.hxx +++ b/sc/source/filter/inc/xeescher.hxx @@ -304,6 +304,7 @@ private: tools::Rectangle maAreaFrom; tools::Rectangle maAreaTo; XclExpObjectManager& mrRoot; + std::optional<::Color> moBackgroundFill; }; //#endif
