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