[Libreoffice-commits] core.git: sc/source

Andras Timar andras.timar at collabora.com
Mon Nov 24 07:05:55 PST 2014


 sc/source/filter/lotus/lotform.cxx |   46 ++++++++++++++++++++++++++++---------
 1 file changed, 35 insertions(+), 11 deletions(-)

New commits:
commit 70ae5bb4182a99c17da8eb32b36baec3e7a48723
Author: Andras Timar <andras.timar at collabora.com>
Date:   Mon Nov 24 16:04:20 2014 +0100

    import @TERM and @CTERM functions from Lotus 1-2-3 files (related: fdo#86241)
    
    Change-Id: I864ad87aa0455c323a5235fa1230d3f2ac3ffbb4

diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx
index 3e1fe49..7c6fc45 100644
--- a/sc/source/filter/lotus/lotform.cxx
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -137,6 +137,30 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nAnz, const sal_Char* pExtStri
             eParam[ 2 ] = n0Token;      //    -> 2. as Default
         }
             break;
+        case ocZZR:
+        {
+            OSL_ENSURE( nAnz == 3,
+                "*LotusToSc::DoFunc(): TERM() or CTERM() need 3 parameters!" );
+            nAnz = 4;
+            if ( OString(pExtString) == "TERM" )
+            {
+                // @TERM(pmt,int,fv) -> NPER(int,-pmt,pv=0,fv)
+                NegToken( eParam[ 2 ] );
+                eParam[ 3 ] = eParam[ 1 ];
+                eParam[ 1 ] = aPool.Store( 0.0 );
+            }
+            else //CTERM()
+            {
+                // @CTERM(int,fv,pv) -> NPER(int,pmt=0,-pv,fv)
+                NegToken( eParam[ 0 ] );
+                nMerk0 = eParam[ 1 ];
+                eParam[ 1 ] = eParam[ 0 ];
+                eParam[ 0 ] = nMerk0;
+                eParam[ 3 ] = eParam[ 2 ];
+                eParam[ 2 ] = aPool.Store( 0.0 );
+            }
+        }
+            break;
         default:;
     }
 
@@ -393,7 +417,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest,
 
         eType = ( pIndexToType )( nOc );
         eOc = ( pIndexToToken)( nOc );
-        if( eOc == ocNoName )
+        if( eOc == ocNoName || eOc == ocZZR )
             pExtName = GetAddInName( nOc );
 
         switch( eType )
@@ -742,8 +766,8 @@ FUNC_TYPE LotusToSc::IndexToType( sal_uInt8 nIndex )
         FT_NotImpl,         //  114 Call()
         FT_FuncFix1,        //  115 @@()
         FT_FuncFix3,        //  116 Rate()
-        FT_FuncFix1,        //  117 Term()
-        FT_FuncFix1,        //  118 Cterm()
+        FT_FuncFix3,        //  117 Term()
+        FT_FuncFix3,        //  118 Cterm()
         FT_FuncFix3,        //  119 Sln()
         FT_FuncFix4,        //  120 Syd(), Soy()
         FT_FuncFix4,        //  121 Ddb()
@@ -1006,8 +1030,8 @@ DefTokenId LotusToSc::IndexToToken( sal_uInt8 nIndex )
         ocNoName,           //  114 Call()
         ocIndirect,         //  115 @@()
         ocZins,             //  116 Rate()
-        ocNoName,           //  117 Term()
-        ocNoName,           //  118 Cterm()
+        ocZZR,              //  117 Term()
+        ocZZR,              //  118 Cterm()
         ocLIA,              //  119 Sln()
         ocDIA,              //  120 Syd(), Soy()
         ocGDA,              //  121 Ddb()
@@ -1271,8 +1295,8 @@ FUNC_TYPE LotusToSc::IndexToTypeWK123( sal_uInt8 nIndex )
         FT_NotImpl,         //  114 App                  <- change in name
         FT_FuncFix1,        //  115 @@()                 <- new
         FT_FuncFix3,        //  116 Rate()               <- new
-        FT_FuncFix3,        //  117 Term()               <- change in quantity
-        FT_FuncFix3,        //  118 Cterm()              <- change in quantity
+        FT_FuncFix3,        //  117 Term()
+        FT_FuncFix3,        //  118 Cterm()
         FT_FuncFix3,        //  119 Sln()                <- new
         FT_FuncFix4,        //  120 Syd()                <- new
         FT_FuncFix4,        //  121 Ddb()                <- new
@@ -1535,8 +1559,8 @@ DefTokenId LotusToSc::IndexToTokenWK123( sal_uInt8 nIndex )
         ocNoName,           //  114 Call()
         ocIndirect,         //  115 @@()
         ocZins,             //  116 Rate()
-        ocNoName,           //  117 Term()
-        ocNoName,           //  118 Cterm()
+        ocZZR,              //  117 Term()
+        ocZZR,              //  118 Cterm()
         ocLIA,              //  119 Sln()
         ocDIA,              //  120 Syd(), Soy()
         ocGDA,              //  121 Ddb()
@@ -1800,8 +1824,8 @@ const sal_Char* GetAddInName( const sal_uInt8 n )
         NULL,                       //  114 Call()
         NULL,                       //  115 @@()
         NULL,                       //  116 Rate()
-        "ANN",                      //  117 Term()
-        NULL,                       //  118 Cterm()
+        "TERM",                     //  117 Term()
+        "CTERM",                    //  118 Cterm()
         NULL,                       //  119 Sln()
         NULL,                       //  120 Syd(), Soy()
         NULL,                       //  121 Ddb()


More information about the Libreoffice-commits mailing list