sc/source/core/tool/interpr1.cxx | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
New commits: commit 81b606f547fcfc254e040937519516b98f089241 Author: Eike Rathke <er...@redhat.com> Date: Mon Jun 29 20:50:53 2015 +0200 support plain database range (table) names in INDIRECT Change-Id: I89c1249315059d6a04615de27e8b9b18dfd300ff diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 568ce1f..e2255ac 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -7095,7 +7095,40 @@ void ScInterpreter::ScIndirect() } while (false); - /* TODO: simple named ranges and database ranges could be resolved. */ + do + { + OUString aName( ScGlobal::pCharClass->uppercase( sRefStr)); + ScDBCollection::NamedDBs& rDBs = pDok->GetDBCollection()->getNamedDBs(); + const ScDBData* pData = rDBs.findByUpperName( aName); + if (!pData) + break; + + ScRange aRange; + pData->GetArea( aRange); + + // In Excel, specifying a table name without [] resolves to the + // same as with [], a range that excludes header and totals + // rows and contains only data rows. Do the same. + if (pData->HasHeader()) + aRange.aStart.IncRow(); + if (pData->HasTotals()) + aRange.aEnd.IncRow(-1); + + if (aRange.aStart.Row() > aRange.aEnd.Row()) + break; + + if (aRange.aStart == aRange.aEnd) + PushSingleRef( aRange.aStart.Col(), aRange.aStart.Row(), + aRange.aStart.Tab()); + else + PushDoubleRef( aRange.aStart.Col(), aRange.aStart.Row(), + aRange.aStart.Tab(), aRange.aEnd.Col(), + aRange.aEnd.Row(), aRange.aEnd.Tab()); + + // success! + return; + } + while (false); // It may be even a TableRef. // Anything else that resolves to one reference could be added _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits