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

Generated by: LCOV version 1.10