summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx24
-rw-r--r--include/formula/FormulaCompiler.hxx3
-rw-r--r--sc/inc/compiler.hxx3
-rw-r--r--sc/source/core/tool/compiler.cxx6
4 files changed, 20 insertions, 16 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 02c7a5eb9424..59839b4cc2b7 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -537,9 +537,9 @@ FormulaCompiler::FormulaCompiler( FormulaTokenArray& rArr )
meGrammar( formula::FormulaGrammar::GRAM_UNSPECIFIED ),
bAutoCorrect( false ),
bCorrected( false ),
- bIgnoreErrors( false ),
glSubTotal( false ),
- mbJumpCommandReorder(true)
+ mbJumpCommandReorder(true),
+ mbStopOnError(true)
{
}
@@ -555,9 +555,9 @@ FormulaCompiler::FormulaCompiler()
meGrammar( formula::FormulaGrammar::GRAM_UNSPECIFIED ),
bAutoCorrect( false ),
bCorrected( false ),
- bIgnoreErrors( false ),
glSubTotal( false ),
- mbJumpCommandReorder(true)
+ mbJumpCommandReorder(true),
+ mbStopOnError(true)
{
}
@@ -983,7 +983,7 @@ sal_uInt16 FormulaCompiler::GetErrorConstant( const OUString& rName ) const
void FormulaCompiler::SetCompileForFAP( bool bVal )
{
mbJumpCommandReorder = !bVal;
- bIgnoreErrors = bVal;
+ mbStopOnError = !bVal;
}
@@ -1041,7 +1041,7 @@ bool FormulaCompiler::GetToken()
aCorrectedSymbol = "";
}
bool bStop = false;
- if( pArr->GetCodeError() && !bIgnoreErrors )
+ if (pArr->GetCodeError() && mbStopOnError)
bStop = true;
else
{
@@ -1119,7 +1119,7 @@ bool FormulaCompiler::GetToken()
// RPN creation by recursion
void FormulaCompiler::Factor()
{
- if ( pArr->GetCodeError() && !bIgnoreErrors )
+ if (pArr->GetCodeError() && mbStopOnError)
return;
CurrentFactor pFacToken( this );
@@ -1157,7 +1157,7 @@ void FormulaCompiler::Factor()
{
NextToken();
eOp = Expression();
- while ((eOp == ocSep) && (!pArr->GetCodeError() || bIgnoreErrors))
+ while ((eOp == ocSep) && (!pArr->GetCodeError() || !mbStopOnError))
{ // range list (A1;A2) converted to (A1~A2)
pFacToken = mpToken;
NextToken();
@@ -1292,7 +1292,7 @@ void FormulaCompiler::Factor()
if( !bNoParam )
{
nSepCount++;
- while ( (eOp == ocSep) && (!pArr->GetCodeError() || bIgnoreErrors) )
+ while ((eOp == ocSep) && (!pArr->GetCodeError() || !mbStopOnError))
{
nSepCount++;
NextToken();
@@ -1364,7 +1364,7 @@ void FormulaCompiler::Factor()
}
short nJumpCount = 0;
while ( (nJumpCount < (FORMULA_MAXJUMPCOUNT - 1)) && (eOp == ocSep)
- && (!pArr->GetCodeError() || bIgnoreErrors) )
+ && (!pArr->GetCodeError() || !mbStopOnError))
{
if ( ++nJumpCount <= nJumpMax )
pFacToken->GetJump()[nJumpCount] = pc-1;
@@ -1641,7 +1641,7 @@ bool FormulaCompiler::CompileTokenArray()
{
glSubTotal = false;
bCorrected = false;
- if( !pArr->GetCodeError() || bIgnoreErrors )
+ if (!pArr->GetCodeError() || !mbStopOnError)
{
if ( bAutoCorrect )
{
@@ -1684,7 +1684,7 @@ bool FormulaCompiler::CompileTokenArray()
if( !pArr->GetCodeError() && nErrorBeforePop )
pArr->SetCodeError( nErrorBeforePop);
- if( pArr->GetCodeError() && !bIgnoreErrors )
+ if (pArr->GetCodeError() && mbStopOnError)
{
pArr->DelRPN();
pArr->SetHyperLink( false);
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
index 8d4627e51fd8..ec1aba3782b1 100644
--- a/include/formula/FormulaCompiler.hxx
+++ b/include/formula/FormulaCompiler.hxx
@@ -337,11 +337,10 @@ protected:
bool bAutoCorrect; // whether to apply AutoCorrection
bool bCorrected; // AutoCorrection was applied
- bool bIgnoreErrors; // on AutoCorrect and CompileForFAP
- // ignore errors and create RPN nevertheless
bool glSubTotal; // if code contains one or more subtotal functions
bool mbJumpCommandReorder; /// Whether or not to reorder RPN for jump commands.
+ bool mbStopOnError; /// Whether to stop compilation on first encountered error.
private:
void InitSymbolsNative() const; /// only SymbolsNative, on first document creation
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 8ea5c770e8ce..811028c48ad3 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -394,8 +394,7 @@ public:
//! _either_ CompileForFAP _or_ AutoCorrection, _not_ both
// #i101512# SetCompileForFAP is in formula::FormulaCompiler
- void SetAutoCorrection( bool bVal )
- { bAutoCorrect = bVal; bIgnoreErrors = bVal; }
+ void SetAutoCorrection( bool bVal );
void SetCloseBrackets( bool bVal ) { mbCloseBrackets = bVal; }
void SetRefConvention( const Convention *pConvP );
void SetRefConvention( const formula::FormulaGrammar::AddressConvention eConv );
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 9f5c51bcfe5e..be8780ed7257 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3199,6 +3199,12 @@ bool ScCompiler::IsErrorConstant( const OUString& rName ) const
return false;
}
+void ScCompiler::SetAutoCorrection( bool bVal )
+{
+ bAutoCorrect = bVal;
+ mbStopOnError = !bVal;
+}
+
void ScCompiler::AutoCorrectParsedSymbol()
{
sal_Int32 nPos = aCorrectedSymbol.getLength();