xref: /aoo4110/main/sc/inc/compiler.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_COMPILER_HXX
25 #define SC_COMPILER_HXX
26 
27 #ifndef INCLUDED_STRING_H
28 #include <string.h>
29 #define INCLUDED_STRING_H
30 #endif
31 #include <tools/mempool.hxx>
32 #include "scdllapi.h"
33 #include "global.hxx"
34 #include "refdata.hxx"
35 #include "formula/token.hxx"
36 #include "formula/intruref.hxx"
37 #include "formula/grammar.hxx"
38 #include <unotools/charclass.hxx>
39 #include <rtl/ustrbuf.hxx>
40 #include <com/sun/star/sheet/ExternalLinkInfo.hpp>
41 #include <vector>
42 
43 #include <formula/FormulaCompiler.hxx>
44 
45 
46 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
47 #include <boost/shared_ptr.hpp>
48 #endif
49 
50 #ifndef INCLUDED_HASH_MAP
51 #include <hash_map>
52 #define INCLUDED_HASH_MAP
53 #endif
54 
55 //-----------------------------------------------
56 
57 // constants and data types also for external modules (ScInterpreter et al)
58 
59 #define MAXCODE      512    /* maximum number of tokens in formula */
60 #define MAXSTRLEN    1024   /* maximum length of input string of one symbol */
61 #define MAXJUMPCOUNT 32     /* maximum number of jumps (ocChose) */
62 
63 // flag values of CharTable
64 #define SC_COMPILER_C_ILLEGAL         0x00000000
65 #define SC_COMPILER_C_CHAR            0x00000001
66 #define SC_COMPILER_C_CHAR_BOOL       0x00000002
67 #define SC_COMPILER_C_CHAR_WORD       0x00000004
68 #define SC_COMPILER_C_CHAR_VALUE      0x00000008
69 #define SC_COMPILER_C_CHAR_STRING     0x00000010
70 #define SC_COMPILER_C_CHAR_DONTCARE   0x00000020
71 #define SC_COMPILER_C_BOOL            0x00000040
72 #define SC_COMPILER_C_WORD            0x00000080
73 #define SC_COMPILER_C_WORD_SEP        0x00000100
74 #define SC_COMPILER_C_VALUE           0x00000200
75 #define SC_COMPILER_C_VALUE_SEP       0x00000400
76 #define SC_COMPILER_C_VALUE_EXP       0x00000800
77 #define SC_COMPILER_C_VALUE_SIGN      0x00001000
78 #define SC_COMPILER_C_VALUE_VALUE     0x00002000
79 #define SC_COMPILER_C_STRING_SEP      0x00004000
80 #define SC_COMPILER_C_NAME_SEP        0x00008000  // there can be only one! '\''
81 #define SC_COMPILER_C_CHAR_IDENT      0x00010000  // identifier (built-in function) or reference start
82 #define SC_COMPILER_C_IDENT           0x00020000  // identifier or reference continuation
83 #define SC_COMPILER_C_ODF_LBRACKET    0x00040000  // ODF '[' reference bracket
84 #define SC_COMPILER_C_ODF_RBRACKET    0x00080000  // ODF ']' reference bracket
85 #define SC_COMPILER_C_ODF_LABEL_OP    0x00100000  // ODF '!!' automatic intersection of labels
86 #define SC_COMPILER_C_ODF_NAME_MARKER 0x00200000  // ODF '$$' marker that starts a defined (range) name
87 #define SC_COMPILER_C_CHAR_NAME       0x00400000  // start character of a defined name
88 #define SC_COMPILER_C_NAME            0x00800000  // continuation character of a defined name
89 
90 #define SC_COMPILER_FILE_TAB_SEP      '#'         // 'Doc'#Tab
91 
92 
93 class ScDocument;
94 class ScMatrix;
95 class ScRangeData;
96 class ScExternalRefManager;
97 class ScTokenArray;
98 
99 // constants and data types internal to compiler
100 
101 #if 0
102 /*
103     OpCode   eOp;           // OpCode
104     formula::StackVar eType;         // type of data
105     sal_uInt16   nRefCnt;       // reference count
106     sal_Bool     bRaw;          // not cloned yet and trimmed to real size
107  */
108 #endif
109 
110 #define SC_TOKEN_FIX_MEMBERS    \
111     OpCode   eOp;               \
112     formula::StackVar eType;    \
113     sal_uInt16   nRefCnt;           \
114     sal_Bool     bRaw;
115 
116 struct ScDoubleRawToken
117 {
118 private:
119     SC_TOKEN_FIX_MEMBERS
120 public:
121     union
122     {   // union only to assure alignment identical to ScRawToken
123         double      nValue;
124         struct {
125             sal_uInt8        cByte;
126             bool        bHasForceArray;
127         } sbyte;
128     };
129                 DECL_FIXEDMEMPOOL_NEWDEL( ScDoubleRawToken );
130 };
131 
132 struct ScRawToken
133 {
134     friend class ScCompiler;
135     // Friends that use a temporary ScRawToken on the stack (and therefor need
136     // the private dtor) and know what they're doing..
137     friend class ScTokenArray;
138     friend sal_uInt16 lcl_ScRawTokenOffset();
139 private:
140     SC_TOKEN_FIX_MEMBERS
141 public:
142     union {
143         double       nValue;
144         struct {
145             sal_uInt8        cByte;
146             bool        bHasForceArray;
147         } sbyte;
148         ScComplexRefData aRef;
149         struct {
150             sal_uInt16      nFileId;
151             sal_Unicode     cTabName[MAXSTRLEN+1];
152             ScComplexRefData    aRef;
153         } extref;
154         struct {
155             sal_uInt16  nFileId;
156             sal_Unicode cName[MAXSTRLEN+1];
157         } extname;
158         ScMatrix*    pMat;
159         sal_uInt16       nIndex;                // index into name collection
160         sal_Unicode  cStr[ MAXSTRLEN+1 ];   // string (up to 255 characters + 0)
161         short        nJump[MAXJUMPCOUNT+1]; // If/Chose token
162     };
163 
164                 //! other members not initialized
ScRawTokenScRawToken165                 ScRawToken() : bRaw( sal_True ) {}
166 private:
~ScRawTokenScRawToken167                 ~ScRawToken() {}                //! only delete via Delete()
168 public:
169                 DECL_FIXEDMEMPOOL_NEWDEL( ScRawToken );
GetTypeScRawToken170     formula::StackVar    GetType()   const       { return (formula::StackVar) eType; }
GetOpCodeScRawToken171     OpCode      GetOpCode() const       { return (OpCode)   eOp;   }
NewOpCodeScRawToken172     void        NewOpCode( OpCode e )   { eOp = e; }
IncRefScRawToken173     void        IncRef()                { nRefCnt++;       }
DecRefScRawToken174     void        DecRef()                { if( !--nRefCnt ) Delete(); }
GetRefScRawToken175     sal_uInt16      GetRef() const          { return nRefCnt; }
176     SC_DLLPUBLIC void       Delete();
177 
178     // Use these methods only on tokens that are not part of a token array,
179     // since the reference count is cleared!
180     void SetOpCode( OpCode eCode );
181     void SetString( const sal_Unicode* pStr );
182     void SetSingleReference( const ScSingleRefData& rRef );
183     void SetDoubleReference( const ScComplexRefData& rRef );
184     void SetDouble( double fVal );
185 //UNUSED2008-05  void SetInt( int nVal );
186 //UNUSED2008-05  void SetMatrix( ScMatrix* p );
187 
188     // These methods are ok to use, reference count not cleared.
189 //UNUSED2008-05  ScComplexRefData& GetReference();
190 //UNUSED2008-05  void SetReference( ScComplexRefData& rRef );
191     void SetName( sal_uInt16 n );
192     void SetExternalSingleRef( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef );
193     void SetExternalDoubleRef( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef );
194     void SetExternalName( sal_uInt16 nFileId, const String& rName );
195     void SetMatrix( ScMatrix* p );
196     void SetExternal(const sal_Unicode* pStr);
197 
198     ScRawToken* Clone() const;      // real copy!
199     formula::FormulaToken* CreateToken() const;   // create typified token
200     void Load( SvStream&, sal_uInt16 nVer );
201 
202     static xub_StrLen GetStrLen( const sal_Unicode* pStr ); // as long as a "string" is an array
GetStrLenBytesScRawToken203     static size_t GetStrLenBytes( xub_StrLen nLen )
204         { return nLen * sizeof(sal_Unicode); }
GetStrLenBytesScRawToken205     static size_t GetStrLenBytes( const sal_Unicode* pStr )
206         { return GetStrLenBytes( GetStrLen( pStr ) ); }
207 };
208 
209 
210 typedef formula::SimpleIntrusiveReference< struct ScRawToken > ScRawTokenRef;
211 
212 class SC_DLLPUBLIC ScCompiler : public formula::FormulaCompiler
213 {
214 public:
215 
216     enum EncodeUrlMode
217     {
218         ENCODE_BY_GRAMMAR,
219         ENCODE_ALWAYS,
220         ENCODE_NEVER,
221     };
222 
223     struct Convention
224     {
225         const formula::FormulaGrammar::AddressConvention meConv;
226         const sal_uLong*                mpCharTable;
227 
228 
229         Convention( formula::FormulaGrammar::AddressConvention eConvP );
230         virtual ~Convention();
231 
232         virtual void MakeRefStr( rtl::OUStringBuffer&   rBuffer,
233                                  const ScCompiler&      rCompiler,
234                                  const ScComplexRefData&    rRef,
235                                  sal_Bool bSingleRef ) const = 0;
236         virtual ::com::sun::star::i18n::ParseResult
237                     parseAnyToken( const String& rFormula,
238                                    xub_StrLen nSrcPos,
239                                    const CharClass* pCharClass) const = 0;
240 
241         /**
242          * Parse the symbol string and pick up the file name and the external
243          * range name.
244          *
245          * @return true on successful parse, or false otherwise.
246          */
247         virtual bool parseExternalName( const String& rSymbol, String& rFile, String& rName,
248                 const ScDocument* pDoc,
249                 const ::com::sun::star::uno::Sequence<
250                     const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const = 0;
251 
252         virtual String makeExternalNameStr( const String& rFile, const String& rName ) const = 0;
253 
254         virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
255                                          sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef,
256                                          ScExternalRefManager* pRefMgr ) const = 0;
257 
258         virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
259                                          sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef,
260                                          ScExternalRefManager* pRefMgr ) const = 0;
261 
262         enum SpecialSymbolType
263         {
264             /**
265              * Character between sheet name and address.  In OOO A1 this is
266              * '.', while XL A1 and XL R1C1 this is '!'.
267              */
268             SHEET_SEPARATOR,
269 
270             /**
271              * In OOO A1, a sheet name may be prefixed with '$' to indicate an
272              * absolute sheet position.
273              */
274             ABS_SHEET_PREFIX
275         };
276         virtual sal_Unicode getSpecialSymbol( SpecialSymbolType eSymType ) const = 0;
277     };
278     friend struct Convention;
279 
280 private:
281 
282 
283     static CharClass            *pCharClassEnglish;                      // character classification for en_US locale
284     static const Convention     *pConventions[ formula::FormulaGrammar::CONV_LAST ];
285 
286     static const Convention * const pConvOOO_A1;
287     static const Convention * const pConvOOO_A1_ODF;
288     static const Convention * const pConvXL_A1;
289     static const Convention * const pConvXL_R1C1;
290     static const Convention * const pConvXL_OOX;
291 
292     static struct AddInMap
293     {
294         const char* pODFF;
295         const char* pEnglish;
296         bool        bMapDupToInternal;      // when writing ODFF
297         const char* pOriginal;              // programmatical name
298         const char* pUpper;                 // upper case programmatical name
299     } maAddInMap[];
300     static const AddInMap* GetAddInMap();
301     static size_t GetAddInMapCount();
302 
303     ScDocument* pDoc;
304     ScAddress   aPos;
305 
306     // For CONV_XL_OOX, may be set via API by MOOXML filter.
307     ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > maExternalLinks;
308 
309     sal_Unicode cSymbol[MAXSTRLEN];                 // current Symbol
310     String      aFormula;                           // formula source code
311     xub_StrLen  nSrcPos;                            // tokenizer position (source code)
312     ScRawTokenRef   pRawToken;
313 
314     const CharClass*    pCharClass;         // which character classification is used for parseAnyToken
315     sal_uInt16      mnPredetectedReference;     // reference when reading ODF, 0 (none), 1 (single) or 2 (double)
316     SCsTAB      nMaxTab;                    // last sheet in document
317     sal_Int32   mnRangeOpPosInSymbol;       // if and where a range operator is in symbol
318     const Convention *pConv;
319     EncodeUrlMode   meEncodeUrlMode;
320     bool        mbCloseBrackets;            // whether to close open brackets automatically, default TRUE
321     bool        mbExtendedErrorDetection;
322     bool        mbRewind;                   // whether symbol is to be rewound to some step during lexical analysis
323 
324     sal_Bool   NextNewToken(bool bInArray = false);
325 
326     virtual void SetError(sal_uInt16 nError);
327     xub_StrLen NextSymbol(bool bInArray);
328     sal_Bool IsValue( const String& );
329     sal_Bool IsOpCode( const String&, bool bInArray );
330     sal_Bool IsOpCode2( const String& );
331     sal_Bool IsString();
332     sal_Bool IsReference( const String& );
333     sal_Bool IsSingleReference( const String& );
334     sal_Bool IsPredetectedReference( const String& );
335     sal_Bool IsDoubleReference( const String& );
336     sal_Bool IsMacro( const String& );
337     sal_Bool IsNamedRange( const String& );
338     bool IsExternalNamedRange( const String& rSymbol );
339     sal_Bool IsDBRange( const String& );
340     sal_Bool IsColRowName( const String& );
341     sal_Bool IsBoolean( const String& );
342     void AutoCorrectParsedSymbol();
343 
344     void SetRelNameReference();
345 
346     static void InitCharClassEnglish();
347 
348 public:
349     ScCompiler( ScDocument* pDocument, const ScAddress&);
350 
351     ScCompiler( ScDocument* pDocument, const ScAddress&,ScTokenArray& rArr);
352 
353 public:
354     static void DeInit();               /// all
355 
356     // for ScAddress::Format()
357     static void CheckTabQuotes( String& aTabName,
358                                 const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO );
359 
360     /** Analyzes a string for a 'Doc'#Tab construct, or 'Do''c'#Tab etc..
361 
362         @returns the position of the unquoted # hash mark in 'Doc'#Tab, or
363                  STRING_NOTFOUND if none. */
364     static xub_StrLen GetDocTabPos( const String& rString );
365 
366     static sal_Bool EnQuote( String& rStr );
367     sal_Unicode GetNativeAddressSymbol( Convention::SpecialSymbolType eType ) const;
368 
369 
370     // Check if it is a valid english function name
371     bool IsEnglishSymbol( const String& rName );
372 
373     //! _either_ CompileForFAP _or_ AutoCorrection, _not_ both
374     // #i101512# SetCompileForFAP is in formula::FormulaCompiler
SetAutoCorrection(sal_Bool bVal)375     void            SetAutoCorrection( sal_Bool bVal )
376                         { bAutoCorrect = bVal; bIgnoreErrors = bVal; }
SetCloseBrackets(bool bVal)377     void            SetCloseBrackets( bool bVal ) { mbCloseBrackets = bVal; }
378     void            SetRefConvention( const Convention *pConvP );
379     void            SetRefConvention( const formula::FormulaGrammar::AddressConvention eConv );
380 
381     /// Set symbol map if not empty.
382     void            SetFormulaLanguage( const OpCodeMapPtr & xMap );
383 
384     void            SetGrammar( const formula::FormulaGrammar::Grammar eGrammar );
385 
386     void            SetEncodeUrlMode( EncodeUrlMode eMode );
387     EncodeUrlMode   GetEncodeUrlMode() const;
388 private:
389     /** Set grammar and reference convention from within SetFormulaLanguage()
390         or SetGrammar().
391 
392         @param eNewGrammar
393             The new grammar to be set and the associated reference convention.
394 
395         @param eOldGrammar
396             The previous grammar that was active before SetFormulaLanguage().
397      */
398     void            SetGrammarAndRefConvention(
399                         const formula::FormulaGrammar::Grammar eNewGrammar,
400                         const formula::FormulaGrammar::Grammar eOldGrammar );
401 public:
402 
403     /// Set external link info for ScAddress::CONV_XL_OOX.
SetExternalLinks(const::com::sun::star::uno::Sequence<const::com::sun::star::sheet::ExternalLinkInfo> & rLinks)404     inline  void    SetExternalLinks(
405             const ::com::sun::star::uno::Sequence<
406             const ::com::sun::star::sheet::ExternalLinkInfo > & rLinks )
407     {
408         maExternalLinks = rLinks;
409     }
410 
411     void            CreateStringFromXMLTokenArray( String& rFormula, String& rFormulaNmsp );
412 
SetExtendedErrorDetection(bool bVal)413     void            SetExtendedErrorDetection( bool bVal ) { mbExtendedErrorDetection = bVal; }
414 
IsCorrected()415     sal_Bool            IsCorrected() { return bCorrected; }
GetCorrectedFormula()416     const String&   GetCorrectedFormula() { return aCorrectedFormula; }
417 
418     // Use convention from this->aPos by default
419     ScTokenArray* CompileString( const String& rFormula );
420     ScTokenArray* CompileString( const String& rFormula, const String& rFormulaNmsp );
GetDoc() const421     const ScDocument* GetDoc() const { return pDoc; }
GetPos() const422     const ScAddress& GetPos() const { return aPos; }
423 
424     void MoveRelWrap( SCCOL nMaxCol, SCROW nMaxRow );
425     static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos,
426                              SCCOL nMaxCol, SCROW nMaxRow );
427 
428     sal_Bool UpdateNameReference( UpdateRefMode eUpdateRefMode,
429                               const ScRange&,
430                               SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
431                               sal_Bool& rChanged, sal_Bool bSharedFormula = sal_False);
432 
433     ScRangeData* UpdateReference( UpdateRefMode eUpdateRefMode,
434                                   const ScAddress& rOldPos, const ScRange&,
435                                   SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
436                                   sal_Bool& rChanged, sal_Bool& rRefSizeChanged );
437 
438     /// Only once for converted shared formulas,
439     /// token array has to be compiled afterwards.
440     void UpdateSharedFormulaReference( UpdateRefMode eUpdateRefMode,
441                                   const ScAddress& rOldPos, const ScRange&,
442                                   SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
443 
444     ScRangeData* UpdateInsertTab(SCTAB nTable, sal_Bool bIsName );
445     ScRangeData* UpdateDeleteTab(SCTAB nTable, sal_Bool bIsMove, sal_Bool bIsName, sal_Bool& bCompile);
446     // the last parameter is true only when copying a sheet, to update the range name's address
447     ScRangeData* UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, bool bIsName, bool bOnlyUpdateOwnTab = false );
448 
449     sal_Bool HasModifiedRange();
450 
451     /** If the character is allowed as first character in sheet names or
452         references, includes '$' and '?'. */
IsCharWordChar(String const & rStr,xub_StrLen nPos,const formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO)453     static inline sal_Bool IsCharWordChar( String const & rStr,
454                                        xub_StrLen nPos,
455                                        const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO )
456         {
457             sal_Unicode c = rStr.GetChar( nPos );
458             if (c < 128)
459             {
460                 return pConventions[eConv] ? static_cast<sal_Bool>(
461                         (pConventions[eConv]->mpCharTable[ sal_uInt8(c) ] & SC_COMPILER_C_CHAR_WORD) == SC_COMPILER_C_CHAR_WORD) :
462                     sal_False;   // no convention => assume invalid
463             }
464             else
465                 return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos );
466         }
467 
468     /** If the character is allowed in sheet names, thus may be part of a
469         reference, includes '$' and '?' and such. */
IsWordChar(String const & rStr,xub_StrLen nPos,const formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO)470     static inline sal_Bool IsWordChar( String const & rStr,
471                                    xub_StrLen nPos,
472                                    const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO )
473         {
474             sal_Unicode c = rStr.GetChar( nPos );
475             if (c < 128)
476             {
477                 return pConventions[eConv] ? static_cast<sal_Bool>(
478                         (pConventions[eConv]->mpCharTable[ sal_uInt8(c) ] & SC_COMPILER_C_WORD) == SC_COMPILER_C_WORD) :
479                     sal_False;   // convention not known => assume invalid
480             }
481             else
482                 return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos );
483         }
484 
485     /** If the character is allowed as tested by nFlags (SC_COMPILER_C_...
486         bits) for all known address conventions. If more than one bit is given
487         in nFlags, all bits must match. If bTestLetterNumeric is sal_False and
488         char>=128, no LetterNumeric test is done and sal_False is returned. */
IsCharFlagAllConventions(String const & rStr,xub_StrLen nPos,sal_uLong nFlags,bool bTestLetterNumeric=true)489     static inline bool IsCharFlagAllConventions( String const & rStr,
490                                                  xub_StrLen nPos,
491                                                  sal_uLong nFlags,
492                                                  bool bTestLetterNumeric = true )
493         {
494             sal_Unicode c = rStr.GetChar( nPos );
495             if (c < 128)
496             {
497                 for ( int nConv = formula::FormulaGrammar::CONV_UNSPECIFIED;
498                         ++nConv < formula::FormulaGrammar::CONV_LAST; )
499                 {
500                     if (pConventions[nConv] &&
501                             ((pConventions[nConv]->mpCharTable[ sal_uInt8(c) ] & nFlags) != nFlags))
502                         return false;
503                     // convention not known => assume valid
504                 }
505                 return true;
506             }
507             else if (bTestLetterNumeric)
508                 return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos );
509             else
510                 return false;
511         }
512 
513 private:
514     // FormulaCompiler
515     virtual String FindAddInFunction( const String& rUpperName, sal_Bool bLocalFirst ) const;
516     virtual void fillFromAddInCollectionUpperName( NonConstOpCodeMapPtr xMap ) const;
517     virtual void fillFromAddInCollectionEnglishName( NonConstOpCodeMapPtr xMap ) const;
518     virtual void fillFromAddInMap( NonConstOpCodeMapPtr xMap, formula::FormulaGrammar::Grammar _eGrammar ) const;
519     virtual void fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaOpCodeMapEntry >& _rVec,bool _bIsEnglish) const;
520 
521     virtual sal_Bool HandleExternalReference(const formula::FormulaToken& _aToken);
522     virtual sal_Bool HandleRange();
523     virtual sal_Bool HandleSingleRef();
524     virtual sal_Bool HandleDbData();
525 
526     virtual formula::FormulaTokenRef ExtendRangeReference( formula::FormulaToken & rTok1, formula::FormulaToken & rTok2, bool bReuseDoubleRef );
527 	virtual void CreateStringFromExternal(rtl::OUStringBuffer& rBuffer, formula::FormulaToken* pTokenP);
528     virtual void CreateStringFromSingleRef(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP);
529     virtual void CreateStringFromDoubleRef(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP);
530     virtual void CreateStringFromMatrix( rtl::OUStringBuffer& rBuffer, formula::FormulaToken* _pTokenP);
531     virtual void CreateStringFromIndex(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP);
532     virtual void LocalizeString( String& rName );	// modify rName - input: exact name
533     virtual sal_Bool IsImportingXML() const;
534 
535     /// Access the CharTable flags
GetCharTableFlags(sal_Unicode c)536     inline sal_uLong GetCharTableFlags( sal_Unicode c )
537         { return c < 128 ? pConv->mpCharTable[ sal_uInt8(c) ] : 0; }
538 };
539 
540 SC_DLLPUBLIC String GetScCompilerNativeSymbol( OpCode eOp ); //CHINA001
541 
542 #endif
543