summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx22
-rw-r--r--include/formula/FormulaCompiler.hxx7
-rw-r--r--sc/source/core/tool/compiler.cxx6
3 files changed, 20 insertions, 15 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();
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
index 9df22ecf0ca8..8d4627e51fd8 100644
--- a/include/formula/FormulaCompiler.hxx
+++ b/include/formula/FormulaCompiler.hxx
@@ -227,8 +227,7 @@ public:
sal_uInt16 GetErrorConstant( const OUString& rName ) const;
- void SetCompileForFAP( bool bVal )
- { bCompileForFAP = bVal; bIgnoreErrors = bVal; }
+ void SetCompileForFAP( bool bVal );
static bool IsOpCodeVolatile( OpCode eOp );
static bool IsOpCodeJumpCommand( OpCode eOp );
@@ -338,12 +337,12 @@ protected:
bool bAutoCorrect; // whether to apply AutoCorrection
bool bCorrected; // AutoCorrection was applied
- bool bCompileForFAP; //! not real RPN but names, for FunctionAutoPilot
- // will not be resolved
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.
+
private:
void InitSymbolsNative() const; /// only SymbolsNative, on first document creation
void InitSymbolsEnglish() const; /// only SymbolsEnglish, maybe later
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 888f774df935..9f5c51bcfe5e 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3918,7 +3918,7 @@ bool ScCompiler::HandleRange()
sal_uInt16 nErr = pRangeData->GetErrCode();
if( nErr )
SetError( errNoName );
- else if ( !bCompileForFAP )
+ else if (mbJumpCommandReorder)
{
ScTokenArray* pNew;
// put named formula into parentheses.
@@ -4469,7 +4469,7 @@ bool ScCompiler::HandleSingleRef()
}
if ( !bFound )
SetError(errNoRef);
- else if ( !bCompileForFAP )
+ else if (mbJumpCommandReorder)
{
ScTokenArray* pNew = new ScTokenArray();
if ( bSingle )
@@ -4520,7 +4520,7 @@ bool ScCompiler::HandleDbData()
ScDBData* pDBData = pDoc->GetDBCollection()->getNamedDBs().findByIndex(mpToken->GetIndex());
if ( !pDBData )
SetError(errNoName);
- else if ( !bCompileForFAP )
+ else if (mbJumpCommandReorder)
{
ScComplexRefData aRefData;
aRefData.InitFlags();