Kaydet (Commit) 5720c85c authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Eike Rathke

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/55349Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
üst b7a30d4b
......@@ -3337,9 +3337,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()
......
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment