sc/qa/unit/data/xlsx/tdf161365.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 8 ++++++++ sc/source/filter/excel/xeescher.cxx | 15 ++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-)
New commits: commit a55b8c5c0a4dfabcaa00360d02c33ea077f2062a Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Mon May 26 15:12:38 2025 +0000 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed May 28 00:50:09 2025 +0200 tdf#161365 xlsx export: checkbox checked property in vmlDrawing.xml preserve also the checked state while saving Change-Id: Ibf7e464d952a57c6b52cc74420aa15b24aa0a5d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185872 Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Tested-by: Jenkins (cherry picked from commit de5bd835b81735f5627586bd1efb677d99921eba) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185880 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/unit/data/xlsx/tdf161365.xlsx b/sc/qa/unit/data/xlsx/tdf161365.xlsx index f2ff32ba916c..937345ea82e5 100644 Binary files a/sc/qa/unit/data/xlsx/tdf161365.xlsx and b/sc/qa/unit/data/xlsx/tdf161365.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index bb9d12cbaf6f..2ed4ee394700 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -1232,6 +1232,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf161365) assertXPathContent(pDrawing1, "/xdr:wsDr/mc:AlternateContent/mc:Choice/xdr:twoCellAnchor/xdr:to/xdr:row", u"3"); + + // Checked state - first off, second on + + xmlDocUniquePtr pVmlDrawing1 = parseExport("xl/drawings/vmlDrawing1.vml"); + CPPUNIT_ASSERT(pVmlDrawing1); + + assertXPath(pVmlDrawing1, "/xml/v:shape[1]/xx:ClientData/xx:Checked", 0); + assertXPathContent(pVmlDrawing1, "/xml/v:shape[2]/xx:ClientData/xx:Checked", u"1"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf112567b) diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index abec2e52b8d5..d9bc7f3ea56d 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1095,12 +1095,13 @@ class VmlFormControlExporter : public oox::vml::VMLExport OUString m_sFmlaLink; OUString m_aLabel; OUString m_aMacroName; + sal_Int16 m_nState; public: VmlFormControlExporter(const sax_fastparser::FSHelperPtr& p, sal_uInt16 nObjType, const tools::Rectangle& rAreaFrom, const tools::Rectangle& rAreaTo, const OUString& sControlName, const OUString& sFmlaLink, - OUString aLabel, OUString aMacroName); + OUString aLabel, OUString aMacroName, sal_Int16 nState); protected: using VMLExport::StartShape; @@ -1115,7 +1116,8 @@ VmlFormControlExporter::VmlFormControlExporter(const sax_fastparser::FSHelperPtr const tools::Rectangle& rAreaTo, const OUString& sControlName, const OUString& sFmlaLink, - OUString aLabel, OUString aMacroName) + OUString aLabel, OUString aMacroName, + sal_Int16 nState) : VMLExport(p) , m_nObjType(nObjType) , m_aAreaFrom(rAreaFrom) @@ -1124,6 +1126,7 @@ VmlFormControlExporter::VmlFormControlExporter(const sax_fastparser::FSHelperPtr , m_sFmlaLink(sFmlaLink) , m_aLabel(std::move(aLabel)) , m_aMacroName(std::move(aMacroName)) + , m_nState(nState) { } @@ -1172,6 +1175,11 @@ void VmlFormControlExporter::EndShape(sal_Int32 nShapeElement) XclXmlUtils::WriteElement(pVmlDrawing, FSNS(XML_x, XML_FmlaMacro), m_aMacroName); } + if (m_nObjType == EXC_OBJTYPE_CHECKBOX && m_nState == EXC_OBJ_CHECKBOX_CHECKED) + { + XclXmlUtils::WriteElement(pVmlDrawing, FSNS(XML_x, XML_Checked), "1"); + } + // XclExpOcxControlObj::WriteSubRecs() has the same fixed values. if (m_nObjType == EXC_OBJTYPE_BUTTON) { @@ -1204,7 +1212,8 @@ void XclExpTbxControlObj::SaveVml(XclExpXmlStream& rStrm) : OUString(); VmlFormControlExporter aFormControlExporter(rStrm.GetCurrentStream(), GetObjType(), aAreaFrom, - aAreaTo, msCtrlName, sCellLink, msLabel, GetMacroName()); + aAreaTo, msCtrlName, sCellLink, msLabel, GetMacroName(), + mnState); aFormControlExporter.SetSkipwzName(true); // use XML_id for legacyid, not XML_ID aFormControlExporter.OverrideShapeIDGen(true, "_x0000_s"_ostr); aFormControlExporter.AddSdrObject(*pObj, /*bIsFollowingTextFlow=*/false, /*eHOri=*/-1,