LibreOffice Module sc (master)  1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
ScCompiler Class Reference

#include <compiler.hxx>

Inheritance diagram for ScCompiler:
[legend]
Collaboration diagram for ScCompiler:
[legend]

Classes

struct  AddInMap
 
struct  Convention
 
struct  PendingImplicitIntersectionOptimization
 "stack" of currently active ocTableRef tokens More...
 
struct  TableRefEntry
 get or setup tab names for the current grammar More...
 

Public Types

enum  ExtendedErrorDetection {
  EXTENDED_ERROR_DETECTION_NONE = 0,
  EXTENDED_ERROR_DETECTION_NAME_BREAK,
  EXTENDED_ERROR_DETECTION_NAME_NO_BREAK
}
 
- Public Types inherited from formula::FormulaCompiler
enum  SeparatorType {
  SeparatorType::RESOURCE_BASE,
  SeparatorType::SEMICOLON_BASE
}
 
typedef std::shared_ptr< const OpCodeMapOpCodeMapPtr
 
typedef std::shared_ptr< OpCodeMapNonConstOpCodeMapPtr
 

Public Member Functions

 ScCompiler (sc::CompileFormulaContext &rCxt, const ScAddress &rPos, bool bComputeII=false, bool bMatrixFlag=false, const ScInterpreterContext *pContext=nullptr)
 
 ScCompiler (ScDocument &rDocument, const ScAddress &, formula::FormulaGrammar::Grammar eGrammar=formula::FormulaGrammar::GRAM_UNSPECIFIED, bool bComputeII=false, bool bMatrixFlag=false, const ScInterpreterContext *pContext=nullptr)
 If eGrammar == GRAM_UNSPECIFIED then the grammar of rDocument is used,. More...
 
 ScCompiler (sc::CompileFormulaContext &rCxt, const ScAddress &rPos, ScTokenArray &rArr, bool bComputeII=false, bool bMatrixFlag=false, const ScInterpreterContext *pContext=nullptr)
 
 ScCompiler (ScDocument &rDocument, const ScAddress &, ScTokenArray &rArr, formula::FormulaGrammar::Grammar eGrammar=formula::FormulaGrammar::GRAM_UNSPECIFIED, bool bComputeII=false, bool bMatrixFlag=false, const ScInterpreterContext *pContext=nullptr)
 If eGrammar == GRAM_UNSPECIFIED then the grammar of rDocument is used,. More...
 
virtual ~ScCompiler () override
 
sal_Unicode GetNativeAddressSymbol (Convention::SpecialSymbolType eType) const
 
bool IsErrorConstant (const OUString &) const
 
bool IsTableRefItem (const OUString &) const
 
bool IsTableRefColumn (const OUString &) const
 
bool GetTokenIfOpCode (OpCode eOp)
 Calls GetToken() if PeekNextNoSpaces() is of given OpCode. More...
 
void SetAutoCorrection (bool bVal)
 When auto correction is set, the jump command reorder must be enabled. More...
 
void SetCloseBrackets (bool bVal)
 
void SetRefConvention (const Convention *pConvP)
 
void SetRefConvention (const formula::FormulaGrammar::AddressConvention eConv)
 
void SetFormulaLanguage (const OpCodeMapPtr &xMap)
 Set symbol map if not empty. More...
 
void SetGrammar (const formula::FormulaGrammar::Grammar eGrammar)
 
void SetNumberFormatter (SvNumberFormatter *pFormatter)
 
void SetExternalLinks (const css::uno::Sequence< css::sheet::ExternalLinkInfo > &rLinks)
 Set external link info for ScAddress::CONV_XL_OOX. More...
 
void CreateStringFromXMLTokenArray (OUString &rFormula, OUString &rFormulaNmsp)
 
void SetExtendedErrorDetection (ExtendedErrorDetection eVal)
 
bool IsCorrected () const
 
const OUString & GetCorrectedFormula () const
 
std::unique_ptr< ScTokenArrayCompileString (const OUString &rFormula)
 Tokenize formula expression string into an array of tokens. More...
 
std::unique_ptr< ScTokenArrayCompileString (const OUString &rFormula, const OUString &rFormulaNmsp)
 
const ScAddressGetPos () const
 
void MoveRelWrap ()
 
bool HasUnhandledPossibleImplicitIntersections () const
 
const std::set< OpCode > & UnhandledPossibleImplicitIntersectionsOpCodes ()
 
- Public Member Functions inherited from formula::FormulaCompiler
 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
 
const OpCodeMapPtrGetCurrentOpCodeMap () const
 
OpCode GetEnglishOpCode (const OUString &rName) const
 
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 FormulaTokenCreateStringFromToken (OUString &rFormula, const FormulaToken *pToken)
 
