22#include <com/sun/star/beans/Pair.hpp>
23#include <com/sun/star/sheet/FormulaToken.hpp>
24#include <com/sun/star/table/CellAddress.hpp>
30 namespace lang {
class XMultiServiceFactory; }
31 namespace sheet {
class XFormulaParser; }
34namespace oox {
template<
typename Type >
class Matrix; }
36namespace oox {
class SequenceInputStream; }
37namespace oox::xls {
struct BinAddress; }
234 void setBiff12Data( sal_uInt16 nCol, sal_Int32 nRow,
bool bRelativeAsOffset );
281 css::uno::Any&
append( sal_Int32 nOpCode );
284 template<
typename Type >
577 explicit OpCodeProvider(
const css::uno::Reference<css::lang::XMultiServiceFactory>& rxModelFactory,
594 css::uno::Sequence< css::sheet::FormulaOpCodeMapEntry >
609 const css::uno::Reference< css::lang::XMultiServiceFactory >& rxModelFactory,
617 const OUString& rFormula,
621 css::uno::Reference< css::sheet::XFormulaParser >
715 sal_Int32 nFilterBySheet )
const;
766 bool bTrimLeadingSpaces )
const;
A wrapper around the FormulaParser service provided by the Calc document.
css::uno::Reference< css::sheet::XFormulaParser > mxParser
PropertySet maParserProps
ApiParserWrapper(const css::uno::Reference< css::lang::XMultiServiceFactory > &rxModelFactory, const OpCodeProvider &rOpCodeProv)
ApiTokenSequence parseFormula(const OUString &rFormula, const ScAddress &rRefPos)
Calls the XFormulaParser::parseFormula() function of the API parser.
PropertySet & getParserProperties()
Returns read/write access to the formula parser property set.
Token sequence iterator that is able to skip space tokens.
const sal_Int32 mnSpacesOpCode
Pointer behind last token of the token sequence.
ApiTokenIterator & operator++()
const ApiToken * mpTokenEnd
Pointer to current token of the token sequence.
ApiTokenIterator(const ApiTokenSequence &rTokens, sal_Int32 nSpacesOpCode)
const ApiToken * operator->() const
A vector of formula tokens with additional convenience functions.
ApiTokenSequence toSequence() const
Converts to a sequence.
::std::vector< ApiToken > mvTokens
css::uno::Any & append(sal_Int32 nOpCode)
Appends a new token with the passed op-code, returns its data field.
const ApiToken & back() const
ApiToken & operator[](size_t i)
void append(sal_Int32 nOpCode, const Type &rData)
Appends a new token with the passed op-code and data.
void push_back(const ApiToken &rToken)
Iterator working on the mpParamInfos member of the FunctionInfo struct.
const FunctionParamInfo * mpParamInfo
bool isCalcOnlyParam() const
const FunctionParamInfo * mpParamInfoEnd
FunctionParamInfoIterator & operator++()
FunctionParamInfoIterator(const FunctionInfo &rFuncInfo)
bool isExcelOnlyParam() const
Provides access to function info structs for all available sheet functions.
FunctionProvider & operator=(FunctionProvider const &)=delete
const FunctionInfo * getFuncInfoFromMacroName(const OUString &rFuncName) const
Returns the function info for a macro function referred by the EXTERN.CALL function,...
const FunctionInfo * getFuncInfoFromBiff12FuncId(sal_uInt16 nFuncId) const
Returns the function info for a BIFF12 function index, or 0 on error.
FunctionProviderImplRef mxFuncImpl
FunctionProvider(FunctionProvider &&)=default
static FunctionLibraryType getFuncLibTypeFromLibraryName(std::u16string_view rLibraryName)
Returns the library type associated with the passed URL of a function library (function add-in).
virtual ~FunctionProvider()
FunctionProvider(bool bImportFilter)
std::shared_ptr< FunctionProviderImpl > FunctionProviderImplRef
const FunctionInfo * getFuncInfoFromOoxFuncName(const OUString &rFuncName) const
Returns the function info for an OOXML function name, or 0 on error.
FunctionProvider(FunctionProvider const &)=default
const FunctionInfoVector & getFuncs() const
Returns the list of all function infos.
Provides access to API op-codes for all available formula tokens and to function info structs for all...
OpCodeProvider(OpCodeProvider const &)=default
const ApiOpCodes & getOpCodes() const
Returns the structure containing all token op-codes for operators and special tokens used by the Calc...
OpCodeProvider(const css::uno::Reference< css::lang::XMultiServiceFactory > &rxModelFactory, bool bImportFilter)
css::uno::Sequence< css::sheet::FormulaOpCodeMapEntry > getOoxParserMap() const
Returns the op-code map that is used by the OOXML formula parser.
virtual ~OpCodeProvider() override
std::shared_ptr< OpCodeProviderImpl > OpCodeProviderImplRef
OpCodeProvider(OpCodeProvider &&)=default
OpCodeProviderImplRef mxOpCodeImpl
OpCodeProvider & operator=(OpCodeProvider const &)=delete
const FunctionInfo * getFuncInfoFromApiToken(const ApiToken &rToken) const
Returns the function info for an API token, or 0 on error.
Helper class to provide access to global workbook data.
const sal_uInt8 BIFF_TOKID_MEMFUNC
Constant reference subexpression without result.
const sal_uInt8 BIFF_TOKID_ENDSHEET
Start of a sheet reference (BIFF2-BIFF4).
const sal_uInt8 BIFF_TOKID_LT
String concatenation operator.
const sal_uInt16 BIFF_TOK_NLR_REL
NLR: Pivot table name.
const sal_uInt8 BIFF_TOK_NLR_ROWR
NLR: Invalid/deleted.
const sal_uInt16 BIFF_TOK_REF_ROWMASK
Mask to extract BIFF8 column from reference.
const sal_uInt8 BIFF_TOKID_LIST
Intersection operator.
const sal_uInt16 BIFF_TOK_REF_COLREL
Mask to extract BIFF2-BIFF5 row from reference.
const sal_uInt16 BIFF_FUNC_EXTERNCALL
Function identifier of the OFFSET function.
const sal_Int32 BIFF12_TOK_REF_ROWMASK
Mask to extract column from reference (BIFF12).
css::sheet::FormulaToken ApiToken
const sal_uInt8 BIFF_TOK_ATTR_CHOOSE
Start of true condition in IF function.
const sal_uInt8 BIFF_TOKID_GE
Equal operator.
const sal_uInt8 BIFF_TOKID_RANGE
List operator.
const sal_uInt16 BIFF_FUNC_SUM
Function identifier of the IF function.
const sal_uInt8 BIFF_TOK_ATTR_SKIP
Jump array of CHOOSE function.
const sal_uInt8 BIFF_TOKID_REFN
Deleted 2D area reference.
const sal_uInt8 BIFF_TOKID_UMINUS
Unary plus.
const sal_uInt8 BIFF_TOK_ATTR_SPACE_BR
Spaces before next token.
const sal_uInt8 BIFF_TOKCLASS_REF
00-1F: Base tokens.
const sal_uInt16 BIFF_FUNC_COLUMNS
Function identifier of the ROWS function.
const sal_uInt8 BIFF_TOK_NLR_ROWV
NLR: Column index.
const sal_uInt16 BIFF12_TOK_TABLE_COLRANGE
Table reference: Single column.
const sal_uInt8 BIFF_TOKID_NAMEX
const sal_uInt16 BIFF_FUNC_TRUE
Function identifier of the SUM function.
const sal_uInt8 BIFF_TOKID_AREAERR
Deleted 2D cell reference.
const sal_uInt8 BIFF_TOKID_NE
Greater than operator.
const sal_uInt8 BIFF_TOK_ATTR_VOLATILE
TRUE value of a tBool token.
const sal_uInt16 BIFF12_TOK_TABLE_DATA
Table reference: Special [#Headers] range.
const sal_uInt32 BIFF_TOK_NLR_ADDREL
Mask to extract BIFF8 column from NLR.
const sal_uInt8 BIFF_TOK_FUNCVAR_CMDPROMPT
Mask for function/command index.
const sal_uInt8 BIFF_TOKID_REF3D
External reference.
css::uno::Sequence< ApiToken > ApiTokenSequence
const sal_uInt16 BIFF_TOK_FUNCVAR_FUNCIDMASK
Macro command.
const size_t BIFF_TOKARR_MAXLEN
const sal_uInt8 BIFF_MAX_PARAMCOUNT
Maximum parameter count for OOXML/BIFF12 files.
const sal_uInt8 BIFF_TOK_ATTR_ASSIGN
SUM function with one parameter.
const sal_uInt8 BIFF_TOKID_REFERR
Variable reference subexpression.
const sal_uInt16 BIFF12_TOK_TABLE_TOTALS
Table reference: Special [#Data] range.
const sal_uInt8 BIFF_TOKID_TBL
Array or shared formula reference.
const sal_uInt8 BIFF_TOKID_AREAN
Relative 2D cell reference (in names).
const sal_uInt8 BIFF_TOKID_ATTR
Natural language reference (NLR).
const sal_uInt8 BIFF_TOKID_EXP
Placeholder for invalid token id.
const sal_uInt8 BIFF_TOKID_ISECT
Not equal operator.
const sal_uInt16 BIFF12_TOK_REF_COLREL
Mask to extract row from reference (BIFF12).
css::beans::Pair< css::table::CellAddress, sal_Bool > ApiSpecialTokenInfo
Contains the base address and type of a special token representing an array formula or a shared formu...
const sal_uInt8 BIFF_TOKID_SUB
Addition operator.
const sal_uInt8 BIFF_TOKID_NAME
Function, variable number of arguments.
const sal_uInt8 BIFF_TOK_NLR_SCOLR
Stacked NLR: Row index.
RefVector< FunctionInfo > FunctionInfoVector
const sal_uInt16 BIFF12_TOK_REF_ROWREL
True = column is relative (BIFF12).
const sal_uInt8 BIFF_TOKCLASS_ARR
40-5F: Value class tokens.
FormulaType
Function identifier of the WEEKNUM function.
@ SharedFormula
Array (matrix) formula.
const sal_uInt16 BIFF_FUNC_FLOOR
BIFF function id of the EXTERN.CALL function.
const sal_uInt8 BIFF_TOKID_INT
Boolean constant.
const sal_uInt8 BIFF_TOK_NLR_SXNAME
NLR: Invalid/deleted range.
const sal_uInt8 BIFF_TOKID_MEMNOMEM
Deleted reference subexpression.
const sal_uInt8 BIFF_TOK_ATTR_SPACE_SP_PRE
Line breaks before closing parenthesis.
const sal_uInt8 BIFF_TOKID_FUNCVAR
Function, fixed number of arguments.
const sal_uInt16 BIFF12_TOK_TABLE_HEADERS
Table reference: Special [#All] range.
const sal_uInt8 BIFF_TOKID_MUL
Subtraction operator.
const sal_uInt8 BIFF_TOK_ATTR_SPACE
BASIC style assignment.
const sal_uInt8 BIFF_TOKID_GT
Greater than or equal operator.
const sal_uInt8 BIFF_TOK_ATTR_SPACE_BR_CLOSE
Spaces before closing parenthesis.
const sal_uInt8 BIFF_TOK_ARRAY_DOUBLE
Deleted 3D area reference.
const sal_uInt8 BIFF_TOKID_AREAERR3D
Deleted 3D cell reference.
const sal_uInt16 BIFF12_TOK_TABLE_ROW
Table reference: Spaces after separators.
const sal_uInt8 BIFF_TOKID_REFERR3D
3D area reference.
const sal_uInt8 BIFF_TOKID_MEMAREAN
Relative 2D area reference (in names).
const sal_uInt32 BIFF_TOK_NLR_ADDMASK
NLR relative (in appended data).
const sal_uInt8 BIFF_TOKID_AREA
2D cell reference.
const sal_uInt8 BIFF_TOK_ATTR_IFERROR
Leading spaces and volatile formula.
const sal_uInt16 BIFF_TOK_NLR_MASK
True = NLR is relative.
const sal_uInt8 BIFF_TOK_ATTR_SPACE_VOLATILE
Spaces in formula representation.
const sal_uInt8 BIFF_TOK_NLR_SCOLV
Stacked NLR: Value in row.
const sal_uInt8 BIFF_TOKID_LE
Less than operator.
const sal_uInt8 BIFF_TOK_BOOL_TRUE
FALSE value of a tBool token.
const sal_uInt8 BIFF_TOK_NLR_ERR
Table reference: Single cell.
const sal_uInt8 BIFF_TOKID_ERR
End of a sheet reference (BIFF2-BIFF4).
const sal_uInt8 BIFF_TOKID_AREA3D
3D cell reference.
const sal_uInt8 BIFF_TOKID_EQ
Less than or equal operator.
const sal_uInt8 BIFF_TOKID_CONCAT
Power operator.
const sal_uInt8 BIFF_TOKID_PAREN
Percent sign.
const sal_uInt8 BIFF_TOK_NLR_SRANGE
NLR: Range.
const sal_uInt8 BIFF_TOK_ARRAY_BOOL
String value in an array.
const sal_uInt8 OOX_MAX_PARAMCOUNT
Mask for number of appended ranges.
const sal_uInt8 BIFF_TOKID_PERCENT
Unary minus.
const sal_uInt16 BIFF_TOK_REF_COLMASK
True = row is relative (BIFF12).
const sal_uInt8 BIFF_TOKID_MISSARG
Parentheses.
const sal_uInt8 BIFF_TOKCLASS_VAL
20-3F: Reference class tokens.
const sal_uInt8 BIFF_TOKID_MEMERR
Constant reference subexpression.
const sal_uInt16 BIFF12_TOK_TABLE_SP_SEP
Table reference: Spaces in outer brackets.
const sal_uInt8 BIFF_TOKID_REF
Defined name.
const sal_uInt8 BIFF_TOKID_FUNC
Array constant.
const sal_uInt16 BIFF_FUNC_OFFSET
Function identifier of the COLUMNS function.
const sal_uInt16 BIFF12_TOK_TABLE_THISROW
Table reference: Special [#Totals] range.
const sal_uInt8 BIFF_TOKID_MASK
This bit must be null for a valid token identifier.
const sal_uInt8 BIFF_TOK_ARRAY_ERROR
Boolean value in an array.
const sal_uInt8 BIFF_TOK_ATTR_SPACE_BR_OPEN
Spaces before opening parenthesis.
const sal_uInt16 BIFF_FUNC_CEILING
Function identifier of the FLOOR function.
const sal_uInt16 BIFF_FUNC_FALSE
Function identifier of the TRUE function.
const sal_uInt16 BIFF_TOK_REF_ROWREL
True = column is relative.
const sal_uInt8 BIFF_TOKID_SHEET
Special attribute.
const sal_uInt8 BIFF_TOK_ATTR_SPACE_SP
Start of condition in IFERROR function (BIFF12 only).
const sal_uInt16 BIFF12_TOK_TABLE_SP_BRACKETS
Table reference: Special [#This Row] range.
FunctionLibraryType
This enumeration contains constants for all known external libraries containing supported sheet funct...
@ FUNCLIB_EUROTOOL
Unknown library (must be zero).
const sal_uInt8 BIFF_TOK_NLR_SROWR
Stacked NLR: Range.
const sal_uInt16 BIFF_FUNC_IF
Maximum parameter count for BIFF2-BIFF8 files.
const sal_uInt8 BIFF_TOKID_UPLUS
Range operator.
const sal_uInt8 BIFF_TOK_ATTR_SPACE_SP_OPEN
Line breaks before next token.
const sal_uInt8 BIFF_TOKID_NLR
String constant.
const sal_uInt8 BIFF_TOKID_MEMAREA
2D area reference.
const sal_uInt8 BIFF_TOKID_DIV
Multiplication operator.
const sal_uInt16 BIFF12_TOK_TABLE_ALL
Table reference: Range of columns.
const sal_uInt8 BIFF_TOK_ATTR_SPACE_SP_CLOSE
Line breaks before opening parenthesis.
const sal_uInt8 BIFF_TOKID_ADD
Multiple operation reference.
const sal_uInt8 BIFF_TOK_NLR_COLR
NLR: Row index.
const sal_uInt8 BIFF_TOK_NLR_SROWV
Stacked NLR: Column index.
const sal_uInt8 BIFF_TOKID_NUM
Integer constant.
const sal_uInt8 BIFF_TOK_ATTR_IF
Volatile function.
FuncParamValidity
Enumerates validity modes for a function parameter.
@ CalcOnly
Parameter supported by Calc and Excel.
@ ExcelOnly
Parameter supported by Calc only.
const sal_uInt16 BIFF12_TOK_TABLE_CELL
Table reference: Single row.
const sal_uInt16 BIFF_FUNC_HYPERLINK
Function identifier of the CEILING function.
const sal_uInt16 BIFF_FUNC_ROWS
Function identifier of the FALSE function.
const sal_uInt8 BIFF_TOKID_BOOL
Error constant.
const sal_uInt8 BIFF_TOK_ARRAY_STRING
Double value in an array.
const sal_uInt8 BIFF_TOKID_FUNCCE
Reference subexpression (in names) without result.
const sal_uInt8 BIFF_TOK_BOOL_FALSE
Error code in an array.
const sal_uInt8 BIFF_TOKCLASS_MASK
Maximum size of a token array.
const sal_uInt8 BIFF_TOKID_STR
Missing argument.
const sal_uInt8 BIFF_TOKID_NONE
const sal_uInt8 BIFF_TOK_FUNCVAR_COUNTMASK
User prompt for macro commands.
const sal_uInt8 BIFF_TOK_NLR_COLV
NLR: Value in row.
const sal_uInt8 BIFF_TOK_NLR_RANGEERR
Stacked NLR: Value in column.
const sal_uInt16 BIFF_TOK_FUNCVAR_CMD
Spaces before formula (BIFF3).
const sal_uInt8 BIFF_TOK_ATTR_SUM
Skip tokens.
const sal_uInt8 BIFF_TOK_NLR_RANGE
NLR: Value in column.
const sal_uInt16 BIFF12_TOK_REF_COLMASK
Mask for parameter count.
const sal_uInt8 BIFF_TOKID_POWER
Division operator.
const sal_uInt16 BIFF_FUNC_WEEKNUM
Function identifier of the HYPERLINK function.
const sal_uInt8 BIFF_TOKFLAG_INVALID
60-7F: Array class tokens.
const sal_uInt8 BIFF_TOKID_MEMNOMEMN
Reference subexpression (in names).
const sal_uInt16 BIFF12_TOK_TABLE_COLUMN
True = row is relative.
const sal_uInt8 BIFF_TOKID_ARRAY
Floating-point constant.
const sal_uInt8 BIFF_TOKCLASS_NONE
Contains all API op-codes needed to build formulas with tokens.
sal_Int32 OPCODE_PLUS_SIGN
Column separator in constant arrays.
sal_Int32 OPCODE_MISSING
Op-code for common value operands.
sal_Int32 OPCODE_GREATER_EQUAL
Compare greater operator.
sal_Int32 OPCODE_POWER
Division operator.
sal_Int32 OPCODE_NAME
Spaces between other formula tokens.
sal_Int32 OPCODE_DBAREA
Index of a defined name.
sal_Int32 OPCODE_LESS_EQUAL
Compare less operator.
sal_Int32 OPCODE_ARRAY_OPEN
Function parameter separator.
sal_Int32 OPCODE_DDE
Natural language reference.
sal_Int32 OPCODE_ARRAY_COLSEP
Row separator in constant arrays.
sal_Int32 OPCODE_SEP
Closing parenthesis.
sal_Int32 OPCODE_PERCENT
Unary minus sign.
sal_Int32 OPCODE_LESS
Compare not equal operator.
sal_Int32 OPCODE_CLOSE
Opening parenthesis.
sal_Int32 OPCODE_LIST
Range intersection operator.
sal_Int32 OPCODE_INTERSECT
Compare greater or equal operator.
sal_Int32 OPCODE_ADD
Percent sign.
sal_Int32 OPCODE_BAD
Macro function call.
sal_Int32 OPCODE_OPEN
Function style #NAME? error.
sal_Int32 OPCODE_NLR
Index of a database area.
sal_Int32 OPCODE_MACRO
DDE link function.
sal_Int32 OPCODE_SUB
Addition operator.
sal_Int32 OPCODE_RANGE
Range list operator.
sal_Int32 OPCODE_NOT_EQUAL
Compare equal operator.
sal_Int32 OPCODE_MULT
Subtraction operator.
sal_Int32 OPCODE_NONAME
Bad token (unknown name, formula error).
sal_Int32 OPCODE_ARRAY_ROWSEP
Closing brace for constant arrays.
sal_Int32 OPCODE_SPACES
Placeholder for a missing function parameter.
sal_Int32 OPCODE_ARRAY_CLOSE
Opening brace for constant arrays.
sal_Int32 OPCODE_EXTERNAL
Internal: function name unknown to mapper.
sal_Int32 OPCODE_CONCAT
Power operator.
sal_Int32 OPCODE_EQUAL
String concatenation operator.
sal_Int32 OPCODE_PUSH
External function call (e.g. add-ins).
sal_Int32 OPCODE_MINUS_SIGN
Unary plus sign.
sal_Int32 OPCODE_GREATER
Compare less or equal operator.
sal_Int32 OPCODE_DIV
Multiplication operator.
A 2D cell address struct for binary filters.
A 2D formula cell range reference struct with relative flags.
BinSingleRef2d maRef2
Start (top-left) cell address.
void readBiff12Data(SequenceInputStream &rStrm, bool bRelativeAsOffset)
End (bottom-right) cell address.
A 2D formula cell reference struct with relative flags.
BinSingleRef2d()
True = relative row reference.
void setBiff12Data(sal_uInt16 nCol, sal_Int32 nRow, bool bRelativeAsOffset)
bool mbRowRel
True = relative column reference.
sal_Int32 mnRow
Column index.
void readBiff12Data(SequenceInputStream &rStrm, bool bRelativeAsOffset)
Represents information for a spreadsheet function.
FunctionLibraryType meFuncLibType
Programmatic function name for external functions.
OUString maBiffMacroName
OOXML function name.
bool mbExternal
True = volatile function.
sal_uInt16 mnBiffFuncId
BIFF12 function identifier.
const FunctionParamInfo * mpParamInfos
BIFF token class of the return value.
sal_uInt8 mnRetClass
Maximum number of parameters.
bool mbParamPairs
Information about all parameters.
OUString maExtProgName
Expected macro name in EXTERN.CALL function.
sal_Int32 mnApiOpCode
The external library this function is part of.
sal_uInt8 mnMinParamCount
BIFF2-BIFF8 function identifier.
bool mbVarParam
True = macro sheet function or command.
bool mbMacroFunc
True = internal function in Calc. (Both can be true!)
sal_uInt8 mnMaxParamCount
Minimum number of parameters.
bool mbInternal
True = external function in Calc.
OUString maOoxFuncName
ODF function name.
bool mbVolatile
True = optional parameters are expected to appear in pairs.
sal_uInt16 mnBiff12FuncId
API function opcode.
Structure that contains all needed information for a parameter in a function.
FuncParamValidity meValid