tdf#79972 XLSX export: fix hyperlink at numeric data

Hyperlink at numeric data lost after export.

tdf79972.xlsx: Test file from Excel 2016.

Change-Id: I6064724e6e38325386c4dfc8f1e9d93cce041975
Reviewed-on: https://gerrit.libreoffice.org/72894
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
diff --git a/sc/qa/unit/data/xlsx/tdf79972.xlsx b/sc/qa/unit/data/xlsx/tdf79972.xlsx
new file mode 100644
index 0000000..49f797c
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf79972.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index ef73469..94bfd5a 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -222,6 +222,7 @@ public:
    void testTdf112567();
    void testTdf123645XLSX();
    void testTdf125173XLSX();
    void testTdf79972XLSX();

    void testXltxExport();

@@ -349,6 +350,7 @@ public:
    CPPUNIT_TEST(testTdf112567);
    CPPUNIT_TEST(testTdf123645XLSX);
    CPPUNIT_TEST(testTdf125173XLSX);
    CPPUNIT_TEST(testTdf79972XLSX);

    CPPUNIT_TEST(testXltxExport);

@@ -4370,6 +4372,22 @@ void ScExportTest::testTdf125173XLSX()
    assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "TargetMode", "External");
}

void ScExportTest::testTdf79972XLSX()
{
    ScDocShellRef xDocSh = loadDoc("tdf79972.", FORMAT_XLSX);
    CPPUNIT_ASSERT(xDocSh.is());
    std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);

    xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
    CPPUNIT_ASSERT(pDoc);
    assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "ref", "A1");

    xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels");
    CPPUNIT_ASSERT(pXmlRels);
    assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "Target", "https://bugs.documentfoundation.org/show_bug.cgi?id=79972");
    assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", "External");
}

CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);

CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index e236a79..c8a34cd 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -24,6 +24,8 @@
#include <com/sun/star/i18n/ScriptType.hpp>
#include <scitems.hxx>
#include <svl/intitem.hxx>
#include <svl/stritem.hxx>
#include <editeng/flditem.hxx>
#include <document.hxx>
#include <dociter.hxx>
#include <olinetab.hxx>
@@ -2522,6 +2524,17 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
            {
                double fValue = rScCell.mfValue;

                if (pPattern)
                {
                    OUString aUrl = pPattern->GetItemSet().Get(ATTR_HYPERLINK).GetValue();
                    if (!aUrl.isEmpty())
                    {
                        std::shared_ptr<XclExpHyperlink> aLink;
                        aLink.reset(new XclExpHyperlink(GetRoot(), SvxURLField(aUrl, aUrl), aScPos));
                        mxHyperlinkList->AppendRecord(aLink);
                    }
                }

                // try to create a Boolean cell
                if( pPattern && ((fValue == 0.0) || (fValue == 1.0)) )
                {