const FormulaTokenCreateStringFromToken (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
 
bool NeedsTableRefTransformation () const
 
void SetComputeIIFlag (bool bSet)
 
void SetMatrixFlag (bool bSet)
 

Static Public Member Functions

static void DeInit ()
 
static void CheckTabQuotes (OUString &aTabName, const formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO)
 all More...
 
static sal_Int32 GetDocTabPos (const OUString &rString)
 Analyzes a string for a 'Doc'Tab construct, or 'Do''c'Tab etc... More...
 
static bool EnQuote (OUString &rStr)
 
static bool IsEnglishSymbol (const OUString &rName)
 
static const ConventionGetRefConvention (formula::FormulaGrammar::AddressConvention eConv)
 
static void MoveRelWrap (const ScTokenArray &rArr, const ScDocument &rDoc, const ScAddress &rPos, SCCOL nMaxCol, SCROW nMaxRow)
 
static bool IsCharFlagAllConventions (OUString const &rStr, sal_Int32 nPos, ScCharFlags nFlags)
 If the character is allowed as tested by nFlags (SC_COMPILER_C_... More...
 
static bool DoubleRefToPosSingleRefScalarCase (const ScRange &rRange, ScAddress &rAdr, const ScAddress &rFormulaPos)
 TODO : Move this to somewhere appropriate. More...
 
- Static Public Member Functions inherited from formula::FormulaCompiler
static OpCodeMapPtr CreateOpCodeMap (const css::uno::Sequence< const css::sheet::FormulaOpCodeMapEntry > &rMapping, bool bEnglish)
 
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)
 

Private Member Functions

std::vector< OUString > & GetSetupTabNames () const
 sheet names mangled for the current grammar for output More...
 
bool NextNewToken (bool bInArray)
 
virtual void SetError (FormulaError nError) override
 
sal_Int32 NextSymbol (bool bInArray)
 
bool IsValue (const OUString &)
 
bool IsOpCode (const OUString &, bool bInArray)
 
bool IsOpCode2 (const OUString &)
 
bool IsString ()
 
bool IsReference (const OUString &rSymbol, const OUString *pErrRef=nullptr)
 
bool IsSingleReference (const OUString &rSymbol, const OUString *pErrRef=nullptr)
 
bool IsDoubleReference (const OUString &rSymbol, const OUString *pErrRef=nullptr)
 
bool IsPredetectedReference (const OUString &rSymbol)
 
bool IsPredetectedErrRefReference (const OUString &rName, const OUString *pErrRef)
 
bool IsMacro (const OUString &)
 
bool IsNamedRange (const OUString &)
 
bool IsExternalNamedRange (const OUString &rSymbol, bool &rbInvalidExternalNameRange)
 
bool IsDBRange (const OUString &)
 
bool IsColRowName (const OUString &)
 
bool IsBoolean (const OUString &)
 
void AutoCorrectParsedSymbol ()
 
void AdjustSheetLocalNameRelReferences (SCTAB nDelta)
 
void SetRelNameReference ()
 
ScRangeDataGetRangeData (const formula::FormulaToken &pToken) const
 Obtain range data for ocName token, global or sheet local. More...
 
void SetGrammarAndRefConvention (const formula::FormulaGrammar::Grammar eNewGrammar, const formula::FormulaGrammar::Grammar eOldGrammar)
 Set grammar and reference convention from within SetFormulaLanguage() or SetGrammar(). More...
 
virtual OUString FindAddInFunction (const OUString &rUpperName, bool bLocalFirst) const override
 
virtual void fillFromAddInCollectionUpperName (const NonConstOpCodeMapPtr &xMap) const override
 
virtual void fillFromAddInCollectionEnglishName (const NonConstOpCodeMapPtr &xMap) const override
 
virtual void fillFromAddInMap (const NonConstOpCodeMapPtr &xMap, formula::FormulaGrammar::Grammar _eGrammar) const override
 
virtual void fillAddInToken (::std::vector< css::sheet::FormulaOpCodeMapEntry > &_rVec, bool _bIsEnglish) const override
 
virtual bool HandleExternalReference (const formula::FormulaToken &_aToken) override
 
virtual bool HandleRange () override
 
virtual bool HandleColRowName () override
 
virtual bool HandleDbData () override
 
virtual bool HandleTableRef () override
 
virtual formula::FormulaTokenRef ExtendRangeReference (formula::FormulaToken &rTok1, formula::FormulaToken &rTok2) override
 
virtual void CreateStringFromExternal (OUStringBuffer &rBuffer, const formula::FormulaToken *pToken) const override
 
virtual void CreateStringFromSingleRef (OUStringBuffer &rBuffer, const formula::FormulaToken *pToken) const override
 
virtual void CreateStringFromDoubleRef (OUStringBuffer &rBuffer, const formula::FormulaToken *pToken) const override
 
virtual void CreateStringFromMatrix (OUStringBuffer &rBuffer, const formula::FormulaToken *pToken) const override
 
virtual void CreateStringFromIndex (OUStringBuffer &rBuffer, const formula::FormulaToken *pToken) const override
 
virtual void LocalizeString (OUString &rName) const override
 
virtual formula::ParamClass GetForceArrayParameter (const formula::FormulaToken *pToken, sal_uInt16 nParam) const override
 
ScCharFlags GetCharTableFlags (sal_Unicode c, sal_Unicode cLast)
 Access the CharTable flags. More...
 
virtual void HandleIIOpCode (formula::FormulaToken *token, formula::FormulaToken ***pppToken, sal_uInt8 nNumParams) override
 
bool HandleIIOpCodeInternal (formula::FormulaToken *token, formula::FormulaToken ***pppToken, sal_uInt8 nNumParams)
 
bool SkipImplicitIntersectionOptimization (const formula::FormulaToken *token) const
 
virtual void PostProcessCode () override
 
void ReplaceDoubleRefII (formula::FormulaToken **ppDoubleRefTok)
 
bool AdjustSumRangeShape (const ScComplexRefData &rBaseRange, ScComplexRefData &rSumRange)
 
void CorrectSumRange (const ScComplexRefData &rBaseRange, ScComplexRefData &rSumRange, formula::FormulaToken **ppSumRangeToken)
 

Static Private Member Functions

static size_t GetAddInMapCount ()
 
static void InitCharClassEnglish ()
 
static bool ParameterMayBeImplicitIntersection (const formula::FormulaToken *token, int parameter)
 

Private Attributes

ScDocumentrDoc
 
ScAddress aPos
 
SvNumberFormattermpFormatter
 
const ScInterpreterContextmpInterpreterContext
 
SCTAB mnCurrentSheetTab
 
sal_Int32 mnCurrentSheetEndPos
 
css::uno::Sequence< css::sheet::ExternalLinkInfo > maExternalLinks
 
sal_Unicode cSymbol [MAXSTRLEN+1]
 
OUString aFormula
 
sal_Int32 nSrcPos
 
ScRawToken maRawToken
 
std::queue< OpCodemaPendingOpCodes
 
const CharClasspCharClass
 
sal_uInt16 mnPredetectedReference
 
sal_Int32 mnRangeOpPosInSymbol
 
const ConventionpConv
 
ExtendedErrorDetection meExtendedErrorDetection
 
bool mbCloseBrackets
 
bool mbRewind
 
std::vector< sal_uInt16 > maExternalFiles
 
std::vector< OUString > maTabNames
 
std::vector< TableRefEntrymaTableRefs
 
std::vector< PendingImplicitIntersectionOptimizationmPendingImplicitIntersectionOptimizations
 
std::set< formula::FormulaTokenRefmUnhandledPossibleImplicitIntersections
 
std::set< OpCodemUnhandledPossibleImplicitIntersectionsOpCodes
 

Static Private Attributes

static CharClasspCharClassEnglish = nullptr
 
static const ConventionpConventions [formula::FormulaGrammar::CONV_LAST] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }
 
