LCOV - code coverage report
Current view: top level - sc/source/filter/qpro - qproform.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 23 278 8.3 %
Date: 2014-04-11 Functions: 2 9 22.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <rtl/strbuf.hxx>
      22             : #include <sal/config.h>
      23             : #include <sal/macros.h>
      24             : #include "qpro.hxx"
      25             : 
      26             : #include "qproform.hxx"
      27             : #include "formel.hxx"
      28             : #include "compiler.hxx"
      29             : #include <tokstack.hxx>
      30             : #include "ftools.hxx"
      31             : 
      32           0 : void QProToSc::ReadSRD( ScSingleRefData& rSRD, sal_Int8 nPage, sal_Int8 nCol, sal_uInt16 nRelBit )
      33             : {
      34           0 :     sal_uInt16 nTmp = nRelBit & 0x1fff;
      35           0 :     rSRD.InitAddress( ScAddress( nCol, (~nTmp + 1), 0 ) );
      36           0 :     if( nRelBit & 0x4000 )
      37             :     {
      38           0 :         rSRD.SetRelCol(nCol);
      39             :     }
      40             :     else
      41             :     {
      42           0 :         rSRD.SetAbsCol(nCol);
      43             :     }
      44             : 
      45           0 :     if( nRelBit & 0x2000 )
      46             :     {
      47           0 :         SCROW nRelRow = (~nTmp + 1);
      48           0 :         nRelRow = (sal_Int16)(nTmp << 3); // This looks weird... Mistake?
      49           0 :         nRelRow /= 8;
      50           0 :         rSRD.SetRelRow(nRelRow);
      51             :     }
      52             :     else
      53             :     {
      54           0 :         rSRD.SetAbsRow(nTmp);
      55             :     }
      56           0 :     if( nRelBit & 0x8000 )
      57             :     {
      58           0 :         rSRD.SetRelTab(nPage);
      59             :     }
      60             :     else
      61             :     {
      62           0 :         rSRD.SetAbsTab(nPage);
      63             :     }
      64           0 :     if (rSRD.toAbs(aEingPos).Tab() != aEingPos.Tab())
      65           0 :         rSRD.SetFlag3D(true);
      66           0 : }
      67             : 
      68           1 : QProToSc::QProToSc( SvStream& rStream, const ScAddress& rRefPos ) :
      69             :     ConverterBase( 128 ),
      70           1 :     maIn( rStream )
      71             : {
      72           1 :     aEingPos = rRefPos;
      73           1 : }
      74             : 
      75           0 : void QProToSc::DoFunc( DefTokenId eOc, sal_uInt16 nArgs, const sal_Char* pExtString )
      76             : {
      77           0 :     TokenId  eParam[ nBufSize ];
      78             :     sal_Int32    nCount;
      79           0 :     TokenId  nPush, nPush1;
      80             : 
      81           0 :     sal_Bool bAddIn = false;
      82             : 
      83           0 :     if( eOc == ocNoName )
      84             :     {
      85           0 :         bAddIn = sal_True;
      86           0 :         if( pExtString )
      87             :         {
      88           0 :             OStringBuffer s("QPRO_");
      89           0 :             s.append(pExtString);
      90           0 :             nPush = aPool.Store(eOc, OStringToOUString(s.makeStringAndClear(), maIn.GetStreamCharSet()));
      91           0 :             aPool << nPush;
      92             :         }
      93             :         else
      94           0 :             aPool << ocNoName;
      95             :     }
      96             : 
      97           0 :     if( nArgs < nBufSize )
      98             :     {
      99           0 :         for( nCount = 0; nCount < nArgs ; nCount++ )
     100           0 :             aStack >> eParam[ nCount ];
     101             :     }
     102             :     else
     103           0 :         return;
     104             : 
     105           0 :     switch( eOc )
     106             :     {
     107             :         case ocIndex:
     108           0 :             nPush = eParam[ 0 ];
     109           0 :             eParam[ 0 ] = eParam[ 1 ];
     110           0 :             eParam[ 1 ] = nPush;
     111           0 :             IncToken( eParam[ 0 ] );
     112           0 :             IncToken( eParam[ 1 ] );
     113           0 :             break;
     114             : 
     115             :         case ocIRR:
     116           0 :             nPush = eParam[ 0 ];
     117           0 :             eParam[ 0 ] = eParam[ 1 ];
     118           0 :             eParam[ 1 ] = nPush;
     119           0 :             break;
     120             : 
     121             :         case ocGetYear:
     122           0 :             nPush = aPool.Store( 1900.0 );
     123           0 :             aPool << ocOpen;
     124           0 :             break;
     125             : 
     126             :         default:
     127           0 :             break;
     128             :     }
     129             : 
     130           0 :     if( !bAddIn )
     131           0 :         aPool << eOc;
     132             : 
     133           0 :     aPool << ocOpen;
     134             : 
     135           0 :     if( nArgs> 0 )
     136             :     {
     137           0 :         sal_Int16 nLast = nArgs- 1;
     138             : 
     139           0 :         if( eOc == ocZGZ )
     140           0 :             aPool << eParam[ 2 ] << ocSep << eParam[ 1 ] << ocSep << eParam[ 0 ];
     141           0 :         if( eOc == ocZinsZ )
     142           0 :             aPool << eParam[ 3 ] << ocSep << eParam[ 2 ] << ocSep << eParam[ 1 ] << ocSep << eParam[ 0 ];
     143             :         else
     144             :         {
     145           0 :             sal_Int16 nNull = -1;
     146           0 :             aPool << eParam[ nLast ];
     147           0 :             for( nCount = nLast - 1 ; nCount >= 0 ; nCount-- )
     148             :             {
     149           0 :                 if( nCount != nNull )
     150           0 :                     aPool << ocSep << eParam[ nCount ];
     151             :             }
     152             :         }
     153             :     }
     154             : 
     155           0 :     if( eOc == ocGetYear )
     156           0 :         aPool << ocClose << ocSub << nPush;
     157           0 :     else if( eOc == ocFixed )
     158           0 :         aPool << ocSep << ocTrue << ocOpen << ocClose;
     159             : 
     160           0 :     aPool << ocClose;
     161           0 :     aPool >> aStack;
     162             : }
     163             : 
     164           0 : void QProToSc::IncToken( TokenId &rParam )
     165             : {
     166           0 :     aPool << ocOpen << rParam << mnAddToken;
     167           0 :     rParam = aPool.Store();
     168           0 : }
     169             : 
     170             : #define SAFEDEC_OR_RET(nRef, amt, ret) \
     171             : do { \
     172             :     if (nRef < amt)\
     173             :         return ret; \
     174             :     nRef-=amt; \
     175             : } while(false)
     176             : 
     177           1 : ConvErr QProToSc::Convert( const ScTokenArray*& pArray, sal_uInt16 /*nLen*/, const FORMULA_TYPE /*eFT*/ )
     178             : {
     179             :     sal_uInt8 nFmla[ nBufSize ], i, nArg, nArgArray[ nBufSize ];
     180             :     sal_Int8 nCol, nPage;
     181           1 :     sal_uInt16 nInt, nIntCount = 0, nStringCount = 0, nFloatCount = 0, nDLLCount = 0, nArgCount = 0;
     182           1 :     sal_uInt16 nIntArray[ nBufSize ] = {0};
     183         257 :     OUString sStringArray[ nBufSize ];
     184             :     sal_uInt16 nDummy, nDLLId, nDLLArray[ nBufSize ];
     185             :     sal_uInt16 nNote, nRef, nRelBits;
     186           1 :     TokenId nPush;
     187             :     ScComplexRefData aCRD;
     188             :     ScSingleRefData aSRD;
     189             :     FUNC_TYPE eType;
     190             :     DefTokenId eOc;
     191           1 :     double nFloatArray[ nBufSize ] = {0};
     192             :     double nFloat;
     193           1 :     const sal_Char* pExtString = 0;
     194             : 
     195           1 :     aCRD.InitFlags();
     196           1 :     aSRD.InitFlags();
     197           1 :     maIn.ReadUInt16( nRef );
     198             : 
     199           1 :     if( nRef < nBufSize )
     200             :     {
     201           1 :         for( i=0; i < nRef; i++)
     202             :         {
     203           1 :             maIn.ReadUChar( nFmla[i] );
     204             : 
     205           1 :             if( nFmla[ i ] == 0x05 )
     206             :             {
     207           0 :                 maIn.ReadUInt16( nInt );
     208           0 :                 nIntArray[ nIntCount ] = nInt;
     209           0 :                 SAFEDEC_OR_RET(nRef, 2, ConvErrCount);
     210           0 :                 nIntCount++;
     211             :             }
     212             : 
     213           1 :             if( nFmla[ i ] == 0x00 )
     214             :             {
     215           1 :                 maIn.ReadDouble( nFloat );
     216           1 :                 nFloatArray[ nFloatCount ] = nFloat;
     217           1 :                 SAFEDEC_OR_RET(nRef, 8, ConvErrCount);
     218           0 :                 nFloatCount++;
     219             :             }
     220             : 
     221           0 :             if( nFmla[ i ] == 0x1a )
     222             :             {
     223           0 :                 maIn.ReadUChar( nArg ).ReadUInt16( nDummy ).ReadUInt16( nDLLId );
     224           0 :                 nArgArray[ nArgCount ] = nArg;
     225           0 :                 nDLLArray[ nDLLCount ] = nDLLId;
     226           0 :                 SAFEDEC_OR_RET(nRef, 5, ConvErrCount);
     227           0 :                 nDLLCount++;
     228           0 :                 nArgCount++;
     229             :             }
     230           0 :             if( nFmla[ i ] == 0x06 )
     231             :             {
     232           0 :                 OUString aTmp(::read_zeroTerminated_uInt8s_ToOUString(maIn, maIn.GetStreamCharSet()));
     233           0 :                 sStringArray[ nStringCount ] = aTmp;
     234           0 :                 nStringCount++;
     235           0 :                 SAFEDEC_OR_RET(nRef, aTmp.getLength() + 1, ConvErrCount);
     236             :             }
     237             :         }
     238             :     }
     239             :     else
     240           0 :         return ConvErrCount;
     241             : 
     242           0 :     i = 0, nIntCount = 0, nFloatCount = 0, nDLLCount = 0, nArgCount = 0, nStringCount =0;
     243             : 
     244           0 :     while( i < nRef && ( nFmla[ i ] != 0x03 ) )
     245             :     {
     246           0 :         eType = IndexToType( nFmla[ i ] );
     247           0 :         eOc = IndexToToken( nFmla[ i ] );
     248           0 :         if( eOc == ocNoName )
     249           0 :             pExtString = getString( nFmla[ i ] );
     250             : 
     251           0 :         switch( eType )
     252             :         {
     253             :             case FT_NotImpl:
     254           0 :                 DoFunc( ocNoName, 0, pExtString );
     255           0 :                 break;
     256             : 
     257             :             case FT_FuncFix0:
     258           0 :                 DoFunc( eOc, 0, NULL );
     259           0 :                 break;
     260             : 
     261             :             case FT_FuncFix1:
     262           0 :                 DoFunc( eOc, 1, NULL );
     263           0 :                 break;
     264             : 
     265             :             case FT_FuncFix2:
     266           0 :                 DoFunc( eOc, 2, NULL );
     267           0 :                 break;
     268             : 
     269             :             case FT_FuncFix3:
     270           0 :                 DoFunc( eOc, 3, NULL );
     271           0 :                 break;
     272             : 
     273             :             case FT_FuncFix4:
     274           0 :                 DoFunc( eOc, 4, NULL );
     275           0 :                 break;
     276             : 
     277             :             case FT_FuncFix5:
     278           0 :                 DoFunc( eOc, 5, NULL );
     279           0 :                 break;
     280             : 
     281             :             case FT_FuncFix6:
     282           0 :                 DoFunc( eOc, 6, NULL );
     283           0 :                 break;
     284             : 
     285             :             case FT_DLL:{
     286           0 :                 eOc = IndexToDLLId( nDLLArray[ nDLLCount ] );
     287           0 :                 sal_uInt8 nPar = nArgArray[ nArgCount ];
     288           0 :                 DoFunc( eOc, nPar, NULL );
     289           0 :                 nDLLCount++;
     290           0 :                 nArgCount++;
     291             :                 }
     292           0 :                 break;
     293             : 
     294             :             case FT_Cref : // Single cell reference
     295           0 :                 maIn.ReadUInt16( nNote ).ReadSChar( nCol ).ReadSChar( nPage ).ReadUInt16( nRelBits );
     296           0 :                 ReadSRD( aSRD, nPage, nCol, nRelBits );
     297           0 :                 aStack << aPool.Store( aSRD );
     298           0 :                 break;
     299             : 
     300             :             case FT_Range: // Block reference
     301           0 :                 maIn.ReadUInt16( nNote ).ReadSChar( nCol ).ReadSChar( nPage ).ReadUInt16( nRelBits );
     302           0 :                 ReadSRD( aCRD.Ref1, nPage, nCol, nRelBits );
     303           0 :                 maIn.ReadSChar( nCol ).ReadSChar( nPage ).ReadUInt16( nRelBits );
     304           0 :                 ReadSRD( aCRD.Ref2, nPage, nCol, nRelBits );
     305             :                 // Sheet name of second corner is not displayed if identical
     306           0 :                 if (aCRD.Ref1.IsFlag3D() && aCRD.Ref1.Tab() == aCRD.Ref2.Tab() &&
     307           0 :                         aCRD.Ref1.IsTabRel() == aCRD.Ref2.IsTabRel())
     308           0 :                     aCRD.Ref2.SetFlag3D( false);
     309           0 :                 aStack << aPool.Store( aCRD );
     310           0 :                 break;
     311             : 
     312             :             case FT_FuncVar:{ // Sum of a sequence of numbers
     313             :                 sal_uInt8 nArgs;
     314           0 :                 i++;
     315           0 :                 nArgs = nFmla[ i ];
     316           0 :                 DoFunc( eOc, nArgs, NULL );
     317             :                 }
     318           0 :                 break;
     319             : 
     320             :             case FT_Op: // operators
     321           0 :                 aStack >> nPush;
     322           0 :                 aPool << aStack << eOc << nPush;
     323           0 :                 aPool >> aStack;
     324           0 :                 break;
     325             : 
     326             :             case FT_Braces:
     327           0 :                 aPool << ocOpen << aStack << ocClose;
     328           0 :                 aPool >> aStack;
     329           0 :                 break;
     330             : 
     331             :             case FT_ConstInt:{
     332             :                 sal_uInt16 nVal;
     333           0 :                 nVal = nIntArray[ nIntCount ];
     334           0 :                 aStack << aPool.Store( ( double ) nVal );
     335           0 :                 nIntCount++;
     336             :                 }
     337           0 :                 break;
     338             : 
     339             :             case FT_ConstFloat:{
     340             :                 double nVal;
     341           0 :                 nVal = nFloatArray[ nFloatCount ];
     342           0 :                 aStack << aPool.Store( nVal );
     343           0 :                 nFloatCount++;
     344             :                 }
     345           0 :                 break;
     346             : 
     347             :             case FT_ConstString:{
     348           0 :                 OUString aLabel(sStringArray[ nStringCount ]);
     349           0 :                 aStack << aPool.Store( aLabel );
     350           0 :                 nStringCount++;
     351             :                 }
     352           0 :                 break;
     353             : 
     354             :             case FT_Neg:
     355           0 :                 aPool <<  ocNegSub << aStack;
     356           0 :                 aPool >> aStack;
     357           0 :                 break;
     358             : 
     359             :             case FT_NOP:    // indicates invalid opcode.
     360             :             case FT_Return: // indicates end of formula
     361           0 :                 break;
     362             :         }
     363           0 :         i++;
     364             :     }
     365           0 :     pArray = aPool[ aStack.Get() ];
     366         256 :     return ConvOK;
     367             : }
     368             : 
     369             : static const struct
     370             : {
     371             :     DefTokenId nToken;
     372             :     FUNC_TYPE   nType;
     373             : } aFuncMap[] = {
     374             :     { ocPush, FT_ConstFloat },
     375             :     { ocPush, FT_Cref },
     376             :     { ocPush, FT_Range },
     377             :     { ocPush, FT_Return },
     378             :     { ocPush, FT_Braces },
     379             :     { ocPush, FT_ConstInt },
     380             :     { ocPush, FT_ConstString },
     381             :     { ocPush, FT_NOP },
     382             :     { ocNegSub, FT_Neg },                       // 0x08
     383             :     { ocAdd, FT_Op },
     384             :     { ocSub, FT_Op },
     385             :     { ocMul, FT_Op },
     386             :     { ocDiv, FT_Op },
     387             :     { ocPow, FT_Op },
     388             :     { ocEqual, FT_Op },
     389             :     { ocNotEqual, FT_Op },
     390             :     { ocLessEqual, FT_Op },                     // 0x10
     391             :     { ocGreaterEqual, FT_Op },
     392             :     { ocLess, FT_Op },
     393             :     { ocGreater, FT_Op },
     394             :     { ocAnd, FT_Op },
     395             :     { ocOr, FT_Op },
     396             :     { ocNot, FT_FuncFix1 },
     397             :     { ocPush, FT_NOP },     // Unary plus
     398             :     { ocAddress, FT_FuncFix4 }, // Address of
     399             :     { ocNoName, FT_NotImpl }, // Halt function
     400             :     { ocNoName, FT_DLL }, // DLL function
     401             :     { ocNoName, FT_NOP }, // Extended operands
     402             :     { ocNoName, FT_NOP }, // Extended operands
     403             :     { ocNoName, FT_NOP }, // Reserved
     404             :     { ocNoName, FT_NOP }, // Reserved
     405             :     { ocNotAvail, FT_FuncFix0 }, // NA
     406             :     { ocNoName, FT_FuncFix0 }, // Error         // 0x20
     407             :     { ocAbs, FT_FuncFix1 },
     408             :     { ocInt, FT_FuncFix1 },
     409             :     { ocSqrt, FT_FuncFix1 },
     410             :     { ocLog10, FT_FuncFix1 },
     411             :     { ocLn, FT_FuncFix1 },
     412             :     { ocPi, FT_FuncFix0 },
     413             :     { ocSin, FT_FuncFix1 },
     414             :     { ocCos, FT_FuncFix1 },
     415             :     { ocTan, FT_FuncFix1 },
     416             :     { ocArcTan2, FT_FuncFix2 },
     417             :     { ocArcTan, FT_FuncFix1 },
     418             :     { ocArcSin, FT_FuncFix1 },
     419             :     { ocArcCos, FT_FuncFix1 },
     420             :     { ocExp, FT_FuncFix1 },
     421             :     { ocMod, FT_FuncFix2 },
     422             :     { ocChose, FT_FuncVar },                    // 0x30
     423             :     { ocIsNA, FT_FuncFix1 },
     424             :     { ocIsError, FT_FuncFix1 },
     425             :     { ocFalse, FT_FuncFix0 },
     426             :     { ocTrue, FT_FuncFix0 },
     427             :     { ocRandom, FT_FuncFix0 },
     428             :     { ocGetDate, FT_FuncFix3 },
     429             :     { ocGetActTime, FT_FuncFix0 },
     430             :     { ocNoName, FT_NotImpl },    // QPro Pmt
     431             :     { ocNoName, FT_NotImpl },    // QPro Pv
     432             :     { ocNoName, FT_NotImpl },    // QPro Fv
     433             :     { ocIf, FT_FuncFix3 },
     434             :     { ocGetDay, FT_FuncFix1 },
     435             :     { ocGetMonth, FT_FuncFix1 },
     436             :     { ocGetYear, FT_FuncFix1 },
     437             :     { ocRound, FT_FuncFix2 },
     438             :     { ocGetTime, FT_FuncFix3 },                  // 0x40
     439             :     { ocGetHour, FT_FuncFix1 },
     440             :     { ocGetMin, FT_FuncFix1 },
     441             :     { ocGetSec, FT_FuncFix1 },
     442             :     { ocIsValue, FT_FuncFix1 },
     443             :     { ocIsString, FT_FuncFix1 },
     444             :     { ocLen, FT_FuncFix1 },
     445             :     { ocValue, FT_FuncFix1 },
     446             :     { ocFixed, FT_FuncFix2 },
     447             :     { ocMid, FT_FuncFix3 },
     448             :     { ocChar, FT_FuncFix1 },
     449             :     { ocCode, FT_FuncFix1 },
     450             :     { ocFind, FT_FuncFix3 },
     451             :     { ocGetDateValue, FT_FuncFix1 },
     452             :     { ocGetTimeValue, FT_FuncFix1 },
     453             :     { ocNoName, FT_NotImpl },
     454             :     { ocSum, FT_FuncVar },                     // 0x50
     455             :     { ocAverage, FT_FuncVar },
     456             :     { ocCount, FT_FuncVar },
     457             :     { ocMin, FT_FuncVar },
     458             :     { ocMax, FT_FuncVar },
     459             :     { ocVLookup, FT_FuncFix3 },
     460             :     { ocNPV, FT_FuncFix2 },
     461             :     { ocVar, FT_FuncVar },
     462             :     { ocNormDist, FT_FuncVar },
     463             :     { ocIRR, FT_FuncFix2 },
     464             :     { ocHLookup, FT_FuncFix3 },
     465             :     { ocDBSum, FT_FuncFix3 },
     466             :     { ocDBAverage, FT_FuncFix3 },
     467             :     { ocDBCount, FT_FuncFix3 },
     468             :     { ocDBMin, FT_FuncFix3 },
     469             :     { ocDBMax, FT_FuncFix3 },
     470             :     { ocDBVar, FT_FuncFix3 },                 // 0x60
     471             :     { ocDBStdDev, FT_FuncFix3 },
     472             :     { ocNoName, FT_NotImpl },
     473             :     { ocColumns, FT_FuncFix1 },
     474             :     { ocRows, FT_FuncFix1 },
     475             :     { ocRept, FT_FuncFix2 },
     476             :     { ocUpper, FT_FuncFix1 },
     477             :     { ocLower, FT_FuncFix1 },
     478             :     { ocLeft, FT_FuncFix2 },
     479             :     { ocRight, FT_FuncFix2 },
     480             :     { ocReplace, FT_FuncFix4 },
     481             :     { ocPropper, FT_FuncFix1 },
     482             :     { ocCell, FT_FuncFix2 },
     483             :     { ocTrim, FT_FuncFix1 },
     484             :     { ocClean, FT_FuncFix1 },
     485             :     { ocNoName, FT_NotImpl },
     486             :     { ocNoName, FT_NotImpl },               // 0x70
     487             :     { ocExact, FT_FuncFix2 },
     488             :     { ocNoName, FT_NotImpl }, // Call()
     489             :     { ocIndirect, FT_FuncFix1 },
     490             :     { ocZGZ, FT_FuncFix3 }, // Interest
     491             :     { ocNoName, FT_NotImpl },
     492             :     { ocNoName, FT_NotImpl },
     493             :     { ocLIA, FT_FuncFix3 },
     494             :     { ocDIA, FT_FuncFix4 },
     495             :     { ocGDA, FT_FuncFix4 },
     496             :     { ocStDevP, FT_FuncVar },
     497             :     { ocVarP, FT_FuncVar },
     498             :     { ocDBStdDevP, FT_FuncVar },
     499             :     { ocDBVarP, FT_FuncVar },
     500             :     { ocBW, FT_FuncFix3 },  // QPro Pval
     501             :     { ocRMZ, FT_FuncFix5 }, // QPro Paymt
     502             :     { ocZW, FT_FuncFix3 },  // QPro Fval   // 0x80
     503             :     { ocZZR, FT_FuncFix5 },
     504             :     { ocZins, FT_FuncFix5 },
     505             :     { ocZinsZ, FT_FuncFix4 },
     506             :     { ocKapz, FT_FuncFix6 },
     507             :     { ocSumProduct, FT_FuncFix2 },
     508             :     { ocNoName, FT_NotImpl },
     509             :     { ocNoName, FT_NotImpl },
     510             :     { ocNoName, FT_NotImpl },
     511             :     { ocNoName, FT_NotImpl },
     512             :     { ocDeg, FT_FuncFix1 },
     513             :     { ocRad, FT_FuncFix1 },
     514             :     { ocNoName, FT_NotImpl },
     515             :     { ocNoName, FT_NotImpl },
     516             :     { ocGetActDate, FT_FuncFix0 },
     517             :     { ocNPV, FT_FuncFix2 },
     518             :     { ocNoName, FT_NotImpl },                // 0x90
     519             :     { ocNoName, FT_NotImpl },
     520             :     { ocNoName, FT_NOP },
     521             :     { ocNoName, FT_NOP }, // 147
     522             :     { ocNoName, FT_NOP }, // 148
     523             :     { ocNoName, FT_NOP }, // 149
     524             :     { ocNoName, FT_NOP }, // 150
     525             :     { ocNoName, FT_NOP }, // 151
     526             :     { ocNoName, FT_NOP }, // 152
     527             :     { ocNoName, FT_NOP }, // 153
     528             :     { ocTable, FT_FuncFix1 },
     529             :     { ocNoName, FT_NOP }, // 155 - opcodes do not represent any function.
     530             :     { ocNoName, FT_NOP }, // 156
     531             :     { ocIndex,  FT_FuncFix4 },
     532             :     { ocNoName, FT_NotImpl },
     533             :     { ocNoName, FT_NotImpl }, // Gives the property of the particular object
     534             :     { ocNoName, FT_NotImpl },  // Dynamic Data Exchange Link // 0x100
     535             :     { ocNoName, FT_NotImpl }   // gives properties of DOS menus
     536             : };
     537             : 
     538             : const int nIndexCount = sizeof( aFuncMap ) / sizeof( aFuncMap[ 0 ] );
     539             : 
     540           0 : DefTokenId QProToSc::IndexToToken( sal_uInt16 nIndex )
     541             : {
     542           0 :     if( nIndex < nIndexCount )
     543           0 :         return aFuncMap[ nIndex ].nToken;
     544           0 :     return ocNoName;
     545             : }
     546             : 
     547           0 : FUNC_TYPE QProToSc::IndexToType( sal_uInt8 nIndex )
     548             : {
     549           0 :     if( nIndex < nIndexCount )
     550           0 :         return aFuncMap[ nIndex ].nType;
     551           0 :     return FT_NotImpl;
     552             : }
     553             : 
     554           0 : DefTokenId QProToSc::IndexToDLLId( sal_uInt16 nIndex )
     555             : {
     556             :     DefTokenId eId;
     557           0 :     switch( nIndex )
     558             :     {
     559             :         case 0x0001:
     560           0 :             eId = ocAveDev;
     561           0 :             break;
     562             : 
     563             :         case 0x0024:
     564           0 :             eId = ocGCD;
     565           0 :             break;
     566             : 
     567             :         case 0x0025:
     568           0 :             eId = ocLCM;
     569           0 :             break;
     570             : 
     571             :         case 0x0027:
     572           0 :             eId = ocCeil;
     573           0 :             break;
     574             : 
     575             :         case 0x0028:
     576           0 :             eId = ocEven;
     577           0 :             break;
     578             : 
     579             :         case 0x0022:
     580           0 :             eId = ocFact;
     581           0 :             break;
     582             : 
     583             :         case 0x002a:
     584           0 :             eId = ocFloor;
     585           0 :             break;
     586             : 
     587             :         case 0x002d:
     588           0 :             eId = ocOdd;
     589           0 :             break;
     590             : 
     591             :         case 0x0006:
     592           0 :             eId = ocBetaDist;
     593           0 :             break;
     594             : 
     595             :         case 0x0008:
     596           0 :             eId = ocBetaInv;
     597           0 :             break;
     598             : 
     599             :         case 0x0010:
     600           0 :             eId = ocCovar;
     601           0 :             break;
     602             : 
     603             :         case 0x000b:
     604           0 :             eId = ocChiInv;
     605           0 :             break;
     606             : 
     607             :         case 0x003d:
     608           0 :             eId = ocLaufz;
     609           0 :             break;
     610             : 
     611             :         case 0x0019:
     612           0 :             eId = ocFInv;
     613           0 :             break;
     614             : 
     615             :         case 0x001a:
     616           0 :             eId = ocFisher;
     617           0 :             break;
     618             : 
     619             :         case 0x001b:
     620           0 :             eId = ocFisherInv;
     621           0 :             break;
     622             : 
     623             :         case 0x0030:
     624           0 :             eId = ocMedian;
     625           0 :             break;
     626             : 
     627             :         default:
     628           0 :             eId = ocNoName;
     629           0 :             break;
     630             :     }
     631           0 :     return eId;
     632             : }
     633             : 
     634           0 : const sal_Char* QProToSc::getString( sal_uInt8 nIndex )
     635             : {
     636           0 :     const sal_Char* pExtString = 0;
     637           0 :     switch( nIndex )
     638             :     {
     639             :         case 57:
     640           0 :             pExtString = "Pv";
     641           0 :             break;
     642             : 
     643             :         case 58:
     644           0 :             pExtString = "Fv";
     645           0 :             break;
     646             : 
     647             :         case 98:
     648           0 :             pExtString = "Index2D";
     649           0 :             break;
     650             : 
     651             :         case 111:
     652           0 :             pExtString = "S";
     653           0 :             break;
     654             : 
     655             :         case 112:
     656           0 :             pExtString = "N";
     657           0 :             break;
     658             : 
     659             :         case 114:
     660           0 :             pExtString = "CALL";
     661           0 :             break;
     662             : 
     663             :         case 117:
     664           0 :             pExtString = "TERM";
     665           0 :             break;
     666             : 
     667             :         case 118:
     668           0 :             pExtString = "CTERM";
     669           0 :             break;
     670             : 
     671             :         case 134:
     672           0 :             pExtString = "MEMAVAIL";
     673           0 :             break;
     674             : 
     675             :         case 135:
     676           0 :             pExtString = "MEMEMSAVAIL";
     677           0 :             break;
     678             : 
     679             :         case 136:
     680           0 :             pExtString = "FILEEXISTS";
     681           0 :             break;
     682             : 
     683             :         case 137:
     684           0 :             pExtString = "CURVALUE";
     685           0 :             break;
     686             : 
     687             :         case 140:
     688           0 :             pExtString = "HEX";
     689           0 :             break;
     690             : 
     691             :         case 141:
     692           0 :             pExtString = "NUM";
     693           0 :             break;
     694             : 
     695             :         case 145:
     696           0 :             pExtString = "VERSION";
     697           0 :             break;
     698             : 
     699             :         case 157:
     700           0 :             pExtString = "INDEX3D";
     701           0 :             break;
     702             : 
     703             :         case 158:
     704           0 :             pExtString = "CELLINDEX3D";
     705           0 :             break;
     706             : 
     707             :         case 159:
     708           0 :             pExtString = "PROPERTY";
     709           0 :             break;
     710             : 
     711             :         case 160:
     712           0 :             pExtString = "DDE";
     713           0 :             break;
     714             : 
     715             :         case 161:
     716           0 :             pExtString = "COMMAND";
     717           0 :             break;
     718             : 
     719             :         default:
     720           0 :             pExtString = NULL;
     721           0 :             break;
     722             :     }
     723           0 :     return pExtString;
     724             : }
     725             : 
     726             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10