LibreOffice Module sc (master) 1
compiler.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 <string.h>
23
24#include "scdllapi.h"
25#include "global.hxx"
26#include "refdata.hxx"
27#include "token.hxx"
28#include <formula/token.hxx>
29#include <formula/grammar.hxx>
30#include <rtl/ustrbuf.hxx>
31#include <com/sun/star/sheet/ExternalLinkInfo.hpp>
32#include <com/sun/star/i18n/ParseResult.hpp>
33#include <queue>
34#include <vector>
35#include <memory>
36#include <unordered_set>
37#include <set>
38#include <com/sun/star/uno/Sequence.hxx>
40
42
43struct ScSheetLimits;
44
45// constants and data types also for external modules (ScInterpreter et al)
46
47#define MAXSTRLEN 1024 /* maximum length of input string of one symbol */
48
49// flag values of CharTable
50enum class ScCharFlags : sal_uInt32 {
51 NONE = 0x00000000,
52 Illegal = 0x00000000,
53 Char = 0x00000001,
54 CharBool = 0x00000002,
55 CharWord = 0x00000004,
56 CharValue = 0x00000008,
57 CharString = 0x00000010,
58 CharDontCare = 0x00000020,
59 Bool = 0x00000040,
60 Word = 0x00000080,
61 WordSep = 0x00000100,
62 Value = 0x00000200,
63 ValueSep = 0x00000400,
64 ValueExp = 0x00000800,
65 ValueSign = 0x00001000,
66 ValueValue = 0x00002000,
67 StringSep = 0x00004000,
68 NameSep = 0x00008000, // there can be only one! '\''
69 CharIdent = 0x00010000, // identifier (built-in function) or reference start
70 Ident = 0x00020000, // identifier or reference continuation
71 OdfLBracket = 0x00040000, // ODF '[' reference bracket
72 OdfRBracket = 0x00080000, // ODF ']' reference bracket
73 OdfLabelOp = 0x00100000, // ODF '!!' automatic intersection of labels
74 OdfNameMarker = 0x00200000, // ODF '$$' marker that starts a defined (range) name
75 CharName = 0x00400000, // start character of a defined name
76 Name = 0x00800000, // continuation character of a defined name
77 CharErrConst = 0x01000000, // start character of an error constant ('#')
78};
79namespace o3tl {
80 template<> struct typed_flags<ScCharFlags> : is_typed_flags<ScCharFlags, 0x01ffffff> {};
81}
82
83#define SC_COMPILER_FILE_TAB_SEP '#' // 'Doc'#Tab
84
85class ScDocument;
86class ScMatrix;
87class ScRangeData;
88class ScTokenArray;
90class CharClass;
91
92namespace sc {
93
94class CompileFormulaContext;
95
96}
97
98// constants and data types internal to compiler
99
100struct ScRawToken final
101{
102 friend class ScCompiler;
103 // Friends that use a temporary ScRawToken on the stack (and therefore need
104 // the private dtor) and know what they're doing...
105 friend class ScTokenArray;
107 formula::StackVar eType; // type of data; this determines how the unions are used
108public:
109 union {
110 double nValue;
111 struct {
115 struct {
120 struct {
121 sal_uInt16 nFileId;
124 struct {
125 sal_uInt16 nFileId;
127 struct {
128 sal_Int16 nSheet;
129 sal_uInt16 nIndex;
131 struct {
132 sal_uInt16 nIndex;
135 struct {
136 rtl_uString* mpData;
137 rtl_uString* mpDataIgnoreCase;
141 short nJump[ FORMULA_MAXJUMPCOUNT + 1 ]; // If/Chose token
142 };
143 OUString maExternalName; // depending on the opcode, this is either the external, or the external name, or the external table name
144
145 // coverity[uninit_member] - members deliberately not initialized
147private:
149public:
150 formula::StackVar GetType() const { return eType; }
151 OpCode GetOpCode() const { return eOp; }
152 void NewOpCode( OpCode e ) { eOp = e; }
153
154 // Use these methods only on tokens that are not part of a token array,
155 // since the reference count is cleared!
156 void SetOpCode( OpCode eCode );
157 void SetString( rtl_uString* pData, rtl_uString* pDataIgnoreCase );
158 void SetSingleReference( const ScSingleRefData& rRef );
159 void SetDoubleReference( const ScComplexRefData& rRef );
160 void SetDouble( double fVal );
161 void SetErrorConstant( FormulaError nErr );
162
163 // These methods are ok to use, reference count not cleared.
164 void SetName(sal_Int16 nSheet, sal_uInt16 nIndex);
165 void SetExternalSingleRef( sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef );
166 void SetExternalDoubleRef( sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef );
167 void SetExternalName( sal_uInt16 nFileId, const OUString& rName );
168 void SetExternal(const OUString& rStr);
169
175 bool IsValidReference(const ScDocument& rDoc) const;
176
177 formula::FormulaToken* CreateToken(ScSheetLimits& rLimits) const; // create typified token
178};
179
181{
182public:
183
185 {
186 EXTENDED_ERROR_DETECTION_NONE = 0, // no error on unknown symbols, default (interpreter handles it)
187 EXTENDED_ERROR_DETECTION_NAME_BREAK, // name error on unknown symbols and break, pCode incomplete
188 EXTENDED_ERROR_DETECTION_NAME_NO_BREAK // name error on unknown symbols, don't break, continue
189 };
190
191 struct SAL_DLLPRIVATE Convention
192 {
194
196 virtual ~Convention();
197
198 virtual void makeRefStr(
199 ScSheetLimits& rLimits,
200 OUStringBuffer& rBuffer,
202 const ScAddress& rPos,
203 const OUString& rErrRef, const std::vector<OUString>& rTabNames,
204 const ScComplexRefData& rRef, bool bSingleRef, bool bFromRangeName ) const = 0;
205
206 virtual css::i18n::ParseResult
207 parseAnyToken( const OUString& rFormula,
208 sal_Int32 nSrcPos,
209 const CharClass* pCharClass,
210 bool bGroupSeparator) const = 0;
211
218 virtual bool parseExternalName( const OUString& rSymbol, OUString& rFile, OUString& rName,
219 const ScDocument& rDoc,
220 const css::uno::Sequence< css::sheet::ExternalLinkInfo>* pExternalLinks ) const = 0;
221
222 virtual OUString makeExternalNameStr( sal_uInt16 nFileId, const OUString& rFile,
223 const OUString& rName ) const = 0;
224
225 virtual void makeExternalRefStr(
226 ScSheetLimits& rLimits,
227 OUStringBuffer& rBuffer, const ScAddress& rPos, sal_uInt16 nFileId, const OUString& rFileName,
228 const OUString& rTabName, const ScSingleRefData& rRef ) const = 0;
229
230 virtual void makeExternalRefStr(
231 ScSheetLimits& rLimits,
232 OUStringBuffer& rBuffer, const ScAddress& rPos,
233 sal_uInt16 nFileId, const OUString& rFileName, const std::vector<OUString>& rTabNames,
234 const OUString& rTabName, const ScComplexRefData& rRef ) const = 0;
235
237 {
243
248 ABS_SHEET_PREFIX
249 };
250 virtual sal_Unicode getSpecialSymbol( SpecialSymbolType eSymType ) const = 0;
251
253
254 protected:
255 std::unique_ptr<ScCharFlags[]> mpCharTable;
256 };
257 friend struct Convention;
258
259private:
260
261 static osl::Mutex maMutex;
262 static const CharClass *pCharClassEnglish; // character classification for en_US locale
263 static const CharClass *pCharClassLocalized; // character classification for UI locale
264 static const Convention *pConventions[ formula::FormulaGrammar::CONV_LAST ];
265
266 static const struct AddInMap
267 {
268 const char* pODFF;
269 const char* pEnglish;
270 const char* pOriginal; // programmatical name
271 const char* pUpper; // upper case programmatical name
272 } g_aAddInMap[];
273 static size_t GetAddInMapCount();
274
277
280
281 SCTAB mnCurrentSheetTab; // indicates current sheet number parsed so far
282 sal_Int32 mnCurrentSheetEndPos; // position after current sheet name if parsed
283
284 // For CONV_XL_OOX, may be set via API by MOOXML filter.
285 css::uno::Sequence<css::sheet::ExternalLinkInfo> maExternalLinks;
286
287 sal_Unicode cSymbol[MAXSTRLEN+1]; // current Symbol + 0
288 OUString aFormula; // formula source code
289 sal_Int32 nSrcPos; // tokenizer position (source code)
291
292 std::queue<OpCode> maPendingOpCodes; // additional opcodes generated from a single symbol
293
294 const CharClass* pCharClass; // which character classification is used for parseAnyToken and upper/lower
295 bool mbCharClassesDiffer; // whether pCharClass and current system locale's CharClass differ
296 sal_uInt16 mnPredetectedReference; // reference when reading ODF, 0 (none), 1 (single) or 2 (double)
297 sal_Int32 mnRangeOpPosInSymbol; // if and where a range operator is in symbol
300 bool mbCloseBrackets; // whether to close open brackets automatically, default TRUE
301 bool mbRewind; // whether symbol is to be rewound to some step during lexical analysis
302 bool mbRefConventionChartOOXML; // whether to use special ooxml chart syntax in case of OOXML reference convention,
303 // when parsing a formula string. [0]!GlobalNamedRange, LocalSheet!LocalNamedRange
304 std::vector<sal_uInt16> maExternalFiles;
305
306 std::vector<OUString> maTabNames;
307 std::vector<OUString> &GetSetupTabNames() const;
308
310 {
312 sal_uInt16 mnLevel;
314 };
315 std::vector<TableRefEntry> maTableRefs;
316
317 // Optimizing implicit intersection is done only at the end of code generation, because the usage context may
318 // be important. Store candidate parameters and the operation they are the argument for.
320 {
322 : parameterLocation( p ), parameter( *p ), operation( o ) {}
326 };
327 std::vector< PendingImplicitIntersectionOptimization > mPendingImplicitIntersectionOptimizations;
328 std::unordered_set<formula::FormulaTokenRef> mUnhandledPossibleImplicitIntersections;
329#ifdef DBG_UTIL
331#endif
332
333 bool NextNewToken(bool bInArray);
334 bool ToUpperAsciiOrI18nIsAscii( OUString& rUpper, const OUString& rOrg ) const;
335
336 virtual void SetError(FormulaError nError) override;
337
338 struct Whitespace final
339 {
340 sal_Int32 nCount;
342
343 Whitespace() : nCount(0), cChar(0x20) {}
344 void reset( sal_Unicode c ) { nCount = 0; cChar = c; }
345 };
346
347 static void addWhitespace( std::vector<ScCompiler::Whitespace> & rvSpaces,
348 ScCompiler::Whitespace & rSpace, sal_Unicode c, sal_Int32 n = 1 );
349
350 std::vector<Whitespace> NextSymbol(bool bInArray);
351
352 bool ParseValue( const OUString& );
353 bool ParseOpCode( const OUString&, bool bInArray );
354 bool ParseOpCode2( std::u16string_view );
355 bool ParseString();
356 bool ParseReference( const OUString& rSymbol, const OUString* pErrRef = nullptr );
357 bool ParseSingleReference( const OUString& rSymbol, const OUString* pErrRef = nullptr );
358 bool ParseDoubleReference( const OUString& rSymbol, const OUString* pErrRef = nullptr );
359 bool ParsePredetectedReference( const OUString& rSymbol );
360 bool ParsePredetectedErrRefReference( const OUString& rName, const OUString* pErrRef );
361 bool ParseMacro( const OUString& );
362 bool ParseNamedRange( const OUString&, bool onlyCheck = false );
363 bool ParseExternalNamedRange( const OUString& rSymbol, bool& rbInvalidExternalNameRange );
364 bool ParseDBRange( const OUString& );
365 bool ParseColRowName( const OUString& );
366 bool ParseBoolean( const OUString& );
367 void AutoCorrectParsedSymbol();
368 const ScRangeData* GetRangeData( SCTAB& rSheet, const OUString& rUpperName ) const;
369
370 void AdjustSheetLocalNameRelReferences( SCTAB nDelta );
371 void SetRelNameReference();
372
378 ScRangeData* GetRangeData( const formula::FormulaToken& pToken ) const;
379
380 bool HasPossibleNamedRangeConflict(SCTAB nTab) const;
381
382public:
383 static const CharClass* GetCharClassLocalized();
384 static const CharClass* GetCharClassEnglish();
385
386public:
388 bool bComputeII = false, bool bMatrixFlag = false, const ScInterpreterContext* pContext = nullptr );
389
392 ScCompiler( ScDocument& rDocument, const ScAddress&,
394 bool bComputeII = false, bool bMatrixFlag = false, const ScInterpreterContext* pContext = nullptr );
395
397 bool bComputeII = false, bool bMatrixFlag = false, const ScInterpreterContext* pContext = nullptr );
398
401 ScCompiler( ScDocument& rDocument, const ScAddress&, ScTokenArray& rArr,
403 bool bComputeII = false, bool bMatrixFlag = false, const ScInterpreterContext* pContext = nullptr );
404
405 virtual ~ScCompiler() override;
406
407public:
408 static void DeInit();
409
410 // for ScAddress::Format()
411 static void CheckTabQuotes( OUString& aTabName,
413
418 static sal_Int32 GetDocTabPos( const OUString& rString );
419
420 // Check if it is a valid english function name
421 static bool IsEnglishSymbol( const OUString& rName );
422
423 bool ParseErrorConstant( const OUString& );
424 bool ParseTableRefItem( const OUString& );
425 bool ParseTableRefColumn( const OUString& );
426
428 bool GetTokenIfOpCode( OpCode eOp );
429
433 void SetAutoCorrection( bool bVal );
434 void SetCloseBrackets( bool bVal ) { mbCloseBrackets = bVal; }
435 void SetRefConventionChartOOXML( bool bVal ) { mbRefConventionChartOOXML = bVal; }
436 void SetRefConvention( const Convention *pConvP );
437 void SetRefConvention( const formula::FormulaGrammar::AddressConvention eConv );
438
439 static const Convention* GetRefConvention( formula::FormulaGrammar::AddressConvention eConv );
440
444 OpCodeMapPtr GetOpCodeMap( const sal_Int32 nLanguage ) const { return GetFinalOpCodeMap(nLanguage); }
445
447 void SetFormulaLanguage( const OpCodeMapPtr & xMap );
448
449 void SetGrammar( const formula::FormulaGrammar::Grammar eGrammar );
450
451 void SetNumberFormatter( SvNumberFormatter* pFormatter );
452
453private:
463 void SetGrammarAndRefConvention(
464 const formula::FormulaGrammar::Grammar eNewGrammar,
465 const formula::FormulaGrammar::Grammar eOldGrammar );
466public:
467
470 const css::uno::Sequence<
471 css::sheet::ExternalLinkInfo>& rLinks )
472 {
473 maExternalLinks = rLinks;
474 }
475
476 void CreateStringFromXMLTokenArray( OUString& rFormula, OUString& rFormulaNmsp );
477
478 void SetExtendedErrorDetection( ExtendedErrorDetection eVal ) { meExtendedErrorDetection = eVal; }
479
480 bool IsCorrected() const { return bCorrected; }
481 const OUString& GetCorrectedFormula() const { return aCorrectedFormula; }
482
491 std::unique_ptr<ScTokenArray> CompileString( const OUString& rFormula );
492 std::unique_ptr<ScTokenArray> CompileString( const OUString& rFormula, const OUString& rFormulaNmsp );
493 const ScAddress& GetPos() const { return aPos; }
494
495 void MoveRelWrap();
496 static void MoveRelWrap( const ScTokenArray& rArr, const ScDocument& rDoc, const ScAddress& rPos,
497 SCCOL nMaxCol, SCROW nMaxRow );
498
502 static bool IsCharFlagAllConventions(
503 OUString const & rStr, sal_Int32 nPos, ScCharFlags nFlags );
504
506 static bool DoubleRefToPosSingleRefScalarCase(const ScRange& rRange, ScAddress& rAdr,
507 const ScAddress& rFormulaPos);
508
509 bool HasUnhandledPossibleImplicitIntersections() const { return !mUnhandledPossibleImplicitIntersections.empty(); }
510#ifdef DBG_UTIL
511 const std::set<OpCode>& UnhandledPossibleImplicitIntersectionsOpCodes() { return mUnhandledPossibleImplicitIntersectionsOpCodes; }
512#endif
513
514private:
515 // FormulaCompiler
516 virtual OUString FindAddInFunction( const OUString& rUpperName, bool bLocalFirst ) const override;
517 virtual void fillFromAddInCollectionUpperName( const NonConstOpCodeMapPtr& xMap ) const override;
518 virtual void fillFromAddInCollectionEnglishName( const NonConstOpCodeMapPtr& xMap ) const override;
519 virtual void fillFromAddInMap( const NonConstOpCodeMapPtr& xMap, formula::FormulaGrammar::Grammar _eGrammar ) const override;
520 virtual void fillAddInToken(::std::vector< css::sheet::FormulaOpCodeMapEntry >& _rVec,bool _bIsEnglish) const override;
521
522 virtual bool HandleExternalReference(const formula::FormulaToken& _aToken) override;
523 virtual bool HandleRange() override;
524 virtual bool HandleColRowName() override;
525 virtual bool HandleDbData() override;
526 virtual bool HandleTableRef() override;
527
529 virtual void CreateStringFromExternal( OUStringBuffer& rBuffer, const formula::FormulaToken* pToken ) const override;
530 virtual void CreateStringFromSingleRef( OUStringBuffer& rBuffer, const formula::FormulaToken* pToken ) const override;
531 virtual void CreateStringFromDoubleRef( OUStringBuffer& rBuffer, const formula::FormulaToken* pToken ) const override;
532 virtual void CreateStringFromMatrix( OUStringBuffer& rBuffer, const formula::FormulaToken* pToken ) const override;
533 virtual void CreateStringFromIndex( OUStringBuffer& rBuffer, const formula::FormulaToken* pToken ) const override;
534 virtual void LocalizeString( OUString& rName ) const override; // modify rName - input: exact name
535
536 virtual formula::ParamClass GetForceArrayParameter( const formula::FormulaToken* pToken, sal_uInt16 nParam ) const override;
537
540 { return c < 128 ? pConv->getCharTableFlags(c, cLast) : ScCharFlags::NONE; }
541
542 virtual void HandleIIOpCode(formula::FormulaToken* token, formula::FormulaToken*** pppToken, sal_uInt8 nNumParams) override;
543 bool HandleIIOpCodeInternal(formula::FormulaToken* token, formula::FormulaToken*** pppToken, sal_uInt8 nNumParams);
544 bool SkipImplicitIntersectionOptimization(const formula::FormulaToken* token) const;
545 virtual void PostProcessCode() override;
546 virtual void AnnotateOperands() override;
547 static bool ParameterMayBeImplicitIntersection(const formula::FormulaToken* token, int parameter);
548 void ReplaceDoubleRefII(formula::FormulaToken** ppDoubleRefTok);
549 bool AdjustSumRangeShape(const ScComplexRefData& rBaseRange, ScComplexRefData& rSumRange);
550 void CorrectSumRange(const ScComplexRefData& rBaseRange, ScComplexRefData& rSumRange, formula::FormulaToken** ppSumRangeToken);
551 void AnnotateTrimOnDoubleRefs();
552};
553
554/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define FORMULA_MAXJUMPCOUNT
OUString aFormula
Definition: compiler.hxx:288
bool HasUnhandledPossibleImplicitIntersections() const
Definition: compiler.hxx:509
css::uno::Sequence< css::sheet::ExternalLinkInfo > maExternalLinks
Definition: compiler.hxx:285
bool mbCharClassesDiffer
Definition: compiler.hxx:295
const ScAddress & GetPos() const
Definition: compiler.hxx:493
std::unordered_set< formula::FormulaTokenRef > mUnhandledPossibleImplicitIntersections
Definition: compiler.hxx:328
const ScInterpreterContext * mpInterpreterContext
Definition: compiler.hxx:279
std::vector< TableRefEntry > maTableRefs
Definition: compiler.hxx:315
void SetCloseBrackets(bool bVal)
Definition: compiler.hxx:434
void SetExternalLinks(const css::uno::Sequence< css::sheet::ExternalLinkInfo > &rLinks)
Set external link info for ScAddress::CONV_XL_OOX.
Definition: compiler.hxx:469
std::vector< PendingImplicitIntersectionOptimization > mPendingImplicitIntersectionOptimizations
Definition: compiler.hxx:327
ExtendedErrorDetection meExtendedErrorDetection
Definition: compiler.hxx:299
bool IsCorrected() const
Definition: compiler.hxx:480
const CharClass * pCharClass
Definition: compiler.hxx:294
static const CharClass * pCharClassEnglish
Definition: compiler.hxx:262
const Convention * pConv
Definition: compiler.hxx:298
sal_Int32 mnRangeOpPosInSymbol
Definition: compiler.hxx:297
ScDocument & rDoc
Definition: compiler.hxx:275
SCTAB mnCurrentSheetTab
Definition: compiler.hxx:281
const std::set< OpCode > & UnhandledPossibleImplicitIntersectionsOpCodes()
Definition: compiler.hxx:511
static const CharClass * pCharClassLocalized
Definition: compiler.hxx:263
void SetRefConventionChartOOXML(bool bVal)
Definition: compiler.hxx:435
bool mbRefConventionChartOOXML
Definition: compiler.hxx:302
std::vector< OUString > maTabNames
Definition: compiler.hxx:306
ExtendedErrorDetection
Definition: compiler.hxx:185
@ EXTENDED_ERROR_DETECTION_NAME_BREAK
Definition: compiler.hxx:187
const OUString & GetCorrectedFormula() const
Definition: compiler.hxx:481
void SetExtendedErrorDetection(ExtendedErrorDetection eVal)
Definition: compiler.hxx:478
sal_Int32 mnCurrentSheetEndPos
Definition: compiler.hxx:282
std::set< OpCode > mUnhandledPossibleImplicitIntersectionsOpCodes
Definition: compiler.hxx:330
std::vector< sal_uInt16 > maExternalFiles
Definition: compiler.hxx:304
sal_uInt16 mnPredetectedReference
Definition: compiler.hxx:296
bool mbCloseBrackets
Definition: compiler.hxx:300
ScCharFlags GetCharTableFlags(sal_Unicode c, sal_Unicode cLast)
Access the CharTable flags.
Definition: compiler.hxx:539
static osl::Mutex maMutex
Definition: compiler.hxx:261
ScAddress aPos
Definition: compiler.hxx:276
sal_Int32 nSrcPos
Definition: compiler.hxx:289
bool mbRewind
Definition: compiler.hxx:301
std::queue< OpCode > maPendingOpCodes
Definition: compiler.hxx:292
OpCodeMapPtr GetOpCodeMap(const sal_Int32 nLanguage) const
Overwrite FormulaCompiler::GetOpCodeMap() forwarding to GetFinalOpCodeMap().
Definition: compiler.hxx:444
ScRawToken maRawToken
Definition: compiler.hxx:290
SvNumberFormatter * mpFormatter
Definition: compiler.hxx:278
Matrix data type that can store values of mixed types.
Definition: scmatrix.hxx:101
virtual formula::ParamClass GetForceArrayParameter(const FormulaToken *pToken, sal_uInt16 nParam) const
virtual void CreateStringFromMatrix(OUStringBuffer &rBuffer, const FormulaToken *pToken) const
OpCodeMapPtr GetFinalOpCodeMap(const sal_Int32 nLanguage) const
virtual void fillAddInToken(::std::vector< css::sheet::FormulaOpCodeMapEntry > &_rVec, bool _bIsEnglish) const
virtual bool HandleColRowName()
virtual void AnnotateOperands()
virtual void SetError(FormulaError nError)
virtual FormulaTokenRef ExtendRangeReference(FormulaToken &rTok1, FormulaToken &rTok2)
virtual bool HandleRange()
virtual void fillFromAddInMap(const NonConstOpCodeMapPtr &xMap, FormulaGrammar::Grammar _eGrammar) const
virtual bool HandleExternalReference(const FormulaToken &_aToken)
virtual void CreateStringFromExternal(OUStringBuffer &rBuffer, const FormulaToken *pToken) const
virtual void fillFromAddInCollectionUpperName(const NonConstOpCodeMapPtr &xMap) const
virtual void CreateStringFromSingleRef(OUStringBuffer &rBuffer, const FormulaToken *pToken) const
virtual bool HandleDbData()
virtual void LocalizeString(OUString &rName) const
virtual void fillFromAddInCollectionEnglishName(const NonConstOpCodeMapPtr &xMap) const
virtual void CreateStringFromDoubleRef(OUStringBuffer &rBuffer, const FormulaToken *pToken) const
std::shared_ptr< const OpCodeMap > OpCodeMapPtr
virtual void HandleIIOpCode(FormulaToken *, FormulaToken ***, sal_uInt8)
virtual OUString FindAddInFunction(const OUString &rUpperName, bool bLocalFirst) const
virtual bool HandleTableRef()
virtual void PostProcessCode()
virtual void CreateStringFromIndex(OUStringBuffer &rBuffer, const FormulaToken *pToken) const
sal_Int16 mnLevel
ScCharFlags
Definition: compiler.hxx:50
#define MAXSTRLEN
Definition: compiler.hxx:47
int nCount
FormulaError
void * p
NONE
Value
::boost::intrusive_ptr< FormulaToken > FormulaTokenRef
CAUTION! The following defines must be in the same namespace as the respective type.
OpCode
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
const char * pEnglish
Definition: compiler.hxx:269
const char * pOriginal
Definition: compiler.hxx:270
const char * pODFF
Definition: compiler.hxx:268
const char * pUpper
Definition: compiler.hxx:271
virtual css::i18n::ParseResult parseAnyToken(const OUString &rFormula, sal_Int32 nSrcPos, const CharClass *pCharClass, bool bGroupSeparator) const =0
@ SHEET_SEPARATOR
Character between sheet name and address.
Definition: compiler.hxx:242
const formula::FormulaGrammar::AddressConvention meConv
Definition: compiler.hxx:193
virtual sal_Unicode getSpecialSymbol(SpecialSymbolType eSymType) const =0
virtual ScCharFlags getCharTableFlags(sal_Unicode c, sal_Unicode cLast) const =0
std::unique_ptr< ScCharFlags[]> mpCharTable
Definition: compiler.hxx:255
virtual OUString makeExternalNameStr(sal_uInt16 nFileId, const OUString &rFile, const OUString &rName) const =0
virtual void makeExternalRefStr(ScSheetLimits &rLimits, OUStringBuffer &rBuffer, const ScAddress &rPos, sal_uInt16 nFileId, const OUString &rFileName, const std::vector< OUString > &rTabNames, const OUString &rTabName, const ScComplexRefData &rRef) const =0
virtual bool parseExternalName(const OUString &rSymbol, OUString &rFile, OUString &rName, const ScDocument &rDoc, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks) const =0
Parse the symbol string and pick up the file name and the external range name.
virtual void makeExternalRefStr(ScSheetLimits &rLimits, OUStringBuffer &rBuffer, const ScAddress &rPos, sal_uInt16 nFileId, const OUString &rFileName, const OUString &rTabName, const ScSingleRefData &rRef) const =0
virtual void makeRefStr(ScSheetLimits &rLimits, OUStringBuffer &rBuffer, formula::FormulaGrammar::Grammar eGram, const ScAddress &rPos, const OUString &rErrRef, const std::vector< OUString > &rTabNames, const ScComplexRefData &rRef, bool bSingleRef, bool bFromRangeName) const =0
"stack" of currently active ocTableRef tokens
Definition: compiler.hxx:320
PendingImplicitIntersectionOptimization(formula::FormulaToken **p, formula::FormulaToken *o)
Definition: compiler.hxx:321
get or setup tab names for the current grammar
Definition: compiler.hxx:310
TableRefEntry(formula::FormulaToken *p)
Definition: compiler.hxx:313
void reset(sal_Unicode c)
Definition: compiler.hxx:344
Complex reference (a range) into the sheet.
Definition: refdata.hxx:123
void SetExternalDoubleRef(sal_uInt16 nFileId, const OUString &rTabName, const ScComplexRefData &rRef)
Definition: token.cxx:309
sal_Int16 nSheet
Definition: compiler.hxx:128
void SetDouble(double fVal)
Definition: token.cxx:275
void SetString(rtl_uString *pData, rtl_uString *pDataIgnoreCase)
Definition: token.cxx:251
struct ScRawToken::@17::@24 table
OpCode GetOpCode() const
Definition: compiler.hxx:151
void SetDoubleReference(const ScComplexRefData &rRef)
Definition: token.cxx:268
sal_uInt16 nFileId
Definition: compiler.hxx:121
short nJump[FORMULA_MAXJUMPCOUNT+1]
Definition: compiler.hxx:141
void NewOpCode(OpCode e)
Definition: compiler.hxx:152
OpCode eOp
Definition: compiler.hxx:106
void SetExternalSingleRef(sal_uInt16 nFileId, const OUString &rTabName, const ScSingleRefData &rRef)
Definition: token.cxx:298
ScMatrix * pMat
Definition: compiler.hxx:139
ScComplexRefData aRef
Definition: compiler.hxx:119
void SetOpCode(OpCode eCode)
Definition: token.cxx:207
struct ScRawToken::@17::@19 whitespace
struct ScRawToken::@17::@20 sbyte
void SetName(sal_Int16 nSheet, sal_uInt16 nIndex)
Definition: token.cxx:289
rtl_uString * mpData
Definition: compiler.hxx:136
sal_uInt8 cByte
Definition: compiler.hxx:116
sal_uInt16 nIndex
Definition: compiler.hxx:129
FormulaError nError
Definition: compiler.hxx:140
bool IsValidReference(const ScDocument &rDoc) const
If the token is a non-external reference, determine if the reference is valid.
Definition: token.cxx:335
struct ScRawToken::@17::@25 sharedstring
void SetSingleReference(const ScSingleRefData &rRef)
Definition: token.cxx:260
void SetErrorConstant(FormulaError nErr)
Definition: token.cxx:282
formula::StackVar GetType() const
only delete via Delete()
Definition: compiler.hxx:150
sal_Unicode cChar
Definition: compiler.hxx:113
formula::StackVar eType
Definition: compiler.hxx:107
struct ScRawToken::@17::@21 extref
void SetExternalName(sal_uInt16 nFileId, const OUString &rName)
Definition: token.cxx:319
double nValue
Definition: compiler.hxx:110
OUString maExternalName
Definition: compiler.hxx:143
rtl_uString * mpDataIgnoreCase
Definition: compiler.hxx:137
formula::ParamClass eInForceArray
Definition: compiler.hxx:117
sal_uInt8 nCount
Definition: compiler.hxx:112
struct ScRawToken::@17::@23 name
ScTableRefToken::Item eItem
Definition: compiler.hxx:133
void SetExternal(const OUString &rStr)
Definition: token.cxx:328
struct ScRawToken::@17::@22 extname
formula::FormulaToken * CreateToken(ScSheetLimits &rLimits) const
Definition: token.cxx:352
Single reference (one address) into the sheet.
Definition: refdata.hxx:30
OUString Name
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
::boost::intrusive_ptr< formula::FormulaToken > ScTokenRef
Definition: types.hxx:29
sal_Int32 SCROW
Definition: types.hxx:17