Kaydet (Commit) e78290c8 authored tarafından Eike Rathke's avatar Eike Rathke Kaydeden (comit) Andras Timar

TableRef: use ScTokenArray::HasReferences() instead of GetNextReferenceRPN()

To catch also a simple =Table[[#This Row],[Column]] that is outside of
table bounds located and therefor generates an error token instead of a
reference in RPN.

Change-Id: I28f5ca12b5f5998c623d0f38fcf39f037aabd317
(cherry picked from commit 703832ca)
üst ea653726
...@@ -2896,8 +2896,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( ...@@ -2896,8 +2896,7 @@ bool ScFormulaCell::UpdateReferenceOnShift(
bCellStateChanged = UpdatePosOnShift(rCxt); bCellStateChanged = UpdatePosOnShift(rCxt);
// Check presence of any references or column row names. // Check presence of any references or column row names.
pCode->Reset(); bool bHasRefs = pCode->HasReferences();
bool bHasRefs = (pCode->GetNextReferenceRPN() != NULL);
bool bHasColRowNames = false; bool bHasColRowNames = false;
if (!bHasRefs) if (!bHasRefs)
{ {
...@@ -3018,8 +3017,7 @@ bool ScFormulaCell::UpdateReferenceOnMove( ...@@ -3018,8 +3017,7 @@ bool ScFormulaCell::UpdateReferenceOnMove(
} }
// Check presence of any references or column row names. // Check presence of any references or column row names.
pCode->Reset(); bool bHasRefs = pCode->HasReferences();
bool bHasRefs = (pCode->GetNextReferenceRPN() != NULL);
bool bHasColRowNames = false; bool bHasColRowNames = false;
if (!bHasRefs) if (!bHasRefs)
{ {
...@@ -3147,8 +3145,7 @@ bool ScFormulaCell::UpdateReferenceOnCopy( ...@@ -3147,8 +3145,7 @@ bool ScFormulaCell::UpdateReferenceOnCopy(
} }
// Check presence of any references or column row names. // Check presence of any references or column row names.
pCode->Reset(); bool bHasRefs = pCode->HasReferences();
bool bHasRefs = (pCode->GetNextReferenceRPN() != NULL);
pCode->Reset(); pCode->Reset();
bool bHasColRowNames = (pCode->GetNextColRowName() != NULL); bool bHasColRowNames = (pCode->GetNextColRowName() != NULL);
bHasRefs = bHasRefs || bHasColRowNames; bHasRefs = bHasRefs || bHasColRowNames;
...@@ -3228,8 +3225,7 @@ void ScFormulaCell::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) ...@@ -3228,8 +3225,7 @@ void ScFormulaCell::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt )
// Adjust tokens only when it's not grouped or grouped top cell. // Adjust tokens only when it's not grouped or grouped top cell.
bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this; bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this;
bool bPosChanged = (rCxt.mnInsertPos <= aPos.Tab()); bool bPosChanged = (rCxt.mnInsertPos <= aPos.Tab());
pCode->Reset(); if (pDocument->IsClipOrUndo() || !pCode->HasReferences())
if (pDocument->IsClipOrUndo() || !pCode->GetNextReferenceRPN())
{ {
if (bPosChanged) if (bPosChanged)
aPos.IncTab(rCxt.mnSheets); aPos.IncTab(rCxt.mnSheets);
...@@ -3259,8 +3255,7 @@ bool ScFormulaCell::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) ...@@ -3259,8 +3255,7 @@ bool ScFormulaCell::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt )
// Adjust tokens only when it's not grouped or grouped top cell. // Adjust tokens only when it's not grouped or grouped top cell.
bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this; bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this;
bool bPosChanged = (aPos.Tab() >= rCxt.mnDeletePos + rCxt.mnSheets); bool bPosChanged = (aPos.Tab() >= rCxt.mnDeletePos + rCxt.mnSheets);
pCode->Reset(); if (pDocument->IsClipOrUndo() || !pCode->HasReferences())
if (pDocument->IsClipOrUndo() || !pCode->GetNextReferenceRPN())
{ {
if (bPosChanged) if (bPosChanged)
aPos.IncTab(-1*rCxt.mnSheets); aPos.IncTab(-1*rCxt.mnSheets);
...@@ -3289,8 +3284,7 @@ void ScFormulaCell::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTab ...@@ -3289,8 +3284,7 @@ void ScFormulaCell::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTab
// Adjust tokens only when it's not grouped or grouped top cell. // Adjust tokens only when it's not grouped or grouped top cell.
bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this; bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this;
pCode->Reset(); if (!pCode->HasReferences() || pDocument->IsClipOrUndo())
if (!pCode->GetNextReferenceRPN() || pDocument->IsClipOrUndo())
{ {
aPos.SetTab(nTabNo); aPos.SetTab(nTabNo);
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment