Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi,

I have added the imaginary functions IMTAN, IMCOT, IMSEC, IMCSC, IMSINH, IMCOSH, IMCSCH, IMSECH in AOO. Those are defined in ODFF, but not implemented yet.

You find the original patch in https://issues.apache.org/ooo/show_bug.cgi?id=111609. It is integration in AOO trunk with revision r1348096.

I have now transformed it, so it is applicable to LibreOffice. If you like it, you can use it immediately, without waiting for an AOO release.

Kind regards
Regina

From d286084873ad34b35fce351f1e25e7c1e1bed4c4 Mon Sep 17 00:00:00 2001
From: Regina Henschel <rb.henschel@t-online.de>
Date: Sat, 9 Jun 2012 19:34:38 +0200
Subject: [PATCH] ODFF: implement missing imaginary functions [AOO i111609
 r1348096]

Change-Id: I04ce0b1fdf787c3d8b2301cd92400e54049494bf
---
 sc/inc/helpids.h                                   |    8 +
 sc/source/core/tool/addinhelpid.cxx                |    8 +
 sc/source/core/tool/odffmap.cxx                    |    9 +
 sc/util/hidother.src                               |    8 +
 .../idl/com/sun/star/sheet/addin/XAnalysis.idl     |   32 ++++
 scaddins/source/analysis/analysis.cxx              |   80 +++++++++
 scaddins/source/analysis/analysis.hrc              |   27 +++-
 scaddins/source/analysis/analysis.hxx              |    8 +
 scaddins/source/analysis/analysis.src              |  144 ++++++++++++++++
 scaddins/source/analysis/analysis_deffuncnames.src |   72 ++++++++
 scaddins/source/analysis/analysis_funcnames.src    |   40 +++++
 scaddins/source/analysis/analysishelper.cxx        |  172 +++++++++++++++++++-
 scaddins/source/analysis/analysishelper.hxx        |   13 ++-
 13 files changed, 608 insertions(+), 13 deletions(-)

diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 7c5955c..8f38a0b 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -387,6 +387,14 @@
 #define HID_AAI_FUNC_OCT2HEX                                    "SC_HID_AAI_FUNC_OCT2HEX"
 #define HID_AAI_FUNC_CONVERT                                    "SC_HID_AAI_FUNC_CONVERT"
 #define HID_AAI_FUNC_FACTDOUBLE                                 "SC_HID_AAI_FUNC_FACTDOUBLE"
+#define HID_AAI_FUNC_IMTAN                                      "SC_HID_AAI_FUNC_IMTAN"
+#define HID_AAI_FUNC_IMSEC                                      "SC_HID_AAI_FUNC_IMSEC"
+#define HID_AAI_FUNC_IMCSC                                      "SC_HID_AAI_FUNC_IMCSC"
+#define HID_AAI_FUNC_IMCOT                                      "SC_HID_AAI_FUNC_IMCOT"
+#define HID_AAI_FUNC_IMSINH                                     "SC_HID_AAI_FUNC_IMSINH"
+#define HID_AAI_FUNC_IMCOSH                                     "SC_HID_AAI_FUNC_IMCOSH"
+#define HID_AAI_FUNC_IMSECH                                     "SC_HID_AAI_FUNC_IMSECH"
+#define HID_AAI_FUNC_IMCSCH                                     "SC_HID_AAI_FUNC_IMCSCH"
 
 // DateFunc Addin Functions (max.20) -----------------------------------------
 #define HID_DAI_FUNC_DAYSINMONTH                                "SC_HID_DAI_FUNC_DAYSINMONTH"
diff --git a/sc/source/core/tool/addinhelpid.cxx b/sc/source/core/tool/addinhelpid.cxx
index 67bae51..0442b5a 100644
--- a/sc/source/core/tool/addinhelpid.cxx
+++ b/sc/source/core/tool/addinhelpid.cxx
@@ -91,6 +91,10 @@ const ScUnoAddInHelpId pAnalysisHelpIds[] =
     { "getImargument"               , HID_AAI_FUNC_IMARGUMENT       },
     { "getImconjugate"              , HID_AAI_FUNC_IMCONJUGATE      },
     { "getImcos"                    , HID_AAI_FUNC_IMCOS            },
+    { "getImcosh"                   , HID_AAI_FUNC_IMCOSH           },
+    { "getImcot"                    , HID_AAI_FUNC_IMCOT            },
+    { "getImcsc"                    , HID_AAI_FUNC_IMCSC            },
+    { "getImcsch"                   , HID_AAI_FUNC_IMCSCH           },
     { "getImdiv"                    , HID_AAI_FUNC_IMDIV            },
     { "getImexp"                    , HID_AAI_FUNC_IMEXP            },
     { "getImln"                     , HID_AAI_FUNC_IMLN             },
