summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorKohei Yoshida <libreoffice@kohei.us>2013-09-07 16:32:49 -0400
committerKohei Yoshida <libreoffice@kohei.us>2013-09-07 16:38:24 -0400
commitf4710e167ded0e6a378f1bfb01ef842b726b0aac (patch)
treebbb8fe4f38bcf1be19e9c438e4941af1bee80636 /sc/source
parent405a9346efa8dbed3d36ad96dc373a97e4e99d92 (diff)
Fix incorrect reference update on shared formulas.
The start position of a shared formula group is used to prevent non-top cells of the group from being updated. Updating it at the top cell may cause non-top cells to perform reference update which they never should. Change-Id: I4f067d4d717b756fc89cb823f3ce3e630dac756e
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/formulacell.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 143351e8326e..0f248a26705f 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2186,7 +2186,10 @@ bool ScFormulaCell::UpdatePosOnShift( const sc::RefUpdateContext& rCxt )
// This formula cell itself is being shifted during cell range
// insertion or deletion. Update its position.
- if (mxGroup && mxGroup->mnStart == aPos.Row())
+
+ if (mxGroup && (mxGroup->mnStart+mxGroup->mnLength-1) == aPos.Row())
+ // For a shared formula cell, update its group start position only
+ // when it's the last cell of the group.
mxGroup->mnStart += rCxt.mnRowDelta;
aPos.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);