LibreOffice Module sc (master)  1
xlformula.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #pragma once
21 
22 #include <osl/diagnose.h>
23 #include <formula/opcode.hxx>
24 #include <address.hxx>
25 #include "ftools.hxx"
26 #include <map>
27 #include <memory>
28 
29 namespace svl {
30 
31 class SharedStringPool;
32 
33 }
34 
35 // Constants ==================================================================
36 
37 const size_t EXC_TOKARR_MAXLEN = 4096;
38 
39 // Token class flags ----------------------------------------------------------
40 
46 
47 // Base tokens ----------------------------------------------------------------
48 
50 
51 const sal_uInt8 EXC_TOKID_NONE = 0x00;
52 const sal_uInt8 EXC_TOKID_EXP = 0x01;
53 const sal_uInt8 EXC_TOKID_TBL = 0x02;
54 const sal_uInt8 EXC_TOKID_ADD = 0x03;
55 const sal_uInt8 EXC_TOKID_SUB = 0x04;
56 const sal_uInt8 EXC_TOKID_MUL = 0x05;
57 const sal_uInt8 EXC_TOKID_DIV = 0x06;
58 const sal_uInt8 EXC_TOKID_POWER = 0x07;
60 const sal_uInt8 EXC_TOKID_LT = 0x09;
61 const sal_uInt8 EXC_TOKID_LE = 0x0A;
62 const sal_uInt8 EXC_TOKID_EQ = 0x0B;
63 const sal_uInt8 EXC_TOKID_GE = 0x0C;
64 const sal_uInt8 EXC_TOKID_GT = 0x0D;
65 const sal_uInt8 EXC_TOKID_NE = 0x0E;
66 const sal_uInt8 EXC_TOKID_ISECT = 0x0F;
67 const sal_uInt8 EXC_TOKID_LIST = 0x10;
68 const sal_uInt8 EXC_TOKID_RANGE = 0x11;
69 const sal_uInt8 EXC_TOKID_UPLUS = 0x12;
72 const sal_uInt8 EXC_TOKID_PAREN = 0x15;
74 const sal_uInt8 EXC_TOKID_STR = 0x17;
75 const sal_uInt8 EXC_TOKID_NLR = 0x18;
76 const sal_uInt8 EXC_TOKID_ATTR = 0x19;
77 const sal_uInt8 EXC_TOKID_SHEET = 0x1A;
79 const sal_uInt8 EXC_TOKID_ERR = 0x1C;
80 const sal_uInt8 EXC_TOKID_BOOL = 0x1D;
81 const sal_uInt8 EXC_TOKID_INT = 0x1E;
82 const sal_uInt8 EXC_TOKID_NUM = 0x1F;
83 
84 // Base IDs of classified tokens ----------------------------------------------
85 
86 const sal_uInt8 EXC_TOKID_ARRAY = 0x00;
87 const sal_uInt8 EXC_TOKID_FUNC = 0x01;
89 const sal_uInt8 EXC_TOKID_NAME = 0x03;
90 const sal_uInt8 EXC_TOKID_REF = 0x04;
91 const sal_uInt8 EXC_TOKID_AREA = 0x05;
98 const sal_uInt8 EXC_TOKID_REFN = 0x0C;
99 const sal_uInt8 EXC_TOKID_AREAN = 0x0D;
108 
109 // specific token constants ---------------------------------------------------
110 
111 const sal_uInt16 EXC_TOK_STR_MAXLEN = 255;
112 
115 
123 
131 
132 const sal_uInt16 EXC_TOK_FUNCVAR_CMD = 0x8000;
133 const sal_uInt16 EXC_TOK_FUNCVAR_INDEXMASK = 0x7FFF;
136 
137 const sal_uInt16 EXC_TOK_REF_COLREL = 0x4000;
138 const sal_uInt16 EXC_TOK_REF_ROWREL = 0x8000;
139 
153 const sal_uInt16 EXC_TOK_NLR_REL = 0x8000;
154 
155 const sal_uInt32 EXC_TOK_NLR_ADDREL = 0x80000000;
156 const sal_uInt32 EXC_TOK_NLR_ADDMASK = 0x3FFFFFFF;
157 
160 {
171 };
172 
173 // Function parameter info ====================================================
174 
177 {
182 };
183 
186 {
193 };
194 
276 {
279  bool mbValType;
280 };
281 
282 // Function data ==============================================================
283 
285 
287 
293 
294 // selected function IDs
295 const sal_uInt16 EXC_FUNCID_IF = 1;
296 const sal_uInt16 EXC_FUNCID_SUM = 4;
297 const sal_uInt16 EXC_FUNCID_AND = 36;
298 const sal_uInt16 EXC_FUNCID_OR = 37;
299 const sal_uInt16 EXC_FUNCID_CHOOSE = 100;
300 const sal_uInt16 EXC_FUNCID_EXTERNCALL = 255;
301 
311 {
313  sal_uInt16 mnXclFunc;
319  const char* mpcMacroName;
326  bool IsVolatile() const { return ::get_flag( mnFlags, EXC_FUNCFLAG_VOLATILE ); }
330  bool IsFixedParamCount() const { return (mnXclFunc != EXC_FUNCID_EXTERNCALL) && (mnMinParamCount == mnMaxParamCount); }
332  bool IsMacroFunc() const { return mpcMacroName != nullptr && !(mnFlags & EXC_FUNCFLAG_ADDINEQUIV); }
334  bool IsAddInEquivalent() const { return mpcMacroName != nullptr && (mnFlags & EXC_FUNCFLAG_ADDINEQUIV); }
336  OUString GetMacroFuncName() const;
338  OUString GetAddInEquivalentFuncName() const;
339 };
340 
341 class XclRoot;
342 
345 {
346 public:
347  explicit XclFunctionProvider( const XclRoot& rRoot );
348 
350  const XclFunctionInfo* GetFuncInfoFromXclFunc( sal_uInt16 nXclFunc ) const;
352  const XclFunctionInfo* GetFuncInfoFromXclMacroName( const OUString& rXclMacroName ) const;
354  const XclFunctionInfo* GetFuncInfoFromOpCode( OpCode eOpCode ) const;
355 
356 private:
357  void FillXclFuncMap( const XclFunctionInfo* pBeg, const XclFunctionInfo* pEnd );
358  void FillScFuncMap( const XclFunctionInfo* pBeg, const XclFunctionInfo* pEnd );
359 
360 private:
361  typedef ::std::map< sal_uInt16, const XclFunctionInfo* > XclFuncMap;
362  typedef ::std::map< OUString, const XclFunctionInfo* > XclMacroNameMap;
363  typedef ::std::map< OpCode, const XclFunctionInfo* > ScFuncMap;
364 
365  XclFuncMap maXclFuncMap;
366  XclMacroNameMap maXclMacroNameMap;
367  ScFuncMap maScFuncMap;
368 };
369 
370 // Token array ================================================================
371 
372 class XclImpStream;
373 class XclExpStream;
374 
377 {
378 public:
380  explicit XclTokenArray( bool bVolatile = false );
382  explicit XclTokenArray( ScfUInt8Vec& rTokVec, ScfUInt8Vec& rExtDataVec, bool bVolatile = false );
383 
385  bool Empty() const { return maTokVec.empty(); }
387  sal_uInt16 GetSize() const;
389  const sal_uInt8* GetData() const { return maTokVec.empty() ? nullptr : maTokVec.data(); }
391  bool IsVolatile() const { return mbVolatile; }
392 
394  static sal_uInt16 ReadSize(XclImpStream& rStrm);
396  void ReadArray(sal_uInt16 nSize, XclImpStream& rStrm);
398  void Read( XclImpStream& rStrm );
399 
401  void WriteSize( XclExpStream& rStrm ) const;
403  void WriteArray( XclExpStream& rStrm ) const;
405  void Write( XclExpStream& rStrm ) const;
406 
408  bool operator==( const XclTokenArray& rTokArr ) const;
409 
410 private:
413  bool mbVolatile;
414 };
415 
416 typedef std::shared_ptr< XclTokenArray > XclTokenArrayRef;
417 
421 XclExpStream& operator<<( XclExpStream& rStrm, const XclTokenArray& rTokArr );
423 XclExpStream& operator<<( XclExpStream& rStrm, const XclTokenArrayRef& rxTokArr );
424 
425 namespace formula { class FormulaToken; }
426 class ScTokenArray;
427 
439 {
440 public:
441  explicit XclTokenArrayIterator();
442  explicit XclTokenArrayIterator( const ScTokenArray& rScTokArr, bool bSkipSpaces );
444  explicit XclTokenArrayIterator( const XclTokenArrayIterator& rTokArrIt, bool bSkipSpaces );
445 
446  void Init( const ScTokenArray& rScTokArr, bool bSkipSpaces );
447 
448  bool Is() const { return mppScToken != nullptr; }
449  bool operator!() const { return !Is(); }
450  const ::formula::FormulaToken* Get() const { return mppScToken ? *mppScToken : nullptr; }
451  const ::formula::FormulaToken* operator->() const { return Get(); }
452  const ::formula::FormulaToken& operator*() const { return *Get(); }
453 
455 
456 private:
457  void NextRawToken();
458  void SkipSpaces();
459 
460 private:
461  const ::formula::FormulaToken*const* mppScTokenBeg;
462  const ::formula::FormulaToken*const* mppScTokenEnd;
463  const ::formula::FormulaToken*const* mppScToken;
465 };
466 
469 {
476 };
477 
486 {
487 public:
488  // token identifiers ------------------------------------------------------
489 
491  inline static sal_uInt8 GetTokenId( sal_uInt8 nBaseId, sal_uInt8 nTokenClass );
492 
494  static sal_uInt8 GetTokenClass( sal_uInt8 nTokenId ) { return nTokenId & EXC_TOKCLASS_MASK; }
496  inline static void ChangeTokenClass( sal_uInt8& rnTokenId, sal_uInt8 nTokenClass );
497 
498  // strings and string lists -----------------------------------------------
499 
503  static bool GetTokenString( OUString& rString, const ::formula::FormulaToken& rScToken );
504 
508  static bool GetString( OUString& rString, const ScTokenArray& rScTokArr );
509 
517  static bool GetStringList( OUString& rStringList, const ScTokenArray& rScTokArr, sal_Unicode cSep );
518 
525  static void ConvertStringToList(
526  ScTokenArray& rScTokArr, svl::SharedStringPool& rSPool, sal_Unicode cStringSep );
527 
528  // multiple operations ----------------------------------------------------
529 
534  static bool GetMultipleOpRefs( const ScDocument& rDoc, XclMultipleOpRefs& rRefs, const ScTokenArray& rScTokArr, const ScAddress& rScPos );
535 };
536 
538 {
539  OSL_ENSURE( !::get_flag( nBaseId, static_cast< sal_uInt8 >( ~EXC_TOKID_MASK ) ), "XclTokenArrayHelper::GetTokenId - invalid token ID" );
540  OSL_ENSURE( !::get_flag( nTokenClass, static_cast< sal_uInt8 >( ~EXC_TOKCLASS_MASK ) ), "XclTokenArrayHelper::GetTokenId - invalid token class" );
541  return nBaseId | nTokenClass;
542 }
543 
544 inline void XclTokenArrayHelper::ChangeTokenClass( sal_uInt8& rnTokenId, sal_uInt8 nTokenClass )
545 {
546  OSL_ENSURE( !::get_flag( nTokenClass, static_cast< sal_uInt8 >( ~EXC_TOKCLASS_MASK ) ), "XclTokenArrayHelper::ChangeTokenClass - invalid token class" );
547  ::set_flag( rnTokenId, EXC_TOKCLASS_MASK, false );
548  ::set_flag( rnTokenId, nTokenClass );
549 }
550 
551 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const XclFunctionInfo * GetFuncInfoFromXclMacroName(const OUString &rXclMacroName) const
Returns the function data for an Excel function simulated by a macro call, or 0 on error...
Definition: xlformula.cxx:684
const sal_uInt8 EXC_TOKID_PAREN
Percent sign.
Definition: xlformula.hxx:72
const sal_uInt8 EXC_TOKID_AREAERR
Deleted 2D cell reference.
Definition: xlformula.hxx:97
const sal_uInt8 EXC_FUNCFLAG_VOLATILE
Number of parameter info entries.
Definition: xlformula.hxx:288
const sal_uInt8 EXC_FUNC_MAXPARAM
Definition: xlformula.hxx:284
const sal_uInt8 EXC_TOK_NLR_SXNAME
NLR: Invalid/deleted range.
Definition: xlformula.hxx:152
static void ChangeTokenClass(sal_uInt8 &rnTokenId, sal_uInt8 nTokenClass)
Changes the token class in the passed classified token ID.
Definition: xlformula.hxx:544
::std::vector< sal_uInt8 > ScfUInt8Vec
Definition: ftools.hxx:253
const sal_uInt8 EXC_TOKID_ARRAY
Floating-point constant.
Definition: xlformula.hxx:86
const XclFunctionInfo * GetFuncInfoFromXclFunc(sal_uInt16 nXclFunc) const
Returns the function data for an Excel function index, or 0 on error.
Definition: xlformula.cxx:676
bool Is() const
Definition: xlformula.hxx:448
const sal_uInt8 EXC_TOKID_LE
Less than operator.
Definition: xlformula.hxx:61
static sal_uInt16 ReadSize(XclImpStream &rStrm)
Reads the size field of the token array.
Definition: xlformula.cxx:741
ScAddress maRowFirstScPos
Definition: xlformula.hxx:473
const sal_uInt8 EXC_TOKID_MEMAREAN
Relative 2D area reference (in names).
Definition: xlformula.hxx:100
const sal_uInt8 EXC_TOKID_STR
Missing argument.
Definition: xlformula.hxx:74
const sal_uInt32 EXC_TOK_NLR_ADDREL
True = Natural language ref is relative.
Definition: xlformula.hxx:155
This class is used to export Excel record streams.
Definition: xestream.hxx:72
bool IsFixedParamCount() const
Returns true, if the function parameter count is fixed.
Definition: xlformula.hxx:330
const sal_uInt8 EXC_TOK_ATTR_SPACE_SP_OPEN
Line breaks before next token.
Definition: xlformula.hxx:126
const sal_uInt8 EXC_TOKID_MASK
60-7F: Array class tokens.
Definition: xlformula.hxx:49
void FillXclFuncMap(const XclFunctionInfo *pBeg, const XclFunctionInfo *pEnd)
Definition: xlformula.cxx:700
const sal_uInt8 EXC_TOK_NLR_ROWV
NLR: Column index.
Definition: xlformula.hxx:143
const sal_uInt8 EXC_TOKCLASS_REF
00-1F: Base tokens.
Definition: xlformula.hxx:43
bool mbValType
Token class conversion type.
Definition: xlformula.hxx:279
const sal_uInt8 EXC_TOKID_REF
Defined name.
Definition: xlformula.hxx:90
const sal_uInt8 EXC_TOKID_REFERR3D
3D area reference.
Definition: xlformula.hxx:106
const sal_uInt8 EXC_TOKID_CONCAT
Power operator.
Definition: xlformula.hxx:59
const sal_uInt8 EXC_TOKID_GE
Equal operator.
Definition: xlformula.hxx:63
const sal_uInt8 EXC_TOKID_MEMFUNC
Constant reference subexpression without result.
Definition: xlformula.hxx:95
Convert tokens to VAL class.
Definition: xlformula.hxx:189
const sal_uInt8 EXC_FUNCFLAG_PARAMPAIRS
Only used in export filter.
Definition: xlformula.hxx:291
const sal_uInt8 EXC_TOK_ATTR_GOTO
Jump array of CHOOSE function.
Definition: xlformula.hxx:119
Conditional format.
Definition: xlformula.hxx:165
const sal_uInt8 EXC_TOKID_LT
String concatenation operator.
Definition: xlformula.hxx:60
Parameter supported by Calc only.
Definition: xlformula.hxx:181
const sal_uInt8 EXC_TOK_ATTR_SPACE_BR
Spaces before next token.
Definition: xlformula.hxx:125
bool IsMacroFunc() const
Returns true, if the function is simulated by a macro call.
Definition: xlformula.hxx:332
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.
Definition: xlformula.cxx:893
const sal_uInt8 EXC_TOKID_MEMAREA
2D area reference.
Definition: xlformula.hxx:92
const sal_uInt8 EXC_TOKCLASS_ARR
40-5F: Value class tokens.
Definition: xlformula.hxx:45
static bool GetTokenString(OUString &rString, const ::formula::FormulaToken &rScToken)
Tries to extract a string from the passed token.
Definition: xlformula.cxx:879
const sal_uInt8 EXC_TOK_BOOL_TRUE
sal_False value of a tBool token.
Definition: xlformula.hxx:114
void set_flag(Type &rnBitField, Type nMask, bool bSet=true)
Sets or clears (according to bSet) all set bits of nMask in rnBitField.
Definition: ftools.hxx:95
sal_uInt16 GetSize() const
Returns the size of the token array in bytes.
Definition: xlformula.cxx:735
void Write(XclExpStream &rStrm) const
Writes size field and the tokens.
Definition: xlformula.cxx:789
const sal_uInt16 EXC_FUNCID_IF
Function is an add-in equivalent.
Definition: xlformula.hxx:295
const sal_uInt8 EXC_TOKID_AREA3D
3D cell reference.
Definition: xlformula.hxx:105
Parameter supported by Calc and Excel.
Definition: xlformula.hxx:180
const sal_uInt16 EXC_TOK_FUNCVAR_INDEXMASK
Macro command.
Definition: xlformula.hxx:133
Shared formula.
Definition: xlformula.hxx:164
::std::map< OpCode, const XclFunctionInfo * > ScFuncMap
Definition: xlformula.hxx:363
const sal_uInt8 EXC_TOKID_NAMEX
Definition: xlformula.hxx:103
const sal_uInt8 EXC_TOKID_BOOL
Error constant.
Definition: xlformula.hxx:80
const sal_uInt8 EXC_TOKCLASS_MASK
Maximum size of a token array.
Definition: xlformula.hxx:41
const size_t EXC_FUNCINFO_PARAMINFO_COUNT
Maximum parameter count.
Definition: xlformula.hxx:286
const sal_uInt8 EXC_TOKID_TBL
Array or shared formula reference.
Definition: xlformula.hxx:53
Web query source range.
Definition: xlformula.hxx:170
void WriteSize(XclExpStream &rStrm) const
Writes the size field of the token array.
Definition: xlformula.cxx:776
const sal_uInt8 EXC_FUNCFLAG_IMPORTONLY
Result is volatile (e.g. NOW() function).
Definition: xlformula.hxx:289
XclFuncParamConv
Enumerates different types of token class conversion in function parameters.
Definition: xlformula.hxx:185
const sal_uInt16 EXC_FUNCID_CHOOSE
Definition: xlformula.hxx:299
const sal_uInt8 EXC_TOKID_NONE
Definition: xlformula.hxx:51
void ReadArray(sal_uInt16 nSize, XclImpStream &rStrm)
Reads the tokens of the token array (without size field).
Definition: xlformula.cxx:746
const sal_uInt16 EXC_TOK_FUNCVAR_CMD
Spaces before formula (BIFF3).
Definition: xlformula.hxx:132
const sal_uInt8 EXC_TOKID_ADD
Multiple operation reference.
Definition: xlformula.hxx:54
const sal_uInt8 EXC_TOKCLASS_NONE
Definition: xlformula.hxx:42
const sal_uInt8 EXC_TOKID_MEMNOMEMN
Reference subexpression (in names).
Definition: xlformula.hxx:101
sal_uInt16 sal_Unicode
XclFormulaType
Mask for number of appended ranges.
Definition: xlformula.hxx:159
const sal_uInt8 EXC_TOKID_LIST
Intersection operator.
Definition: xlformula.hxx:67
const sal_uInt8 EXC_TOK_FUNCVAR_COUNTMASK
User prompt for macro commands.
Definition: xlformula.hxx:135
const sal_uInt8 EXC_TOK_NLR_SCOLV
Stacked NLR: Value in row.
Definition: xlformula.hxx:150
const sal_uInt16 EXC_TOK_REF_ROWREL
True = Column is relative.
Definition: xlformula.hxx:138
static sal_uInt8 GetTokenId(sal_uInt8 nBaseId, sal_uInt8 nTokenClass)
Returns the classified token ID from a base ID and the token class.
Definition: xlformula.hxx:537
const sal_uInt8 EXC_TOKID_GT
Greater than or equal operator.
Definition: xlformula.hxx:64
bool Empty() const
Returns true, if the token array is empty.
Definition: xlformula.hxx:385
ScAddress maFmlaScPos
Definition: xlformula.hxx:470
const sal_uInt8 EXC_TOKID_NE
Greater than operator.
Definition: xlformula.hxx:65
OpCode
const sal_uInt8 EXC_TOKID_REF3D
External reference.
Definition: xlformula.hxx:104
void WriteArray(XclExpStream &rStrm) const
Writes the tokens of the token array (without size field).
Definition: xlformula.cxx:781
const sal_uInt16 EXC_FUNCID_SUM
Definition: xlformula.hxx:296
const sal_uInt8 EXC_FUNCFLAG_ADDINEQUIV
Optional parameters are expected to appear in pairs.
Definition: xlformula.hxx:292
const sal_uInt8 EXC_TOKID_FUNCVAR
Function, fixed number of arguments.
Definition: xlformula.hxx:88
const sal_uInt8 EXC_TOKID_AREA
2D cell reference.
Definition: xlformula.hxx:91
ScAddress maColRelScPos
Definition: xlformula.hxx:472
const sal_uInt8 EXC_TOKID_UMINUS
Unary plus.
Definition: xlformula.hxx:70
const sal_uInt8 EXC_TOKID_NAME
Function, variable number of arguments.
Definition: xlformula.hxx:89
const sal_uInt8 EXC_TOKID_NUM
Integer constant.
Definition: xlformula.hxx:82
const sal_uInt8 * GetData() const
Returns read-only access to the byte vector storing token data.
Definition: xlformula.hxx:389
const sal_uInt8 EXC_TOK_NLR_SRANGE
NLR: Range.
Definition: xlformula.hxx:146
XclMacroNameMap maXclMacroNameMap
Maps Excel function indexes to function data.
Definition: xlformula.hxx:366
bool mbSkipSpaces
Pointer to current token pointer of token array.
Definition: xlformula.hxx:464
const sal_uInt8 EXC_TOKID_AREAERR3D
Deleted 3D cell reference.
Definition: xlformula.hxx:107
const ::formula::FormulaToken *const * mppScTokenEnd
Pointer to first token pointer of token array.
Definition: xlformula.hxx:462
const sal_uInt8 EXC_TOK_NLR_RANGE
NLR: Value in column.
Definition: xlformula.hxx:145
const sal_uInt8 EXC_TOK_NLR_ERR
True = Row is relative.
Definition: xlformula.hxx:140
const sal_uInt8 EXC_TOKID_UPLUS
Range operator.
Definition: xlformula.hxx:69
Matrix (array) formula.
Definition: xlformula.hxx:163
const sal_uInt8 EXC_TOKID_SUB
Addition operator.
Definition: xlformula.hxx:55
const sal_uInt8 EXC_FUNCFLAG_EXPORTONLY
Only used in import filter.
Definition: xlformula.hxx:290
const sal_uInt32 EXC_TOK_NLR_ADDMASK
NLR relative (in appended data).
Definition: xlformula.hxx:156
const sal_uInt8 EXC_TOKID_ERR
End of a sheet reference (BIFF2-BIFF4).
Definition: xlformula.hxx:79
XclExpStream & operator<<(XclExpStream &rStrm, const XclTokenArray &rTokArr)
Calls the Write() function at the passed token array.
Definition: xlformula.cxx:806
const sal_uInt8 EXC_TOK_FUNCVAR_PROMPT
Mask for function/command index.
Definition: xlformula.hxx:134
const sal_uInt8 EXC_TOK_NLR_ROWR
NLR: Invalid/deleted.
Definition: xlformula.hxx:141
const sal_uInt8 EXC_TOK_NLR_SCOLR
Stacked NLR: Row index.
Definition: xlformula.hxx:148
Represents information for a spreadsheet function for import and export.
Definition: xlformula.hxx:310
const sal_uInt8 EXC_TOKID_REFN
Deleted 2D area reference.
Definition: xlformula.hxx:98
Defined name.
Definition: xlformula.hxx:167
XclFuncParamValidity meValid
Definition: xlformula.hxx:277
const size_t EXC_TOKARR_MAXLEN
Definition: xlformula.hxx:37
OUString GetAddInEquivalentFuncName() const
Returns the programmatical name of the Add-In function as string.
Definition: xlformula.cxx:42
const sal_uInt8 EXC_TOK_ATTR_SPACE_SP_CLOSE
Line breaks before opening parenthesis.
Definition: xlformula.hxx:128
const sal_uInt8 EXC_TOK_ATTR_SPACE_SP
Spaces in formula representation.
Definition: xlformula.hxx:124
const sal_uInt8 EXC_TOK_ATTR_IF
Volatile function.
Definition: xlformula.hxx:117
const sal_uInt8 EXC_TOKID_ATTR
Natural language reference (NLR).
Definition: xlformula.hxx:76
bool operator!() const
Definition: xlformula.hxx:449
const XclFunctionInfo * GetFuncInfoFromOpCode(OpCode eOpCode) const
Returns the function data for a Calc opcode, or 0 on error.
Definition: xlformula.cxx:692
ScfUInt8Vec maExtDataVec
Byte vector containing token data.
Definition: xlformula.hxx:412
ScFuncMap maScFuncMap
Maps macro function names to function data.
Definition: xlformula.hxx:367
sal_uInt8 mnRetClass
Maximum number of parameters.
Definition: xlformula.hxx:316
const sal_uInt16 EXC_TOK_NLR_REL
NLR: Pivot table name.
Definition: xlformula.hxx:153
const sal_uInt16 EXC_FUNCID_AND
Definition: xlformula.hxx:297
XclTokenArray(bool bVolatile=false)
Creates an empty token array.
Definition: xlformula.cxx:723
const sal_uInt8 EXC_TOK_NLR_COLV
NLR: Value in row.
Definition: xlformula.hxx:144
Repeat parent conversion in VALTYPE parameters.
Definition: xlformula.hxx:191
const sal_uInt8 EXC_TOKID_ENDSHEET
Start of a sheet reference (BIFF2-BIFF4).
Definition: xlformula.hxx:78
bool get_flag(Type nBitField, Type nMask)
Returns true, if at least one of the bits set in nMask is set in nBitField.
Definition: ftools.hxx:75
const sal_uInt8 EXC_TOK_ATTR_SPACE
BASIC style assignment.
Definition: xlformula.hxx:122
const sal_uInt8 EXC_TOKID_RANGE
List operator.
Definition: xlformula.hxx:68
const sal_uInt8 EXC_TOKID_EQ
Less than or equal operator.
Definition: xlformula.hxx:62
sal_uInt8 mnMaxParamCount
Minimum number of parameters.
Definition: xlformula.hxx:315
const ::formula::FormulaToken * Get() const
Definition: xlformula.hxx:450
const sal_uInt8 EXC_TOKID_NLR
String constant.
Definition: xlformula.hxx:75
const sal_uInt8 EXC_TOK_NLR_COLR
NLR: Row index.
Definition: xlformula.hxx:142
void FillScFuncMap(const XclFunctionInfo *pBeg, const XclFunctionInfo *pEnd)
Definition: xlformula.cxx:714
const char * mpcMacroName
Additional flags (EXC_FUNCFLAG_* constants).
Definition: xlformula.hxx:319
sal_uInt8 mnMinParamCount
Excel function index.
Definition: xlformula.hxx:314
std::shared_ptr< XclTokenArray > XclTokenArrayRef
Definition: xlformula.hxx:416
Provides access to function info structs for all available functions.
Definition: xlformula.hxx:344
const sal_uInt8 EXC_TOKID_MISSARG
Parentheses.
Definition: xlformula.hxx:73
const sal_uInt16 EXC_TOK_STR_MAXLEN
Deleted 3D area reference.
Definition: xlformula.hxx:111
const sal_uInt8 EXC_TOKCLASS_VAL
20-3F: Reference class tokens.
Definition: xlformula.hxx:44
const sal_uInt8 EXC_TOK_ATTR_CHOOSE
Start of true condition in IF function.
Definition: xlformula.hxx:118
bool IsParamPairs() const
Returns true, if optional parameters are expected to appear in pairs.
Definition: xlformula.hxx:328
const sal_uInt8 EXC_TOK_BOOL_FALSE
Maximum string length of a tStr token.
Definition: xlformula.hxx:113
XclTokenArrayIterator & operator++()
Definition: xlformula.cxx:853
Binary representation of an Excel token array.
Definition: xlformula.hxx:376
const sal_uInt8 EXC_TOKID_PERCENT
Unary minus.
Definition: xlformula.hxx:71
static sal_uInt8 GetTokenClass(sal_uInt8 nTokenId)
Returns the token class of the passed token ID.
Definition: xlformula.hxx:494
const sal_uInt8 EXC_TOKID_ISECT
Not equal operator.
Definition: xlformula.hxx:66
::std::map< sal_uInt16, const XclFunctionInfo * > XclFuncMap
Definition: xlformula.hxx:361
Contains all cell references that can be extracted from a multiple operations formula.
Definition: xlformula.hxx:468
bool IsVolatile() const
Returns true, if the formula contains a volatile function.
Definition: xlformula.hxx:391
unsigned char sal_uInt8
ScAddress maRowRelScPos
Definition: xlformula.hxx:474
Convert tokens to ARR class.
Definition: xlformula.hxx:190
const sal_uInt8 EXC_TOKID_POWER
Division operator.
Definition: xlformula.hxx:58
const ::formula::FormulaToken *const * mppScToken
Pointer behind last token pointer of token array.
Definition: xlformula.hxx:463
void Read(XclImpStream &rStrm)
Reads size field and the tokens.
Definition: xlformula.cxx:771
const ::formula::FormulaToken * operator->() const
Definition: xlformula.hxx:451
const sal_uInt8 EXC_TOK_ATTR_SPACE_BR_OPEN
Spaces before opening parenthesis.
Definition: xlformula.hxx:127
const sal_uInt8 EXC_TOKID_MUL
Subtraction operator.
Definition: xlformula.hxx:56
const sal_uInt16 EXC_FUNCID_OR
Definition: xlformula.hxx:298
const sal_uInt8 EXC_TOKID_INT
Boolean constant.
Definition: xlformula.hxx:81
const sal_uInt8 EXC_TOK_ATTR_SPACE_BR_CLOSE
Spaces before closing parenthesis.
Definition: xlformula.hxx:129
XclImpStream & operator>>(XclImpStream &rStrm, XclTokenArray &rTokArr)
Calls the Read() function at the passed token array.
Definition: xlformula.cxx:800
XclFuncParamConv meConv
Parameter validity.
Definition: xlformula.hxx:278
const sal_uInt8 EXC_TOK_ATTR_SPACE_SP_PRE
Line breaks before closing parenthesis.
Definition: xlformula.hxx:130
These need to be in global namespace just like their respective types are.
Simple cell formula, also used in change tracking.
Definition: xlformula.hxx:162
const sal_uInt16 EXC_FUNCID_EXTERNCALL
Definition: xlformula.hxx:300
XclFuncParamValidity
Enumerates validity modes for a function parameter.
Definition: xlformula.hxx:176
const sal_uInt8 EXC_TOKID_FUNCCE
Reference subexpression (in names) without result.
Definition: xlformula.hxx:102
const ::formula::FormulaToken & operator*() const
Definition: xlformula.hxx:452
const sal_uInt8 EXC_TOK_NLR_SROWR
Stacked NLR: Range.
Definition: xlformula.hxx:147
const sal_uInt8 EXC_TOK_ATTR_ASSIGN
SUM function with one parameter.
Definition: xlformula.hxx:121
const sal_uInt8 EXC_TOKID_MEMNOMEM
Deleted reference subexpression.
Definition: xlformula.hxx:94
Data validation.
Definition: xlformula.hxx:166
const sal_uInt8 EXC_TOK_ATTR_SUM
Jump to token.
Definition: xlformula.hxx:120
bool operator==(const XclTokenArray &rTokArr) const
Compares this token array with the passed.
Definition: xlformula.cxx:795
const sal_uInt8 EXC_TOKID_SHEET
Special attribute.
Definition: xlformula.hxx:77
Default for an unspecified entry in a C-array.
Definition: xlformula.hxx:179
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.
Definition: xlformula.cxx:921
static bool GetString(OUString &rString, const ScTokenArray &rScTokArr)
Parses the passed formula and tries to find a single string token, i.e.
Definition: xlformula.cxx:886
bool IsVolatile() const
Function name, if simulated by a macro call (UTF-8) EXC_FUNCFLAG_ADDINEQUIV is 0; or programmatical a...
Definition: xlformula.hxx:326
::std::map< OUString, const XclFunctionInfo * > XclMacroNameMap
Definition: xlformula.hxx:362
const sal_uInt8 EXC_TOKID_AREAN
Relative 2D cell reference (in names).
Definition: xlformula.hxx:99
const sal_uInt8 EXC_TOKID_MEMERR
Constant reference subexpression.
Definition: xlformula.hxx:93
Repeat parent conversion in REFTYPE parameters.
Definition: xlformula.hxx:192
This class is used to import record oriented streams.
Definition: xistream.hxx:277
const sal_uInt16 EXC_TOK_REF_COLREL
Mask for parameter count.
Definition: xlformula.hxx:137
void Init(const ScTokenArray &rScTokArr, bool bSkipSpaces)
Definition: xlformula.cxx:843
A helper with Excel specific token array functions.
Definition: xlformula.hxx:485
const sal_uInt8 EXC_TOKID_FUNC
Array constant.
Definition: xlformula.hxx:87
bool IsAddInEquivalent() const
Returns true, if the function is stored as an add-in call.
Definition: xlformula.hxx:334
sal_uInt8 mnFlags
Information for all parameters.
Definition: xlformula.hxx:318
XclFuncMap maXclFuncMap
Definition: xlformula.hxx:365
Chart source ranges.
Definition: xlformula.hxx:168
Special token array iterator for the Excel filters.
Definition: xlformula.hxx:438
const ::formula::FormulaToken *const * mppScTokenBeg
Definition: xlformula.hxx:461
Access to global data for a filter object (imported or exported document) from other classes...
Definition: xlroot.hxx:127
bool mbVolatile
Byte vector containing extended data (arrays, stacked NLRs).
Definition: xlformula.hxx:413
XclFunctionProvider(const XclRoot &rRoot)
Definition: xlformula.cxx:649
ScfUInt8Vec maTokVec
Definition: xlformula.hxx:411
const sal_uInt8 EXC_TOK_NLR_RANGEERR
Stacked NLR: Value in column.
Definition: xlformula.hxx:151
sal_uInt16 mnXclFunc
Calc function opcode.
Definition: xlformula.hxx:313
Spreadsheet links in form controls.
Definition: xlformula.hxx:169
const sal_uInt8 EXC_TOK_NLR_SROWV
Stacked NLR: Column index.
Definition: xlformula.hxx:149
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.
Definition: xlformula.cxx:961
XclFuncParamInfo mpParamInfos[EXC_FUNCINFO_PARAMINFO_COUNT]
Token class of the return value.
Definition: xlformula.hxx:317
const sal_uInt8 EXC_TOKID_EXP
Placeholder for invalid token id.
Definition: xlformula.hxx:52
Structure that contains all needed information for a parameter in a function.
Definition: xlformula.hxx:275
ScAddress maColFirstScPos
Position of the (first) formula cell.
Definition: xlformula.hxx:471
OUString GetMacroFuncName() const
Returns the name of the external function as string.
Definition: xlformula.cxx:35
Use original class of current token.
Definition: xlformula.hxx:188
const sal_uInt8 EXC_TOKID_DIV
Multiplication operator.
Definition: xlformula.hxx:57
const sal_uInt8 EXC_TOKID_REFERR
Variable reference subexpression.
Definition: xlformula.hxx:96
const sal_uInt8 EXC_TOK_ATTR_VOLATILE
sal_True value of a tBool token.
Definition: xlformula.hxx:116