diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-12 21:53:34 -0400 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-03-13 10:44:00 -0500 |
commit | 3da21555accb654a3185bdac5532304ac6ce5b34 (patch) | |
tree | 108c800066b4709efd46cda9f32ae24262d40b09 /sc/source/core/tool/token.cxx | |
parent | 6293d898c16bafeb703129ed0d33857934ab1dfb (diff) |
fdo#75977: Clear sheet deleted flags for affected references when undoing.
This will allow formula cells to restore deleted references when they get
recalculated. With this change, SetDirty() that previosly took no argument
has been renamed to SetAllFormulasDirty(), and it now takes one argument that
stores context information.
(cherry picked from commit 18909ddb30db7ca9416ee2bfb0503753e877f002)
Conflicts:
sc/inc/document.hxx
sc/source/ui/docshell/docsh5.cxx
sc/source/ui/view/spelldialog.cxx
Change-Id: If0de5dc1737a2722b6d61a87644b10a4f921edc5
Reviewed-on: https://gerrit.libreoffice.org/8564
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/source/core/tool/token.cxx')
-rw-r--r-- | sc/source/core/tool/token.cxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index ec323de2f6c7..2b03db3e7795 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -3198,6 +3198,52 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMovedTab( sc::RefUpdateMoveTa namespace { +void clearTabDeletedFlag( ScSingleRefData& rRef, const ScAddress& rPos, SCTAB nStartTab, SCTAB nEndTab ) +{ + if (!rRef.IsTabDeleted()) + return; + + ScAddress aAbs = rRef.toAbs(rPos); + if (nStartTab <= aAbs.Tab() && aAbs.Tab() <= nEndTab) + rRef.SetTabDeleted(false); +} + +} + +void ScTokenArray::ClearTabDeleted( const ScAddress& rPos, SCTAB nStartTab, SCTAB nEndTab ) +{ + if (nEndTab < nStartTab) + return; + + FormulaToken** p = pCode; + FormulaToken** pEnd = p + static_cast<size_t>(nLen); + for (; p != pEnd; ++p) + { + switch ((*p)->GetType()) + { + case svSingleRef: + { + ScToken* pToken = static_cast<ScToken*>(*p); + ScSingleRefData& rRef = pToken->GetSingleRef(); + clearTabDeletedFlag(rRef, rPos, nStartTab, nEndTab); + } + break; + case svDoubleRef: + { + ScToken* pToken = static_cast<ScToken*>(*p); + ScComplexRefData& rRef = pToken->GetDoubleRef(); + clearTabDeletedFlag(rRef.Ref1, rPos, nStartTab, nEndTab); + clearTabDeletedFlag(rRef.Ref2, rPos, nStartTab, nEndTab); + } + break; + default: + ; + } + } +} + +namespace { + void checkBounds( const sc::RefUpdateContext& rCxt, const ScAddress& rPos, SCROW nGroupLen, const ScSingleRefData& rRef, std::vector<SCROW>& rBounds) |