xref: /aoo41x/main/sc/source/filter/inc/tokstack.hxx (revision 3ee7c2db)
138d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
338d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
438d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
538d50f7bSAndrew Rist  * distributed with this work for additional information
638d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
738d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
838d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
938d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
1038d50f7bSAndrew Rist  *
1138d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1238d50f7bSAndrew Rist  *
1338d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1438d50f7bSAndrew Rist  * software distributed under the License is distributed on an
1538d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1638d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
1738d50f7bSAndrew Rist  * specific language governing permissions and limitations
1838d50f7bSAndrew Rist  * under the License.
1938d50f7bSAndrew Rist  *
2038d50f7bSAndrew Rist  *************************************************************/
2138d50f7bSAndrew Rist 
2238d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_TOKSTACK_HXX
25cdf0e10cSrcweir #define SC_TOKSTACK_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <string.h>
28cdf0e10cSrcweir #include <tools/debug.hxx>
29cdf0e10cSrcweir #include "compiler.hxx"
30cdf0e10cSrcweir #include "tokenarray.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <vector>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir typedef OpCode DefTokenId;
35cdf0e10cSrcweir // in PRODUCT version: ambiguity between OpCode (being sal_uInt16) and UINT16
36cdf0e10cSrcweir // Unfortunately a typedef is just a dumb alias and not a real type ...
37cdf0e10cSrcweir //typedef sal_uInt16 TokenId;
38cdf0e10cSrcweir struct TokenId
39cdf0e10cSrcweir {
40cdf0e10cSrcweir 		sal_uInt16			nId;
41cdf0e10cSrcweir 
TokenIdTokenId42cdf0e10cSrcweir 						TokenId() : nId( 0 ) {}
TokenIdTokenId43cdf0e10cSrcweir 						TokenId( sal_uInt16 n ) : nId( n ) {}
TokenIdTokenId44cdf0e10cSrcweir 						TokenId( const TokenId& r ) : nId( r.nId ) {}
operator =TokenId45cdf0e10cSrcweir 	inline	TokenId&	operator =( const TokenId& r ) { nId = r.nId; return *this; }
operator =TokenId46cdf0e10cSrcweir 	inline	TokenId&	operator =( sal_uInt16 n ) { nId = n; return *this; }
operator sal_uInt16&TokenId47cdf0e10cSrcweir 	inline				operator sal_uInt16&() { return nId; }
48cdf0e10cSrcweir 	inline				operator const sal_uInt16&() const { return nId; }
operator <TokenId49cdf0e10cSrcweir 	inline	sal_Bool		operator <( sal_uInt16 n ) const { return nId < n; }
operator >TokenId50cdf0e10cSrcweir 	inline	sal_Bool		operator >( sal_uInt16 n ) const { return nId > n; }
operator <=TokenId51cdf0e10cSrcweir 	inline	sal_Bool		operator <=( sal_uInt16 n ) const { return nId <= n; }
operator >=TokenId52cdf0e10cSrcweir 	inline	sal_Bool		operator >=( sal_uInt16 n ) const { return nId >= n; }
operator ==TokenId53cdf0e10cSrcweir 	inline	sal_Bool		operator ==( sal_uInt16 n ) const { return nId == n; }
operator !=TokenId54cdf0e10cSrcweir 	inline	sal_Bool		operator !=( sal_uInt16 n ) const { return nId != n; }
55cdf0e10cSrcweir };
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 
58cdf0e10cSrcweir //------------------------------------------------------------------------
59cdf0e10cSrcweir struct ScComplexRefData;
60cdf0e10cSrcweir class TokenStack;
61cdf0e10cSrcweir class ScToken;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 
64cdf0e10cSrcweir enum E_TYPE
65cdf0e10cSrcweir {
66cdf0e10cSrcweir 	T_Id,		// Id-Folge
67cdf0e10cSrcweir 	T_Str,		// String
68cdf0e10cSrcweir 	T_D,		// Double
69cdf0e10cSrcweir     T_Err,      // Error code
70cdf0e10cSrcweir 	T_RefC,		// Cell Reference
71cdf0e10cSrcweir 	T_RefA,		// Area Reference
72cdf0e10cSrcweir 	T_RN,		// Range Name
73cdf0e10cSrcweir 	T_Ext,		// irgendwas Unbekanntes mit Funktionsnamen
74cdf0e10cSrcweir 	T_Nlf,		// token for natural language formula
75cdf0e10cSrcweir 	T_Matrix,	// token for inline arrays
76cdf0e10cSrcweir     T_ExtName,  // token for external names
77cdf0e10cSrcweir     T_ExtRefC,
78cdf0e10cSrcweir     T_ExtRefA,
79cdf0e10cSrcweir 	T_Error		// fuer Abfrage im Fehlerfall
80cdf0e10cSrcweir };
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 
85cdf0e10cSrcweir class TokenPool
86cdf0e10cSrcweir {
87cdf0e10cSrcweir 	// !ACHTUNG!: externe Id-Basis ist 1, interne 0!
88cdf0e10cSrcweir 	// Ausgabe Id = 0 -> Fehlerfall
89cdf0e10cSrcweir 	private:
90cdf0e10cSrcweir 		String**					ppP_Str;	// Pool fuer Strings
91cdf0e10cSrcweir 		sal_uInt16						nP_Str;		// ...mit Groesse
92cdf0e10cSrcweir 		sal_uInt16						nP_StrAkt;	// ...und Schreibmarke
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 		double*						pP_Dbl;		// Pool fuer Doubles
95cdf0e10cSrcweir 		sal_uInt16						nP_Dbl;
96cdf0e10cSrcweir 		sal_uInt16						nP_DblAkt;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir         sal_uInt16*                     pP_Err;     // Pool for error codes
99cdf0e10cSrcweir         sal_uInt16                      nP_Err;
100cdf0e10cSrcweir         sal_uInt16                      nP_ErrAkt;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 		ScSingleRefData**				ppP_RefTr;	// Pool fuer Referenzen
103cdf0e10cSrcweir 		sal_uInt16						nP_RefTr;
104cdf0e10cSrcweir 		sal_uInt16						nP_RefTrAkt;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 		sal_uInt16*						pP_Id;		// Pool fuer Id-Folgen
107cdf0e10cSrcweir 		sal_uInt16						nP_Id;
108cdf0e10cSrcweir 		sal_uInt16						nP_IdAkt;
109cdf0e10cSrcweir 		sal_uInt16						nP_IdLast;	// letzter Folgen-Beginn
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 		struct	EXTCONT
112cdf0e10cSrcweir 		{
113cdf0e10cSrcweir 			DefTokenId				eId;
114cdf0e10cSrcweir 			String					aText;
EXTCONTTokenPool::EXTCONT115cdf0e10cSrcweir 									EXTCONT( const DefTokenId e, const String& r ) :
116cdf0e10cSrcweir 										eId( e ), aText( r ){}
117cdf0e10cSrcweir 		};
118cdf0e10cSrcweir 		EXTCONT**					ppP_Ext;
119cdf0e10cSrcweir 		sal_uInt16						nP_Ext;
120cdf0e10cSrcweir 		sal_uInt16						nP_ExtAkt;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 		struct	NLFCONT
123cdf0e10cSrcweir 		{
124cdf0e10cSrcweir 			ScSingleRefData			aRef;
NLFCONTTokenPool::NLFCONT125cdf0e10cSrcweir 									NLFCONT( const ScSingleRefData& r ) : aRef( r )	{}
126cdf0e10cSrcweir 		};
127cdf0e10cSrcweir 		NLFCONT**					ppP_Nlf;
128cdf0e10cSrcweir 		sal_uInt16						nP_Nlf;
129cdf0e10cSrcweir 		sal_uInt16						nP_NlfAkt;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 		ScMatrix**					ppP_Matrix;		// Pool fuer Matricies
132cdf0e10cSrcweir 		sal_uInt16						nP_Matrix;
133cdf0e10cSrcweir 		sal_uInt16						nP_MatrixAkt;
134cdf0e10cSrcweir 
135cdf0e10cSrcweir         /** for storage of external names */
136cdf0e10cSrcweir         struct ExtName
137cdf0e10cSrcweir         {
138cdf0e10cSrcweir             sal_uInt16  mnFileId;
139cdf0e10cSrcweir             String      maName;
140cdf0e10cSrcweir         };
141cdf0e10cSrcweir         ::std::vector<ExtName>      maExtNames;
142cdf0e10cSrcweir 
143cdf0e10cSrcweir         /** for storage of external cell references */
144cdf0e10cSrcweir         struct ExtCellRef
145cdf0e10cSrcweir         {
146cdf0e10cSrcweir             sal_uInt16      mnFileId;
147cdf0e10cSrcweir 			String			maTabName;
148cdf0e10cSrcweir             ScSingleRefData   maRef;
149cdf0e10cSrcweir         };
150cdf0e10cSrcweir         ::std::vector<ExtCellRef>   maExtCellRefs;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir         /** for storage of external area references */
153cdf0e10cSrcweir         struct ExtAreaRef
154cdf0e10cSrcweir         {
155cdf0e10cSrcweir             sal_uInt16      mnFileId;
156cdf0e10cSrcweir 			String			maTabName;
157cdf0e10cSrcweir             ScComplexRefData    maRef;
158cdf0e10cSrcweir         };
159cdf0e10cSrcweir         ::std::vector<ExtAreaRef>   maExtAreaRefs;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 		sal_uInt16*						pElement;	// Array mit Indizes fuer Elemente
162cdf0e10cSrcweir 		E_TYPE*						pType;		// ...mit Typ-Info
163cdf0e10cSrcweir 		sal_uInt16*						pSize;		// ...mit Laengenangabe (Anz. sal_uInt16)
164cdf0e10cSrcweir 		sal_uInt16						nElement;
165cdf0e10cSrcweir 		sal_uInt16						nElementAkt;
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 		static const sal_uInt16			nScTokenOff;// Offset fuer SC-Token
168cdf0e10cSrcweir #ifdef DBG_UTIL
169cdf0e10cSrcweir 		sal_uInt16						nRek;		// Rekursionszaehler
170cdf0e10cSrcweir #endif
171cdf0e10cSrcweir 		ScTokenArray*				pScToken;	// Tokenbastler
172cdf0e10cSrcweir 
173*3ee7c2dbSArmin Le Grand 		bool						GrowString( void );
174*3ee7c2dbSArmin Le Grand 		bool						GrowDouble( void );
175*3ee7c2dbSArmin Le Grand /* TODO: in case we had FormulaTokenArray::AddError() */
176*3ee7c2dbSArmin Le Grand #if 0
177*3ee7c2dbSArmin Le Grand         bool                        GrowError( void );
178*3ee7c2dbSArmin Le Grand #endif
179*3ee7c2dbSArmin Le Grand 		bool						GrowTripel( sal_uInt16 nByMin = 1 );
180*3ee7c2dbSArmin Le Grand 		bool						GrowId( void );
181*3ee7c2dbSArmin Le Grand 		bool						GrowElement( void );
182*3ee7c2dbSArmin Le Grand 		bool						GrowExt( void );
183*3ee7c2dbSArmin Le Grand 		bool						GrowNlf( void );
184*3ee7c2dbSArmin Le Grand 		bool						GrowMatrix( void );
185*3ee7c2dbSArmin Le Grand 		bool						GetElement( const sal_uInt16 nId );
186*3ee7c2dbSArmin Le Grand 		bool						GetElementRek( const sal_uInt16 nId );
187cdf0e10cSrcweir 	public:
188cdf0e10cSrcweir 									TokenPool( void );
189cdf0e10cSrcweir 									~TokenPool();
190cdf0e10cSrcweir 		inline TokenPool&			operator <<( const TokenId nId );
191cdf0e10cSrcweir 		inline TokenPool&			operator <<( const DefTokenId eId );
192cdf0e10cSrcweir 		inline TokenPool&			operator <<( TokenStack& rStack );
193cdf0e10cSrcweir 		void						operator >>( TokenId& rId );
194cdf0e10cSrcweir 		inline void					operator >>( TokenStack& rStack );
195cdf0e10cSrcweir 		inline const TokenId		Store( void );
196cdf0e10cSrcweir 		const TokenId				Store( const double& rDouble );
197cdf0e10cSrcweir //UNUSED2008-05  const TokenId               StoreError( sal_uInt16 nError );
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 									// nur fuer Range-Names
200cdf0e10cSrcweir 		const TokenId				Store( const sal_uInt16 nIndex );
201cdf0e10cSrcweir 		inline const TokenId		Store( const sal_Int16 nWert );
202cdf0e10cSrcweir 		const TokenId				Store( const String& rString );
203cdf0e10cSrcweir 		const TokenId				Store( const ScSingleRefData& rTr );
204cdf0e10cSrcweir 		const TokenId				Store( const ScComplexRefData& rTr );
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 		const TokenId				Store( const DefTokenId eId, const String& rName );
207cdf0e10cSrcweir 										// 4 externals (e.g. AddIns, Makros...)
208cdf0e10cSrcweir 		const TokenId				StoreNlf( const ScSingleRefData& rTr );
209cdf0e10cSrcweir         const TokenId               StoreMatrix();
210cdf0e10cSrcweir         const TokenId               StoreExtName( sal_uInt16 nFileId, const String& rName );
211cdf0e10cSrcweir         const TokenId               StoreExtRef( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef );
212cdf0e10cSrcweir         const TokenId               StoreExtRef( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef );
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 		inline const TokenId		LastId( void ) const;
215cdf0e10cSrcweir 		inline const ScTokenArray*	operator []( const TokenId nId );
216cdf0e10cSrcweir 		void						Reset( void );
217cdf0e10cSrcweir 		inline E_TYPE				GetType( const TokenId& nId ) const;
218cdf0e10cSrcweir 		sal_Bool						IsSingleOp( const TokenId& nId, const DefTokenId eId ) const;
219cdf0e10cSrcweir         const String*               GetExternal( const TokenId& nId ) const;
220cdf0e10cSrcweir 		ScMatrix*					GetMatrix( unsigned int n ) const;
221cdf0e10cSrcweir };
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 
226cdf0e10cSrcweir class TokenStack
227cdf0e10cSrcweir 	// Stack fuer Token-Ids: Id 0 sollte reserviert bleiben als
228cdf0e10cSrcweir 	//	fehlerhafte Id,	da z.B. Get() im Fehlerfall 0 liefert
229cdf0e10cSrcweir {
230cdf0e10cSrcweir 	private:
231cdf0e10cSrcweir 		TokenId*					pStack;		// Stack als Array
232cdf0e10cSrcweir 		sal_uInt16						nPos;		// Schreibmarke
233cdf0e10cSrcweir 		sal_uInt16						nSize;		// Erster Index ausserhalb des Stacks
234cdf0e10cSrcweir 	public:
235cdf0e10cSrcweir 									TokenStack( sal_uInt16 nNewSize = 1024 );
236cdf0e10cSrcweir 									~TokenStack();
237cdf0e10cSrcweir 		inline TokenStack&			operator <<( const TokenId nNewId );
238cdf0e10cSrcweir 		inline void					operator >>( TokenId &rId );
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 		inline void					Reset( void );
241cdf0e10cSrcweir 
HasMoreTokens() const242cdf0e10cSrcweir         inline bool                 HasMoreTokens() const { return nPos > 0; }
243cdf0e10cSrcweir 		inline const TokenId		Get( void );
244cdf0e10cSrcweir };
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 
248cdf0e10cSrcweir 
Get(void)249cdf0e10cSrcweir inline const TokenId TokenStack::Get( void )
250cdf0e10cSrcweir {
251cdf0e10cSrcweir 	DBG_ASSERT( nPos > 0,
252cdf0e10cSrcweir 		"*TokenStack::Get(): Leer ist leer, ist leer, ist leer, ist..." );
253cdf0e10cSrcweir 
254cdf0e10cSrcweir     TokenId nRet;
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 	if( nPos == 0 )
257cdf0e10cSrcweir 		nRet = 0;
258cdf0e10cSrcweir 	else
259cdf0e10cSrcweir 	{
260cdf0e10cSrcweir 		nPos--;
261cdf0e10cSrcweir 		nRet = pStack[ nPos ];
262cdf0e10cSrcweir 	}
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 	return nRet;
265cdf0e10cSrcweir }
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 
operator <<(const TokenId nNewId)268cdf0e10cSrcweir inline TokenStack &TokenStack::operator <<( const TokenId nNewId )
269cdf0e10cSrcweir {// Element auf Stack
270cdf0e10cSrcweir 	DBG_ASSERT( nPos < nSize, "*TokenStack::<<(): Stackueberlauf" );
271cdf0e10cSrcweir 	if( nPos < nSize )
272cdf0e10cSrcweir 	{
273cdf0e10cSrcweir 		pStack[ nPos ] = nNewId;
274cdf0e10cSrcweir 		nPos++;
275cdf0e10cSrcweir 	}
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 	return *this;
278cdf0e10cSrcweir }
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 
operator >>(TokenId & rId)281cdf0e10cSrcweir inline void TokenStack::operator >>( TokenId& rId )
282cdf0e10cSrcweir {// Element von Stack
283cdf0e10cSrcweir 	DBG_ASSERT( nPos > 0,
284cdf0e10cSrcweir 		"*TokenStack::>>(): Leer ist leer, ist leer, ist leer, ..." );
285cdf0e10cSrcweir 	if( nPos > 0 )
286cdf0e10cSrcweir 	{
287cdf0e10cSrcweir 		nPos--;
288cdf0e10cSrcweir 		rId = pStack[ nPos ];
289cdf0e10cSrcweir 	}
290cdf0e10cSrcweir }
291cdf0e10cSrcweir 
292cdf0e10cSrcweir 
Reset(void)293cdf0e10cSrcweir inline void TokenStack::Reset( void )
294cdf0e10cSrcweir {
295cdf0e10cSrcweir 	nPos = 0;
296cdf0e10cSrcweir }
297cdf0e10cSrcweir 
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 
300cdf0e10cSrcweir 
operator <<(const TokenId nId)301cdf0e10cSrcweir inline TokenPool& TokenPool::operator <<( const TokenId nId )
302cdf0e10cSrcweir {
303cdf0e10cSrcweir 	// POST: nId's werden hintereinander im Pool unter einer neuen Id
304cdf0e10cSrcweir 	//		 abgelegt. Vorgang wird mit >> oder Store() abgeschlossen
305cdf0e10cSrcweir 	// nId -> ( sal_uInt16 ) nId - 1;
306cdf0e10cSrcweir 	DBG_ASSERT( ( sal_uInt16 ) nId < nScTokenOff,
307cdf0e10cSrcweir 		"-TokenPool::operator <<: TokenId im DefToken-Bereich!" );
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 	if( nP_IdAkt >= nP_Id )
310*3ee7c2dbSArmin Le Grand 		if (!GrowId())
311*3ee7c2dbSArmin Le Grand             return *this;
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 	pP_Id[ nP_IdAkt ] = ( ( sal_uInt16 ) nId ) - 1;
314cdf0e10cSrcweir 	nP_IdAkt++;
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 	return *this;
317cdf0e10cSrcweir }
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 
operator <<(const DefTokenId eId)320cdf0e10cSrcweir inline TokenPool& TokenPool::operator <<( const DefTokenId eId )
321cdf0e10cSrcweir {
322cdf0e10cSrcweir 	DBG_ASSERT( ( sal_uInt32 ) eId + nScTokenOff < 0xFFFF,
323cdf0e10cSrcweir 		"-TokenPool::operator<<: enmum zu gross!" );
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 	if( nP_IdAkt >= nP_Id )
326*3ee7c2dbSArmin Le Grand 		if (!GrowId())
327*3ee7c2dbSArmin Le Grand             return *this;
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 	pP_Id[ nP_IdAkt ] = ( ( sal_uInt16 ) eId ) + nScTokenOff;
330cdf0e10cSrcweir 	nP_IdAkt++;
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 	return *this;
333cdf0e10cSrcweir }
334cdf0e10cSrcweir 
335cdf0e10cSrcweir 
operator <<(TokenStack & rStack)336cdf0e10cSrcweir inline TokenPool& TokenPool::operator <<( TokenStack& rStack )
337cdf0e10cSrcweir {
338cdf0e10cSrcweir 	if( nP_IdAkt >= nP_Id )
339*3ee7c2dbSArmin Le Grand 		if (!GrowId())
340*3ee7c2dbSArmin Le Grand             return *this;
341cdf0e10cSrcweir 
342cdf0e10cSrcweir 	pP_Id[ nP_IdAkt ] = ( ( sal_uInt16 ) rStack.Get() ) - 1;
343cdf0e10cSrcweir 	nP_IdAkt++;
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 	return *this;
346cdf0e10cSrcweir }
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 
operator >>(TokenStack & rStack)349cdf0e10cSrcweir inline void TokenPool::operator >>( TokenStack& rStack )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir     TokenId nId;
352cdf0e10cSrcweir 	*this >> nId;
353cdf0e10cSrcweir 	rStack << nId;
354cdf0e10cSrcweir }
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 
Store(void)357cdf0e10cSrcweir inline const TokenId TokenPool::Store( void )
358cdf0e10cSrcweir {
359cdf0e10cSrcweir     TokenId nId;
360cdf0e10cSrcweir 	*this >> nId;
361cdf0e10cSrcweir 	return nId;
362cdf0e10cSrcweir }
363cdf0e10cSrcweir 
364cdf0e10cSrcweir 
Store(const sal_Int16 nWert)365cdf0e10cSrcweir inline const TokenId TokenPool::Store( const sal_Int16 nWert )
366cdf0e10cSrcweir {
367cdf0e10cSrcweir 	return Store( ( double ) nWert );
368cdf0e10cSrcweir }
369cdf0e10cSrcweir 
370cdf0e10cSrcweir 
LastId(void) const371cdf0e10cSrcweir inline const TokenId TokenPool::LastId( void ) const
372cdf0e10cSrcweir {
373cdf0e10cSrcweir 	return ( TokenId ) nElementAkt; // stimmt, da Ausgabe mit Offset 1!
374cdf0e10cSrcweir }
375cdf0e10cSrcweir 
376cdf0e10cSrcweir 
operator [](const TokenId nId)377cdf0e10cSrcweir const inline ScTokenArray* TokenPool::operator []( const TokenId nId )
378cdf0e10cSrcweir {
379cdf0e10cSrcweir 	pScToken->Clear();
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 	if( nId )
382cdf0e10cSrcweir 	{//...nur wenn nId > 0!
383cdf0e10cSrcweir #ifdef DBG_UTIL
384cdf0e10cSrcweir 		nRek = 0;
385cdf0e10cSrcweir #endif
386cdf0e10cSrcweir 		GetElement( ( sal_uInt16 ) nId - 1 );
387cdf0e10cSrcweir 	}
388cdf0e10cSrcweir 
389cdf0e10cSrcweir 	return pScToken;
390cdf0e10cSrcweir }
391cdf0e10cSrcweir 
392cdf0e10cSrcweir 
GetType(const TokenId & rId) const393cdf0e10cSrcweir inline E_TYPE TokenPool::GetType( const TokenId& rId ) const
394cdf0e10cSrcweir {
395cdf0e10cSrcweir     E_TYPE nRet;
396cdf0e10cSrcweir 
397cdf0e10cSrcweir 	sal_uInt16 nId = (sal_uInt16) rId - 1;
398cdf0e10cSrcweir 
399cdf0e10cSrcweir 	if( nId < nElementAkt )
400cdf0e10cSrcweir 		nRet = pType[ nId ] ;
401cdf0e10cSrcweir 	else
402cdf0e10cSrcweir 		nRet = T_Error;
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 	return nRet;
405cdf0e10cSrcweir }
406cdf0e10cSrcweir 
407cdf0e10cSrcweir 
408cdf0e10cSrcweir #endif
409cdf0e10cSrcweir 
410