[Libreoffice-commits] core.git: sc/qa sc/source

tundet (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 1 15:51:11 UTC 2019


 sc/qa/unit/data/xlsx/test_115192.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx |   14 ++++++++++++++
 sc/source/filter/xcl97/xcl97rec.cxx   |   10 ++++------
 3 files changed, 18 insertions(+), 6 deletions(-)

New commits:
commit 186a9aae2d9612a9d6408e4871bc49963d4f9bb6
Author:     tundet <tundeth at gmail.com>
AuthorDate: Fri Mar 29 10:22:06 2019 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Mon Apr 1 17:50:45 2019 +0200

    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 at numbertext.org>

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
Binary files /dev/null and b/sc/qa/unit/data/xlsx/test_115192.xlsx 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:


More information about the Libreoffice-commits mailing list