LibreOffice Module formula (master) 1
|
#include <FormulaCompiler.hxx>
Classes | |
class | CurrentFactor |
class | OpCodeMap |
Mappings from strings to OpCodes and vice versa. More... | |
Public Types | |
enum class | SeparatorType { RESOURCE_BASE , SEMICOLON_BASE } |
Separators mapped when loading opcodes from the resource, values other than RESOURCE_BASE may override the resource strings. More... | |
enum | InitSymbols { ASK = 0 , INIT , DESTROY } |
typedef std::shared_ptr< const OpCodeMap > | OpCodeMapPtr |
typedef std::shared_ptr< OpCodeMap > | NonConstOpCodeMapPtr |
Public Member Functions | |
FormulaCompiler (bool bComputeII=false, bool bMatrixFlag=false) | |
FormulaCompiler (FormulaTokenArray &_rArr, bool bComputeII=false, bool bMatrixFlag=false) | |
virtual | ~FormulaCompiler () |
OpCodeMapPtr | GetOpCodeMap (const sal_Int32 nLanguage) const |
Get OpCodeMap for formula language. More... | |
void | DestroyOpCodeMap (const sal_Int32 nLanguage) |
Destroy the singleton OpCodeMap for formula language. More... | |
bool | HasOpCodeMap (const sal_Int32 nLanguage) const |
Whether the singleton OpCodeMap for formula language exists already. More... | |
const OpCodeMapPtr & | GetCurrentOpCodeMap () const |
Get current OpCodeMap in effect. More... | |
OpCode | GetEnglishOpCode (const OUString &rName) const |
Get OpCode for English symbol. More... | |
FormulaError | GetErrorConstant (const OUString &rName) const |
void | AppendErrorConstant (OUStringBuffer &rBuffer, FormulaError nError) const |
void | EnableJumpCommandReorder (bool bEnable) |
void | EnableStopOnError (bool bEnable) |
SvNumFormatType | GetNumFormatType () const |
bool | CompileTokenArray () |
void | CreateStringFromTokenArray (OUString &rFormula) |
void | CreateStringFromTokenArray (OUStringBuffer &rBuffer) |
const FormulaToken * | CreateStringFromToken (OUString &rFormula, const FormulaToken *pToken) |
const FormulaToken * | CreateStringFromToken (OUStringBuffer &rBuffer, const FormulaToken *pToken, bool bAllowArrAdvance=false) |
void | AppendBoolean (OUStringBuffer &rBuffer, bool bVal) const |
void | AppendDouble (OUStringBuffer &rBuffer, double fVal) const |
FormulaGrammar::Grammar | GetGrammar () const |
Set symbol map corresponding to one of predefined formula::FormulaGrammar::Grammar, including an address reference convention. More... | |
bool | NeedsTableRefTransformation () const |
Whether current symbol set and grammar need transformation of Table structured references to A1 style references when writing / exporting (creating strings). More... | |
virtual formula::ParamClass | GetForceArrayParameter (const FormulaToken *pToken, sal_uInt16 nParam) const |
If a parameter nParam (0-based) is to be forced to array for OpCode eOp, i.e. More... | |
void | SetComputeIIFlag (bool bSet) |
Sets the implicit intersection compute flag. More... | |
void | SetMatrixFlag (bool bSet) |
Sets the matrix flag for the formula. More... | |
Static Public Member Functions | |
static OpCodeMapPtr | CreateOpCodeMap (const css::uno::Sequence< const css::sheet::FormulaOpCodeMapEntry > &rMapping, bool bEnglish) |
Create an internal symbol map from API mapping. More... | |
static bool | IsOpCodeVolatile (OpCode eOp) |
static bool | IsOpCodeJumpCommand (OpCode eOp) |
static bool | DeQuote (OUString &rStr) |
static const OUString & | GetNativeSymbol (OpCode eOp) |
static sal_Unicode | GetNativeSymbolChar (OpCode eOp) |
static bool | IsMatrixFunction (OpCode _eOpCode) |
static void | AppendString (OUStringBuffer &rBuffer, const OUString &rStr) |
static void | UpdateSeparatorsNative (const OUString &rSep, const OUString &rArrayColSep, const OUString &rArrayRowSep) |
static void | ResetNativeSymbols () |
static void | SetNativeSymbols (const OpCodeMapPtr &xMap) |
Protected Member Functions | |
OpCodeMapPtr | GetFinalOpCodeMap (const sal_Int32 nLanguage) const |
Get finalized OpCodeMap for formula language. More... | |
virtual OUString | FindAddInFunction (const OUString &rUpperName, bool bLocalFirst) const |
virtual void | fillFromAddInCollectionUpperName (const NonConstOpCodeMapPtr &xMap) const |
virtual void | fillFromAddInMap (const NonConstOpCodeMapPtr &xMap, FormulaGrammar::Grammar _eGrammar) const |
virtual void | fillFromAddInCollectionEnglishName (const NonConstOpCodeMapPtr &xMap) const |
virtual void | fillAddInToken (::std::vector< css::sheet::FormulaOpCodeMapEntry > &_rVec, bool _bIsEnglish) const |
virtual void | SetError (FormulaError nError) |
virtual FormulaTokenRef | ExtendRangeReference (FormulaToken &rTok1, FormulaToken &rTok2) |
virtual bool | HandleExternalReference (const FormulaToken &_aToken) |
virtual bool | HandleRange () |
virtual bool | HandleColRowName () |
virtual bool | HandleDbData () |
virtual bool | HandleTableRef () |
virtual void | CreateStringFromExternal (OUStringBuffer &rBuffer, const FormulaToken *pToken) const |
virtual void | CreateStringFromSingleRef (OUStringBuffer &rBuffer, const FormulaToken *pToken) const |
virtual void | CreateStringFromDoubleRef (OUStringBuffer &rBuffer, const FormulaToken *pToken) const |
virtual void | CreateStringFromMatrix (OUStringBuffer &rBuffer, const FormulaToken *pToken) const |
virtual void | CreateStringFromIndex (OUStringBuffer &rBuffer, const FormulaToken *pToken) const |
virtual void | LocalizeString (OUString &rName) const |
bool | GetToken () |
OpCode | NextToken () |
void | PutCode (FormulaTokenRef &) |
void | Factor () |
void | RangeLine () |
void | UnionLine () |
void | IntersectionLine () |
void | UnaryLine () |
void | PostOpLine () |
void | PowLine () |
void | MulDivLine () |
void | AddSubLine () |
void | ConcatLine () |
void | CompareLine () |
OpCode | Expression () |
void | PopTokenArray () |
void | PushTokenArray (FormulaTokenArray *, bool) |
bool | MergeRangeReference (FormulaToken **const pCode1, FormulaToken *const *const pCode2) |
virtual void | HandleIIOpCode (FormulaToken *, FormulaToken ***, sal_uInt8) |
virtual void | PostProcessCode () |
virtual void | AnnotateOperands () |
Protected Attributes | |
OUString | aCorrectedFormula |
OUString | aCorrectedSymbol |
OpCodeMapPtr | mxSymbols |
FormulaTokenRef | mpToken |
FormulaTokenRef | pCurrentFactorToken |
sal_uInt16 | nCurrentFactorParam |
FormulaTokenArray * | pArr |
FormulaTokenArrayPlainIterator | maArrIterator |
FormulaTokenRef | mpLastToken |
FormulaToken ** | pCode |
FormulaArrayStack * | pStack |
OpCode | eLastOp |
short | nRecursion |
SvNumFormatType | nNumFmt |
sal_uInt16 | pc |
FormulaGrammar::Grammar | meGrammar |
bool | bAutoCorrect |
bool | bCorrected |
bool | glSubTotal |
bool | needsRPNTokenCheck |
bool | mbJumpCommandReorder |
bool | mbStopOnError |
Whether or not to reorder RPN for jump commands. More... | |
bool | mbComputeII |
Whether to stop compilation on first encountered error. More... | |
bool | mbMatrixFlag |
Private Member Functions | |
FormulaCompiler (const FormulaCompiler &)=delete | |
FormulaCompiler & | operator= (const FormulaCompiler &)=delete |
bool | InitSymbolsNative (InitSymbols) const |
bool | InitSymbolsEnglish (InitSymbols) const |
only SymbolsNative, on first document creation More... | |
bool | InitSymbolsPODF (InitSymbols) const |
only SymbolsEnglish, maybe later More... | |
bool | InitSymbolsAPI (InitSymbols) const |
only SymbolsPODF, on demand More... | |
bool | InitSymbolsODFF (InitSymbols) const |
only SymbolsAPI, on demand More... | |
bool | InitSymbolsEnglishXL (InitSymbols) const |
only SymbolsODFF, on demand More... | |
bool | InitSymbolsOOXML (InitSymbols) const |
only SymbolsEnglishXL, on demand More... | |
void | loadSymbols (const std::pair< const char *, int > *pSymbols, FormulaGrammar::Grammar eGrammar, NonConstOpCodeMapPtr &rxMap, SeparatorType eSepType=SeparatorType::SEMICOLON_BASE) const |
only SymbolsOOXML, on demand More... | |
void | CheckSetForceArrayParameter (FormulaTokenRef const &rCurr, sal_uInt8 nParam) |
Check pCurrentFactorToken for nParam's (0-based) ForceArray types and set ForceArray at rCurr if so. More... | |
void | ForceArrayOperator (FormulaTokenRef const &rCurr) |
Static Private Attributes | |
static FormulaTokenArray | smDummyTokenArray |
Definition at line 71 of file FormulaCompiler.hxx.
typedef std::shared_ptr< OpCodeMap > formula::FormulaCompiler::NonConstOpCodeMapPtr |
Definition at line 203 of file FormulaCompiler.hxx.
typedef std::shared_ptr< const OpCodeMap > formula::FormulaCompiler::OpCodeMapPtr |
Definition at line 202 of file FormulaCompiler.hxx.
Enumerator | |
---|---|
ASK | |
INIT | |
DESTROY |
Definition at line 423 of file FormulaCompiler.hxx.
|
strong |
Separators mapped when loading opcodes from the resource, values other than RESOURCE_BASE may override the resource strings.
Used by OpCodeList implementation via loadSymbols().
Enumerator | |
---|---|
RESOURCE_BASE | |
SEMICOLON_BASE |
Definition at line 331 of file FormulaCompiler.hxx.
|
privatedelete |
formula::FormulaCompiler::FormulaCompiler | ( | bool | bComputeII = false , |
bool | bMatrixFlag = false |
||
) |
Definition at line 790 of file FormulaCompiler.cxx.
formula::FormulaCompiler::FormulaCompiler | ( | FormulaTokenArray & | _rArr, |
bool | bComputeII = false , |
||
bool | bMatrixFlag = false |
||
) |
Definition at line 765 of file FormulaCompiler.cxx.
|
virtual |
Definition at line 813 of file FormulaCompiler.cxx.
|
protected |
Definition at line 2187 of file FormulaCompiler.cxx.
References HandleIIOpCode(), mbComputeII, mpToken, MulDivLine(), NextToken(), ocAdd, ocSub, p, pCode, and PutCode().
Referenced by ConcatLine().
|
inlineprotectedvirtual |
Definition at line 387 of file FormulaCompiler.hxx.
Referenced by Factor().
void formula::FormulaCompiler::AppendBoolean | ( | OUStringBuffer & | rBuffer, |
bool | bVal | ||
) | const |
Definition at line 2687 of file FormulaCompiler.cxx.
void formula::FormulaCompiler::AppendDouble | ( | OUStringBuffer & | rBuffer, |
double | fVal | ||
) | const |
Definition at line 2668 of file FormulaCompiler.cxx.
References SvtSysLocale::GetLocaleData(), LocaleDataWrapper::getNumDecimalSep(), and mxSymbols.
Referenced by CreateStringFromToken().
void formula::FormulaCompiler::AppendErrorConstant | ( | OUStringBuffer & | rBuffer, |
FormulaError | nError | ||
) | const |
Definition at line 1390 of file FormulaCompiler.cxx.
References DivisionByZero, IllegalFPOperation, mxSymbols, NoCode, NoName, NoRef, NotAvailable, NoValue, ocErrDivZero, ocErrNA, ocErrName, ocErrNull, ocErrNum, ocErrRef, and ocErrValue.
Referenced by CreateStringFromToken().
|
static |
Definition at line 2692 of file FormulaCompiler.cxx.
References aStr.
Referenced by CreateStringFromToken().
|
private |
Check pCurrentFactorToken for nParam's (0-based) ForceArray types and set ForceArray at rCurr if so.
Set nParam+1 as 1-based nCurrentFactorParam for subsequent ForceArrayOperator() calls.
Definition at line 3089 of file FormulaCompiler.cxx.
References ForceArrayOperator(), nCurrentFactorParam, and pCurrentFactorToken.
Referenced by Factor().
|
protected |
Definition at line 2227 of file FormulaCompiler.cxx.
References ConcatLine(), HandleIIOpCode(), mbComputeII, mpToken, NextToken(), ocEqual, ocGreaterEqual, p, pCode, and PutCode().
Referenced by Expression().
bool formula::FormulaCompiler::CompileTokenArray | ( | ) |
Definition at line 2305 of file FormulaCompiler.cxx.
References aCorrectedFormula, aCorrectedSymbol, bAutoCorrect, bCorrected, formula::FormulaTokenArray::CheckAllRPNTokens(), formula::FormulaTokenArray::ClearRecalcMode(), formula::FormulaTokenArray::CreateNewRPNArrayFromData(), formula::FormulaTokenArray::DelRPN(), eLastOp, Expression(), FORMULA_MAXTOKENS, formula::FormulaTokenArray::GetCodeError(), glSubTotal, formula::FormulaTokenArray::IsRecalcModeForced(), maArrIterator, mbStopOnError, needsRPNTokenCheck, NextToken(), nNumFmt, NONE, ocOpen, ocStop, OperatorExpected, pArr, pc, pCode, pData, PopTokenArray(), PostProcessCode(), pStack, formula::FormulaTokenArrayPlainIterator::Reset(), formula::FormulaTokenArray::SetCodeError(), SetError(), formula::FormulaTokenArray::SetHyperLink(), and formula::FormulaTokenArray::SetRecalcModeForced().
|
protected |
Definition at line 2207 of file FormulaCompiler.cxx.
References AddSubLine(), HandleIIOpCode(), mbComputeII, mpToken, NextToken(), ocAmpersand, p, pCode, and PutCode().
Referenced by CompareLine().
|
static |
Create an internal symbol map from API mapping.
bEnglish | Use English number parser / formatter instead of native. |
Definition at line 934 of file FormulaCompiler.cxx.
References formula::FormulaGrammar::CONV_UNSPECIFIED, formula::FormulaGrammar::GRAM_EXTERNAL, formula::FormulaGrammar::mergeToGrammar(), ocExternal, SAL_WARN, SC_OPCODE_LAST_OPCODE_ID, and formula::FormulaGrammar::setEnglishBit().
|
protectedvirtual |
Definition at line 2908 of file FormulaCompiler.cxx.
Referenced by CreateStringFromToken().
|
protectedvirtual |
Definition at line 2920 of file FormulaCompiler.cxx.
Referenced by CreateStringFromToken().
|
protectedvirtual |
Definition at line 2912 of file FormulaCompiler.cxx.
Referenced by CreateStringFromToken().
|
protectedvirtual |
Definition at line 2916 of file FormulaCompiler.cxx.
Referenced by CreateStringFromToken().
|
protectedvirtual |
Definition at line 2904 of file FormulaCompiler.cxx.
Referenced by CreateStringFromToken().
const FormulaToken * formula::FormulaCompiler::CreateStringFromToken | ( | OUString & | rFormula, |
const FormulaToken * | pToken | ||
) |
Definition at line 2451 of file FormulaCompiler.cxx.
References aBuffer, CreateStringFromToken(), and p.
Referenced by CreateStringFromToken(), CreateStringFromTokenArray(), and GetToken().
const FormulaToken * formula::FormulaCompiler::CreateStringFromToken | ( | OUStringBuffer & | rBuffer, |
const FormulaToken * | pToken, | ||
bool | bAllowArrAdvance = false |
||
) |
Definition at line 2459 of file FormulaCompiler.cxx.
References AppendDouble(), AppendErrorConstant(), AppendString(), CreateStringFromDoubleRef(), CreateStringFromExternal(), CreateStringFromIndex(), CreateStringFromMatrix(), CreateStringFromSingleRef(), GetNativeSymbol(), formula::FormulaGrammar::isExcelSyntax(), LocalizeString(), maArrIterator, meGrammar, mxSymbols, n, NeedsTableRefTransformation(), formula::FormulaTokenArrayPlainIterator::Next(), ocAnd, ocBad, ocColRowName, ocErrName, ocInternalBegin, ocInternalEnd, ocIntersect, ocOpen, ocOr, ocPush, ocRange, ocSep, ocSpaces, ocStringXML, ocTableRef, ocTableRefClose, ocTableRefItemAll, ocTableRefItemData, ocTableRefItemHeaders, ocTableRefItemThisRow, ocTableRefItemTotals, ocTableRefOpen, ocWhitespace, p, formula::FormulaTokenArrayPlainIterator::PeekNext(), formula::FormulaTokenArrayPlainIterator::PeekNextNoSpaces(), formula::FormulaTokenArrayPlainIterator::PeekPrevNoSpaces(), formula::pInternal, SAL_WARN, formula::svByte, formula::svDouble, formula::svDoubleRef, formula::svError, formula::svExternal, formula::svFAP, formula::svIndex, formula::svJump, formula::svMatrix, formula::svMatrixCell, formula::svMissing, formula::svSep, formula::svSingleRef, formula::svString, and t.
void formula::FormulaCompiler::CreateStringFromTokenArray | ( | OUString & | rFormula | ) |
Definition at line 2395 of file FormulaCompiler.cxx.
References aBuffer, CreateStringFromTokenArray(), formula::FormulaTokenArray::GetLen(), and pArr.
Referenced by CreateStringFromTokenArray().
void formula::FormulaCompiler::CreateStringFromTokenArray | ( | OUStringBuffer & | rBuffer | ) |
Definition at line 2402 of file FormulaCompiler.cxx.
References CreateStringFromToken(), formula::FormulaTokenArrayPlainIterator::First(), formula::FormulaTokenArrayPlainIterator::GetIndex(), formula::FormulaTokenArray::GetLen(), formula::FormulaGrammar::isODFF(), formula::FormulaGrammar::isOOXML(), formula::FormulaGrammar::isPODF(), formula::FormulaTokenArray::IsRecalcModeForced(), formula::FormulaTokenArrayPlainIterator::Jump(), maArrIterator, meGrammar, formula::FormulaTokenArray::NeedsOoxmlRewrite(), formula::FormulaTokenArray::NeedsPodfRewrite(), pArr, formula::FormulaTokenArray::RewriteMissing(), and t.
|
static |
Definition at line 1199 of file FormulaCompiler.cxx.
void formula::FormulaCompiler::DestroyOpCodeMap | ( | const sal_Int32 | nLanguage | ) |
Destroy the singleton OpCodeMap for formula language.
This unconditionally destroys the underlying singleton instance of the map to be reinitialized again later on the next GetOpCodeMap() call. Use if the base class FormulaCompiler::GetOpCodeMap() was called and created the map (i.e. HasOpCodeMap() before returned false) and later a derived class like ScCompiler shall initialize it including AddIns.
nLanguage | One of css::sheet::FormulaLanguage constants. |
Definition at line 873 of file FormulaCompiler.cxx.
References InitSymbolsAPI(), InitSymbolsEnglish(), InitSymbolsEnglishXL(), InitSymbolsNative(), InitSymbolsODFF(), InitSymbolsOOXML(), and InitSymbolsPODF().
Referenced by GetOpCodeMap().
void formula::FormulaCompiler::EnableJumpCommandReorder | ( | bool | bEnable | ) |
Definition at line 1380 of file FormulaCompiler.cxx.
References mbJumpCommandReorder.
void formula::FormulaCompiler::EnableStopOnError | ( | bool | bEnable | ) |
Definition at line 1385 of file FormulaCompiler.cxx.
References mbStopOnError.
|
protected |
generate token instead?
Definition at line 2247 of file FormulaCompiler.cxx.
References CompareLine(), HandleIIOpCode(), mbComputeII, mpToken, NextToken(), nRecursion, formula::nRecursionMax, ocAnd, ocOr, ocStop, p, pCode, PutCode(), SetError(), and StackOverflow.
Referenced by CompileTokenArray(), and Factor().
|
protectedvirtual |
Definition at line 2280 of file FormulaCompiler.cxx.
Referenced by MergeRangeReference().
|
protected |
Definition at line 1557 of file FormulaCompiler.cxx.
References aCorrectedFormula, aCorrectedSymbol, formula::FormulaTokenArray::AddRecalcMode(), formula::FormulaTokenArrayPlainIterator::AfterRemoveToken(), AnnotateOperands(), bAutoCorrect, bCorrected, CheckSetForceArrayParameter(), CodeOverflow, Expression(), FORMULA_MAXJUMPCOUNT, FORMULA_MAXPARAMS, FORMULA_MAXPARAMSII, FORMULA_MAXTOKENS, formula::FormulaTokenArray::GetCodeError(), formula::FormulaToken::GetDouble(), formula::FormulaTokenArrayPlainIterator::GetIndex(), formula::FormulaToken::GetJump(), formula::FormulaToken::GetOpCode(), formula::FormulaToken::GetType(), HandleIIOpCode(), IllegalParameter, formula::FormulaGrammar::isODFF(), IsOpCodeJumpCommand(), IsOpCodeVolatile(), maArrIterator, mbComputeII, mbJumpCommandReorder, mbStopOnError, meGrammar, mpToken, mxSymbols, formula::FormulaToken::NewOpCode(), NextToken(), nNumFmt, NoName, NONE, ocAnd, ocBad, ocCell, ocChoose, ocClose, ocColRowName, ocColRowNameAuto, ocColumn, ocConvertOOo, ocDBArea, ocDde, ocExternal, ocHyperLink, ocIf, ocIfError, ocIfNA, ocInternalBegin, ocInternalEnd, ocIsoWeeknum, ocMacro, ocMatRef, ocMissing, ocMul, ocName, ocNot, ocOpen, ocOr, ocPush, ocRow, ocSep, ocStop, ocTableRef, ocUnion, ocWebservice, ocWeeknumOOo, ONLOAD_LENIENT, ONLOAD_MUST, OperatorExpected, p, PairExpected, ParameterExpected, pArr, pc, pCode, pStack, PutCode(), formula::FormulaTokenArray::RemoveToken(), SAL_WARN, SC_OPCODE_START_1_PAR, SC_OPCODE_START_2_PAR, SC_OPCODE_START_NO_PAR, SC_OPCODE_STOP_1_PAR, SC_OPCODE_STOP_2_PAR, SC_OPCODE_STOP_NO_PAR, formula::FormulaToken::SetByte(), SetError(), formula::FormulaTokenArray::SetExclusiveRecalcModeAlways(), formula::FormulaTokenArray::SetHyperLink(), formula::FormulaTokenArray::SetRecalcModeOnRefMove(), formula::svDouble, formula::svJump, formula::svSingleRef, formula::svString, formula::FormulaTokenArray::TokenAt(), and UnknownToken.
Referenced by RangeLine().
|
protectedvirtual |
Definition at line 1211 of file FormulaCompiler.cxx.
Referenced by formula::FormulaCompiler::OpCodeMap::createSequenceOfAvailableMappings().
|
protectedvirtual |
Definition at line 1136 of file FormulaCompiler.cxx.
Referenced by loadSymbols().
|
protectedvirtual |
Definition at line 1132 of file FormulaCompiler.cxx.
Referenced by loadSymbols().
|
protectedvirtual |
Definition at line 1140 of file FormulaCompiler.cxx.
Referenced by loadSymbols().
|
protectedvirtual |
Definition at line 929 of file FormulaCompiler.cxx.
Referenced by formula::FormulaCompiler::OpCodeMap::createSequenceOfFormulaTokens().
|
private |
Definition at line 2933 of file FormulaCompiler.cxx.
References eType, formula::ForceArray, formula::ForceArrayReturn, GetForceArrayParameter(), formula::FormulaToken::GetInForceArray(), formula::FormulaToken::GetOpCode(), formula::FormulaToken::GetType(), IsMatrixFunction(), mbMatrixFlag, nCurrentFactorParam, ocPush, pc, pCode, pCurrentFactorToken, formula::Reference, formula::ReferenceOrForceArray, formula::ReferenceOrRefArray, SAL_MAX_UINT16, SC_OPCODE_START_BIN_OP, SC_OPCODE_START_UN_OP, SC_OPCODE_STOP_BIN_OP, SC_OPCODE_STOP_UN_OP, formula::SuppressedReferenceOrForceArray, formula::svByte, formula::svDoubleRef, formula::svJump, formula::svMatrix, formula::Unknown, and formula::Value.
Referenced by CheckSetForceArrayParameter(), formula::FormulaCompiler::CurrentFactor::operator=(), and PutCode().
|
inline |
Get current OpCodeMap in effect.
Definition at line 264 of file FormulaCompiler.hxx.
OpCode formula::FormulaCompiler::GetEnglishOpCode | ( | const OUString & | rName | ) | const |
Get OpCode for English symbol.
Used in XFunctionAccess to create token array.
rName | Symbol to lookup. MUST be upper case. |
Definition at line 1144 of file FormulaCompiler.cxx.
References GetOpCodeMap(), and ocNone.
FormulaError formula::FormulaCompiler::GetErrorConstant | ( | const OUString & | rName | ) | const |
Definition at line 1330 of file FormulaCompiler.cxx.
References DivisionByZero, IllegalFPOperation, isPublishedFormulaError(), mxSymbols, NoCode, NoName, NONE, NoRef, NotAvailable, NoValue, ocErrDivZero, ocErrNA, ocErrName, ocErrNull, ocErrNum, ocErrRef, ocErrValue, SAL_MAX_UINT16, and o3tl::toUInt32().
|
protected |
Get finalized OpCodeMap for formula language.
Creates/returns a singleton instance of an OpCodeMap that contains external AddIn mappings if the derived class supports them. Do not call at this base class as it results in a permanent mapping without AddIns even for derived classes (unless it is for the implementation of the temporary GetOpCodeMap()).
nLanguage | One of css::sheet::FormulaLanguage constants. |
Definition at line 826 of file FormulaCompiler.cxx.
References InitSymbolsAPI(), InitSymbolsEnglish(), InitSymbolsEnglishXL(), InitSymbolsNative(), InitSymbolsODFF(), InitSymbolsOOXML(), InitSymbolsPODF(), mxSymbolsAPI, mxSymbolsEnglish, mxSymbolsEnglishXL, mxSymbolsNative, mxSymbolsODFF, mxSymbolsOOXML, and mxSymbolsPODF.
Referenced by GetOpCodeMap().
|
virtual |
If a parameter nParam (0-based) is to be forced to array for OpCode eOp, i.e.
classified as ParamClass::ForceArray or ParamClass::ReferenceOrForceArray type.
Definition at line 2928 of file FormulaCompiler.cxx.
References formula::Unknown.
Referenced by ForceArrayOperator().
|
inline |
Set symbol map corresponding to one of predefined formula::FormulaGrammar::Grammar, including an address reference convention.
Definition at line 304 of file FormulaCompiler.hxx.
|
static |
Definition at line 994 of file FormulaCompiler.cxx.
References formula::lcl_fillNativeSymbols().
Referenced by CreateStringFromToken(), and GetNativeSymbolChar().
|
static |
Definition at line 1001 of file FormulaCompiler.cxx.
References GetNativeSymbol().
|
inline |
Definition at line 289 of file FormulaCompiler.hxx.
FormulaCompiler::OpCodeMapPtr formula::FormulaCompiler::GetOpCodeMap | ( | const sal_Int32 | nLanguage | ) | const |
Get OpCodeMap for formula language.
Returns either the finalized OpCodeMap (created by GetFinalOpCodeMap() of a derived class) for nLanguage if there is such, or if not then a temporary map of which its singleton is reset immediately and the temporary will get destroyed by the caller's scope. A temporary map created at this base class does not contain AddIn mappings.
nLanguage | One of css::sheet::FormulaLanguage constants. |
Definition at line 817 of file FormulaCompiler.cxx.
References DestroyOpCodeMap(), GetFinalOpCodeMap(), and HasOpCodeMap().
Referenced by GetEnglishOpCode().
|
protected |
Definition at line 1431 of file FormulaCompiler.cxx.
References aCorrectedFormula, aCorrectedSymbol, bAutoCorrect, CreateStringFromToken(), formula::FormulaTokenArray::GetCodeError(), formula::FormulaTokenArrayPlainIterator::GetIndex(), GetToken(), glSubTotal, HandleColRowName(), HandleDbData(), HandleExternalReference(), HandleIIOpCode(), HandleRange(), HandleTableRef(), formula::FormulaGrammar::isExcelSyntax(), maArrIterator, mbComputeII, mbStopOnError, meGrammar, mpLastToken, mpToken, needsRPNTokenCheck, formula::FormulaTokenArrayPlainIterator::Next(), NONE, nRecursion, formula::nRecursionMax, ocAggregate, ocColRowName, ocDBArea, ocIntersect, ocName, ocPush, ocSpaces, ocStop, ocSubTotal, ocTableRef, ocWhitespace, formula::FormulaTokenArray::OpCodeBefore(), pArr, PopTokenArray(), pStack, SetError(), StackOverflow, and formula::FormulaTokenArrayPlainIterator::StepBack().
Referenced by GetToken(), NextToken(), and UnaryLine().
|
protectedvirtual |
Definition at line 2889 of file FormulaCompiler.cxx.
Referenced by GetToken().
|
protectedvirtual |
Definition at line 2894 of file FormulaCompiler.cxx.
Referenced by GetToken().
|
protectedvirtual |
Definition at line 2879 of file FormulaCompiler.cxx.
Referenced by GetToken().
|
inlineprotectedvirtual |
Definition at line 381 of file FormulaCompiler.hxx.
Referenced by AddSubLine(), CompareLine(), ConcatLine(), Expression(), Factor(), GetToken(), MulDivLine(), PostOpLine(), PowLine(), and UnaryLine().
|
protectedvirtual |
Definition at line 2884 of file FormulaCompiler.cxx.
Referenced by GetToken().
|
protectedvirtual |
Definition at line 2899 of file FormulaCompiler.cxx.
Referenced by GetToken().
bool formula::FormulaCompiler::HasOpCodeMap | ( | const sal_Int32 | nLanguage | ) | const |
Whether the singleton OpCodeMap for formula language exists already.
nLanguage | One of css::sheet::FormulaLanguage constants. |
Definition at line 904 of file FormulaCompiler.cxx.
References InitSymbolsAPI(), InitSymbolsEnglish(), InitSymbolsEnglishXL(), InitSymbolsNative(), InitSymbolsODFF(), InitSymbolsOOXML(), and InitSymbolsPODF().
Referenced by GetOpCodeMap().
|
private |
only SymbolsPODF, on demand
Definition at line 1039 of file FormulaCompiler.cxx.
References aMap, formula::FormulaGrammar::GRAM_API, loadSymbols(), mxSymbolsAPI, and RESOURCE_BASE.
Referenced by DestroyOpCodeMap(), GetFinalOpCodeMap(), and HasOpCodeMap().
|
private |
only SymbolsNative, on first document creation
Definition at line 1011 of file FormulaCompiler.cxx.
References aMap, formula::FormulaGrammar::GRAM_ENGLISH, loadSymbols(), and mxSymbolsEnglish.
Referenced by DestroyOpCodeMap(), GetFinalOpCodeMap(), and HasOpCodeMap().
|
private |
only SymbolsODFF, on demand
Definition at line 1067 of file FormulaCompiler.cxx.
References aMap, formula::FormulaGrammar::GRAM_ENGLISH, loadSymbols(), mxSymbolsEnglishXL, ocArrayColSep, ocArrayRowSep, and ocSep.
Referenced by DestroyOpCodeMap(), GetFinalOpCodeMap(), and HasOpCodeMap().
|
private |
Definition at line 1006 of file FormulaCompiler.cxx.
References formula::lcl_fillNativeSymbols(), and mxSymbolsNative.
Referenced by DestroyOpCodeMap(), GetFinalOpCodeMap(), and HasOpCodeMap().
|
private |
only SymbolsAPI, on demand
Definition at line 1053 of file FormulaCompiler.cxx.
References aMap, formula::FormulaGrammar::GRAM_ODFF, loadSymbols(), mxSymbolsODFF, and RESOURCE_BASE.
Referenced by DestroyOpCodeMap(), GetFinalOpCodeMap(), and HasOpCodeMap().
|
private |
only SymbolsEnglishXL, on demand
Definition at line 1091 of file FormulaCompiler.cxx.
References aMap, formula::FormulaGrammar::GRAM_OOXML, loadSymbols(), mxSymbolsOOXML, and RESOURCE_BASE.
Referenced by DestroyOpCodeMap(), GetFinalOpCodeMap(), and HasOpCodeMap().
|
private |
only SymbolsEnglish, maybe later
Definition at line 1025 of file FormulaCompiler.cxx.
References aMap, formula::FormulaGrammar::GRAM_PODF, loadSymbols(), mxSymbolsPODF, and RESOURCE_BASE.
Referenced by DestroyOpCodeMap(), GetFinalOpCodeMap(), and HasOpCodeMap().
|
protected |
Definition at line 2065 of file FormulaCompiler.cxx.
References formula::FormulaTokenArrayPlainIterator::GetIndex(), maArrIterator, mpToken, NextToken(), ocIntersect, ocSpaces, p, pArr, pc, pCode, PutCode(), RangeLine(), and formula::FormulaTokenArray::ReplaceToken().
Referenced by UnionLine().
|
static |
Definition at line 1217 of file FormulaCompiler.cxx.
References ocDde, ocFourier, ocFrequency, ocGrowth, ocLinest, ocLogest, ocMatInv, ocMatMult, ocMatrixUnit, ocMatTrans, ocModalValue_Multi, and ocTrend.
Referenced by ForceArrayOperator(), and formula::FormulaDlg_Impl::GetFunctionPos().
|
static |
Definition at line 1183 of file FormulaCompiler.cxx.
References ocChoose, ocIf, ocIfError, and ocIfNA.
Referenced by Factor(), formula::FormulaToken::GetParamCount(), formula::FormulaTokenArray::HasMatrixDoubleRefOps(), and formula::FormulaToken::IsFunction().
|
static |
Definition at line 1153 of file FormulaCompiler.cxx.
References ocDebugVar, ocFormula, ocGetActDate, ocGetActTime, ocIndirect, ocInfo, ocOffset, and ocRandom.
Referenced by Factor().
|
private |
only SymbolsOOXML, on demand
Definition at line 1106 of file FormulaCompiler.cxx.
References fillFromAddInCollectionEnglishName(), fillFromAddInCollectionUpperName(), fillFromAddInMap(), formula::FormulaGrammar::GRAM_API, formula::FormulaGrammar::GRAM_ENGLISH, formula::FormulaGrammar::GRAM_ODFF, and SC_OPCODE_LAST_OPCODE_ID.
Referenced by InitSymbolsAPI(), InitSymbolsEnglish(), InitSymbolsEnglishXL(), InitSymbolsODFF(), InitSymbolsOOXML(), and InitSymbolsPODF().
|
protectedvirtual |
Definition at line 2924 of file FormulaCompiler.cxx.
Referenced by CreateStringFromToken().
|
protected |
Definition at line 2285 of file FormulaCompiler.cxx.
References formula::FormulaToken::DecRef(), ExtendRangeReference(), p, pc, and pCode.
Referenced by RangeLine().
|
protected |
Definition at line 2167 of file FormulaCompiler.cxx.
References HandleIIOpCode(), mbComputeII, mpToken, NextToken(), ocDiv, ocMul, p, pCode, PowLine(), and PutCode().
Referenced by AddSubLine().
bool formula::FormulaCompiler::NeedsTableRefTransformation | ( | ) | const |
Whether current symbol set and grammar need transformation of Table structured references to A1 style references when writing / exporting (creating strings).
Definition at line 2705 of file FormulaCompiler.cxx.
References formula::FormulaGrammar::isPODF(), meGrammar, mxSymbols, and ocTableRefOpen.
Referenced by CreateStringFromToken().
|
protected |
Definition at line 2739 of file FormulaCompiler.cxx.
References aCorrectedFormula, aCorrectedSymbol, bAutoCorrect, bCorrected, eLastOp, GetToken(), formula::FormulaGrammar::isExcelSyntax(), maArrIterator, meGrammar, mpToken, mxSymbols, NextToken(), nPos, nRecursion, ocAdd, ocAnd, ocColRowNameAuto, ocDiv, ocEqual, ocGreater, ocIntersect, ocLess, ocMul, ocOpen, ocOr, ocPush, ocSep, ocSpaces, ocStop, ocSub, OperatorExpected, formula::FormulaTokenArrayPlainIterator::PeekNextNoSpaces(), formula::FormulaTokenArrayPlainIterator::PeekPrevNoSpaces(), pStack, SC_OPCODE_START_BIN_OP, SC_OPCODE_STOP_BIN_OP, SC_OPCODE_STOP_UN_OP, SetError(), and VariableExpected.
Referenced by AddSubLine(), CompareLine(), CompileTokenArray(), ConcatLine(), Expression(), Factor(), IntersectionLine(), MulDivLine(), NextToken(), PostOpLine(), PowLine(), RangeLine(), UnaryLine(), and UnionLine().
|
privatedelete |
|
protected |
Definition at line 2371 of file FormulaCompiler.cxx.
References formula::FormulaTokenArray::GetRecalcMode(), formula::FormulaTokenArray::IsHyperLink(), formula::FormulaTokenArray::IsRecalcModeAlways(), formula::FormulaTokenArray::IsRecalcModeNormal(), formula::FormulaTokenArrayPlainIterator::Jump(), maArrIterator, mpLastToken, p, pArr, and pStack.
Referenced by CompileTokenArray(), and GetToken().
|
protected |
Definition at line 2132 of file FormulaCompiler.cxx.
References HandleIIOpCode(), mbComputeII, mpToken, NextToken(), ocPercentSign, pCode, PutCode(), and UnaryLine().
Referenced by PowLine().
|
inlineprotectedvirtual |
Definition at line 385 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray().
|
protected |
Definition at line 2147 of file FormulaCompiler.cxx.
References HandleIIOpCode(), mbComputeII, mpToken, NextToken(), ocPow, p, pCode, PostOpLine(), and PutCode().
Referenced by MulDivLine().
|
protected |
Definition at line 3099 of file FormulaCompiler.cxx.
References aCorrectedFormula, aCorrectedSymbol, bAutoCorrect, formula::FormulaTokenArrayPlainIterator::GetIndex(), maArrIterator, mpLastToken, p, pArr, and pStack.
|
protected |
Definition at line 2855 of file FormulaCompiler.cxx.
References CodeOverflow, ForceArrayOperator(), FORMULA_MAXTOKENS, formula::FormulaTokenArray::GetCodeError(), mbJumpCommandReorder, NONE, ocStop, p, pArr, pc, pCode, SAL_WARN, and SetError().
Referenced by AddSubLine(), CompareLine(), ConcatLine(), Expression(), Factor(), IntersectionLine(), MulDivLine(), PostOpLine(), PowLine(), RangeLine(), UnaryLine(), and UnionLine().
|
protected |
Definition at line 2050 of file FormulaCompiler.cxx.
References Factor(), MergeRangeReference(), mpToken, NextToken(), ocRange, p, pCode, and PutCode().
Referenced by IntersectionLine().
|
static |
Definition at line 2724 of file FormulaCompiler.cxx.
References formula::lcl_fillNativeSymbols().
|
inline |
Sets the implicit intersection compute flag.
Definition at line 322 of file FormulaCompiler.hxx.
|
protectedvirtual |
Definition at line 2276 of file FormulaCompiler.cxx.
Referenced by CompileTokenArray(), Expression(), Factor(), GetToken(), NextToken(), and PutCode().
|
inline |
Sets the matrix flag for the formula.
Definition at line 325 of file FormulaCompiler.hxx.
|
static |
Definition at line 2731 of file FormulaCompiler.cxx.
References formula::lcl_fillNativeSymbols().
|
protected |
Definition at line 2111 of file FormulaCompiler.cxx.
References GetToken(), HandleIIOpCode(), mbComputeII, mpToken, NextToken(), ocAdd, p, pCode, PutCode(), SC_OPCODE_STOP_UN_OP, UnaryLine(), and UnionLine().
Referenced by PostOpLine(), and UnaryLine().
|
protected |
Definition at line 2099 of file FormulaCompiler.cxx.
References IntersectionLine(), mpToken, NextToken(), ocUnion, p, and PutCode().
Referenced by UnaryLine().
|
static |
Definition at line 2714 of file FormulaCompiler.cxx.
References formula::lcl_fillNativeSymbols(), ocArrayColSep, ocArrayRowSep, and ocSep.
|
protected |
Definition at line 389 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), Factor(), GetToken(), NextToken(), and PushTokenArray().
|
protected |
Definition at line 390 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), Factor(), GetToken(), NextToken(), and PushTokenArray().
|
protected |
Definition at line 411 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), Factor(), GetToken(), NextToken(), and PushTokenArray().
|
protected |
Definition at line 412 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), Factor(), and NextToken().
|
protected |
Definition at line 404 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), and NextToken().
|
protected |
Definition at line 413 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), and GetToken().
|
protected |
Definition at line 398 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), CreateStringFromToken(), CreateStringFromTokenArray(), Factor(), GetToken(), IntersectionLine(), NextToken(), PopTokenArray(), and PushTokenArray().
|
protected |
Whether to stop compilation on first encountered error.
Definition at line 419 of file FormulaCompiler.hxx.
Referenced by AddSubLine(), CompareLine(), ConcatLine(), Expression(), Factor(), GetToken(), MulDivLine(), PostOpLine(), PowLine(), and UnaryLine().
|
protected |
Definition at line 416 of file FormulaCompiler.hxx.
Referenced by EnableJumpCommandReorder(), Factor(), and PutCode().
|
protected |
Definition at line 420 of file FormulaCompiler.hxx.
Referenced by ForceArrayOperator().
|
protected |
Whether or not to reorder RPN for jump commands.
Definition at line 417 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), EnableStopOnError(), Factor(), and GetToken().
|
protected |
Definition at line 409 of file FormulaCompiler.hxx.
Referenced by formula::FormulaCompiler::OpCodeMap::copyFrom(), CreateStringFromToken(), CreateStringFromTokenArray(), Factor(), GetToken(), NeedsTableRefTransformation(), and NextToken().
|
protected |
Definition at line 399 of file FormulaCompiler.hxx.
Referenced by GetToken(), PopTokenArray(), and PushTokenArray().
|
protected |
Definition at line 394 of file FormulaCompiler.hxx.
Referenced by AddSubLine(), CompareLine(), ConcatLine(), Expression(), Factor(), GetToken(), IntersectionLine(), MulDivLine(), NextToken(), PostOpLine(), PowLine(), RangeLine(), UnaryLine(), and UnionLine().
|
protected |
Definition at line 392 of file FormulaCompiler.hxx.
Referenced by AppendBoolean(), AppendDouble(), AppendErrorConstant(), CreateStringFromToken(), Factor(), GetErrorConstant(), NeedsTableRefTransformation(), and NextToken().
|
mutableprivate |
Definition at line 491 of file FormulaCompiler.hxx.
Referenced by GetFinalOpCodeMap(), and InitSymbolsAPI().
|
mutableprivate |
Definition at line 493 of file FormulaCompiler.hxx.
Referenced by GetFinalOpCodeMap(), and InitSymbolsEnglish().
|
mutableprivate |
Definition at line 494 of file FormulaCompiler.hxx.
Referenced by GetFinalOpCodeMap(), and InitSymbolsEnglishXL().
|
mutableprivate |
Definition at line 492 of file FormulaCompiler.hxx.
Referenced by GetFinalOpCodeMap(), and InitSymbolsNative().
|
mutableprivate |
Definition at line 489 of file FormulaCompiler.hxx.
Referenced by GetFinalOpCodeMap(), and InitSymbolsODFF().
|
mutableprivate |
Definition at line 495 of file FormulaCompiler.hxx.
Referenced by GetFinalOpCodeMap(), and InitSymbolsOOXML().
|
mutableprivate |
Definition at line 490 of file FormulaCompiler.hxx.
Referenced by GetFinalOpCodeMap(), and InitSymbolsPODF().
|
protected |
Definition at line 396 of file FormulaCompiler.hxx.
Referenced by CheckSetForceArrayParameter(), ForceArrayOperator(), formula::FormulaCompiler::CurrentFactor::operator=(), and formula::FormulaCompiler::CurrentFactor::~CurrentFactor().
|
protected |
Definition at line 414 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), and GetToken().
|
protected |
Definition at line 406 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), and Factor().
|
protected |
Definition at line 405 of file FormulaCompiler.hxx.
Referenced by Expression(), GetToken(), and NextToken().
|
protected |
Definition at line 397 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), CreateStringFromTokenArray(), Factor(), GetToken(), IntersectionLine(), PopTokenArray(), PushTokenArray(), and PutCode().
|
protected |
Definition at line 407 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), Factor(), ForceArrayOperator(), IntersectionLine(), MergeRangeReference(), and PutCode().
|
protected |
Definition at line 401 of file FormulaCompiler.hxx.
Referenced by AddSubLine(), CompareLine(), CompileTokenArray(), ConcatLine(), Expression(), Factor(), ForceArrayOperator(), IntersectionLine(), MergeRangeReference(), MulDivLine(), PostOpLine(), PowLine(), PutCode(), RangeLine(), and UnaryLine().
|
protected |
Definition at line 395 of file FormulaCompiler.hxx.
Referenced by CheckSetForceArrayParameter(), ForceArrayOperator(), formula::FormulaCompiler::CurrentFactor::operator FormulaTokenRef &(), formula::FormulaCompiler::CurrentFactor::operator->(), formula::FormulaCompiler::CurrentFactor::operator=(), and formula::FormulaCompiler::CurrentFactor::~CurrentFactor().
|
protected |
Definition at line 402 of file FormulaCompiler.hxx.
Referenced by CompileTokenArray(), Factor(), GetToken(), NextToken(), PopTokenArray(), and PushTokenArray().
|
staticprivate |
Definition at line 497 of file FormulaCompiler.hxx.