diff options
author | Noel Power <noel.power@novell.com> | 2010-10-13 10:51:50 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2010-10-13 10:51:50 +0100 |
commit | 606a57481911e111dfab950cd7fb90ae80aed014 (patch) | |
tree | 62e85311b32105e6d4e165d60c9d4bbdb80c03bc /formula | |
parent | a4d7dbf897e41a1afda6c2b6f0e5cc35920a1cf3 (diff) | |
parent | ed49568618442960781b63c3a47ddc65031b2fa0 (diff) |
Merge branch 'vba' fix conflics, trailing ws & tab issues
also removed some old headers ( which I need to add new ones for )
Conflicts:
basic/source/classes/sbunoobj.cxx
basic/source/classes/sbxmod.cxx
xmloff/inc/xmlnmspe.hxx
xmloff/inc/xmloff/xmltoken.hxx
xmlscript/inc/xmlscript/xmldlg_imexp.hxx
Diffstat (limited to 'formula')
-rw-r--r-- | formula/inc/formula/FormulaCompiler.hxx | 2 | ||||
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 86 |
2 files changed, 51 insertions, 37 deletions
diff --git a/formula/inc/formula/FormulaCompiler.hxx b/formula/inc/formula/FormulaCompiler.hxx index 1ccdf2d487..5b84beade4 100644 --- a/formula/inc/formula/FormulaCompiler.hxx +++ b/formula/inc/formula/FormulaCompiler.hxx @@ -220,6 +220,8 @@ public: void SetCompileForFAP( BOOL bVal ) { bCompileForFAP = bVal; bIgnoreErrors = bVal; } + static bool IsOpCodeVolatile( OpCode eOp ); + static BOOL DeQuote( String& rStr ); static const String& GetNativeSymbol( OpCode eOp ); diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 3c87ce3855..739504435f 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -741,6 +741,30 @@ OpCode FormulaCompiler::GetEnglishOpCode( const String& rName ) const return bFound ? (*iLook).second : OpCode(ocNone); } +bool FormulaCompiler::IsOpCodeVolatile( OpCode eOp ) +{ + switch (eOp) + { + // no parameters: + case ocRandom: + case ocGetActDate: + case ocGetActTime: + // one parameter: + case ocFormula: + case ocInfo: + // more than one parameters: + // ocIndirect/ocIndirectXL otherwise would have to do + // StopListening and StartListening on a reference for every + // interpreted value. + case ocIndirect: + case ocIndirectXL: + // ocOffset results in indirect references. + case ocOffset: + return true; + } + return false; +} + // Remove quotes, escaped quotes are unescaped. BOOL FormulaCompiler::DeQuote( String& rStr ) { @@ -973,44 +997,32 @@ void FormulaCompiler::Factor() { if( nNumFmt == NUMBERFORMAT_UNDEFINED ) nNumFmt = lcl_GetRetFormat( eOp ); - // Functions that have to be always recalculated - switch( eOp ) + + if ( IsOpCodeVolatile(eOp) ) + pArr->SetRecalcModeAlways(); + else { - // no parameters: - case ocRandom: - case ocGetActDate: - case ocGetActTime: - // one parameter: - case ocFormula: - case ocInfo: - // more than one parameters: - // ocIndirect/ocIndirectXL otherwise would have to do - // StopListening and StartListening on a reference for every - // interpreted value. - case ocIndirect: - case ocIndirectXL: - // ocOffset results in indirect references. - case ocOffset: - pArr->SetRecalcModeAlways(); - break; - // Functions recalculated on every document load. - // Don't use SetRecalcModeOnLoad() which would override - // ModeAlways. - case ocConvert : - pArr->AddRecalcMode( RECALCMODE_ONLOAD ); - break; - // If the referred cell is moved the value changes. - case ocColumn : - case ocRow : - // ocCell needs recalc on move for some possible type values. - case ocCell : - pArr->SetRecalcModeOnRefMove(); - break; - case ocHyperLink : - pArr->SetHyperLink(TRUE); - break; - default: - ; // nothing + switch( eOp ) + { + // Functions recalculated on every document load. + // Don't use SetRecalcModeOnLoad() which would override + // ModeAlways. + case ocConvert : + pArr->AddRecalcMode( RECALCMODE_ONLOAD ); + break; + // If the referred cell is moved the value changes. + case ocColumn : + case ocRow : + // ocCell needs recalc on move for some possible type values. + case ocCell : + pArr->SetRecalcModeOnRefMove(); + break; + case ocHyperLink : + pArr->SetHyperLink(TRUE); + break; + default: + ; // nothing + } } if (SC_OPCODE_START_NO_PAR <= eOp && eOp < SC_OPCODE_STOP_NO_PAR) { |