summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-04-19 15:41:28 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-04-19 15:51:01 +0200
commit44481da569df85aa91455fdc2892a4e0c5818e6c (patch)
treed217fbb17a23afaa04d0e14111dba4fe18b361c8 /sc
parentenable the chart2 dumper test (diff)
downloadcore-44481da569df85aa91455fdc2892a4e0c5818e6c.tar.gz
core-44481da569df85aa91455fdc2892a4e0c5818e6c.zip
update relative local range names, fdo#48856
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/compiler.hxx2
-rw-r--r--sc/inc/rangenam.hxx4
-rw-r--r--sc/source/core/data/table1.cxx2
-rw-r--r--sc/source/core/tool/compiler.cxx7
-rw-r--r--sc/source/core/tool/rangenam.cxx8
5 files changed, 10 insertions, 13 deletions
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 84496b6a9c2a..b83448b22c28 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -443,7 +443,7 @@ public:
bool UpdateNameReference( UpdateRefMode eUpdateRefMode,
const ScRange&,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
- bool& rChanged, bool bSharedFormula = false);
+ bool& rChanged, bool bSharedFormula = false, bool bLocal = false);
ScRangeData* UpdateReference( UpdateRefMode eUpdateRefMode,
const ScAddress& rOldPos, const ScRange&,
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 3d8f626e0594..2e3c007adb1c 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -139,7 +139,7 @@ public:
const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT );
void UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& r,
- SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
+ SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bLocal = false );
bool IsModified() const { return bModified; }
SC_DLLPUBLIC void GuessPosition();
@@ -203,7 +203,7 @@ public:
SC_DLLPUBLIC const ScRangeData* findByUpperName(const rtl::OUString& rName) const;
SC_DLLPUBLIC ScRangeData* findByIndex(sal_uInt16 i);
void UpdateReference(UpdateRefMode eUpdateRefMode, const ScRange& rRange,
- SCsCOL nDx, SCsROW nDy, SCsTAB nDz);
+ SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bLocal = false);
void UpdateTabRef(SCTAB nTable, sal_uInt16 nFlag, SCTAB nNewTable = 0, SCTAB nNewSheets = 1);
void UpdateTranspose(const ScRange& rSource, const ScAddress& rDest);
void UpdateGrow(const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY);
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 31bf5a655c5e..acf52059080c 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1379,7 +1379,7 @@ void ScTable::UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW
if (mpRangeName)
{
ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );;
- mpRangeName->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz );
+ mpRangeName->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz, true );
}
if ( bIncludeDraw )
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 9b2fa2e00dfe..be051c9d69e3 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4454,7 +4454,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
bool ScCompiler::UpdateNameReference(UpdateRefMode eUpdateRefMode,
const ScRange& r,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
- bool& rChanged, bool bSharedFormula)
+ bool& rChanged, bool bSharedFormula, bool bLocal)
{
bool bRelRef = false; // set if relative reference
rChanged = false;
@@ -4474,15 +4474,12 @@ bool ScCompiler::UpdateNameReference(UpdateRefMode eUpdateRefMode,
if (!bUpdate && t->GetType() == svDoubleRef)
bUpdate = !rRef.Ref2.IsColRel() || !rRef.Ref2.IsRowRel() ||
!rRef.Ref2.IsTabRel();
- if (!bSharedFormula)
+ if (!bSharedFormula && !bLocal)
{
// We cannot update names with sheet-relative references, they may
// be used on other sheets as well and the resulting reference
// would be wrong. This is a dilemma if col/row would need to be
// updated for the current usage.
- // TODO: seems the only way out of this would be to not allow
- // relative sheet references and have sheet-local names that can be
- // copied along with sheets.
bUpdate = bUpdate && !rRef.Ref1.IsTabRel() && !rRef.Ref2.IsTabRel();
}
if (bUpdate)
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index b5111de64de6..8f10302a7e23 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -300,7 +300,7 @@ void ScRangeData::UpdateSymbol( rtl::OUStringBuffer& rBuffer, const ScAddress& r
void ScRangeData::UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& r,
- SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
+ SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bLocal )
{
bool bChanged = false;
@@ -312,7 +312,7 @@ void ScRangeData::UpdateReference( UpdateRefMode eUpdateRefMode,
aComp.SetGrammar(pDoc->GetGrammar());
const bool bRelRef = aComp.UpdateNameReference( eUpdateRefMode, r,
nDx, nDy, nDz,
- bChanged, bSharedFormula);
+ bChanged, bSharedFormula, bLocal);
if (bSharedFormula)
{
if (bRelRef)
@@ -779,11 +779,11 @@ ScRangeData* ScRangeName::findByIndex(sal_uInt16 i)
}
void ScRangeName::UpdateReference(
- UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz)
+ UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bLocal)
{
DataType::iterator itr = maData.begin(), itrEnd = maData.end();
for (; itr != itrEnd; ++itr)
- itr->second->UpdateReference(eUpdateRefMode, rRange, nDx, nDy, nDz);
+ itr->second->UpdateReference(eUpdateRefMode, rRange, nDx, nDy, nDz, bLocal);
}
void ScRangeName::UpdateTabRef(SCTAB nTable, sal_uInt16 nFlag, SCTAB nNewTable, SCTAB nNewSheets)