create NoName error token instead of setting error at the token array
... when handling name token. This can happen when importing BIFF .xls and the
original range is not present in the document. The document is broken, but such
formula can continue to work if the range expression was not actually executed,
for example IF(TRUE(),then_good,else_bad_range) where else_bad_range is #NAME?
error.
Change-Id: I823ac89115418cf5069b2baf5c5de2c814319ae7
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 589bb9b..834c7ab 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4659,6 +4659,7 @@ ScRangeData* ScCompiler::GetRangeData( const FormulaToken& rToken ) const
bool ScCompiler::HandleRange()
{
ScTokenArray* pNew;
const ScRangeData* pRangeData = GetRangeData( *mpToken);
if (pRangeData)
{
@@ -4667,7 +4668,6 @@ bool ScCompiler::HandleRange()
SetError( FormulaError::NoName );
else if (mbJumpCommandReorder)
{
ScTokenArray* pNew;
// put named formula into parentheses.
// But only if there aren't any yet, parenthetical
// ocSep doesn't work, e.g. SUM((...;...))
@@ -4716,7 +4716,15 @@ bool ScCompiler::HandleRange()
}
}
else
SetError(FormulaError::NoName);
{
// No ScRangeData for an already compiled token can happen in BIFF .xls
// import if the original range is not present in the document.
pNew = new ScTokenArray;
pNew->Add( new FormulaErrorToken( FormulaError::NoName));
PushTokenArray( pNew, true );
pNew->Reset();
return GetToken();
}
return true;
}