Kaydet (Commit) 186a9aae authored tarafından tundet's avatar tundet Kaydeden (comit) László Németh

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: 's avatarLászló Németh <nemeth@numbertext.org>
üst 7de7e8ec
......@@ -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();
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment