summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortundet <tundeth@gmail.com>2019-03-29 10:22:06 +0100
committerLászló Németh <nemeth@numbertext.org>2019-04-01 17:50:45 +0200
commit186a9aae2d9612a9d6408e4871bc49963d4f9bb6 (patch)
treef60dcf5315024e96fd4d9392d06699da5ef47607
parent7de7e8ecb5d53d219e47dccf9b1b767852b215e2 (diff)
tdf#115192 XLSX export: fix hyperlink inserted to shape
Hyperlink inserted to shape didn't work after export, because the LO wrote TargetMode="External" code incorrectly in the xml. test_115192.xlsx: Test file from Excel 2016. Change-Id: I3a9d39c1aa5de5af6d1ca43d16c45a5401ec6f3d Reviewed-on: https://gerrit.libreoffice.org/69915 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
-rwxr-xr-xsc/qa/unit/data/xlsx/test_115192.xlsxbin0 -> 11299 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx14
-rw-r--r--sc/source/filter/xcl97/xcl97rec.cxx10
3 files changed, 18 insertions, 6 deletions
diff --git a/sc/qa/unit/data/xlsx/test_115192.xlsx b/sc/qa/unit/data/xlsx/test_115192.xlsx
new file mode 100755
index 000000000000..17bef2cb977e
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/test_115192.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index d9f5a93a8ca2..9ce85f021ccb 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -211,6 +211,7 @@ public:
void testTdf121612();
void testPivotCacheAfterExportXLSX();
void testTdf114969XLSX();
+ void testTdf115192XLSX();
void testXltxExport();
@@ -329,6 +330,7 @@ public:
CPPUNIT_TEST(testTdf121612);
CPPUNIT_TEST(testPivotCacheAfterExportXLSX);
CPPUNIT_TEST(testTdf114969XLSX);
+ CPPUNIT_TEST(testTdf115192XLSX);
CPPUNIT_TEST(testXltxExport);
@@ -4172,6 +4174,18 @@ void ScExportTest::testTdf114969XLSX()
assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[2]", "location", "'1.1.1.1'!C2");
}
+void ScExportTest::testTdf115192XLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("test_115192.", FORMAT_XLSX);
+ CPPUNIT_ASSERT(xDocSh.is());
+
+ xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels", FORMAT_XLSX);
+ CPPUNIT_ASSERT(pDoc);
+ assertXPath(pDoc, "/r:Relationships/r:Relationship[@Id='rId1']", "TargetMode", "External");
+ assertXPathNoAttribute(pDoc, "/r:Relationships/r:Relationship[@Id='rId2']", "TargetMode");
+ assertXPath(pDoc, "/r:Relationships/r:Relationship[@Id='rId3']", "TargetMode", "External");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 2d2fa5decf18..38fd9c27103e 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1096,7 +1096,7 @@ ScRefFlags parseAddress(const OUString& rString, ScAddress& rAddress, const ScDo
return rAddress.Parse(rString, pDoc, formula::FormulaGrammar::CONV_XL_R1C1);
}
-bool transformURL(const OUString& rOldURL, OUString& rNewURL, const ScDocument* pDoc)
+void transformURL(const OUString& rOldURL, OUString& rNewURL, const ScDocument* pDoc)
{
if (rOldURL.startsWith("#"))
{
@@ -1112,7 +1112,7 @@ bool transformURL(const OUString& rOldURL, OUString& rNewURL, const ScDocument*
{
OUString aString = aRange.Format(nResult, pDoc, formula::FormulaGrammar::CONV_XL_OOX);
rNewURL = "#" + aString;
- return true;
+ return;
}
else
{
@@ -1121,13 +1121,12 @@ bool transformURL(const OUString& rOldURL, OUString& rNewURL, const ScDocument*
{
OUString aString = aAddress.Format(nResult, pDoc, formula::FormulaGrammar::CONV_XL_OOX);
rNewURL = "#" + aString;
- return true;
+ return;
}
}
}
rNewURL = rOldURL;
- return false;
}
class ScURLTransformer : public oox::drawingml::URLTransformer
@@ -1147,8 +1146,7 @@ public:
virtual bool isExternalURL(const OUString& rURL) const override
{
- OUString aNewURL;
- return transformURL(rURL, aNewURL, &mrDoc);
+ return !rURL.startsWith("#");
}
private: