[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sc/qa sc/source
Tünde Tóth (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 9 11:56:56 UTC 2019
sc/qa/unit/data/xlsx/hyperlink_export.xlsx |binary
sc/qa/unit/subsequent_export-test.cxx | 19 +++++++++++++++++++
sc/source/filter/excel/xecontent.cxx | 4 ++++
3 files changed, 23 insertions(+)
New commits:
commit 1d6277e77c33e8f9ad2c557ffe3250243f4a1ce4
Author: Tünde Tóth <tundeth at gmail.com>
AuthorDate: Tue Jul 2 10:07:24 2019 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Tue Jul 9 13:56:10 2019 +0200
tdf#126177 XLSX export: fix hyperlinks to documents
After export hyperlinks to documents didn't work, because the
the hyperlink relationship targets contained also the anchor.
Change-Id: I0bfc5bd1ef2b37f769d6a6b97e31c1b4bbfcb9aa
Reviewed-on: https://gerrit.libreoffice.org/74988
Reviewed-by: László Németh <nemeth at numbertext.org>
Tested-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 3cdc1b35b9d86bcfa1277e3e94925ae7b18b8fde)
Reviewed-on: https://gerrit.libreoffice.org/75292
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/sc/qa/unit/data/xlsx/hyperlink_export.xlsx b/sc/qa/unit/data/xlsx/hyperlink_export.xlsx
new file mode 100644
index 000000000000..4c3952d96290
Binary files /dev/null and b/sc/qa/unit/data/xlsx/hyperlink_export.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 9d628f97faa9..06eaf398407f 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -225,6 +225,7 @@ public:
void testTdf125173XLSX();
void testTdf79972XLSX();
void testTdf126024XLSX();
+ void testTdf126177XLSX();
void testXltxExport();
@@ -355,6 +356,7 @@ public:
CPPUNIT_TEST(testTdf125173XLSX);
CPPUNIT_TEST(testTdf79972XLSX);
CPPUNIT_TEST(testTdf126024XLSX);
+ CPPUNIT_TEST(testTdf126177XLSX);
CPPUNIT_TEST(testXltxExport);
@@ -4437,6 +4439,23 @@ void ScExportTest::testTdf126024XLSX()
assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", "External");
}
+void ScExportTest::testTdf126177XLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("hyperlink_export.", 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", "location", "Munka1!A5");
+
+ xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels");
+ CPPUNIT_ASSERT(pXmlRels);
+ OUString aTarget = getXPath(pXmlRels, "/r:Relationships/r:Relationship", "Target");
+ CPPUNIT_ASSERT(aTarget.endsWith("test.xlsx"));
+ assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", "External");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 234c681c59c3..3237ff1fca75 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -445,6 +445,10 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
aXclStrm << sal_uInt16( 0 );
mnFlags |= EXC_HLINK_MARK;
+
+ OUString location = XclXmlUtils::ToOUString(*mxTextMark);
+ if (msTarget.endsWith(location))
+ msTarget = msTarget.copy(0, msTarget.getLength() - location.getLength() - 1);
}
SetRecSize( 32 + mxVarData->Tell() );
More information about the Libreoffice-commits
mailing list