static const struct ScCompiler::AddInMap g_aAddInMap []
 

Friends

struct Convention
 

Additional Inherited Members

- Protected Member Functions inherited from formula::FormulaCompiler
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)
 
- Protected Attributes inherited from formula::FormulaCompiler
OUString aCorrectedFormula
 
OUString aCorrectedSymbol
 
OpCodeMapPtr mxSymbols
 
FormulaTokenRef mpToken
 
FormulaTokenRef pCurrentFactorToken
 
sal_uInt16 nCurrentFactorParam
 
FormulaTokenArraypArr
 
FormulaTokenArrayPlainIterator maArrIterator
 
FormulaTokenRef mpLastToken
 
FormulaToken ** pCode
 
FormulaArrayStackpStack
 
OpCode eLastOp
 
short nRecursion
 
SvNumFormatType nNumFmt
 
sal_uInt16 pc
 
FormulaGrammar::Grammar meGrammar
 
bool bAutoCorrect
 
bool bCorrected
 
bool glSubTotal
 
bool needsRPNTokenCheck
 
bool mbJumpCommandReorder
 
bool mbStopOnError
 
bool mbComputeII
 
bool mbMatrixFlag
 

Detailed Description

Definition at line 176 of file compiler.hxx.

Member Enumeration Documentation

Enumerator
EXTENDED_ERROR_DETECTION_NONE 
EXTENDED_ERROR_DETECTION_NAME_BREAK 
EXTENDED_ERROR_DETECTION_NAME_NO_BREAK 

Definition at line 180 of file compiler.hxx.

Constructor & Destructor Documentation

ScCompiler::ScCompiler ( sc::CompileFormulaContext rCxt,
const ScAddress rPos,
bool  bComputeII = false,
bool  bMatrixFlag = false,
const ScInterpreterContext pContext = nullptr 
)

Definition at line 1851 of file compiler.cxx.

References sc::CompileFormulaContext::getGrammar(), and SetGrammar().

ScCompiler::ScCompiler ( ScDocument rDocument,
const ScAddress rPos,
formula::FormulaGrammar::Grammar  eGrammar = formula::FormulaGrammar::GRAM_UNSPECIFIED,
bool  bComputeII = false,
bool  bMatrixFlag = false,
const ScInterpreterContext pContext = nullptr 
)

If eGrammar == GRAM_UNSPECIFIED then the grammar of rDocument is used,.

Definition at line 1872 of file compiler.cxx.

References ScDocument::GetGrammar(), formula::FormulaGrammar::GRAM_UNSPECIFIED, and SetGrammar().

ScCompiler::ScCompiler ( sc::CompileFormulaContext rCxt,
const ScAddress rPos,
ScTokenArray rArr,
bool  bComputeII = false,
bool  bMatrixFlag = false,
const ScInterpreterContext pContext = nullptr 
)

Definition at line 1806 of file compiler.cxx.

