xref: /aoo4110/main/sc/source/filter/lotus/lotform.cxx (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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 
28 
29 //------------------------------------------------------------------------
30 
31 #include "decl.h"
32 #include "lotform.hxx"
33 #include "compiler.hxx"
34 #include "lotrange.hxx"
35 #include "namebuff.hxx"
36 #include "root.hxx"
37 #include "ftools.hxx"
38 #include "tool.h"
39 
40 #include <math.h>
41 
42 extern WKTYP				eTyp;
43 
44 static const sal_Char*		GetAddInName( const sal_uInt8 nIndex );
45 
46 static DefTokenId			lcl_KnownAddIn( const ByteString& sTest );
47 
48 //extern double decipher_Number123( sal_uInt32 nValue );
49 
50 
DoFunc(DefTokenId eOc,sal_uInt8 nAnz,const sal_Char * pExtString)51 void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nAnz, const sal_Char* pExtString )
52 {
53 	TokenId						eParam[ 256 ];
54 	sal_Int32						nLauf;
55 	TokenId						nMerk0, nMerk1;
56 
57 	sal_Bool						bAddIn = sal_False;
58 	sal_Bool						bNeg = sal_False;
59 
60 	DBG_ASSERT( nAnz < 128, "-LotusToSc::DoFunc(): Neee! -so viel kann ich nicht!" );
61 
62 	if( eOc == ocNoName )
63 	{
64 		ByteString				t;
65 		if( pExtString )
66 		{
67 			const ByteString	s( "@<<@123>>" );
68 
69 			t = pExtString;
70 
71 			xub_StrLen			n = t.Search( s );
72 			if( n != STRING_NOTFOUND )
73 				t.Erase( 0, n + s.Len() );
74 
75 			t.EraseTrailingChars( '(' );
76 
77 			eOc = lcl_KnownAddIn( t );
78 
79 			if( eOc == ocNoName )
80 				t.Insert( "L123_", 0 );
81 		}
82 		else
83 			t = "#UNKNOWN FUNC NAME#";
84 
85 		if( eOc == ocNoName )
86 		{
87 			bAddIn = sal_True;
88 			nMerk0 = aPool.Store( eOc, String( t, eSrcChar ) );
89 
90 			aPool << nMerk0;
91 		}
92 	}
93 
94 	for( nLauf = 0 ; nLauf < nAnz ; nLauf++ )
95 		aStack >> eParam[ nLauf ];
96 
97 	// Spezialfaelle...
98 	switch( eOc )
99 	{
100 		case ocIndex:
101 			DBG_ASSERT( nAnz > 2, "+LotusToSc::DoFunc(): ocIndex braucht mind. 2 Parameter!" );
102 			nMerk0 = eParam[ 0 ];
103 			eParam[ 0 ] = eParam[ 1 ];
104 			eParam[ 1 ] = nMerk0;
105 			IncToken( eParam[ 0 ] );
106 			IncToken( eParam[ 1 ] );
107 			break;
108 		case ocIRR:
109 		{
110 			DBG_ASSERT( nAnz == 2, "+LotusToSc::DoFunc(): ocIRR hat nur 2 Parameter!" );
111 			nMerk0 = eParam[ 0 ];
112 			eParam[ 0 ] = eParam[ 1 ];
113 			eParam[ 1 ] = nMerk0;
114 		}
115 			break;
116 		case ocGetYear:
117 		{
118 			nMerk0 = aPool.Store( 1900.0 );
119 			aPool << ocOpen;
120 		}
121 			break;
122 		case ocChose:
123 		{// 1. Parameter ++
124             if (nAnz >= 1)
125                 IncToken( eParam[ nAnz - 1 ] );
126 		}
127 			break;
128 		case ocFind:
129 		case ocHLookup:
130 		case ocVLookup:
131 		{// letzten Parameter ++
132 			IncToken( eParam[ 0 ] );
133 		}
134 			break;
135 		case ocMid:
136 		case ocReplace:
137 		{// 2. Parameter ++
138             if (nAnz >= 2)
139                 IncToken( eParam[ nAnz - 2 ] );
140 		}
141 			break;
142 		case ocZins:
143 		{
144 			// neue Anzahl = 4!
145 			DBG_ASSERT( nAnz == 3,
146 				"*LotusToSc::DoFunc(): ZINS() hat 3 Parameter!" );
147 			nAnz = 4;
148 			eParam[ 3 ] = eParam[ 0 ];	// 3. -> 1.
149 			eParam[ 0 ] = eParam[ 2 ];	// 1. -> 4.
150 			NegToken( eParam[ 1 ] );	// 2. -> -2. (+ 2. -> 3.)
151 			eParam[ 2 ] = n0Token;		//    -> 2. als Default
152 		}
153 			break;
154         default:;
155 	}
156 	// ................
157 
158 
159 	if( !bAddIn )
160 		aPool << eOc;
161 
162 	aPool << ocOpen;
163 
164 	if( nAnz > 0 )
165 	{
166 		sal_Int16 nNull = -1;	// gibt einen auszulassenden Parameter an
167 			// ACHTUNG: 0 ist der letzte Parameter, nAnz-1 der erste
168 
169 		sal_Int16 nLast = nAnz - 1;
170 
171 		if( eOc == ocRMZ )
172 		{	// Extrawurst ocRMZ letzter Parameter negiert!
173 			// zusaetzlich: 1. -> 3., 3. -> 2., 2. -> 1.
174 			DBG_ASSERT( nAnz == 3,
175 				"+LotusToSc::DoFunc(): ocRMZ hat genau 3 Parameter!" );
176 			aPool << eParam[ 1 ] << ocSep << eParam[ 0 ] << ocSep
177 				<< ocNegSub << eParam[ 2 ];
178 		}
179 		else
180 		{	// Normalfall
181 			// [Parameter{;Parameter}]
182 			aPool << eParam[ nLast ];
183 
184 			for( nLauf = nLast - 1 ; nLauf >= 0 ; nLauf-- )
185 			{
186 				if( nLauf != nNull )
187 					aPool << ocSep << eParam[ nLauf ];
188 			}
189 		}
190 	}
191 
192 
193 	// Spezialfaelle...
194 	if( eOc == ocGetYear )
195 	{
196 		aPool << ocClose << ocSub << nMerk0;
197 	}
198 	else if( eOc == ocFixed )
199 	{
200 		aPool << ocSep << ocTrue << ocOpen << ocClose;
201 	}
202 	else if( eOc == ocFind )
203 	{
204 		nMerk1 = aPool.Store();
205 		DecToken( nMerk1 );
206 		aPool << nMerk1;
207 	}
208 
209 	aPool << ocClose;
210 
211 	// ................
212 
213 	aPool >> aStack;
214 
215 	if( bNeg )
216 	{
217 		aPool << ocOpen << ocSub << aStack << ocClose;
218 		aPool >> aStack;
219 	}
220 }
221 
222 
LotusRelToScRel(sal_uInt16 nCol,sal_uInt16 nRow,ScSingleRefData & rSRD)223 void LotusToSc::LotusRelToScRel( sal_uInt16 nCol, sal_uInt16 nRow, ScSingleRefData& rSRD )
224 {
225 	// Col-Bemachung
226 	if( nCol & 0x8000 )
227     {
228 		rSRD.SetColRel( sal_True );
229 		if( nCol & 0x0080 )
230 			nCol |= 0xFF00;
231 		else
232 			nCol &= 0x00FF;
233         // #i36252# first cast unsigned 16-bit to signed 16-bit, and then to SCsCOL
234         rSRD.nRelCol = static_cast< SCsCOL >( static_cast< sal_Int16 >( nCol ) );
235     }
236 	else
237 	{
238 		rSRD.SetColRel( sal_False );
239         rSRD.nCol = static_cast< SCsCOL >( nCol & 0x00FF );
240 	}
241 
242 	// Row-Bemachung
243 	if( nRow & 0x8000 )
244     {
245 		rSRD.SetRowRel( sal_True );
246 		// vorzeichenrichtige Erweiterung
247 		switch( eTyp )
248         {
249 			// 5432 1098 7654 3210
250 			// 8421 8421 8421 8421
251 			//       xxx xxxx xxxx
252 			case eWK_1:
253 				if( nRow & 0x0400 )
254 					nRow |= 0xF800;
255 				else
256 					nRow &= 0x07FF;
257 				break;
258 			// 8421 8421 8421 8421
259 			//    x xxxx xxxx xxxx
260 			case eWK_2:
261 				if( nRow & 0x1000 )
262 					nRow |= 0xE000;
263 				else
264 					nRow &= 0x1FFF;
265 				break;
266 			default:
267 				DBG_ERROR( "*LotusToSc::LotusRelToScRel(): etwas vergessen...?" );
268         }
269     }
270 	else
271     {
272 		rSRD.SetRowRel( sal_False );
273 		switch( eTyp )
274         {
275 			// 5432 1098 7654 3210
276 			// 8421 8421 8421 8421
277 			//       xxx xxxx xxxx
278 			case eWK_1:
279 				nRow &= 0x07FF;
280 				break;
281 			// 8421 8421 8421 8421
282 			//   xx xxxx xxxx xxxx
283 			case eWK_2:
284 				nRow &= 0x3FFF;
285 				break;
286 			default:
287 				DBG_ERROR( "*LotusToSc::LotusRelToScRel(): etwas vergessen...?" );
288         }
289     }
290 
291 	if( rSRD.IsRowRel() )
292         // #i36252# first cast unsigned 16-bit to signed 16-bit, and then to SCsROW
293         rSRD.nRelRow = static_cast< SCsROW >( static_cast< sal_Int16 >( nRow ) );
294 	else
295         rSRD.nRow = static_cast< SCsROW >( nRow );
296 
297 	if( rSRD.IsRowRel() || rSRD.IsColRel() )
298 		rSRD.CalcAbsIfRel( aEingPos );
299 }
300 
301 
ReadSRD(ScSingleRefData & rSRD,sal_uInt8 nRelBit)302 void LotusToSc::ReadSRD( ScSingleRefData& rSRD, sal_uInt8 nRelBit )
303 {
304 	sal_uInt8			nTab, nCol;
305 	sal_uInt16			nRow;
306 
307 	Read( nRow );
308 	Read( nTab );
309 	Read( nCol );
310 
311     sal_Bool b3D = ( static_cast< SCTAB >( nTab ) != aEingPos.Tab() );
312 
313 	rSRD.SetColRel( ( nRelBit & 0x01 ) != 0 );
314     rSRD.nCol = static_cast< SCsCOL >( nCol );
315 
316 	rSRD.SetRowRel( ( nRelBit & 0x02 ) != 0 );
317     rSRD.nRow = static_cast< SCsROW >( nRow );
318 
319 	rSRD.SetTabRel( ( ( nRelBit & 0x04) != 0 ) || !b3D );
320     rSRD.nTab = static_cast< SCsTAB >( nTab );
321 
322 	rSRD.SetFlag3D( b3D );
323 
324 	rSRD.CalcRelFromAbs( aEingPos );
325 }
326 
327 
IncToken(TokenId & rParam)328 void LotusToSc::IncToken( TokenId &rParam )
329 {
330 	aPool << ocOpen << rParam << nAddToken;
331 	rParam = aPool.Store();
332 }
333 
334 
DecToken(TokenId & rParam)335 void LotusToSc::DecToken( TokenId &rParam )
336 {
337 	aPool << ocOpen << rParam << nSubToken;
338 	rParam = aPool.Store();
339 }
340 
341 
NegToken(TokenId & rParam)342 void LotusToSc::NegToken( TokenId &rParam )
343 {
344 	aPool << ocNegSub << ocOpen << rParam << ocClose;
345 	rParam = aPool.Store();
346 }
347 
348 
Reset(const ScAddress & rEingPos)349 void LotusToSc::Reset( const ScAddress& rEingPos )
350 {
351     LotusConverterBase::Reset( rEingPos );
352 
353 	TokenId nEins = aPool.Store( 1.0 );
354 
355 	aPool << ocClose << ocAdd << nEins;
356 	nAddToken = aPool.Store();
357 
358 	aPool << ocClose << ocSub << nEins;
359 	nSubToken = aPool.Store();
360 
361 	n0Token = aPool.Store( 0.0 );
362 }
363 
364 
LotusToSc(SvStream & rStream,CharSet e,sal_Bool b)365 LotusToSc::LotusToSc( SvStream &rStream, CharSet e, sal_Bool b ) :
366 	LotusConverterBase( rStream, 128 )
367 {
368 	eSrcChar = e;
369 	bWK3 = sal_False;
370 	bWK123 = b;
371 }
372 
373 
374 typedef FUNC_TYPE ( FuncType1 ) ( sal_uInt8 );
375 typedef DefTokenId ( FuncType2 ) ( sal_uInt8 );
376 
377 
Convert(const ScTokenArray * & rpErg,sal_Int32 & rRest,const FORMULA_TYPE)378 ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest,
379     const FORMULA_TYPE /*eFT*/ )
380 {
381 	sal_uInt8				nOc;
382 	sal_uInt8				nAnz;
383 	sal_uInt8				nRelBits;
384 	sal_uInt16				nStrLen;
385 	sal_uInt16				nRngIndex;
386 	FUNC_TYPE			eType = FT_NOP;
387 	TokenId				nMerk0;
388 	DefTokenId			eOc;
389     const sal_Char*     pExtName = 0;
390 	RangeNameBufferWK3&	rRangeNameBufferWK3 = *pLotusRoot->pRngNmBffWK3;
391 
392 	ScComplexRefData		aCRD;
393 	aCRD.InitFlags();
394 	ScSingleRefData&		rR = aCRD.Ref1;
395 
396 	LR_ID				nId;
397 	TokenId				nNewId;
398 
399 	LotusRangeList&		rRangeList = *pLotusRoot->pRangeNames;
400 
401 	FuncType1*			pIndexToType;
402 	FuncType2*			pIndexToToken;
403 
404 	if( bWK3 )
405 	{	// for > WK3
406 		pIndexToType = IndexToTypeWK123;
407 		pIndexToToken = IndexToTokenWK123;
408 	}
409 	else if( bWK123 )
410 	{
411 		pIndexToType = IndexToTypeWK123;
412 		pIndexToToken = IndexToTokenWK123;
413 	}
414 	else
415 	{
416 		pIndexToType = IndexToType;
417 		pIndexToToken = IndexToToken;
418 
419 		rR.SetTabRel( sal_True );
420 		rR.nTab = aEingPos.Tab();
421 		rR.nRelTab = 0;
422 		rR.SetFlag3D( sal_False );
423 	}
424 
425 	aCRD.Ref2 = rR;
426 
427 	nBytesLeft = rRest;
428 
429 	while( eType )		// != FT_Return (==0)
430 	{
431 		Read( nOc );
432 
433 		if( nBytesLeft < 0 )
434 		{
435 			rpErg = aPool[ aStack.Get() ];
436 			return ConvErrCount;
437 		}
438 
439 		eType = ( pIndexToType )( nOc );
440 		eOc = ( pIndexToToken)( nOc );
441 		if( eOc == ocNoName )
442 			pExtName = GetAddInName( nOc );
443 
444 		switch( eType )
445 		{
446 			case FT_Return:
447 				if( bWK3 || bWK123 )
448 					nBytesLeft = 0;	// wird ab WK3 nicht benutzt
449 
450 				rRest = nBytesLeft;
451 				break;
452 			case FT_NotImpl:
453 			case FT_FuncFix0:	DoFunc( eOc, 0, pExtName ); break;
454 			case FT_FuncFix1:	DoFunc( eOc, 1, pExtName ); break;
455 			case FT_FuncFix2:	DoFunc( eOc, 2, pExtName ); break;
456 			case FT_FuncFix3:	DoFunc( eOc, 3, pExtName ); break;
457 			case FT_FuncFix4:	DoFunc( eOc, 4, pExtName ); break;
458 		        case FT_FuncVar:
459 				Read( nAnz );
460 				DoFunc( eOc, nAnz, pExtName );
461 				break;
462 			case FT_Neg:
463 				aPool << ocOpen << ocNegSub << aStack << ocClose;
464 				aPool >> aStack;
465 				break;
466 			case FT_Op:
467 				aStack >> nMerk0;
468 				aPool << aStack << eOc << nMerk0;
469 				aPool >> aStack;
470 				break;
471 			case FT_ConstFloat:
472 			{
473 				double	fDouble;
474 				Read( fDouble );
475 				aStack << aPool.Store( fDouble );
476 			}
477 				break;
478 			case FT_Variable:
479 			{
480 				sal_uInt16	nCol, nRow;
481 				Read( nCol );
482 				Read( nRow );
483 
484 				LotusRelToScRel( nCol, nRow, rR );
485 
486 				if( bWK3 )
487 					nNewId = aPool.Store( rR );
488 				else
489 				{
490 					nId = rRangeList.GetIndex( rR.nCol, rR.nRow );
491 
492 					if( nId == ID_FAIL )
493 						// kein Range dazu
494 						nNewId = aPool.Store( rR );
495 					else
496 						nNewId = aPool.Store( ( sal_uInt16 ) nId );
497 				}
498 
499 				aStack << nNewId;
500 			}
501 				break;
502 			case FT_Range:
503 			{
504 				sal_uInt16	nColS, nRowS, nColE, nRowE;
505 				Read( nColS );
506 				Read( nRowS );
507 				Read( nColE );
508 				Read( nRowE );
509 
510 				LotusRelToScRel( nColS, nRowS, rR );
511 				LotusRelToScRel( nColE, nRowE, aCRD.Ref2 );
512 
513 				if( bWK3 )
514 					nNewId = aPool.Store( aCRD );
515 				else
516 				{
517 					nId = rRangeList.GetIndex(
518 						rR.nCol, rR.nRow, aCRD.Ref2.nCol, aCRD.Ref2.nRow );
519 
520 					if( nId == ID_FAIL )
521 						// kein Range dazu
522 						nNewId = aPool.Store( aCRD );
523 					else
524 						nNewId = aPool.Store( ( sal_uInt16 ) nId );
525 				}
526 
527 				aStack << nNewId;
528 			}
529 				break;
530 			case FT_Braces:
531 				aPool << ocOpen << aStack << ocClose;
532 				aPool >> aStack;
533 				break;
534 			case FT_ConstInt:
535 			{
536 				sal_Int16	nVal;
537 				Read( nVal );
538 				aStack << aPool.Store( ( double ) nVal );
539 			}
540 				break;
541 			case FT_ConstString:
542 			{
543                 String  aTmp( ScfTools::ReadCString( aIn, nBytesLeft, eSrcChar ) );
544 
545 				aStack << aPool.Store( aTmp );
546 			}
547 				break;
548 			case FT_NOP:
549 				break;
550 			// ------------------------------------------ fuer > WK3 -
551 			case FT_Cref:
552 				Read( nRelBits );
553 				ReadSRD( rR, nRelBits );
554 				aStack << aPool.Store( rR );
555 				break;
556 			case FT_Rref:
557 				Read( nRelBits );
558 				ReadCRD( aCRD, nRelBits );
559 				aStack << aPool.Store( aCRD );
560 				break;
561 			case FT_Nrref:
562 			{
563                 String      aTmp( ScfTools::ReadCString( aIn, nBytesLeft, eSrcChar ) );
564 				if( rRangeNameBufferWK3.FindRel( aTmp, nRngIndex ) )
565 					aStack << aPool.Store( nRngIndex );
566 				else
567 			{
568 					String	aText( RTL_CONSTASCII_USTRINGPARAM( "NRREF " ) );
569 					aText += aTmp;
570 					aStack << aPool.Store( aText );
571 			}
572 			}
573 				break;
574 			case FT_Absnref:
575 			{
576                 String      aTmp( ScfTools::ReadCString( aIn, nBytesLeft, eSrcChar ) );
577 				if( rRangeNameBufferWK3.FindAbs( aTmp, nRngIndex ) )
578 					aStack << aPool.Store( nRngIndex );
579 				else
580 				{
581 					String	aText( RTL_CONSTASCII_USTRINGPARAM( "ABSNREF " ) );
582 					aText += aTmp;
583 					aStack << aPool.Store( aText );
584 				}
585 			}
586 				break;
587 			case FT_Erref:
588 				Ignore( 4 );
589 				aPool << ocBad;
590 				aPool >> aStack;
591 				break;
592 			case FT_Ecref:
593 				Ignore( 5 );
594 				aPool << ocBad;
595 				aPool >> aStack;
596 				break;
597 			case FT_Econstant:
598 				Ignore( 10 );
599 				aPool << ocBad;
600 				aPool >> aStack;
601 				break;
602 			case FT_Splfunc:
603 			{
604 				Read( nAnz );
605 				Read( nStrLen );
606 
607 				if( nStrLen )
608 				{
609 					sal_Char*	p = new (::std::nothrow) sal_Char[ nStrLen + 1 ];
610                     if (p)
611                     {
612                         aIn.Read( p, nStrLen );
613                         p[ nStrLen ] = 0x00;
614 
615                         DoFunc( ocNoName, nAnz, p );
616 
617                         delete[] p;
618                     }
619                     else
620                         DoFunc( ocNoName, nAnz, NULL );
621 				}
622 				else
623 					DoFunc( ocNoName, nAnz, NULL );
624 			}
625 				break;
626 			case FT_Const10Float:
627 			        if ( bWK123 )
628 			        {
629 			                double fValue;
630 			                Read( fValue );
631 			                aStack << aPool.Store( fValue );
632 			        }
633 			        else aStack << aPool.Store( ScfTools::ReadLongDouble( aIn ) );
634 			        break;
635 			case FT_Snum:
636 			        if ( bWK123 )
637 				{
638 				         sal_uInt32   nValue;
639 
640 				         Read( nValue );
641 					 double  fValue = Snum32ToDouble( nValue );
642 					 aStack << aPool.Store( fValue );
643 				}
644 				else
645 				{
646 				        sal_Int16 nVal;
647 				        Read( nVal );
648 				        aStack << aPool.Store( SnumToDouble( nVal ) );
649 				}
650 				break;
651 		    	default:
652 				DBG_ERROR( "*LotusToSc::Convert(): unbekannter enum!" );
653 		}
654 	}
655 
656 	rpErg = aPool[ aStack.Get() ];
657 
658 	DBG_ASSERT( nBytesLeft >= 0, "*LotusToSc::Convert(): zuviel verarbeitet!");
659 	DBG_ASSERT( nBytesLeft <= 0, "*LotusToSc::Convert(): wat is mit'm Rest?" );
660 
661 	if( rRest )
662 		aIn.SeekRel( nBytesLeft );	// eventuellen Rest/Ueberlauf korrigieren
663 
664 	rRest = 0;
665 
666 	return ConvOK;
667 }
668 
669 
IndexToType(sal_uInt8 nIndex)670 FUNC_TYPE LotusToSc::IndexToType( sal_uInt8 nIndex )
671 {
672 	static const FUNC_TYPE pType[ 256 ] =
673 	{						// Code Bezeichnung
674 		FT_ConstFloat,		//    0 8-Byte-IEEE-Float
675 		FT_Variable,		//    1 Variable
676 		FT_Range,			//    2 Bereich
677 		FT_Return,			//    3 return
678 		FT_Braces,			//    4 Klammer
679 		FT_ConstInt,		//    5 2-Byte-Integer
680 		FT_ConstString,		//    6 ASCII-String
681 		FT_NOP,				//    7 NOP
682 		FT_Neg,				//    8 Negation
683 		FT_Op,				//    9 Addition
684 		FT_Op,				//   10 Subtraktion
685 		FT_Op,				//   11 Multiplikation
686 		FT_Op,				//   12 Division
687 		FT_Op,				//   13 Potenzierung
688 		FT_Op,				//   14 Gleichheit
689 		FT_Op,				//   15 Ungleich
690 		FT_Op,				//   16 Kleiner-gleich
691 		FT_Op,				//   17 Groesser-gleich
692 		FT_Op,				//   18 Kleiner
693 		FT_Op,				//   19 Groesser
694 		FT_Op,				//   20 And (logisch)
695 		FT_Op,				//   21 Or (logisch)
696 		FT_FuncFix1,		//   22 Not (logisch)
697 		FT_NOP,				//   23 unaeres Plus
698 		FT_NotImpl,			//   24
699 		FT_NotImpl,			//   25
700 		FT_NotImpl,			//   26
701 		FT_NotImpl,			//   27
702 		FT_NotImpl,			//   28
703 		FT_NotImpl,			//   29
704 		FT_NotImpl,			//   30
705 		FT_FuncFix0,		//   31 Not applicable
706 		FT_FuncFix0,		//   32 Error
707 		FT_FuncFix1,		//   33 Betrag ABS()
708 		FT_FuncFix1,		//   34 Ganzzahl INT()
709 		FT_FuncFix1,		//   35 Quadratwurzel
710 		FT_FuncFix1,		//   36 Zehnerlogarithmus
711 		FT_FuncFix1,		//   37 Natuerlicher Logarithmus
712 		FT_FuncFix0,		//   38 PI
713 		FT_FuncFix1,		//   39 Sinus
714 		FT_FuncFix1,		//   40 Cosinus
715 		FT_FuncFix1,		//   41 Tangens
716 		FT_FuncFix2,		//   42 Arcus-Tangens 2 (4.Quadrant)   <----- richtig? -
717 		FT_FuncFix1,		//   43 Arcus-Tangens (2.Quadrant)
718 		FT_FuncFix1,		//   44 Arcus-Sinus
719 		FT_FuncFix1,		//   45 Arcus-Cosinus
720 		FT_FuncFix1,		//   46 Exponentialfunktion
721 		FT_FuncFix2,		//   47 Modulo
722 		FT_FuncVar,			//   48 Auswahl
723 		FT_FuncFix1,		//   49 Is not applicable?
724 		FT_FuncFix1,		//   50 Is Error?
725 		FT_FuncFix0,		//   51 FALSE
726 		FT_FuncFix0,		//   52 TRUE
727 		FT_FuncFix0,		//   53 Zufallszahl
728 		FT_FuncFix3,		//   54 Datum
729 		FT_FuncFix0,		//   55 Heute
730 		FT_FuncFix3,		//   56 Payment
731 		FT_FuncFix3,		//   57 Present Value
732 		FT_FuncFix3,		//   58 Future Value
733 		FT_FuncFix3,		//   59 If ... then ... else ...
734 		FT_FuncFix1,		//   60 Tag des Monats
735 		FT_FuncFix1,		//   61 Monat
736 		FT_FuncFix1,		//   62 Jahr
737 		FT_FuncFix2,		//   63 Runden
738 		FT_FuncFix3,		//   64 Zeit
739 		FT_FuncFix1,		//   65 Stunde
740 		FT_FuncFix1,		//   66 Minute
741 		FT_FuncFix1,		//   67 Sekunde
742 		FT_FuncFix1,		//   68 Ist Zahl?
743 		FT_FuncFix1,		//   69 Ist Text?
744 		FT_FuncFix1,		//   70 Len()
745 		FT_FuncFix1,		//   71 Val()
746 		FT_FuncFix2,		//   72 String()
747 		FT_FuncFix3,		//   73 Mid()
748 		FT_FuncFix1,		//   74 Char()
749 		FT_FuncFix1,		//   75 Ascii()
750 		FT_FuncFix3,		//   76 Find()
751 		FT_FuncFix1,		//   77 Datevalue
752 		FT_FuncFix1,		//   78 Timevalue
753 		FT_FuncFix1,		//   79 Cellpointer
754 		FT_FuncVar,			//   80 Sum()
755 		FT_FuncVar,			//   81 Avg()
756 		FT_FuncVar,			//   82 Cnt()
757 		FT_FuncVar,			//   83 Min()
758 		FT_FuncVar,			//   84 Max()
759 		FT_FuncFix3,		//   85 Vlookup()
760 		FT_FuncFix2,		//   86 Npv()
761 		FT_FuncVar,			//   87 Var()
762 		FT_FuncVar,			//   88 Std()
763 		FT_FuncFix2,		//   89 Irr()
764 		FT_FuncFix3,		//   90 Hlookup()
765 		FT_FuncFix3,		//   91 ?
766 		FT_FuncFix3,		//   92 ?
767 		FT_FuncFix3,		//   93 ?
768 		FT_FuncFix3,		//   94 ?
769 		FT_FuncFix3,		//   95 ?
770 		FT_FuncFix3,		//   96 ?
771 		FT_FuncFix3,		//   97 ?
772 		FT_FuncFix3,		//   98 Index()                         <- richtig? -
773 		FT_FuncFix1,		//   99 Cols()
774 		FT_FuncFix1,		//  100 Rows()
775 		FT_FuncFix2,		//  101 Repeat()
776 		FT_FuncFix1,		//  102 Upper()
777 		FT_FuncFix1,		//  103 Lower()
778 		FT_FuncFix2,		//  104 Left()
779 		FT_FuncFix2,		//  105 Right()
780 		FT_FuncFix4,		//  106 Replace()
781 		FT_FuncFix1,		//  107 Proper()
782 		FT_FuncFix2,		//  108 Cell()
783 		FT_FuncFix1,		//  109 Trim()
784 		FT_FuncFix1,		//  110 Clean()
785 		FT_FuncFix1,		//  111 F()
786 		FT_FuncFix1,		//  112 Wert() (oder W()?)
787 		FT_FuncFix2,		//  113 Exact()
788 		FT_NotImpl,			//  114 Call()
789 		FT_FuncFix1,		//  115 @@()
790 		FT_FuncFix3,		//  116 Rate()
791 		FT_FuncFix1,		//  117 Term()
792 		FT_FuncFix1,		//  118 Cterm()
793 		FT_FuncFix3,		//  119 Sln()
794 		FT_FuncFix4,		//  120 Syd(), Soy()
795 		FT_FuncFix4,		//  121 Ddb()
796 		FT_NotImpl,			//  122
797 		FT_NotImpl,			//  123
798 		FT_NotImpl,			//  124
799 		FT_NotImpl,			//  125
800 		FT_NotImpl,			//  126
801 		FT_NotImpl,			//  127
802 		FT_NotImpl,			//  128
803 		FT_NotImpl,			//  129
804 		FT_NotImpl,			//  130
805 		FT_NotImpl,			//  131
806 		FT_NotImpl,			//  132
807 		FT_NotImpl,			//  133
808 		FT_NotImpl,			//  134
809 		FT_NotImpl,			//  135
810 		FT_NotImpl,			//  136
811 		FT_NotImpl,			//  137
812 		FT_NotImpl,			//  138
813 		FT_NotImpl,			//  139
814 		FT_NotImpl,			//  140
815 		FT_NotImpl,			//  141
816 		FT_NotImpl,			//  142
817 		FT_NotImpl,			//  143
818 		FT_NotImpl,			//  144
819 		FT_NotImpl,			//  145
820 		FT_NotImpl,			//  146
821 		FT_NotImpl,			//  147
822 		FT_NotImpl,			//  148
823 		FT_NotImpl,			//  149
824 		FT_NotImpl,			//  150
825 		FT_NotImpl,			//  151
826 		FT_NotImpl,			//  152
827 		FT_NotImpl,			//  153
828 		FT_NotImpl,			//  154
829 		FT_NotImpl,			//  155
830 		FT_FuncVar,			//  156 ?
831 		FT_NotImpl,			//  157
832 		FT_NotImpl,			//  158
833 		FT_NotImpl,			//  159
834 		FT_NotImpl,			//  160
835 		FT_NotImpl,			//  161
836 		FT_NotImpl,			//  162
837 		FT_NotImpl,			//  163
838 		FT_NotImpl,			//  164
839 		FT_NotImpl,			//  165
840 		FT_NotImpl,			//  166
841 		FT_NotImpl,			//  167
842 		FT_NotImpl,			//  168
843 		FT_NotImpl,			//  169
844 		FT_NotImpl,			//  170
845 		FT_NotImpl,			//  171
846 		FT_NotImpl,			//  172
847 		FT_NotImpl,			//  173
848 		FT_NotImpl,			//  174
849 		FT_NotImpl,			//  175
850 		FT_NotImpl,			//  176
851 		FT_NotImpl,			//  177
852 		FT_NotImpl,			//  178
853 		FT_NotImpl,			//  179
854 		FT_NotImpl,			//  180
855 		FT_NotImpl,			//  181
856 		FT_NotImpl,			//  182
857 		FT_NotImpl,			//  183
858 		FT_NotImpl,			//  184
859 		FT_NotImpl,			//  185
860 		FT_NotImpl,			//  186
861 		FT_NotImpl,			//  187
862 		FT_NotImpl,			//  188
863 		FT_NotImpl,			//  189
864 		FT_NotImpl,			//  190
865 		FT_NotImpl,			//  191
866 		FT_NotImpl,			//  192
867 		FT_NotImpl,			//  193
868 		FT_NotImpl,			//  194
869 		FT_NotImpl,			//  195
870 		FT_NotImpl,			//  196
871 		FT_NotImpl,			//  197
872 		FT_NotImpl,			//  198
873 		FT_NotImpl,			//  199
874 		FT_NotImpl,			//  200
875 		FT_NotImpl,			//  201
876 		FT_NotImpl,			//  202
877 		FT_NotImpl,			//  203
878 		FT_NotImpl,			//  204
879 		FT_NotImpl,			//  205
880 		FT_FuncVar,			//  206 ?
881 		FT_NotImpl,			//  207
882 		FT_NotImpl,			//  208
883 		FT_NotImpl,			//  209
884 		FT_NotImpl,			//  210
885 		FT_NotImpl,			//  211
886 		FT_NotImpl,			//  212
887 		FT_NotImpl,			//  213
888 		FT_NotImpl,			//  214
889 		FT_NotImpl,			//  215
890 		FT_NotImpl,			//  216
891 		FT_NotImpl,			//  217
892 		FT_NotImpl,			//  218
893 		FT_NotImpl,			//  219
894 		FT_NotImpl,			//  220
895 		FT_NotImpl,			//  221
896 		FT_NotImpl,			//  222
897 		FT_NotImpl,			//  223
898 		FT_NotImpl,			//  224
899 		FT_NotImpl,			//  225
900 		FT_NotImpl,			//  226
901 		FT_NotImpl,			//  227
902 		FT_NotImpl,			//  228
903 		FT_NotImpl,			//  229
904 		FT_NotImpl,			//  230
905 		FT_NotImpl,			//  231
906 		FT_NotImpl,			//  232
907 		FT_NotImpl,			//  233
908 		FT_NotImpl,			//  234
909 		FT_NotImpl,			//  235
910 		FT_NotImpl,			//  236
911 		FT_NotImpl,			//  237
912 		FT_NotImpl,			//  238
913 		FT_NotImpl,			//  239
914 		FT_NotImpl,			//  240
915 		FT_NotImpl,			//  241
916 		FT_NotImpl,			//  242
917 		FT_NotImpl,			//  243
918 		FT_NotImpl,			//  244
919 		FT_NotImpl,			//  245
920 		FT_NotImpl,			//  246
921 		FT_NotImpl,			//  247
922 		FT_NotImpl,			//  248
923 		FT_NotImpl,			//  249
924 		FT_NotImpl,			//  250
925 		FT_NotImpl,			//  251
926 		FT_NotImpl,			//  252
927 		FT_NotImpl,			//  253
928 		FT_NotImpl,			//  254
929 		FT_FuncVar,			//  255 ?
930 	};
931 	return pType[ nIndex ];
932 }
933 
934 
IndexToToken(sal_uInt8 nIndex)935 DefTokenId LotusToSc::IndexToToken( sal_uInt8 nIndex )
936 {
937 	static const DefTokenId pToken[ 256 ] =
938 	{						// Code Bezeichnung
939 		ocPush,				//    0 8-Byte-IEEE-Float
940 		ocPush,				//    1 Variable
941 		ocPush,				//    2 Bereich
942 		ocPush,				//    3 return
943 		ocPush,				//    4 Klammer
944 		ocPush,				//    5 2-Byte-Integer
945 		ocPush,				//    6 ASCII-String
946 		ocPush,				//    7 NOP
947 		ocNegSub,			//    8 Negation
948 		ocAdd,				//    9 Addition
949 		ocSub,				//   10 Subtraktion
950 		ocMul,				//   11 Multiplikation
951 		ocDiv,				//   12 Division
952 		ocPow,				//   13 Potenzierung
953 		ocEqual,			//   14 Gleichheit
954 		ocNotEqual,			//   15 Ungleich
955 		ocLessEqual,		//   16 Kleiner-gleich
956 		ocGreaterEqual,		//   17 Groesser-gleich
957 		ocLess,				//   18 Kleiner
958 		ocGreater,			//   19 Groesser
959 		ocAnd,				//   20 And (logisch)
960 		ocOr,				//   21 Or (logisch)
961 		ocNot,				//   22 Not (logisch)
962 		ocPush,				//   23 unaeres Plus
963 		ocNoName,			//   24
964 		ocNoName,			//   25
965 		ocNoName,			//   26
966 		ocNoName,			//   27
967 		ocNoName,			//   28
968 		ocNoName,			//   29
969 		ocNoName,			//   30
970 		ocNotAvail,			//   31 Not available
971 		ocNoName,			//   32 Error
972 		ocAbs,				//   33 Betrag ABS()
973 		ocInt,				//   34 Ganzzahl INT()
974 		ocSqrt,				//   35 Quadratwurzel
975 		ocLog10,			//   36 Zehnerlogarithmus
976 		ocLn,				//   37 Natuerlicher Logarithmus
977 		ocPi,				//   38 PI
978 		ocSin,				//   39 Sinus
979 		ocCos,				//   40 Cosinus
980 		ocTan,				//   41 Tangens
981 		ocArcTan2,			//   42 Arcus-Tangens 2 (4.Quadrant)
982 		ocArcTan,			//   43 Arcus-Tangens (2.Quadrant)
983 		ocArcSin,			//   44 Arcus-Sinus
984 		ocArcCos,			//   45 Arcus-Cosinus
985 		ocExp,				//   46 Exponentialfunktion
986 		ocMod,				//   47 Modulo
987 		ocChose,			//   48 Auswahl
988 		ocIsNA,				//   49 Is not available?
989 		ocIsError,			//   50 Is Error?
990 		ocFalse,			//   51 FALSE
991 		ocTrue,				//   52 TRUE
992 		ocRandom,			//   53 Zufallszahl
993 		ocGetDate,			//   54 Datum
994 		ocGetActDate,		//   55 Heute
995 		ocRMZ,				//   56 Payment
996 		ocBW,				//   57 Present Value
997 		ocZW,				//   58 Future Value
998 		ocIf,				//   59 If ... then ... else ...
999 		ocGetDay,			//   60 Tag des Monats
1000 		ocGetMonth,			//   61 Monat
1001 		ocGetYear,			//   62 Jahr
1002 		ocRound,			//   63 Runden
1003 		ocGetTime,			//   64 Zeit
1004 		ocGetHour,			//   65 Stunde
1005 		ocGetMin,			//   66 Minute
1006 		ocGetSec,			//   67 Sekunde
1007 		ocIsValue,			//   68 Ist Zahl?
1008 		ocIsString,			//   69 Ist Text?
1009 		ocLen,				//   70 Len()
1010 		ocValue,			//   71 Val()
1011 		ocFixed,			//   72 String()	ocFixed ersatzweise + Spezialfall
1012 		ocMid,				//   73 Mid()
1013 		ocChar,				//   74 Char()
1014 		ocCode,				//   75 Ascii()
1015 		ocFind,				//   76 Find()
1016 		ocGetDateValue,		//   77 Datevalue
1017 		ocGetTimeValue,		//   78 Timevalue
1018 		ocNoName,			//   79 Cellpointer
1019 		ocSum,				//   80 Sum()
1020 		ocAverage,			//   81 Avg()
1021 		ocCount,			//   82 Cnt()
1022 		ocMin,				//   83 Min()
1023 		ocMax,				//   84 Max()
1024 		ocVLookup,			//   85 Vlookup()
1025 		ocNPV,				//   86 Npv()
1026 		ocVar,				//   87 Var()
1027 		ocNormDist,			//   88 Std()
1028 		ocIRR,				//   89 Irr()
1029 		ocHLookup,			//   90 Hlookup()
1030 		ocDBSum,			//   91 XlfDsum
1031 		ocDBAverage,		//   92 XlfDaverage
1032 		ocDBCount,			//   93 XlfDcount
1033 		ocDBMin,			//   94 XlfDmin
1034 		ocDBMax,			//   95 XlfDmax
1035 		ocDBVar,			//   96 XlfDvar
1036 		ocDBStdDev,			//   97 XlfDstdev
1037 		ocIndex,			//   98 Index()
1038 		ocColumns,			//   99 Cols()
1039 		ocRows,				//  100 Rows()
1040 		ocRept,				//  101 Repeat()
1041 		ocUpper,			//  102 Upper()
1042 		ocLower,			//  103 Lower()
1043 		ocLeft,				//  104 Left()
1044 		ocRight,			//  105 Right()
1045 		ocReplace,			//  106 Replace()
1046 		ocPropper,			//  107 Proper()
1047 		ocNoName,			//  108 Cell()
1048 		ocTrim,				//  109 Trim()
1049 		ocClean,			//  110 Clean()
1050 		ocFalse,			//  111 F()
1051 		ocTrue,				//  112 W()
1052 		ocExact,			//  113 Exact()
1053 		ocNoName,			//  114 Call()
1054 		ocIndirect,			//  115 @@()
1055 		ocZins,				//  116 Rate()
1056 		ocNoName,			//  117 Term()
1057 		ocNoName,			//  118 Cterm()
1058 		ocLIA,				//  119 Sln()
1059 		ocDIA,				//  120 Syd(), Soy()
1060 		ocGDA,				//  121 Ddb()
1061 		ocNoName,			//  122
1062 		ocNoName,			//  123
1063 		ocNoName,			//  124
1064 		ocNoName,			//  125
1065 		ocNoName,			//  126
1066 		ocNoName,			//  127
1067 		ocNoName,			//  128
1068 		ocNoName,			//  129
1069 		ocNoName,			//  130
1070 		ocNoName,			//  131
1071 		ocNoName,			//  132
1072 		ocNoName,			//  133
1073 		ocNoName,			//  134
1074 		ocNoName,			//  135
1075 		ocNoName,			//  136
1076 		ocNoName,			//  137
1077 		ocNoName,			//  138
1078 		ocNoName,			//  139
1079 		ocNoName,			//  140
1080 		ocNoName,			//  141
1081 		ocNoName,			//  142
1082 		ocNoName,			//  143
1083 		ocNoName,			//  144
1084 		ocNoName,			//  145
1085 		ocNoName,			//  146
1086 		ocNoName,			//  147
1087 		ocNoName,			//  148
1088 		ocNoName,			//  149
1089 		ocNoName,			//  150
1090 		ocNoName,			//  151
1091 		ocNoName,			//  152
1092 		ocNoName,			//  153
1093 		ocNoName,			//  154
1094 		ocNoName,			//  155
1095 		ocNoName,			//  156 ?
1096 		ocNoName,			//  157
1097 		ocNoName,			//  158
1098 		ocNoName,			//  159
1099 		ocNoName,			//  160
1100 		ocNoName,			//  161
1101 		ocNoName,			//  162
1102 		ocNoName,			//  163
1103 		ocNoName,			//  164
1104 		ocNoName,			//  165
1105 		ocNoName,			//  166
1106 		ocNoName,			//  167
1107 		ocNoName,			//  168
1108 		ocNoName,			//  169
1109 		ocNoName,			//  170
1110 		ocNoName,			//  171
1111 		ocNoName,			//  172
1112 		ocNoName,			//  173
1113 		ocNoName,			//  174
1114 		ocNoName,			//  175
1115 		ocNoName,			//  176
1116 		ocNoName,			//  177
1117 		ocNoName,			//  178
1118 		ocNoName,			//  179
1119 		ocNoName,			//  180
1120 		ocNoName,			//  181
1121 		ocNoName,			//  182
1122 		ocNoName,			//  183
1123 		ocNoName,			//  184
1124 		ocNoName,			//  185
1125 		ocNoName,			//  186
1126 		ocNoName,			//  187
1127 		ocNoName,			//  188
1128 		ocNoName,			//  189
1129 		ocNoName,			//  190
1130 		ocNoName,			//  191
1131 		ocNoName,			//  192
1132 		ocNoName,			//  193
1133 		ocNoName,			//  194
1134 		ocNoName,			//  195
1135 		ocNoName,			//  196
1136 		ocNoName,			//  197
1137 		ocNoName,			//  198
1138 		ocNoName,			//  199
1139 		ocNoName,			//  200
1140 		ocNoName,			//  201
1141 		ocNoName,			//  202
1142 		ocNoName,			//  203
1143 		ocNoName,			//  204
1144 		ocNoName,			//  205
1145 		ocNoName,			//  206 ?
1146 		ocNoName,			//  207
1147 		ocNoName,			//  208
1148 		ocNoName,			//  209
1149 		ocNoName,			//  210
1150 		ocNoName,			//  211
1151 		ocNoName,			//  212
1152 		ocNoName,			//  213
1153 		ocNoName,			//  214
1154 		ocNoName,			//  215
1155 		ocNoName,			//  216
1156 		ocNoName,			//  217
1157 		ocNoName,			//  218
1158 		ocNoName,			//  219
1159 		ocNoName,			//  220
1160 		ocNoName,			//  221
1161 		ocNoName,			//  222
1162 		ocNoName,			//  223
1163 		ocNoName,			//  224
1164 		ocNoName,			//  225
1165 		ocNoName,			//  226
1166 		ocNoName,			//  227
1167 		ocNoName,			//  228
1168 		ocNoName,			//  229
1169 		ocNoName,			//  230
1170 		ocNoName,			//  231
1171 		ocNoName,			//  232
1172 		ocNoName,			//  233
1173 		ocNoName,			//  234
1174 		ocNoName,			//  235
1175 		ocNoName,			//  236
1176 		ocNoName,			//  237
1177 		ocNoName,			//  238
1178 		ocNoName,			//  239
1179 		ocNoName,			//  240
1180 		ocNoName,			//  241
1181 		ocNoName,			//  242
1182 		ocNoName,			//  243
1183 		ocNoName,			//  244
1184 		ocNoName,			//  245
1185 		ocNoName,			//  246
1186 		ocNoName,			//  247
1187 		ocNoName,			//  248
1188 		ocNoName,			//  249
1189 		ocNoName,			//  250
1190 		ocNoName,			//  251
1191 		ocNoName,			//  252
1192 		ocNoName,			//  253
1193 		ocNoName,			//  254
1194 		ocNoName			//  255 ?
1195 	};
1196 
1197 	return pToken[ nIndex ];
1198 }
1199 
1200 
IndexToTypeWK123(sal_uInt8 nIndex)1201 FUNC_TYPE LotusToSc::IndexToTypeWK123( sal_uInt8 nIndex )
1202 {
1203 	static const FUNC_TYPE pType[ 256 ] =
1204 	{						// Code Bezeichnung
1205 		FT_Const10Float,	//    0 8-Byte-IEEE-Long-Number
1206 		FT_Cref,			//    1 Cell Reference
1207 		FT_Rref,			//    2 Area Reference
1208 		FT_Return,			//    3 return
1209 		FT_Braces,			//    4 Klammer
1210 		FT_Snum,			//    5 Short-Number
1211 		FT_ConstString,		//    6 ASCII-String
1212 		FT_Nrref,			//    7 Named range reference
1213 		FT_Absnref,			//    8 Absolut named range
1214 		FT_Erref,			//    9 Err range reference
1215 		FT_Ecref,			//   10 Err cell reference
1216 		FT_Econstant,		//   11 Err constant
1217 		FT_NotImpl,			//   12
1218 		FT_NotImpl,			//   13
1219 		FT_Neg,				//   14 Negation
1220 		FT_Op,				//   15 Addition
1221 		FT_Op,				//   16 Subtraktion
1222 		FT_Op,				//   17 Multiplikation
1223 		FT_Op,				//   18 Division
1224 		FT_Op,				//   19 Potenzierung
1225 		FT_Op,				//   20 Gleichheit
1226 		FT_Op,				//   21 Ungleich
1227 		FT_Op,				//   22 Kleiner-gleich
1228 		FT_Op,				//   23 Groesser-gleich
1229 		FT_Op,				//   24 Kleiner
1230 		FT_Op,				//   25 Groesser
1231 		FT_Op,				//   26 And (logisch)
1232 		FT_Op,				//   27 Or (logisch)
1233 		FT_FuncFix1,		//   28 Not (logisch)
1234 		FT_NOP,				//   29 unaeres Plus
1235 		FT_Op,				//   30 Concatenation
1236 		FT_FuncFix0,		//   31 Not applicable
1237 		FT_FuncFix0,		//   32 Error
1238 		FT_FuncFix1,		//   33 Betrag ABS()
1239 		FT_FuncFix1,		//   34 Ganzzahl INT()
1240 		FT_FuncFix1,		//   35 Quadratwurzel
1241 		FT_FuncFix1,		//   36 Zehnerlogarithmus
1242 		FT_FuncFix1,		//   37 Natuerlicher Logarithmus
1243 		FT_FuncFix0,		//   38 PI
1244 		FT_FuncFix1,		//   39 Sinus
1245 		FT_FuncFix1,		//   40 Cosinus
1246 		FT_FuncFix1,		//   41 Tangens
1247 		FT_FuncFix2,		//   42 Arcus-Tangens 2 (4.Quadrant)
1248 		FT_FuncFix1,		//   43 Arcus-Tangens (2.Quadrant)
1249 		FT_FuncFix1,		//   44 Arcus-Sinus
1250 		FT_FuncFix1,		//   45 Arcus-Cosinus
1251 		FT_FuncFix1,		//   46 Exponentialfunktion
1252 		FT_FuncFix2,		//   47 Modulo
1253 		FT_FuncVar,			//   48 Auswahl
1254 		FT_FuncFix1,		//   49 Is not applicable?
1255 		FT_FuncFix1,		//   50 Is Error?
1256 		FT_FuncFix0,		//   51 FALSE
1257 		FT_FuncFix0,		//   52 TRUE
1258 		FT_FuncFix0,		//   53 Zufallszahl
1259 		FT_FuncFix3,		//   54 Datum
1260 		FT_FuncFix0,		//   55 Heute
1261 		FT_FuncFix3,		//   56 Payment
1262 		FT_FuncFix3,		//   57 Present Value
1263 		FT_FuncFix3,		//   58 Future Value
1264 		FT_FuncFix3,		//   59 If ... then ... else ...
1265 		FT_FuncFix1,		//   60 Tag des Monats
1266 		FT_FuncFix1,		//   61 Monat
1267 		FT_FuncFix1,		//   62 Jahr
1268 		FT_FuncFix2,		//   63 Runden
1269 		FT_FuncFix3,		//   64 Zeit
1270 		FT_FuncFix1,		//   65 Stunde
1271 		FT_FuncFix1,		//   66 Minute
1272 		FT_FuncFix1,		//   67 Sekunde
1273 		FT_FuncFix1,		//   68 Ist Zahl?
1274 		FT_FuncFix1,		//   69 Ist Text?
1275 		FT_FuncFix1,		//   70 Len()
1276 		FT_FuncFix1,		//   71 Val()
1277 		FT_FuncFix2,		//   72 String()
1278 		FT_FuncFix3,		//   73 Mid()
1279 		FT_FuncFix1,		//   74 Char()
1280 		FT_FuncFix1,		//   75 Ascii()
1281 		FT_FuncFix3,		//   76 Find()
1282 		FT_FuncFix1,		//   77 Datevalue
1283 		FT_FuncFix1,		//   78 Timevalue
1284 		FT_FuncFix1,		//   79 Cellpointer
1285 		FT_FuncVar,			//   80 Sum()
1286 		FT_FuncVar,			//   81 Avg()
1287 		FT_FuncVar,			//   82 Cnt()
1288 		FT_FuncVar,			//   83 Min()
1289 		FT_FuncVar,			//   84 Max()
1290 		FT_FuncFix3,		//   85 Vlookup()
1291 		FT_FuncFix2,		//   86 Npv()
1292 		FT_FuncVar,			//   87 Var()
1293 		FT_FuncVar,			//   88 Std()
1294 		FT_FuncFix2,		//   89 Irr()
1295 		FT_FuncFix3,		//   90 Hlookup()
1296 		FT_FuncVar,			//   91 Dsum                 <-------- neu! -
1297 		FT_FuncVar,			//   92 Davg                 <-------- neu! -
1298 		FT_FuncVar,			//   93 Dcnt                 <-------- neu! -
1299 		FT_FuncVar,			//   94 Dmin                 <-------- neu! -
1300 		FT_FuncVar,			//   95 Dmax                 <-------- neu! -
1301 		FT_FuncVar,			//   96 Dvar                 <-------- neu! -
1302 		FT_FuncVar,			//   97 Dstd                 <-------- neu! -
1303 		FT_FuncVar,			//   98 Index()              <-------- change! -
1304 		FT_FuncFix1,		//   99 Cols()               <-------- neu! -
1305 		FT_FuncFix1,		//  100 Rows()               <-------- neu! -
1306 		FT_FuncFix2,		//  101 Repeat()             <-------- neu! -
1307 		FT_FuncFix1,		//  102 Upper()              <-------- neu! -
1308 		FT_FuncFix1,		//  103 Lower()              <-------- neu! -
1309 		FT_FuncFix2,		//  104 Left()               <-------- neu! -
1310 		FT_FuncFix2,		//  105 Right()              <-------- neu! -
1311 		FT_FuncFix4,		//  106 Replace()            <-------- neu! -
1312 		FT_FuncFix1,		//  107 Proper()             <-------- neu! -
1313 		FT_FuncFix2,		//  108 Cell()               <-------- neu! -
1314 		FT_FuncFix1,		//  109 Trim()               <-------- neu! -
1315 		FT_FuncFix1,		//  110 Clean()              <-------- neu! -
1316 		FT_FuncFix1,		//  111 S()                  <--------- change in Bez. -
1317 		FT_FuncFix1,		//  112 N()                  <--------- change in Bez. -
1318 		FT_FuncFix2,		//  113 Exact()              <-------- neu! -
1319 		FT_NotImpl,			//  114 App                  <--------- change in Bez. -
1320 		FT_FuncFix1,		//  115 @@()                 <-------- neu! -
1321 		FT_FuncFix3,		//  116 Rate()               <-------- neu! -
1322 		FT_FuncFix3,		//  117 Term()               <--------- change in Anz.
1323 		FT_FuncFix3,		//  118 Cterm()              <--------- change in Anz.
1324 		FT_FuncFix3,		//  119 Sln()                <-------- neu! -
1325 		FT_FuncFix4,		//  120 Syd()                <-------- neu! -
1326 		FT_FuncFix4,		//  121 Ddb()                <-------- neu! -
1327 		FT_Splfunc,			//  122 Splfunc              <-------- neu! -
1328 		FT_FuncFix1,		//  123 Sheets               <-------- neu! -
1329 		FT_FuncFix1,		//  124 Info                 <-------- neu! -
1330 		FT_FuncVar,			//  125 Sumproduct           <-------- neu! -
1331 		FT_FuncFix1,		//  126 Isrange              <-------- neu! -
1332 		FT_FuncVar,			//  127 Dget                 <-------- neu! -
1333 		FT_FuncVar,			//  128 Dquery               <-------- neu! -
1334 		FT_FuncFix4,		//  129 Coord                <-------- neu! -
1335 		FT_NOP,				//  130 Reserved (internal)  <-------- neu! -
1336 		FT_FuncFix0,		//  131 Today                <-------- neu! -
1337 		FT_FuncVar,			//  132 Vdb                  <-------- neu! -
1338 		FT_FuncVar,			//  133 Dvars                <-------- neu! -
1339 		FT_FuncVar,			//  134 Dstds                <-------- neu! -
1340 		FT_FuncVar,			//  135 Vars                 <-------- neu! -
1341 		FT_FuncVar,			//  136 Stds                 <-------- neu! -
1342 		FT_FuncFix2,		//  137 D360                 <-------- neu! -
1343 		FT_NOP,				//  138 Reserved (internal)  <-------- neu! -
1344 		FT_FuncFix0,		//  139 Isapp                <-------- neu! - Anzahl ? -
1345 		FT_FuncVar,			//  140 Isaaf                <-------- neu! - Anzahl ? -
1346 		FT_FuncFix1,		//  141 Weekday              <-------- neu! -
1347 		FT_FuncFix3,		//  142 Datedif              <-------- neu! -
1348 		FT_FuncVar,			//  143 Rank                 <-------- neu! -
1349 		FT_FuncFix2,		//  144 Numberstring         <-------- neu! -
1350 		FT_FuncFix1,		//  145 Datestring           <-------- neu! -
1351 		FT_FuncFix1,		//  146 Decimal              <-------- neu! -
1352 		FT_FuncFix1,		//  147 Hex                  <-------- neu! -
1353 		FT_FuncFix4,		//  148 Db                   <-------- neu! -
1354 		FT_FuncFix4,		//  149 Pmti                 <-------- neu! -
1355 		FT_FuncFix4,		//  150 Spi                  <-------- neu! -
1356 		FT_FuncFix1,		//  151 Fullp                <-------- neu! -
1357 		FT_FuncFix1,		//  152 Halfp                <-------- neu! -
1358 		FT_FuncVar,			//  153 Pureavg              <-------- neu! -
1359 		FT_FuncVar,			//  154 Purecount            <-------- neu! -
1360 		FT_FuncVar,			//  155 Puremax              <-------- neu! -
1361 		FT_FuncVar,			//  156 Puremin              <-------- neu! -
1362 		FT_FuncVar,			//  157 Purestd              <-------- neu! -
1363 		FT_FuncVar,			//  158 Purevar              <-------- neu! -
1364 		FT_FuncVar,			//  159 Purestds             <-------- neu! -
1365 		FT_FuncVar,			//  160 Purevars             <-------- neu! -
1366 		FT_FuncFix3,		//  161 Pmt2                 <-------- neu! -
1367 		FT_FuncFix3,		//  162 Pv2                  <-------- neu! -
1368 		FT_FuncFix3,		//  163 Fv2                  <-------- neu! -
1369 		FT_FuncFix3,		//  164 Term2                <-------- neu! -
1370 		FT_NotImpl,			//  165 ---                  <-------- neu! - Anzahl ? -
1371 		FT_FuncFix2,		//  166 D360 (US-Version)
1372 		FT_NotImpl,			//  167
1373 		FT_NotImpl,			//  168
1374 		FT_NotImpl,			//  169
1375 		FT_NotImpl,			//  170
1376 		FT_NotImpl,			//  171
1377 		FT_NotImpl,			//  172
1378 		FT_NotImpl,			//  173
1379 		FT_NotImpl,			//  174
1380 		FT_NotImpl,			//  175
1381 		FT_NotImpl,			//  176
1382 		FT_NotImpl,			//  177
1383 		FT_NotImpl,			//  178
1384 		FT_NotImpl,			//  179
1385 		FT_NotImpl,			//  180
1386 		FT_NotImpl,			//  181
1387 		FT_NotImpl,			//  182
1388 		FT_NotImpl,			//  183
1389 		FT_NotImpl,			//  184
1390 		FT_NotImpl,			//  185
1391 		FT_FuncVar,			//  186 Solver               <-------- neu! -
1392 		FT_NotImpl,			//  187
1393 		FT_NotImpl,			//  188
1394 		FT_NotImpl,			//  189
1395 		FT_NotImpl,			//  190
1396 		FT_NotImpl,			//  191
1397 		FT_NotImpl,			//  192
1398 		FT_NotImpl,			//  193
1399 		FT_NotImpl,			//  194
1400 		FT_NotImpl,			//  195
1401 		FT_NotImpl,			//  196
1402 		FT_NotImpl,			//  197
1403 		FT_NotImpl,			//  198
1404 		FT_NotImpl,			//  199
1405 		FT_NotImpl,			//  200
1406 		FT_NotImpl,			//  201
1407 		FT_NotImpl,			//  202
1408 		FT_NotImpl,			//  203
1409 		FT_NotImpl,			//  204
1410 		FT_NotImpl,			//  205
1411 		FT_NotImpl,			//  206
1412 		FT_NotImpl,			//  207
1413 		FT_NotImpl,			//  208
1414 		FT_NotImpl,			//  209
1415 		FT_NotImpl,			//  210
1416 		FT_NotImpl,			//  211
1417 		FT_NotImpl,			//  212
1418 		FT_NotImpl,			//  213
1419 		FT_NotImpl,			//  214
1420 		FT_NotImpl,			//  215
1421 		FT_NotImpl,			//  216
1422 		FT_NotImpl,			//  217
1423 		FT_NotImpl,			//  218
1424 		FT_NotImpl,			//  219
1425 		FT_NotImpl,			//  220
1426 		FT_NotImpl,			//  221
1427 		FT_NotImpl,			//  222
1428 		FT_NotImpl,			//  223
1429 		FT_NotImpl,			//  224
1430 		FT_NotImpl,			//  225
1431 		FT_NotImpl,			//  226
1432 		FT_NotImpl,			//  227
1433 		FT_NotImpl,			//  228
1434 		FT_NotImpl,			//  229
1435 		FT_NotImpl,			//  230
1436 		FT_NotImpl,			//  231
1437 		FT_NotImpl,			//  232
1438 		FT_NotImpl,			//  233
1439 		FT_NotImpl,			//  234
1440 		FT_NotImpl,			//  235
1441 		FT_NotImpl,			//  236
1442 		FT_NotImpl,			//  237
1443 		FT_NotImpl,			//  238
1444 		FT_NotImpl,			//  239
1445 		FT_NotImpl,			//  240
1446 		FT_NotImpl,			//  241
1447 		FT_NotImpl,			//  242
1448 		FT_NotImpl,			//  243
1449 		FT_NotImpl,			//  244
1450 		FT_NotImpl,			//  245
1451 		FT_NotImpl,			//  246
1452 		FT_NotImpl,			//  247
1453 		FT_NotImpl,			//  248
1454 		FT_NotImpl,			//  249
1455 		FT_NotImpl,			//  250
1456 		FT_NotImpl,			//  251
1457 		FT_NotImpl,			//  252
1458 		FT_NotImpl,			//  253
1459 		FT_NotImpl,			//  254
1460 		FT_NotImpl,			//  255
1461 	};
1462 	return pType[ nIndex ];
1463 }
1464 
1465 
IndexToTokenWK123(sal_uInt8 nIndex)1466 DefTokenId LotusToSc::IndexToTokenWK123( sal_uInt8 nIndex )
1467 {
1468 	static const DefTokenId pToken[ 256 ] =
1469 	{						// Code Bezeichnung
1470 		ocPush,				//    0 8-Byte-IEEE-Long-Numbers
1471 		ocPush,				//    1 Variable
1472 		ocPush,				//    2 Bereich
1473 		ocPush,				//    3 return
1474 		ocPush,				//    4 Klammer
1475 		ocPush,				//    5 Numbers
1476 		ocPush,				//    6 ASCII-String
1477 		ocPush,				//    7 Named range reference
1478 		ocPush,				//    8 Absolut named range
1479 		ocPush,				//    9 Err range reference
1480 		ocPush,				//   10 Err cell reference
1481 		ocPush,				//   11 Err constant
1482 		ocPush,				//   12
1483 		ocPush,				//   13
1484 		ocNegSub,			//   14 Negation
1485 		ocAdd,				//   15 Addition
1486 		ocSub,				//   16 Subtraktion
1487 		ocMul,				//   17 Multiplikation
1488 		ocDiv,				//   18 Division
1489 		ocPow,				//   19 Potenzierung
1490 		ocEqual,			//   20 Gleichheit
1491 		ocNotEqual,			//   21 Ungleich
1492 		ocLessEqual,		//   22 Kleiner-gleich
1493 		ocGreaterEqual,		//   23 Groesser-gleich
1494 		ocLess,				//   24 Kleiner
1495 		ocGreater,			//   25 Groesser
1496 		ocAnd,				//   26 And (logisch)
1497 		ocOr,				//   27 Or (logisch)
1498 		ocNot,				//   28 Not (logisch)
1499 		ocPush,				//   29 unaeres Plus
1500 		ocAmpersand,		//   30	Concatenation
1501 		ocNotAvail,			//   31 Not available
1502 		ocNoName,			//   32 Error
1503 		ocAbs,				//   33 Betrag ABS()
1504 		ocInt,				//   34 Ganzzahl INT()
1505 		ocSqrt,				//   35 Quadratwurzel
1506 		ocLog10,			//   36 Zehnerlogarithmus
1507 		ocLn,				//   37 Natuerlicher Logarithmus
1508 		ocPi,				//   38 PI
1509 		ocSin,				//   39 Sinus
1510 		ocCos,				//   40 Cosinus
1511 		ocTan,				//   41 Tangens
1512 		ocArcTan2,			//   42 Arcus-Tangens 2 (4.Quadrant)
1513 		ocArcTan,			//   43 Arcus-Tangens (2.Quadrant)
1514 		ocArcSin,			//   44 Arcus-Sinus
1515 		ocArcCos,			//   45 Arcus-Cosinus
1516 		ocExp,				//   46 Exponentialfunktion
1517 		ocMod,				//   47 Modulo
1518 		ocChose,			//   48 Auswahl
1519 		ocIsNA,				//   49 Is not available?
1520 		ocIsError,			//   50 Is Error?
1521 		ocFalse,			//   51 FALSE
1522 		ocTrue,				//   52 TRUE
1523 		ocRandom,			//   53 Zufallszahl
1524 		ocGetDate,			//   54 Datum
1525 		ocGetActDate,		//   55 Heute
1526 		ocRMZ,				//   56 Payment
1527 		ocBW,				//   57 Present Value
1528 		ocZW,				//   58 Future Value
1529 		ocIf,				//   59 If ... then ... else ...
1530 		ocGetDay,			//   60 Tag des Monats
1531 		ocGetMonth,			//   61 Monat
1532 		ocGetYear,			//   62 Jahr
1533 		ocRound,			//   63 Runden
1534 		ocGetTime,			//   64 Zeit
1535 		ocGetHour,			//   65 Stunde
1536 		ocGetMin,			//   66 Minute
1537 		ocGetSec,			//   67 Sekunde
1538 		ocIsValue,			//   68 Ist Zahl?
1539 		ocIsString,			//   69 Ist Text?
1540 		ocLen,				//   70 Len()
1541 		ocValue,			//   71 Val()
1542 		ocFixed,			//   72 String()	ocFixed ersatzweise + Spezialfall
1543 		ocMid,				//   73 Mid()
1544 		ocChar,				//   74 Char()
1545 		ocCode,				//   75 Ascii()
1546 		ocFind,				//   76 Find()
1547 		ocGetDateValue,		//   77 Datevalue
1548 		ocGetTimeValue,		//   78 Timevalue
1549 		ocNoName,			//   79 Cellpointer
1550 		ocSum,				//   80 Sum()
1551 		ocAverage,			//   81 Avg()
1552 		ocCount,			//   82 Cnt()
1553 		ocMin,				//   83 Min()
1554 		ocMax,				//   84 Max()
1555 		ocVLookup,			//   85 Vlookup()
1556 		ocNPV,				//   86 Npv()
1557 		ocVar,				//   87 Var()
1558 		ocStDev,			//   88 Std()
1559 		ocIRR,				//   89 Irr()
1560 		ocHLookup,			//   90 Hlookup()
1561 		ocDBSum,			//   91 XlfDsum
1562 		ocDBAverage,		//   92 XlfDaverage
1563 		ocDBCount,			//   93 XlfDcount
1564 		ocDBMin,			//   94 XlfDmin
1565 		ocDBMax,			//   95 XlfDmax
1566 		ocDBVar,			//   96 XlfDvar
1567 		ocDBStdDev,			//   97 XlfDstdev
1568 		ocIndex,			//   98 Index()
1569 		ocColumns,			//   99 Cols()
1570 		ocRows,				//  100 Rows()
1571 		ocRept,				//  101 Repeat()
1572 		ocUpper,			//  102 Upper()
1573 		ocLower,			//  103 Lower()
1574 		ocLeft,				//  104 Left()
1575 		ocRight,			//  105 Right()
1576 		ocReplace,			//  106 Replace()
1577 		ocPropper,			//  107 Proper()
1578 		ocNoName,			//  108 Cell()
1579 		ocTrim,				//  109 Trim()
1580 		ocClean,			//  110 Clean()
1581 		ocNoName,			//  111 F()		(Excel: T()?)
1582 		ocNoName,			//  112 W()
1583 		ocExact,			//  113 Exact()
1584 		ocNoName,			//  114 Call()
1585 		ocIndirect,			//  115 @@()
1586 		ocZins,				//  116 Rate()
1587 		ocNoName,			//  117 Term()
1588 		ocNoName,			//  118 Cterm()
1589 		ocLIA,				//  119 Sln()
1590 		ocDIA,				//  120 Syd(), Soy()
1591 		ocGDA,				//  121 Ddb()
1592 		ocNoName,			//  122 Splfunc
1593 		ocNoName,			//  123 Sheets
1594 		ocNoName,			//  124	Info
1595 		ocSumProduct,		//  125 Sumproduct
1596 		ocNoName,			//  126 Isrange
1597 		ocDBGet,			//  127 Dget
1598 		ocNoName,			//  128 Dquery
1599 		ocNoName,			//  129 Coord
1600 		ocNoName,			//  130 Reserved (internal)
1601 		ocGetActDate,		//  131 Today
1602 		ocNoName,			//  132 Vdb
1603 		ocDBVarP,			//  133 Dvars
1604 		ocDBStdDevP,		//  134 Dstds
1605 		ocVarP,				//  135 Vars
1606 		ocStDevP,			//  136 Stds
1607 		ocGetDiffDate360,	//  137 D360
1608 		ocNoName,			//  138 Reserved (internal)
1609 		ocNoName,			//  139 Isapp
1610 		ocNoName,			//  140 Isaaf
1611 		ocGetDayOfWeek,		//  141 Weekday
1612 		ocGetDiffDate,		//  142 Datedif
1613 		ocRank,				//  143 Rank
1614 		ocNoName,			//  144 Numberstring
1615 		ocNoName,			//  145 Datestring
1616 		ocNoName,			//  146 Decimal
1617 		ocNoName,			//  147 Hex
1618 		ocNoName,			//  148 Db
1619 		ocNoName,			//  149 Pmti
1620 		ocNoName,			//  150 Spi
1621 		ocNoName,			//  151 Fullp
1622 		ocNoName,			//  152 Halfp
1623 		ocNoName,			//  153 Pureavg
1624 		ocCount2,			//  154 Purecount
1625 		ocNoName,			//  155 Puremax
1626 		ocNoName,			//  156 Puremin
1627 		ocNoName,			//  157 Purestd
1628 		ocNoName,			//  158 Purevar
1629 		ocNoName,			//  159 Purestds
1630 		ocNoName,			//  160 Purevars
1631 		ocNoName,			//  161 Pmt2
1632 		ocNoName,			//  162 Pv2
1633 		ocNoName,			//  163 Fv2
1634 		ocNoName,			//  164 Term2
1635 		ocNoName,			//  165 ---                  <-------- neu! - Anzahl ? -
1636 		ocGetDiffDate360,	//  166 D360 (US-Version, ersatzweise wie ander D360-Funktion)
1637 		ocNoName,			//  167
1638 		ocNoName,			//  168
1639 		ocNoName,			//  169
1640 		ocNoName,			//  170
1641 		ocNoName,			//  171
1642 		ocNoName,			//  172
1643 		ocNoName,			//  173
1644 		ocNoName,			//  174
1645 		ocNoName,			//  175
1646 		ocNoName,			//  176
1647 		ocNoName,			//  177
1648 		ocNoName,			//  178
1649 		ocNoName,			//  179
1650 		ocNoName,			//  180
1651 		ocNoName,			//  181
1652 		ocNoName,			//  182
1653 		ocNoName,			//  183
1654 		ocNoName,			//  184
1655 		ocNoName,			//  185
1656 		ocNoName,			//  186
1657 		ocNoName,			//  187
1658 		ocNoName,			//  188
1659 		ocNoName,			//  189
1660 		ocNoName,			//  190
1661 		ocNoName,			//  191
1662 		ocNoName,			//  192
1663 		ocNoName,			//  193
1664 		ocNoName,			//  194
1665 		ocNoName,			//  195
1666 		ocNoName,			//  196
1667 		ocNoName,			//  197
1668 		ocNoName,			//  198
1669 		ocNoName,			//  199
1670 		ocNoName,			//  200
1671 		ocNoName,			//  201
1672 		ocNoName,			//  202
1673 		ocNoName,			//  203
1674 		ocNoName,			//  204
1675 		ocNoName,			//  205
1676 		ocNoName,			//  206 ?
1677 		ocNoName,			//  207
1678 		ocNoName,			//  208
1679 		ocNoName,			//  209
1680 		ocNoName,			//  210
1681 		ocNoName,			//  211
1682 		ocNoName,			//  212
1683 		ocNoName,			//  213
1684 		ocNoName,			//  214
1685 		ocNoName,			//  215
1686 		ocNoName,			//  216
1687 		ocNoName,			//  217
1688 		ocNoName,			//  218
1689 		ocNoName,			//  219
1690 		ocNoName,			//  220
1691 		ocNoName,			//  221
1692 		ocNoName,			//  222
1693 		ocNoName,			//  223
1694 		ocNoName,			//  224
1695 		ocNoName,			//  225
1696 		ocNoName,			//  226
1697 		ocNoName,			//  227
1698 		ocNoName,			//  228
1699 		ocNoName,			//  229
1700 		ocNoName,			//  230
1701 		ocNoName,			//  231
1702 		ocNoName,			//  232
1703 		ocNoName,			//  233
1704 		ocNoName,			//  234
1705 		ocNoName,			//  235
1706 		ocNoName,			//  236
1707 		ocNoName,			//  237
1708 		ocNoName,			//  238
1709 		ocNoName,			//  239
1710 		ocNoName,			//  240
1711 		ocNoName,			//  241
1712 		ocNoName,			//  242
1713 		ocNoName,			//  243
1714 		ocNoName,			//  244
1715 		ocNoName,			//  245
1716 		ocNoName,			//  246
1717 		ocNoName,			//  247
1718 		ocNoName,			//  248
1719 		ocNoName,			//  249
1720 		ocNoName,			//  250
1721 		ocNoName,			//  251
1722 		ocNoName,			//  252
1723 		ocNoName,			//  253
1724 		ocNoName,			//  254
1725 		ocNoName			//  255 ?
1726 	};
1727 
1728 	return pToken[ nIndex ];
1729 }
1730 
1731 
1732 
1733 
GetAddInName(const sal_uInt8 n)1734 const sal_Char* GetAddInName( const sal_uInt8 n )
1735 {
1736 	static const sal_Char*	pNames[ 256 ] =
1737 	{
1738 		NULL,						//    0 8-Byte-IEEE-Float
1739 		NULL,						//    1 Variable
1740 		NULL,						//    2 Bereich
1741 		NULL,						//    3 return
1742 		NULL,						//    4 Klammer
1743 		NULL,						//    5 2-Byte-Integer
1744 		NULL,						//    6 ASCII-String
1745 		NULL,						//    7 Named range reference
1746 		NULL,						//    8 Absolut named range
1747 		NULL,						//    9 Err range reference
1748 		NULL,						//   10 Err cell reference
1749 		NULL,						//   11 Err constant
1750 		NULL,						//   12
1751 		NULL,						//   13
1752 		NULL,						//   14 Negation
1753 		NULL,						//   15 Addition
1754 		NULL,						//   16 Subtraktion
1755 		NULL,						//   17 Multiplikation
1756 		NULL,						//   18 Division
1757 		NULL,						//   19 Potenzierung
1758 		NULL,						//   20 Gleichheit
1759 		NULL,						//   21 Ungleich
1760 		NULL,						//   22 Kleiner-gleich
1761 		NULL,						//   23 Groesser-gleich
1762 		NULL,						//   24 Kleiner
1763 		NULL,						//   25 Groesser
1764 		NULL,						//   26 And (logisch)
1765 		NULL,						//   27 Or (logisch)
1766 		NULL,						//   28 Not (logisch)
1767 		NULL,						//   29 unaeres Plus
1768 		NULL,						//   30	Concatenation
1769 		NULL,						//   31 Not applicable
1770 		NULL,						//   32 Error
1771 		NULL,						//   33 Betrag ABS()
1772 		NULL,						//   34 Ganzzahl INT()
1773 		NULL,						//   35 Quadratwurzel
1774 		NULL,						//   36 Zehnerlogarithmus
1775 		NULL,						//   37 Natuerlicher Logarithmus
1776 		NULL,						//   38 PI
1777 		NULL,						//   39 Sinus
1778 		NULL,						//   40 Cosinus
1779 		NULL,						//   41 Tangens
1780 		NULL,						//   42 Arcus-Tangens 2 (4.Quadrant)
1781 		NULL,						//   43 Arcus-Tangens (2.Quadrant)
1782 		NULL,						//   44 Arcus-Sinus
1783 		NULL,						//   45 Arcus-Cosinus
1784 		NULL,						//   46 Exponentialfunktion
1785 		NULL,						//   47 Modulo
1786 		NULL,						//   48 Auswahl
1787 		NULL,						//   49 Is not applicable?
1788 		NULL,						//   50 Is Error?
1789 		NULL,						//   51 FALSE
1790 		NULL,						//   52 TRUE
1791 		NULL,						//   53 Zufallszahl
1792 		NULL,						//   54 Datum
1793 		NULL,						//   55 Heute
1794 		NULL,						//   56 Payment
1795 		NULL,						//   57 Present Value
1796 		NULL,						//   58 Future Value
1797 		NULL,						//   59 If ... then ... else ...
1798 		NULL,						//   60 Tag des Monats
1799 		NULL,						//   61 Monat
1800 		NULL,						//   62 Jahr
1801 		NULL,						//   63 Runden
1802 		NULL,						//   64 Zeit
1803 		NULL,						//   65 Stunde
1804 		NULL,						//   66 Minute
1805 		NULL,						//   67 Sekunde
1806 		NULL,						//   68 Ist Zahl?
1807 		NULL,						//   69 Ist Text?
1808 		NULL,						//   70 Len()
1809 		NULL,						//   71 Val()
1810 		NULL,						//   72 String()	ocFixed ersatzweise + Spezialfall
1811 		NULL,						//   73 Mid()
1812 		NULL,						//   74 Char()
1813 		NULL,						//   75 Ascii()
1814 		NULL,						//   76 Find()
1815 		NULL,						//   77 Datevalue
1816 		NULL,						//   78 Timevalue
1817 		"ZELLZEIGER",				//   79 Cellpointer
1818 		NULL,						//   80 Sum()
1819 		NULL,						//   81 Avg()
1820 		NULL,						//   82 Cnt()
1821 		NULL,						//   83 Min()
1822 		NULL,						//   84 Max()
1823 		NULL,						//   85 Vlookup()
1824 		NULL,						//   86 Npv()
1825 		NULL,						//   87 Var()
1826 		NULL,						//   88 Std()
1827 		NULL,						//   89 Irr()
1828 		NULL,						//   90 Hlookup()
1829 		NULL,						//   91 XlfDsum
1830 		NULL,						//   92 XlfDaverage
1831 		NULL,						//   93 XlfDcount
1832 		NULL,						//   94 XlfDmin
1833 		NULL,						//   95 XlfDmax
1834 		NULL,						//   96 XlfDvar
1835 		NULL,						//   97 XlfDstdev
1836 		NULL,						//   98 Index()
1837 		NULL,						//   99 Cols()
1838 		NULL,						//  100 Rows()
1839 		NULL,						//  101 Repeat()
1840 		NULL,						//  102 Upper()
1841 		NULL,						//  103 Lower()
1842 		NULL,						//  104 Left()
1843 		NULL,						//  105 Right()
1844 		NULL,						//  106 Replace()
1845 		NULL,						//  107 Proper()
1846 		"ZELLE",					//  108 Cell()
1847 		NULL,						//  109 Trim()
1848 		NULL,						//  110 Clean()
1849 		"F",						//  111 F()		(Excel: T()?)
1850 		"W",						//  112 W()
1851 		NULL,						//  113 Exact()
1852 		NULL,						//  114 Call()
1853 		NULL,						//  115 @@()
1854 		NULL,						//  116 Rate()
1855 		"ANN",						//  117 Term()
1856 		NULL,						//  118 Cterm()
1857 		NULL,						//  119 Sln()
1858 		NULL,						//  120 Syd(), Soy()
1859 		NULL,						//  121 Ddb()
1860 		"SplFunc",					//  122 Splfunc
1861 		"BLAETTER",					//  123 Sheets
1862 		"INFO",						//  124	Info
1863 		NULL,						//  125 Sumproduct
1864 		"ISTBEREICH",				//  126 Isrange
1865 		NULL,						//  127 Dget
1866 		"DABFRAGE",					//  128 Dquery
1867 		"KOORD",					//  129 Coord
1868 		NULL,						//  130 Reserved (internal)
1869 		NULL,						//  131 Today
1870 		NULL,						//  132 Vdb
1871 		NULL,						//  133 Dvars
1872 		NULL,						//  134 Dstds
1873 		NULL,						//  135 Vars
1874 		NULL,						//  136 Stds
1875 		NULL,						//  137 D360
1876 		NULL,						//  138 Reserved (internal)
1877 		NULL,						//  139 Isapp
1878 		"ISTDEFZUS",				//  140 Isaaf
1879 		NULL,						//  141 Weekday
1880 		NULL,						//  142 Datedif
1881 		NULL,						//  143 Rank
1882 		NULL,						//  144 Numberstring
1883 		"DATUMFOLGE",				//  145 Datestring
1884 		"DEZIMAL",					//  146 Decimal
1885 		"HEX",						//  147 Hex
1886 		NULL,						//  148 Db
1887 		NULL,						//  149 Pmti
1888 		NULL,						//  150 Spi
1889 		NULL,						//  151 Fullp
1890 		NULL,						//  152 Halfp
1891 		"PURMITTELWERT",			//  153 Pureavg
1892 		"PURANZAHL",				//  154 Purecount
1893 		"PURMAX",					//  155 Puremax
1894 		"PURMIN",					//  156 Puremin
1895 		"PURSTDABW",				//  157 Purestd
1896 		"PURVAR",					//  158 Purevar
1897 		"PURSTDABWP",				//  159 Purestds
1898 		"PURVARP",					//  160 Purevars
1899 		NULL,						//  161 Pmt2
1900 		NULL,						//  162 Pv2
1901 		NULL,						//  163 Fv2
1902 		NULL,						//  164 Term2
1903 		NULL,						//  165 ---                  <-------- neu! - Anzahl ? -
1904 		NULL,						//  166 D360 (US-Version, ersatzweise wie ander D360-Funktion)
1905 		NULL,						//  167
1906 		NULL,						//  168
1907 		NULL,						//  169
1908 		NULL,						//  170
1909 		NULL,						//  171
1910 		NULL,						//  172
1911 		NULL,						//  173
1912 		NULL,						//  174
1913 		NULL,						//  175
1914 		NULL,						//  176
1915 		NULL,						//  177
1916 		NULL,						//  178
1917 		NULL,						//  179
1918 		NULL,						//  180
1919 		NULL,						//  181
1920 		NULL,						//  182
1921 		NULL,						//  183
1922 		NULL,						//  184
1923 		NULL,						//  185
1924 		NULL,						//  186
1925 		NULL,						//  187
1926 		NULL,						//  188
1927 		NULL,						//  189
1928 		NULL,						//  190
1929 		NULL,						//  191
1930 		NULL,						//  192
1931 		NULL,						//  193
1932 		NULL,						//  194
1933 		NULL,						//  195
1934 		NULL,						//  196
1935 		NULL,						//  197
1936 		NULL,						//  198
1937 		NULL,						//  199
1938 		NULL,						//  200
1939 		NULL,						//  201
1940 		NULL,						//  202
1941 		NULL,						//  203
1942 		NULL,						//  204
1943 		NULL,						//  205
1944 		NULL,						//  206 ?
1945 		NULL,						//  207
1946 		NULL,						//  208
1947 		NULL,						//  209
1948 		NULL,						//  210
1949 		NULL,						//  211
1950 		NULL,						//  212
1951 		NULL,						//  213
1952 		NULL,						//  214
1953 		NULL,						//  215
1954 		NULL,						//  216
1955 		NULL,						//  217
1956 		NULL,						//  218
1957 		NULL,						//  219
1958 		NULL,						//  220
1959 		NULL,						//  221
1960 		NULL,						//  222
1961 		NULL,						//  223
1962 		NULL,						//  224
1963 		NULL,						//  225
1964 		NULL,						//  226
1965 		NULL,						//  227
1966 		NULL,						//  228
1967 		NULL,						//  229
1968 		NULL,						//  230
1969 		NULL,						//  231
1970 		NULL,						//  232
1971 		NULL,						//  233
1972 		NULL,						//  234
1973 		NULL,						//  235
1974 		NULL,						//  236
1975 		NULL,						//  237
1976 		NULL,						//  238
1977 		NULL,						//  239
1978 		NULL,						//  240
1979 		NULL,						//  241
1980 		NULL,						//  242
1981 		NULL,						//  243
1982 		NULL,						//  244
1983 		NULL,						//  245
1984 		NULL,						//  246
1985 		NULL,						//  247
1986 		NULL,						//  248
1987 		NULL,						//  249
1988 		NULL,						//  250
1989 		NULL,						//  251
1990 		NULL,						//  252
1991 		NULL,						//  253
1992 		NULL,						//  254
1993 		NULL						//  255 ?
1994 	};
1995 
1996 	return pNames[ n ];
1997 }
1998 
1999 
lcl_KnownAddIn(const ByteString & sTest)2000 static DefTokenId lcl_KnownAddIn( const ByteString& sTest )
2001 {
2002 	DefTokenId	eId = ocNoName;
2003 
2004 	if( sTest == "FACT" )
2005 			eId = ocFact;
2006 	else if(sTest== "ISEMPTY")
2007 			eId=ocIsEmpty;
2008 	else if(sTest== "DEGTORAD")
2009 			eId=ocRad;
2010 	else if(sTest== "RADTODEG")
2011 			eId=ocDeg;
2012 	else if(sTest== "SIGN")
2013 			eId=ocPlusMinus;
2014 	else if(sTest== "ACOSH")
2015 			eId=ocArcCosHyp;
2016 	else if(sTest== "ACOTH")
2017 			eId=ocArcCotHyp;
2018 	else if(sTest== "ASINH")
2019 			eId=ocArcSinHyp;
2020 	else if(sTest== "ATANH")
2021 			eId=ocArcTanHyp;
2022 	else if(sTest== "COSH")
2023 			eId=ocCosHyp;
2024 	else if(sTest== "COTH")
2025 			eId=ocCotHyp;
2026 	else if(sTest== "SINH")
2027 			eId=ocSinHyp;
2028 	else if(sTest== "TANH")
2029 			eId=ocTanHyp;
2030 	else if(sTest== "EVEN")
2031 			eId=ocIsEven;
2032 	else if(sTest== "ODD")
2033 			eId=ocIsOdd;
2034 	else if(sTest== "ACOT")
2035 			eId=ocArcCot;
2036 	else if(sTest== "COT")
2037 			eId=ocCot;
2038 	else if(sTest== "ACOT")
2039 			eId=ocArcCot;
2040 	else if(sTest== "TRUNC")
2041 			eId=ocTrunc;
2042 	else if(sTest== "GEOMEAN")
2043 			eId=ocGeoMean;
2044 	else if(sTest== "HARMEAN")
2045 			eId=ocHarMean;
2046 	else if(sTest== "CORREL")
2047 			eId=ocCorrel;
2048 	else if(sTest== "MEDIAN")
2049 			eId=ocMedian;
2050 	else if(sTest== "COV")
2051 			eId=ocCovar;
2052 	else if(sTest== "SKEWNESS")
2053 			eId=ocSchiefe;
2054 	else if(sTest== "CHITEST")
2055 			eId=ocChiTest;
2056 	else if(sTest== "FTEST")
2057 			eId=ocFTest;
2058 	else if(sTest== "AVEDEV")
2059 			eId=ocAveDev;
2060 	else if(sTest== "PRODUCT")
2061 			eId=ocProduct;
2062 	else if(sTest== "PERMUT")
2063 			eId=ocVariationen;
2064 	else if(sTest== "GAMMALN")
2065 			eId=ocGammaLn;
2066 	else if(sTest== "POISSON")
2067 			eId=ocPoissonDist;
2068 	else if(sTest== "NORMAL")
2069 			eId=ocNormDist;
2070 	else if(sTest== "CRITBINOMIAL")
2071 			eId=ocKritBinom;
2072 	return eId;
2073 
2074 
2075 }
2076 
2077