summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-10-12 19:47:44 +0200
committerjan iversen <jani@documentfoundation.org>2016-10-18 06:26:47 +0000
commitfd6e8b80a8f84d4d2caec1838b787443f623168f (patch)
tree1796aba53a2f21c29be14553a567f2b74ce488b7
parent98d7b2395f0527835be50cd683a40e7a848b150d (diff)
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. (cherry picked from commit d3645961d98ce9f0cfb1ef7f0aba7bf020b90945) Change-Id: I823ac89115418cf5069b2baf5c5de2c814319ae7 Reviewed-on: https://gerrit.libreoffice.org/29795 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> (cherry picked from commit f81b2592cd93dac2cb78fdb22bf661d04bdef25f) Reviewed-on: https://gerrit.libreoffice.org/29818 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: jan iversen <jani@documentfoundation.org> Tested-by: jan iversen <jani@documentfoundation.org>
-rw-r--r--sc/source/core/tool/compiler.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e161b12b7529..5d0af7ea9b8a 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4442,6 +4442,7 @@ ScRangeData* ScCompiler::GetRangeData( const FormulaToken& rToken ) const
bool ScCompiler::HandleRange()
{
+ ScTokenArray* pNew;
const ScRangeData* pRangeData = GetRangeData( *mpToken);
if (pRangeData)
{
@@ -4450,7 +4451,6 @@ bool ScCompiler::HandleRange()
SetError( errNoName );
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((...;...))
@@ -4491,7 +4491,15 @@ bool ScCompiler::HandleRange()
}
}
else
- SetError(errNoName);
+ {
+ // 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(errNoName));
+ PushTokenArray( pNew, true );
+ pNew->Reset();
+ return GetToken();
+ }
return true;
}