References sc::CompileFormulaContext::getGrammar(), and SetGrammar().

ScCompiler::ScCompiler ( ScDocument rDocument,
const ScAddress rPos,
ScTokenArray rArr,
formula::FormulaGrammar::Grammar  eGrammar = formula::FormulaGrammar::GRAM_UNSPECIFIED,
bool  bComputeII = false,
bool  bMatrixFlag = false,
const ScInterpreterContext pContext = nullptr 
)

If eGrammar == GRAM_UNSPECIFIED then the grammar of rDocument is used,.

Definition at line 1827 of file compiler.cxx.

References ScDocument::GetGrammar(), formula::FormulaGrammar::GRAM_UNSPECIFIED, and SetGrammar().

ScCompiler::~ScCompiler ( )
overridevirtual

Definition at line 1896 of file compiler.cxx.

Member Function Documentation

void ScCompiler::AdjustSheetLocalNameRelReferences ( SCTAB  nDelta)
private
bool ScCompiler::AdjustSumRangeShape ( const ScComplexRefData rBaseRange,
ScComplexRefData rSumRange 
)
private
void ScCompiler::AutoCorrectParsedSymbol ( )
private
void ScCompiler::CheckTabQuotes ( OUString &  aTabName,
const formula::FormulaGrammar::AddressConvention  eConv = formula::FormulaGrammar::CONV_OOO 
)
static
std::unique_ptr< ScTokenArray > ScCompiler::CompileString ( const OUString &  rFormula)

Tokenize formula expression string into an array of tokens.

Parameters
rFormulaformula expression to tokenize.
Returns
heap allocated token array object. The caller must manage the life cycle of this object.

Definition at line 4495 of file compiler.cxx.

References aArr, formula::FormulaCompiler::aCorrectedFormula, formula::FormulaCompiler::aCorrectedSymbol, Add, formula::FormulaTokenArray::AddToken(), aFormula, aPos, formula::FormulaCompiler::bAutoCorrect, formula::FormulaCompiler::bCorrected, ScRawToken::CreateToken(), formula::FormulaCompiler::eLastOp, ScDocument::GetExternalRefManager(), formula::FormulaToken::GetIndex(), formula::FormulaTokenArray::GetLen(), formula::FormulaToken::GetOpCode(), ScRawToken::GetOpCode(), ScDocument::GetSheetLimits(), formula::FormulaToken::GetType(), formula::FormulaCompiler::maArrIterator, maExternalFiles, o3tl::make_unsigned(), maRawToken, maTableRefs, mbCloseBrackets, formula::FormulaCompiler::meGrammar, formula::FormulaCompiler::MergeRangeReference(), formula::FormulaCompiler::mxSymbols, NextNewToken(), nSrcPos, ocAddress, ocArrayClose, ocArrayColSep, ocArrayOpen, ocArrayRowSep, ocClose, ocColRowName, ocColRowNameAuto, ocDBArea, ocNone, ocOpen, ocPush, ocRange, ocSep, ocSkip, ocTableRefClose, ocTableRefOpen, ocWeek, formula::FormulaTokenArray::OpCodeBefore(), formula::FormulaCompiler::pArr, formula::FormulaTokenArray::PeekPrev(), rDoc, SAL_WARN_IF, SetError(), SetGrammar(), formula::FormulaTokenArray::SetRecalcModeForced(), formula::FormulaTokenArray::SetShareable(), comphelper::string::strip(), svSep, svSingleRef, and ScTableRefToken::TABLE.

Referenced by ScVbaNames::Add(), ScOrcusFormula::commit(), ScFormulaCell::Compile(), ScConditionEntry::Compile(), ScRangeData::CompileRangeData(), CompileString(), ScFormulaCell::CompileXML(), XclExpChSourceLink::ConvertDataSequence(), ScXMLConditionalFormatContext::endFastElement(), ScDocFunc::EnterMatrix(), oox::xls::DefinedName::getScTokens(), ScNameDefDlg::IsFormulaValid(), ScNameDlg::IsFormulaValid(), ScSimpleFormulaCalculator::ScSimpleFormulaCalculator(), and ScImportExport::Sylk2Doc().

std::unique_ptr< ScTokenArray > ScCompiler::CompileString ( const OUString &  rFormula,
const OUString &  rFormulaNmsp 
)
void ScCompiler::CorrectSumRange ( const ScComplexRefData rBaseRange,
ScComplexRefData rSumRange,
formula::FormulaToken **  ppSumRangeToken 
)
private
void ScCompiler::CreateStringFromDoubleRef ( OUStringBuffer &  rBuffer,
const formula::FormulaToken pToken 
) const
overrideprivatevirtual
void ScCompiler::CreateStringFromExternal ( OUStringBuffer &  rBuffer,
const formula::FormulaToken pToken 
) const
overrideprivatevirtual
void ScCompiler::CreateStringFromIndex ( OUStringBuffer &  rBuffer,
const formula::FormulaToken pToken 
) const
overrideprivatevirtual
void ScCompiler::CreateStringFromMatrix ( OUStringBuffer &  rBuffer,
const formula::FormulaToken pToken 
) const
overrideprivatevirtual
void ScCompiler::CreateStringFromSingleRef ( OUStringBuffer &  rBuffer,
const formula::FormulaToken pToken 
) const
overrideprivatevirtual
void ScCompiler::CreateStringFromXMLTokenArray ( OUString &  rFormula,
OUString &  rFormulaNmsp 
)
void ScCompiler::DeInit ( )
static

