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

Justin Luth justin.luth at collabora.com
Wed Jun 13 11:04:02 UTC 2018


 sc/qa/unit/subsequent_export-test.cxx |    4 ++--
 sc/source/filter/html/htmlimp.cxx     |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 399bf0dcd26ed23d2864d60ccba0541d81f48cdc
Author: Justin Luth <justin.luth at collabora.com>
Date:   Tue Jun 5 19:30:58 2018 +0300

    tdf#114487 sc htmlimp: non-global sheet range names
    
    Allow multiple file imports, each one having a
    non-conflicting range name, by being sheet specific. As
    Eike states, "This does *not* mean that they couldn't
    be referenced from other sheets. By prefixing the sheet
    name it can be used from any other sheet, for example
    Sheet2.HTML_1. (This wasn't possible in early versions
    with sheet-local names but it has been possible for
    a while already)."
    
    In theory, it would previously have been possible to create
    a generic sheet with calculations using a range name
    that doesn't exist yet, and then importing *any* file
    to be analyzed.
    
    In practice that has never been possible
    since all names were relative, and imports always
    create a new sheet, so the relative name would point
    elsewhere. Also, the non-existant name only resolves
    after a round-trip of the file, not immediately
    upon file import.
    
    So, it is logical to set the imported range names
    to be sheet-local instead of global.
    
    Change-Id: I3103f0655b2373bb731c192bb5d2c0757938ee28
    Reviewed-on: https://gerrit.libreoffice.org/55349
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 5720c85ccea9f1481bd604b806c5be728e59a13f)
    Reviewed-on: https://gerrit.libreoffice.org/55648
    (cherry picked from commit f62340a104813e4a6a34e7281d86407bc8314ffd)
    Reviewed-on: https://gerrit.libreoffice.org/55698
    Tested-by: Justin Luth <justin_luth at sil.org>

diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index af1b344dcf89..168dc7f572d2 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -3318,9 +3318,9 @@ void ScExportTest::testAbsNamedRangeHTML()
     xDocSh2->DoHardRecalc();
 
     ScDocument& rDoc = xDocSh2->GetDocument();
-    ScRangeData* pRangeData = rDoc.GetRangeName()->findByUpperName(OUString("HTML_1"));
+    ScRangeData* pRangeData = rDoc.GetRangeName(0)->findByUpperName(OUString("HTML_1"));
     ScSingleRefData* pRef = pRangeData->GetCode()->FirstToken()->GetSingleRef();
-    CPPUNIT_ASSERT_MESSAGE("HTML_1 is an absolute reference",!pRef->IsTabRel());
+    CPPUNIT_ASSERT_MESSAGE("Sheet1.HTML_1 is an absolute reference",!pRef->IsTabRel());
 }
 
 void ScExportTest::testSheetLocalRangeNameXLS()
diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx
index f601903bfde9..a4d79d21ae14 100644
--- a/sc/source/filter/html/htmlimp.cxx
+++ b/sc/source/filter/html/htmlimp.cxx
@@ -107,7 +107,7 @@ void ScHTMLImport::InsertRangeName( ScDocument* pDoc, const OUString& rName, con
     ScTokenArray aTokArray;
     aTokArray.AddDoubleReference( aRefData );
     ScRangeData* pRangeData = new ScRangeData( pDoc, rName, aTokArray );
-    pDoc->GetRangeName()->insert( pRangeData );
+    pDoc->GetRangeName( rRange.aStart.Tab() )->insert( pRangeData );
 }
 
 void ScHTMLImport::WriteToDocument(


More information about the Libreoffice-commits mailing list