diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-28 21:25:01 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-28 21:28:57 -0500 |
commit | f32df2d590d0ee14f09664934457ba9e8de8cbe6 (patch) | |
tree | 931668661a90fbe8c6b8148e72ef218272fc7e17 /sc/source/core/tool | |
parent | aa6c5b7faecdb57cbdeac051e304531c1a1cf63b (diff) |
fdo#75053: Adjust reference update on shift for formula groups.
This is similar to my earlier fix for reference update on moving of
cells.
Change-Id: I592599507bfcab12f611eeae7b56c99da6c31919
Diffstat (limited to 'sc/source/core/tool')
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 31 |
2 files changed, 33 insertions, 2 deletions
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index afb8f5fd77a5..68f2ba5fba4f 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -769,13 +769,13 @@ struct ConventionOOO_A1 : public Convention_A1 rBuffer.append('.'); if (!rRef.IsColRel()) rBuffer.append('$'); - if (!ValidCol(rAbsRef.Col())) + if (!ValidCol(rAbsRef.Col()) || rRef.IsColDeleted()) rBuffer.append(rErrRef); else MakeColStr(rBuffer, rAbsRef.Col()); if (!rRef.IsRowRel()) rBuffer.append('$'); - if (!ValidRow(rAbsRef.Row())) + if (!ValidRow(rAbsRef.Row()) || rRef.IsRowDeleted()) rBuffer.append(rErrRef); else MakeRowStr(rBuffer, rAbsRef.Row()); diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 7052049a9f44..c7c8e42314d5 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -2480,6 +2480,25 @@ void setRefDeleted( ScSingleRefData& rRef, const sc::RefUpdateContext& rCxt ) rRef.SetTabDeleted(true); } +void restoreDeletedRef( ScSingleRefData& rRef, const sc::RefUpdateContext& rCxt ) +{ + if (rCxt.mnColDelta) + { + if (rRef.IsColDeleted()) + rRef.SetColDeleted(false); + } + else if (rCxt.mnRowDelta) + { + if (rRef.IsRowDeleted()) + rRef.SetRowDeleted(false); + } + else if (rCxt.mnTabDelta) + { + if (rRef.IsTabDeleted()) + rRef.SetTabDeleted(false); + } +} + void setRefDeleted( ScComplexRefData& rRef, const sc::RefUpdateContext& rCxt ) { if (rCxt.mnColDelta < 0) @@ -2647,6 +2666,18 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateCon break; } + if (!rCxt.isDeleted() && rRef.IsDeleted()) + { + // Check if the token has reference to previously deleted region. + ScAddress aCheckPos = rRef.toAbs(aNewPos); + if (rCxt.maRange.In(aCheckPos)) + { + restoreDeletedRef(rRef, rCxt); + aRes.mbValueChanged = true; + break; + } + } + if (rCxt.maRange.In(aAbs)) { aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta); |