Definition at line 169 of file compiler.cxx.

Referenced by ScGlobal::Clear().

bool ScCompiler::DoubleRefToPosSingleRefScalarCase ( const ScRange rRange,
ScAddress rAdr,
const ScAddress rFormulaPos 
)
static

TODO : Move this to somewhere appropriate.

Definition at line 6144 of file compiler.cxx.

References ScRange::aEnd, assert(), ScRange::aStart, ScAddress::Col(), ScAddress::Row(), ScAddress::Set(), and ScAddress::Tab().

Referenced by ReplaceDoubleRefII().

bool ScCompiler::EnQuote ( OUString &  rStr)
static
FormulaTokenRef ScCompiler::ExtendRangeReference ( formula::FormulaToken rTok1,
formula::FormulaToken rTok2 
)
overrideprivatevirtual

Reimplemented from formula::FormulaCompiler.

Definition at line 5328 of file compiler.cxx.

References aPos, extendRangeReference(), ScDocument::GetSheetLimits(), and rDoc.

void ScCompiler::fillAddInToken ( ::std::vector< css::sheet::FormulaOpCodeMapEntry > &  _rVec,
bool  _bIsEnglish 
) const
overrideprivatevirtual
void ScCompiler::fillFromAddInCollectionEnglishName ( const NonConstOpCodeMapPtr xMap) const
overrideprivatevirtual
void ScCompiler::fillFromAddInCollectionUpperName ( const NonConstOpCodeMapPtr xMap) const
overrideprivatevirtual
void ScCompiler::fillFromAddInMap ( const NonConstOpCodeMapPtr xMap,
formula::FormulaGrammar::Grammar  _eGrammar 
) const
overrideprivatevirtual
OUString ScCompiler::FindAddInFunction ( const OUString &  rUpperName,
bool  bLocalFirst 
) const
overrideprivatevirtual

Reimplemented from formula::FormulaCompiler.

Definition at line 292 of file compiler.cxx.

References ScUnoAddInCollection::FindFunction(), and ScGlobal::GetAddInCollection().

size_t ScCompiler::GetAddInMapCount ( )
staticprivate

Definition at line 138 of file odffmap.cxx.

References g_aAddInMap, and SAL_N_ELEMENTS.

ScCharFlags ScCompiler::GetCharTableFlags ( sal_Unicode  c,
sal_Unicode  cLast 
)
inlineprivate

Access the CharTable flags.

Definition at line 507 of file compiler.hxx.

References ScCompiler::Convention::getCharTableFlags(), and NONE.

Referenced by AutoCorrectParsedSymbol(), IsReference(), and NextSymbol().

const OUString& ScCompiler::GetCorrectedFormula ( ) const
inline

Definition at line 449 of file compiler.hxx.

References formula::FormulaCompiler::aCorrectedFormula.

sal_Int32 ScCompiler::GetDocTabPos ( const OUString &  rString)
static

Analyzes a string for a 'Doc'Tab construct, or 'Do''c'Tab etc...

Returns
the position of the unquoted # hash mark in 'Doc'Tab, or -1 if none.

Definition at line 1939 of file compiler.cxx.

References ScGlobal::FindUnquoted(), nPos, and SC_COMPILER_FILE_TAB_SEP.

Referenced by lcl_Format(), lcl_Split_DocTab(), and ScInterpreter::ScAddressFunc().

formula::ParamClass ScCompiler::GetForceArrayParameter ( const formula::FormulaToken pToken,
sal_uInt16  nParam 
) const
overrideprivatevirtual

Reimplemented from formula::FormulaCompiler.

Definition at line 5910 of file compiler.cxx.

References ScParameterClassification::GetParameterType().

sal_Unicode ScCompiler::GetNativeAddressSymbol ( Convention::SpecialSymbolType  eType) const

Definition at line 5323 of file compiler.cxx.

References ScCompiler::Convention::getSpecialSymbol(), and pConv.

const ScAddress& ScCompiler::GetPos ( ) const
inline

Definition at line 461 of file compiler.hxx.

Referenced by CreateStringFromExternal().

ScRangeData * ScCompiler::GetRangeData ( const formula::FormulaToken pToken) const
private

Obtain range data for ocName token, global or sheet local.

Prerequisite: rToken is a FormulaIndexToken so IsGlobal() and GetIndex() can be called on it. We don't check with RTTI.

Definition at line 4839 of file compiler.cxx.

References ScDocument::FindRangeNameBySheetAndIndex(), formula::FormulaToken::GetIndex(), formula::FormulaToken::GetSheet(), and rDoc.

Referenced by CreateStringFromIndex(), and HandleRange().

const ScCompiler::Convention * ScCompiler::GetRefConvention ( formula::FormulaGrammar::AddressConvention  eConv)
static

Definition at line 1957 of file compiler.cxx.

Referenced by SetRefConvention().

std::vector< OUString > & ScCompiler::GetSetupTabNames ( ) const
private

