diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-28 21:25:01 -0500 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2014-03-03 08:00:16 -0600 |
commit | cb83b334e489a4ec1cc067145c3f64b129475e7f (patch) | |
tree | a4e3e1871aac423c51ade747430153ac17933ac2 /sc/source/core/tool/token.cxx | |
parent | 4040c461fc244940c6817770104ccbcc013ac1f3 (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
(cherry picked from commit f32df2d590d0ee14f09664934457ba9e8de8cbe6)
Reviewed-on: https://gerrit.libreoffice.org/8403
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'sc/source/core/tool/token.cxx')
-rw-r--r-- | sc/source/core/tool/token.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 92a9c77be623..eb2acb9624a7 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); |