[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sc/qa sc/source
Tünde Tóth (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 26 06:27:35 UTC 2019
sc/qa/unit/data/xlsx/hyperlink_formula.xlsx |binary
sc/qa/unit/subsequent_export-test.cxx | 18 ++++++++++++++++++
sc/source/filter/excel/xetable.cxx | 11 +++++++++++
3 files changed, 29 insertions(+)
New commits:
commit 861ee491b0bf3ca1c18336924017911a1823cc31
Author: Tünde Tóth <tundeth at gmail.com>
AuthorDate: Thu Jun 20 16:52:20 2019 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed Jun 26 08:26:57 2019 +0200
tdf#126024 XLSX export: fix hyperlink on formula cell
Hyperlink on formula cell lost after export.
Change-Id: I682c8bb559b5adde84b350f79c35a2e769f106ec
Reviewed-on: https://gerrit.libreoffice.org/74457
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
Tested-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 1bdbdc6ebcdba2784dcfa56b50632c4706ba14b5)
Reviewed-on: https://gerrit.libreoffice.org/74713
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/sc/qa/unit/data/xlsx/hyperlink_formula.xlsx b/sc/qa/unit/data/xlsx/hyperlink_formula.xlsx
new file mode 100644
index 000000000000..77ae2bdc7f7b
Binary files /dev/null and b/sc/qa/unit/data/xlsx/hyperlink_formula.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 416fb9f32139..9d628f97faa9 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -224,6 +224,7 @@ public:
void testTdf123645XLSX();
void testTdf125173XLSX();
void testTdf79972XLSX();
+ void testTdf126024XLSX();
void testXltxExport();
@@ -353,6 +354,7 @@ public:
CPPUNIT_TEST(testTdf123645XLSX);
CPPUNIT_TEST(testTdf125173XLSX);
CPPUNIT_TEST(testTdf79972XLSX);
+ CPPUNIT_TEST(testTdf126024XLSX);
CPPUNIT_TEST(testXltxExport);
@@ -4419,6 +4421,22 @@ void ScExportTest::testTdf79972XLSX()
assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", "External");
}
+void ScExportTest::testTdf126024XLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("hyperlink_formula.", 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", "A2");
+
+ 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/");
+ 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 c8a34cd89faf..d7a3adf8f7e6 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2581,6 +2581,17 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
case CELLTYPE_FORMULA:
{
+ 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);
+ }
+ }
+
xCell.reset(new XclExpFormulaCell(
GetRoot(), aXclPos, pPattern, nMergeBaseXFId,
*rScCell.mpFormula, maArrayBfr, maShrfmlaBfr, maTableopBfr));
More information about the Libreoffice-commits
mailing list