summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-06-09 23:29:38 +0200
committerEike Rathke <erack@redhat.com>2015-06-09 23:42:53 +0200
commit20e4ccc6ba366cd70c9218e016ccff4025e3d816 (patch)
tree2117acbe852a3b7ae87ef629fe368729fc0b8fc6
parent8e0a9f97acd7eacb550eb503691e88cfd0921e5e (diff)
correct 3D reference update on sheet deletion, tdf#90001 follow-up
be1b3daeeb64a44e577510561d02147b87db72c2 missed a few cases * a deleted reference start was shifted by two sheets instead of one if the formula was on a sheet before the deleted one * a deleted reference end was not correct if the formula was on a sheet behind the deleted one and used relative sheet reference * #REF! wasn't set when the entire referenced range was deleted Change-Id: Ib9c7492a651a8429fa1c411c8e447593e366e09d
-rw-r--r--sc/source/core/tool/token.cxx19
1 files changed, 10 insertions, 9 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 00c9395434f0..4e20d93d8195 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3471,25 +3471,26 @@ bool adjustDoubleRefOnDeleteTab(ScComplexRefData& rRef, SCTAB nDelPos, SCTAB nSh
ScAddress aEndPos = rRef2.toAbs(rOldPos);
bool bMoreThanOneTab = aStartPos.Tab() != aEndPos.Tab();
bool bModified = false;
- if (bMoreThanOneTab && aStartPos.Tab() == nDelPos)
+ if (bMoreThanOneTab && aStartPos.Tab() == nDelPos && nDelPos + nSheets <= aEndPos.Tab())
{
- if (rRef1.IsTabRel())
+ if (rRef1.IsTabRel() && aStartPos.Tab() < rOldPos.Tab())
{
- aStartPos.IncTab(nSheets);
- rRef1.SetAddress(aStartPos, rOldPos);
+ rRef1.IncTab(nSheets);
+ bModified = true;
}
- bModified = true;
}
else
{
bModified = adjustSingleRefOnDeletedTab(rRef1, nDelPos, nSheets, rOldPos, rNewPos);
}
- if (bMoreThanOneTab && aEndPos.Tab() == nDelPos)
+ if (bMoreThanOneTab && aEndPos.Tab() == nDelPos && aStartPos.Tab() <= nDelPos - nSheets)
{
- aEndPos.IncTab(-nSheets);
- rRef2.SetAddress(aEndPos, rNewPos);
- bModified = true;
+ if (!rRef2.IsTabRel() || rOldPos.Tab() < aEndPos.Tab())
+ {
+ rRef2.IncTab(-nSheets);
+ bModified = true;
+ }
}
else
{