sheet names mangled for the current grammar for output

Definition at line 245 of file compiler.cxx.

References CheckTabQuotes(), and formula::FormulaGrammar::extractRefConvention().

Referenced by CreateStringFromDoubleRef(), and CreateStringFromSingleRef().

bool ScCompiler::GetTokenIfOpCode ( OpCode  eOp)
bool ScCompiler::HandleColRowName ( )
overrideprivatevirtual
bool ScCompiler::HandleDbData ( )
overrideprivatevirtual
bool ScCompiler::HandleExternalReference ( const formula::FormulaToken _aToken)
overrideprivatevirtual
void ScCompiler::HandleIIOpCode ( formula::FormulaToken token,
formula::FormulaToken ***  pppToken,
sal_uInt8  nNumParams 
)
overrideprivatevirtual
bool ScCompiler::HandleIIOpCodeInternal ( formula::FormulaToken token,
formula::FormulaToken ***  pppToken,
sal_uInt8  nNumParams 
)
private
bool ScCompiler::HandleRange ( )
overrideprivatevirtual
bool ScCompiler::HandleTableRef ( )
overrideprivatevirtual

Reimplemented from formula::FormulaCompiler.

Definition at line 5611 of file compiler.cxx.

References formula::FormulaTokenArray::Add(), ScTokenArray::AddDoubleReference(), ScTokenArray::AddSingleReference(), ScRange::aEnd, ScTableRefToken::ALL, aPos, ScRange::aStart, ScTableRefToken::DATA, ScTableRefToken::DATA_TOTALS, ScDBCollection::NamedDBs::findByIndex(), ScDBData::GetArea(), ScDocument::GetDBCollection(), ScTableRefToken::GetIndex(), ScTableRefToken::GetItem(), ScDBCollection::getNamedDBs(), formula::FormulaToken::GetOpCode(), ScDocument::GetSheetLimits(), formula::FormulaToken::GetSingleRef(), formula::FormulaCompiler::GetToken(), GetTokenIfOpCode(), formula::FormulaToken::GetType(), ScDBData::HasHeader(), ScDBData::HasTotals(), ScTableRefToken::HEADERS, ScTableRefToken::HEADERS_DATA, ScAddress::IncRow(), ScSingleRefData::InitFlags(), ScComplexRefData::InitFlags(), ScAddress::INITIALIZE_INVALID, ScRange::Intersection(), ScSingleRefData::IsColRel(), formula::FormulaTokenArray::IsFromRangeName(), ScSingleRefData::IsRelName(), ScRange::IsValid(), formula::FormulaCompiler::maArrIterator, formula::FormulaCompiler::mbJumpCommandReorder, formula::FormulaCompiler::mpToken, ocBad, ocPush, ocRange, ocSep, ocTableRefClose, ocTableRefItemAll, ocTableRefItemData, ocTableRefItemHeaders, ocTableRefItemThisRow, ocTableRefItemTotals, ocTableRefOpen, formula::FormulaCompiler::pArr, formula::FormulaTokenArrayPlainIterator::PeekNextNoSpaces(), formula::FormulaCompiler::PushTokenArray(), ScRange::PutInOrder(), rDoc, ScComplexRefData::Ref1, ScComplexRefData::Ref2, ScAddress::Row(), ScSingleRefData::SetAddress(), ScTableRefToken::SetAreaRefRPN(), ScSingleRefData::SetColRel(), SetError(), ScSingleRefData::SetFlag3D(), ScComplexRefData::SetRange(), ScSingleRefData::SetRelName(), ScAddress::SetRow(), ScSingleRefData::SetRowRel(), ScAddress::SetTab(), svSingleRef, ScAddress::Tab(), ScTableRefToken::TABLE, ScTableRefToken::THIS_ROW, and ScTableRefToken::TOTALS.

bool ScCompiler::HasUnhandledPossibleImplicitIntersections ( ) const
inline

Definition at line 477 of file compiler.hxx.

Referenced by ScFormulaCell::InterpretFormulaGroupOpenCL().

void ScCompiler::InitCharClassEnglish ( )
staticprivate

Definition at line 201 of file compiler.cxx.

References comphelper::getProcessComponentContext().

bool ScCompiler::IsBoolean ( const OUString &  rName)
private
bool ScCompiler::IsCharFlagAllConventions ( OUString const &  rStr,
sal_Int32  nPos,
ScCharFlags  nFlags 
)
static

If the character is allowed as tested by nFlags (SC_COMPILER_C_...

bits) for all known address conventions. If more than one bit is given in nFlags, all bits must match.

Definition at line 5018 of file compiler.cxx.

References formula::FormulaGrammar::CONV_LAST, formula::FormulaGrammar::CONV_UNSPECIFIED, ScGlobal::getCharClassPtr(), CharClass::isLetterNumeric(), and pConventions.

Referenced by ScfTools::ConvertToScDefinedName(), ScRangeData::IsNameValid(), and ScRangeData::MakeValidName().

bool ScCompiler::IsColRowName ( const OUString &  rName)
private
bool ScCompiler::IsCorrected ( ) const
inline

Definition at line 448 of file compiler.hxx.

References formula::FormulaCompiler::bCorrected.

