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 78879862cb11d4991b19ba6ae92a23d4a5bf110a Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Mon May 26 15:12:38 2025 +0000 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Tue May 27 07:31:03 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/+/185813 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> 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 3a667750f4af..da65d1bb1bd6 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -1252,6 +1252,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf161365) assertXPathContent( pDrawing1, "/xdr:wsDr/mc:AlternateContent/mc:Choice/xdr:twoCellAnchor/xdr:to/xdr:row"_ostr, "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"_ostr, 0); + assertXPathContent(pVmlDrawing1, "/xml/v:shape[2]/xx:ClientData/xx:Checked"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf112567b) diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 9bf0dedcdfbd..038c686ad024 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1096,12 +1096,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; @@ -1116,7 +1117,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) @@ -1125,6 +1127,7 @@ VmlFormControlExporter::VmlFormControlExporter(const sax_fastparser::FSHelperPtr , m_sFmlaLink(sFmlaLink) , m_aLabel(std::move(aLabel)) , m_aMacroName(std::move(aMacroName)) + , m_nState(nState) { } @@ -1173,6 +1176,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) { @@ -1205,7 +1213,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,