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 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XLFORMULA_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XLFORMULA_HXX
22 
23 #include <osl/diagnose.h>
24 #include <formula/opcode.hxx>
25 #include <address.hxx>
26 #include "ftools.hxx"
27 #include <map>
28 #include <memory>
29 
30 namespace svl {
31 
32 class SharedStringPool;
33 
34 }
35 
36 // Constants ==================================================================
37 
38 const size_t EXC_TOKARR_MAXLEN = 4096;
39 
40 // Token class flags ----------------------------------------------------------
41 
47 
48 // Base tokens ----------------------------------------------------------------
49 
51 
52 const sal_uInt8 EXC_TOKID_NONE = 0x00;
53 const sal_uInt8 EXC_TOKID_EXP = 0x01;
54 const sal_uInt8 EXC_TOKID_TBL = 0x02;
55 const sal_uInt8 EXC_TOKID_ADD = 0x03;
56 const sal_uInt8 EXC_TOKID_SUB = 0x04;
57 const sal_uInt8 EXC_TOKID_MUL = 0x05;
58 const sal_uInt8 EXC_TOKID_DIV = 0x06;
59 const sal_uInt8 EXC_TOKID_POWER = 0x07;
61 const sal_uInt8 EXC_TOKID_LT = 0x09;
62 const sal_uInt8 EXC_TOKID_LE = 0x0A;
63 const sal_uInt8 EXC_TOKID_EQ = 0x0B;
64 const sal_uInt8 EXC_TOKID_GE = 0x0C;
65 const sal_uInt8 EXC_TOKID_GT = 0x0D;
66 const sal_uInt8 EXC_TOKID_NE = 0x0E;
67 const sal_uInt8 EXC_TOKID_ISECT = 0x0F;
68 const sal_uInt8 EXC_TOKID_LIST = 0x10;
69 const sal_uInt8 EXC_TOKID_RANGE = 0x11;
70 const sal_uInt8 EXC_TOKID_UPLUS = 0x12;
73 const sal_uInt8 EXC_TOKID_PAREN = 0x15;
75 const sal_uInt8 EXC_TOKID_STR = 0x17;
76 const sal_uInt8 EXC_TOKID_NLR = 0x18;
77 const sal_uInt8 EXC_TOKID_ATTR = 0x19;
78 const sal_uInt8 EXC_TOKID_SHEET = 0x1A;
80 const sal_uInt8 EXC_TOKID_ERR = 0x1C;
81 const sal_uInt8 EXC_TOKID_BOOL = 0x1D;
82 const sal_uInt8 EXC_TOKID_INT = 0x1E;
83 const sal_uInt8 EXC_TOKID_NUM = 0x1F;
84 
85 // Base IDs of classified tokens ----------------------------------------------
86 
87 const sal_uInt8 EXC_TOKID_ARRAY = 0x00;
88 const sal_uInt8 EXC_TOKID_FUNC = 0x01;
90 const sal_uInt8 EXC_TOKID_NAME = 0x03;
91 const sal_uInt8 EXC_TOKID_REF = 0x04;
92 const sal_uInt8 EXC_TOKID_AREA = 0x05;
99 const sal_uInt8 EXC_TOKID_REFN = 0x0C;
109 
110 // specific token constants ---------------------------------------------------
111 
112 const sal_uInt16 EXC_TOK_STR_MAXLEN = 255;
113 
116 
124 
132 
133 const sal_uInt16 EXC_TOK_FUNCVAR_CMD = 0x8000;
134 const sal_uInt16 EXC_TOK_FUNCVAR_INDEXMASK = 0x7FFF;
137 
138 const sal_uInt16 EXC_TOK_REF_COLREL = 0x4000;
139 const sal_uInt16 EXC_TOK_REF_ROWREL = 0x8000;
140 
154 const sal_uInt16 EXC_TOK_NLR_REL = 0x8000;
155 
156 const sal_uInt32 EXC_TOK_NLR_ADDREL = 0x80000000;
157 const sal_uInt32 EXC_TOK_NLR_ADDMASK = 0x3FFFFFFF;
158 
161 {
172 };
173 
174 // Function parameter info ====================================================
175 
178 {
183 };
184 
187 {
194 };
195 
277 {
280  bool mbValType;
281 };
282 
283 // Function data ==============================================================
284 
286 
288 
294 
295 // selected function IDs
296 const sal_uInt16 EXC_FUNCID_IF = 1;
297 const sal_uInt16 EXC_FUNCID_SUM = 4;
298 const sal_uInt16 EXC_FUNCID_AND = 36;
299 const sal_uInt16 EXC_FUNCID_OR = 37;
300 const sal_uInt16 EXC_FUNCID_CHOOSE = 100;
301 const sal_uInt16 EXC_FUNCID_EXTERNCALL = 255;
302 
312 {
314  sal_uInt16 mnXclFunc;
320  const char* mpcMacroName;
327  bool IsVolatile() const { return ::get_flag( mnFlags, EXC_FUNCFLAG_VOLATILE ); }
331  bool IsFixedParamCount() const { return (mnXclFunc != EXC_FUNCID_EXTERNCALL) && (mnMinParamCount == mnMaxParamCount); }
333  bool IsMacroFunc() const { return mpcMacroName != nullptr && !(mnFlags & EXC_FUNCFLAG_ADDINEQUIV); }
335  bool IsAddInEquivalent() const { return mpcMacroName != nullptr && (mnFlags & EXC_FUNCFLAG_ADDINEQUIV); }
337  OUString GetMacroFuncName() const;
339  OUString GetAddInEquivalentFuncName() const;
340 };
341 
342 class XclRoot;
343 
346 {
347 public:
348  explicit XclFunctionProvider( const XclRoot& rRoot );
349 
351  const XclFunctionInfo* GetFuncInfoFromXclFunc( sal_uInt16 nXclFunc ) const;
353  const XclFunctionInfo* GetFuncInfoFromXclMacroName( const OUString& rXclMacroName ) const;
355  const XclFunctionInfo* GetFuncInfoFromOpCode( OpCode eOpCode ) const;
356 
357 private:
358  void FillXclFuncMap( const XclFunctionInfo* pBeg, const XclFunctionInfo* pEnd );
359  void FillScFuncMap( const XclFunctionInfo* pBeg, const XclFunctionInfo* pEnd );
360 
361 private:
362  typedef ::std::map< sal_uInt16, const XclFunctionInfo* > XclFuncMap;
363  typedef ::std::map< OUString, const XclFunctionInfo* > XclMacroNameMap;
364  typedef ::std::map< OpCode, const XclFunctionInfo* > ScFuncMap;
365 
366  XclFuncMap maXclFuncMap;
367  XclMacroNameMap maXclMacroNameMap;
368  ScFuncMap maScFuncMap;
369 };
370 
371 // Token array ================================================================
372 
373 class XclImpStream;
374 class XclExpStream;
375 
378 {
379 public:
381  explicit XclTokenArray( bool bVolatile = false );
383  explicit XclTokenArray( ScfUInt8Vec& rTokVec, ScfUInt8Vec& rExtDataVec, bool bVolatile = false );
384 
386  bool Empty() const { return maTokVec.empty(); }
388  sal_uInt16 GetSize() const;
390  const sal_uInt8* GetData() const { return maTokVec.empty() ? nullptr : maTokVec.data(); }
392  bool IsVolatile() const { return mbVolatile; }
393 
395  void ReadSize( XclImpStream& rStrm );
397  void ReadArray( XclImpStream& rStrm );
399  void Read( XclImpStream& rStrm );
400 
402  void WriteSize( XclExpStream& rStrm ) const;
404  void WriteArray( XclExpStream& rStrm ) const;
406  void Write( XclExpStream& rStrm ) const;
407 
409  bool operator==( const XclTokenArray& rTokArr ) const;
410 
411 private:
414  bool mbVolatile;
415 };
416 
417 typedef std::shared_ptr< XclTokenArray > XclTokenArrayRef;
418 
422 XclExpStream& operator<<( XclExpStream& rStrm, const XclTokenArray& rTokArr );
424 XclExpStream& operator<<( XclExpStream& rStrm, const XclTokenArrayRef& rxTokArr );
425 
426 namespace formula { class FormulaToken; }
427 class ScTokenArray;
428 
440 {
441 public:
442  explicit XclTokenArrayIterator();
443  explicit XclTokenArrayIterator( const ScTokenArray& rScTokArr, bool bSkipSpaces );
445  explicit XclTokenArrayIterator( const XclTokenArrayIterator& rTokArrIt, bool bSkipSpaces );
446 
447  void Init( const ScTokenArray& rScTokArr, bool bSkipSpaces );
448 
449  bool Is() const { return mppScToken != nullptr; }
450  bool operator!() const { return !Is(); }
451  const ::formula::FormulaToken* Get() const { return mppScToken ? *mppScToken : nullptr; }
452  const ::formula::FormulaToken* operator->() const { return Get(); }
453  const ::formula::FormulaToken& operator*() const { return *Get(); }
454 
456 
457 private:
458  void NextRawToken();
459  void SkipSpaces();
460 
461 private:
462  const ::formula::FormulaToken*const* mppScTokenBeg;
463  const ::formula::FormulaToken*const* mppScTokenEnd;
464  const ::formula::FormulaToken*const* mppScToken;
466 };
467 
470 {
477 };
478 
487 {
488 public:
489  // token identifiers ------------------------------------------------------
490 
492  inline static sal_uInt8 GetTokenId( sal_uInt8 nBaseId, sal_uInt8 nTokenClass );
493 
495  static sal_uInt8 GetTokenClass( sal_uInt8 nTokenId ) { return nTokenId & EXC_TOKCLASS_MASK; }
497  inline static void ChangeTokenClass( sal_uInt8& rnTokenId, sal_uInt8 nTokenClass );
498 
499  // strings and string lists -----------------------------------------------
500 
504  static bool GetTokenString( OUString& rString, const ::formula::FormulaToken& rScToken );
505 
509  static bool GetString( OUString& rString, const ScTokenArray& rScTokArr );
510 
518  static bool GetStringList( OUString& rStringList, const ScTokenArray& rScTokArr, sal_Unicode cSep );
519 
526  static void ConvertStringToList(
527  ScTokenArray& rScTokArr, svl::SharedStringPool& rSPool, sal_Unicode cStringSep );
528 
529  // multiple operations ----------------------------------------------------
530 
535  static bool GetMultipleOpRefs( const ScDocument& rDoc, XclMultipleOpRefs& rRefs, const ScTokenArray& rScTokArr, const ScAddress& rScPos );
536 };
537 
539 {
540  OSL_ENSURE( !::get_flag( nBaseId, static_cast< sal_uInt8 >( ~EXC_TOKID_MASK ) ), "XclTokenArrayHelper::GetTokenId - invalid token ID" );
541  OSL_ENSURE( !::get_flag( nTokenClass, static_cast< sal_uInt8 >( ~EXC_TOKCLASS_MASK ) ), "XclTokenArrayHelper::GetTokenId - invalid token class" );
542  return nBaseId | nTokenClass;
543 }
544 
545 inline void XclTokenArrayHelper::ChangeTokenClass( sal_uInt8& rnTokenId, sal_uInt8 nTokenClass )
546 {
547  OSL_ENSURE( !::get_flag( nTokenClass, static_cast< sal_uInt8 >( ~EXC_TOKCLASS_MASK ) ), "XclTokenArrayHelper::ChangeTokenClass - invalid token class" );
548  ::set_flag( rnTokenId, EXC_TOKCLASS_MASK, false );
549  ::set_flag( rnTokenId, nTokenClass );
550 }
551 
552 #endif
553 
554 /* 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:73
const sal_uInt8 EXC_TOKID_AREAERR
Deleted 2D cell reference.
Definition: xlformula.hxx:98
const sal_uInt8 EXC_FUNCFLAG_VOLATILE
Number of parameter info entries.
Definition: xlformula.hxx:289
const sal_uInt8 EXC_FUNC_MAXPARAM
Definition: xlformula.hxx:285
const sal_uInt8 EXC_TOK_NLR_SXNAME
NLR: Invalid/deleted range.
Definition: xlformula.hxx:153
static void ChangeTokenClass(sal_uInt8 &rnTokenId, sal_uInt8 nTokenClass)
Changes the token class in the passed classified token ID.
Definition: xlformula.hxx:545
::std::vector< sal_uInt8 > ScfUInt8Vec
Definition: ftools.hxx:251
const sal_uInt8 EXC_TOKID_ARRAY
Floating-point constant.
Definition: xlformula.hxx:87
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:449
const sal_uInt8 EXC_TOKID_LE
Less than operator.
Definition: xlformula.hxx:62
ScAddress maRowFirstScPos
Definition: xlformula.hxx:474
const sal_uInt8 EXC_TOKID_MEMAREAN
Relative 2D area reference (in names).
Definition: xlformula.hxx:101
const sal_uInt8 EXC_TOKID_STR
Missing argument.
Definition: xlformula.hxx:75
const sal_uInt32 EXC_TOK_NLR_ADDREL
True = Natural language ref is relative.
Definition: xlformula.hxx:156
This class is used to export Excel record streams.
Definition: xestream.hxx:71
bool IsFixedParamCount() const
Returns true, if the function parameter count is fixed.
Definition: xlformula.hxx:331
const sal_uInt8 EXC_TOK_ATTR_SPACE_SP_OPEN
Line breaks before next token.
Definition: xlformula.hxx:127
const sal_uInt8 EXC_TOKID_MASK
60-7F: Array class tokens.
Definition: xlformula.hxx:50
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:144
const sal_uInt8 EXC_TOKCLASS_REF
00-1F: Base tokens.
Definition: xlformula.hxx:44
bool mbValType
Token class conversion type.
Definition: xlformula.hxx:280
const sal_uInt8 EXC_TOKID_REF
Defined name.
Definition: xlformula.hxx:91
const sal_uInt8 EXC_TOKID_REFERR3D
3D area reference.
Definition: xlformula.hxx:107
const sal_uInt8 EXC_TOKID_CONCAT
Power operator.
Definition: xlformula.hxx:60
const sal_uInt8 EXC_TOKID_GE
Equal operator.
Definition: xlformula.hxx:64
const sal_uInt8 EXC_TOKID_MEMFUNC
Constant reference subexpression without result.
Definition: xlformula.hxx:96
Convert tokens to VAL class.
Definition: xlformula.hxx:190
const sal_uInt8 EXC_FUNCFLAG_PARAMPAIRS
Only used in export filter.
Definition: xlformula.hxx:292
const sal_uInt8 EXC_TOK_ATTR_GOTO
Jump array of CHOOSE function.
Definition: xlformula.hxx:120
Conditional format.
Definition: xlformula.hxx:166
const sal_uInt8 EXC_TOKID_LT
String concatenation operator.
Definition: xlformula.hxx:61
Parameter supported by Calc only.
Definition: xlformula.hxx:182
const sal_uInt8 EXC_TOK_ATTR_SPACE_BR
Spaces before next token.
Definition: xlformula.hxx:126
bool IsMacroFunc() const
Returns true, if the function is simulated by a macro call.
Definition: xlformula.hxx:333
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:874
const sal_uInt8 EXC_TOKID_MEMAREA
2D area reference.
Definition: xlformula.hxx:93
const sal_uInt8 EXC_TOKCLASS_ARR
40-5F: Value class tokens.
Definition: xlformula.hxx:46
static bool GetTokenString(OUString &rString, const ::formula::FormulaToken &rScToken)
Tries to extract a string from the passed token.
Definition: xlformula.cxx:860
const sal_uInt8 EXC_TOK_BOOL_TRUE
sal_False value of a tBool token.
Definition: xlformula.hxx:115
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:93
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:773
const sal_uInt16 EXC_FUNCID_IF
Function is an add-in equivalent.
Definition: xlformula.hxx:296
const sal_uInt8 EXC_TOKID_AREA3D
3D cell reference.
Definition: xlformula.hxx:106
Parameter supported by Calc and Excel.
Definition: xlformula.hxx:181
const sal_uInt16 EXC_TOK_FUNCVAR_INDEXMASK
Macro command.
Definition: xlformula.hxx:134
Shared formula.
Definition: xlformula.hxx:165
::std::map< OpCode, const XclFunctionInfo * > ScFuncMap
Definition: xlformula.hxx:364
const sal_uInt8 EXC_TOKID_NAMEX
Definition: xlformula.hxx:104
const sal_uInt8 EXC_TOKID_BOOL
Error constant.
Definition: xlformula.hxx:81
const sal_uInt8 EXC_TOKCLASS_MASK
Maximum size of a token array.
Definition: xlformula.hxx:42
const size_t EXC_FUNCINFO_PARAMINFO_COUNT
Maximum parameter count.
Definition: xlformula.hxx:287
const sal_uInt8 EXC_TOKID_TBL
Array or shared formula reference.
Definition: xlformula.hxx:54
Web query source range.
Definition: xlformula.hxx:171
void WriteSize(XclExpStream &rStrm) const
Writes the size field of the token array.
Definition: xlformula.cxx:760
const sal_uInt8 EXC_FUNCFLAG_IMPORTONLY
Result is volatile (e.g. NOW() function).
Definition: xlformula.hxx:290
XclFuncParamConv
Enumerates different types of token class conversion in function parameters.
Definition: xlformula.hxx:186
const sal_uInt16 EXC_FUNCID_CHOOSE
Definition: xlformula.hxx:300
const sal_uInt8 EXC_TOKID_NONE
Definition: xlformula.hxx:52
const sal_uInt16 EXC_TOK_FUNCVAR_CMD
Spaces before formula (BIFF3).
Definition: xlformula.hxx:133
const sal_uInt8 EXC_TOKID_ADD
Multiple operation reference.
Definition: xlformula.hxx:55
const sal_uInt8 EXC_TOKCLASS_NONE
Definition: xlformula.hxx:43
const sal_uInt8 EXC_TOKID_MEMNOMEMN
Reference subexpression (in names).
Definition: xlformula.hxx:102
sal_uInt16 sal_Unicode
XclFormulaType
Mask for number of appended ranges.
Definition: xlformula.hxx:160
const sal_uInt8 EXC_TOKID_LIST
Intersection operator.
Definition: xlformula.hxx:68
const sal_uInt8 EXC_TOK_FUNCVAR_COUNTMASK
User prompt for macro commands.
Definition: xlformula.hxx:136
const sal_uInt8 EXC_TOK_NLR_SCOLV
Stacked NLR: Value in row.
Definition: xlformula.hxx:151
const sal_uInt16 EXC_TOK_REF_ROWREL
True = Column is relative.
Definition: xlformula.hxx:139
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:538
const sal_uInt8 EXC_TOKID_GT
Greater than or equal operator.
Definition: xlformula.hxx:65
bool Empty() const
Returns true, if the token array is empty.
Definition: xlformula.hxx:386
ScAddress maFmlaScPos
Definition: xlformula.hxx:471
const sal_uInt8 EXC_TOKID_NE
Greater than operator.
Definition: xlformula.hxx:66
OpCode
const sal_uInt8 EXC_TOKID_REF3D
External reference.
Definition: xlformula.hxx:105
void WriteArray(XclExpStream &rStrm) const
Writes the tokens of the token array (without size field).
Definition: xlformula.cxx:765
const sal_uInt16 EXC_FUNCID_SUM
Definition: xlformula.hxx:297
const sal_uInt8 EXC_FUNCFLAG_ADDINEQUIV
Optional parameters are expected to appear in pairs.
Definition: xlformula.hxx:293
const sal_uInt8 EXC_TOKID_FUNCVAR
Function, fixed number of arguments.
Definition: xlformula.hxx:89
const sal_uInt8 EXC_TOKID_AREA
2D cell reference.
Definition: xlformula.hxx:92
ScAddress maColRelScPos
Definition: xlformula.hxx:473
const sal_uInt8 EXC_TOKID_UMINUS
Unary plus.
Definition: xlformula.hxx:71
const sal_uInt8 EXC_TOKID_NAME
Function, variable number of arguments.
Definition: xlformula.hxx:90
const sal_uInt8 EXC_TOKID_NUM
Integer constant.
Definition: xlformula.hxx:83
const sal_uInt8 * GetData() const
Returns read-only access to the byte vector storing token data.
Definition: xlformula.hxx:390
const sal_uInt8 EXC_TOK_NLR_SRANGE
NLR: Range.
Definition: xlformula.hxx:147
XclMacroNameMap maXclMacroNameMap
Maps Excel function indexes to function data.
Definition: xlformula.hxx:367
bool mbSkipSpaces
Pointer to current token pointer of token array.
Definition: xlformula.hxx:465
const sal_uInt8 EXC_TOKID_AREAERR3D
Deleted 3D cell reference.
Definition: xlformula.hxx:108
const ::formula::FormulaToken *const * mppScTokenEnd
Pointer to first token pointer of token array.
Definition: xlformula.hxx:463
const sal_uInt8 EXC_TOK_NLR_RANGE
NLR: Value in column.
Definition: xlformula.hxx:146
const sal_uInt8 EXC_TOK_NLR_ERR
True = Row is relative.
Definition: xlformula.hxx:141
const sal_uInt8 EXC_TOKID_UPLUS
Range operator.
Definition: xlformula.hxx:70
Matrix (array) formula.
Definition: xlformula.hxx:164
const sal_uInt8 EXC_TOKID_SUB
Addition operator.
Definition: xlformula.hxx:56
const sal_uInt8 EXC_FUNCFLAG_EXPORTONLY
Only used in import filter.
Definition: xlformula.hxx:291
const sal_uInt32 EXC_TOK_NLR_ADDMASK
NLR relative (in appended data).
Definition: xlformula.hxx:157
const sal_uInt8 EXC_TOKID_ERR
End of a sheet reference (BIFF2-BIFF4).
Definition: xlformula.hxx:80
XclExpStream & operator<<(XclExpStream &rStrm, const XclTokenArray &rTokArr)
Calls the Write() function at the passed token array.
Definition: xlformula.cxx:790
const sal_uInt8 EXC_TOK_FUNCVAR_PROMPT
Mask for function/command index.
Definition: xlformula.hxx:135
void ReadArray(XclImpStream &rStrm)
Reads the tokens of the token array (without size field).
Definition: xlformula.cxx:748
const sal_uInt8 EXC_TOK_NLR_ROWR
NLR: Invalid/deleted.
Definition: xlformula.hxx:142
const sal_uInt8 EXC_TOK_NLR_SCOLR
Stacked NLR: Row index.
Definition: xlformula.hxx:149
Represents information for a spreadsheet function for import and export.
Definition: xlformula.hxx:311
const sal_uInt8 EXC_TOKID_REFN
Deleted 2D area reference.
Definition: xlformula.hxx:99
Defined name.
Definition: xlformula.hxx:168
XclFuncParamValidity meValid
Definition: xlformula.hxx:278
const size_t EXC_TOKARR_MAXLEN
Definition: xlformula.hxx:38
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:129
const sal_uInt8 EXC_TOK_ATTR_SPACE_SP
Spaces in formula representation.
Definition: xlformula.hxx:125
const sal_uInt8 EXC_TOK_ATTR_IF
Volatile function.
Definition: xlformula.hxx:118
const sal_uInt8 EXC_TOKID_ATTR
Natural language reference (NLR).
Definition: xlformula.hxx:77
bool operator!() const
Definition: xlformula.hxx:450
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:413
ScFuncMap maScFuncMap
Maps macro function names to function data.
Definition: xlformula.hxx:368
sal_uInt8 mnRetClass
Maximum number of parameters.
Definition: xlformula.hxx:317
const sal_uInt16 EXC_TOK_NLR_REL
NLR: Pivot table name.
Definition: xlformula.hxx:154
const sal_uInt16 EXC_FUNCID_AND
Definition: xlformula.hxx:298
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:145
Repeat parent conversion in VALTYPE parameters.
Definition: xlformula.hxx:192
const sal_uInt8 EXC_TOKID_ENDSHEET
Start of a sheet reference (BIFF2-BIFF4).
Definition: xlformula.hxx:79
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:73
const sal_uInt8 EXC_TOK_ATTR_SPACE
BASIC style assignment.
Definition: xlformula.hxx:123
const sal_uInt8 EXC_TOKID_RANGE
List operator.
Definition: xlformula.hxx:69
const sal_uInt8 EXC_TOKID_EQ
Less than or equal operator.
Definition: xlformula.hxx:63
sal_uInt8 mnMaxParamCount
Minimum number of parameters.
Definition: xlformula.hxx:316
const ::formula::FormulaToken * Get() const
Definition: xlformula.hxx:451
const sal_uInt8 EXC_TOKID_NLR
String constant.
Definition: xlformula.hxx:76
const sal_uInt8 EXC_TOK_NLR_COLR
NLR: Row index.
Definition: xlformula.hxx:143
void FillScFuncMap(const XclFunctionInfo *pBeg, const XclFunctionInfo *pEnd)
Definition: xlformula.cxx:714
const char * mpcMacroName
Additional flags (EXC_FUNCFLAG_* constants).
Definition: xlformula.hxx:320
sal_uInt8 mnMinParamCount
Excel function index.
Definition: xlformula.hxx:315
std::shared_ptr< XclTokenArray > XclTokenArrayRef
Definition: xlformula.hxx:417
Provides access to function info structs for all available functions.
Definition: xlformula.hxx:345
const sal_uInt8 EXC_TOKID_MISSARG
Parentheses.
Definition: xlformula.hxx:74
const sal_uInt16 EXC_TOK_STR_MAXLEN
Deleted 3D area reference.
Definition: xlformula.hxx:112
const sal_uInt8 EXC_TOKCLASS_VAL
20-3F: Reference class tokens.
Definition: xlformula.hxx:45
void ReadSize(XclImpStream &rStrm)
Reads the size field of the token array.
Definition: xlformula.cxx:741
const sal_uInt8 EXC_TOK_ATTR_CHOOSE
Start of true condition in IF function.
Definition: xlformula.hxx:119
bool IsParamPairs() const
Returns true, if optional parameters are expected to appear in pairs.
Definition: xlformula.hxx:329
const sal_uInt8 EXC_TOK_BOOL_FALSE
Maximum string length of a tStr token.
Definition: xlformula.hxx:114
XclTokenArrayIterator & operator++()
Definition: xlformula.cxx:837
Binary representation of an Excel token array.
Definition: xlformula.hxx:377
const sal_uInt8 EXC_TOKID_PERCENT
Unary minus.
Definition: xlformula.hxx:72
static sal_uInt8 GetTokenClass(sal_uInt8 nTokenId)
Returns the token class of the passed token ID.
Definition: xlformula.hxx:495
const sal_uInt8 EXC_TOKID_ISECT
Not equal operator.
Definition: xlformula.hxx:67
::std::map< sal_uInt16, const XclFunctionInfo * > XclFuncMap
Definition: xlformula.hxx:362
Contains all cell references that can be extracted from a multiple operations formula.
Definition: xlformula.hxx:469
bool IsVolatile() const
Returns true, if the formula contains a volatile function.
Definition: xlformula.hxx:392
unsigned char sal_uInt8
ScAddress maRowRelScPos
Definition: xlformula.hxx:475
Convert tokens to ARR class.
Definition: xlformula.hxx:191
const sal_uInt8 EXC_TOKID_POWER
Division operator.
Definition: xlformula.hxx:59
const ::formula::FormulaToken *const * mppScToken
Pointer behind last token pointer of token array.
Definition: xlformula.hxx:464
void Read(XclImpStream &rStrm)
Reads size field and the tokens.
Definition: xlformula.cxx:754
const ::formula::FormulaToken * operator->() const
Definition: xlformula.hxx:452
const sal_uInt8 EXC_TOK_ATTR_SPACE_BR_OPEN
Spaces before opening parenthesis.
Definition: xlformula.hxx:128
const sal_uInt8 EXC_TOKID_MUL
Subtraction operator.
Definition: xlformula.hxx:57
const sal_uInt16 EXC_FUNCID_OR
Definition: xlformula.hxx:299
const sal_uInt8 EXC_TOKID_INT
Boolean constant.
Definition: xlformula.hxx:82
const sal_uInt8 EXC_TOK_ATTR_SPACE_BR_CLOSE
Spaces before closing parenthesis.
Definition: xlformula.hxx:130
XclImpStream & operator>>(XclImpStream &rStrm, XclTokenArray &rTokArr)
Calls the Read() function at the passed token array.
Definition: xlformula.cxx:784
XclFuncParamConv meConv
Parameter validity.
Definition: xlformula.hxx:279
const sal_uInt8 EXC_TOK_ATTR_SPACE_SP_PRE
Line breaks before closing parenthesis.
Definition: xlformula.hxx:131
These need to be in global namespace just like their respective types are.
Simple cell formula, also used in change tracking.
Definition: xlformula.hxx:163
const sal_uInt16 EXC_FUNCID_EXTERNCALL
Definition: xlformula.hxx:301
XclFuncParamValidity
Enumerates validity modes for a function parameter.
Definition: xlformula.hxx:177
const sal_uInt8 EXC_TOKID_FUNCCE
Reference subexpression (in names) without result.
Definition: xlformula.hxx:103
const ::formula::FormulaToken & operator*() const
Definition: xlformula.hxx:453
const sal_uInt8 EXC_TOK_NLR_SROWR
Stacked NLR: Range.
Definition: xlformula.hxx:148
const sal_uInt8 EXC_TOK_ATTR_ASSIGN
SUM function with one parameter.
Definition: xlformula.hxx:122
const sal_uInt8 EXC_TOKID_MEMNOMEM
Deleted reference subexpression.
Definition: xlformula.hxx:95
Data validation.
Definition: xlformula.hxx:167
const sal_uInt8 EXC_TOK_ATTR_SUM
Jump to token.
Definition: xlformula.hxx:121
bool operator==(const XclTokenArray &rTokArr) const
Compares this token array with the passed.
Definition: xlformula.cxx:779
const sal_uInt8 EXC_TOKID_SHEET
Special attribute.
Definition: xlformula.hxx:78
Default for an unspecified entry in a C-array.
Definition: xlformula.hxx:180
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:902
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:867
bool IsVolatile() const
Function name, if simulated by a macro call (UTF-8) EXC_FUNCFLAG_ADDINEQUIV is 0; or programmatical a...
Definition: xlformula.hxx:327
::std::map< OUString, const XclFunctionInfo * > XclMacroNameMap
Definition: xlformula.hxx:363
const sal_uInt8 EXC_TOKID_AREAN
Relative 2D cell reference (in names).
Definition: xlformula.hxx:100
const sal_uInt8 EXC_TOKID_MEMERR
Constant reference subexpression.
Definition: xlformula.hxx:94
Repeat parent conversion in REFTYPE parameters.
Definition: xlformula.hxx:193
This class is used to import record oriented streams.
Definition: xistream.hxx:278
const sal_uInt16 EXC_TOK_REF_COLREL
Mask for parameter count.
Definition: xlformula.hxx:138
void Init(const ScTokenArray &rScTokArr, bool bSkipSpaces)
Definition: xlformula.cxx:827
A helper with Excel specific token array functions.
Definition: xlformula.hxx:486
const sal_uInt8 EXC_TOKID_FUNC
Array constant.
Definition: xlformula.hxx:88
bool IsAddInEquivalent() const
Returns true, if the function is stored as an add-in call.
Definition: xlformula.hxx:335
sal_uInt8 mnFlags
Information for all parameters.
Definition: xlformula.hxx:319
XclFuncMap maXclFuncMap
Definition: xlformula.hxx:366
Chart source ranges.
Definition: xlformula.hxx:169
Special token array iterator for the Excel filters.
Definition: xlformula.hxx:439
const ::formula::FormulaToken *const * mppScTokenBeg
Definition: xlformula.hxx:462
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:414
XclFunctionProvider(const XclRoot &rRoot)
Definition: xlformula.cxx:649
ScfUInt8Vec maTokVec
Definition: xlformula.hxx:412
const sal_uInt8 EXC_TOK_NLR_RANGEERR
Stacked NLR: Value in column.
Definition: xlformula.hxx:152
sal_uInt16 mnXclFunc
Calc function opcode.
Definition: xlformula.hxx:314
Spreadsheet links in form controls.
Definition: xlformula.hxx:170
const sal_uInt8 EXC_TOK_NLR_SROWV
Stacked NLR: Column index.
Definition: xlformula.hxx:150
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:942
XclFuncParamInfo mpParamInfos[EXC_FUNCINFO_PARAMINFO_COUNT]
Token class of the return value.
Definition: xlformula.hxx:318
const sal_uInt8 EXC_TOKID_EXP
Placeholder for invalid token id.
Definition: xlformula.hxx:53
Structure that contains all needed information for a parameter in a function.
Definition: xlformula.hxx:276
ScAddress maColFirstScPos
Position of the (first) formula cell.
Definition: xlformula.hxx:472
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:189
const sal_uInt8 EXC_TOKID_DIV
Multiplication operator.
Definition: xlformula.hxx:58
const sal_uInt8 EXC_TOKID_REFERR
Variable reference subexpression.
Definition: xlformula.hxx:97
const sal_uInt8 EXC_TOK_ATTR_VOLATILE
sal_True value of a tBool token.
Definition: xlformula.hxx:117