Kaydet (Commit) 69a7e744 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Use "stop on error" concept rather than "ignore error if true".

Just to keep the pattern of "true" -> "action", "false" -> "no action".

Change-Id: I6303bc779cd7048eef2fdc3c2abba8be8f15da6d
üst 5db9391c
......@@ -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);
......
......@@ -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
......
......@@ -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 );
......
......@@ -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();
......
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