@@ -99,10 +103,14 @@ const ScUnoAddInHelpId pAnalysisHelpIds[] =
     { "getImpower"                  , HID_AAI_FUNC_IMPOWER          },
     { "getImproduct"                , HID_AAI_FUNC_IMPRODUCT        },
     { "getImreal"                   , HID_AAI_FUNC_IMREAL           },
+    { "getImsec"                    , HID_AAI_FUNC_IMSEC            },
+    { "getImsech"                   , HID_AAI_FUNC_IMSECH           },
     { "getImsin"                    , HID_AAI_FUNC_IMSIN            },
+    { "getImsinh"                   , HID_AAI_FUNC_IMSINH           },
     { "getImsqrt"                   , HID_AAI_FUNC_IMSQRT           },
     { "getImsub"                    , HID_AAI_FUNC_IMSUB            },
     { "getImsum"                    , HID_AAI_FUNC_IMSUM            },
+    { "getImtan"                    , HID_AAI_FUNC_IMTAN            },
     { "getIntrate"                  , HID_AAI_FUNC_INTRATE          },
     { "getIseven"                   , HID_AAI_FUNC_ISEVEN           },
     { "getIsodd"                    , HID_AAI_FUNC_ISODD            },
diff --git a/sc/source/core/tool/odffmap.cxx b/sc/source/core/tool/odffmap.cxx
index 2129da3..b61f8ad 100644
--- a/sc/source/core/tool/odffmap.cxx
+++ b/sc/source/core/tool/odffmap.cxx
@@ -95,6 +95,14 @@ ScCompiler::AddInMap ScCompiler::maAddInMap[] =
     { "IMSUB", "IMSUB", false, "com.sun.star.sheet.addin.Analysis.getImsub", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMSUB" },
     { "IMSUM", "IMSUM", false, "com.sun.star.sheet.addin.Analysis.getImsum", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMSUM" },
     { "IMSQRT", "IMSQRT", false, "com.sun.star.sheet.addin.Analysis.getImsqrt", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMSQRT" },
+    { "IMTAN", "IMTAN", false, "com.sun.star.sheet.addin.Analysis.getImtan", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMTAN" },
+    { "IMSEC", "IMSEC", false, "com.sun.star.sheet.addin.Analysis.getImsec", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMSEC" },
+    { "IMCSC", "IMCSC", false, "com.sun.star.sheet.addin.Analysis.getImcsc", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMCSC" },
+    { "IMCOT", "IMCOT", false, "com.sun.star.sheet.addin.Analysis.getImcot", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMCOT" },
+    { "IMSINH", "IMSINH", false, "com.sun.star.sheet.addin.Analysis.getImsinh", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMSINH" },
+    { "IMCOSH", "IMCOSH", false, "com.sun.star.sheet.addin.Analysis.getImcosh", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMCOSH" },
+    { "IMSECH", "IMSECH", false, "com.sun.star.sheet.addin.Analysis.getImsech", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMSECH" },
+    { "IMCSCH", "IMCSCH", false, "com.sun.star.sheet.addin.Analysis.getImcsch", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMCSCH" },
     { "COMPLEX", "COMPLEX", false, "com.sun.star.sheet.addin.Analysis.getComplex", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETCOMPLEX" },
     { "CONVERT", "CONVERT_ADD", false, "com.sun.star.sheet.addin.Analysis.getConvert", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETCONVERT" },
     { "AMORDEGRC", "AMORDEGRC", false, "com.sun.star.sheet.addin.Analysis.getAmordegrc", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETAMORDEGRC" },
@@ -134,6 +142,7 @@ ScCompiler::AddInMap ScCompiler::maAddInMap[] =
     { "COUPPCD", "COUPPCD", false, "com.sun.star.sheet.addin.Analysis.getCouppcd", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETCOUPPCD" },
     { "COUPNUM", "COUPNUM", false, "com.sun.star.sheet.addin.Analysis.getCoupnum", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETCOUPNUM" },
     { "FVSCHEDULE", "FVSCHEDULE", false, "com.sun.star.sheet.addin.Analysis.getFvschedule", 
"COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETFVSCHEDULE" },
+
 };
 
 const ScCompiler::AddInMap* ScCompiler::GetAddInMap()
diff --git a/sc/util/hidother.src b/sc/util/hidother.src
index 85d36f9..fc31e88 100644
--- a/sc/util/hidother.src
+++ b/sc/util/hidother.src
@@ -463,6 +463,14 @@ hidspecial HID_AAI_FUNC_IMSIN       { HelpID = HID_AAI_FUNC_IMSIN; };
 hidspecial HID_AAI_FUNC_IMSUB       { HelpID = HID_AAI_FUNC_IMSUB; };
 hidspecial HID_AAI_FUNC_IMSUM       { HelpID = HID_AAI_FUNC_IMSUM; };
 hidspecial HID_AAI_FUNC_IMSQRT      { HelpID = HID_AAI_FUNC_IMSQRT; };
+hidspecial HID_AAI_FUNC_IMTAN       { HelpID = HID_AAI_FUNC_IMTAN; };
+hidspecial HID_AAI_FUNC_IMSEC       { HelpID = HID_AAI_FUNC_IMSEC; };
+hidspecial HID_AAI_FUNC_IMCSC       { HelpID = HID_AAI_FUNC_IMCSC; };
+hidspecial HID_AAI_FUNC_IMCOT       { HelpID = HID_AAI_FUNC_IMCOT; };
+hidspecial HID_AAI_FUNC_IMSINH      { HelpID = HID_AAI_FUNC_IMSINH; };
+hidspecial HID_AAI_FUNC_IMCOSH      { HelpID = HID_AAI_FUNC_IMCOSH; };
+hidspecial HID_AAI_FUNC_IMSECH      { HelpID = HID_AAI_FUNC_IMSECH; };
+hidspecial HID_AAI_FUNC_IMCSCH      { HelpID = HID_AAI_FUNC_IMCSCH; };
 hidspecial HID_AAI_FUNC_COMPLEX     { HelpID = HID_AAI_FUNC_COMPLEX; };
 hidspecial HID_AAI_FUNC_OCT2BIN     { HelpID = HID_AAI_FUNC_OCT2BIN; };
 hidspecial HID_AAI_FUNC_OCT2DEZ     { HelpID = HID_AAI_FUNC_OCT2DEZ; };
diff --git a/scaddins/idl/com/sun/star/sheet/addin/XAnalysis.idl 
b/scaddins/idl/com/sun/star/sheet/addin/XAnalysis.idl
index 1cb0018..daae62b 100644
--- a/scaddins/idl/com/sun/star/sheet/addin/XAnalysis.idl
+++ b/scaddins/idl/com/sun/star/sheet/addin/XAnalysis.idl
@@ -321,6 +321,38 @@ module addin
         string getImsqrt( [in] string Num )
             raises( com::sun::star::lang::IllegalArgumentException );
 
+        /// imtan.
+        string getImtan( [in] string Num )
+            raises( com::sun::star::lang::IllegalArgumentException );
+
+        /// imsec.
+        string getImsec( [in] string Num)
+            raises( com::sun::star::lang::IllegalArgumentException );
+
+        /// imcsc.
+        string getImcsc( [in] string Num )
+            raises( com::sun::star::lang::IllegalArgumentException );
+
+        /// imcot.
+        string getImcot( [in] string Num )
+            raises( com::sun::star::lang::IllegalArgumentException );
+
+        /// imsinh.
+        string getImsinh( [in] string Num )
+            raises( com::sun::star::lang::IllegalArgumentException );
+
+        /// imcosh.
+        string getImcosh( [in] string Num )
+            raises( com::sun::star::lang::IllegalArgumentException );
+
+        /// imsech.
+        string getImsech( [in] string Num)
+            raises( com::sun::star::lang::IllegalArgumentException );
+
+        /// imcsch.
+        string getImcsch( [in] string Num )
+            raises( com::sun::star::lang::IllegalArgumentException );
+
         /// complex.
         string getComplex( [in] double Real, [in] double Imaginary, [in] any Suffix )
             raises( com::sun::star::lang::IllegalArgumentException );
diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx
index e62265f..2215f28 100644
--- a/scaddins/source/analysis/analysis.cxx
+++ b/scaddins/source/analysis/analysis.cxx
@@ -1215,6 +1215,86 @@ STRING SAL_CALL AnalysisAddIn::getImsqrt( const STRING& aNum ) 
THROWDEF_RTE_IAE
 }
 
 
+STRING SAL_CALL AnalysisAddIn::getImtan( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+    Complex     z( aNum );
+
+    z.Tan();
+
+    return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImsec( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+    Complex     z( aNum );
+
+    z.Sec();
+
+    return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImcsc( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+    Complex     z( aNum );
+
+    z.Csc();
+
+    return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImcot( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+    Complex     z( aNum );
+
+    z.Cot();
+
+    return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImsinh( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+    Complex     z( aNum );
+
+    z.Sinh();
+
+    return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImcosh( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+    Complex     z( aNum );
+
+    z.Cosh();
+
+    return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImsech( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+    Complex     z( aNum );
+
+    z.Sech();
+
+    return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImcsch( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+    Complex     z( aNum );
+
+    z.Csch();
+
+    return z.GetString();
+}
+
+
 STRING SAL_CALL AnalysisAddIn::getComplex( double fR, double fI, const ANY& rSuff ) 
THROWDEF_RTE_IAE
 {
     sal_Bool    bi;
diff --git a/scaddins/source/analysis/analysis.hrc b/scaddins/source/analysis/analysis.hrc
index 7b5b94f..d53eb1e 100644
--- a/scaddins/source/analysis/analysis.hrc
+++ b/scaddins/source/analysis/analysis.hrc
@@ -131,7 +131,14 @@
 #define ANALYSIS_Couppcd                    (ANALYSIS_FUNCDESC_START+90)
 #define ANALYSIS_Coupnum                    (ANALYSIS_FUNCDESC_START+91)
 #define ANALYSIS_Fvschedule                 (ANALYSIS_FUNCDESC_START+92)
-
+#define ANALYSIS_Imtan                      (ANALYSIS_FUNCDESC_START+93)
+#define ANALYSIS_Imsec                      (ANALYSIS_FUNCDESC_START+94)
+#define ANALYSIS_Imcsc                      (ANALYSIS_FUNCDESC_START+95)
+#define ANALYSIS_Imcot                      (ANALYSIS_FUNCDESC_START+96)
+#define ANALYSIS_Imsinh                     (ANALYSIS_FUNCDESC_START+97)
+#define ANALYSIS_Imcosh                     (ANALYSIS_FUNCDESC_START+98)
+#define ANALYSIS_Imsech                     (ANALYSIS_FUNCDESC_START+99)
+#define ANALYSIS_Imcsch                     (ANALYSIS_FUNCDESC_START+100)
 
 #define ANALYSIS_FUNCNAME_START             (1)
 
@@ -228,7 +235,14 @@
 #define ANALYSIS_FUNCNAME_Couppcd           (ANALYSIS_FUNCNAME_START+90)
 #define ANALYSIS_FUNCNAME_Coupnum           (ANALYSIS_FUNCNAME_START+91)
 #define ANALYSIS_FUNCNAME_Fvschedule        (ANALYSIS_FUNCNAME_START+92)
-
+#define ANALYSIS_FUNCNAME_Imtan             (ANALYSIS_FUNCNAME_START+93)
+#define ANALYSIS_FUNCNAME_Imsec             (ANALYSIS_FUNCNAME_START+94)
+#define ANALYSIS_FUNCNAME_Imcsc             (ANALYSIS_FUNCNAME_START+95)
+#define ANALYSIS_FUNCNAME_Imcot             (ANALYSIS_FUNCNAME_START+96)
+#define ANALYSIS_FUNCNAME_Imsinh            (ANALYSIS_FUNCNAME_START+97)
+#define ANALYSIS_FUNCNAME_Imcosh            (ANALYSIS_FUNCNAME_START+98)
+#define ANALYSIS_FUNCNAME_Imsech            (ANALYSIS_FUNCNAME_START+99)
+#define ANALYSIS_FUNCNAME_Imcsch            (ANALYSIS_FUNCNAME_START+100)
 
 #define ANALYSIS_DEFFUNCNAME_START          (RID_ANALYSIS_DEFFUNCTION_NAMES+1)
 
@@ -325,6 +339,13 @@
 #define ANALYSIS_DEFFUNCNAME_Couppcd        (ANALYSIS_DEFFUNCNAME_START+90)
 #define ANALYSIS_DEFFUNCNAME_Coupnum        (ANALYSIS_DEFFUNCNAME_START+91)
 #define ANALYSIS_DEFFUNCNAME_Fvschedule     (ANALYSIS_DEFFUNCNAME_START+92)
-
+#define ANALYSIS_DEFFUNCNAME_Imtan          (ANALYSIS_DEFFUNCNAME_START+93)
+#define ANALYSIS_DEFFUNCNAME_Imsec          (ANALYSIS_DEFFUNCNAME_START+94)
+#define ANALYSIS_DEFFUNCNAME_Imcsc          (ANALYSIS_DEFFUNCNAME_START+95)
+#define ANALYSIS_DEFFUNCNAME_Imcot          (ANALYSIS_DEFFUNCNAME_START+96)
+#define ANALYSIS_DEFFUNCNAME_Imsinh         (ANALYSIS_DEFFUNCNAME_START+97)
+#define ANALYSIS_DEFFUNCNAME_Imcosh         (ANALYSIS_DEFFUNCNAME_START+98)
+#define ANALYSIS_DEFFUNCNAME_Imsech         (ANALYSIS_DEFFUNCNAME_START+99)
+#define ANALYSIS_DEFFUNCNAME_Imcsch         (ANALYSIS_DEFFUNCNAME_START+100)
 
 #endif
diff --git a/scaddins/source/analysis/analysis.hxx b/scaddins/source/analysis/analysis.hxx
index 3e0fd4a..b6d58e6 100644
--- a/scaddins/source/analysis/analysis.hxx
+++ b/scaddins/source/analysis/analysis.hxx
@@ -193,6 +193,14 @@ public:
     virtual STRING SAL_CALL     getImsum( constREFXPS& xOpt, const SEQSEQ( STRING )& aNum1, const 
SEQ( ANY )& aFollowingPars ) THROWDEF_RTE_IAE;
 
     virtual STRING SAL_CALL     getImsqrt( const STRING& aNum ) THROWDEF_RTE_IAE;
+    virtual STRING SAL_CALL     getImtan( const STRING& aNum ) THROWDEF_RTE_IAE;
+    virtual STRING SAL_CALL     getImsec( const STRING& aNum ) THROWDEF_RTE_IAE;
+    virtual STRING SAL_CALL     getImcsc( const STRING& aNum ) THROWDEF_RTE_IAE;
+    virtual STRING SAL_CALL     getImcot( const STRING& aNum ) THROWDEF_RTE_IAE;
+    virtual STRING SAL_CALL     getImsinh( const STRING& aNum ) THROWDEF_RTE_IAE;
+    virtual STRING SAL_CALL     getImcosh( const STRING& aNum ) THROWDEF_RTE_IAE;
+    virtual STRING SAL_CALL     getImsech( const STRING& aNum ) THROWDEF_RTE_IAE;
+    virtual STRING SAL_CALL     getImcsch( const STRING& aNum ) THROWDEF_RTE_IAE;
     virtual STRING SAL_CALL     getComplex( double fReal, double fImaginary, const ANY& rSuffix ) 
THROWDEF_RTE_IAE;
 
     virtual double SAL_CALL     getConvert( double fVal, const STRING& aFromUnit, const STRING& 
aToUnit ) THROWDEF_RTE_IAE;
diff --git a/scaddins/source/analysis/analysis.src b/scaddins/source/analysis/analysis.src
index bdff7932..8e81e3e 100644
--- a/scaddins/source/analysis/analysis.src
+++ b/scaddins/source/analysis/analysis.src
@@ -1352,6 +1352,150 @@ Resource RID_ANALYSIS_FUNCTION_DESCRIPTIONS
 
     };
 
+    Resource ANALYSIS_Imtan
+    {
+        String 1    // description Imtan
+        {
+            Text [ en-US ] = "Returns the tangent of a complex number";
+        };
+
+        String 2 // name of parameter 1         Imtan
+        {
+            Text [ en-US ] = "Complex number";
+        };
+
+        String 3 // description of parameter 1  Imtan
+        {
+            Text [ en-US ] = "A complex number";
+        };
+    };
+
+    Resource ANALYSIS_Imsec
+    {
+        String 1    // description Imsec
+        {
+            Text [ en-US ] = "Returns the secant of a complex number";
+        };
+
+        String 2 // name of parameter 1         Imsec
+        {
+            Text [ en-US ] = "Complex number";
+        };
+
+        String 3 // description of parameter 1  Imsec
+        {
+            Text [ en-US ] = "A complex number";
+        };
+    };
+
+    Resource ANALYSIS_Imcsc
+    {
+        String 1    // description Imcsc
+        {
+            Text [ en-US ] = "Returns the cosecant of a complex number";
+        };
+
+        String 2 // name of parameter 1         Imcsc
+        {
+            Text [ en-US ] = "Complex number";
+        };
+
+        String 3 // description of parameter 1  Imcsc
+        {
+            Text [ en-US ] = "A complex number";
+        };
+    };
+
+    Resource ANALYSIS_Imcot
+    {
+        String 1    // description Imcot
+        {
+            Text [ en-US ] = "Returns the cotangent of a complex number";
+        };
+
+        String 2 // name of parameter 1         Imcot
+        {
+            Text [ en-US ] = "Complex number";
+        };
+
+        String 3 // description of parameter 1  Imcot
+        {
+            Text [ en-US ] = "A complex number";
+        };
+    };
+
+    Resource ANALYSIS_Imsinh
+    {
+        String 1    // description Imsinh
+        {
+            Text [ en-US ] = "Returns the hyperbolic sine of a complex number";
+        };
+
+        String 2 // name of parameter 1         Imsinh
+        {
+            Text [ en-US ] = "Complex number";
+        };
+
+        String 3 // description of parameter 1  Imsinh
+        {
+            Text [ en-US ] = "A complex number";
+        };
+    };
+
+    Resource ANALYSIS_Imcosh
+    {
+        String 1    // description Imcosh
+        {
+            Text [ en-US ] = "Returns the hyperbolic cosine of a complex number";
+        };
+
+        String 2 // name of parameter 1         Imcosh
+        {
+            Text [ en-US ] = "Complex number";
+        };
+
+        String 3 // description of parameter 1  Imcosh
+        {
+            Text [ en-US ] = "A complex number";
+        };
+    };
+
+    Resource ANALYSIS_Imsech
+    {
+        String 1    // description Imsech
+        {
+            Text [ en-US ] = "Returns the hyperbolic secant of a complex number";
+        };
+
+        String 2 // name of parameter 1         Imsech
+        {
+            Text [ en-US ] = "Complex number";
+        };
+
+        String 3 // description of parameter 1  Imsech
+        {
+            Text [ en-US ] = "A complex number";
+        };
+    };
+
+    Resource ANALYSIS_Imcsch
+    {
+        String 1    // description Imcsch
+        {
+            Text [ en-US ] = "Returns the hyperbolic cosecant of a complex number";
+        };
+
+        String 2 // name of parameter 1         Imcsch
+        {
+            Text [ en-US ] = "Complex number";
+        };
+
+        String 3 // description of parameter 1  Imcsch
+        {
+            Text [ en-US ] = "A complex number";
+        };
+    };
+
     Resource ANALYSIS_Complex
     {
         String 1    // description Complex
diff --git a/scaddins/source/analysis/analysis_deffuncnames.src 
b/scaddins/source/analysis/analysis_deffuncnames.src
index 2c67e2c..cff3b5d 100644
--- a/scaddins/source/analysis/analysis_deffuncnames.src
+++ b/scaddins/source/analysis/analysis_deffuncnames.src
@@ -813,6 +813,78 @@ Resource RID_ANALYSIS_DEFFUNCTION_NAMES
         };
     };
 
+    StringArray ANALYSIS_DEFFUNCNAME_Imtan
+    {
+        ItemList =
+        {
+            < "IMTAN"; >;
+            < "IMTAN"; >;
+        };
+    };
+
+    StringArray ANALYSIS_DEFFUNCNAME_Imsec
+    {
+        ItemList =
+        {
+            < "IMSEC"; >;
+            < "IMSEC"; >;
+        };
+    };
+
+    StringArray ANALYSIS_DEFFUNCNAME_Imcsc
+    {
+        ItemList =
+        {
+            < "IMCSC"; >;
+            < "IMCSC"; >;
+        };
+    };
+
+    StringArray ANALYSIS_DEFFUNCNAME_Imcot
+    {
+        ItemList =
+        {
+            < "IMCOT"; >;
+            < "IMCOT"; >;
+        };
+    };
+
+    StringArray ANALYSIS_DEFFUNCNAME_Imsinh
+    {
+        ItemList =
+        {
+            < "IMSINH"; >;
+            < "IMSINH"; >;
+        };
+    };
+
+    StringArray ANALYSIS_DEFFUNCNAME_Imcosh
+    {
+        ItemList =
+        {
+            < "IMCOSH"; >;
+            < "IMCOSH"; >;
+        };
+    };
+
+    StringArray ANALYSIS_DEFFUNCNAME_Imsech
+    {
+        ItemList =
+        {
+            < "IMSECH"; >;
+            < "IMSECH"; >;
+        };
+    };
+
+    StringArray ANALYSIS_DEFFUNCNAME_Imcsch
+    {
+        ItemList =
+        {
+            < "IMCSCH"; >;
+            < "IMCSCH"; >;
+        };
+    };
+
     StringArray ANALYSIS_DEFFUNCNAME_Complex
     {
         ItemList =
diff --git a/scaddins/source/analysis/analysis_funcnames.src 
b/scaddins/source/analysis/analysis_funcnames.src
index 47796f3..fea61a5 100644
--- a/scaddins/source/analysis/analysis_funcnames.src
+++ b/scaddins/source/analysis/analysis_funcnames.src
@@ -465,6 +465,46 @@ Resource RID_ANALYSIS_FUNCTION_NAMES
         Text [ en-US ] = "IMSQRT";
     };
 
+    String ANALYSIS_FUNCNAME_Imtan
+    {
+        Text [ en-US ] = "IMTAN";
+    };
+
+    String ANALYSIS_FUNCNAME_Imsec
+    {
+        Text [ en-US ] = "IMSEC";
+    };
+
+    String ANALYSIS_FUNCNAME_Imcsc
+    {
+        Text [ en-US ] = "IMCSC";
+    };
+
+    String ANALYSIS_FUNCNAME_Imcot
+    {
+        Text [ en-US ] = "IMCOT";
+    };
+
+    String ANALYSIS_FUNCNAME_Imsinh
+    {
+        Text [ en-US ] = "IMSINH";
+    };
+
+    String ANALYSIS_FUNCNAME_Imcosh
+    {
+        Text [ en-US ] = "IMCOSH";
+    };
+
+    String ANALYSIS_FUNCNAME_Imsech
+    {
+        Text [ en-US ] = "IMSECH";
+    };
+
+    String ANALYSIS_FUNCNAME_Imcsch
+    {
+        Text [ en-US ] = "IMCSCH";
+    };
+
     String ANALYSIS_FUNCNAME_Complex
     {
         Text [ en-US ] = "COMPLEX";
diff --git a/scaddins/source/analysis/analysishelper.cxx 
b/scaddins/source/analysis/analysishelper.cxx
index c2e17a8..a37632f 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -108,6 +108,14 @@ const FuncDataBase pFuncDatas[] =
     FUNCDATA( Imsub,            UNIQUE,     STDPAR,     2,          FDCat_Tech ),
     FUNCDATA( Imsqrt,           UNIQUE,     STDPAR,     1,          FDCat_Tech ),
     FUNCDATA( Imsum,            UNIQUE,     INTPAR,     1,          FDCat_Tech ),
+    FUNCDATA( Imtan,            UNIQUE,     STDPAR,     1,          FDCat_Tech ),
+    FUNCDATA( Imsec,            UNIQUE,     STDPAR,     1,          FDCat_Tech ),
+    FUNCDATA( Imcsc,            UNIQUE,     STDPAR,     1,          FDCat_Tech ),
+    FUNCDATA( Imcot,            UNIQUE,     STDPAR,     1,          FDCat_Tech ),
+    FUNCDATA( Imsinh,           UNIQUE,     STDPAR,     1,          FDCat_Tech ),
+    FUNCDATA( Imcosh,           UNIQUE,     STDPAR,     1,          FDCat_Tech ),
+    FUNCDATA( Imsech,           UNIQUE,     STDPAR,     1,          FDCat_Tech ),
+    FUNCDATA( Imcsch,           UNIQUE,     STDPAR,     1,          FDCat_Tech ),
     FUNCDATA( Complex,          UNIQUE,     STDPAR,     3,          FDCat_Tech ),
     FUNCDATA( Convert,          DOUBLE,     STDPAR,     3,          FDCat_Tech ),
     FUNCDATA( Amordegrc,        UNIQUE,     INTPAR,     7,          FDCat_Finance ),
@@ -1861,15 +1869,9 @@ void Complex::Sqrt( void )
 }
 
 
-inline sal_Bool SinOverflow( double f )
-{
-    return fabs( f ) >= 134217728;
-}
-
-
 void Complex::Sin( void ) THROWDEF_RTE_IAE
 {
-    if( SinOverflow( r ) )
+    if( !::rtl::math::isValidArcArg( r ) )
         THROW_IAE;
 
     if( i )
@@ -1887,7 +1889,7 @@ void Complex::Sin( void ) THROWDEF_RTE_IAE
 
 void Complex::Cos( void ) THROWDEF_RTE_IAE
 {
-    if( SinOverflow( r ) )
+       if( !::rtl::math::isValidArcArg( r ) )
         THROW_IAE;
 
     if( i )
@@ -1961,6 +1963,160 @@ void Complex::Log2( void ) THROWDEF_RTE_IAE
 }
 
 
+void Complex::Tan(void) THROWDEF_RTE_IAE
+{
+    if ( i )
+    {
+        if( !::rtl::math::isValidArcArg( 2.0 * r ) )
+            THROW_IAE;
+        double fScale =1.0 / ( cos( 2.0 * r ) + cosh( 2.0 * i ));
+        r = sin( 2.0 * r ) * fScale;
+        i = sinh( 2.0 * i ) * fScale;
+    }
+    else
+    {
+        if( !::rtl::math::isValidArcArg( r ) )
+            THROW_IAE;
+        r = tan( r );
+    }
+}
+
+
+void Complex::Sec( void ) THROWDEF_RTE_IAE
+{
+    if( i )
+    {
+        if( !::rtl::math::isValidArcArg( 2 * r ) )
+            THROW_IAE;
+        double fScale = 1.0 / (cosh( 2.0 * i) + cos ( 2.0 * r));
+        double  r_;
+        r_ = 2.0 * cos( r ) * cosh( i ) * fScale;
+        i = 2.0 * sin( r ) * sinh( i ) * fScale;
+        r = r_;
+    }
+    else
+    {
+        if( !::rtl::math::isValidArcArg( r ) )
+            THROW_IAE;
+        r = 1.0 / cos( r );
+    }
+}
+
+
+void Complex::Csc( void ) THROWDEF_RTE_IAE
+{
+    if( i )
+    {
+        if( !::rtl::math::isValidArcArg( 2 * r ) )
+            THROW_IAE;
+        double fScale = 1.0 / (cosh( 2.0 * i) - cos ( 2.0 * r));
+        double  r_;
+        r_ = 2.0 * sin( r ) * cosh( i ) * fScale;
+        i = -2.0 * cos( r ) * sinh( i ) * fScale;
+        r = r_;
+    }
+    else
+    {
+        if( !::rtl::math::isValidArcArg( r ) )
+            THROW_IAE;
+        r = 1.0 / sin( r );
+    }
+}
+
+
+void Complex::Cot(void) THROWDEF_RTE_IAE
+{
+    if ( i )
+    {
+        if( !::rtl::math::isValidArcArg( 2.0 * r ) )
+            THROW_IAE;
+        double fScale =1.0 / ( cosh( 2.0 * i ) - cos( 2.0 * r ) );
+        r = sin( 2.0 * r ) * fScale;
+        i = - ( sinh( 2.0 * i ) * fScale );
+    }
+    else
+    {
+        if( !::rtl::math::isValidArcArg( r ) )
+            THROW_IAE;
+        r = 1.0 / tan( r );
+    }
+}
+
+
+void Complex::Sinh( void ) THROWDEF_RTE_IAE
+{
+    if( !::rtl::math::isValidArcArg( r ) )
+        THROW_IAE;
+
+    if( i )
+    {
+        double r_;
+        r_ = sinh( r ) * cos( i );
+               i = cosh( r ) * sin( i );
+               r = r_;
+       }
+       else
+               r = sinh( r );
+}
+
+
+void Complex::Cosh( void ) THROWDEF_RTE_IAE
+{
+    if( !::rtl::math::isValidArcArg( r ) )
+        THROW_IAE;
+
+    if( i )
+    {
+        double r_;
+        r_ = cosh( r ) * cos( i );
+               i = sinh( r ) * sin( i );
+               r = r_;
+       }
+       else
+               r = cosh( r );
+}
+
+
+void Complex::Sech(void) THROWDEF_RTE_IAE
+{
+    if ( i )
+    {
+        if( !::rtl::math::isValidArcArg( 2.0 * r ) )
+            THROW_IAE;
+        double fScale =1.0 / ( cosh( 2.0 * r ) + cos( 2.0 * i ));
+        double r_;
+        r_ = 2.0 * cosh( 2.0 * r ) * cos( i ) * fScale;
+        i = - (2.0 * sinh( 2.0 * r ) * sin( i ) * fScale );
+        r = r_ ;
+    }
+    else
+    {
+        if( !::rtl::math::isValidArcArg( r ) )
+            THROW_IAE;
+        r = 1.0 / cosh( r );
+    }
+}
+
+
+void Complex::Csch(void) THROWDEF_RTE_IAE
+{
+    if ( i )
+    {
+        if( !::rtl::math::isValidArcArg( 2.0 * r ) )
+            THROW_IAE;
+        double fScale =1.0 / ( cosh( 2.0 * r ) - cos( 2.0 * i ));
+        double r_;
+        r_ = 2.0 * sinh( 2.0 * r ) * cos( i ) * fScale;
+        i = - ( 2.0 * cosh( 2.0 * r ) * sin( i ) * fScale );
+        r = r_ ;
+    }
+    else
+    {
+        if( !::rtl::math::isValidArcArg( r ) )
+            THROW_IAE;
+        r = 1.0 / sinh( r );
+    }
+}
 
 
 ComplexList::~ComplexList()
diff --git a/scaddins/source/analysis/analysishelper.hxx 
b/scaddins/source/analysis/analysishelper.hxx
index 136a6e3..2abfc0f 100644
--- a/scaddins/source/analysis/analysishelper.hxx
+++ b/scaddins/source/analysis/analysishelper.hxx
@@ -462,7 +462,7 @@ class Complex
     sal_Unicode             c;
 
 public:
-    inline                  Complex( double fReal, double fImag = 0.0, sal_Char cC = '\0' );
+    inline                  Complex( double fReal, double fImag = 0.0, sal_Unicode cC = '\0' );
                             Complex( const STRING& rComplexAsString ) THROWDEF_RTE_IAE;
 
     inline static sal_Bool  IsImagUnit( sal_Unicode c );
@@ -490,6 +490,15 @@ public:
     inline void             Mult( const Complex& rMult );
     inline void             Sub( const Complex& rMult );
     inline void             Add( const Complex& rAdd );
+    void                    Tan( void ) THROWDEF_RTE_IAE;
+    void                    Sec( void ) THROWDEF_RTE_IAE;
+    void                    Csc( void ) THROWDEF_RTE_IAE;
+    void                    Cot( void ) THROWDEF_RTE_IAE;
+    void                    Sinh( void ) THROWDEF_RTE_IAE;
+    void                    Cosh( void ) THROWDEF_RTE_IAE;
+    void                    Sech( void ) THROWDEF_RTE_IAE;
+    void                    Csch( void ) THROWDEF_RTE_IAE;
+
 };
 
 
@@ -807,7 +816,7 @@ inline const FuncData* FuncDataList::Get( sal_uInt32 n ) const
 }
 
 
-inline Complex::Complex( double fReal, double fImag, sal_Char cC ) :
+inline Complex::Complex( double fReal, double fImag, sal_Unicode cC ) :
         r( fReal ), i( fImag ), c( cC )
 {
 }
-- 
1.7.5.1


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.