[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Thu Feb 25 12:57:55 UTC 2021


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

New commits:
commit f516f2a0ccc939f565c8a84ae5430b3706d56bb4
Author:     Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Wed Oct 14 10:53:54 2020 +0200
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Thu Feb 25 13:57:22 2021 +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>
    (cherry picked from commit fc58d7d65b9683db7b7632137126680b8483f6c5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111465
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

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 a3b699cb9938..f37778217a73 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -267,6 +267,7 @@ public:
     void testTdf123353();
     void testTdf133688_precedents();
     void testTdf126305_DataValidatyErrorAlert();
+    void testTdf129969();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -428,6 +429,7 @@ public:
     CPPUNIT_TEST(testTdf123353);
     CPPUNIT_TEST(testTdf133688_precedents);
     CPPUNIT_TEST(testTdf126305_DataValidatyErrorAlert);
+    CPPUNIT_TEST(testTdf129969);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -5420,6 +5422,23 @@ void ScExportTest::testTdf126305_DataValidatyErrorAlert()
     xDocSh->DoClose();
 }
 
+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 7bc5445de207..d69946b06f62 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