LibreOffice Module sc (master)  1
Static Public Member Functions | List of all members
XclTokenArrayHelper Class Reference

A helper with Excel specific token array functions. More...

#include <xlformula.hxx>

Inheritance diagram for XclTokenArrayHelper:
[legend]

Static Public Member Functions

static sal_uInt8 GetTokenId (sal_uInt8 nBaseId, sal_uInt8 nTokenClass)
 Returns the classified token ID from a base ID and the token class. More...
 
static sal_uInt8 GetTokenClass (sal_uInt8 nTokenId)
 Returns the token class of the passed token ID. More...
 
static void ChangeTokenClass (sal_uInt8 &rnTokenId, sal_uInt8 nTokenClass)
 Changes the token class in the passed classified token ID. More...
 
static bool GetTokenString (OUString &rString, const ::formula::FormulaToken &rScToken)
 Tries to extract a string from the passed token. More...
 
static bool GetString (OUString &rString, const ScTokenArray &rScTokArr)
 Parses the passed formula and tries to find a single string token, i.e. More...
 
static bool GetStringList (OUString &rStringList, const ScTokenArray &rScTokArr, sal_Unicode cSep)
 Parses the passed formula and tries to find a string token list, i.e. More...
 
static void ConvertStringToList (ScTokenArray &rScTokArr, svl::SharedStringPool &rSPool, sal_Unicode cStringSep)
 Tries to convert a formula that consists of a single string token to a list of strings. More...
 
static bool GetMultipleOpRefs (const ScDocument &rDoc, XclMultipleOpRefs &rRefs, const ScTokenArray &rScTokArr, const ScAddress &rScPos)
 Parses the passed formula and tries to extract references of a multiple operation. More...
 

Detailed Description

A helper with Excel specific token array functions.

The purpose to not add these functions to ScTokenArray is to prevent code changes in low-level Calc headers and to keep the Excel specific source code in the filter directory. Deriving from ScTokenArray is not viable because that would need expensive copy-constructions of the token arrays.

Definition at line 486 of file xlformula.hxx.

Member Function Documentation

void XclTokenArrayHelper::ChangeTokenClass ( sal_uInt8 rnTokenId,
sal_uInt8  nTokenClass 
)
inlinestatic

Changes the token class in the passed classified token ID.

Definition at line 545 of file xlformula.hxx.

References EXC_TOKCLASS_MASK, get_flag(), and set_flag().

Referenced by XclExpFmlaCompImpl::RecalcTokenClass().

void XclTokenArrayHelper::ConvertStringToList ( ScTokenArray rScTokArr,
svl::SharedStringPool rSPool,
sal_Unicode  cStringSep 
)
static

Tries to convert a formula that consists of a single string token to a list of strings.

Removes leading spaces from each token. Example: The formula ="abc\ndef\nghi" will be converted to the formula ="abc";"def";"ghi", if the LF character is specified as separator.

Parameters
rScTokArr(in/out-parameter) The token array to modify.
cStringSepThe separator in the source string.

Definition at line 902 of file xlformula.cxx.

References ScTokenArray::AddOpCode(), formula::FormulaTokenArray::AddString(), ScTokenArray::Clear(), GetString(), svl::SharedStringPool::intern(), ocSep, and comphelper::string::stripStart().

Referenced by XclImpValidationManager::ReadDV().

bool XclTokenArrayHelper::GetMultipleOpRefs ( const ScDocument rDoc,
XclMultipleOpRefs rRefs,
const ScTokenArray rScTokArr,
const ScAddress rScPos 
)
static

Parses the passed formula and tries to extract references of a multiple operation.

Requires that the formula contains a single MULTIPLE.OPERATION function call. Spaces in the formula are silently ignored.

Returns
true = Multiple operation found, and all references successfully extracted.

Definition at line 942 of file xlformula.cxx.

References XclTokenArrayIterator::Is(), XclMultipleOpRefs::maColFirstScPos, XclMultipleOpRefs::maColRelScPos, XclMultipleOpRefs::maFmlaScPos, XclMultipleOpRefs::maRowFirstScPos, XclMultipleOpRefs::maRowRelScPos, XclMultipleOpRefs::mbDblRefMode, ocClose, ocOpen, ocSep, and ocTableOp.

Referenced by XclExpTableopBuffer::CreateOrExtendTableop().

bool XclTokenArrayHelper::GetString ( OUString &  rString,
const ScTokenArray rScTokArr 
)
static

Parses the passed formula and tries to find a single string token, i.e.

"abc".

Parameters
rString(out-parameter) The string contained in the formula.
Returns
true = String token found, rString parameter is valid.

Definition at line 867 of file xlformula.cxx.

References GetTokenString(), and XclTokenArrayIterator::Is().

Referenced by ConvertStringToList().

bool XclTokenArrayHelper::GetStringList ( OUString &  rStringList,
const ScTokenArray rScTokArr,
sal_Unicode  cSep 
)
static

Parses the passed formula and tries to find a string token list, i.e.

"abc";"def";"ghi". Returns the unquoted (!) strings in a single string, separated with the passed character. If a comma is specified, the function will return abc,def,ghi from the example above.

Parameters
rStringList(out-parameter) All strings contained in the formula as list.
cSepList separator character.
Returns
true = String token list found, rString parameter is valid.

Definition at line 874 of file xlformula.cxx.

References formula::FormulaToken::GetOpCode(), GetTokenString(), Is, XclTokenArrayIterator::Is(), and ocSep.

Referenced by XclExpDV::XclExpDV().

static sal_uInt8 XclTokenArrayHelper::GetTokenClass ( sal_uInt8  nTokenId)
inlinestatic

Returns the token class of the passed token ID.

Definition at line 495 of file xlformula.hxx.

References EXC_TOKCLASS_MASK.

Referenced by XclExpFmlaCompImpl::RecalcTokenClass().

sal_uInt8 XclTokenArrayHelper::GetTokenId ( sal_uInt8  nBaseId,
sal_uInt8  nTokenClass 
)
inlinestatic
bool XclTokenArrayHelper::GetTokenString ( OUString &  rString,
const ::formula::FormulaToken rScToken 
)
static

Tries to extract a string from the passed token.

Parameters
rString(out-parameter) The string contained in the token.
Returns
true = Passed token is a string token, rString parameter is valid.

Definition at line 860 of file xlformula.cxx.

References ocPush, and svString.

Referenced by GetString(), and GetStringList().


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