diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-16 12:49:14 -0500 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-01-21 10:53:24 +0000 |
commit | 41b9f71f6717e9e4a6395227406c73b73c2d3a35 (patch) | |
tree | 7954a211985323989e0ff52fb00627f53012adf5 | |
parent | f14eddb9c8ba5c83e6699ec3f2ce57ea80cc8e8f (diff) |
fdo#73655: Don't adjust formula tokens on non-top shared formula cells.
Only adjust tokens for non-shared formula cells and shared formuls cells
that are the top of their respective shared groups.
Change-Id: I9cd57653602c97504a802001947a28c4d03368a5
(cherry picked from commit 982a03d4e2baf4ca7e78c79014389d9b23e200d1)
Reviewed-on: https://gerrit.libreoffice.org/7483
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 721f2681c67d..66ef7320bc13 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2799,6 +2799,8 @@ bool ScFormulaCell::UpdateReference( void ScFormulaCell::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) { + // Adjust tokens only when it's not grouped or grouped top cell. + bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this; bool bPosChanged = (rCxt.mnInsertPos <= aPos.Tab()); pCode->Reset(); if (pDocument->IsClipOrUndo() || !pCode->GetNextReferenceRPN()) @@ -2815,6 +2817,9 @@ void ScFormulaCell::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) if (bPosChanged) aPos.IncTab(rCxt.mnSheets); + if (!bAdjustCode) + return; + sc::RefUpdateResult aRes = pCode->AdjustReferenceOnInsertedTab(rCxt, aOldPos); if (aRes.mbNameModified) // Re-compile after new sheet(s) have been inserted. @@ -2825,6 +2830,8 @@ void ScFormulaCell::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) bool ScFormulaCell::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) { + // Adjust tokens only when it's not grouped or grouped top cell. + bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this; bool bPosChanged = (aPos.Tab() >= rCxt.mnDeletePos + rCxt.mnSheets); pCode->Reset(); if (pDocument->IsClipOrUndo() || !pCode->GetNextReferenceRPN()) @@ -2840,6 +2847,9 @@ bool ScFormulaCell::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) if (bPosChanged) aPos.IncTab(-1*rCxt.mnSheets); + if (!bAdjustCode) + return false; + sc::RefUpdateResult aRes = pCode->AdjustReferenceOnDeletedTab(rCxt, aOldPos); if (aRes.mbNameModified) // Re-compile after sheet(s) have been deleted. @@ -2850,6 +2860,9 @@ bool ScFormulaCell::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) void ScFormulaCell::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo ) { + // Adjust tokens only when it's not grouped or grouped top cell. + bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this; + pCode->Reset(); if (!pCode->GetNextReferenceRPN() || pDocument->IsClipOrUndo()) { @@ -2863,6 +2876,10 @@ void ScFormulaCell::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTab aPos.SetTab(nTabNo); // no StartListeningTo because pTab[nTab] not yet correct! + + if (!bAdjustCode) + return; + sc::RefUpdateResult aRes = pCode->AdjustReferenceOnMovedTab(rCxt, aOldPos); if (aRes.mbNameModified) // Re-compile after sheet(s) have been deleted. |