bool ScCompiler::IsDBRange ( const OUString &  rName)
private
bool ScCompiler::IsDoubleReference ( const OUString &  rSymbol,
const OUString *  pErrRef = nullptr 
)
private
bool ScCompiler::IsEnglishSymbol ( const OUString &  rName)
static
bool ScCompiler::IsErrorConstant ( const OUString &  rName) const
bool ScCompiler::IsExternalNamedRange ( const OUString &  rSymbol,
bool &  rbInvalidExternalNameRange 
)
private
bool ScCompiler::IsMacro ( const OUString &  rName)
private
bool ScCompiler::IsNamedRange ( const OUString &  rUpperName)
private
bool ScCompiler::IsOpCode ( const OUString &  rName,
bool  bInArray 
)
private
bool ScCompiler::IsOpCode2 ( const OUString &  rName)
private

Definition at line 2993 of file compiler.cxx.

References i, maRawToken, ocInternalBegin, ocInternalEnd, pInternal, and ScRawToken::SetOpCode().

Referenced by NextNewToken().

bool ScCompiler::IsPredetectedErrRefReference ( const OUString &  rName,
const OUString *  pErrRef 
)
private

Definition at line 3101 of file compiler.cxx.

References IsDoubleReference(), IsSingleReference(), and mnPredetectedReference.

Referenced by IsPredetectedReference().

bool ScCompiler::IsPredetectedReference ( const OUString &  rSymbol)
private
bool ScCompiler::IsReference ( const OUString &  rSymbol,
const OUString *  pErrRef = nullptr 
)
private
bool ScCompiler::IsSingleReference ( const OUString &  rSymbol,
const OUString *  pErrRef = nullptr 
)
private
bool ScCompiler::IsString ( )
private
bool ScCompiler::IsTableRefColumn ( const OUString &  rName) const
bool ScCompiler::IsTableRefItem ( const OUString &  rName) const
bool ScCompiler::IsValue ( const OUString &  rSym)
private
void ScCompiler::LocalizeString ( OUString &  rName) const
overrideprivatevirtual
void ScCompiler::MoveRelWrap ( )
void ScCompiler::MoveRelWrap ( const ScTokenArray rArr,
const ScDocument rDoc,
const ScAddress rPos,
SCCOL  nMaxCol,
SCROW  nMaxRow 
)
static
bool ScCompiler::NextNewToken ( bool  bInArray)
private
sal_Int32 ScCompiler::NextSymbol ( bool  bInArray)
private
bool ScCompiler::ParameterMayBeImplicitIntersection ( const formula::FormulaToken token,
int  parameter 
)
staticprivate

Definition at line 5915 of file compiler.cxx.

References Array, ScParameterClassification::GetParameterType(), and Value.

Referenced by HandleIIOpCodeInternal().

void ScCompiler::PostProcessCode ( )
overrideprivatevirtual
void ScCompiler::ReplaceDoubleRefII ( formula::FormulaToken **  ppDoubleRefTok)
private
void ScCompiler::SetAutoCorrection ( bool  bVal)

When auto correction is set, the jump command reorder must be enabled.

Definition at line 3985 of file compiler.cxx.

References assert(), formula::FormulaCompiler::bAutoCorrect, formula::FormulaCompiler::mbJumpCommandReorder, and formula::FormulaCompiler::mbStopOnError.

Referenced by ScViewFunc::EnterData().

void ScCompiler::SetCloseBrackets ( bool  bVal)
inline

Definition at line 408 of file compiler.hxx.

Referenced by ScTabViewShell::IsRefInputMode().

void ScCompiler::SetError ( FormulaError  nError)
overrideprivatevirtual
void ScCompiler::SetExtendedErrorDetection ( ExtendedErrorDetection  eVal)
inline

Definition at line 446 of file compiler.hxx.

Referenced by ScRangeData::CompileRangeData().

void ScCompiler::SetExternalLinks ( const css::uno::Sequence< css::sheet::ExternalLinkInfo > &  rLinks)
inline

Set external link info for ScAddress::CONV_XL_OOX.

Definition at line 437 of file compiler.hxx.

Referenced by oox::xls::DefinedName::getScTokens(), and ScFormulaParserObj::SetCompilerFlags().

void ScCompiler::SetFormulaLanguage ( const OpCodeMapPtr xMap)

Set symbol map if not empty.

Definition at line 264 of file compiler.cxx.

References ScGlobal::getCharClassPtr().

Referenced by ScFormulaParserObj::SetCompilerFlags().

void ScCompiler::SetGrammar ( const formula::FormulaGrammar::Grammar  eGrammar)
void ScCompiler::SetGrammarAndRefConvention ( const formula::FormulaGrammar::Grammar  eNewGrammar,
const formula::FormulaGrammar::Grammar  eOldGrammar 
)
private

Set grammar and reference convention from within SetFormulaLanguage() or SetGrammar().

Parameters
eNewGrammarThe new grammar to be set and the associated reference convention.
eOldGrammarThe previous grammar that was active before SetFormulaLanguage().

Definition at line 281 of file compiler.cxx.

References formula::FormulaGrammar::CONV_UNSPECIFIED, formula::FormulaGrammar::extractRefConvention(), and formula::FormulaGrammar::GRAM_UNSPECIFIED.

