summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-06-21 21:48:06 +0200
committerEike Rathke <erack@redhat.com>2015-06-21 21:53:38 +0200
commit703832caef64e212d276667c7f2d79e4018abeea (patch)
tree8ad47aedee5f6de8350b4531fff75058d1318d8d
parentf243e27a37ef49e6e1372ef402cd52fa4b0073b6 (diff)
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
-rw-r--r--sc/source/core/data/formulacell.cxx18
1 files changed, 6 insertions, 12 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 72b698b47ba2..fad80e4676b3 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2894,8 +2894,7 @@ bool ScFormulaCell::UpdateReferenceOnShift(
bCellStateChanged = UpdatePosOnShift(rCxt);
// Check presence of any references or column row names.
- pCode->Reset();
- bool bHasRefs = (pCode->GetNextReferenceRPN() != NULL);
+ bool bHasRefs = pCode->HasReferences();
bool bHasColRowNames = false;
if (!bHasRefs)
{
@@ -3016,8 +3015,7 @@ bool ScFormulaCell::UpdateReferenceOnMove(
}
// Check presence of any references or column row names.
- pCode->Reset();
- bool bHasRefs = (pCode->GetNextReferenceRPN() != NULL);
+ bool bHasRefs = pCode->HasReferences();
bool bHasColRowNames = false;
if (!bHasRefs)
{
@@ -3145,8 +3143,7 @@ bool ScFormulaCell::UpdateReferenceOnCopy(
}
// Check presence of any references or column row names.
- pCode->Reset();
- bool bHasRefs = (pCode->GetNextReferenceRPN() != NULL);
+ bool bHasRefs = pCode->HasReferences();
pCode->Reset();
bool bHasColRowNames = (pCode->GetNextColRowName() != NULL);
bHasRefs = bHasRefs || bHasColRowNames;
@@ -3226,8 +3223,7 @@ 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())
+ if (pDocument->IsClipOrUndo() || !pCode->HasReferences())
{
if (bPosChanged)
aPos.IncTab(rCxt.mnSheets);
@@ -3257,8 +3253,7 @@ 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())
+ if (pDocument->IsClipOrUndo() || !pCode->HasReferences())
{
if (bPosChanged)
aPos.IncTab(-1*rCxt.mnSheets);
@@ -3287,8 +3282,7 @@ void ScFormulaCell::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTab
// 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())
+ if (!pCode->HasReferences() || pDocument->IsClipOrUndo())
{
aPos.SetTab(nTabNo);
return;