diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-14 11:02:27 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-14 13:15:10 -0400 |
commit | 5db9391c0640450f3e30dfa9d2c9b8ff9c79b958 (patch) | |
tree | d7f9d5979b30b87242cbe1a9653dae0ce69ef75d /formula/source | |
parent | 7249ba6877ef687fd787375e18678c5f1f417a49 (diff) |
Introduce a new boolean flag and use it in lieu of bCompileForFAP.
To make it sound more general than "compile for FAP".
Change-Id: Ia6916b6f3579a290be7d5074f809666be2bd2473
Diffstat (limited to 'formula/source')
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 7064e0f54f46..02c7a5eb9424 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 ), - bCompileForFAP( false ), bIgnoreErrors( false ), - glSubTotal( false ) + glSubTotal( false ), + mbJumpCommandReorder(true) { } @@ -555,9 +555,9 @@ FormulaCompiler::FormulaCompiler() meGrammar( formula::FormulaGrammar::GRAM_UNSPECIFIED ), bAutoCorrect( false ), bCorrected( false ), - bCompileForFAP( false ), bIgnoreErrors( false ), - glSubTotal( false ) + glSubTotal( false ), + mbJumpCommandReorder(true) { } @@ -980,6 +980,12 @@ sal_uInt16 FormulaCompiler::GetErrorConstant( const OUString& rName ) const return nError; } +void FormulaCompiler::SetCompileForFAP( bool bVal ) +{ + mbJumpCommandReorder = !bVal; + bIgnoreErrors = bVal; +} + void FormulaCompiler::AppendErrorConstant( OUStringBuffer& rBuffer, sal_uInt16 nError ) const { @@ -1121,7 +1127,7 @@ void FormulaCompiler::Factor() OpCode eOp = mpToken->GetOpCode(); if( eOp == ocPush || eOp == ocColRowNameAuto || eOp == ocMatRef || eOp == ocDBArea - || (bCompileForFAP && ((eOp == ocName) || (eOp == ocDBArea) + || (!mbJumpCommandReorder && ((eOp == ocName) || (eOp == ocDBArea) || (eOp == ocColRowName) || (eOp == ocBad))) ) { @@ -1258,7 +1264,7 @@ void FormulaCompiler::Factor() || eOp == ocOr || eOp == ocBad || ( eOp >= ocInternalBegin && eOp <= ocInternalEnd ) - || (bCompileForFAP && IsOpCodeJumpCommand(eOp))) + || (!mbJumpCommandReorder && IsOpCodeJumpCommand(eOp))) { pFacToken = mpToken; OpCode eMyLastOp = eOp; @@ -1300,7 +1306,7 @@ void FormulaCompiler::Factor() else eOp = NextToken(); // Jumps are just normal functions for the FunctionAutoPilot tree view - if ( bCompileForFAP && pFacToken->GetType() == svJump ) + if (!mbJumpCommandReorder && pFacToken->GetType() == svJump) pFacToken = new FormulaFAPToken( pFacToken->GetOpCode(), nSepCount, pFacToken ); else pFacToken->SetByte( nSepCount ); @@ -2061,7 +2067,7 @@ void FormulaCompiler::PutCode( FormulaTokenRef& p ) SetError( errCodeOverflow); return; } - if( pArr->GetCodeError() && !bCompileForFAP ) + if (pArr->GetCodeError() && mbJumpCommandReorder) return; ForceArrayOperator( p, pCurrentFactorToken); p->IncRef(); |