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

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 26 07:55:02 UTC 2020


 sc/qa/unit/data/ods/external_hyperlink.ods |binary
 sc/qa/unit/subsequent_export-test.cxx      |   25 +++++++++++++++++++++++--
 sc/source/filter/excel/xecontent.cxx       |    5 ++---
 3 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit fc58d7d65b9683db7b7632137126680b8483f6c5
Author:     Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Wed Oct 14 10:53:54 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Mon Oct 26 08:54:26 2020 +0100

    tdf#129969 XLSX export: file URLs need IURI encoding
    
    External hyperlinks with # in directory name didn't work
    after XLSX export.
    
    Change-Id: Ibdf4fcbb65d0c580841d24c1721454164e341424
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104272
    Tested-by: Jenkins
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sc/qa/unit/data/ods/external_hyperlink.ods b/sc/qa/unit/data/ods/external_hyperlink.ods
new file mode 100644
index 000000000000..1e895b988497
Binary files /dev/null and b/sc/qa/unit/data/ods/external_hyperlink.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 71fa266a191e..62ebac829bb6 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -270,6 +270,7 @@ public:
     void testTdf137000_handle_upright();
     void testTdf126305_DataValidatyErrorAlert();
     void testTdf76047_externalLink();
+    void testTdf129969();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -438,6 +439,7 @@ public:
     CPPUNIT_TEST(testTdf137000_handle_upright);
     CPPUNIT_TEST(testTdf126305_DataValidatyErrorAlert);
     CPPUNIT_TEST(testTdf76047_externalLink);
+    CPPUNIT_TEST(testTdf129969);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -5516,8 +5518,10 @@ void ScExportTest::testTdf76047_externalLink()
     ScDocument& rDoc = pShell->GetDocument();
 
     // compare the loaded data (from external links) to the data copied manually to the testfile
-    for (int nCol = 1; nCol <= 5; nCol++) {
-        for (int nRow = 3; nRow <= 5; nRow++) {
+    for (int nCol = 1; nCol <= 5; nCol++)
+    {
+        for (int nRow = 3; nRow <= 5; nRow++)
+        {
             OUString aStr1 = rDoc.GetString(ScAddress(nCol, nRow, 0));
             OUString aStr2 = rDoc.GetString(ScAddress(nCol, nRow + 5, 0));
             OUString aStr3 = rDoc.GetString(ScAddress(nCol, nRow + 11, 0));
@@ -5528,6 +5532,23 @@ void ScExportTest::testTdf76047_externalLink()
     }
 }
 
+void ScExportTest::testTdf129969()
+{
+    ScDocShellRef xShell = loadDoc("external_hyperlink.", FORMAT_ODS);
+    CPPUNIT_ASSERT(xShell.is());
+
+    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    CPPUNIT_ASSERT(xDocSh.is());
+    ScDocument& rDoc = xDocSh->GetDocument();
+    ScAddress aPos(0, 0, 0);
+    const EditTextObject* pEditText = rDoc.GetEditText(aPos);
+    const SvxFieldData* pData = pEditText->GetFieldData(0, 0, text::textfield::Type::URL);
+    const SvxURLField* pURLData = static_cast<const SvxURLField*>(pData);
+    CPPUNIT_ASSERT(pURLData->GetURL().endsWith("/%23folder/test.ods#Sheet2.B10"));
+
+    xDocSh->DoClose();
+}
+
 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 dbb28ec7b81c..27f07989c530 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -351,9 +351,8 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
     {
         sal_uInt16 nLevel;
         bool bRel;
-        /* TODO: should we differentiate between BIFF and OOXML and write IURI
-         * encoded for OOXML? */
-        OUString aFileName( BuildFileName( nLevel, bRel, rUrl, rRoot, false ) );
+        OUString aFileName(
+            BuildFileName(nLevel, bRel, rUrl, rRoot, rRoot.GetOutput() == EXC_OUTPUT_XML_2007));
 
         if( eProtocol == INetProtocol::Smb )
         {


More information about the Libreoffice-commits mailing list