xref: /aoo42x/main/sc/inc/compiler.hxx (revision 898153d9)
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     OpCode  SAL_UNUSED_MEMBER		eOp;
121     formula::StackVar SAL_UNUSED_MEMBER	eType;
122     sal_uInt16 SAL_UNUSED_MEMBER	nRefCnt;
123     sal_Bool SAL_UNUSED_MEMBER		bRaw;
124 public:
125     union
126     {   // union only to assure alignment identical to ScRawToken
127         double      nValue;
128         struct {
129             sal_uInt8        cByte;
130             bool        bHasForceArray;
131         } sbyte;
132     };
133                 DECL_FIXEDMEMPOOL_NEWDEL( ScDoubleRawToken );
134 };
135 
136 struct ScRawToken
137 {
138     friend class ScCompiler;
139     // Friends that use a temporary ScRawToken on the stack (and therefor need
140     // the private dtor) and know what they're doing..
141     friend class ScTokenArray;
142     friend sal_uInt16 lcl_ScRawTokenOffset();
143 private:
144     SC_TOKEN_FIX_MEMBERS
145 public:
146     union {
147         double       nValue;
148         struct {
149             sal_uInt8        cByte;
150             bool        bHasForceArray;
151         } sbyte;
152         ScComplexRefData aRef;
153         struct {
154             sal_uInt16      nFileId;
155             sal_Unicode     cTabName[MAXSTRLEN+1];
156             ScComplexRefData    aRef;
157         } extref;
158         struct {
159             sal_uInt16  nFileId;
160             sal_Unicode cName[MAXSTRLEN+1];
161         } extname;
162         ScMatrix*    pMat;
163         sal_uInt16       nIndex;                // index into name collection
164         sal_Unicode  cStr[ MAXSTRLEN+1 ];   // string (up to 255 characters + 0)
165         short        nJump[MAXJUMPCOUNT+1]; // If/Chose token
166     };
167 
168                 //! other members not initialized
ScRawTokenScRawToken169                 ScRawToken() : bRaw( sal_True ) {}
170 private:
~ScRawTokenScRawToken171                 ~ScRawToken() {}                //! only delete via Delete()
172 public:
173                 DECL_FIXEDMEMPOOL_NEWDEL( ScRawToken );
GetTypeScRawToken174     formula::StackVar    GetType()   const       { return (formula::StackVar) eType; }
GetOpCodeScRawToken175     OpCode      GetOpCode() const       { return (OpCode)   eOp;   }
NewOpCodeScRawToken176     void        NewOpCode( OpCode e )   { eOp = e; }
IncRefScRawToken177     void        IncRef()                { nRefCnt++;       }
DecRefScRawToken178     void        DecRef()                { if( !--nRefCnt ) Delete(); }
GetRefScRawToken179     sal_uInt16      GetRef() const          { return nRefCnt; }
180     SC_DLLPUBLIC void       Delete();
181 
182     // Use these methods only on tokens that are not part of a token array,
183     // since the reference count is cleared!
184     void SetOpCode( OpCode eCode );
185     void SetString( const sal_Unicode* pStr );
186     void SetSingleReference( const ScSingleRefData& rRef );
187     void SetDoubleReference( const ScComplexRefData& rRef );
188     void SetDouble( double fVal );
189 //UNUSED2008-05  void SetInt( int nVal );
190 //UNUSED2008-05  void SetMatrix( ScMatrix* p );
191 
192     // These methods are ok to use, reference count not cleared.
193 //UNUSED2008-05  ScComplexRefData& GetReference();
194 //UNUSED2008-05  void SetReference( ScComplexRefData& rRef );
195     void SetName( sal_uInt16 n );
196     void SetExternalSingleRef( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef );
197     void SetExternalDoubleRef( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef );
198     void SetExternalName( sal_uInt16 nFileId, const String& rName );
199     void SetMatrix( ScMatrix* p );
200     void SetExternal(const sal_Unicode* pStr);
201 
202     ScRawToken* Clone() const;      // real copy!
203     formula::FormulaToken* CreateToken() const;   // create typified token
204     void Load( SvStream&, sal_uInt16 nVer );
205 
206     static xub_StrLen GetStrLen( const sal_Unicode* pStr ); // as long as a "string" is an array
GetStrLenBytesScRawToken207     static size_t GetStrLenBytes( xub_StrLen nLen )
208         { return nLen * sizeof(sal_Unicode); }
GetStrLenBytesScRawToken209     static size_t GetStrLenBytes( const sal_Unicode* pStr )
210         { return GetStrLenBytes( GetStrLen( pStr ) ); }
211 };
212 
213 
214 typedef formula::SimpleIntrusiveReference< struct ScRawToken > ScRawTokenRef;
215 
216 class SC_DLLPUBLIC ScCompiler : public formula::FormulaCompiler
217 {
218 public:
219 
220     enum EncodeUrlMode
221     {
222         ENCODE_BY_GRAMMAR,
223         ENCODE_ALWAYS,
224         ENCODE_NEVER,
225     };
226 
227     struct Convention
228     {
229         const formula::FormulaGrammar::AddressConvention meConv;
230         const sal_uLong*                mpCharTable;
231 
232 
233         Convention( formula::FormulaGrammar::AddressConvention eConvP );
234         virtual ~Convention();
235 
236         virtual void MakeRefStr( rtl::OUStringBuffer&   rBuffer,
237                                  const ScCompiler&      rCompiler,
238                                  const ScComplexRefData&    rRef,
239                                  sal_Bool bSingleRef ) const = 0;
240         virtual ::com::sun::star::i18n::ParseResult
241                     parseAnyToken( const String& rFormula,
242                                    xub_StrLen nSrcPos,
243                                    const CharClass* pCharClass) const = 0;
244 
245         /**
246          * Parse the symbol string and pick up the file name and the external
247          * range name.
248          *
249          * @return true on successful parse, or false otherwise.
250          */
251         virtual bool parseExternalName( const String& rSymbol, String& rFile, String& rName,
252                 const ScDocument* pDoc,
253                 const ::com::sun::star::uno::Sequence<
254                     const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const = 0;
255 
256         virtual String makeExternalNameStr( const String& rFile, const String& rName ) const = 0;
257 
258         virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
259                                          sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef,
260                                          ScExternalRefManager* pRefMgr ) const = 0;
261 
262         virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
263                                          sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef,
264                                          ScExternalRefManager* pRefMgr ) const = 0;
265 
266         enum SpecialSymbolType
267         {
268             /**
269              * Character between sheet name and address.  In OOO A1 this is
270              * '.', while XL A1 and XL R1C1 this is '!'.
271              */
272             SHEET_SEPARATOR,
273 
274             /**
275              * In OOO A1, a sheet name may be prefixed with '$' to indicate an
276              * absolute sheet position.
277              */
278             ABS_SHEET_PREFIX
279         };
280         virtual sal_Unicode getSpecialSymbol( SpecialSymbolType eSymType ) const = 0;
281     };
282     friend struct Convention;
283 
284 private:
285 
286 
287     static CharClass            *pCharClassEnglish;                      // character classification for en_US locale
288     static const Convention     *pConventions[ formula::FormulaGrammar::CONV_LAST ];
289 
290     static const Convention * const pConvOOO_A1;
291     static const Convention * const pConvOOO_A1_ODF;
292     static const Convention * const pConvXL_A1;
293     static const Convention * const pConvXL_R1C1;
294     static const Convention * const pConvXL_OOX;
295 
296     static struct AddInMap
297     {
298         const char* pODFF;
299         const char* pEnglish;
300         bool        bMapDupToInternal;      // when writing ODFF
301         const char* pOriginal;              // programmatical name
302         const char* pUpper;                 // upper case programmatical name
303     } maAddInMap[];
304     static const AddInMap* GetAddInMap();
305     static size_t GetAddInMapCount();
306 
307     ScDocument* pDoc;
308     ScAddress   aPos;
309 
310     // For CONV_XL_OOX, may be set via API by MOOXML filter.
311     ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > maExternalLinks;
312 
313     sal_Unicode cSymbol[MAXSTRLEN];                 // current Symbol
314     String      aFormula;                           // formula source code
315     xub_StrLen  nSrcPos;                            // tokenizer position (source code)
316     ScRawTokenRef   pRawToken;
317 
318     const CharClass*    pCharClass;         // which character classification is used for parseAnyToken
319     sal_uInt16      mnPredetectedReference;     // reference when reading ODF, 0 (none), 1 (single) or 2 (double)
320     SCsTAB      nMaxTab;                    // last sheet in document
321     sal_Int32   mnRangeOpPosInSymbol;       // if and where a range operator is in symbol
322     const Convention *pConv;
323     EncodeUrlMode   meEncodeUrlMode;
324     bool        mbCloseBrackets;            // whether to close open brackets automatically, default TRUE
325     bool        mbExtendedErrorDetection;
326     bool        mbRewind;                   // whether symbol is to be rewound to some step during lexical analysis
327 
328     sal_Bool   NextNewToken(bool bInArray = false);
329 
330     virtual void SetError(sal_uInt16 nError);
331     xub_StrLen NextSymbol(bool bInArray);
332     sal_Bool IsValue( const String& );
333     sal_Bool IsOpCode( const String&, bool bInArray );
334     sal_Bool IsOpCode2( const String& );
335     sal_Bool IsString();
336     sal_Bool IsReference( const String& );
337     sal_Bool IsSingleReference( const String& );
338     sal_Bool IsPredetectedReference( const String& );
339     sal_Bool IsDoubleReference( const String& );
340     sal_Bool IsMacro( const String& );
341     sal_Bool IsNamedRange( const String& );
342     bool IsExternalNamedRange( const String& rSymbol );
343     sal_Bool IsDBRange( const String& );
344     sal_Bool IsColRowName( const String& );
345     sal_Bool IsBoolean( const String& );
346     void AutoCorrectParsedSymbol();
347 
348     void SetRelNameReference();
349 
350     static void InitCharClassEnglish();
351 
352 public:
353     ScCompiler( ScDocument* pDocument, const ScAddress&);
354 
355     ScCompiler( ScDocument* pDocument, const ScAddress&,ScTokenArray& rArr);
356 
357 public:
358     static void DeInit();               /// all
359 
360     // for ScAddress::Format()
361     static void CheckTabQuotes( String& aTabName,
362                                 const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO );
363 
364     /** Analyzes a string for a 'Doc'#Tab construct, or 'Do''c'#Tab etc..
365 
366         @returns the position of the unquoted # hash mark in 'Doc'#Tab, or
367                  STRING_NOTFOUND if none. */
368     static xub_StrLen GetDocTabPos( const String& rString );
369 
370     static sal_Bool EnQuote( String& rStr );
371     sal_Unicode GetNativeAddressSymbol( Convention::SpecialSymbolType eType ) const;
372 
373 
374     // Check if it is a valid english function name
375     bool IsEnglishSymbol( const String& rName );
376 
377     //! _either_ CompileForFAP _or_ AutoCorrection, _not_ both
378     // #i101512# SetCompileForFAP is in formula::FormulaCompiler
SetAutoCorrection(sal_Bool bVal)379     void            SetAutoCorrection( sal_Bool bVal )
380                         { bAutoCorrect = bVal; bIgnoreErrors = bVal; }
SetCloseBrackets(bool bVal)381     void            SetCloseBrackets( bool bVal ) { mbCloseBrackets = bVal; }
382     void            SetRefConvention( const Convention *pConvP );
383     void            SetRefConvention( const formula::FormulaGrammar::AddressConvention eConv );
384 
385     /// Set symbol map if not empty.
386     void            SetFormulaLanguage( const OpCodeMapPtr & xMap );
387 
388     void            SetGrammar( const formula::FormulaGrammar::Grammar eGrammar );
389 
390     void            SetEncodeUrlMode( EncodeUrlMode eMode );
391     EncodeUrlMode   GetEncodeUrlMode() const;
392 private:
393     /** Set grammar and reference convention from within SetFormulaLanguage()
394         or SetGrammar().
395 
396         @param eNewGrammar
397             The new grammar to be set and the associated reference convention.
398 
399         @param eOldGrammar
400             The previous grammar that was active before SetFormulaLanguage().
401      */
402     void            SetGrammarAndRefConvention(
403                         const formula::FormulaGrammar::Grammar eNewGrammar,
404                         const formula::FormulaGrammar::Grammar eOldGrammar );
405 public:
406 
407     /// Set external link info for ScAddress::CONV_XL_OOX.
SetExternalLinks(const::com::sun::star::uno::Sequence<const::com::sun::star::sheet::ExternalLinkInfo> & rLinks)408     inline  void    SetExternalLinks(
409             const ::com::sun::star::uno::Sequence<
410             const ::com::sun::star::sheet::ExternalLinkInfo > & rLinks )
411     {
412         maExternalLinks = rLinks;
413     }
414 
415     void            CreateStringFromXMLTokenArray( String& rFormula, String& rFormulaNmsp );
416 
SetExtendedErrorDetection(bool bVal)417     void            SetExtendedErrorDetection( bool bVal ) { mbExtendedErrorDetection = bVal; }
418 
IsCorrected()419     sal_Bool            IsCorrected() { return bCorrected; }
GetCorrectedFormula()420     const String&   GetCorrectedFormula() { return aCorrectedFormula; }
421 
422     // Use convention from this->aPos by default
423     ScTokenArray* CompileString( const String& rFormula );
424     ScTokenArray* CompileString( const String& rFormula, const String& rFormulaNmsp );
GetDoc() const425     const ScDocument* GetDoc() const { return pDoc; }
GetPos() const426     const ScAddress& GetPos() const { return aPos; }
427 
428     void MoveRelWrap( SCCOL nMaxCol, SCROW nMaxRow );
429     static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos,
430                              SCCOL nMaxCol, SCROW nMaxRow );
431 
432     sal_Bool UpdateNameReference( UpdateRefMode eUpdateRefMode,
433                               const ScRange&,
434                               SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
435                               sal_Bool& rChanged, sal_Bool bSharedFormula = sal_False);
436 
437     ScRangeData* UpdateReference( UpdateRefMode eUpdateRefMode,
438                                   const ScAddress& rOldPos, const ScRange&,
439                                   SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
440                                   sal_Bool& rChanged, sal_Bool& rRefSizeChanged );
441 
442     /// Only once for converted shared formulas,
443     /// token array has to be compiled afterwards.
444     void UpdateSharedFormulaReference( UpdateRefMode eUpdateRefMode,
445                                   const ScAddress& rOldPos, const ScRange&,
446                                   SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
447 
448     ScRangeData* UpdateInsertTab(SCTAB nTable, sal_Bool bIsName );
449     ScRangeData* UpdateDeleteTab(SCTAB nTable, sal_Bool bIsMove, sal_Bool bIsName, sal_Bool& bCompile);
450     // the last parameter is true only when copying a sheet, to update the range name's address
451     ScRangeData* UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, bool bIsName, bool bOnlyUpdateOwnTab = false );
452 
453     sal_Bool HasModifiedRange();
454 
455     /** If the character is allowed as first character in sheet names or
456         references, includes '$' and '?'. */
IsCharWordChar(String const & rStr,xub_StrLen nPos,const formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO)457     static inline sal_Bool IsCharWordChar( String const & rStr,
458                                        xub_StrLen nPos,
459                                        const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO )
460         {
461             sal_Unicode c = rStr.GetChar( nPos );
462             if (c < 128)
463             {
464                 return pConventions[eConv] ? static_cast<sal_Bool>(
465                         (pConventions[eConv]->mpCharTable[ sal_uInt8(c) ] & SC_COMPILER_C_CHAR_WORD) == SC_COMPILER_C_CHAR_WORD) :
466                     sal_False;   // no convention => assume invalid
467             }
468             else
469                 return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos );
470         }
471 
472     /** If the character is allowed in sheet names, thus may be part of a
473         reference, includes '$' and '?' and such. */
IsWordChar(String const & rStr,xub_StrLen nPos,const formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO)474     static inline sal_Bool IsWordChar( String const & rStr,
475                                    xub_StrLen nPos,
476                                    const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO )
477         {
478             sal_Unicode c = rStr.GetChar( nPos );
479             if (c < 128)
480             {
481                 return pConventions[eConv] ? static_cast<sal_Bool>(
482                         (pConventions[eConv]->mpCharTable[ sal_uInt8(c) ] & SC_COMPILER_C_WORD) == SC_COMPILER_C_WORD) :
483                     sal_False;   // convention not known => assume invalid
484             }
485             else
486                 return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos );
487         }
488 
489     /** If the character is allowed as tested by nFlags (SC_COMPILER_C_...
490         bits) for all known address conventions. If more than one bit is given
491         in nFlags, all bits must match. If bTestLetterNumeric is sal_False and
492         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)493     static inline bool IsCharFlagAllConventions( String const & rStr,
494                                                  xub_StrLen nPos,
495                                                  sal_uLong nFlags,
496                                                  bool bTestLetterNumeric = true )
497         {
498             sal_Unicode c = rStr.GetChar( nPos );
499             if (c < 128)
500             {
501                 for ( int nConv = formula::FormulaGrammar::CONV_UNSPECIFIED;
502                         ++nConv < formula::FormulaGrammar::CONV_LAST; )
503                 {
504                     if (pConventions[nConv] &&
505                             ((pConventions[nConv]->mpCharTable[ sal_uInt8(c) ] & nFlags) != nFlags))
506                         return false;
507                     // convention not known => assume valid
508                 }
509                 return true;
510             }
511             else if (bTestLetterNumeric)
512                 return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos );
513             else
514                 return false;
515         }
516 
517 private:
518     // FormulaCompiler
519     virtual String FindAddInFunction( const String& rUpperName, sal_Bool bLocalFirst ) const;
520     virtual void fillFromAddInCollectionUpperName( NonConstOpCodeMapPtr xMap ) const;
521     virtual void fillFromAddInCollectionEnglishName( NonConstOpCodeMapPtr xMap ) const;
522     virtual void fillFromAddInMap( NonConstOpCodeMapPtr xMap, formula::FormulaGrammar::Grammar _eGrammar ) const;
523     virtual void fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaOpCodeMapEntry >& _rVec,bool _bIsEnglish) const;
524 
525     virtual sal_Bool HandleExternalReference(const formula::FormulaToken& _aToken);
526     virtual sal_Bool HandleRange();
527     virtual sal_Bool HandleSingleRef();
528     virtual sal_Bool HandleDbData();
529 
530     virtual formula::FormulaTokenRef ExtendRangeReference( formula::FormulaToken & rTok1, formula::FormulaToken & rTok2, bool bReuseDoubleRef );
531 	virtual void CreateStringFromExternal(rtl::OUStringBuffer& rBuffer, formula::FormulaToken* pTokenP);
532     virtual void CreateStringFromSingleRef(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP);
533     virtual void CreateStringFromDoubleRef(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP);
534     virtual void CreateStringFromMatrix( rtl::OUStringBuffer& rBuffer, formula::FormulaToken* _pTokenP);
535     virtual void CreateStringFromIndex(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP);
536     virtual void LocalizeString( String& rName );	// modify rName - input: exact name
537     virtual sal_Bool IsImportingXML() const;
538 
539     /// Access the CharTable flags
GetCharTableFlags(sal_Unicode c)540     inline sal_uLong GetCharTableFlags( sal_Unicode c )
541         { return c < 128 ? pConv->mpCharTable[ sal_uInt8(c) ] : 0; }
542 };
543 
544 SC_DLLPUBLIC String GetScCompilerNativeSymbol( OpCode eOp ); //CHINA001
545 
546 #endif
547