[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sc/qa sc/source

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 25 09:36:20 UTC 2019


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

New commits:
commit 5c0fa3265962373f36020f3ba8ddcdbc265e0acc
Author:     Tünde Tóth <tundeth at gmail.com>
AuthorDate: Thu Mar 14 14:44:31 2019 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Mon Mar 25 10:35:56 2019 +0100

    tdf#114969 XLSX export: fix 'sheet.name.with.dot'!A1-like links
    
    When the sheet name/cell address separator was an exclamation mark,
    bad conversion of the optional dot separator replaced the last dot
    of the exported sheet name, resulting broken links:
    
    'sheet.name.with!dot'!A1
    
    Change-Id: I84fb6c8da345c144b04657ea350f1f96614071b7
    Reviewed-on: https://gerrit.libreoffice.org/69272
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 37a3af2413f9407639157caef67d7d5168230e49)
    Reviewed-on: https://gerrit.libreoffice.org/69583
    Reviewed-by: Tünde Tóth <tundeth at gmail.com>

diff --git a/sc/qa/unit/data/ods/sheet_name_with_dots.ods b/sc/qa/unit/data/ods/sheet_name_with_dots.ods
new file mode 100755
index 000000000000..dc5b8193fe71
Binary files /dev/null and b/sc/qa/unit/data/ods/sheet_name_with_dots.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 04d26cd35d6d..22851e9b5f5f 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -220,6 +220,7 @@ public:
     void testTdf118990();
     void testTdf121612();
     void testPivotCacheAfterExportXLSX();
+    void testTdf114969XLSX();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -335,6 +336,7 @@ public:
     CPPUNIT_TEST(testTdf118990);
     CPPUNIT_TEST(testTdf121612);
     CPPUNIT_TEST(testPivotCacheAfterExportXLSX);
+    CPPUNIT_TEST(testTdf114969XLSX);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -4231,6 +4233,17 @@ void ScExportTest::testPivotCacheAfterExportXLSX()
     xDocSh->DoClose();
 }
 
+void ScExportTest::testTdf114969XLSX()
+{
+    ScDocShellRef xDocSh = loadDoc("sheet_name_with_dots.", FORMAT_ODS);
+    CPPUNIT_ASSERT(xDocSh.is());
+
+    xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
+    CPPUNIT_ASSERT(pDoc);
+    assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[1]", "location", "'1.1.1.1'!C1");
+    assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[2]", "location", "'1.1.1.1'!C2");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
old mode 100644
new mode 100755
index 7d8341f5b3f8..9023a524b786
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -418,11 +418,14 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
     {
         OUString aTextMark( rUrl.copy( 1 ) );
 
-        sal_Int32 nSepPos = aTextMark.lastIndexOf( '.' );
-        if(nSepPos != -1)
-            aTextMark = aTextMark.replaceAt( nSepPos, 1, "!" );
-        else
-            nSepPos = aTextMark.lastIndexOf( '!' );
+        sal_Int32 nSepPos = aTextMark.lastIndexOf( '!' );
+        sal_Int32 nPointPos = aTextMark.lastIndexOf( '.' );
+        // last dot is the separator, if there is no ! after it
+        if(nSepPos < nPointPos)
+        {
+           nSepPos = nPointPos;
+           aTextMark = aTextMark.replaceAt( nSepPos, 1, "!" );
+        }
 
         if(nSepPos != -1)
         {


More information about the Libreoffice-commits mailing list