void ScCompiler::SetNumberFormatter ( SvNumberFormatter pFormatter)

Definition at line 259 of file compiler.cxx.

void ScCompiler::SetRefConvention ( const Convention pConvP)
void ScCompiler::SetRefConvention ( const formula::FormulaGrammar::AddressConvention  eConv)

Definition at line 1950 of file compiler.cxx.

References GetRefConvention(), and SetRefConvention().

void ScCompiler::SetRelNameReference ( )
private
bool ScCompiler::SkipImplicitIntersectionOptimization ( const formula::FormulaToken token) const
private
const std::set<OpCode>& ScCompiler::UnhandledPossibleImplicitIntersectionsOpCodes ( )
inline

Definition at line 479 of file compiler.hxx.

Referenced by ScFormulaCell::InterpretFormulaGroupOpenCL().

Friends And Related Function Documentation

friend struct Convention
friend

Definition at line 253 of file compiler.hxx.

Member Data Documentation

OUString ScCompiler::aFormula
private

Definition at line 282 of file compiler.hxx.

Referenced by CompileString(), IsValue(), NextNewToken(), and NextSymbol().

ScAddress ScCompiler::aPos
private
sal_Unicode ScCompiler::cSymbol[MAXSTRLEN+1]
private

Definition at line 281 of file compiler.hxx.

Referenced by IsOpCode(), IsReference(), IsString(), NextNewToken(), and NextSymbol().

const ScCompiler::AddInMap ScCompiler::g_aAddInMap
staticprivate

Definition at line 25 of file odffmap.cxx.

Referenced by GetAddInMapCount().

std::vector<sal_uInt16> ScCompiler::maExternalFiles
private
css::uno::Sequence<css::sheet::ExternalLinkInfo> ScCompiler::maExternalLinks
private

Definition at line 279 of file compiler.hxx.

Referenced by IsDoubleReference(), IsExternalNamedRange(), and IsSingleReference().

std::queue<OpCode> ScCompiler::maPendingOpCodes
private

Definition at line 286 of file compiler.hxx.

Referenced by IsValue(), and NextNewToken().

ScRawToken ScCompiler::maRawToken
mutableprivate
std::vector<TableRefEntry> ScCompiler::maTableRefs
private
std::vector<OUString> ScCompiler::maTabNames
private

Definition at line 297 of file compiler.hxx.

bool ScCompiler::mbCloseBrackets
private

Definition at line 293 of file compiler.hxx.

Referenced by CompileString().

bool ScCompiler::mbRewind
private

Definition at line 294 of file compiler.hxx.

Referenced by IsReference(), and NextNewToken().

ExtendedErrorDetection ScCompiler::meExtendedErrorDetection
private

Definition at line 292 of file compiler.hxx.

Referenced by NextNewToken().

sal_Int32 ScCompiler::mnCurrentSheetEndPos
private

Definition at line 276 of file compiler.hxx.

Referenced by IsNamedRange(), and IsSingleReference().

SCTAB ScCompiler::mnCurrentSheetTab
private

Definition at line 275 of file compiler.hxx.

Referenced by IsNamedRange(), and IsSingleReference().

sal_uInt16 ScCompiler::mnPredetectedReference
private
sal_Int32 ScCompiler::mnRangeOpPosInSymbol
private

Definition at line 290 of file compiler.hxx.

Referenced by IsReference(), and NextSymbol().

std::vector< PendingImplicitIntersectionOptimization > ScCompiler::mPendingImplicitIntersectionOptimizations
private

Definition at line 318 of file compiler.hxx.

Referenced by HandleIIOpCodeInternal(), and PostProcessCode().

SvNumberFormatter* ScCompiler::mpFormatter
private

Definition at line 272 of file compiler.hxx.

Referenced by IsValue().

const ScInterpreterContext* ScCompiler::mpInterpreterContext
private

Definition at line 273 of file compiler.hxx.

Referenced by CreateStringFromSingleRef().

std::set<formula::FormulaTokenRef> ScCompiler::mUnhandledPossibleImplicitIntersections
private

Definition at line 319 of file compiler.hxx.

Referenced by HandleIIOpCodeInternal().

std::set<OpCode> ScCompiler::mUnhandledPossibleImplicitIntersectionsOpCodes
private

Definition at line 321 of file compiler.hxx.

Referenced by HandleIIOpCode().

sal_Int32 ScCompiler::nSrcPos
private

Definition at line 283 of file compiler.hxx.

Referenced by CompileString(), IsValue(), lcl_isValidQuotedText(), NextNewToken(), and NextSymbol().

const CharClass* ScCompiler::pCharClass
private

Definition at line 288 of file compiler.hxx.

CharClass * ScCompiler::pCharClassEnglish = nullptr
staticprivate

Definition at line 257 of file compiler.hxx.

const Convention* ScCompiler::pConv
private
const ScCompiler::Convention * ScCompiler::pConventions = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }
staticprivate

Definition at line 258 of file compiler.hxx.

Referenced by IsCharFlagAllConventions().

ScDocument& ScCompiler::rDoc
private

The documentation for this class was generated from the following files: