diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-16 12:49:14 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-16 14:34:44 -0500 |
commit | 982a03d4e2baf4ca7e78c79014389d9b23e200d1 (patch) | |
tree | 964d7ebb0c9fe26dd225fd3942719a5df8528f4f /sc/source | |
parent | 7b3e7c46d7245aba87a3f4742b2c7911095a3bc0 (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
Diffstat (limited to 'sc/source')
-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 4837e3cf5959..14ccad41bca4 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. |