sc/qa/unit/subsequent_export_test2.cxx |    4 ++++
 sc/source/filter/excel/xeescher.cxx    |   17 +++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 7f23dae00fedc9d7119b44b6c44d9eca4f8c87b8
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Sat Jan 21 21:40:25 2023 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Tue Jan 24 02:14:12 2023 +0000

    tdf#135987 xlsx vml export: retain checkbox link to cell
    
    The checkbox can be linked to a cell, so that the cell's value
    is toggled between true and false.
    This was lost on a round-trip.
    
    Change-Id: I4f2d44a594a92caedb29ded9b2c292006c803115
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145962
    Tested-by: Justin Luth <jl...@mail.com>
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 3093e63500dd..81df3cb9452f 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -1075,6 +1075,10 @@ void ScExportTest2::testTdf106181()
         pDrawing,
         
"/xdr:wsDr/mc:AlternateContent/mc:Choice/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr",
         "hidden", "0");
+
+    xmlDocUniquePtr pVmlDrawing = parseExport("xl/drawings/vmlDrawing1.vml");
+    CPPUNIT_ASSERT(pVmlDrawing);
+    assertXPathContent(pVmlDrawing, "//xx:ClientData/xx:FmlaLink", "$D$9");
 }
 
 void ScExportTest2::testTdf145057()
diff --git a/sc/source/filter/excel/xeescher.cxx 
b/sc/source/filter/excel/xeescher.cxx
index c0c15fda599a..4e9491cc94c3 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1094,13 +1094,14 @@ class VmlFormControlExporter : public 
oox::vml::VMLExport
     tools::Rectangle m_aAreaFrom;
     tools::Rectangle m_aAreaTo;
     OUString m_sControlName;
+    OUString m_sFmlaLink;
     OUString m_aLabel;
     OUString m_aMacroName;
 
 public:
     VmlFormControlExporter(const sax_fastparser::FSHelperPtr& p, sal_uInt16 
nObjType,
                            const tools::Rectangle& rAreaFrom, const 
tools::Rectangle& rAreaTo,
-                           const OUString& sControlName,
+                           const OUString& sControlName, const OUString& 
sFmlaLink,
                            OUString aLabel, OUString aMacroName);
 
 protected:
@@ -1115,12 +1116,14 @@ VmlFormControlExporter::VmlFormControlExporter(const 
sax_fastparser::FSHelperPtr
                                                const tools::Rectangle& 
rAreaFrom,
                                                const tools::Rectangle& rAreaTo,
                                                const OUString& sControlName,
+                                               const OUString& sFmlaLink,
                                                OUString aLabel, OUString 
aMacroName)
     : VMLExport(p)
     , m_nObjType(nObjType)
     , m_aAreaFrom(rAreaFrom)
     , m_aAreaTo(rAreaTo)
     , m_sControlName(sControlName)
+    , m_sFmlaLink(sFmlaLink)
     , m_aLabel(std::move(aLabel))
     , m_aMacroName(std::move(aMacroName))
 {
@@ -1178,6 +1181,9 @@ void VmlFormControlExporter::EndShape(sal_Int32 
nShapeElement)
     }
     XclXmlUtils::WriteElement(pVmlDrawing, FSNS(XML_x, XML_TextVAlign), 
"Center");
 
+    if (!m_sFmlaLink.isEmpty())
+        XclXmlUtils::WriteElement(pVmlDrawing, FSNS(XML_x, XML_FmlaLink), 
m_sFmlaLink);
+
     pVmlDrawing->endElement(FSNS(XML_x, XML_ClientData));
     VMLExport::EndShape(nShapeElement);
 }
@@ -1192,8 +1198,15 @@ void XclExpTbxControlObj::SaveVml(XclExpXmlStream& rStrm)
     tools::Rectangle aAreaTo;
     // Unlike XclExpTbxControlObj::SaveXml(), this is not calculated in EMUs.
     lcl_GetFromTo(mrRoot, pObj->GetLogicRect(), GetTab(), aAreaFrom, aAreaTo);
+
+    const OUString sCellLink
+        = mxCellLinkAddress.IsValid()
+              ? mxCellLinkAddress.Format(ScRefFlags::ADDR_ABS, &GetDoc(),
+                                         
ScAddress::Details(formula::FormulaGrammar::CONV_XL_A1))
+              : OUString();
+
     VmlFormControlExporter aFormControlExporter(rStrm.GetCurrentStream(), 
GetObjType(), aAreaFrom,
-                                                aAreaTo, msCtrlName, msLabel, 
GetMacroName());
+                                                aAreaTo, msCtrlName, 
sCellLink, msLabel, GetMacroName());
     aFormControlExporter.SetSkipwzName(true);  // use XML_id for legacyid, not 
XML_ID
     aFormControlExporter.OverrideShapeIDGen(true, "_x0000_s");
     aFormControlExporter.AddSdrObject(*pObj, /*bIsFollowingTextFlow=*/false, 
/*eHOri=*/-1,

Reply via email to