summaryrefslogtreecommitdiff
path: root/scaddins
diff options
context:
space:
mode:
Diffstat (limited to 'scaddins')
-rw-r--r--scaddins/prj/build.lst4
-rw-r--r--scaddins/prj/d.lst9
-rw-r--r--scaddins/source/analysis/analysis.cxx1312
-rw-r--r--scaddins/source/analysis/analysis.hrc330
-rw-r--r--scaddins/source/analysis/analysis.hxx240
-rw-r--r--scaddins/source/analysis/analysis.src3604
-rw-r--r--scaddins/source/analysis/analysis_deffuncnames.src874
-rw-r--r--scaddins/source/analysis/analysis_funcnames.src548
-rw-r--r--scaddins/source/analysis/analysisadd.idl592
-rw-r--r--scaddins/source/analysis/analysisdefs.hxx53
-rw-r--r--scaddins/source/analysis/analysishelper.cxx2988
-rw-r--r--scaddins/source/analysis/analysishelper.hxx1105
-rw-r--r--scaddins/source/analysis/bessel.cxx415
-rw-r--r--scaddins/source/analysis/bessel.hxx59
-rw-r--r--scaddins/source/analysis/financial.cxx667
-rw-r--r--scaddins/source/analysis/makefile.mk134
-rw-r--r--scaddins/source/datefunc/dateadd.idl118
-rw-r--r--scaddins/source/datefunc/datefunc.cxx1000
-rw-r--r--scaddins/source/datefunc/datefunc.def7
-rw-r--r--scaddins/source/datefunc/datefunc.hrc75
-rw-r--r--scaddins/source/datefunc/datefunc.hxx428
-rw-r--r--scaddins/source/datefunc/datefunc.src348
-rw-r--r--scaddins/source/datefunc/makefile.mk121
-rw-r--r--scaddins/source/datefunc/msdev.mk116
24 files changed, 15147 insertions, 0 deletions
diff --git a/scaddins/prj/build.lst b/scaddins/prj/build.lst
new file mode 100644
index 000000000000..c2ade63c0b5d
--- /dev/null
+++ b/scaddins/prj/build.lst
@@ -0,0 +1,4 @@
+ca scaddins : l10n vcl NULL
+ca scaddins usr1 - all sc_mkout NULL
+ca scaddins\source\datefunc nmake - all sc_dfunc NULL
+ca scaddins\source\analysis nmake - all sc_analysis NULL
diff --git a/scaddins/prj/d.lst b/scaddins/prj/d.lst
new file mode 100644
index 000000000000..f31644cf5e8c
--- /dev/null
+++ b/scaddins/prj/d.lst
@@ -0,0 +1,9 @@
+mkdir: %COMMON_DEST%\bin%_EXT%\hid
+..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
+..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.jar
+..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
+..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
+..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
+..\%__SRC%\bin\*.bin %_DEST%\bin%_EXT%\*.bin
+..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx
new file mode 100644
index 000000000000..bbc58ed27c9c
--- /dev/null
+++ b/scaddins/source/analysis/analysis.cxx
@@ -0,0 +1,1312 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "analysis.hxx"
+
+#include <cppuhelper/factory.hxx>
+#include <osl/diagnose.h>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+#include <string.h>
+
+#include <tools/resmgr.hxx>
+#include <tools/rcid.h>
+#include "analysis.hrc"
+#include "bessel.hxx"
+
+#define ADDIN_SERVICE "com.sun.star.sheet.AddIn"
+#define MY_SERVICE "com.sun.star.sheet.addin.Analysis"
+#define MY_IMPLNAME "com.sun.star.sheet.addin.AnalysisImpl"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+//------------------------------------------------------------------
+//
+// entry points for service registration / instantiation
+//
+//------------------------------------------------------------------
+
+extern "C" {
+
+
+void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** /*ppEnv*/ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+
+sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, registry::XRegistryKey* pRegistryKey )
+{
+ if( pRegistryKey )
+ {
+ try
+ {
+ STRING aImpl = STRFROMASCII( "/" );
+ aImpl += AnalysisAddIn::getImplementationName_Static();
+ aImpl += STRFROMASCII( "/UNO/SERVICES" );
+
+ REF( registry::XRegistryKey ) xNewKey(
+ reinterpret_cast< registry::XRegistryKey* >( pRegistryKey )->createKey( aImpl ) );
+
+ SEQ( STRING ) aSequ = AnalysisAddIn::getSupportedServiceNames_Static();
+ const STRING* pArray = aSequ.getConstArray();
+
+ for( sal_Int32 i = 0 ; i < aSequ.getLength() ; i++ )
+ xNewKey->createKey( pArray[ i ] );
+
+ return sal_True;
+ }
+ catch( registry::InvalidRegistryException& )
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+
+
+void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ )
+{
+ void* pRet = 0;
+
+ if( pServiceManager && STRING::createFromAscii( pImplName ) == AnalysisAddIn::getImplementationName_Static() )
+ {
+ REF( lang::XSingleServiceFactory ) xFactory( cppu::createOneInstanceFactory(
+ reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
+ AnalysisAddIn::getImplementationName_Static(),
+ AnalysisAddIn_CreateInstance,
+ AnalysisAddIn::getSupportedServiceNames_Static() ) );
+
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+
+
+} // extern C
+
+
+
+
+//------------------------------------------------------------------------
+//
+// "normal" service implementation
+//
+//------------------------------------------------------------------------
+
+
+ResMgr& AnalysisAddIn::GetResMgr( void ) THROWDEF_RTE
+{
+ if( !pResMgr )
+ {
+ InitData(); // try to get resource manager
+
+ if( !pResMgr )
+ THROW_RTE;
+ }
+
+ return *pResMgr;
+}
+
+
+STRING AnalysisAddIn::GetDisplFuncStr( sal_uInt16 nFuncNum ) THROWDEF_RTE
+{
+ return String( AnalysisRscStrLoader( RID_ANALYSIS_FUNCTION_NAMES, nFuncNum, GetResMgr() ).GetString() );
+}
+
+
+class AnalysisResourcePublisher : public Resource
+{
+public:
+ AnalysisResourcePublisher( const AnalysisResId& rId ) : Resource( rId ) {}
+ BOOL IsAvailableRes( const ResId& rId ) const { return Resource::IsAvailableRes( rId ); }
+ void FreeResource() { Resource::FreeResource(); }
+};
+
+
+class AnalysisFuncRes : public Resource
+{
+public:
+ AnalysisFuncRes( ResId& rRes, ResMgr& rResMgr, sal_uInt16 nInd, STRING& rRet );
+};
+
+
+AnalysisFuncRes::AnalysisFuncRes( ResId& rRes, ResMgr& rResMgr, sal_uInt16 nInd, STRING& rRet ) : Resource( rRes )
+{
+ rRet = String( AnalysisResId( nInd, rResMgr ) );
+
+ FreeResource();
+}
+
+
+STRING AnalysisAddIn::GetFuncDescrStr( sal_uInt16 nResId, sal_uInt16 nStrIndex ) THROWDEF_RTE
+{
+ STRING aRet;
+ AnalysisResourcePublisher aResPubl( AnalysisResId( RID_ANALYSIS_FUNCTION_DESCRIPTIONS, GetResMgr() ) );
+ AnalysisResId aRes( nResId, GetResMgr() );
+ aRes.SetRT( RSC_RESOURCE );
+ if( aResPubl.IsAvailableRes( aRes ) )
+ {
+ AnalysisFuncRes aSubRes( aRes, GetResMgr(), nStrIndex, aRet );
+ }
+
+ aResPubl.FreeResource();
+
+ return aRet;
+}
+
+
+void AnalysisAddIn::InitData( void )
+{
+ if( pResMgr )
+ delete pResMgr;
+
+ OString aModName( "analysis" );
+ pResMgr = ResMgr::CreateResMgr( ( const sal_Char* ) aModName,
+ aFuncLoc );
+
+ if( pFD )
+ delete pFD;
+
+ if( pResMgr )
+ pFD = new FuncDataList( *pResMgr );
+ else
+ pFD = NULL;
+
+ if( pDefLocales )
+ {
+ delete pDefLocales;
+ pDefLocales = NULL;
+ }
+}
+
+
+AnalysisAddIn::AnalysisAddIn( const uno::Reference< lang::XMultiServiceFactory >& xServiceFact ) :
+ pDefLocales( NULL ),
+ pFD( NULL ),
+ pFactDoubles( NULL ),
+ pCDL( NULL ),
+ pResMgr( NULL ),
+ aAnyConv( xServiceFact )
+{
+}
+
+
+AnalysisAddIn::~AnalysisAddIn()
+{
+ if( pFD )
+ delete pFD;
+
+ if( pFactDoubles )
+ delete[] pFactDoubles;
+
+ if( pCDL )
+ delete pCDL;
+
+// if( pResMgr ) no delete, because _all_ resource managers are deleted _before_ this dtor is called
+// delete pResMgr;
+
+ if( pDefLocales )
+ delete[] pDefLocales;
+}
+
+
+sal_Int32 AnalysisAddIn::getDateMode(
+ const uno::Reference< beans::XPropertySet >& xPropSet,
+ const uno::Any& rAny ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ sal_Int32 nMode = aAnyConv.getInt32( xPropSet, rAny, 0 );
+ if( (nMode < 0) || (nMode > 4) )
+ throw lang::IllegalArgumentException();
+ return nMode;
+}
+
+
+
+//-----------------------------------------------------------------------------
+
+
+#define MAXFACTDOUBLE 300
+
+double AnalysisAddIn::FactDouble( sal_Int32 nNum ) THROWDEF_RTE_IAE
+{
+ if( nNum < 0 || nNum > MAXFACTDOUBLE )
+ THROW_IAE;
+
+ if( !pFactDoubles )
+ {
+ pFactDoubles = new double[ MAXFACTDOUBLE + 1 ];
+
+ pFactDoubles[ 0 ] = 1.0; // by default
+
+ double fOdd = 1.0;
+ double fEven = 2.0;
+
+ pFactDoubles[ 1 ] = fOdd;
+ pFactDoubles[ 2 ] = fEven;
+
+ sal_Bool bOdd = sal_True;
+
+ for( sal_uInt16 nCnt = 3 ; nCnt <= MAXFACTDOUBLE ; nCnt++ )
+ {
+ if( bOdd )
+ {
+ fOdd *= nCnt;
+ pFactDoubles[ nCnt ] = fOdd;
+ }
+ else
+ {
+ fEven *= nCnt;
+ pFactDoubles[ nCnt ] = fEven;
+ }
+
+ bOdd = !bOdd;
+
+ }
+ }
+
+ return pFactDoubles[ nNum ];
+}
+
+
+STRING AnalysisAddIn::getImplementationName_Static()
+{
+ return STRFROMASCII( MY_IMPLNAME );
+}
+
+
+SEQ( STRING ) AnalysisAddIn::getSupportedServiceNames_Static()
+{
+ SEQ( STRING ) aRet(2);
+ STRING* pArray = aRet.getArray();
+ pArray[0] = STRFROMASCII( ADDIN_SERVICE );
+ pArray[1] = STRFROMASCII( MY_SERVICE );
+ return aRet;
+}
+
+
+REF( uno::XInterface ) SAL_CALL AnalysisAddIn_CreateInstance(
+ const uno::Reference< lang::XMultiServiceFactory >& xServiceFact )
+{
+ static uno::Reference< uno::XInterface > xInst = (cppu::OWeakObject*) new AnalysisAddIn( xServiceFact );
+ return xInst;
+}
+
+
+// XServiceName
+
+STRING SAL_CALL AnalysisAddIn::getServiceName() THROWDEF_RTE
+{
+ // name of specific AddIn service
+ return STRFROMASCII( MY_SERVICE );
+}
+
+
+// XServiceInfo
+
+STRING SAL_CALL AnalysisAddIn::getImplementationName() THROWDEF_RTE
+{
+ return getImplementationName_Static();
+}
+
+
+sal_Bool SAL_CALL AnalysisAddIn::supportsService( const STRING& aName ) THROWDEF_RTE
+{
+ return aName.compareToAscii( ADDIN_SERVICE ) == 0 || aName.compareToAscii( MY_SERVICE ) == 0;
+}
+
+
+SEQ( STRING ) SAL_CALL AnalysisAddIn::getSupportedServiceNames() THROWDEF_RTE
+{
+ return getSupportedServiceNames_Static();
+}
+
+
+// XLocalizable
+
+void SAL_CALL AnalysisAddIn::setLocale( const lang::Locale& eLocale ) THROWDEF_RTE
+{
+ aFuncLoc = eLocale;
+
+ InitData(); // change of locale invalidates resources!
+}
+
+lang::Locale SAL_CALL AnalysisAddIn::getLocale() THROWDEF_RTE
+{
+ return aFuncLoc;
+}
+
+
+// XAddIn
+
+STRING SAL_CALL AnalysisAddIn::getProgrammaticFuntionName( const STRING& ) THROWDEF_RTE
+{
+ // not used by calc
+ // (but should be implemented for other uses of the AddIn service)
+
+ return STRING();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getDisplayFunctionName( const STRING& aProgrammaticName ) THROWDEF_RTE
+{
+ STRING aRet;
+
+ const FuncData* p = pFD->Get( aProgrammaticName );
+ if( p )
+ {
+ aRet = GetDisplFuncStr( p->GetUINameID() );
+ if( p->IsDouble() )
+ aRet += STRFROMANSI( "_ADD" );
+ }
+ else
+ {
+ aRet = STRFROMANSI( "UNKNOWNFUNC_" );
+ aRet += aProgrammaticName;
+ }
+
+ return aRet;
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getFunctionDescription( const STRING& aProgrammaticName ) THROWDEF_RTE
+{
+ STRING aRet;
+
+ const FuncData* p = pFD->Get( aProgrammaticName );
+ if( p )
+ aRet = GetFuncDescrStr( p->GetDescrID(), 1 );
+
+ return aRet;
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getDisplayArgumentName( const STRING& aName, sal_Int32 nArg ) THROWDEF_RTE
+{
+ STRING aRet;
+
+ const FuncData* p = pFD->Get( aName );
+ if( p && nArg <= 0xFFFF )
+ {
+ sal_uInt16 nStr = p->GetStrIndex( sal_uInt16( nArg ) );
+ if( nStr /*&& nStr < 4*/ )
+ aRet = GetFuncDescrStr( p->GetDescrID(), nStr );
+ else
+ aRet = STRFROMANSI( "internal" );
+ }
+
+ return aRet;
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getArgumentDescription( const STRING& aName, sal_Int32 nArg ) THROWDEF_RTE
+{
+ STRING aRet;
+
+ const FuncData* p = pFD->Get( aName );
+ if( p && nArg <= 0xFFFF )
+ {
+ sal_uInt16 nStr = p->GetStrIndex( sal_uInt16( nArg ) );
+ if( nStr /*&& nStr < 4*/ )
+ aRet = GetFuncDescrStr( p->GetDescrID(), nStr + 1 );
+ else
+ aRet = STRFROMANSI( "for internal use only" );
+ }
+
+ return aRet;
+}
+
+
+static const char* pDefCatName = "Add-In";
+
+
+STRING SAL_CALL AnalysisAddIn::getProgrammaticCategoryName( const STRING& aName ) THROWDEF_RTE
+{
+ // return non-translated strings
+// return STRFROMASCII( "Add-In" );
+ const FuncData* p = pFD->Get( aName );
+ STRING aRet;
+ if( p )
+ {
+ const sal_Char* pStr;
+
+ switch( p->GetCategory() )
+ {
+ case FDCat_DateTime: pStr = "Date&Time"; break;
+ case FDCat_Finance: pStr = "Financial"; break;
+ case FDCat_Inf: pStr = "Information"; break;
+ case FDCat_Math: pStr = "Mathematical"; break;
+ case FDCat_Tech: pStr = "Technical"; break;
+ default:
+ pStr = pDefCatName; break;
+ }
+
+ aRet = STRFROMASCII( pStr );
+ }
+ else
+ aRet = STRFROMASCII( pDefCatName );
+
+ return aRet;
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getDisplayCategoryName( const STRING& aProgrammaticFunctionName ) THROWDEF_RTE
+{
+ // return translated strings, not used for predefined categories
+// return STRFROMASCII( "Add-In" );
+ const FuncData* p = pFD->Get( aProgrammaticFunctionName );
+ STRING aRet;
+ if( p )
+ {
+ const sal_Char* pStr;
+
+ switch( p->GetCategory() )
+ {
+ case FDCat_DateTime: pStr = "Date&Time"; break;
+ case FDCat_Finance: pStr = "Financial"; break;
+ case FDCat_Inf: pStr = "Information"; break;
+ case FDCat_Math: pStr = "Mathematical"; break;
+ case FDCat_Tech: pStr = "Technical"; break;
+ default:
+ pStr = pDefCatName; break;
+ }
+
+ aRet = STRFROMASCII( pStr );
+ }
+ else
+ aRet = STRFROMASCII( pDefCatName );
+
+ return aRet;
+}
+
+
+static const sal_Char* pLang[] = { "de", "en" };
+static const sal_Char* pCoun[] = { "DE", "US" };
+static const sal_uInt32 nNumOfLoc = sizeof( pLang ) / sizeof( sal_Char* );
+
+
+void AnalysisAddIn::InitDefLocales( void )
+{
+ pDefLocales = new CSS::lang::Locale[ nNumOfLoc ];
+
+ for( sal_uInt32 n = 0 ; n < nNumOfLoc ; n++ )
+ {
+ pDefLocales[ n ].Language = STRING::createFromAscii( pLang[ n ] );
+ pDefLocales[ n ].Country = STRING::createFromAscii( pCoun[ n ] );
+ }
+}
+
+
+inline const CSS::lang::Locale& AnalysisAddIn::GetLocale( sal_uInt32 nInd )
+{
+ if( !pDefLocales )
+ InitDefLocales();
+
+ if( nInd < sizeof( pLang ) )
+ return pDefLocales[ nInd ];
+ else
+ return aFuncLoc;
+}
+
+
+SEQofLocName SAL_CALL AnalysisAddIn::getCompatibilityNames( const STRING& aProgrammaticName ) THROWDEF_RTE
+{
+ const FuncData* p = pFD->Get( aProgrammaticName );
+
+ if( !p )
+ return SEQofLocName( 0 );
+
+ const StringList& r = p->GetCompNameList();
+ sal_uInt32 nCount = r.Count();
+
+ SEQofLocName aRet( nCount );
+
+ CSS::sheet::LocalizedName* pArray = aRet.getArray();
+
+ for( sal_uInt32 n = 0 ; n < nCount ; n++ )
+ {
+ pArray[ n ] = CSS::sheet::LocalizedName( GetLocale( n ), *r.Get( n ) );
+ }
+
+ return aRet;
+}
+
+
+// XAnalysis
+
+/*double SAL_CALL AnalysisAddIn::get_Test( constREFXPS&,
+ sal_Int32 nMode, double f1, double f2, double f3 ) THROWDEF_RTE
+{
+ return _Test( nMode, f1, f2, f3 );
+}*/
+
+
+/**
+ * Workday
+ */
+
+sal_Int32 SAL_CALL AnalysisAddIn::getWorkday( constREFXPS& xOptions,
+ sal_Int32 nDate, sal_Int32 nDays, const ANY& aHDay ) THROWDEF_RTE_IAE
+{
+ if( !nDays )
+ return nDate;
+
+ sal_Int32 nNullDate = GetNullDate( xOptions );
+
+ SortedIndividualInt32List aSrtLst;
+
+ aSrtLst.InsertHolidayList( aAnyConv, xOptions, aHDay, nNullDate, sal_False );
+
+ sal_Int32 nActDate = nDate + nNullDate;
+
+ if( nDays > 0 )
+ {
+ if( GetDayOfWeek( nActDate ) == 5 )
+ // when starting on Saturday, assuming we're starting on Sunday to get the jump over the weekend
+ nActDate++;
+
+ while( nDays )
+ {
+ nActDate++;
+
+ if( GetDayOfWeek( nActDate ) < 5 )
+ {
+ if( !aSrtLst.Find( nActDate ) )
+ nDays--;
+ }
+ else
+ nActDate++; // jump over weekend
+ }
+ }
+ else
+ {
+ if( GetDayOfWeek( nActDate ) == 6 )
+ // when starting on Sunday, assuming we're starting on Saturday to get the jump over the weekend
+ nActDate--;
+
+ while( nDays )
+ {
+ nActDate--;
+
+ if( GetDayOfWeek( nActDate ) < 5 )
+ {
+ if( !aSrtLst.Find( nActDate ) )
+ nDays++;
+ }
+ else
+ nActDate--; // jump over weekend
+ }
+ }
+
+ return nActDate - nNullDate;
+}
+
+
+/**
+ * Yearfrac
+ */
+
+double SAL_CALL AnalysisAddIn::getYearfrac( constREFXPS& xOpt,
+ sal_Int32 nStartDate, sal_Int32 nEndDate, const ANY& rMode ) THROWDEF_RTE_IAE
+{
+ double fRet = GetYearFrac( xOpt, nStartDate, nEndDate, getDateMode( xOpt, rMode ) );
+ RETURN_FINITE( fRet );
+}
+
+
+sal_Int32 SAL_CALL AnalysisAddIn::getEdate( constREFXPS& xOpt, sal_Int32 nStartDate, sal_Int32 nMonths ) THROWDEF_RTE_IAE
+{
+ sal_Int32 nNullDate = GetNullDate( xOpt );
+ ScaDate aDate( nNullDate, nStartDate, 5 );
+ aDate.addMonths( nMonths );
+ return aDate.getDate( nNullDate );
+}
+
+
+sal_Int32 SAL_CALL AnalysisAddIn::getWeeknum( constREFXPS& xOpt, sal_Int32 nDate, sal_Int32 nMode ) THROWDEF_RTE_IAE
+{
+ nDate += GetNullDate( xOpt );
+
+ sal_uInt16 nDay, nMonth, nYear;
+ DaysToDate( nDate, nDay, nMonth, nYear );
+
+ sal_Int32 nFirstInYear = DateToDays( 1, 1, nYear );
+ sal_uInt16 nFirstDayInYear = GetDayOfWeek( nFirstInYear );
+
+ return ( nDate - nFirstInYear + ( ( nMode == 1 )? ( nFirstDayInYear + 1 ) % 7 : nFirstDayInYear ) ) / 7 + 1;
+}
+
+
+sal_Int32 SAL_CALL AnalysisAddIn::getEomonth( constREFXPS& xOpt, sal_Int32 nDate, sal_Int32 nMonths ) THROWDEF_RTE_IAE
+{
+ sal_Int32 nNullDate = GetNullDate( xOpt );
+ nDate += nNullDate;
+ sal_uInt16 nDay, nMonth, nYear;
+ DaysToDate( nDate, nDay, nMonth, nYear );
+
+ sal_Int32 nNewMonth = nMonth + nMonths;
+
+ if( nNewMonth > 12 )
+ {
+ nYear = sal::static_int_cast<sal_uInt16>( nYear + ( nNewMonth / 12 ) );
+ nNewMonth %= 12;
+ }
+ else if( nNewMonth < 1 )
+ {
+ nNewMonth = -nNewMonth;
+ nYear = sal::static_int_cast<sal_uInt16>( nYear - ( nNewMonth / 12 ) );
+ nYear--;
+ nNewMonth %= 12;
+ nNewMonth = 12 - nNewMonth;
+ }
+
+ return DateToDays( DaysInMonth( sal_uInt16( nNewMonth ), nYear ), sal_uInt16( nNewMonth ), nYear ) - nNullDate;
+}
+
+
+sal_Int32 SAL_CALL AnalysisAddIn::getNetworkdays( constREFXPS& xOpt,
+ sal_Int32 nStartDate, sal_Int32 nEndDate, const ANY& aHDay ) THROWDEF_RTE_IAE
+{
+ sal_Int32 nNullDate = GetNullDate( xOpt );
+
+ SortedIndividualInt32List aSrtLst;
+
+ aSrtLst.InsertHolidayList( aAnyConv, xOpt, aHDay, nNullDate, sal_False );
+
+ sal_Int32 nActDate = nStartDate + nNullDate;
+ sal_Int32 nStopDate = nEndDate + nNullDate;
+ sal_Int32 nCnt = 0;
+
+ if( nActDate <= nStopDate )
+ {
+ while( nActDate <= nStopDate )
+ {
+ if( GetDayOfWeek( nActDate ) < 5 && !aSrtLst.Find( nActDate ) )
+ nCnt++;
+
+ nActDate++;
+ }
+ }
+ else
+ {
+ while( nActDate >= nStopDate )
+ {
+ if( GetDayOfWeek( nActDate ) < 5 && !aSrtLst.Find( nActDate ) )
+ nCnt--;
+
+ nActDate--;
+ }
+ }
+
+ return nCnt;
+}
+
+
+sal_Int32 SAL_CALL AnalysisAddIn::getIseven( sal_Int32 nVal ) THROWDEF_RTE_IAE
+{
+ return ( nVal & 0x00000001 )? 0 : 1;
+}
+
+
+sal_Int32 SAL_CALL AnalysisAddIn::getIsodd( sal_Int32 nVal ) THROWDEF_RTE_IAE
+{
+ return ( nVal & 0x00000001 )? 1 : 0;
+}
+
+double SAL_CALL
+AnalysisAddIn::getMultinomial( constREFXPS& xOpt, const SEQSEQ( sal_Int32 )& aVLst,
+ const SEQ( uno::Any )& aOptVLst ) THROWDEF_RTE_IAE
+{
+ ScaDoubleListGE0 aValList;
+
+ aValList.Append( aVLst );
+ aValList.Append( aAnyConv, xOpt, aOptVLst );
+
+ if( aValList.Count() == 0 )
+ return 0.0;
+
+ sal_Int32 nZ = 0;
+ double fN = 1.0;
+
+ for( const double *p = aValList.First(); p; p = aValList.Next() )
+ {
+ double fInt = (*p >= 0.0) ? rtl::math::approxFloor( *p ) : rtl::math::approxCeil( *p );
+ if ( fInt < 0.0 || fInt > 170.0 )
+ THROW_IAE;
+ sal_Int32 n = static_cast< sal_Int32 >( fInt );
+ if( n > 0 )
+ {
+ nZ += n;
+ fN *= Fak( n );
+ }
+ }
+
+ if( nZ > 170 )
+ THROW_IAE;
+
+ double fRet = Fak( nZ ) / fN;
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getSeriessum( double fX, double fN, double fM, const SEQSEQ( double )& aCoeffList ) THROWDEF_RTE_IAE
+{
+ double fRet = 0.0;
+
+ // #i32269# 0^0 is undefined, Excel returns #NUM! error
+ if( fX == 0.0 && fN == 0 )
+ THROW_RTE;
+
+ if( fX != 0.0 )
+ {
+ sal_Int32 n1, n2;
+ sal_Int32 nE1 = aCoeffList.getLength();
+ sal_Int32 nE2;
+ //sal_Int32 nZ = 0;
+
+ for( n1 = 0 ; n1 < nE1 ; n1++ )
+ {
+ const SEQ( double )& rList = aCoeffList[ n1 ];
+ nE2 = rList.getLength();
+ const double* pList = rList.getConstArray();
+
+ for( n2 = 0 ; n2 < nE2 ; n2++ )
+ {
+ fRet += pList[ n2 ] * pow( fX, fN );
+
+ fN += fM;
+ }
+ }
+ }
+
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getQuotient( double fNum, double fDenom ) THROWDEF_RTE_IAE
+{
+ double fRet;
+ if( (fNum < 0) != (fDenom < 0) )
+ fRet = ::rtl::math::approxCeil( fNum / fDenom );
+ else
+ fRet = ::rtl::math::approxFloor( fNum / fDenom );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getMround( double fNum, double fMult ) THROWDEF_RTE_IAE
+{
+ if( fMult == 0.0 )
+ return fMult;
+
+ double fRet = fMult * ::rtl::math::round( fNum / fMult );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getSqrtpi( double fNum ) THROWDEF_RTE_IAE
+{
+ double fRet = sqrt( fNum * PI );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getRandbetween( double fMin, double fMax ) THROWDEF_RTE_IAE
+{
+ fMin = ::rtl::math::round( fMin, 0, rtl_math_RoundingMode_Up );
+ fMax = ::rtl::math::round( fMax, 0, rtl_math_RoundingMode_Up );
+ if( fMin > fMax )
+ THROW_IAE;
+
+ // fMax -> range
+ double fRet = fMax - fMin + 1.0;
+ fRet *= rand();
+ fRet /= (RAND_MAX + 1.0);
+ fRet += fMin;
+ fRet = floor( fRet ); // simple floor is sufficient here
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getGcd( constREFXPS& xOpt, const SEQSEQ( double )& aVLst, const SEQ( uno::Any )& aOptVLst ) THROWDEF_RTE_IAE
+{
+ ScaDoubleListGT0 aValList;
+
+ aValList.Append( aVLst );
+ aValList.Append( aAnyConv, xOpt, aOptVLst );
+
+ if( aValList.Count() == 0 )
+ return 0.0;
+
+ const double* p = aValList.First();
+ double f = *p;
+
+ p = aValList.Next();
+
+ while( p )
+ {
+ f = GetGcd( *p, f );
+ p = aValList.Next();
+ }
+
+ RETURN_FINITE( f );
+}
+
+
+double SAL_CALL AnalysisAddIn::getLcm( constREFXPS& xOpt, const SEQSEQ( double )& aVLst, const SEQ( uno::Any )& aOptVLst ) THROWDEF_RTE_IAE
+{
+ ScaDoubleListGE0 aValList;
+
+ aValList.Append( aVLst );
+ aValList.Append( aAnyConv, xOpt, aOptVLst );
+
+ if( aValList.Count() == 0 )
+ return 0.0;
+
+ const double* p = aValList.First();
+ double f = *p;
+
+ if( f == 0.0 )
+ return f;
+
+ p = aValList.Next();
+
+ while( p )
+ {
+ double fTmp = *p;
+ if( f == 0.0 )
+ return f;
+ else
+ f = fTmp * f / GetGcd( fTmp, f );
+ p = aValList.Next();
+ }
+
+ RETURN_FINITE( f );
+}
+
+
+double SAL_CALL AnalysisAddIn::getBesseli( double fNum, sal_Int32 nOrder ) THROWDEF_RTE_IAE
+{
+ double fRet = sca::analysis::BesselI( fNum, nOrder );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getBesselj( double fNum, sal_Int32 nOrder ) THROWDEF_RTE_IAE
+{
+ double fRet = sca::analysis::BesselJ( fNum, nOrder );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getBesselk( double fNum, sal_Int32 nOrder ) THROWDEF_RTE_IAE
+{
+ if( nOrder < 0 || fNum <= 0.0 )
+ THROW_IAE;
+
+ double fRet = sca::analysis::BesselK( fNum, nOrder );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getBessely( double fNum, sal_Int32 nOrder ) THROWDEF_RTE_IAE
+{
+ if( nOrder < 0 || fNum <= 0.0 )
+ THROW_IAE;
+
+// return yn( nOrder, fNum );
+ double fRet = sca::analysis::BesselY( fNum, nOrder );
+ RETURN_FINITE( fRet );
+}
+
+
+const double SCA_MAX2 = 511.0; // min. val for binary numbers (9 bits + sign)
+const double SCA_MIN2 = -SCA_MAX2-1.0; // min. val for binary numbers (9 bits + sign)
+const double SCA_MAX8 = 536870911.0; // max. val for octal numbers (29 bits + sign)
+const double SCA_MIN8 = -SCA_MAX8-1.0; // min. val for octal numbers (29 bits + sign)
+const double SCA_MAX16 = 549755813888.0; // max. val for hexadecimal numbers (39 bits + sign)
+const double SCA_MIN16 = -SCA_MAX16-1.0; // min. val for hexadecimal numbers (39 bits + sign)
+const sal_Int32 SCA_MAXPLACES = 10; // max. number of places
+
+
+STRING SAL_CALL AnalysisAddIn::getBin2Oct( constREFXPS& xOpt, const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE
+{
+ double fVal = ConvertToDec( aNum, 2, SCA_MAXPLACES );
+ sal_Int32 nPlaces = 0;
+ sal_Bool bUsePlaces = aAnyConv.getInt32( nPlaces, xOpt, rPlaces );
+ return ConvertFromDec( fVal, SCA_MIN8, SCA_MAX8, 8, nPlaces, SCA_MAXPLACES, bUsePlaces );
+}
+
+
+double SAL_CALL AnalysisAddIn::getBin2Dec( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ double fRet = ConvertToDec( aNum, 2, SCA_MAXPLACES );
+ RETURN_FINITE( fRet );
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getBin2Hex( constREFXPS& xOpt, const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE
+{
+ double fVal = ConvertToDec( aNum, 2, SCA_MAXPLACES );
+ sal_Int32 nPlaces = 0;
+ sal_Bool bUsePlaces = aAnyConv.getInt32( nPlaces, xOpt, rPlaces );
+ return ConvertFromDec( fVal, SCA_MIN16, SCA_MAX16, 16, nPlaces, SCA_MAXPLACES, bUsePlaces );
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getOct2Bin( constREFXPS& xOpt, const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE
+{
+ double fVal = ConvertToDec( aNum, 8, SCA_MAXPLACES );
+ sal_Int32 nPlaces = 0;
+ sal_Bool bUsePlaces = aAnyConv.getInt32( nPlaces, xOpt, rPlaces );
+ return ConvertFromDec( fVal, SCA_MIN2, SCA_MAX2, 2, nPlaces, SCA_MAXPLACES, bUsePlaces );
+}
+
+
+double SAL_CALL AnalysisAddIn::getOct2Dec( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ double fRet = ConvertToDec( aNum, 8, SCA_MAXPLACES );
+ RETURN_FINITE( fRet );
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getOct2Hex( constREFXPS& xOpt, const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE
+{
+ double fVal = ConvertToDec( aNum, 8, SCA_MAXPLACES );
+ sal_Int32 nPlaces = 0;
+ sal_Bool bUsePlaces = aAnyConv.getInt32( nPlaces, xOpt, rPlaces );
+ return ConvertFromDec( fVal, SCA_MIN16, SCA_MAX16, 16, nPlaces, SCA_MAXPLACES, bUsePlaces );
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getDec2Bin( constREFXPS& xOpt, sal_Int32 nNum, const ANY& rPlaces ) THROWDEF_RTE_IAE
+{
+ sal_Int32 nPlaces = 0;
+ sal_Bool bUsePlaces = aAnyConv.getInt32( nPlaces, xOpt, rPlaces );
+ return ConvertFromDec( nNum, SCA_MIN2, SCA_MAX2, 2, nPlaces, SCA_MAXPLACES, bUsePlaces );
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getDec2Oct( constREFXPS& xOpt, sal_Int32 nNum, const ANY& rPlaces ) THROWDEF_RTE_IAE
+{
+ sal_Int32 nPlaces = 0;
+ sal_Bool bUsePlaces = aAnyConv.getInt32( nPlaces, xOpt, rPlaces );
+ return ConvertFromDec( nNum, SCA_MIN8, SCA_MAX8, 8, nPlaces, SCA_MAXPLACES, bUsePlaces );
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getDec2Hex( constREFXPS& xOpt, double fNum, const ANY& rPlaces ) THROWDEF_RTE_IAE
+{
+ sal_Int32 nPlaces = 0;
+ sal_Bool bUsePlaces = aAnyConv.getInt32( nPlaces, xOpt, rPlaces );
+ return ConvertFromDec( fNum, SCA_MIN16, SCA_MAX16, 16, nPlaces, SCA_MAXPLACES, bUsePlaces );
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getHex2Bin( constREFXPS& xOpt, const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE
+{
+ double fVal = ConvertToDec( aNum, 16, SCA_MAXPLACES );
+ sal_Int32 nPlaces = 0;
+ sal_Bool bUsePlaces = aAnyConv.getInt32( nPlaces, xOpt, rPlaces );
+ return ConvertFromDec( fVal, SCA_MIN2, SCA_MAX2, 2, nPlaces, SCA_MAXPLACES, bUsePlaces );
+}
+
+
+double SAL_CALL AnalysisAddIn::getHex2Dec( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ double fRet = ConvertToDec( aNum, 16, SCA_MAXPLACES );
+ RETURN_FINITE( fRet );
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getHex2Oct( constREFXPS& xOpt, const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE
+{
+ double fVal = ConvertToDec( aNum, 16, SCA_MAXPLACES );
+ sal_Int32 nPlaces = 0;
+ sal_Bool bUsePlaces = aAnyConv.getInt32( nPlaces, xOpt, rPlaces );
+ return ConvertFromDec( fVal, SCA_MIN8, SCA_MAX8, 8, nPlaces, SCA_MAXPLACES, bUsePlaces );
+}
+
+
+sal_Int32 SAL_CALL AnalysisAddIn::getDelta( constREFXPS& xOpt, double fNum1, const ANY& rNum2 ) THROWDEF_RTE_IAE
+{
+ return fNum1 == aAnyConv.getDouble( xOpt, rNum2, 0.0 );
+}
+
+
+double SAL_CALL AnalysisAddIn::getErf( constREFXPS& xOpt, double fLL, const ANY& rUL ) THROWDEF_RTE_IAE
+{
+ double fUL, fRet;
+ sal_Bool bContainsValue = aAnyConv.getDouble( fUL, xOpt, rUL );
+
+ fRet = bContainsValue ? (Erf( fUL ) - Erf( fLL )) : Erf( fLL );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getErfc( double f ) THROWDEF_RTE_IAE
+{
+ double fRet = Erfc( f );
+ RETURN_FINITE( fRet );
+}
+
+
+sal_Int32 SAL_CALL AnalysisAddIn::getGestep( constREFXPS& xOpt, double fNum, const ANY& rStep ) THROWDEF_RTE_IAE
+{
+ return fNum >= aAnyConv.getDouble( xOpt, rStep, 0.0 );
+}
+
+
+double SAL_CALL AnalysisAddIn::getFactdouble( sal_Int32 nNum ) THROWDEF_RTE_IAE
+{
+ double fRet = FactDouble( nNum );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getImabs( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ double fRet = Complex( aNum ).Abs();
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getImaginary( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ double fRet = Complex( aNum ).Imag();
+ RETURN_FINITE( fRet );
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImpower( const STRING& aNum, double f ) THROWDEF_RTE_IAE
+{
+ Complex z( aNum );
+
+ z.Power( f );
+
+ return z.GetString();
+}
+
+
+double SAL_CALL AnalysisAddIn::getImargument( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ double fRet = Complex( aNum ).Arg();
+ RETURN_FINITE( fRet );
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImcos( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ Complex z( aNum );
+
+ z.Cos();
+
+ return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImdiv( const STRING& aDivid, const STRING& aDivis ) THROWDEF_RTE_IAE
+{
+ Complex z( aDivid );
+
+ z.Div( Complex( aDivis ) );
+
+ return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImexp( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ Complex z( aNum );
+
+ z.Exp();
+
+ return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImconjugate( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ Complex z( aNum );
+
+ z.Conjugate();
+
+ return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImln( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ Complex z( aNum );
+
+ z.Ln();
+
+ return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImlog10( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ Complex z( aNum );
+
+ z.Log10();
+
+ return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImlog2( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ Complex z( aNum );
+
+ z.Log2();
+
+ return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImproduct( constREFXPS&, const SEQSEQ( STRING )& aNum1, const SEQ( uno::Any )& aNL ) THROWDEF_RTE_IAE
+{
+ ComplexList z_list;
+
+ z_list.Append( aNum1, AH_IgnoreEmpty );
+ z_list.Append( aNL, AH_IgnoreEmpty );
+
+ const Complex* p = z_list.First();
+
+ if( !p )
+ return Complex( 0 ).GetString();
+
+ Complex z( *p );
+
+ for( p = z_list.Next() ; p ; p = z_list.Next() )
+ z.Mult( *p );
+
+ return z.GetString();
+}
+
+
+double SAL_CALL AnalysisAddIn::getImreal( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ double fRet = Complex( aNum ).Real();
+ RETURN_FINITE( fRet );
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImsin( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ Complex z( aNum );
+
+ z.Sin();
+
+ return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImsub( const STRING& aNum1, const STRING& aNum2 ) THROWDEF_RTE_IAE
+{
+ Complex z( aNum1 );
+
+ z.Sub( Complex( aNum2 ) );
+
+ return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImsum( constREFXPS&, const SEQSEQ( STRING )& aNum1, const SEQ( CSS::uno::Any )& aFollowingPars ) THROWDEF_RTE_IAE
+{
+ ComplexList z_list;
+
+ z_list.Append( aNum1, AH_IgnoreEmpty );
+ z_list.Append( aFollowingPars, AH_IgnoreEmpty );
+
+ const Complex* p = z_list.First();
+
+ if( !p )
+ return Complex( 0 ).GetString();
+
+ Complex z( *p );
+
+ for( p = z_list.Next() ; p ; p = z_list.Next() )
+ z.Add( *p );
+
+ return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getImsqrt( const STRING& aNum ) THROWDEF_RTE_IAE
+{
+ Complex z( aNum );
+
+// z.Power( 0.5 );
+ z.Sqrt();
+
+ return z.GetString();
+}
+
+
+STRING SAL_CALL AnalysisAddIn::getComplex( double fR, double fI, const ANY& rSuff ) THROWDEF_RTE_IAE
+{
+ sal_Bool bi;
+
+ switch( rSuff.getValueTypeClass() )
+ {
+ case uno::TypeClass_VOID:
+ bi = sal_True;
+ break;
+ case uno::TypeClass_STRING:
+ {
+ const STRING* pSuff = ( const STRING* ) rSuff.getValue();
+ bi = pSuff->compareToAscii( "i" ) == 0 || pSuff->getLength() == 0;
+ if( !bi && pSuff->compareToAscii( "j" ) != 0 )
+ THROW_IAE;
+ }
+ break;
+ default:
+ THROW_IAE;
+ }
+
+ return Complex( fR, fI, bi ? 'i' : 'j' ).GetString();
+}
+
+
+double SAL_CALL AnalysisAddIn::getConvert( double f, const STRING& aFU, const STRING& aTU ) THROWDEF_RTE_IAE
+{
+ if( !pCDL )
+ pCDL = new ConvertDataList();
+
+ double fRet = pCDL->Convert( f, aFU, aTU );
+ RETURN_FINITE( fRet );
+}
+
+
diff --git a/scaddins/source/analysis/analysis.hrc b/scaddins/source/analysis/analysis.hrc
new file mode 100644
index 000000000000..7b5b94ff178c
--- /dev/null
+++ b/scaddins/source/analysis/analysis.hrc
@@ -0,0 +1,330 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SCADDINS_ANALYSIS_HRC
+#define SCADDINS_ANALYSIS_HRC
+
+
+#define ANALYSIS_RESOURCE_START 1000
+
+
+#define RID_ANALYSIS_FUNCTION_DESCRIPTIONS (ANALYSIS_RESOURCE_START+1000)
+#define RID_ANALYSIS_FUNCTION_NAMES (ANALYSIS_RESOURCE_START+2000)
+#define RID_ANALYSIS_DEFFUNCTION_NAMES (ANALYSIS_RESOURCE_START+3000)
+
+#define ANALYSIS_FUNCDESC_START (ANALYSIS_RESOURCE_START)
+
+
+#define ANALYSIS_Workday (ANALYSIS_FUNCDESC_START)
+#define ANALYSIS_Yearfrac (ANALYSIS_FUNCDESC_START+1)
+#define ANALYSIS_Edate (ANALYSIS_FUNCDESC_START+2)
+#define ANALYSIS_Weeknum (ANALYSIS_FUNCDESC_START+3)
+#define ANALYSIS_Eomonth (ANALYSIS_FUNCDESC_START+4)
+#define ANALYSIS_Networkdays (ANALYSIS_FUNCDESC_START+5)
+#define ANALYSIS_Iseven (ANALYSIS_FUNCDESC_START+6)
+#define ANALYSIS_Isodd (ANALYSIS_FUNCDESC_START+7)
+#define ANALYSIS_Multinomial (ANALYSIS_FUNCDESC_START+8)
+#define ANALYSIS_Seriessum (ANALYSIS_FUNCDESC_START+9)
+#define ANALYSIS_Quotient (ANALYSIS_FUNCDESC_START+10)
+#define ANALYSIS_Mround (ANALYSIS_FUNCDESC_START+11)
+#define ANALYSIS_Sqrtpi (ANALYSIS_FUNCDESC_START+12)
+#define ANALYSIS_Randbetween (ANALYSIS_FUNCDESC_START+13)
+#define ANALYSIS_Gcd (ANALYSIS_FUNCDESC_START+14)
+#define ANALYSIS_Lcm (ANALYSIS_FUNCDESC_START+15)
+#define ANALYSIS_Besseli (ANALYSIS_FUNCDESC_START+16)
+#define ANALYSIS_Besselj (ANALYSIS_FUNCDESC_START+17)
+#define ANALYSIS_Besselk (ANALYSIS_FUNCDESC_START+18)
+#define ANALYSIS_Bessely (ANALYSIS_FUNCDESC_START+19)
+#define ANALYSIS_Bin2Oct (ANALYSIS_FUNCDESC_START+20)
+#define ANALYSIS_Bin2Dec (ANALYSIS_FUNCDESC_START+21)
+#define ANALYSIS_Bin2Hex (ANALYSIS_FUNCDESC_START+22)
+#define ANALYSIS_Oct2Bin (ANALYSIS_FUNCDESC_START+23)
+#define ANALYSIS_Oct2Dec (ANALYSIS_FUNCDESC_START+24)
+#define ANALYSIS_Oct2Hex (ANALYSIS_FUNCDESC_START+25)
+#define ANALYSIS_Dec2Bin (ANALYSIS_FUNCDESC_START+26)
+#define ANALYSIS_Dec2Hex (ANALYSIS_FUNCDESC_START+27)
+#define ANALYSIS_Dec2Oct (ANALYSIS_FUNCDESC_START+28)
+#define ANALYSIS_Hex2Bin (ANALYSIS_FUNCDESC_START+29)
+#define ANALYSIS_Hex2Dec (ANALYSIS_FUNCDESC_START+30)
+#define ANALYSIS_Hex2Oct (ANALYSIS_FUNCDESC_START+31)
+#define ANALYSIS_Delta (ANALYSIS_FUNCDESC_START+32)
+#define ANALYSIS_Erf (ANALYSIS_FUNCDESC_START+33)
+#define ANALYSIS_Erfc (ANALYSIS_FUNCDESC_START+34)
+#define ANALYSIS_Gestep (ANALYSIS_FUNCDESC_START+35)
+#define ANALYSIS_Factdouble (ANALYSIS_FUNCDESC_START+36)
+#define ANALYSIS_Imabs (ANALYSIS_FUNCDESC_START+37)
+#define ANALYSIS_Imaginary (ANALYSIS_FUNCDESC_START+38)
+#define ANALYSIS_Impower (ANALYSIS_FUNCDESC_START+39)
+#define ANALYSIS_Imargument (ANALYSIS_FUNCDESC_START+40)
+#define ANALYSIS_Imcos (ANALYSIS_FUNCDESC_START+41)
+#define ANALYSIS_Imdiv (ANALYSIS_FUNCDESC_START+42)
+#define ANALYSIS_Imexp (ANALYSIS_FUNCDESC_START+43)
+#define ANALYSIS_Imconjugate (ANALYSIS_FUNCDESC_START+44)
+#define ANALYSIS_Imln (ANALYSIS_FUNCDESC_START+45)
+#define ANALYSIS_Imlog10 (ANALYSIS_FUNCDESC_START+46)
+#define ANALYSIS_Imlog2 (ANALYSIS_FUNCDESC_START+47)
+#define ANALYSIS_Improduct (ANALYSIS_FUNCDESC_START+48)
+#define ANALYSIS_Imreal (ANALYSIS_FUNCDESC_START+49)
+#define ANALYSIS_Imsin (ANALYSIS_FUNCDESC_START+50)
+#define ANALYSIS_Imsub (ANALYSIS_FUNCDESC_START+51)
+#define ANALYSIS_Imsqrt (ANALYSIS_FUNCDESC_START+52)
+#define ANALYSIS_Imsum (ANALYSIS_FUNCDESC_START+53)
+#define ANALYSIS_Complex (ANALYSIS_FUNCDESC_START+54)
+#define ANALYSIS_Convert (ANALYSIS_FUNCDESC_START+55)
+#define ANALYSIS_Amordegrc (ANALYSIS_FUNCDESC_START+56)
+#define ANALYSIS_Amorlinc (ANALYSIS_FUNCDESC_START+57)
+#define ANALYSIS_Accrint (ANALYSIS_FUNCDESC_START+58)
+#define ANALYSIS_Accrintm (ANALYSIS_FUNCDESC_START+59)
+#define ANALYSIS_Received (ANALYSIS_FUNCDESC_START+60)
+#define ANALYSIS_Disc (ANALYSIS_FUNCDESC_START+61)
+#define ANALYSIS_Duration (ANALYSIS_FUNCDESC_START+62)
+#define ANALYSIS_Effect (ANALYSIS_FUNCDESC_START+63)
+#define ANALYSIS_Cumprinc (ANALYSIS_FUNCDESC_START+64)
+#define ANALYSIS_Cumipmt (ANALYSIS_FUNCDESC_START+65)
+#define ANALYSIS_Price (ANALYSIS_FUNCDESC_START+66)
+#define ANALYSIS_Pricedisc (ANALYSIS_FUNCDESC_START+67)
+#define ANALYSIS_Pricemat (ANALYSIS_FUNCDESC_START+68)
+#define ANALYSIS_Mduration (ANALYSIS_FUNCDESC_START+69)
+#define ANALYSIS_Nominal (ANALYSIS_FUNCDESC_START+70)
+#define ANALYSIS_Dollarfr (ANALYSIS_FUNCDESC_START+71)
+#define ANALYSIS_Dollarde (ANALYSIS_FUNCDESC_START+72)
+#define ANALYSIS_Yield (ANALYSIS_FUNCDESC_START+73)
+#define ANALYSIS_Yielddisc (ANALYSIS_FUNCDESC_START+74)
+#define ANALYSIS_Yieldmat (ANALYSIS_FUNCDESC_START+75)
+#define ANALYSIS_Tbilleq (ANALYSIS_FUNCDESC_START+76)
+#define ANALYSIS_Tbillprice (ANALYSIS_FUNCDESC_START+77)
+#define ANALYSIS_Tbillyield (ANALYSIS_FUNCDESC_START+78)
+#define ANALYSIS_Oddfprice (ANALYSIS_FUNCDESC_START+79)
+#define ANALYSIS_Oddfyield (ANALYSIS_FUNCDESC_START+80)
+#define ANALYSIS_Oddlprice (ANALYSIS_FUNCDESC_START+81)
+#define ANALYSIS_Oddlyield (ANALYSIS_FUNCDESC_START+82)
+#define ANALYSIS_Xirr (ANALYSIS_FUNCDESC_START+83)
+#define ANALYSIS_Xnpv (ANALYSIS_FUNCDESC_START+84)
+#define ANALYSIS_Intrate (ANALYSIS_FUNCDESC_START+85)
+#define ANALYSIS_Coupncd (ANALYSIS_FUNCDESC_START+86)
+#define ANALYSIS_Coupdays (ANALYSIS_FUNCDESC_START+87)
+#define ANALYSIS_Coupdaysnc (ANALYSIS_FUNCDESC_START+88)
+#define ANALYSIS_Coupdaybs (ANALYSIS_FUNCDESC_START+89)
+#define ANALYSIS_Couppcd (ANALYSIS_FUNCDESC_START+90)
+#define ANALYSIS_Coupnum (ANALYSIS_FUNCDESC_START+91)
+#define ANALYSIS_Fvschedule (ANALYSIS_FUNCDESC_START+92)
+
+
+#define ANALYSIS_FUNCNAME_START (1)
+
+#define ANALYSIS_FUNCNAME_Workday (ANALYSIS_FUNCNAME_START)
+#define ANALYSIS_FUNCNAME_Yearfrac (ANALYSIS_FUNCNAME_START+1)
+#define ANALYSIS_FUNCNAME_Edate (ANALYSIS_FUNCNAME_START+2)
+#define ANALYSIS_FUNCNAME_Weeknum (ANALYSIS_FUNCNAME_START+3)
+#define ANALYSIS_FUNCNAME_Eomonth (ANALYSIS_FUNCNAME_START+4)
+#define ANALYSIS_FUNCNAME_Networkdays (ANALYSIS_FUNCNAME_START+5)
+#define ANALYSIS_FUNCNAME_Iseven (ANALYSIS_FUNCNAME_START+6)
+#define ANALYSIS_FUNCNAME_Isodd (ANALYSIS_FUNCNAME_START+7)
+#define ANALYSIS_FUNCNAME_Multinomial (ANALYSIS_FUNCNAME_START+8)
+#define ANALYSIS_FUNCNAME_Seriessum (ANALYSIS_FUNCNAME_START+9)
+#define ANALYSIS_FUNCNAME_Quotient (ANALYSIS_FUNCNAME_START+10)
+#define ANALYSIS_FUNCNAME_Mround (ANALYSIS_FUNCNAME_START+11)
+#define ANALYSIS_FUNCNAME_Sqrtpi (ANALYSIS_FUNCNAME_START+12)
+#define ANALYSIS_FUNCNAME_Randbetween (ANALYSIS_FUNCNAME_START+13)
+#define ANALYSIS_FUNCNAME_Gcd (ANALYSIS_FUNCNAME_START+14)
+#define ANALYSIS_FUNCNAME_Lcm (ANALYSIS_FUNCNAME_START+15)
+#define ANALYSIS_FUNCNAME_Besseli (ANALYSIS_FUNCNAME_START+16)
+#define ANALYSIS_FUNCNAME_Besselj (ANALYSIS_FUNCNAME_START+17)
+#define ANALYSIS_FUNCNAME_Besselk (ANALYSIS_FUNCNAME_START+18)
+#define ANALYSIS_FUNCNAME_Bessely (ANALYSIS_FUNCNAME_START+19)
+#define ANALYSIS_FUNCNAME_Bin2Oct (ANALYSIS_FUNCNAME_START+20)
+#define ANALYSIS_FUNCNAME_Bin2Dec (ANALYSIS_FUNCNAME_START+21)
+#define ANALYSIS_FUNCNAME_Bin2Hex (ANALYSIS_FUNCNAME_START+22)
+#define ANALYSIS_FUNCNAME_Oct2Bin (ANALYSIS_FUNCNAME_START+23)
+#define ANALYSIS_FUNCNAME_Oct2Dec (ANALYSIS_FUNCNAME_START+24)
+#define ANALYSIS_FUNCNAME_Oct2Hex (ANALYSIS_FUNCNAME_START+25)
+#define ANALYSIS_FUNCNAME_Dec2Bin (ANALYSIS_FUNCNAME_START+26)
+#define ANALYSIS_FUNCNAME_Dec2Hex (ANALYSIS_FUNCNAME_START+27)
+#define ANALYSIS_FUNCNAME_Dec2Oct (ANALYSIS_FUNCNAME_START+28)
+#define ANALYSIS_FUNCNAME_Hex2Bin (ANALYSIS_FUNCNAME_START+29)
+#define ANALYSIS_FUNCNAME_Hex2Dec (ANALYSIS_FUNCNAME_START+30)
+#define ANALYSIS_FUNCNAME_Hex2Oct (ANALYSIS_FUNCNAME_START+31)
+#define ANALYSIS_FUNCNAME_Delta (ANALYSIS_FUNCNAME_START+32)
+#define ANALYSIS_FUNCNAME_Erf (ANALYSIS_FUNCNAME_START+33)
+#define ANALYSIS_FUNCNAME_Erfc (ANALYSIS_FUNCNAME_START+34)
+#define ANALYSIS_FUNCNAME_Gestep (ANALYSIS_FUNCNAME_START+35)
+#define ANALYSIS_FUNCNAME_Factdouble (ANALYSIS_FUNCNAME_START+36)
+#define ANALYSIS_FUNCNAME_Imabs (ANALYSIS_FUNCNAME_START+37)
+#define ANALYSIS_FUNCNAME_Imaginary (ANALYSIS_FUNCNAME_START+38)
+#define ANALYSIS_FUNCNAME_Impower (ANALYSIS_FUNCNAME_START+39)
+#define ANALYSIS_FUNCNAME_Imargument (ANALYSIS_FUNCNAME_START+40)
+#define ANALYSIS_FUNCNAME_Imcos (ANALYSIS_FUNCNAME_START+41)
+#define ANALYSIS_FUNCNAME_Imdiv (ANALYSIS_FUNCNAME_START+42)
+#define ANALYSIS_FUNCNAME_Imexp (ANALYSIS_FUNCNAME_START+43)
+#define ANALYSIS_FUNCNAME_Imconjugate (ANALYSIS_FUNCNAME_START+44)
+#define ANALYSIS_FUNCNAME_Imln (ANALYSIS_FUNCNAME_START+45)
+#define ANALYSIS_FUNCNAME_Imlog10 (ANALYSIS_FUNCNAME_START+46)
+#define ANALYSIS_FUNCNAME_Imlog2 (ANALYSIS_FUNCNAME_START+47)
+#define ANALYSIS_FUNCNAME_Improduct (ANALYSIS_FUNCNAME_START+48)
+#define ANALYSIS_FUNCNAME_Imreal (ANALYSIS_FUNCNAME_START+49)
+#define ANALYSIS_FUNCNAME_Imsin (ANALYSIS_FUNCNAME_START+50)
+#define ANALYSIS_FUNCNAME_Imsub (ANALYSIS_FUNCNAME_START+51)
+#define ANALYSIS_FUNCNAME_Imsqrt (ANALYSIS_FUNCNAME_START+52)
+#define ANALYSIS_FUNCNAME_Imsum (ANALYSIS_FUNCNAME_START+53)
+#define ANALYSIS_FUNCNAME_Complex (ANALYSIS_FUNCNAME_START+54)
+#define ANALYSIS_FUNCNAME_Convert (ANALYSIS_FUNCNAME_START+55)
+#define ANALYSIS_FUNCNAME_Amordegrc (ANALYSIS_FUNCNAME_START+56)
+#define ANALYSIS_FUNCNAME_Amorlinc (ANALYSIS_FUNCNAME_START+57)
+#define ANALYSIS_FUNCNAME_Accrint (ANALYSIS_FUNCNAME_START+58)
+#define ANALYSIS_FUNCNAME_Accrintm (ANALYSIS_FUNCNAME_START+59)
+#define ANALYSIS_FUNCNAME_Received (ANALYSIS_FUNCNAME_START+60)
+#define ANALYSIS_FUNCNAME_Disc (ANALYSIS_FUNCNAME_START+61)
+#define ANALYSIS_FUNCNAME_Duration (ANALYSIS_FUNCNAME_START+62)
+#define ANALYSIS_FUNCNAME_Effect (ANALYSIS_FUNCNAME_START+63)
+#define ANALYSIS_FUNCNAME_Cumprinc (ANALYSIS_FUNCNAME_START+64)
+#define ANALYSIS_FUNCNAME_Cumipmt (ANALYSIS_FUNCNAME_START+65)
+#define ANALYSIS_FUNCNAME_Price (ANALYSIS_FUNCNAME_START+66)
+#define ANALYSIS_FUNCNAME_Pricedisc (ANALYSIS_FUNCNAME_START+67)
+#define ANALYSIS_FUNCNAME_Pricemat (ANALYSIS_FUNCNAME_START+68)
+#define ANALYSIS_FUNCNAME_Mduration (ANALYSIS_FUNCNAME_START+69)
+#define ANALYSIS_FUNCNAME_Nominal (ANALYSIS_FUNCNAME_START+70)
+#define ANALYSIS_FUNCNAME_Dollarfr (ANALYSIS_FUNCNAME_START+71)
+#define ANALYSIS_FUNCNAME_Dollarde (ANALYSIS_FUNCNAME_START+72)
+#define ANALYSIS_FUNCNAME_Yield (ANALYSIS_FUNCNAME_START+73)
+#define ANALYSIS_FUNCNAME_Yielddisc (ANALYSIS_FUNCNAME_START+74)
+#define ANALYSIS_FUNCNAME_Yieldmat (ANALYSIS_FUNCNAME_START+75)
+#define ANALYSIS_FUNCNAME_Tbilleq (ANALYSIS_FUNCNAME_START+76)
+#define ANALYSIS_FUNCNAME_Tbillprice (ANALYSIS_FUNCNAME_START+77)
+#define ANALYSIS_FUNCNAME_Tbillyield (ANALYSIS_FUNCNAME_START+78)
+#define ANALYSIS_FUNCNAME_Oddfprice (ANALYSIS_FUNCNAME_START+79)
+#define ANALYSIS_FUNCNAME_Oddfyield (ANALYSIS_FUNCNAME_START+80)
+#define ANALYSIS_FUNCNAME_Oddlprice (ANALYSIS_FUNCNAME_START+81)
+#define ANALYSIS_FUNCNAME_Oddlyield (ANALYSIS_FUNCNAME_START+82)
+#define ANALYSIS_FUNCNAME_Xirr (ANALYSIS_FUNCNAME_START+83)
+#define ANALYSIS_FUNCNAME_Xnpv (ANALYSIS_FUNCNAME_START+84)
+#define ANALYSIS_FUNCNAME_Intrate (ANALYSIS_FUNCNAME_START+85)
+#define ANALYSIS_FUNCNAME_Coupncd (ANALYSIS_FUNCNAME_START+86)
+#define ANALYSIS_FUNCNAME_Coupdays (ANALYSIS_FUNCNAME_START+87)
+#define ANALYSIS_FUNCNAME_Coupdaysnc (ANALYSIS_FUNCNAME_START+88)
+#define ANALYSIS_FUNCNAME_Coupdaybs (ANALYSIS_FUNCNAME_START+89)
+#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_DEFFUNCNAME_START (RID_ANALYSIS_DEFFUNCTION_NAMES+1)
+
+#define ANALYSIS_DEFFUNCNAME_Workday (ANALYSIS_DEFFUNCNAME_START)
+#define ANALYSIS_DEFFUNCNAME_Yearfrac (ANALYSIS_DEFFUNCNAME_START+1)
+#define ANALYSIS_DEFFUNCNAME_Edate (ANALYSIS_DEFFUNCNAME_START+2)
+#define ANALYSIS_DEFFUNCNAME_Weeknum (ANALYSIS_DEFFUNCNAME_START+3)
+#define ANALYSIS_DEFFUNCNAME_Eomonth (ANALYSIS_DEFFUNCNAME_START+4)
+#define ANALYSIS_DEFFUNCNAME_Networkdays (ANALYSIS_DEFFUNCNAME_START+5)
+#define ANALYSIS_DEFFUNCNAME_Iseven (ANALYSIS_DEFFUNCNAME_START+6)
+#define ANALYSIS_DEFFUNCNAME_Isodd (ANALYSIS_DEFFUNCNAME_START+7)
+#define ANALYSIS_DEFFUNCNAME_Multinomial (ANALYSIS_DEFFUNCNAME_START+8)
+#define ANALYSIS_DEFFUNCNAME_Seriessum (ANALYSIS_DEFFUNCNAME_START+9)
+#define ANALYSIS_DEFFUNCNAME_Quotient (ANALYSIS_DEFFUNCNAME_START+10)
+#define ANALYSIS_DEFFUNCNAME_Mround (ANALYSIS_DEFFUNCNAME_START+11)
+#define ANALYSIS_DEFFUNCNAME_Sqrtpi (ANALYSIS_DEFFUNCNAME_START+12)
+#define ANALYSIS_DEFFUNCNAME_Randbetween (ANALYSIS_DEFFUNCNAME_START+13)
+#define ANALYSIS_DEFFUNCNAME_Gcd (ANALYSIS_DEFFUNCNAME_START+14)
+#define ANALYSIS_DEFFUNCNAME_Lcm (ANALYSIS_DEFFUNCNAME_START+15)
+#define ANALYSIS_DEFFUNCNAME_Besseli (ANALYSIS_DEFFUNCNAME_START+16)
+#define ANALYSIS_DEFFUNCNAME_Besselj (ANALYSIS_DEFFUNCNAME_START+17)
+#define ANALYSIS_DEFFUNCNAME_Besselk (ANALYSIS_DEFFUNCNAME_START+18)
+#define ANALYSIS_DEFFUNCNAME_Bessely (ANALYSIS_DEFFUNCNAME_START+19)
+#define ANALYSIS_DEFFUNCNAME_Bin2Oct (ANALYSIS_DEFFUNCNAME_START+20)
+#define ANALYSIS_DEFFUNCNAME_Bin2Dec (ANALYSIS_DEFFUNCNAME_START+21)
+#define ANALYSIS_DEFFUNCNAME_Bin2Hex (ANALYSIS_DEFFUNCNAME_START+22)
+#define ANALYSIS_DEFFUNCNAME_Oct2Bin (ANALYSIS_DEFFUNCNAME_START+23)
+#define ANALYSIS_DEFFUNCNAME_Oct2Dec (ANALYSIS_DEFFUNCNAME_START+24)
+#define ANALYSIS_DEFFUNCNAME_Oct2Hex (ANALYSIS_DEFFUNCNAME_START+25)
+#define ANALYSIS_DEFFUNCNAME_Dec2Bin (ANALYSIS_DEFFUNCNAME_START+26)
+#define ANALYSIS_DEFFUNCNAME_Dec2Hex (ANALYSIS_DEFFUNCNAME_START+27)
+#define ANALYSIS_DEFFUNCNAME_Dec2Oct (ANALYSIS_DEFFUNCNAME_START+28)
+#define ANALYSIS_DEFFUNCNAME_Hex2Bin (ANALYSIS_DEFFUNCNAME_START+29)
+#define ANALYSIS_DEFFUNCNAME_Hex2Dec (ANALYSIS_DEFFUNCNAME_START+30)
+#define ANALYSIS_DEFFUNCNAME_Hex2Oct (ANALYSIS_DEFFUNCNAME_START+31)
+#define ANALYSIS_DEFFUNCNAME_Delta (ANALYSIS_DEFFUNCNAME_START+32)
+#define ANALYSIS_DEFFUNCNAME_Erf (ANALYSIS_DEFFUNCNAME_START+33)
+#define ANALYSIS_DEFFUNCNAME_Erfc (ANALYSIS_DEFFUNCNAME_START+34)
+#define ANALYSIS_DEFFUNCNAME_Gestep (ANALYSIS_DEFFUNCNAME_START+35)
+#define ANALYSIS_DEFFUNCNAME_Factdouble (ANALYSIS_DEFFUNCNAME_START+36)
+#define ANALYSIS_DEFFUNCNAME_Imabs (ANALYSIS_DEFFUNCNAME_START+37)
+#define ANALYSIS_DEFFUNCNAME_Imaginary (ANALYSIS_DEFFUNCNAME_START+38)
+#define ANALYSIS_DEFFUNCNAME_Impower (ANALYSIS_DEFFUNCNAME_START+39)
+#define ANALYSIS_DEFFUNCNAME_Imargument (ANALYSIS_DEFFUNCNAME_START+40)
+#define ANALYSIS_DEFFUNCNAME_Imcos (ANALYSIS_DEFFUNCNAME_START+41)
+#define ANALYSIS_DEFFUNCNAME_Imdiv (ANALYSIS_DEFFUNCNAME_START+42)
+#define ANALYSIS_DEFFUNCNAME_Imexp (ANALYSIS_DEFFUNCNAME_START+43)
+#define ANALYSIS_DEFFUNCNAME_Imconjugate (ANALYSIS_DEFFUNCNAME_START+44)
+#define ANALYSIS_DEFFUNCNAME_Imln (ANALYSIS_DEFFUNCNAME_START+45)
+#define ANALYSIS_DEFFUNCNAME_Imlog10 (ANALYSIS_DEFFUNCNAME_START+46)
+#define ANALYSIS_DEFFUNCNAME_Imlog2 (ANALYSIS_DEFFUNCNAME_START+47)
+#define ANALYSIS_DEFFUNCNAME_Improduct (ANALYSIS_DEFFUNCNAME_START+48)
+#define ANALYSIS_DEFFUNCNAME_Imreal (ANALYSIS_DEFFUNCNAME_START+49)
+#define ANALYSIS_DEFFUNCNAME_Imsin (ANALYSIS_DEFFUNCNAME_START+50)
+#define ANALYSIS_DEFFUNCNAME_Imsub (ANALYSIS_DEFFUNCNAME_START+51)
+#define ANALYSIS_DEFFUNCNAME_Imsqrt (ANALYSIS_DEFFUNCNAME_START+52)
+#define ANALYSIS_DEFFUNCNAME_Imsum (ANALYSIS_DEFFUNCNAME_START+53)
+#define ANALYSIS_DEFFUNCNAME_Complex (ANALYSIS_DEFFUNCNAME_START+54)
+#define ANALYSIS_DEFFUNCNAME_Convert (ANALYSIS_DEFFUNCNAME_START+55)
+#define ANALYSIS_DEFFUNCNAME_Amordegrc (ANALYSIS_DEFFUNCNAME_START+56)
+#define ANALYSIS_DEFFUNCNAME_Amorlinc (ANALYSIS_DEFFUNCNAME_START+57)
+#define ANALYSIS_DEFFUNCNAME_Accrint (ANALYSIS_DEFFUNCNAME_START+58)
+#define ANALYSIS_DEFFUNCNAME_Accrintm (ANALYSIS_DEFFUNCNAME_START+59)
+#define ANALYSIS_DEFFUNCNAME_Received (ANALYSIS_DEFFUNCNAME_START+60)
+#define ANALYSIS_DEFFUNCNAME_Disc (ANALYSIS_DEFFUNCNAME_START+61)
+#define ANALYSIS_DEFFUNCNAME_Duration (ANALYSIS_DEFFUNCNAME_START+62)
+#define ANALYSIS_DEFFUNCNAME_Effect (ANALYSIS_DEFFUNCNAME_START+63)
+#define ANALYSIS_DEFFUNCNAME_Cumprinc (ANALYSIS_DEFFUNCNAME_START+64)
+#define ANALYSIS_DEFFUNCNAME_Cumipmt (ANALYSIS_DEFFUNCNAME_START+65)
+#define ANALYSIS_DEFFUNCNAME_Price (ANALYSIS_DEFFUNCNAME_START+66)
+#define ANALYSIS_DEFFUNCNAME_Pricedisc (ANALYSIS_DEFFUNCNAME_START+67)
+#define ANALYSIS_DEFFUNCNAME_Pricemat (ANALYSIS_DEFFUNCNAME_START+68)
+#define ANALYSIS_DEFFUNCNAME_Mduration (ANALYSIS_DEFFUNCNAME_START+69)
+#define ANALYSIS_DEFFUNCNAME_Nominal (ANALYSIS_DEFFUNCNAME_START+70)
+#define ANALYSIS_DEFFUNCNAME_Dollarfr (ANALYSIS_DEFFUNCNAME_START+71)
+#define ANALYSIS_DEFFUNCNAME_Dollarde (ANALYSIS_DEFFUNCNAME_START+72)
+#define ANALYSIS_DEFFUNCNAME_Yield (ANALYSIS_DEFFUNCNAME_START+73)
+#define ANALYSIS_DEFFUNCNAME_Yielddisc (ANALYSIS_DEFFUNCNAME_START+74)
+#define ANALYSIS_DEFFUNCNAME_Yieldmat (ANALYSIS_DEFFUNCNAME_START+75)
+#define ANALYSIS_DEFFUNCNAME_Tbilleq (ANALYSIS_DEFFUNCNAME_START+76)
+#define ANALYSIS_DEFFUNCNAME_Tbillprice (ANALYSIS_DEFFUNCNAME_START+77)
+#define ANALYSIS_DEFFUNCNAME_Tbillyield (ANALYSIS_DEFFUNCNAME_START+78)
+#define ANALYSIS_DEFFUNCNAME_Oddfprice (ANALYSIS_DEFFUNCNAME_START+79)
+#define ANALYSIS_DEFFUNCNAME_Oddfyield (ANALYSIS_DEFFUNCNAME_START+80)
+#define ANALYSIS_DEFFUNCNAME_Oddlprice (ANALYSIS_DEFFUNCNAME_START+81)
+#define ANALYSIS_DEFFUNCNAME_Oddlyield (ANALYSIS_DEFFUNCNAME_START+82)
+#define ANALYSIS_DEFFUNCNAME_Xirr (ANALYSIS_DEFFUNCNAME_START+83)
+#define ANALYSIS_DEFFUNCNAME_Xnpv (ANALYSIS_DEFFUNCNAME_START+84)
+#define ANALYSIS_DEFFUNCNAME_Intrate (ANALYSIS_DEFFUNCNAME_START+85)
+#define ANALYSIS_DEFFUNCNAME_Coupncd (ANALYSIS_DEFFUNCNAME_START+86)
+#define ANALYSIS_DEFFUNCNAME_Coupdays (ANALYSIS_DEFFUNCNAME_START+87)
+#define ANALYSIS_DEFFUNCNAME_Coupdaysnc (ANALYSIS_DEFFUNCNAME_START+88)
+#define ANALYSIS_DEFFUNCNAME_Coupdaybs (ANALYSIS_DEFFUNCNAME_START+89)
+#define ANALYSIS_DEFFUNCNAME_Couppcd (ANALYSIS_DEFFUNCNAME_START+90)
+#define ANALYSIS_DEFFUNCNAME_Coupnum (ANALYSIS_DEFFUNCNAME_START+91)
+#define ANALYSIS_DEFFUNCNAME_Fvschedule (ANALYSIS_DEFFUNCNAME_START+92)
+
+
+#endif
diff --git a/scaddins/source/analysis/analysis.hxx b/scaddins/source/analysis/analysis.hxx
new file mode 100644
index 000000000000..fbf7dd012050
--- /dev/null
+++ b/scaddins/source/analysis/analysis.hxx
@@ -0,0 +1,240 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ANALYSIS_HXX
+#define ANALYSIS_HXX
+
+
+#include <com/sun/star/sheet/XAddIn.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sheet/addin/XAnalysis.hpp>
+#include <com/sun/star/sheet/LocalizedName.hpp>
+#include <com/sun/star/sheet/XCompatibilityNames.hpp>
+
+#include <cppuhelper/implbase5.hxx> // helper for implementations
+
+#include "analysisdefs.hxx"
+#include "analysishelper.hxx"
+
+
+class FuncData;
+class FuncDataList;
+class ConvertDataList;
+class ResMgr;
+
+
+REF( CSS::uno::XInterface ) SAL_CALL AnalysisAddIn_CreateInstance( const REF( CSS::lang::XMultiServiceFactory )& );
+
+
+class AnalysisAddIn : public cppu::WeakImplHelper5<
+ CSS::sheet::XAddIn,
+ CSS::sheet::XCompatibilityNames,
+ CSS::sheet::addin::XAnalysis,
+ CSS::lang::XServiceName,
+ CSS::lang::XServiceInfo >
+{
+private:
+ CSS::lang::Locale aFuncLoc;
+ CSS::lang::Locale* pDefLocales;
+ FuncDataList* pFD;
+ double* pFactDoubles;
+ ConvertDataList* pCDL;
+ ResMgr* pResMgr;
+
+ ScaAnyConverter aAnyConv;
+
+ ResMgr& GetResMgr( void ) THROWDEF_RTE;
+ STRING GetDisplFuncStr( sal_uInt16 nFuncNum ) THROWDEF_RTE;
+ STRING GetFuncDescrStr( sal_uInt16 nResId, sal_uInt16 nStrIndex ) THROWDEF_RTE;
+ void InitDefLocales( void );
+ inline const CSS::lang::Locale& GetLocale( sal_uInt32 nInd );
+ void InitData( void );
+
+ /// Converts an Any to sal_Int32 in the range from 0 to 4 (date calculation mode).
+ sal_Int32 getDateMode(
+ const CSS::uno::Reference< CSS::beans::XPropertySet >& xPropSet,
+ const CSS::uno::Any& rAny )
+ throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+
+public:
+ AnalysisAddIn(
+ const CSS::uno::Reference< CSS::lang::XMultiServiceFactory >& xServiceFact );
+ virtual ~AnalysisAddIn();
+
+ double FactDouble( sal_Int32 nNum ) THROWDEF_RTE_IAE;
+
+ static STRING getImplementationName_Static();
+ static SEQ( STRING ) getSupportedServiceNames_Static();
+
+ // XAddIn
+ virtual STRING SAL_CALL getProgrammaticFuntionName( const STRING& aDisplayName ) THROWDEF_RTE;
+ virtual STRING SAL_CALL getDisplayFunctionName( const STRING& aProgrammaticName ) THROWDEF_RTE;
+ virtual STRING SAL_CALL getFunctionDescription( const STRING& aProgrammaticName ) THROWDEF_RTE;
+ virtual STRING SAL_CALL getDisplayArgumentName( const STRING& aProgrammaticFunctionName, sal_Int32 nArgument ) THROWDEF_RTE;
+ virtual STRING SAL_CALL getArgumentDescription( const STRING& aProgrammaticFunctionName, sal_Int32 nArgument ) THROWDEF_RTE;
+ virtual STRING SAL_CALL getProgrammaticCategoryName( const STRING& aProgrammaticFunctionName ) THROWDEF_RTE;
+ virtual STRING SAL_CALL getDisplayCategoryName( const STRING& aProgrammaticFunctionName ) THROWDEF_RTE;
+
+ // XCompatibilityNames
+ virtual SEQofLocName SAL_CALL getCompatibilityNames( const STRING& aProgrammaticName ) THROWDEF_RTE;
+
+ // XLocalizable
+ virtual void SAL_CALL setLocale( const CSS::lang::Locale& eLocale ) THROWDEF_RTE;
+ virtual CSS::lang::Locale SAL_CALL getLocale( ) THROWDEF_RTE;
+
+ // XServiceName
+ virtual STRING SAL_CALL getServiceName( ) THROWDEF_RTE;
+
+ // XServiceInfo
+ virtual STRING SAL_CALL getImplementationName( ) THROWDEF_RTE;
+ virtual sal_Bool SAL_CALL supportsService( const STRING& ServiceName ) THROWDEF_RTE;
+ virtual SEQ( STRING ) SAL_CALL getSupportedServiceNames( ) THROWDEF_RTE;
+
+ // methods from own interfaces start here
+
+ // XAnalysis
+// virtual double SAL_CALL get_Test( constREFXPS&, sal_Int32 nMode, double f1, double f2, double f3 ) THROWDEF_RTE;
+
+ virtual sal_Int32 SAL_CALL getWorkday( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nDays, const ANY& aHDay ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getYearfrac( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nEndDate, const ANY& aMode ) THROWDEF_RTE_IAE;
+ virtual sal_Int32 SAL_CALL getEdate( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nMonths ) THROWDEF_RTE_IAE;
+ virtual sal_Int32 SAL_CALL getWeeknum( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nMode ) THROWDEF_RTE_IAE;
+ virtual sal_Int32 SAL_CALL getEomonth( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nMonths ) THROWDEF_RTE_IAE;
+ virtual sal_Int32 SAL_CALL getNetworkdays( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nEndDate, const ANY& aHDay ) THROWDEF_RTE_IAE;
+
+ virtual sal_Int32 SAL_CALL getIseven( sal_Int32 nVal ) THROWDEF_RTE_IAE;
+ virtual sal_Int32 SAL_CALL getIsodd( sal_Int32 nVal ) THROWDEF_RTE_IAE;
+
+ virtual double SAL_CALL getMultinomial( constREFXPS& xOpt, const SEQSEQ( sal_Int32 )& aVLst, const SEQ( com::sun::star::uno::Any )& aOptVLst ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getSeriessum( double fX, double fN, double fM, const SEQSEQ( double )& aCoeffList ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getQuotient( double fNum, double fDenum ) THROWDEF_RTE_IAE;
+
+ virtual double SAL_CALL getMround( double fNum, double fMult ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getSqrtpi( double fNum ) THROWDEF_RTE_IAE;
+
+ virtual double SAL_CALL getRandbetween( double fMin, double fMax ) THROWDEF_RTE_IAE;
+
+ virtual double SAL_CALL getGcd( constREFXPS& xOpt, const SEQSEQ( double )& aVLst, const SEQ( ANY )& aOptVLst ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getLcm( constREFXPS& xOpt, const SEQSEQ( double )& aVLst, const SEQ( ANY )& aOptVLst ) THROWDEF_RTE_IAE;
+
+ virtual double SAL_CALL getBesseli( double fNum, sal_Int32 nOrder ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getBesselj( double fNum, sal_Int32 nOrder ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getBesselk( double fNum, sal_Int32 nOrder ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getBessely( double fNum, sal_Int32 nOrder ) THROWDEF_RTE_IAE;
+
+ virtual STRING SAL_CALL getBin2Oct( constREFXPS& xOpt, const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getBin2Dec( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getBin2Hex( constREFXPS& xOpt, const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE;
+
+ virtual STRING SAL_CALL getOct2Bin( constREFXPS& xOpt, const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getOct2Dec( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getOct2Hex( constREFXPS& xOpt, const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE;
+
+ virtual STRING SAL_CALL getDec2Bin( constREFXPS& xOpt, sal_Int32 fNum, const ANY& rPlaces ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getDec2Oct( constREFXPS& xOpt, sal_Int32 fNum, const ANY& rPlaces ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getDec2Hex( constREFXPS& xOpt, double fNum, const ANY& rPlaces ) THROWDEF_RTE_IAE;
+
+ virtual STRING SAL_CALL getHex2Bin( constREFXPS& xOpt, const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getHex2Dec( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getHex2Oct( constREFXPS& xOpt, const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE;
+
+ virtual sal_Int32 SAL_CALL getDelta( constREFXPS& xOpt, double fNum1, const ANY& rNum2 ) THROWDEF_RTE_IAE;
+
+ virtual double SAL_CALL getErf( constREFXPS& xOpt, double fLowerLimit, const ANY& rUpperLimit ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getErfc( double fLowerLimit ) THROWDEF_RTE_IAE;
+
+ virtual sal_Int32 SAL_CALL getGestep( constREFXPS& xOpt, double fNum, const ANY& rStep ) THROWDEF_RTE_IAE;
+
+ virtual double SAL_CALL getFactdouble( sal_Int32 nNum ) THROWDEF_RTE_IAE;
+
+ virtual double SAL_CALL getImabs( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getImaginary( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getImpower( const STRING& aNum, double fPower ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getImargument( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getImcos( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getImdiv( const STRING& aDivident, const STRING& aDivisor ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getImexp( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getImconjugate( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getImln( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getImlog10( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getImlog2( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getImproduct( constREFXPS& xOpt, const SEQSEQ( STRING )& aNum1, const SEQ_ANY& aNumList ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getImreal( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getImsin( const STRING& aNum ) THROWDEF_RTE_IAE;
+ virtual STRING SAL_CALL getImsub( const STRING& aNum1, const STRING& aNum2 ) THROWDEF_RTE_IAE;
+ 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 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;
+
+ virtual double SAL_CALL getAmordegrc( constREFXPS&, double fCost, sal_Int32 nDate, sal_Int32 nFirstPer, double fRestVal, double fPer, double fRate, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getAmorlinc( constREFXPS&, double fCost, sal_Int32 nDate, sal_Int32 nFirstPer, double fRestVal, double fPer, double fRate, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getAccrint( constREFXPS& xOpt, sal_Int32 nIssue, sal_Int32 nFirstInter, sal_Int32 nSettle, double fRate, const ANY& rVal, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getAccrintm( constREFXPS& xOpt, sal_Int32 nIssue, sal_Int32 nSettle, double fRate, const ANY& rVal, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getReceived( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fInvest, double fDisc, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getDisc( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fPrice, double fRedemp, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getDuration( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fCoup, double fYield, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getEffect( double fNominal, sal_Int32 nPeriods ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getCumprinc( double fRate, sal_Int32 nNumPeriods, double fVal, sal_Int32 nStartPer, sal_Int32 nEndPer, sal_Int32 nPayType ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getCumipmt( double fRate, sal_Int32 nNumPeriods, double fVal, sal_Int32 nStartPer, sal_Int32 nEndPer, sal_Int32 nPayType ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getPrice( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fRate, double fYield, double fRedemp, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getPricedisc( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fDisc, double fRedemp, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getPricemat( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, double fRate, double fYield, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getMduration( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fCoup, double fYield, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getNominal( double fRate, sal_Int32 nPeriods ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getDollarfr( double fDollarDec, sal_Int32 nFrac ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getDollarde( double fDollarFrac, sal_Int32 nFrac ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getYield( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fCoup, double fPrice, double fRedemp, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getYielddisc( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fPrice, double fRedemp, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getYieldmat( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, double fRate, double fPrice, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getTbilleq( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fDisc ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getTbillprice( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fDisc ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getTbillyield( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fPrice ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getOddfprice( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, sal_Int32 nFirstCoup, double fRate, double fYield, double fRedemp, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getOddfyield( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, sal_Int32 nFirstCoup, double fRate, double fPrice, double fRedemp, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getOddlprice( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest, double fRate, double fYield, double fRedemp, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getOddlyield( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest, double fRate, double fPrice, double fRedemp, sal_Int32 nFreq, const ANY& rOptBase) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getXirr( constREFXPS& xOpt, const SEQSEQ( double )& rValues, const SEQSEQ( sal_Int32 )& rDates, const ANY& rGuess ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getXnpv( double fRate, const SEQSEQ( double )& rValues, const SEQSEQ( sal_Int32 )& rDates ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getIntrate( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fInvest, double fRedemp, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getCoupncd( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getCoupdays( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getCoupdaysnc( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getCoupdaybs( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getCouppcd( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getCoupnum( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE;
+ virtual double SAL_CALL getFvschedule( double fPrinc, const SEQSEQ( double )& rSchedule ) THROWDEF_RTE_IAE;
+};
+
+//------------------------------------------------------------------
+
+#endif
+
diff --git a/scaddins/source/analysis/analysis.src b/scaddins/source/analysis/analysis.src
new file mode 100644
index 000000000000..f513ca660734
--- /dev/null
+++ b/scaddins/source/analysis/analysis.src
@@ -0,0 +1,3604 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "analysis.hrc"
+
+
+Resource RID_ANALYSIS_FUNCTION_DESCRIPTIONS
+{
+ Resource ANALYSIS_Workday
+ {
+ String 1 // description Workday
+ {
+ Text [ en-US ] = "Returns the serial number of the date before or after a specified number of workdays";
+ };
+
+ String 2 // name of parameter 1 Workday
+ {
+ Text [ en-US ] = "Start date";
+ };
+
+ String 3 // description of parameter 1 Workday
+ {
+ Text [ en-US ] = "The start date";
+ };
+
+ String 4 // name of parameter 2 Workday
+ {
+ Text [ en-US ] = "Days";
+ };
+
+ String 5 // description of parameter 2 Workday
+ {
+ Text [ en-US ] = "The number of workdays before or after the start date";
+ };
+
+ String 6 // name of parameter 3 Workday
+ {
+ Text [ en-US ] = "Holidays";
+ };
+
+ String 7 // description of parameter 3 Workday
+ {
+ Text [ en-US ] = "List of date values of days off (vacation, holidays, etc.)";
+ };
+ };
+
+ Resource ANALYSIS_Yearfrac
+ {
+ String 1 // description Yearfrac
+ {
+ Text [ en-US ] = "Returns the number of whole days between 'start date' and 'end date' as a year fraction";
+ };
+
+ String 2 // name of parameter 1 Yearfrac
+ {
+ Text [ en-US ] = "Start date";
+ };
+
+ String 3 // description of parameter 1 Yearfrac
+ {
+ Text [ en-US ] = "The start date";
+ };
+
+ String 4 // name of parameter 2 Yearfrac
+ {
+ Text [ en-US ] = "End date";
+ };
+
+ String 5 // description of parameter 2 Yearfrac
+ {
+ Text [ en-US ] = "The end date";
+ };
+
+ String 6 // name of parameter 3 Yearfrac
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 7 // description of parameter 3 Yearfrac
+ {
+ Text [ en-US ] = "Basis for determining the interest days";
+ };
+ };
+
+ Resource ANALYSIS_Edate
+ {
+ String 1 // description Edate
+ {
+ Text [ en-US ] = "Returns the serial number of the date that is a specified number of months before or after the start date";
+ };
+
+ String 2 // name of parameter 1 Edate
+ {
+ Text [ en-US ] = "Start date";
+ };
+
+ String 3 // description of parameter 1 Edate
+ {
+ Text [ en-US ] = "The start date";
+ };
+
+ String 4 // name of parameter 2 Edate
+ {
+ Text [ en-US ] = "Months";
+ };
+
+ String 5 // description of parameter 2 Edate
+ {
+ Text [ en-US ] = "Number of months before or after the start date";
+ };
+ };
+
+ Resource ANALYSIS_Weeknum
+ {
+ String 1 // description Weeknum_add
+ {
+ Text [ en-US ] = "Returns the number of the calendar week in which the specified date occurs.";
+ };
+
+ String 2 // name of parameter 1 Weeknum_add
+ {
+ Text [ en-US ] = "Date";
+ };
+
+ String 3 // description of parameter 1 Weeknum_add
+ {
+ Text [ en-US ] = "The date";
+ };
+
+ String 4 // name of parameter 2 Weeknum_add
+ {
+ Text [ en-US ] = "Return type";
+ };
+
+ String 5 // description of parameter 2 Weeknum_add
+ {
+ Text [ en-US ] = "A number from 1 to 3 that specifies the day with which a week begins";
+ };
+ };
+
+ Resource ANALYSIS_Eomonth
+ {
+ String 1 // description EoMonth
+ {
+ Text[ en-US ] = "Returns the serial number of the last day of the month that comes a certain number of months before or after the start date";
+ };
+
+ String 2 // name of parameter 1 EoMonth
+ {
+ Text [ en-US ] = "Start date";
+ };
+
+ String 3 // description of parameter 1 EoMonth
+ {
+ Text [ en-US ] = "The start date";
+ };
+
+ String 4 // name of parameter 2 EoMonth
+ {
+ Text [ en-US ] = "Months";
+ };
+
+ String 5 // description of parameter 2 EoMonth
+ {
+ Text [ en-US ] = "Number of months before or after the start date";
+ };
+ };
+
+ Resource ANALYSIS_Networkdays
+ {
+ String 1 // description Networkdays
+ {
+ Text [ en-US ] = "Returns the number of workdays between two dates";
+ };
+
+ String 2 // name of parameter 1 Networkdays
+ {
+ Text [ en-US ] = "Start date";
+ };
+
+ String 3 // description of parameter 1 Networkdays
+ {
+ Text [ en-US ] = "The start date";
+ };
+
+ String 4 // name of parameter 2 Networkdays
+ {
+ Text [ en-US ] = "End date";
+ };
+
+ String 5 // description of parameter 2 Networkdays
+ {
+ Text [ en-US ] = "The end date";
+ };
+
+ String 6 // name of parameter 3 Networkdays
+ {
+ Text [ en-US ] = "Holidays";
+ };
+
+ String 7 // description of parameter 3 Networkdays
+ {
+ Text [ en-US ] = "List of date values representing days off (vacation, holidays, etc.)";
+ };
+ };
+
+ Resource ANALYSIS_Iseven
+ {
+ String 1 // description Iseven_add
+ {
+ Text [ en-US ] = "Returns the value 'true' if the number is even";
+ };
+
+ String 2 // name of parameter 1 Iseven_add
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Iseven_add
+ {
+ Text [ en-US ] = "The number";
+ };
+ };
+
+ Resource ANALYSIS_Isodd
+ {
+ String 1 // description Isodd_add
+ {
+ Text [ en-US ] = "Returns the value 'true' if the number is odd";
+ };
+
+ String 2 // name of parameter 1 Isodd_add
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Isodd_add
+ {
+ Text [ en-US ] = "The number";
+ };
+ };
+
+ Resource ANALYSIS_Multinomial
+ {
+ String 1 // description Multinomial
+ {
+ Text [ en-US ] = "Returns the multinomial coefficient of a set of numbers";
+ };
+
+ String 2 // name of parameter 1 Multinomial
+ {
+ Text [ en-US ] = "Number(s)";
+ };
+
+ String 3 // description of parameter 1 Multinomial
+ {
+ Text [ en-US ] = "Number or list of numbers for which you want the multinomial coefficient";
+ };
+ };
+
+ Resource ANALYSIS_Seriessum
+ {
+ String 1 // description Seriessum
+ {
+ Text [ en-US ] = "Returns the sum of a power series";
+ };
+
+ String 2 // name of parameter 1 Seriessum
+ {
+ Text [ en-US ] = "X";
+ };
+
+ String 3 // description of parameter 1 Seriessum
+ {
+ Text [ en-US ] = "The independent variable of the power series";
+ };
+
+ String 4 // name of parameter 2 Seriessum
+ {
+ Text [ en-US ] = "N";
+ };
+
+ String 5 // description of parameter 2 Seriessum
+ {
+ Text [ en-US ] = "The initial power to which x is to be raised";
+ };
+
+ String 6 // name of parameter 3 Seriessum
+ {
+ Text [ en-US ] = "M";
+ };
+
+ String 7 // description of parameter 3 Seriessum
+ {
+ Text [ en-US ] = "The increment by which to increase n for each term in the series";
+ };
+
+ String 8 // name of parameter 4 Seriessum
+ {
+ Text [ en-US ] = "Coefficients";
+ };
+
+ String 9 // description of parameter 4 Seriessum
+ {
+ Text [ en-US ] = "Set of coefficients by which each successive power of the variable x is multiplied";
+ };
+ };
+
+ Resource ANALYSIS_Quotient
+ {
+ String 1 // description Quotient
+ {
+ Text [ en-US ] = "Returns the integer portion of a division";
+ };
+
+ String 2 // name of parameter 1 Quotient
+ {
+ Text [ en-US ] = "Numerator";
+ };
+
+ String 3 // description of parameter 1 Quotient
+ {
+ Text [ en-US ] = "The dividend";
+ };
+
+ String 4 // name of parameter 2 Quotient
+ {
+ Text [ en-US ] = "Denominator";
+ };
+
+ String 5 // description of parameter 2 Quotient
+ {
+ Text [ en-US ] = "The divisor";
+ };
+ };
+
+ Resource ANALYSIS_Mround
+ {
+ String 1 // description Mround
+ {
+ Text [ en-US ] = "Returns a number rounded to a specified multiple";
+ };
+
+ String 2 // name of parameter 1 Mround
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Mround
+ {
+ Text [ en-US ] = "The number to round off";
+ };
+
+ String 4 // name of parameter 2 Mround
+ {
+ Text [ en-US ] = "Multiple";
+ };
+
+ String 5 // description of parameter 2 Mround
+ {
+ Text [ en-US ] = "The multiple to which you want to round number";
+ };
+ };
+
+ Resource ANALYSIS_Sqrtpi
+ {
+ String 1 // description SqrtPI
+ {
+ Text [ en-US ] = "Returns the square root of a number which has been multiplied by pi";
+ };
+
+ String 2 // name of parameter 1 SqrtPI
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 SqrtPI
+ {
+ Text [ en-US ] = "The number by which pi is multiplied";
+ };
+ };
+
+ Resource ANALYSIS_Randbetween
+ {
+ String 1 // description Randbetween
+ {
+ Text [ en-US ] = "Returns a random integer between the numbers you specify";
+ };
+
+ String 2 // name of parameter 1 Randbetween
+ {
+ Text [ en-US ] = "Bottom";
+ };
+
+ String 3 // description of parameter 1 Randbetween
+ {
+ Text [ en-US ] = "The smallest integer returned";
+ };
+
+ String 4 // name of parameter 2 Randbetween
+ {
+ Text [ en-US ] = "Top";
+ };
+
+ String 5 // description of parameter 2 Randbetween
+ {
+ Text [ en-US ] = "The largest integer returned";
+ };
+ };
+
+ Resource ANALYSIS_Gcd
+ {
+ String 1 // description Gcd_add
+ {
+ Text [ en-US ] = "Returns the greatest common divisor";
+ };
+
+ String 2 // name of parameter 1 Gcd_add
+ {
+ Text [ en-US ] = "Number(s)";
+ };
+
+ String 3 // description of parameter 1 Gcd_add
+ {
+ Text [ en-US ] = "Number or list of numbers";
+ };
+ };
+
+ Resource ANALYSIS_Lcm
+ {
+ String 1 // description Lcm_add
+ {
+ Text [ en-US ] = "Returns the least common multiple";
+ };
+
+ String 2 // name of parameter 1 Lcm_add
+ {
+ Text [ en-US ] = "Number(s)";
+ };
+
+ String 3 // description of parameter 1 Lcm_add
+ {
+ Text [ en-US ] = "Number or list of numbers";
+ };
+ };
+
+ Resource ANALYSIS_Besseli
+ {
+ String 1 // description BesselI
+ {
+ Text [ en-US ] = "Returns the modified Bessel function In(x)";
+ };
+
+ String 2 // name of parameter 1 BesselI
+ {
+ Text [ en-US ] = "X";
+ };
+
+ String 3 // description of parameter 1 BesselI
+ {
+ Text [ en-US ] = "The value at which the function is to be evaluated";
+ };
+
+ String 4 // name of parameter 2 BesselI
+ {
+ Text [ en-US ] = "N";
+ };
+
+ String 5 // description of parameter 2 BesselI
+ {
+ Text [ en-US ] = "The order of the Bessel function";
+ };
+ };
+
+ Resource ANALYSIS_Besselj
+ {
+ String 1 // description BesselJ
+ {
+ Text [ en-US ] = "Returns the Bessel function Jn(x)";
+ };
+
+ String 2 // name of parameter 1 BesselJ
+ {
+ Text [ en-US ] = "X";
+ };
+
+ String 3 // description of parameter 1 BesselJ
+ {
+ Text [ en-US ] = "The value at which the function is to be evaluated";
+ };
+
+ String 4 // name of parameter 2 BesselJ
+ {
+ Text [ en-US ] = "N";
+ };
+
+ String 5 // description of parameter 2 BesselJ
+ {
+ Text [ en-US ] = "The order of the Bessel function";
+ };
+ };
+
+ Resource ANALYSIS_Besselk
+ {
+ String 1 // description BesselK
+ {
+ Text [ en-US ] = "Returns the Bessel function Kn(x)";
+ };
+
+ String 2 // name of parameter 1 BesselK
+ {
+ Text [ en-US ] = "X";
+ };
+
+ String 3 // description of parameter 1 BesselK
+ {
+ Text [ en-US ] = "The value at which the function is to be evaluated";
+ };
+
+ String 4 // name of parameter 2 BesselK
+ {
+ Text [ en-US ] = "N";
+ };
+
+ String 5 // description of parameter 2 BesselK
+ {
+ Text [ en-US ] = "The order of the Bessel function";
+ };
+ };
+
+ Resource ANALYSIS_Bessely
+ {
+ String 1 // description BesselY
+ {
+ Text [ en-US ] = "Returns the Bessel function Yn(x)";
+ };
+
+ String 2 // name of parameter 1 BesselY
+ {
+ Text [ en-US ] = "X";
+ };
+
+ String 3 // description of parameter 1 BesselY
+ {
+ Text [ en-US ] = "The value at which the function is to be evaluated";
+ };
+
+ String 4 // name of parameter 2 BesselY
+ {
+ Text [ en-US ] = "N";
+ };
+
+ String 5 // description of parameter 2 BesselY
+ {
+ Text [ en-US ] = "The order of the Bessel function";
+ };
+ };
+
+ Resource ANALYSIS_Bin2Oct
+ {
+ String 1 // description Bin2Oct
+ {
+ Text [ en-US ] = "Converts a binary number to an octal number";
+ };
+
+ String 2 // name of parameter 1 Bin2Oct
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Bin2Oct
+ {
+ Text [ en-US ] = "The binary number to be converted (as text)";
+ };
+
+ String 4 // name of parameter 2 Bin2Oct
+ {
+ Text [ en-US ] = "Places";
+ };
+
+ String 5 // description of parameter 2 Bin2Oct
+ {
+ Text [ en-US ] = "Number of places used";
+ };
+ };
+
+ Resource ANALYSIS_Bin2Dec
+ {
+ String 1 // description Bin2Dec
+ {
+ Text [ en-US ] = "Converts a binary number to a decimal number";
+ };
+
+ String 2 // name of parameter 1 Bin2Dec
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Bin2Dec
+ {
+ Text [ en-US ] = "The binary number to be converted (as text)";
+ };
+ };
+
+ Resource ANALYSIS_Bin2Hex
+ {
+ String 1 // description Bin2Hex
+ {
+ Text [ en-US ] = "Converts a binary number to a hexadecimal number";
+ };
+
+ String 2 // name of parameter 1 Bin2Hex
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Bin2Hex
+ {
+ Text [ en-US ] = "The binary number to be converted (as text)";
+ };
+
+ String 4 // name of parameter 2 Bin2Hex
+ {
+ Text [ en-US ] = "Places";
+ };
+
+ String 5 // description of parameter 2 Bin2Hex
+ {
+ Text [ en-US ] = "Number of places used.";
+ };
+ };
+
+ Resource ANALYSIS_Oct2Bin
+ {
+ String 1 // description Oct2Bin
+ {
+ Text [ en-US ] = "Converts an octal number to a binary number";
+ };
+
+ String 2 // name of parameter 1 Oct2Bin
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Oct2Bin
+ {
+ Text [ en-US ] = "The octal number to be converted (as text)";
+ };
+
+ String 4 // name of parameter 2 Oct2Bin
+ {
+ Text [ en-US ] = "Places";
+ };
+
+ String 5 // description of parameter 2 Oct2Bin
+ {
+ Text [ en-US ] = "Number of places used";
+ };
+ };
+
+ Resource ANALYSIS_Oct2Dec
+ {
+ String 1 // description Oct2Dec
+ {
+ Text [ en-US ] = "Converts an octal number to a decimal number";
+ };
+
+ String 2 // name of parameter 1 Oct2Dec
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Oct2Dec
+ {
+ Text [ en-US ] = "The octal number to be converted (as text)";
+ };
+ };
+
+ Resource ANALYSIS_Oct2Hex
+ {
+ String 1 // description Oct2Hex
+ {
+ Text [ en-US ] = "Converts an octal number to a hexadecimal number";
+ };
+
+ String 2 // name of parameter 1 Oct2Hex
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Oct2Hex
+ {
+ Text [ en-US ] = "The octal number to be converted (as text)";
+ };
+
+ String 4 // name of parameter 2 Oct2Hex
+ {
+ Text [ en-US ] = "Places";
+ };
+
+ String 5 // description of parameter 2 Oct2Hex
+ {
+ Text [ en-US ] = "Number of places used";
+ };
+ };
+
+ Resource ANALYSIS_Dec2Bin
+ {
+ String 1 // description Dec2Bin
+ {
+ Text [ en-US ] = "Converts a decimal number to a binary number";
+ };
+
+ String 2 // name of parameter 1 Dec2Bin
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Dec2Bin
+ {
+ Text [ en-US ] = "The decimal integer to be converted";
+ };
+
+ String 4 // name of parameter 2 Dec2Bin
+ {
+ Text [ en-US ] = "Places";
+ };
+
+ String 5 // description of parameter 2 Dec2Bin
+ {
+ Text [ en-US ] = "Number of places used";
+ };
+ };
+
+ Resource ANALYSIS_Dec2Hex
+ {
+ String 1 // description Dec2Hex
+ {
+ Text [ en-US ] = "Converts a decimal number to a hexadecimal number";
+ };
+
+ String 2 // name of parameter 1 Dec2Hex
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Dec2Hex
+ {
+ Text [ en-US ] = "The decimal integer to be converted";
+ };
+
+ String 4 // name of parameter 2 Dec2Hex
+ {
+ Text [ en-US ] = "Places";
+ };
+
+ String 5 // description of parameter 2 Dec2Hex
+ {
+ Text [ en-US ] = "Number of places used";
+ };
+ };
+
+ Resource ANALYSIS_Dec2Oct
+ {
+ String 1 // description Dec2Oct
+ {
+ Text [ en-US ] = "Converts a decimal number into an octal number";
+ };
+
+ String 2 // name of parameter 1 Dec2Oct
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Dec2Oct
+ {
+ Text [ en-US ] = "The decimal number";
+ };
+
+ String 4 // name of parameter 2 Dec2Oct
+ {
+ Text [ en-US ] = "Places";
+ };
+
+ String 5 // description of parameter 2 Dec2Oct
+ {
+ Text [ en-US ] = "Number of places used";
+ };
+ };
+
+ Resource ANALYSIS_Hex2Bin
+ {
+ String 1 // description Hex2Bin
+ {
+ Text [ en-US ] = "Converts a hexadecimal number to a binary number";
+ };
+
+ String 2 // name of parameter 1 Hex2Bin
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Hex2Bin
+ {
+ Text [ en-US ] = "The hexadecimal number to be converted (as text)";
+ };
+
+ String 4 // name of parameter 2 Hex2Bin
+ {
+ Text [ en-US ] = "Places";
+ };
+
+ String 5 // description of parameter 2 Hex2Bin
+ {
+ Text [ en-US ] = "Number of places used";
+ };
+ };
+
+ Resource ANALYSIS_Hex2Dec
+ {
+ String 1 // description Hex2Dec
+ {
+ Text [ en-US ] = "Converts a hexadecimal number to a decimal number";
+ };
+
+ String 2 // name of parameter 1 Hex2Dec
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Hex2Dec
+ {
+ Text [ en-US ] = "The hexadecimal number to be converted (as text)";
+ };
+ };
+
+ Resource ANALYSIS_Hex2Oct
+ {
+ String 1 // description Hex2Oct
+ {
+ Text [ en-US ] = "Converts a hexadecimal number to an octal number";
+ };
+
+ String 2 // name of parameter 1 Hex2Oct
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Hex2Oct
+ {
+ Text [ en-US ] = "The hexadecimal number to be converted (as text)";
+ };
+
+ String 4 // name of parameter 2 Hex2Oct
+ {
+ Text [ en-US ] = "Places";
+ };
+
+ String 5 // description of parameter 2 Hex2Oct
+ {
+ Text [ en-US ] = "Number of places used";
+ };
+ };
+
+ Resource ANALYSIS_Delta
+ {
+ String 1 // description Delta
+ {
+ Text [ en-US ] = "Tests whether two values are equal";
+ };
+
+ String 2 // name of parameter 1 Delta
+ {
+ Text [ en-US ] = "Number 1";
+ };
+
+ String 3 // description of parameter 1 Delta
+ {
+ Text [ en-US ] = "The first number";
+ };
+
+ String 4 // name of parameter 2 Delta
+ {
+ Text [ en-US ] = "Number 2";
+ };
+
+ String 5 // description of parameter 2 Delta
+ {
+ Text [ en-US ] = "The second number";
+ };
+ };
+
+ Resource ANALYSIS_Erf
+ {
+ String 1 // description Erf
+ {
+ Text [ en-US ] = "Returns the error function";
+ };
+
+ String 2 // name of parameter 1 Erf
+ {
+ Text [ en-US ] = "Lower limit";
+ };
+
+ String 3 // description of parameter 1 Erf
+ {
+ Text [ en-US ] = "The lower limit for integration";
+ };
+
+ String 4 // name of parameter 2 Erf
+ {
+ Text [ en-US ] = "Upper limit";
+ };
+
+ String 5 // description of parameter 2 Erf
+ {
+ Text [ en-US ] = "The upper limit for integration";
+ };
+ };
+
+ Resource ANALYSIS_Erfc
+ {
+ String 1 // description Erfc
+ {
+ Text [ en-US ] = "Returns the complementary error function";
+ };
+
+ String 2 // name of parameter 1 Erfc
+ {
+ Text [ en-US ] = "Lower limit";
+ };
+
+ String 3 // description of parameter 1 Erfc
+ {
+ Text [ en-US ] = "The lower limit for integration";
+ };
+ };
+
+ Resource ANALYSIS_Gestep
+ {
+ String 1 // description GeStep
+ {
+ Text [ en-US ] = "Tests whether a number is greater than a threshold value";
+ };
+
+ String 2 // name of parameter 1 GeStep
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 GeStep
+ {
+ Text [ en-US ] = "The value to test against step";
+ };
+
+ String 4 // name of parameter 2 GeStep
+ {
+ Text [ en-US ] = "Step";
+ };
+
+ String 5 // description of parameter 2 GeStep
+ {
+ Text [ en-US ] = "The threshhold value";
+ };
+ };
+
+ Resource ANALYSIS_Factdouble
+ {
+ String 1 // description Factdouble
+ {
+ Text [ en-US ] = "Returns the double factorial of Number";
+ };
+
+ String 2 // name of parameter 1 Factdouble
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Factdouble
+ {
+ Text [ en-US ] = "The number";
+ };
+ };
+
+ Resource ANALYSIS_Imabs
+ {
+ String 1 // description Imabs
+ {
+ Text [ en-US ] = "Returns the absolute value (modulus) of a complex number";
+ };
+
+ String 2 // name of parameter 1 Imabs
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imabs
+ {
+ Text [ en-US ] = "The complex number";
+ };
+ };
+
+ Resource ANALYSIS_Imaginary
+ {
+ String 1 // description Imaginary
+ {
+ Text [ en-US ] = "Returns the imaginary coefficient of a complex number";
+ };
+
+ String 2 // name of parameter 1 Imaginary
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imaginary
+ {
+ Text [ en-US ] = "The complex number";
+ };
+ };
+
+ Resource ANALYSIS_Impower
+ {
+ String 1 // description Impower
+ {
+ Text [ en-US ] = "Returns a complex number raised to an integer power";
+ };
+
+ String 2 // name of parameter 1 Impower
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Impower
+ {
+ Text [ en-US ] = "The complex number";
+ };
+
+ String 4 // name of parameter 2 Impower
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 5 // description of parameter 2 Impower
+ {
+ Text [ en-US ] = "Power to which the complex number is raised";
+ };
+ };
+
+ Resource ANALYSIS_Imargument
+ {
+ String 1 // description Imargument
+ {
+ Text [ en-US ] = "Returns the argument theta, an angle expressed in radians";
+ };
+
+ String 2 // name of parameter 1 Imargument
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imargument
+ {
+ Text [ en-US ] = "A complex number";
+ };
+ };
+
+ Resource ANALYSIS_Imcos
+ {
+ String 1 // description Imcos
+ {
+ Text [ en-US ] = "Returns the cosine of a complex number";
+ };
+
+ String 2 // name of parameter 1 Imcos
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imcos
+ {
+ Text [ en-US ] = "A complex number";
+ };
+ };
+
+ Resource ANALYSIS_Imdiv
+ {
+ String 1 // description Imdiv
+ {
+ Text [ en-US ] = "Returns the quotient of two complex numbers";
+ };
+
+ String 2 // name of parameter 1 Imdiv
+ {
+ Text [ en-US ] = "Numerator";
+ };
+
+ String 3 // description of parameter 1 Imdiv
+ {
+ Text [ en-US ] = "The dividend";
+ };
+
+ String 4 // name of parameter 2 Imdiv
+ {
+ Text [ en-US ] = "Denominator";
+ };
+
+ String 5 // description of parameter 2 Imdiv
+ {
+ Text [ en-US ] = "The divisor";
+ };
+ };
+
+ Resource ANALYSIS_Imexp
+ {
+ String 1 // description Imexp
+ {
+ Text [ en-US ] = "Returns the algebraic form of the exponential of a complex number";
+ };
+
+ String 2 // name of parameter 1 Imexp
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imexp
+ {
+ Text [ en-US ] = "The complex number";
+ };
+ };
+
+ Resource ANALYSIS_Imconjugate
+ {
+ String 1 // description Imconjugate
+ {
+ Text [ en-US ] = "Returns the complex conjugate of a complex number";
+ };
+
+ String 2 // name of parameter 1 Imconjugate
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imconjugate
+ {
+ Text [ en-US ] = "The complex number";
+ };
+ };
+
+ Resource ANALYSIS_Imln
+ {
+ String 1 // description Imln
+ {
+ Text [ en-US ] = "Returns the natural logarithm of a complex number";
+ };
+
+ String 2 // name of parameter 1 Imln
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imln
+ {
+ Text [ en-US ] = "The complex number";
+ };
+ };
+
+ Resource ANALYSIS_Imlog10
+ {
+ String 1 // description Imlog10
+ {
+ Text [ en-US ] = "Returns the base-10 logarithm of a complex number";
+ };
+
+ String 2 // name of parameter 1 Imlog10
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imlog10
+ {
+ Text [ en-US ] = "The complex number";
+ };
+ };
+
+ Resource ANALYSIS_Imlog2
+ {
+ String 1 // description Imlog2
+ {
+ Text [ en-US ] = "Returns the base-2 logarithm of a complex number";
+ };
+
+ String 2 // name of parameter 1 Imlog2
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imlog2
+ {
+ Text [ en-US ] = "The complex number";
+ };
+ };
+
+ Resource ANALYSIS_Improduct
+ {
+ String 1 // description Improduct
+ {
+ Text [ en-US ] = "Returns the product of several complex numbers";
+ };
+
+ String 2 // name of parameter 1 Improduct
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Improduct
+ {
+ Text [ en-US ] = "The first complex number";
+ };
+
+ String 4 // name of parameter 2 Improduct
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 5 // description of parameter 2 Improduct
+ {
+ Text [ en-US ] = "Another complex number";
+ };
+ };
+
+ Resource ANALYSIS_Imreal
+ {
+ String 1 // description Imreal
+ {
+ Text [ en-US ] = "Returns the real coefficient of a complex number";
+ };
+
+ String 2 // name of parameter 1 Imreal
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imreal
+ {
+ Text [ en-US ] = "The complex number";
+ };
+ };
+
+ Resource ANALYSIS_Imsin
+ {
+ String 1 // description Imsin
+ {
+ Text [ en-US ] = "Returns the sine of a complex number";
+ };
+
+ String 2 // name of parameter 1 Imsin
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imsin
+ {
+ Text [ en-US ] = "The complex number";
+ };
+ };
+
+ Resource ANALYSIS_Imsub
+ {
+ String 1 // description Imsub
+ {
+ Text [ en-US ] = "Returns the difference of two complex numbers";
+ };
+
+ String 2 // name of parameter 1 Imsub
+ {
+ Text [ en-US ] = "Complex number 1";
+ };
+
+ String 3 // description of parameter 1 Imsub
+ {
+ Text [ en-US ] = "Complex number 1";
+ };
+
+ String 4 // name of parameter 2 Imsub
+ {
+ Text [ en-US ] = "Complex number 2";
+ };
+
+ String 5 // description of parameter 2 Imsub
+ {
+ Text [ en-US ] = "Complex number 2";
+ };
+ };
+
+ Resource ANALYSIS_Imsqrt
+ {
+ String 1 // description Imsqrt
+ {
+ Text [ en-US ] = "Returns the square root of a complex number";
+ };
+
+ String 2 // name of parameter 1 Imsqrt
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imsqrt
+ {
+ Text [ en-US ] = "The complex number";
+ };
+ };
+
+ Resource ANALYSIS_Imsum
+ {
+ String 1 // description Imsum
+ {
+ Text [ en-US ] = "Returns the sum of complex numbers";
+ };
+
+ String 2 // name of parameter 1 Imsum
+ {
+ Text [ en-US ] = "Complex number";
+ };
+
+ String 3 // description of parameter 1 Imsum
+ {
+ Text [ en-US ] = "The complex number";
+ };
+
+ };
+
+ Resource ANALYSIS_Complex
+ {
+ String 1 // description Complex
+ {
+ Text [ en-US ] = "Converts real and imaginary coefficients into a complex number";
+ };
+
+ String 2 // name of parameter 1 Complex
+ {
+ Text [ en-US ] = "Real num";
+ };
+
+ String 3 // description of parameter 1 Complex
+ {
+ Text [ en-US ] = "The real coefficient";
+ };
+
+ String 4 // name of parameter 2 Complex
+ {
+ Text [ en-US ] = "I num";
+ };
+
+ String 5 // description of parameter 2 Complex
+ {
+ Text [ en-US ] = "The imaginary coefficient";
+ };
+
+ String 6 // name of parameter 3 Complex
+ {
+ Text [ en-US ] = "Suffix";
+ };
+
+ String 7 // description of parameter 3 Complex
+ {
+ Text [ en-US ] = "The suffix";
+ };
+ };
+
+ Resource ANALYSIS_Convert
+ {
+ String 1 // description Convert_add
+ {
+ Text [ en-US ] = "Converts a number from one measurement system to another";
+ };
+
+ String 2 // name of parameter 1 Convert_add
+ {
+ Text [ en-US ] = "Number";
+ };
+
+ String 3 // description of parameter 1 Convert_add
+ {
+ Text [ en-US ] = "The number";
+ };
+
+ String 4 // name of parameter 2 Convert_add
+ {
+ Text [ en-US ] = "From unit";
+ };
+
+ String 5 // description of parameter 2 Convert_add
+ {
+ Text [ en-US ] = "Unit of measure for number";
+ };
+
+ String 6 // name of parameter 3 Convert_add
+ {
+ Text [ en-US ] = "To unit";
+ };
+
+ String 7 // description of parameter 3 Convert_add
+ {
+ Text [ en-US ] = "Unit of measure for the result";
+ };
+ };
+
+ Resource ANALYSIS_Amordegrc
+ {
+ String 1 // description Amordegrc
+ {
+ Text [ en-US ] = "Returns the prorated linear depreciation of an asset for each accounting period";
+ };
+
+ String 2 // name of parameter 1 Amordegrc
+ {
+ Text [ en-US ] = "Cost";
+ };
+
+ String 3 // description of parameter 1 Amordegrc
+ {
+ Text [ en-US ] = "Cost of the asset";
+ };
+
+ String 4 // name of parameter 2 Amordegrc
+ {
+ Text [ en-US ] = "Date purchased";
+ };
+
+ String 5 // description of parameter 2 Amordegrc
+ {
+ Text [ en-US ] = "Purchase date of the asset";
+ };
+
+ String 6 // name of parameter 3 Amordegrc
+ {
+ Text [ en-US ] = "First period";
+ };
+
+ String 7 // description of parameter 3 Amordegrc
+ {
+ Text [ en-US ] = "Date the first period ends";
+ };
+
+ String 8 // name of parameter 4 Amordegrc
+ {
+ Text [ en-US ] = "Salvage";
+ };
+
+ String 9 // description of parameter 4 Amordegrc
+ {
+ Text [ en-US ] = "Salvage value of an asset at the end of its life";
+ };
+
+ String 10 // name of parameter 5 Amordegrc
+ {
+ Text [ en-US ] = "Period";
+ };
+
+ String 11 // description of parameter 5 Amordegrc
+ {
+ Text [ en-US ] = "The period";
+ };
+
+ String 12 // name of parameter 6 Amordegrc
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 13 // description of parameter 6 Amordegrc
+ {
+ Text [ en-US ] = "The rate of depreciation";
+ };
+
+ String 14 // name of parameter 7 Amordegrc
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 15 // description of parameter 7 Amordegrc
+ {
+ Text [ en-US ] = "The year basis to be used";
+ };
+ };
+
+ Resource ANALYSIS_Amorlinc
+ {
+ String 1 // description Amorlinc
+ {
+ Text [ en-US ] = "Returns the prorated linear depreciation of an asset for each accounting period";
+ };
+
+ String 2 // name of parameter 1 Amorlinc
+ {
+ Text [ en-US ] = "Cost";
+ };
+
+ String 3 // description of parameter 1 Amorlinc
+ {
+ Text [ en-US ] = "Cost of the asset";
+ };
+
+ String 4 // name of parameter 2 Amorlinc
+ {
+ Text [ en-US ] = "Date purchased";
+ };
+
+ String 5 // description of parameter 2 Amorlinc
+ {
+ Text [ en-US ] = "Purchase date of the asset";
+ };
+
+ String 6 // name of parameter 3 Amorlinc
+ {
+ Text [ en-US ] = "First period";
+ };
+
+ String 7 // description of parameter 3 Amorlinc
+ {
+ Text [ en-US ] = "The date the first period ends";
+ };
+
+ String 8 // name of parameter 4 Amorlinc
+ {
+ Text [ en-US ] = "Salvage";
+ };
+
+ String 9 // description of parameter 4 Amorlinc
+ {
+ Text [ en-US ] = "The salvage value of an asset at the end of its life";
+ };
+
+ String 10 // name of parameter 5 Amorlinc
+ {
+ Text [ en-US ] = "Period";
+ };
+
+ String 11 // description of parameter 5 Amorlinc
+ {
+ Text [ en-US ] = "The period";
+ };
+
+ String 12 // name of parameter 6 Amorlinc
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 13 // description of parameter 6 Amorlinc
+ {
+ Text [ en-US ] = "The rate of depreciation";
+ };
+
+ String 14 // name of parameter 7 Amorlinc
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 15 // description of parameter 7 Amorlinc
+ {
+ Text [ en-US ] = "The year basis to be used";
+ };
+ };
+
+ Resource ANALYSIS_Accrint
+ {
+ String 1 // description Accrint
+ {
+ Text [ en-US ] = "Returns the accrued interest for a security that pays periodic interest";
+ };
+
+ String 2 // name of parameter 1 Accrint
+ {
+ Text [ en-US ] = "Issue";
+ };
+
+ String 3 // description of parameter 1 Accrint
+ {
+ Text [ en-US ] = "Issue date of the security";
+ };
+
+ String 4 // name of parameter 2 Accrint
+ {
+ Text [ en-US ] = "First interest";
+ };
+
+ String 5 // description of parameter 2 Accrint
+ {
+ Text [ en-US ] = "First interest date of the security";
+ };
+
+ String 6 // name of parameter 3 Accrint
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 7 // description of parameter 3 Accrint
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 8 // name of parameter 4 Accrint
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 9 // description of parameter 4 Accrint
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 10 // name of parameter 5 Accrint
+ {
+ Text [ en-US ] = "Par";
+ };
+
+ String 11 // description of parameter 5 Accrint
+ {
+ Text [ en-US ] = "The par value";
+ };
+
+ String 12 // name of parameter 6 Accrint
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 13 // description of parameter 6 Accrint
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 14 // name of parameter 7 Accrint
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 15 // description of parameter 7 Accrint
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Accrintm
+ {
+ String 1 // description Accrintm
+ {
+ Text [ en-US ] = "Returns the accrued interest for a security that pays interest at maturity";
+ };
+
+ String 2 // name of parameter 1 Accrintm
+ {
+ Text [ en-US ] = "Issue";
+ };
+
+ String 3 // description of parameter 1 Accrintm
+ {
+ Text [ en-US ] = "The issue date";
+ };
+
+ String 4 // name of parameter 2 Accrintm
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 5 // description of parameter 2 Accrintm
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 6 // name of parameter 3 Accrintm
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 7 // description of parameter 3 Accrintm
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 8 // name of parameter 4 Accrintm
+ {
+ Text [ en-US ] = "Par";
+ };
+
+ String 9 // description of parameter 4 Accrintm
+ {
+ Text [ en-US ] = "The par value";
+ };
+
+ String 10 // name of parameter 5 Accrintm
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 11 // description of parameter 5 Accrintm
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Received
+ {
+ String 1 // description Received
+ {
+ Text [ en-US ] = "Returns the amount paid out at maturity for a fully invested security";
+ };
+
+ String 2 // name of parameter 1 Received
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Received
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Received
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Received
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Received
+ {
+ Text [ en-US ] = "Investment";
+ };
+
+ String 7 // description of parameter 3 Received
+ {
+ Text [ en-US ] = "The investment";
+ };
+
+ String 8 // name of parameter 4 Received
+ {
+ Text [ en-US ] = "Discount";
+ };
+
+ String 9 // description of parameter 4 Received
+ {
+ Text [ en-US ] = "The discount";
+ };
+
+ String 10 // name of parameter 5 Received
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 11 // description of parameter 5 Received
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Disc
+ {
+ String 1 // description Disc
+ {
+ Text [ en-US ] = "Returns the discount rate for a security";
+ };
+
+ String 2 // name of parameter 1 Disc
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Disc
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Disc
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Disc
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Disc
+ {
+ Text [ en-US ] = "Price";
+ };
+
+ String 7 // description of parameter 3 Disc
+ {
+ Text [ en-US ] = "The price";
+ };
+
+ String 8 // name of parameter 4 Disc
+ {
+ Text [ en-US ] = "Redemption";
+ };
+
+ String 9 // description of parameter 4 Disc
+ {
+ Text [ en-US ] = "The redemption value";
+ };
+
+ String 10 // name of parameter 5 Disc
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 11 // description of parameter 5 Disc
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Duration
+ {
+ String 1 // description Duration
+ {
+ Text [ en-US ] = "Returns the annual Macaulay duration of a security with periodic interest payments";
+ };
+
+ String 2 // name of parameter 1 Duration
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Duration
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Duration
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Duration
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Duration
+ {
+ Text [ en-US ] = "Coupon";
+ };
+
+ String 7 // description of parameter 3 Duration
+ {
+ Text [ en-US ] = "The coupon rate";
+ };
+
+ String 8 // name of parameter 4 Duration
+ {
+ Text [ en-US ] = "Yield";
+ };
+
+ String 9 // description of parameter 4 Duration
+ {
+ Text [ en-US ] = "The yield";
+ };
+
+ String 10 // name of parameter 5 Duration
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 11 // description of parameter 5 Duration
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 12 // name of parameter 6 Duration
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 13 // description of parameter 6 Duration
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Effect
+ {
+ String 1 // description Effect_add
+ {
+ Text [ en-US ] = "Returns the effective annual interest rate";
+ };
+
+ String 2 // name of parameter 1 Effect_add
+ {
+ Text [ en-US ] = "Nominal rate";
+ };
+
+ String 3 // description of parameter 1 Effect_add
+ {
+ Text [ en-US ] = "The nominal rate";
+ };
+
+ String 4 // name of parameter 2 Effect_add
+ {
+ Text [ en-US ] = "Npery";
+ };
+
+ String 5 // description of parameter 2 Effect_add
+ {
+ Text [ en-US ] = "The periods";
+ };
+ };
+
+ Resource ANALYSIS_Cumprinc
+ {
+ String 1 // description Cumprinc_add
+ {
+ Text [ en-US ] = "Returns the cumulative principal on a loan to be paid between two periods";
+ };
+
+ String 2 // name of parameter 1 Cumprinc_add
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 3 // description of parameter 1 Cumprinc_add
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 4 // name of parameter 2 Cumprinc_add
+ {
+ Text [ en-US ] = "Nper";
+ };
+
+ String 5 // description of parameter 2 Cumprinc_add
+ {
+ Text [ en-US ] = "Number of payment periods";
+ };
+
+ String 6 // name of parameter 3 Cumprinc_add
+ {
+ Text [ en-US ] = "Pv";
+ };
+
+ String 7 // description of parameter 3 Cumprinc_add
+ {
+ Text [ en-US ] = "The present value";
+ };
+
+ String 8 // name of parameter 4 Cumprinc_add
+ {
+ Text [ en-US ] = "Start period";
+ };
+
+ String 9 // description of parameter 4 Cumprinc_add
+ {
+ Text [ en-US ] = "The start period";
+ };
+
+ String 10 // name of parameter 5 Cumprinc_add
+ {
+ Text [ en-US ] = "End period";
+ };
+
+ String 11 // description of parameter 5 Cumprinc_add
+ {
+ Text [ en-US ] = "The end period";
+ };
+
+ String 12 // name of parameter 6 Cumprinc_add
+ {
+ Text [ en-US ] = "Type";
+ };
+
+ String 13 // description of parameter 6 Cumprinc_add
+ {
+ Text [ en-US ] = "The type of maturity";
+ };
+ };
+
+ Resource ANALYSIS_Cumipmt
+ {
+ String 1 // description Cumipmt_add
+ {
+ Text [ en-US ] = "Returns the cumulative interest to be paid between two periods";
+ };
+
+ String 2 // name of parameter 1 Cumipmt_add
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 3 // description of parameter 1 Cumipmt_add
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 4 // name of parameter 2 Cumipmt_add
+ {
+ Text [ en-US ] = "Nper";
+ };
+
+ String 5 // description of parameter 2 Cumipmt_add
+ {
+ Text [ en-US ] = "Number of payment periods";
+ };
+
+ String 6 // name of parameter 3 Cumipmt_add
+ {
+ Text [ en-US ] = "Pv";
+ };
+
+ String 7 // description of parameter 3 Cumipmt_add
+ {
+ Text [ en-US ] = "The present value";
+ };
+
+ String 8 // name of parameter 4 Cumipmt_add
+ {
+ Text [ en-US ] = "Start period";
+ };
+
+ String 9 // description of parameter 4 Cumipmt_add
+ {
+ Text [ en-US ] = "The start period";
+ };
+
+ String 10 // name of parameter 5 Cumipmt_add
+ {
+ Text [ en-US ] = "End period";
+ };
+
+ String 11 // description of parameter 5 Cumipmt_add
+ {
+ Text [ en-US ] = "The end period";
+ };
+
+ String 12 // name of parameter 6 Cumipmt_add
+ {
+ Text [ en-US ] = "Type";
+ };
+
+ String 13 // description of parameter 6 Cumipmt_add
+ {
+ Text [ en-US ] = "The type of maturity";
+ };
+ };
+
+ Resource ANALYSIS_Price
+ {
+ String 1 // description Price
+ {
+ Text [ en-US ] = "Returns the price per 100 currency units face value of a security that pays periodic interest";
+ };
+
+ String 2 // name of parameter 1 Price
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Price
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Price
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Price
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Price
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 7 // description of parameter 3 Price
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 8 // name of parameter 4 Price
+ {
+ Text [ en-US ] = "Yield";
+ };
+
+ String 9 // description of parameter 4 Price
+ {
+ Text [ en-US ] = "The yield";
+ };
+
+ String 10 // name of parameter 5 Price
+ {
+ Text [ en-US ] = "Redemption";
+ };
+
+ String 11 // description of parameter 5 Price
+ {
+ Text [ en-US ] = "The redemption value";
+ };
+
+ String 12 // name of parameter 6 Price
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 13 // description of parameter 6 Price
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 14 // name of parameter 7 Price
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 15 // description of parameter 7 Price
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Pricedisc
+ {
+ String 1 // description Pricedisc
+ {
+ Text [ en-US ] = "Returns the price per 100 currency units face value of a discounted security";
+ };
+
+ String 2 // name of parameter 1 Pricedisc
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Pricedisc
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Pricedisc
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Pricedisc
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Pricedisc
+ {
+ Text [ en-US ] = "Discount";
+ };
+
+ String 7 // description of parameter 3 Pricedisc
+ {
+ Text [ en-US ] = "The discount";
+ };
+
+ String 8 // name of parameter 4 Pricedisc
+ {
+ Text [ en-US ] = "Redemption";
+ };
+
+ String 9 // description of parameter 4 Pricedisc
+ {
+ Text [ en-US ] = "The redemption value";
+ };
+
+ String 10 // name of parameter 5 Pricedisc
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 11 // description of parameter 5 Pricedisc
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Pricemat
+ {
+ String 1 // description Pricemat
+ {
+ Text [ en-US ] = "Returns the price per 100 currency units face value of a security that pays interest at maturity";
+ };
+
+ String 2 // name of parameter 1 Pricemat
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Pricemat
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Pricemat
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Pricemat
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Pricemat
+ {
+ Text [ en-US ] = "Issue";
+ };
+
+ String 7 // description of parameter 3 Pricemat
+ {
+ Text [ en-US ] = "The issue date";
+ };
+
+ String 8 // name of parameter 4 Pricemat
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 9 // description of parameter 4 Pricemat
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 10 // name of parameter 5 Pricemat
+ {
+ Text [ en-US ] = "Yield";
+ };
+
+ String 11 // description of parameter 5 Pricemat
+ {
+ Text [ en-US ] = "The yield";
+ };
+
+ String 12 // name of parameter 6 Pricemat
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 13 // description of parameter 6 Pricemat
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Mduration
+ {
+ String 1 // description Mduration
+ {
+ Text [ en-US ] = "Returns the Macaulay modified duration for a security with an assumed par value of 100 currency units";
+ };
+
+ String 2 // name of parameter 1 Mduration
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Mduration
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Mduration
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Mduration
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Mduration
+ {
+ Text [ en-US ] = "Coupon";
+ };
+
+ String 7 // description of parameter 3 Mduration
+ {
+ Text [ en-US ] = "The coupon rate";
+ };
+
+ String 8 // name of parameter 4 Mduration
+ {
+ Text [ en-US ] = "Yield";
+ };
+
+ String 9 // description of parameter 4 Mduration
+ {
+ Text [ en-US ] = "The yield";
+ };
+
+ String 10 // name of parameter 5 Mduration
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 11 // description of parameter 5 Mduration
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 12 // name of parameter 6 Mduration
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 13 // description of parameter 6 Mduration
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Nominal
+ {
+ String 1 // description Nominal_add
+ {
+ Text [ en-US ] = "Returns the annual nominal interest rate";
+ };
+
+ String 2 // name of parameter 1 Nominal_add
+ {
+ Text [ en-US ] = "Effective rate";
+ };
+
+ String 3 // description of parameter 1 Nominal_add
+ {
+ Text [ en-US ] = "The effective interest rate";
+ };
+
+ String 4 // name of parameter 2 Nominal_add
+ {
+ Text [ en-US ] = "Npery";
+ };
+
+ String 5 // description of parameter 2 Nominal_add
+ {
+ Text [ en-US ] = "The periods";
+ };
+ };
+
+ Resource ANALYSIS_Dollarfr
+ {
+ String 1 // description Dollarfr
+ {
+ Text [ en-US ] = "Converts a price expressed as a decimal into a price expressed as a fraction";
+ };
+
+ String 2 // name of parameter 1 Dollarfr
+ {
+ Text [ en-US ] = "Decimal dollar";
+ };
+
+ String 3 // description of parameter 1 Dollarfr
+ {
+ Text [ en-US ] = "The decimal number";
+ };
+
+ String 4 // name of parameter 2 Dollarfr
+ {
+ Text [ en-US ] = "Fraction";
+ };
+
+ String 5 // description of parameter 2 Dollarfr
+ {
+ Text [ en-US ] = "The divisor";
+ };
+ };
+
+ Resource ANALYSIS_Dollarde
+ {
+ String 1 // description Dollarde
+ {
+ Text [ en-US ] = "Converts a price expressed as a fraction into a price expressed as a decimal";
+ };
+
+ String 2 // name of parameter 1 Dollarde
+ {
+ Text [ en-US ] = "Fractional dollar";
+ };
+
+ String 3 // description of parameter 1 Dollarde
+ {
+ Text [ en-US ] = "The number as a fraction";
+ };
+
+ String 4 // name of parameter 2 Dollarde
+ {
+ Text [ en-US ] = "Fraction";
+ };
+
+ String 5 // description of parameter 2 Dollarde
+ {
+ Text [ en-US ] = "The divisor";
+ };
+ };
+
+ Resource ANALYSIS_Yield
+ {
+ String 1 // description Yield
+ {
+ Text [ en-US ] = "Returns the yield on a security that pays periodic interest";
+ };
+
+ String 2 // name of parameter 1 Yield
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Yield
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Yield
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Yield
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Yield
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 7 // description of parameter 3 Yield
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 8 // name of parameter 4 Yield
+ {
+ Text [ en-US ] = "Price";
+ };
+
+ String 9 // description of parameter 4 Yield
+ {
+ Text [ en-US ] = "The price";
+ };
+
+ String 10 // name of parameter 5 Yield
+ {
+ Text [ en-US ] = "Redemption";
+ };
+
+ String 11 // description of parameter 5 Yield
+ {
+ Text [ en-US ] = "The redemption value";
+ };
+
+ String 12 // name of parameter 6 Yield
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 13 // description of parameter 6 Yield
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 14 // name of parameter 7 Yield
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 15 // description of parameter 7 Yield
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Yielddisc
+ {
+ String 1 // description Yielddisc
+ {
+ Text [ en-US ] = "Returns the annual yield for a discounted security";
+ };
+
+ String 2 // name of parameter 1 Yielddisc
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Yielddisc
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Yielddisc
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Yielddisc
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Yielddisc
+ {
+ Text [ en-US ] = "Price";
+ };
+
+ String 7 // description of parameter 3 Yielddisc
+ {
+ Text [ en-US ] = "The price";
+ };
+
+ String 8 // name of parameter 4 Yielddisc
+ {
+ Text [ en-US ] = "Redemption";
+ };
+
+ String 9 // description of parameter 4 Yielddisc
+ {
+ Text [ en-US ] = "The redemption value";
+ };
+
+ String 10 // name of parameter 5 Yielddisc
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 11 // description of parameter 5 Yielddisc
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Yieldmat
+ {
+ String 1 // description Yieldmat
+ {
+ Text [ en-US ] = "Returns the annual yield of a security that pays interest at maturity";
+ };
+
+ String 2 // name of parameter 1 Yieldmat
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Yieldmat
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Yieldmat
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Yieldmat
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Yieldmat
+ {
+ Text [ en-US ] = "Issue";
+ };
+
+ String 7 // description of parameter 3 Yieldmat
+ {
+ Text [ en-US ] = "The issue date";
+ };
+
+ String 8 // name of parameter 4 Yieldmat
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 9 // description of parameter 4 Yieldmat
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 10 // name of parameter 5 Yieldmat
+ {
+ Text [ en-US ] = "Price";
+ };
+
+ String 11 // description of parameter 5 Yieldmat
+ {
+ Text [ en-US ] = "The price";
+ };
+
+ String 12 // name of parameter 6 Yieldmat
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 13 // description of parameter 6 Yieldmat
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Tbilleq
+ {
+ String 1 // description Tbilleq
+ {
+ Text [ en-US ] = "Returns the bond-equivalent yield for a treasury bill";
+ };
+
+ String 2 // name of parameter 1 Tbilleq
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Tbilleq
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Tbilleq
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Tbilleq
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Tbilleq
+ {
+ Text [ en-US ] = "Discount";
+ };
+
+ String 7 // description of parameter 3 Tbilleq
+ {
+ Text [ en-US ] = "The discount rate";
+ };
+ };
+
+ Resource ANALYSIS_Tbillprice
+ {
+ String 1 // description Tbillprice
+ {
+ Text [ en-US ] = "Returns the price of 100 currency units face value for a treasury bill";
+ };
+
+ String 2 // name of parameter 1 Tbillprice
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Tbillprice
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Tbillprice
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Tbillprice
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Tbillprice
+ {
+ Text [ en-US ] = "Discount";
+ };
+
+ String 7 // description of parameter 3 Tbillprice
+ {
+ Text [ en-US ] = "The discount rate";
+ };
+ };
+
+ Resource ANALYSIS_Tbillyield
+ {
+ String 1 // description Tbillyield
+ {
+ Text [ en-US ] = "Returns the yield for a treasury bill";
+ };
+
+ String 2 // name of parameter 1 Tbillyield
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Tbillyield
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Tbillyield
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Tbillyield
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Tbillyield
+ {
+ Text [ en-US ] = "Price";
+ };
+
+ String 7 // description of parameter 3 Tbillyield
+ {
+ Text [ en-US ] = "The price";
+ };
+ };
+
+ Resource ANALYSIS_Oddfprice
+ {
+ String 1 // description Oddfprice
+ {
+ Text [ en-US ] = "Returns the price per $100 face value of a security with an odd first period";
+ };
+
+ String 2 // name of parameter 1 Oddfprice
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Oddfprice
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Oddfprice
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Oddfprice
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Oddfprice
+ {
+ Text [ en-US ] = "Issue";
+ };
+
+ String 7 // description of parameter 3 Oddfprice
+ {
+ Text [ en-US ] = "The issue date";
+ };
+
+ String 8 // name of parameter 4 Oddfprice
+ {
+ Text [ en-US ] = "First coupon";
+ };
+
+ String 9 // description of parameter 4 Oddfprice
+ {
+ Text [ en-US ] = "The first coupon date";
+ };
+
+ String 10 // name of parameter 5 Oddfprice
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 11 // description of parameter 5 Oddfprice
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 12 // name of parameter 6 Oddfprice
+ {
+ Text [ en-US ] = "Yield";
+ };
+
+ String 13 // description of parameter 6 Oddfprice
+ {
+ Text [ en-US ] = "The yield";
+ };
+
+ String 14 // name of parameter 7 Oddfprice
+ {
+ Text [ en-US ] = "Redemption";
+ };
+
+ String 15 // description of parameter 7 Oddfprice
+ {
+ Text [ en-US ] = "The redemption value";
+ };
+
+ String 16 // name of parameter 8 Oddfprice
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 17 // description of parameter 8 Oddfprice
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 18 // name of parameter 9 Oddfprice
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 19 // description of parameter 9 Oddfprice
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Oddfyield
+ {
+ String 1 // description Oddfyield
+ {
+ Text [ en-US ] = "Returns the yield of a security with an odd first period";
+ };
+
+ String 2 // name of parameter 1 Oddfyield
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Oddfyield
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Oddfyield
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Oddfyield
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Oddfyield
+ {
+ Text [ en-US ] = "Issue";
+ };
+
+ String 7 // description of parameter 3 Oddfyield
+ {
+ Text [ en-US ] = "The issue date";
+ };
+
+ String 8 // name of parameter 4 Oddfyield
+ {
+ Text [ en-US ] = "First coupon";
+ };
+
+ String 9 // description of parameter 4 Oddfyield
+ {
+ Text [ en-US ] = "The first coupon date";
+ };
+
+ String 10 // name of parameter 5 Oddfyield
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 11 // description of parameter 5 Oddfyield
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 12 // name of parameter 6 Oddfyield
+ {
+ Text [ en-US ] = "Price";
+ };
+
+ String 13 // description of parameter 6 Oddfyield
+ {
+ Text [ en-US ] = "The price";
+ };
+
+ String 14 // name of parameter 7 Oddfyield
+ {
+ Text [ en-US ] = "Redemption";
+ };
+
+ String 15 // description of parameter 7 Oddfyield
+ {
+ Text [ en-US ] = "The redemption value";
+ };
+
+ String 16 // name of parameter 8 Oddfyield
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 17 // description of parameter 8 Oddfyield
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 18 // name of parameter 9 Oddfyield
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 19 // description of parameter 9 Oddfyield
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Oddlprice
+ {
+ String 1 // description Oddlprice
+ {
+ Text [ en-US ] = "Returns the price per $100 face value of a security with an odd last period";
+ };
+
+ String 2 // name of parameter 1 Oddlprice
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Oddlprice
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Oddlprice
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Oddlprice
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Oddlprice
+ {
+ Text [ en-US ] = "Last interest";
+ };
+
+ String 7 // description of parameter 3 Oddlprice
+ {
+ Text [ en-US ] = "The last interest date";
+ };
+
+ String 8 // name of parameter 4 Oddlprice
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 9 // description of parameter 4 Oddlprice
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 10 // name of parameter 5 Oddlprice
+ {
+ Text [ en-US ] = "Yield";
+ };
+
+ String 11 // description of parameter 5 Oddlprice
+ {
+ Text [ en-US ] = "The yield";
+ };
+
+ String 12 // name of parameter 6 Oddlprice
+ {
+ Text [ en-US ] = "Redemption";
+ };
+
+ String 13 // description of parameter 6 Oddlprice
+ {
+ Text [ en-US ] = "The redemption value";
+ };
+
+ String 14 // name of parameter 7 Oddlprice
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 15 // description of parameter 7 Oddlprice
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 16 // name of parameter 8 Oddlprice
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 17 // description of parameter 8 Oddlprice
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Oddlyield
+ {
+ String 1 // description Oddlyield
+ {
+ Text [ en-US ] = "Returns the yield of a security with an odd last period";
+ };
+
+ String 2 // name of parameter 1 Oddlyield
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Oddlyield
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Oddlyield
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Oddlyield
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Oddlyield
+ {
+ Text [ en-US ] = "Last interest";
+ };
+
+ String 7 // description of parameter 3 Oddlyield
+ {
+ Text [ en-US ] = "The last interest date";
+ };
+
+ String 8 // name of parameter 4 Oddlyield
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 9 // description of parameter 4 Oddlyield
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 10 // name of parameter 5 Oddlyield
+ {
+ Text [ en-US ] = "Price";
+ };
+
+ String 11 // description of parameter 5 Oddlyield
+ {
+ Text [ en-US ] = "The price";
+ };
+
+ String 12 // name of parameter 6 Oddlyield
+ {
+ Text [ en-US ] = "Redemption";
+ };
+
+ String 13 // description of parameter 6 Oddlyield
+ {
+ Text [ en-US ] = "The redemption value";
+ };
+
+ String 14 // name of parameter 7 Oddlyield
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 15 // description of parameter 7 Oddlyield
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 16 // name of parameter 8 Oddlyield
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 17 // description of parameter 8 Oddlyield
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Xirr
+ {
+ String 1 // description Xirr
+ {
+ Text [ en-US ] = "Returns the internal rate of return for a non-periodic schedule of payments";
+ };
+
+ String 2 // name of parameter 1 Xirr
+ {
+ Text [ en-US ] = "Values";
+ };
+
+ String 3 // description of parameter 1 Xirr
+ {
+ Text [ en-US ] = "The values";
+ };
+
+ String 4 // name of parameter 2 Xirr
+ {
+ Text [ en-US ] = "Dates";
+ };
+
+ String 5 // description of parameter 2 Xirr
+ {
+ Text [ en-US ] = "The dates";
+ };
+
+ String 6 // name of parameter 3 Xirr
+ {
+ Text [ en-US ] = "Guess";
+ };
+
+ String 7 // description of parameter 3 Xirr
+ {
+ Text [ en-US ] = "The guess";
+ };
+ };
+
+ Resource ANALYSIS_Xnpv
+ {
+ String 1 // description Xnpv
+ {
+ Text [ en-US ] = "Returns the net present value for a non-periodic schedule of payments";
+ };
+
+ String 2 // name of parameter 1 Xnpv
+ {
+ Text [ en-US ] = "Rate";
+ };
+
+ String 3 // description of parameter 1 Xnpv
+ {
+ Text [ en-US ] = "The rate";
+ };
+
+ String 4 // name of parameter 2 Xnpv
+ {
+ Text [ en-US ] = "Values";
+ };
+
+ String 5 // description of parameter 2 Xnpv
+ {
+ Text [ en-US ] = "The values";
+ };
+
+ String 6 // name of parameter 3 Xnpv
+ {
+ Text [ en-US ] = "Dates";
+ };
+
+ String 7 // description of parameter 3 Xnpv
+ {
+ Text [ en-US ] = "The dates";
+ };
+ };
+
+ Resource ANALYSIS_Intrate
+ {
+ String 1 // description Intrate
+ {
+ Text [ en-US ] = "Returns the interest rate for a fully invested security";
+ };
+
+ String 2 // name of parameter 1 Intrate
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Intrate
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Intrate
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Intrate
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Intrate
+ {
+ Text [ en-US ] = "Investment";
+ };
+
+ String 7 // description of parameter 3 Intrate
+ {
+ Text [ en-US ] = "The investment";
+ };
+
+ String 8 // name of parameter 4 Intrate
+ {
+ Text [ en-US ] = "Redemption";
+ };
+
+ String 9 // description of parameter 4 Intrate
+ {
+ Text [ en-US ] = "The redemption value";
+ };
+
+ String 10 // name of parameter 5 Intrate
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 11 // description of parameter 5 Intrate
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Coupncd
+ {
+ String 1 // description Coupncd
+ {
+ Text [ en-US ] = "Returns the first coupon date after the settlement date";
+ };
+
+ String 2 // name of parameter 1 Coupncd
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Coupncd
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Coupncd
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Coupncd
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Coupncd
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 7 // description of parameter 3 Coupncd
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 8 // name of parameter 4 Coupncd
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 9 // description of parameter 4 Coupncd
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Coupdays
+ {
+ String 1 // description Coupdays
+ {
+ Text [ en-US ] = "Returns the number of days in the coupon period containing the settlement date";
+ };
+
+ String 2 // name of parameter 1 Coupdays
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Coupdays
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Coupdays
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Coupdays
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Coupdays
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 7 // description of parameter 3 Coupdays
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 8 // name of parameter 4 Coupdays
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 9 // description of parameter 4 Coupdays
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Coupdaysnc
+ {
+ String 1 // description Coupdaysnc
+ {
+ Text [ en-US ] = "Returns the number of days from the settlement date to the next coupon date";
+ };
+
+ String 2 // name of parameter 1 Coupdaysnc
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Coupdaysnc
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Coupdaysnc
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Coupdaysnc
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Coupdaysnc
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 7 // description of parameter 3 Coupdaysnc
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 8 // name of parameter 4 Coupdaysnc
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 9 // description of parameter 4 Coupdaysnc
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Coupdaybs
+ {
+ String 1 // description Coupdaybs
+ {
+ Text [ en-US ] = "Returns the number of days from the beginning of the coupon period to the settlement date";
+ };
+
+ String 2 // name of parameter 1 Coupdaybs
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Coupdaybs
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Coupdaybs
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Coupdaybs
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Coupdaybs
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 7 // description of parameter 3 Coupdaybs
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 8 // name of parameter 4 Coupdaybs
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 9 // description of parameter 4 Coupdaybs
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Couppcd
+ {
+ String 1 // description Couppcd
+ {
+ Text [ en-US ] = "Returns the last coupon date preceding the settlement date";
+ };
+
+ String 2 // name of parameter 1 Couppcd
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Couppcd
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Couppcd
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Couppcd
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Couppcd
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 7 // description of parameter 3 Couppcd
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 8 // name of parameter 4 Couppcd
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 9 // description of parameter 4 Couppcd
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Coupnum
+ {
+ String 1 // description Coupnum
+ {
+ Text [ en-US ] = "Returns the number of coupons payable between the settlement and maturity dates";
+ };
+
+ String 2 // name of parameter 1 Coupnum
+ {
+ Text [ en-US ] = "Settlement";
+ };
+
+ String 3 // description of parameter 1 Coupnum
+ {
+ Text [ en-US ] = "The settlement";
+ };
+
+ String 4 // name of parameter 2 Coupnum
+ {
+ Text [ en-US ] = "Maturity";
+ };
+
+ String 5 // description of parameter 2 Coupnum
+ {
+ Text [ en-US ] = "The maturity";
+ };
+
+ String 6 // name of parameter 3 Coupnum
+ {
+ Text [ en-US ] = "Frequency";
+ };
+
+ String 7 // description of parameter 3 Coupnum
+ {
+ Text [ en-US ] = "The frequency";
+ };
+
+ String 8 // name of parameter 4 Coupnum
+ {
+ Text [ en-US ] = "Basis";
+ };
+
+ String 9 // description of parameter 4 Coupnum
+ {
+ Text [ en-US ] = "The basis";
+ };
+ };
+
+ Resource ANALYSIS_Fvschedule
+ {
+ String 1 // description Fvschedule
+ {
+ Text [ en-US ] = "Returns the future value of the initial principal after a series of compound interest rates are applied";
+ };
+
+ String 2 // name of parameter 1 Fvschedule
+ {
+ Text [ en-US ] = "Principal";
+ };
+
+ String 3 // description of parameter 1 Fvschedule
+ {
+ Text [ en-US ] = "The principal";
+ };
+
+ String 4 // name of parameter 2 Fvschedule
+ {
+ Text [ en-US ] = "Schedule";
+ };
+
+ String 5 // description of parameter 2 Fvschedule
+ {
+ Text [ en-US ] = "The schedule";
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scaddins/source/analysis/analysis_deffuncnames.src b/scaddins/source/analysis/analysis_deffuncnames.src
new file mode 100644
index 000000000000..840800da8ae4
--- /dev/null
+++ b/scaddins/source/analysis/analysis_deffuncnames.src
@@ -0,0 +1,874 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "analysis.hrc"
+
+
+Resource RID_ANALYSIS_DEFFUNCTION_NAMES
+{
+
+ StringArray ANALYSIS_DEFFUNCNAME_Workday
+ {
+ ItemList =
+ {
+ < "ARBEITSTAG"; >;
+ < "WORKDAY"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Yearfrac
+ {
+ ItemList =
+ {
+ < "BRTEILJAHRE"; >;
+ < "YEARFRAC"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Edate
+ {
+ ItemList =
+ {
+ < "EDATUM"; >;
+ < "EDATE"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Weeknum
+ {
+ ItemList =
+ {
+ < "KALENDERWOCHE"; >;
+ < "WEEKNUM"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Eomonth
+ {
+ ItemList =
+ {
+ < "MONATSENDE"; >;
+ < "EOMONTH"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Networkdays
+ {
+ ItemList =
+ {
+ < "NETTOARBEITSTAGE"; >;
+ < "NETWORKDAYS"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Amordegrc
+ {
+ ItemList =
+ {
+ < "AMORDEGRK"; >;
+ < "AMORDEGRC"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Amorlinc
+ {
+ ItemList =
+ {
+ < "AMORLINEARK"; >;
+ < "AMORLINC"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Accrint
+ {
+ ItemList =
+ {
+ < "AUFGELZINS"; >;
+ < "ACCRINT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Accrintm
+ {
+ ItemList =
+ {
+ < "AUFGELZINSF"; >;
+ < "ACCRINTM"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Received
+ {
+ ItemList =
+ {
+ < "AUSZAHLUNG"; >;
+ < "RECEIVED"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Disc
+ {
+ ItemList =
+ {
+ < "DISAGIO"; >;
+ < "DISC"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Duration
+ {
+ ItemList =
+ {
+ < "DURATION"; >;
+ < "DURATION"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Effect
+ {
+ ItemList =
+ {
+ < "EFFEKTIV"; >;
+ < "EFFECT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Cumprinc
+ {
+ ItemList =
+ {
+ < "KUMKAPITAL"; >;
+ < "CUMPRINC"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Cumipmt
+ {
+ ItemList =
+ {
+ < "KUMZINSZ"; >;
+ < "CUMIPMT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Price
+ {
+ ItemList =
+ {
+ < "KURS"; >;
+ < "PRICE"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Pricedisc
+ {
+ ItemList =
+ {
+ < "KURSDISAGIO"; >;
+ < "PRICEDISC"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Pricemat
+ {
+ ItemList =
+ {
+ < "KURSFÄLLIG"; >;
+ < "PRICEMAT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Mduration
+ {
+ ItemList =
+ {
+ < "MDURATION"; >;
+ < "MDURATION"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Nominal
+ {
+ ItemList =
+ {
+ < "NOMINAL"; >;
+ < "NOMINAL"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Dollarfr
+ {
+ ItemList =
+ {
+ < "NOTIERUNGBRU"; >;
+ < "DOLLARFR"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Dollarde
+ {
+ ItemList =
+ {
+ < "NOTIERUNGDEZ"; >;
+ < "DOLLARDE"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Yield
+ {
+ ItemList =
+ {
+ < "RENDITE"; >;
+ < "YIELD"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Yielddisc
+ {
+ ItemList =
+ {
+ < "RENDITEDIS"; >;
+ < "YIELDDISC"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Yieldmat
+ {
+ ItemList =
+ {
+ < "RENDITEFÄLL"; >;
+ < "YIELDMAT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Tbilleq
+ {
+ ItemList =
+ {
+ < "TBILLÄQUIV"; >;
+ < "TBILLEQ"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Tbillprice
+ {
+ ItemList =
+ {
+ < "TBILLKURS"; >;
+ < "TBILLPRICE"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Tbillyield
+ {
+ ItemList =
+ {
+ < "TBILLRENDITE"; >;
+ < "TBILLYIELD"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Oddfprice
+ {
+ ItemList =
+ {
+ < "UNREGER.KURS"; >;
+ < "ODDFPRICE"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Oddfyield
+ {
+ ItemList =
+ {
+ < "UNREGER.REND"; >;
+ < "ODDFYIELD"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Oddlprice
+ {
+ ItemList =
+ {
+ < "UNREGLE.KURS"; >;
+ < "ODDLPRICE"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Oddlyield
+ {
+ ItemList =
+ {
+ < "UNREGLE.REND"; >;
+ < "ODDLYIELD"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Xirr
+ {
+ ItemList =
+ {
+ < "XINTZINSFUSS"; >;
+ < "XIRR"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Xnpv
+ {
+ ItemList =
+ {
+ < "XKAPITALWERT"; >;
+ < "XNPV"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Intrate
+ {
+ ItemList =
+ {
+ < "ZINSSATZ"; >;
+ < "INTRATE"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Coupncd
+ {
+ ItemList =
+ {
+ < "ZINSTERMNZ"; >;
+ < "COUPNCD"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Coupdays
+ {
+ ItemList =
+ {
+ < "ZINSTERMTAGE"; >;
+ < "COUPDAYS"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Coupdaysnc
+ {
+ ItemList =
+ {
+ < "ZINSTERMTAGNZ"; >;
+ < "COUPDAYSNC"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Coupdaybs
+ {
+ ItemList =
+ {
+ < "ZINSTERMTAGVA"; >;
+ < "COUPDAYBS"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Couppcd
+ {
+ ItemList =
+ {
+ < "ZINSTERMVZ"; >;
+ < "COUPPCD"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Coupnum
+ {
+ ItemList =
+ {
+ < "ZINSTERMZAHL"; >;
+ < "COUPNUM"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Fvschedule
+ {
+ ItemList =
+ {
+ < "ZW2"; >;
+ < "FVSCHEDULE"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Iseven
+ {
+ ItemList =
+ {
+ < "ISTGERADE"; >;
+ < "ISEVEN"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Isodd
+ {
+ ItemList =
+ {
+ < "ISTUNGERADE"; >;
+ < "ISODD"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Gcd
+ {
+ ItemList =
+ {
+ < "GGT"; >;
+ < "GCD"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Lcm
+ {
+ ItemList =
+ {
+ < "KGV"; >;
+ < "LCM"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Multinomial
+ {
+ ItemList =
+ {
+ < "POLYNOMIAL"; >;
+ < "MULTINOMIAL"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Seriessum
+ {
+ ItemList =
+ {
+ < "POTENZREIHE"; >;
+ < "SERIESSUM"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Quotient
+ {
+ ItemList =
+ {
+ < "QUOTIENT"; >;
+ < "QUOTIENT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Mround
+ {
+ ItemList =
+ {
+ < "VRUNDEN"; >;
+ < "MROUND"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Sqrtpi
+ {
+ ItemList =
+ {
+ < "WURZELPI"; >;
+ < "SQRTPI"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Randbetween
+ {
+ ItemList =
+ {
+ < "ZUFALLSBEREICH"; >;
+ < "RANDBETWEEN"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Besseli
+ {
+ ItemList =
+ {
+ < "BESSELI"; >;
+ < "BESSELI"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Besselj
+ {
+ ItemList =
+ {
+ < "BESSELJ"; >;
+ < "BESSELJ"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Besselk
+ {
+ ItemList =
+ {
+ < "BESSELK"; >;
+ < "BESSELK"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Bessely
+ {
+ ItemList =
+ {
+ < "BESSELY"; >;
+ < "BESSELY"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Bin2Dec
+ {
+ ItemList =
+ {
+ < "BININDEZ"; >;
+ < "BIN2DEC"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Bin2Hex
+ {
+ ItemList =
+ {
+ < "BININHEX"; >;
+ < "BIN2HEX"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Bin2Oct
+ {
+ ItemList =
+ {
+ < "BININOKT"; >;
+ < "BIN2OCT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Delta
+ {
+ ItemList =
+ {
+ < "DELTA"; >;
+ < "DELTA"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Dec2Bin
+ {
+ ItemList =
+ {
+ < "DEZINBIN"; >;
+ < "DEC2BIN"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Dec2Hex
+ {
+ ItemList =
+ {
+ < "DEZINHEX"; >;
+ < "DEC2HEX"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Dec2Oct
+ {
+ ItemList =
+ {
+ < "DEZINOKT"; >;
+ < "DEC2OCT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Erf
+ {
+ ItemList =
+ {
+ < "GAUSSFEHLER"; >;
+ < "ERF"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Erfc
+ {
+ ItemList =
+ {
+ < "GAUSSFKOMPL"; >;
+ < "ERFC"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Gestep
+ {
+ ItemList =
+ {
+ < "GGANZZAHL"; >;
+ < "GESTEP"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Hex2Bin
+ {
+ ItemList =
+ {
+ < "HEXINBIN"; >;
+ < "HEX2BIN"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Hex2Dec
+ {
+ ItemList =
+ {
+ < "HEXINDEZ"; >;
+ < "HEX2DEC"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Hex2Oct
+ {
+ ItemList =
+ {
+ < "HEXINOKT"; >;
+ < "HEX2OCT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imabs
+ {
+ ItemList =
+ {
+ < "IMABS"; >;
+ < "IMABS"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imaginary
+ {
+ ItemList =
+ {
+ < "IMAGINÄRTEIL"; >;
+ < "IMAGINARY"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Impower
+ {
+ ItemList =
+ {
+ < "IMAPOTENZ"; >;
+ < "IMPOWER"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imargument
+ {
+ ItemList =
+ {
+ < "IMARGUMENT"; >;
+ < "IMARGUMENT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imcos
+ {
+ ItemList =
+ {
+ < "IMCOS"; >;
+ < "IMCOS"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imdiv
+ {
+ ItemList =
+ {
+ < "IMDIV"; >;
+ < "IMDIV"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imexp
+ {
+ ItemList =
+ {
+ < "IMEXP"; >;
+ < "IMEXP"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imconjugate
+ {
+ ItemList =
+ {
+ < "IMKONJUGIERTE"; >;
+ < "IMCONJUGATE"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imln
+ {
+ ItemList =
+ {
+ < "IMLN"; >;
+ < "IMLN"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imlog10
+ {
+ ItemList =
+ {
+ < "IMLOG10"; >;
+ < "IMLOG10"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imlog2
+ {
+ ItemList =
+ {
+ < "IMLOG2"; >;
+ < "IMLOG2"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Improduct
+ {
+ ItemList =
+ {
+ < "IMPRODUKT"; >;
+ < "IMPRODUCT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imreal
+ {
+ ItemList =
+ {
+ < "IMREALTEIL"; >;
+ < "IMREAL"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imsin
+ {
+ ItemList =
+ {
+ < "IMSIN"; >;
+ < "IMSIN"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imsub
+ {
+ ItemList =
+ {
+ < "IMSUB"; >;
+ < "IMSUB"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imsum
+ {
+ ItemList =
+ {
+ < "IMSUMME"; >;
+ < "IMSUM"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Imsqrt
+ {
+ ItemList =
+ {
+ < "IMWURZEL"; >;
+ < "IMSQRT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Complex
+ {
+ ItemList =
+ {
+ < "KOMPLEXE"; >;
+ < "COMPLEX"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Oct2Bin
+ {
+ ItemList =
+ {
+ < "OKTINBIN"; >;
+ < "OCT2BIN"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Oct2Dec
+ {
+ ItemList =
+ {
+ < "OKTINDEZ"; >;
+ < "OCT2DEC"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Oct2Hex
+ {
+ ItemList =
+ {
+ < "OKTINHEX"; >;
+ < "OCT2HEX"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Convert
+ {
+ ItemList =
+ {
+ < "UMWANDELN"; >;
+ < "CONVERT"; >;
+ };
+ };
+
+ StringArray ANALYSIS_DEFFUNCNAME_Factdouble
+ {
+ ItemList =
+ {
+ < "ZWEIFAKULTÄT"; >;
+ < "FACTDOUBLE"; >;
+ };
+ };
+
+};
+
+
diff --git a/scaddins/source/analysis/analysis_funcnames.src b/scaddins/source/analysis/analysis_funcnames.src
new file mode 100644
index 000000000000..e5cd3e02f9d3
--- /dev/null
+++ b/scaddins/source/analysis/analysis_funcnames.src
@@ -0,0 +1,548 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "analysis.hrc"
+
+
+Resource RID_ANALYSIS_FUNCTION_NAMES
+{
+
+ String ANALYSIS_FUNCNAME_Workday
+ {
+ Text [ en-US ] = "WORKDAY";
+ };
+
+ String ANALYSIS_FUNCNAME_Yearfrac
+ {
+ Text [ en-US ] = "YEARFRAC";
+ };
+
+ String ANALYSIS_FUNCNAME_Edate
+ {
+ Text [ en-US ] = "EDATE";
+ };
+
+ String ANALYSIS_FUNCNAME_Weeknum
+ {
+ Text [ en-US ] = "WEEKNUM";
+ };
+
+ String ANALYSIS_FUNCNAME_Eomonth
+ {
+ Text [ en-US ] = "EOMONTH";
+ };
+
+ String ANALYSIS_FUNCNAME_Networkdays
+ {
+ Text [ en-US ] = "NETWORKDAYS";
+ };
+
+ String ANALYSIS_FUNCNAME_Amordegrc
+ {
+ Text [ en-US ] = "AMORDEGRC";
+ };
+
+ String ANALYSIS_FUNCNAME_Amorlinc
+ {
+ Text [ en-US ] = "AMORLINC";
+ };
+
+ String ANALYSIS_FUNCNAME_Accrint
+ {
+ Text [ en-US ] = "ACCRINT";
+ };
+
+ String ANALYSIS_FUNCNAME_Accrintm
+ {
+ Text [ en-US ] = "ACCRINTM";
+ };
+
+ String ANALYSIS_FUNCNAME_Received
+ {
+ Text [ en-US ] = "RECEIVED";
+ };
+
+ String ANALYSIS_FUNCNAME_Disc
+ {
+ Text [ en-US ] = "DISC";
+ };
+
+ String ANALYSIS_FUNCNAME_Duration
+ {
+ Text [ en-US ] = "DURATION";
+ };
+
+ String ANALYSIS_FUNCNAME_Effect
+ {
+ Text [ en-US ] = "EFFECT";
+ };
+
+ String ANALYSIS_FUNCNAME_Cumprinc
+ {
+ Text [ en-US ] = "CUMPRINC";
+ };
+
+ String ANALYSIS_FUNCNAME_Cumipmt
+ {
+ Text [ en-US ] = "CUMIPMT";
+ };
+
+ String ANALYSIS_FUNCNAME_Price
+ {
+ Text [ en-US ] = "PRICE";
+ };
+
+ String ANALYSIS_FUNCNAME_Pricedisc
+ {
+ Text [ en-US ] = "PRICEDISC";
+ };
+
+ String ANALYSIS_FUNCNAME_Pricemat
+ {
+ Text [ en-US ] = "PRICEMAT";
+ };
+
+ String ANALYSIS_FUNCNAME_Mduration
+ {
+ Text [ en-US ] = "MDURATION";
+ };
+
+ String ANALYSIS_FUNCNAME_Nominal
+ {
+ Text [ en-US ] = "NOMINAL";
+ };
+
+ String ANALYSIS_FUNCNAME_Dollarfr
+ {
+ Text [ en-US ] = "DOLLARFR";
+ };
+
+ String ANALYSIS_FUNCNAME_Dollarde
+ {
+ Text [ en-US ] = "DOLLARDE";
+ };
+
+ String ANALYSIS_FUNCNAME_Yield
+ {
+ Text [ en-US ] = "YIELD";
+ };
+
+ String ANALYSIS_FUNCNAME_Yielddisc
+ {
+ Text [ en-US ] = "YIELDDISC";
+ };
+
+ String ANALYSIS_FUNCNAME_Yieldmat
+ {
+ Text [ en-US ] = "YIELDMAT";
+ };
+
+ String ANALYSIS_FUNCNAME_Tbilleq
+ {
+ Text [ en-US ] = "TBILLEQ";
+ };
+
+ String ANALYSIS_FUNCNAME_Tbillprice
+ {
+ Text [ en-US ] = "TBILLPRICE";
+ };
+
+ String ANALYSIS_FUNCNAME_Tbillyield
+ {
+ Text [ en-US ] = "TBILLYIELD";
+ };
+
+ String ANALYSIS_FUNCNAME_Oddfprice
+ {
+ Text [ en-US ] = "ODDFPRICE";
+ };
+
+ String ANALYSIS_FUNCNAME_Oddfyield
+ {
+ Text [ en-US ] = "ODDFYIELD";
+ };
+
+ String ANALYSIS_FUNCNAME_Oddlprice
+ {
+ Text [ en-US ] = "ODDLPRICE";
+ };
+
+ String ANALYSIS_FUNCNAME_Oddlyield
+ {
+ Text [ en-US ] = "ODDLYIELD";
+ };
+
+ String ANALYSIS_FUNCNAME_Xirr
+ {
+ Text [ en-US ] = "XIRR";
+ };
+
+ String ANALYSIS_FUNCNAME_Xnpv
+ {
+ Text [ en-US ] = "XNPV";
+ };
+
+ String ANALYSIS_FUNCNAME_Intrate
+ {
+ Text [ en-US ] = "INTRATE";
+ };
+
+ String ANALYSIS_FUNCNAME_Coupncd
+ {
+ Text [ en-US ] = "COUPNCD";
+ };
+
+ String ANALYSIS_FUNCNAME_Coupdays
+ {
+ Text [ en-US ] = "COUPDAYS";
+ };
+
+ String ANALYSIS_FUNCNAME_Coupdaysnc
+ {
+ Text [ en-US ] = "COUPDAYSNC";
+ };
+
+ String ANALYSIS_FUNCNAME_Coupdaybs
+ {
+ Text [ en-US ] = "COUPDAYBS";
+ };
+
+ String ANALYSIS_FUNCNAME_Couppcd
+ {
+ Text [ en-US ] = "COUPPCD";
+ };
+
+ String ANALYSIS_FUNCNAME_Coupnum
+ {
+ Text [ en-US ] = "COUPNUM";
+ };
+
+ String ANALYSIS_FUNCNAME_Fvschedule
+ {
+ Text [ en-US ] = "FVSCHEDULE";
+ };
+
+ String ANALYSIS_FUNCNAME_Iseven
+ {
+ Text [ en-US ] = "ISEVEN";
+ };
+
+ String ANALYSIS_FUNCNAME_Isodd
+ {
+ Text [ en-US ] = "ISODD";
+ };
+
+ String ANALYSIS_FUNCNAME_Gcd
+ {
+ Text [ en-US ] = "GCD";
+ };
+
+ String ANALYSIS_FUNCNAME_Lcm
+ {
+ Text [ en-US ] = "LCM";
+ };
+
+ String ANALYSIS_FUNCNAME_Multinomial
+ {
+ Text [ en-US ] = "MULTINOMIAL";
+ };
+
+ String ANALYSIS_FUNCNAME_Seriessum
+ {
+ Text [ en-US ] = "SERIESSUM";
+ };
+
+ String ANALYSIS_FUNCNAME_Quotient
+ {
+ Text [ en-US ] = "QUOTIENT";
+ };
+
+ String ANALYSIS_FUNCNAME_Mround
+ {
+ Text [ en-US ] = "MROUND";
+ };
+
+ String ANALYSIS_FUNCNAME_Sqrtpi
+ {
+ Text [ en-US ] = "SQRTPI";
+ };
+
+ String ANALYSIS_FUNCNAME_Randbetween
+ {
+ Text [ en-US ] = "RANDBETWEEN";
+ };
+
+ String ANALYSIS_FUNCNAME_Besseli
+ {
+ Text [ en-US ] = "BESSELI";
+ };
+
+ String ANALYSIS_FUNCNAME_Besselj
+ {
+ Text [ en-US ] = "BESSELJ";
+ };
+
+ String ANALYSIS_FUNCNAME_Besselk
+ {
+ Text [ en-US ] = "BESSELK";
+ };
+
+ String ANALYSIS_FUNCNAME_Bessely
+ {
+ Text [ en-US ] = "BESSELY";
+ };
+
+ String ANALYSIS_FUNCNAME_Bin2Dec
+ {
+ Text [ en-US ] = "BIN2DEC";
+ };
+
+ String ANALYSIS_FUNCNAME_Bin2Hex
+ {
+ Text [ en-US ] = "BIN2HEX";
+ };
+
+ String ANALYSIS_FUNCNAME_Bin2Oct
+ {
+ Text [ en-US ] = "BIN2OCT";
+ };
+
+ String ANALYSIS_FUNCNAME_Delta
+ {
+ Text [ en-US ] = "DELTA";
+ };
+
+ String ANALYSIS_FUNCNAME_Dec2Bin
+ {
+ Text [ en-US ] = "DEC2BIN";
+ };
+
+ String ANALYSIS_FUNCNAME_Dec2Hex
+ {
+ Text [ en-US ] = "DEC2HEX";
+ };
+
+ String ANALYSIS_FUNCNAME_Dec2Oct
+ {
+ Text [ en-US ] = "DEC2OCT";
+ };
+
+ String ANALYSIS_FUNCNAME_Erf
+ {
+ Text [ en-US ] = "ERF";
+ };
+
+ String ANALYSIS_FUNCNAME_Erfc
+ {
+ Text [ en-US ] = "ERFC";
+ };
+
+ String ANALYSIS_FUNCNAME_Gestep
+ {
+ Text [ en-US ] = "GESTEP";
+ };
+
+ String ANALYSIS_FUNCNAME_Hex2Bin
+ {
+ Text [ en-US ] = "HEX2BIN";
+ };
+
+ String ANALYSIS_FUNCNAME_Hex2Dec
+ {
+ Text [ en-US ] = "HEX2DEC";
+ };
+
+ String ANALYSIS_FUNCNAME_Hex2Oct
+ {
+ Text [ en-US ] = "HEX2OCT";
+ };
+
+ String ANALYSIS_FUNCNAME_Imabs
+ {
+ Text [ en-US ] = "IMABS";
+ };
+
+ String ANALYSIS_FUNCNAME_Imaginary
+ {
+ Text [ en-US ] = "IMAGINARY";
+ };
+
+ String ANALYSIS_FUNCNAME_Impower
+ {
+ Text [ en-US ] = "IMPOWER";
+ };
+
+ String ANALYSIS_FUNCNAME_Imargument
+ {
+ Text [ en-US ] = "IMARGUMENT";
+ };
+
+ String ANALYSIS_FUNCNAME_Imcos
+ {
+ Text [ en-US ] = "IMCOS";
+ };
+
+ String ANALYSIS_FUNCNAME_Imdiv
+ {
+ Text [ en-US ] = "IMDIV";
+ };
+
+ String ANALYSIS_FUNCNAME_Imexp
+ {
+ Text [ en-US ] = "IMEXP";
+ };
+
+ String ANALYSIS_FUNCNAME_Imconjugate
+ {
+ Text [ en-US ] = "IMCONJUGATE";
+ };
+
+ String ANALYSIS_FUNCNAME_Imln
+ {
+ Text [ en-US ] = "IMLN";
+ };
+
+ String ANALYSIS_FUNCNAME_Imlog10
+ {
+ Text [ en-US ] = "IMLOG10";
+ };
+
+ String ANALYSIS_FUNCNAME_Imlog2
+ {
+ Text [ en-US ] = "IMLOG2";
+ };
+
+ String ANALYSIS_FUNCNAME_Improduct
+ {
+ Text [ en-US ] = "IMPRODUCT";
+ };
+
+ String ANALYSIS_FUNCNAME_Imreal
+ {
+ Text [ en-US ] = "IMREAL";
+ };
+
+ String ANALYSIS_FUNCNAME_Imsin
+ {
+ Text [ en-US ] = "IMSIN";
+ };
+
+ String ANALYSIS_FUNCNAME_Imsub
+ {
+ Text [ en-US ] = "IMSUB";
+ };
+
+ String ANALYSIS_FUNCNAME_Imsum
+ {
+ Text [ en-US ] = "IMSUM";
+ };
+
+ String ANALYSIS_FUNCNAME_Imsqrt
+ {
+ Text [ en-US ] = "IMSQRT";
+ };
+
+ String ANALYSIS_FUNCNAME_Complex
+ {
+ Text [ en-US ] = "COMPLEX";
+ };
+
+ String ANALYSIS_FUNCNAME_Oct2Bin
+ {
+ Text [ en-US ] = "OCT2BIN";
+ };
+
+ String ANALYSIS_FUNCNAME_Oct2Dec
+ {
+ Text [ en-US ] = "OCT2DEC";
+ };
+
+ String ANALYSIS_FUNCNAME_Oct2Hex
+ {
+ Text [ en-US ] = "OCT2HEX";
+ };
+
+ String ANALYSIS_FUNCNAME_Convert
+ {
+ Text [ en-US ] = "CONVERT";
+ };
+
+ String ANALYSIS_FUNCNAME_Factdouble
+ {
+ Text [ en-US ] = "FACTDOUBLE";
+ };
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scaddins/source/analysis/analysisadd.idl b/scaddins/source/analysis/analysisadd.idl
new file mode 100644
index 000000000000..14b47ac256fc
--- /dev/null
+++ b/scaddins/source/analysis/analysisadd.idl
@@ -0,0 +1,592 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/beans/XPropertySet.idl>
+#include <com/sun/star/sheet/LocalizedName.idl>
+
+module com
+{
+module sun
+{
+module star
+{
+module sheet
+{
+module addin
+{
+ interface XCompatibilityNames : com::sun::star::uno::XInterface
+ {
+ /// getCompatibilityNames.
+ sequence< com::sun::star::sheet::LocalizedName > getCompatibilityNames ( [in] string aProgrammaticName );
+ };
+
+ /**
+ * Interface with analysis functions.
+ */
+ interface XAnalysis : com::sun::star::uno::XInterface
+ {
+ /// _test.
+// double get_Test(
+// [in] com::sun::star::beans::XPropertySet xOptions,
+// [in] long Mode, [in] double f1, [in] double f2, [in] double f3 );
+
+ /// workday.
+ long getWorkday(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long nStartDate, [in] long nDays, [in] any aHolidays )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// yearfrac.
+ double getYearfrac(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long StartDate, [in] long EndDate, [in] any Mode )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// edate.
+ long getEdate(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long nStartDate, [in] long nNumOfMonths )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// weeknum.
+ long getWeeknum(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long nStartDate, [in] long nMode )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// eomonth.
+ long getEomonth(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long nStartDate, [in] long nMonths )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// networkdays.
+ long getNetworkdays(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long StartDate, [in] long EndDate, [in] any Holidays )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// iseven.
+ long getIseven( [in] long nValue )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// isodd.
+ long getIsodd( [in] long nValue )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// multinomial.
+ double getMultinomial(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] sequence< sequence< long > > aValList,
+ [in] sequence< any > aOptVLst )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// seriessum.
+ double getSeriessum(
+ [in] double X, [in] double N, [in] double M,
+ [in] sequence< sequence< double > > CoeffList )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ // quotient.
+ double getQuotient( [in] double Num, [in] double Denum )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ // mround.
+ double getMround( [in] double Number, [in] double Multiple )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ // sqrtpi.
+ double getSqrtpi( [in] double Number )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ // randbetween.
+ double getRandbetween( [in] double Min, [in] double Max )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// gcd.
+ double getGcd(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] sequence< sequence< double > > FirstValList,
+ [in] sequence< any > OptionalValList )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// lcm.
+ double getLcm(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] sequence< sequence< double > > FirstValList,
+ [in] sequence< any > OptionalValList )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// besseli.
+ double getBesseli( [in] double Num, [in] long Order )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// besselj.
+ double getBesselj( [in] double Num, [in] long Order )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// besselk.
+ double getBesselk( [in] double Num, [in] long Order )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// bessely.
+ double getBessely( [in] double Num, [in] long Order )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// bin2oct.
+ string getBin2Oct(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] string BinaryNum, [in] any Places )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// bin2dec.
+ double getBin2Dec( [in] string BinaryNum )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// bin2hex.
+ string getBin2Hex(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] string BinaryNum, [in] any Places )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// oct2bin.
+ string getOct2Bin(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] string OctalNum, [in] any Places )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// oct2dec.
+ double getOct2Dec( [in] string OctalNum )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// oct2hex.
+ string getOct2Hex(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] string OctalNum, [in] any Places )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// dec2bin.
+ string getDec2Bin(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Value, [in] any Places )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// dec2oct.
+ string getDec2Oct(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Value, [in] any Places )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// dec2hex.
+ string getDec2Hex(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] double Value, [in] any Places )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// hex2bin.
+ string getHex2Bin(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] string HexadecimalValue, [in] any Places )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// hex2dec.
+ double getHex2Dec( [in] string HexadecimalValue )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// hex2oct.
+ string getHex2Oct(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] string HexadecimalValue, [in] any Places )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// delta.
+ long getDelta(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] double Num1, [in] any Num2 )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// erf.
+ double getErf(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] double LowerLimit, [in] any UpperLimit )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// erfc.
+ double getErfc( [in] double LowerLimit )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// gestep.
+ long getGestep(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] double Num, [in] any Step )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// factdouble.
+ double getFactdouble( [in] long Num )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imabs.
+ double getImabs( [in] string Num )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imaginary.
+ double getImaginary( [in] string Num )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// impower.
+ string getImpower( [in] string Num, [in] double Power )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imargument.
+ double getImargument( [in] string Num )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imcos.
+ string getImcos( [in] string Num )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imdiv.
+ string getImdiv( [in] string Num1, [in] string Num2 )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imexp.
+ string getImexp( [in] string Num )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imconjugate.
+ string getImconjugate( [in] string Num )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imln.
+ string getImln( [in] string Num )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imlog10.
+ string getImlog10( [in] string Num )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imlog2.
+ string getImlog2( [in] string Num )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// improduct.
+ string getImproduct(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] sequence< sequence< string > > Num1,
+ [in] sequence< any > NumberList )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imreal.
+ double getImreal( [in] string Num )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imsin.
+ string getImsin( [in] string Num )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imsub.
+ string getImsub( [in] string Num1, [in] string Num2 )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imsum.
+ string getImsum(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] sequence< sequence< string > > Num1,
+ [in] sequence< any > OptNums )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// imsqrt.
+ string getImsqrt( [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 );
+
+ /// convert.
+ double getConvert( [in] double Value, [in] string FromUnit, [in] string ToUnit )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+
+ /// amordegrc.
+ double getAmordegrc(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] double Cost, [in] long Date, [in] long FirstPer, [in] double RestVal,
+ [in] double Periode, [in] double Rate, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// amorlinc.
+ double getAmorlinc(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] double Cost, [in] long Date, [in] long FirstPer, [in] double RestVal,
+ [in] double Periode, [in] double Rate, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// accrint.
+ double getAccrint(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Issue, [in] long FirstInterest, [in] long Settlement, [in] double Rate,
+ [in] any Value, [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// accrintm.
+ double getAccrintm(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Issue, [in] long Settlement, [in] double Rate, [in] any Value, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// received.
+ double getReceived(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] double Investment, [in] double Discount,
+ [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// disc.
+ double getDisc(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] double Price, [in] double Redemption,
+ [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// duration.
+ double getDuration(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] double Coupon, [in] double Yield,
+ [in] long Frequncy, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// effect.
+ double getEffect( [in] double Nomial, [in] long NumOfPeriods )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// cumprinc.
+ double getCumprinc(
+ [in] double Rate, [in] long NumOfPeriods, [in] double Val, [in] long StartPeriode,
+ [in] long EndPeriode, [in] long PayType )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// cumipmt.
+ double getCumipmt(
+ [in] double Rate, [in] long NumOfPeriods, [in] double Val, [in] long StartPeriode,
+ [in] long EndPeriode, [in] long PayType )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// price.
+ double getPrice(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] double Rate, [in] double Yield,
+ [in] double Redemption, [in] long Frequncy, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// pricedisc.
+ double getPricedisc(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] double Discont, [in] double Redemption,
+ [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// pricemat.
+ double getPricemat(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] long Issue, [in] double Rate, [in] double Yield,
+ [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// mduration.
+ double getMduration(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] double Coupon, [in] double Yield,
+ [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// nominal.
+ double getNominal( [in] double Rate, [in] long NumOfPeriods )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// dollarfr.
+ double getDollarfr( [in] double DollarDecimal, [in] long Fraction )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// dollarde.
+ double getDollarde( [in] double DollarFractional, [in] long Fraction )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// yield.
+ double getYield(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] double Coupon, [in] double Price,
+ [in] double Redemption, [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// yielddisc.
+ double getYielddisc(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] double Price,
+ [in] double Redemption, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// yieldmat.
+ double getYieldmat(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] long Issue, [in] double Rate,
+ [in] double Price, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// tbilleq.
+ double getTbilleq(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] double Discont )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// tbillprice.
+ double getTbillprice(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] double Discont )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// tbillyield.
+ double getTbillyield(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] double Price )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// oddfprice.
+ double getOddfprice(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] long Issue, [in] long FirstCouponDate,
+ [in] double Rate, [in] double Yield, [in] double Redemption,
+ [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// oddfyield.
+ double getOddfyield(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] long Issue, [in] long FirstCouponDate,
+ [in] double Rate, [in] double Price, [in] double Redemption,
+ [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// oddlprice.
+ double getOddlprice(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] long LastInterest,
+ [in] double Rate, [in] double Yield, [in] double Redemption,
+ [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// oddlyield.
+ double getOddlyield(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity, [in] long LastInterest,
+ [in] double Rate, [in] double Price, [in] double Redemption,
+ [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// xirr.
+ double getXirr(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] sequence< sequence< double > > Values,
+ [in] sequence< sequence< long > > Dates, [in] any Guess )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// xnpv.
+ double getXnpv(
+ [in] double Rate,
+ [in] sequence< sequence< double > > Values,
+ [in] sequence< sequence< long > > Dates )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// intrate.
+ double getIntrate(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity,
+ [in] double Investment, [in] double Redemption, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// coupncd.
+ double getCoupncd(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity,
+ [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// coupdays.
+ double getCoupdays(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity,
+ [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+
+ /// coupdaysnc.
+ double getCoupdaysnc(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity,
+ [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// coupdaybs.
+ double getCoupdaybs(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity,
+ [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// couppcd.
+ double getCouppcd(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity,
+ [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// coupnum.
+ double getCoupnum(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long Settlement, [in] long Maturity,
+ [in] long Frequency, [in] any Base )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// fvschedule.
+ double getFvschedule( [in] double Principal, [in] sequence< sequence< double > > Schedule )
+ raises( com::sun::star::lang::IllegalArgumentException );
+ };
+
+ service Analysis
+ {
+ // exported interfaces:
+ interface XCompatibilityNames;
+ interface XAnalysis;
+ };
+};
+};
+};
+};
+};
+
diff --git a/scaddins/source/analysis/analysisdefs.hxx b/scaddins/source/analysis/analysisdefs.hxx
new file mode 100644
index 000000000000..81f7435abc19
--- /dev/null
+++ b/scaddins/source/analysis/analysisdefs.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ANALYSISDEFS_HXX
+#define ANALYSISDEFS_HXX
+
+#define CSS ::com::sun::star
+#define XPROPSET CSS::beans::XPropertySet
+#define REF(c) CSS::uno::Reference< c >
+#define constREFXPS const REF(XPROPSET)
+#define SEQ(c) CSS::uno::Sequence< c >
+#define SEQSEQ(c) CSS::uno::Sequence< CSS::uno::Sequence< c > >
+#define SEQofLocName SEQ( CSS::sheet::LocalizedName )
+#define ANY CSS::uno::Any
+#define SEQ_ANY SEQ(ANY)
+#define STRING ::rtl::OUString
+#define STRFROMASCII(s) STRING::createFromAscii( s )
+#define STRFROMANSI(s) STRING( s, strlen( s ), RTL_TEXTENCODING_MS_1252 )
+#define THROWDEF_RTE throw(CSS::uno::RuntimeException)
+#define THROW_RTE throw CSS::uno::RuntimeException()
+#define THROWDEF_RTE_IAE throw(CSS::uno::RuntimeException,CSS::lang::IllegalArgumentException)
+#define THROW_IAE throw CSS::lang::IllegalArgumentException()
+
+#define CHK_Freq ( nFreq != 1 && nFreq != 2 && nFreq != 4 )
+#define CHK_FINITE(d) if( !::rtl::math::isFinite( d ) ) THROW_IAE
+#define RETURN_FINITE(d) if( ::rtl::math::isFinite( d ) ) return d; else THROW_IAE
+
+#endif
+
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
new file mode 100644
index 000000000000..417d30c24d9b
--- /dev/null
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -0,0 +1,2988 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
+
+#include <string.h>
+#include <stdio.h>
+#include <tools/resary.hxx>
+#include <rtl/math.hxx>
+#include "analysishelper.hxx"
+#include "analysis.hrc"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+
+
+#define UNIQUE sal_False // function name does not exist in Calc
+#define DOUBLE sal_True // function name exists in Calc
+
+#define STDPAR sal_False // all parameters are described
+#define INTPAR sal_True // first parameter is internal
+
+#define FUNCDATA( FUNCNAME, DBL, OPT, NUMOFPAR, CAT ) \
+ { "get" #FUNCNAME, ANALYSIS_FUNCNAME_##FUNCNAME, ANALYSIS_##FUNCNAME, DBL, OPT, ANALYSIS_DEFFUNCNAME_##FUNCNAME, NUMOFPAR, CAT }
+
+const FuncDataBase pFuncDatas[] =
+{
+ // UNIQUE or INTPAR or
+ // function name DOUBLE STDPAR # of param category
+ FUNCDATA( Workday, UNIQUE, INTPAR, 3, FDCat_DateTime ),
+ FUNCDATA( Yearfrac, UNIQUE, INTPAR, 3, FDCat_DateTime ),
+ FUNCDATA( Edate, UNIQUE, INTPAR, 2, FDCat_DateTime ),
+ FUNCDATA( Weeknum, DOUBLE, INTPAR, 2, FDCat_DateTime ),
+ FUNCDATA( Eomonth, UNIQUE, INTPAR, 2, FDCat_DateTime ),
+ FUNCDATA( Networkdays, UNIQUE, INTPAR, 3, FDCat_DateTime ),
+ FUNCDATA( Iseven, DOUBLE, STDPAR, 1, FDCat_Inf ),
+ FUNCDATA( Isodd, DOUBLE, STDPAR, 1, FDCat_Inf ),
+ FUNCDATA( Multinomial, UNIQUE, STDPAR, 1, FDCat_Math ),
+ FUNCDATA( Seriessum, UNIQUE, STDPAR, 4, FDCat_Math ),
+ FUNCDATA( Quotient, UNIQUE, STDPAR, 2, FDCat_Math ),
+ FUNCDATA( Mround, UNIQUE, STDPAR, 2, FDCat_Math ),
+ FUNCDATA( Sqrtpi, UNIQUE, STDPAR, 1, FDCat_Math ),
+ FUNCDATA( Randbetween, UNIQUE, STDPAR, 2, FDCat_Math ),
+ FUNCDATA( Gcd, DOUBLE, INTPAR, 1, FDCat_Math ),
+ FUNCDATA( Lcm, DOUBLE, INTPAR, 1, FDCat_Math ),
+ FUNCDATA( Besseli, UNIQUE, STDPAR, 2, FDCat_Tech ),
+ FUNCDATA( Besselj, UNIQUE, STDPAR, 2, FDCat_Tech ),
+ FUNCDATA( Besselk, UNIQUE, STDPAR, 2, FDCat_Tech ),
+ FUNCDATA( Bessely, UNIQUE, STDPAR, 2, FDCat_Tech ),
+ FUNCDATA( Bin2Oct, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Bin2Dec, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Bin2Hex, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Oct2Bin, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Oct2Dec, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Oct2Hex, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Dec2Bin, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Dec2Hex, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Dec2Oct, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Hex2Bin, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Hex2Dec, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Hex2Oct, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Delta, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Erf, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Erfc, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Gestep, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Factdouble, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Imabs, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Imaginary, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Impower, UNIQUE, STDPAR, 2, FDCat_Tech ),
+ FUNCDATA( Imargument, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Imcos, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Imdiv, UNIQUE, STDPAR, 2, FDCat_Tech ),
+ FUNCDATA( Imexp, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Imconjugate, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Imln, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Imlog10, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Imlog2, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Improduct, UNIQUE, INTPAR, 2, FDCat_Tech ),
+ FUNCDATA( Imreal, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Imsin, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Imsub, UNIQUE, STDPAR, 2, FDCat_Tech ),
+ FUNCDATA( Imsqrt, UNIQUE, STDPAR, 1, FDCat_Tech ),
+ FUNCDATA( Imsum, UNIQUE, INTPAR, 1, FDCat_Tech ),
+ FUNCDATA( Complex, UNIQUE, STDPAR, 3, FDCat_Tech ),
+ FUNCDATA( Convert, DOUBLE, STDPAR, 3, FDCat_Tech ),
+ FUNCDATA( Amordegrc, UNIQUE, INTPAR, 7, FDCat_Finance ),
+ FUNCDATA( Amorlinc, UNIQUE, INTPAR, 7, FDCat_Finance ),
+ FUNCDATA( Accrint, UNIQUE, INTPAR, 7, FDCat_Finance ),
+ FUNCDATA( Accrintm, UNIQUE, INTPAR, 5, FDCat_Finance ),
+ FUNCDATA( Received, UNIQUE, INTPAR, 5, FDCat_Finance ),
+ FUNCDATA( Disc, UNIQUE, INTPAR, 5, FDCat_Finance ),
+ FUNCDATA( Duration, DOUBLE, INTPAR, 6, FDCat_Finance ),
+ FUNCDATA( Effect, DOUBLE, STDPAR, 2, FDCat_Finance ),
+ FUNCDATA( Cumprinc, DOUBLE, STDPAR, 6, FDCat_Finance ),
+ FUNCDATA( Cumipmt, DOUBLE, STDPAR, 6, FDCat_Finance ),
+ FUNCDATA( Price, UNIQUE, INTPAR, 7, FDCat_Finance ),
+ FUNCDATA( Pricedisc, UNIQUE, INTPAR, 5, FDCat_Finance ),
+ FUNCDATA( Pricemat, UNIQUE, INTPAR, 6, FDCat_Finance ),
+ FUNCDATA( Mduration, UNIQUE, INTPAR, 6, FDCat_Finance ),
+ FUNCDATA( Nominal, DOUBLE, STDPAR, 2, FDCat_Finance ),
+ FUNCDATA( Dollarfr, UNIQUE, STDPAR, 2, FDCat_Finance ),
+ FUNCDATA( Dollarde, UNIQUE, STDPAR, 2, FDCat_Finance ),
+ FUNCDATA( Yield, UNIQUE, INTPAR, 7, FDCat_Finance ),
+ FUNCDATA( Yielddisc, UNIQUE, INTPAR, 5, FDCat_Finance ),
+ FUNCDATA( Yieldmat, UNIQUE, INTPAR, 6, FDCat_Finance ),
+ FUNCDATA( Tbilleq, UNIQUE, INTPAR, 3, FDCat_Finance ),
+ FUNCDATA( Tbillprice, UNIQUE, INTPAR, 3, FDCat_Finance ),
+ FUNCDATA( Tbillyield, UNIQUE, INTPAR, 3, FDCat_Finance ),
+ FUNCDATA( Oddfprice, UNIQUE, INTPAR, 9, FDCat_Finance ),
+ FUNCDATA( Oddfyield, UNIQUE, INTPAR, 9, FDCat_Finance ),
+ FUNCDATA( Oddlprice, UNIQUE, INTPAR, 8, FDCat_Finance ),
+ FUNCDATA( Oddlyield, UNIQUE, INTPAR, 8, FDCat_Finance ),
+ FUNCDATA( Xirr, UNIQUE, INTPAR, 3, FDCat_Finance ),
+ FUNCDATA( Xnpv, UNIQUE, STDPAR, 3, FDCat_Finance ),
+ FUNCDATA( Intrate, UNIQUE, INTPAR, 5, FDCat_Finance ),
+ FUNCDATA( Coupncd, UNIQUE, INTPAR, 4, FDCat_Finance ),
+ FUNCDATA( Coupdays, UNIQUE, INTPAR, 4, FDCat_Finance ),
+ FUNCDATA( Coupdaysnc, UNIQUE, INTPAR, 4, FDCat_Finance ),
+ FUNCDATA( Coupdaybs, UNIQUE, INTPAR, 4, FDCat_Finance ),
+ FUNCDATA( Couppcd, UNIQUE, INTPAR, 4, FDCat_Finance ),
+ FUNCDATA( Coupnum, UNIQUE, INTPAR, 4, FDCat_Finance ),
+ FUNCDATA( Fvschedule, UNIQUE, STDPAR, 2, FDCat_Finance )
+};
+#undef FUNCDATA
+
+
+sal_uInt16 DaysInMonth( sal_uInt16 nMonth, sal_uInt16 nYear )
+{
+ if( (nMonth == 2) && IsLeapYear( nYear ) )
+ return 29;
+ static const sal_uInt16 aDaysInMonth[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ return aDaysInMonth[ nMonth ];
+}
+
+
+/**
+ * Convert a date to a count of days starting from 01/01/0001
+ *
+ * The internal representation of a Date used in this Addin
+ * is the number of days between 01/01/0001 and the date
+ * this function converts a Day , Month, Year representation
+ * to this internal Date value.
+ *
+ */
+
+sal_Int32 DateToDays( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear )
+{
+ sal_Int32 nDays = ((sal_Int32)nYear-1) * 365;
+ nDays += ((nYear-1) / 4) - ((nYear-1) / 100) + ((nYear-1) / 400);
+
+ for( sal_uInt16 i = 1; i < nMonth; i++ )
+ nDays += DaysInMonth(i,nYear);
+ nDays += nDay;
+
+ return nDays;
+}
+
+
+/**
+ * Convert a count of days starting from 01/01/0001 to a date
+ *
+ * The internal representation of a Date used in this Addin
+ * is the number of days between 01/01/0001 and the date
+ * this function converts this internal Date value
+ * to a Day , Month, Year representation of a Date.
+ *
+ */
+
+void DaysToDate( sal_Int32 nDays, sal_uInt16& rDay, sal_uInt16& rMonth, sal_uInt16& rYear )
+ throw( lang::IllegalArgumentException )
+{
+ if( nDays < 0 )
+ throw lang::IllegalArgumentException();
+
+ sal_Int32 nTempDays;
+ sal_Int32 i = 0;
+ sal_Bool bCalc;
+
+ do
+ {
+ nTempDays = nDays;
+ rYear = (sal_uInt16)((nTempDays / 365) - i);
+ nTempDays -= ((sal_Int32) rYear -1) * 365;
+ nTempDays -= (( rYear -1) / 4) - (( rYear -1) / 100) + ((rYear -1) / 400);
+ bCalc = sal_False;
+ if ( nTempDays < 1 )
+ {
+ i++;
+ bCalc = sal_True;
+ }
+ else
+ {
+ if ( nTempDays > 365 )
+ {
+ if ( (nTempDays != 366) || !IsLeapYear( rYear ) )
+ {
+ i--;
+ bCalc = sal_True;
+ }
+ }
+ }
+ }
+ while ( bCalc );
+
+ rMonth = 1;
+ while ( (sal_Int32)nTempDays > DaysInMonth( rMonth, rYear ) )
+ {
+ nTempDays -= DaysInMonth( rMonth, rYear );
+ rMonth++;
+ }
+ rDay = (sal_uInt16)nTempDays;
+}
+
+
+/**
+ * Get the null date used by the spreadsheet document
+ *
+ * The internal representation of a Date used in this Addin
+ * is the number of days between 01/01/0001 and the date
+ * this function returns this internal Date value for the document null date
+ *
+ */
+
+sal_Int32 GetNullDate( constREFXPS& xOpt ) THROWDEF_RTE
+{
+ if( xOpt.is() )
+ {
+ try
+ {
+ ANY aAny = xOpt->getPropertyValue( STRFROMASCII( "NullDate" ) );
+ util::Date aDate;
+ if( aAny >>= aDate )
+ return DateToDays( aDate.Day, aDate.Month, aDate.Year );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+
+ // no null date available -> no calculations possible
+ throw uno::RuntimeException();
+}
+
+
+sal_Int32 GetDiffDate360(
+ sal_uInt16 nDay1, sal_uInt16 nMonth1, sal_uInt16 nYear1, sal_Bool bLeapYear1,
+ sal_uInt16 nDay2, sal_uInt16 nMonth2, sal_uInt16 nYear2,
+ sal_Bool bUSAMethod )
+{
+ if( nDay1 == 31 )
+ nDay1--;
+ else if( bUSAMethod && ( nMonth1 == 2 && ( nDay1 == 29 || ( nDay1 == 28 && !bLeapYear1 ) ) ) )
+ nDay1 = 30;
+
+ if( nDay2 == 31 )
+ {
+ if( bUSAMethod && nDay1 != 30 )
+ {
+ //aDate2 += 1; -> 1.xx.yyyy
+ nDay2 = 1;
+ if( nMonth2 == 12 )
+ {
+ nYear2++;
+ nMonth2 = 1;
+ }
+ else
+ nMonth2++;
+ }
+ else
+ nDay2 = 30;
+ }
+
+ return nDay2 + nMonth2 * 30 + nYear2 * 360 - nDay1 - nMonth1 * 30 - nYear1 * 360;
+}
+
+
+sal_Int32 GetDiffDate360( sal_Int32 nNullDate, sal_Int32 nDate1, sal_Int32 nDate2, sal_Bool bUSAMethod )
+{
+ nDate1 += nNullDate;
+ nDate2 += nNullDate;
+
+ sal_uInt16 nDay1, nMonth1, nYear1, nDay2, nMonth2, nYear2;
+
+ DaysToDate( nDate1, nDay1, nMonth1, nYear1 );
+ DaysToDate( nDate2, nDay2, nMonth2, nYear2 );
+
+ return GetDiffDate360( nDay1, nMonth1, nYear1, IsLeapYear( nYear1 ), nDay2, nMonth2, nYear2, bUSAMethod );
+}
+
+
+sal_Int32 GetDaysInYears( sal_uInt16 nYear1, sal_uInt16 nYear2 )
+{
+ sal_uInt16 nLeaps = 0;
+ for( sal_uInt16 n = nYear1 ; n <= nYear2 ; n++ )
+ {
+ if( IsLeapYear( n ) )
+ nLeaps++;
+ }
+
+ sal_uInt32 nSum = 1;
+ nSum += nYear2;
+ nSum -= nYear1;
+ nSum *= 365;
+ nSum += nLeaps;
+
+ return nSum;
+}
+
+
+void GetDiffParam( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode,
+ sal_uInt16& rYears, sal_Int32& rDayDiffPart, sal_Int32& rDaysInYear ) THROWDEF_RTE_IAE
+{
+ if( nStartDate > nEndDate )
+ {
+ sal_Int32 n = nEndDate;
+ nEndDate = nStartDate;
+ nStartDate = n;
+ }
+
+ sal_Int32 nDate1 = nStartDate + nNullDate;
+ sal_Int32 nDate2 = nEndDate + nNullDate;
+
+ sal_uInt16 nDay1, nDay2;
+ sal_uInt16 nMonth1, nMonth2;
+ sal_uInt16 nYear1, nYear2;
+
+ DaysToDate( nDate1, nDay1, nMonth1, nYear1 );
+ DaysToDate( nDate2, nDay2, nMonth2, nYear2 );
+
+ sal_uInt16 nYears;
+
+ sal_Int32 nDayDiff, nDaysInYear;
+
+ switch( nMode )
+ {
+ case 0: // 0=USA (NASD) 30/360
+ case 4: // 4=Europe 30/360
+ nDaysInYear = 360;
+ nYears = nYear2 - nYear1;
+ nDayDiff = GetDiffDate360( nDay1, nMonth1, nYear1, IsLeapYear( nYear1 ),
+ nDay2, nMonth2, nYear2, nMode == 0 ) - nYears * nDaysInYear;
+ break;
+ case 1: // 1=exact/exact
+ nYears = nYear2 - nYear1;
+
+ nDaysInYear = IsLeapYear( nYear1 )? 366 : 365;
+
+ if( nYears && ( nMonth1 > nMonth2 || ( nMonth1 == nMonth2 && nDay1 > nDay2 ) ) )
+ nYears--;
+
+ if( nYears )
+ nDayDiff = nDate2 - DateToDays( nDay1, nMonth1, nYear2 );
+ else
+ nDayDiff = nDate2 - nDate1;
+
+ if( nDayDiff < 0 )
+ nDayDiff += nDaysInYear;
+
+ break;
+ case 2: // 2=exact/360
+ nDaysInYear = 360;
+ nYears = sal_uInt16( ( nDate2 - nDate1 ) / nDaysInYear );
+ nDayDiff = nDate2 - nDate1;
+ nDayDiff %= nDaysInYear;
+ break;
+ case 3: //3=exact/365
+ nDaysInYear = 365;
+ nYears = sal_uInt16( ( nDate2 - nDate1 ) / nDaysInYear );
+ nDayDiff = nDate2 - nDate1;
+ nDayDiff %= nDaysInYear;
+ break;
+ default:
+ THROW_IAE;
+ }
+
+ rYears = nYears;
+ rDayDiffPart = nDayDiff;
+ rDaysInYear = nDaysInYear;
+}
+
+
+sal_Int32 GetDiffDate( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode,
+ sal_Int32* pOptDaysIn1stYear ) THROWDEF_RTE_IAE
+{
+ sal_Bool bNeg = nStartDate > nEndDate;
+
+ if( bNeg )
+ {
+ sal_Int32 n = nEndDate;
+ nEndDate = nStartDate;
+ nStartDate = n;
+ }
+
+ sal_Int32 nRet;
+
+ switch( nMode )
+ {
+ case 0: // 0=USA (NASD) 30/360
+ case 4: // 4=Europe 30/360
+ {
+ sal_uInt16 nD1, nM1, nY1, nD2, nM2, nY2;
+
+ nStartDate += nNullDate;
+ nEndDate += nNullDate;
+
+ DaysToDate( nStartDate, nD1, nM1, nY1 );
+ DaysToDate( nEndDate, nD2, nM2, nY2 );
+
+ sal_Bool bLeap = IsLeapYear( nY1 );
+ sal_Int32 nDays, nMonths/*, nYears*/;
+
+ nMonths = nM2 - nM1;
+ nDays = nD2 - nD1;
+
+ nMonths += ( nY2 - nY1 ) * 12;
+
+ nRet = nMonths * 30 + nDays;
+ if( nMode == 0 && nM1 == 2 && nM2 != 2 && nY1 == nY2 )
+ nRet -= bLeap? 1 : 2;
+
+ if( pOptDaysIn1stYear )
+ *pOptDaysIn1stYear = 360;
+ }
+ break;
+ case 1: // 1=exact/exact
+ if( pOptDaysIn1stYear )
+ {
+ sal_uInt16 nD, nM, nY;
+
+ DaysToDate( nStartDate + nNullDate, nD, nM, nY );
+
+ *pOptDaysIn1stYear = IsLeapYear( nY )? 366 : 365;
+ }
+ nRet = nEndDate - nStartDate;
+ break;
+ case 2: // 2=exact/360
+ nRet = nEndDate - nStartDate;
+ if( pOptDaysIn1stYear )
+ *pOptDaysIn1stYear = 360;
+ break;
+ case 3: //3=exact/365
+ nRet = nEndDate - nStartDate;
+ if( pOptDaysIn1stYear )
+ *pOptDaysIn1stYear = 365;
+ break;
+ default:
+ THROW_IAE;
+ }
+
+ return bNeg? -nRet : nRet;
+}
+
+
+double GetYearDiff( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) THROWDEF_RTE_IAE
+{
+ sal_Int32 nDays1stYear;
+ sal_Int32 nTotalDays = GetDiffDate( nNullDate, nStartDate, nEndDate, nMode, &nDays1stYear );
+
+ return double( nTotalDays ) / double( nDays1stYear );
+}
+
+
+sal_Int32 GetDaysInYear( sal_Int32 nNullDate, sal_Int32 nDate, sal_Int32 nMode ) THROWDEF_RTE_IAE
+{
+ switch( nMode )
+ {
+ case 0: // 0=USA (NASD) 30/360
+ case 2: // 2=exact/360
+ case 4: // 4=Europe 30/360
+ return 360;
+ case 1: // 1=exact/exact
+ {
+ sal_uInt16 nD, nM, nY;
+ nDate += nNullDate;
+ DaysToDate( nDate, nD, nM, nY );
+ return IsLeapYear( nY )? 366 : 365;
+ }
+ case 3: //3=exact/365
+ return 365;
+ default:
+ THROW_IAE;
+ }
+}
+
+
+double GetYearFrac( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) THROWDEF_RTE_IAE
+{
+ if( nStartDate == nEndDate )
+ return 0.0; // nothing to do...
+
+ sal_uInt16 nYears;
+ sal_Int32 nDayDiff, nDaysInYear;
+
+ GetDiffParam( nNullDate, nStartDate, nEndDate, nMode, nYears, nDayDiff, nDaysInYear );
+
+ return double( nYears ) + double( nDayDiff ) / double( nDaysInYear );
+}
+
+
+double Fak( sal_Int32 n )
+{
+ if( n > 0 )
+ {
+ double fRet = n;
+ double f = n - 1;
+
+ while( f >= 2.0 )
+ {
+ fRet *= f;
+ f--;
+ }
+
+ return fRet;
+ }
+ else if( !n )
+ return 1.0;
+ else
+ return 0.0;
+}
+
+
+double GetGcd( double f1, double f2 )
+{
+ double f = fmod( f1, f2 );
+ while( f > 0.0 )
+ {
+ f1 = f2;
+ f2 = f;
+ f = fmod( f1, f2 );
+ }
+
+ return f2;
+}
+
+
+double ConvertToDec( const STRING& aStr, sal_uInt16 nBase, sal_uInt16 nCharLim ) THROWDEF_RTE_IAE
+{
+ if ( nBase < 2 || nBase > 36 )
+ THROW_IAE;
+
+ sal_uInt32 nStrLen = aStr.getLength();
+ if( nStrLen > nCharLim )
+ THROW_IAE;
+ else if( !nStrLen )
+ return 0.0;
+
+ double fVal = 0.0;
+
+ register const sal_Unicode* p = aStr.getStr();
+
+ sal_uInt16 nFirstDig = 0;
+ sal_Bool bFirstDig = sal_True;
+ double fBase = nBase;
+
+ while ( *p )
+ {
+ sal_uInt16 n;
+
+ if( '0' <= *p && *p <= '9' )
+ n = *p - '0';
+ else if( 'A' <= *p && *p <= 'Z' )
+ n = 10 + ( *p - 'A' );
+ else if ( 'a' <= *p && *p <= 'z' )
+ n = 10 + ( *p - 'a' );
+ else
+ n = nBase;
+
+ if( n < nBase )
+ {
+ if( bFirstDig )
+ {
+ bFirstDig = sal_False;
+ nFirstDig = n;
+ }
+ fVal = fVal * fBase + double( n );
+ }
+ else
+ // illegal char!
+ THROW_IAE;
+
+ p++;
+
+ }
+
+ if( nStrLen == nCharLim && !bFirstDig && (nFirstDig >= nBase / 2) )
+ { // handling negativ values
+ fVal = ( pow( double( nBase ), double( nCharLim ) ) - fVal ); // complement
+ fVal *= -1.0;
+ }
+
+ return fVal;
+}
+
+
+static inline sal_Char GetMaxChar( sal_uInt16 nBase )
+{
+ const sal_Char* c = "--123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ return c[ nBase ];
+}
+
+
+STRING ConvertFromDec( double fNum, double fMin, double fMax, sal_uInt16 nBase,
+ sal_Int32 nPlaces, sal_Int32 nMaxPlaces, sal_Bool bUsePlaces ) THROWDEF_RTE_IAE
+{
+ fNum = ::rtl::math::approxFloor( fNum );
+ fMin = ::rtl::math::approxFloor( fMin );
+ fMax = ::rtl::math::approxFloor( fMax );
+
+ if( fNum < fMin || fNum > fMax || ( bUsePlaces && ( nPlaces <= 0 || nPlaces > nMaxPlaces ) ) )
+ THROW_IAE;
+
+ sal_Int64 nNum = static_cast< sal_Int64 >( fNum );
+ sal_Bool bNeg = nNum < 0;
+ if( bNeg )
+ nNum = sal_Int64( pow( double( nBase ), double( nMaxPlaces ) ) ) + nNum;
+
+ STRING aRet( STRING::valueOf( nNum, nBase ).toAsciiUpperCase() );
+
+
+ if( bUsePlaces )
+ {
+ sal_Int32 nLen = aRet.getLength();
+ if( !bNeg && nLen > nPlaces )
+ {
+ THROW_IAE;
+ }
+ else if( ( bNeg && nLen < nMaxPlaces ) || ( !bNeg && nLen < nPlaces ) )
+ {
+ sal_Int32 nLeft = nPlaces - nLen;
+ sal_Char* p = new sal_Char[ nLeft + 1 ];
+ memset( p, bNeg? GetMaxChar( nBase ) : '0', nLeft );
+ p[ nLeft ] = 0x00;
+ STRING aTmp( p, nLeft, RTL_TEXTENCODING_MS_1252 );
+ aTmp += aRet;
+ aRet = aTmp;
+
+ delete[] p;
+ }
+ }
+
+ return aRet;
+}
+
+// implementation moved to module sal, see #i97091#
+double Erf( double x )
+{
+ return ::rtl::math::erf(x);
+}
+
+// implementation moved to module sal, see #i97091#
+double Erfc( double x )
+{
+ return ::rtl::math::erfc(x);
+}
+
+inline sal_Bool IsNum( sal_Unicode c )
+{
+ return c >= '0' && c <= '9';
+}
+
+
+inline sal_Bool IsComma( sal_Unicode c )
+{
+ return c == '.' || c == ',';
+}
+
+
+inline sal_Bool IsExpStart( sal_Unicode c )
+{
+ return c == 'e' || c == 'E';
+}
+
+
+inline sal_Bool IsImagUnit( sal_Unicode c )
+{
+ return c == 'i' || c == 'j';
+}
+
+
+inline sal_uInt16 GetVal( sal_Unicode c )
+{
+ return sal_uInt16( c - '0' );
+}
+
+
+sal_Bool ParseDouble( const sal_Unicode*& rp, double& rRet )
+{
+ double fInt = 0.0;
+ double fFrac = 0.0;
+ double fMult = 0.1; // multiplier to multiply digits with, when adding fractional ones
+ sal_Int32 nExp = 0;
+ sal_Int32 nMaxExp = 307;
+ sal_uInt16 nDigCnt = 18; // max. number of digits to read in, rest doesn't matter
+
+ enum State { S_End = 0, S_Sign, S_IntStart, S_Int, S_IgnoreIntDigs, S_Frac, S_IgnoreFracDigs, S_ExpSign, S_Exp };
+
+ State eS = S_Sign;
+
+ sal_Bool bNegNum = sal_False;
+ sal_Bool bNegExp = sal_False;
+
+ const sal_Unicode* p = rp;
+ sal_Unicode c;
+
+ while( eS )
+ {
+ c = *p;
+ switch( eS )
+ {
+ case S_Sign:
+ if( IsNum( c ) )
+ {
+ fInt = GetVal( c );
+ nDigCnt--;
+ eS = S_Int;
+ }
+ else if( c == '-' )
+ {
+ bNegNum = sal_True;
+ eS = S_IntStart;
+ }
+ else if( c == '+' )
+ eS = S_IntStart;
+ else if( IsComma( c ) )
+ eS = S_Frac;
+ else
+ return sal_False;
+ break;
+ case S_IntStart:
+ if( IsNum( c ) )
+ {
+ fInt = GetVal( c );
+ nDigCnt--;
+ eS = S_Int;
+ }
+ else if( IsComma( c ) )
+ eS = S_Frac;
+ else if( IsImagUnit( c ) )
+ {
+ rRet = 0.0;
+ return sal_True;
+ }
+ else
+ return sal_False;
+ break;
+ case S_Int:
+ if( IsNum( c ) )
+ {
+ fInt *= 10.0;
+ fInt += double( GetVal( c ) );
+ nDigCnt--;
+ if( !nDigCnt )
+ eS = S_IgnoreIntDigs;
+ }
+ else if( IsComma( c ) )
+ eS = S_Frac;
+ else if( IsExpStart( c ) )
+ eS = S_ExpSign;
+ else
+ eS = S_End;
+ break;
+ case S_IgnoreIntDigs:
+ if( IsNum( c ) )
+ nExp++; // just multiply num with 10... ;-)
+ else if( IsComma( c ) )
+ eS = S_Frac;
+ else if( IsExpStart( c ) )
+ eS = S_ExpSign;
+ else
+ eS = S_End;
+ break;
+ case S_Frac:
+ if( IsNum( c ) )
+ {
+ fFrac += double( GetVal( c ) ) * fMult;
+ nDigCnt--;
+ if( nDigCnt )
+ fMult *= 0.1;
+ else
+ eS = S_IgnoreFracDigs;
+ }
+ else if( IsExpStart( c ) )
+ eS = S_ExpSign;
+ else
+ eS = S_End;
+ break;
+ case S_IgnoreFracDigs:
+ if( IsExpStart( c ) )
+ eS = S_ExpSign;
+ else if( !IsNum( c ) )
+ eS = S_End;
+ break;
+ case S_ExpSign:
+ if( IsNum( c ) )
+ {
+ nExp = GetVal( c );
+ eS = S_Exp;
+ }
+ else if( c == '-' )
+ {
+ bNegExp = sal_True;
+ eS = S_Exp;
+ }
+ else if( c != '+' )
+ eS = S_End;
+ break;
+ case S_Exp:
+ if( IsNum( c ) )
+ {
+ nExp *= 10;
+ nExp += GetVal( c );
+ if( nExp > nMaxExp )
+ return sal_False;
+ }
+ else
+ eS = S_End;
+ break;
+ case S_End: // to avoid compiler warning
+ break; // loop exits anyway
+ }
+
+ p++;
+ }
+
+ p--; // set pointer back to last
+ rp = p;
+
+ fInt += fFrac;
+ sal_Int32 nLog10 = sal_Int32( log10( fInt ) );
+
+ if( bNegExp )
+ nExp = -nExp;
+
+ if( nLog10 + nExp > nMaxExp )
+ return sal_False;
+
+ fInt = ::rtl::math::pow10Exp( fInt, nExp );
+
+ if( bNegNum )
+ fInt = -fInt;
+
+ rRet = fInt;
+
+ return sal_True;
+}
+
+
+STRING GetString( double f, sal_Bool bLeadingSign, sal_uInt16 nMaxDig )
+{
+ const int nBuff = 256;
+ sal_Char aBuff[ nBuff + 1 ];
+ const char* pFormStr = bLeadingSign? "%+.*g" : "%.*g";
+ int nLen = snprintf( aBuff, nBuff, pFormStr, int( nMaxDig ), f );
+ // you never know which underlying implementation you get ...
+ aBuff[nBuff] = 0;
+ if ( nLen < 0 || nLen > nBuff )
+ nLen = strlen( aBuff );
+
+ STRING aRet( aBuff, nLen, RTL_TEXTENCODING_MS_1252 );
+
+ return aRet;
+}
+
+
+double GetAmordegrc( sal_Int32 nNullDate, double fCost, sal_Int32 nDate, sal_Int32 nFirstPer,
+ double fRestVal, double fPer, double fRate, sal_Int32 nBase ) THROWDEF_RTE_IAE
+{
+ if( nBase == 2 )
+ THROW_IAE;
+
+ sal_uInt32 nPer = sal_uInt32( fPer );
+ double fUsePer = 1.0 / fRate;
+ double fAmorCoeff;
+
+ if( fUsePer < 3.0 )
+ fAmorCoeff = 1.0;
+ else if( fUsePer < 5.0 )
+ fAmorCoeff = 1.5;
+ else if( fUsePer <= 6.0 )
+ fAmorCoeff = 2.0;
+ else
+ fAmorCoeff = 2.5;
+
+ fRate *= fAmorCoeff;
+ double fNRate = ::rtl::math::round( GetYearFrac( nNullDate, nDate, nFirstPer, nBase ) * fRate * fCost, 0 );
+ fCost -= fNRate;
+ double fRest = fCost - fRestVal; // Anschaffungskosten - Restwert - Summe aller Abschreibungen
+
+ for( sal_uInt32 n = 0 ; n < nPer ; n++ )
+ {
+ fNRate = ::rtl::math::round( fRate * fCost, 0 );
+ fRest -= fNRate;
+
+ if( fRest < 0.0 )
+ {
+ switch( nPer - n )
+ {
+ case 0:
+ case 1:
+ return ::rtl::math::round( fCost * 0.5, 0 );
+ default:
+ return 0.0;
+ }
+ }
+
+ fCost -= fNRate;
+ }
+
+ return fNRate;
+}
+
+
+double GetAmorlinc( sal_Int32 nNullDate, double fCost, sal_Int32 nDate, sal_Int32 nFirstPer,
+ double fRestVal, double fPer, double fRate, sal_Int32 nBase ) THROWDEF_RTE_IAE
+{
+ if( nBase == 2 )
+ THROW_IAE;
+
+ sal_uInt32 nPer = sal_uInt32( fPer );
+ double fOneRate = fCost * fRate;
+ double fCostDelta = fCost - fRestVal;
+ double f0Rate = GetYearFrac( nNullDate, nDate, nFirstPer, nBase ) * fRate * fCost;
+ sal_uInt32 nNumOfFullPeriods = sal_uInt32( ( fCost - fRestVal - f0Rate) / fOneRate );
+
+ if( nPer == 0 )
+ return f0Rate;
+ else if( nPer <= nNumOfFullPeriods )
+ return fOneRate;
+ else if( nPer == nNumOfFullPeriods + 1 )
+ return fCostDelta - fOneRate * nNumOfFullPeriods - f0Rate;
+ else
+ return 0.0;
+}
+
+
+double GetDuration( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double fCoup,
+ double fYield, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE
+{
+ double fYearfrac = GetYearFrac( nNullDate, nSettle, nMat, nBase );
+ double fNumOfCoups = GetCoupnum( nNullDate, nSettle, nMat, nFreq, nBase );
+ double fDur = 0.0;
+ const double f100 = 100.0;
+ fCoup *= f100 / double( nFreq ); // fCoup is used as cash flow
+ fYield /= nFreq;
+ fYield += 1.0;
+
+ double nDiff = fYearfrac * nFreq - fNumOfCoups;
+
+ double t;
+
+ for( t = 1.0 ; t < fNumOfCoups ; t++ )
+ fDur += ( t + nDiff ) * ( fCoup ) / pow( fYield, t + nDiff );
+
+ fDur += ( fNumOfCoups + nDiff ) * ( fCoup + f100 ) / pow( fYield, fNumOfCoups + nDiff );
+
+ double p = 0.0;
+ for( t = 1.0 ; t < fNumOfCoups ; t++ )
+ p += fCoup / pow( fYield, t + nDiff );
+
+ p += ( fCoup + f100 ) / pow( fYield, fNumOfCoups + nDiff );
+
+ fDur /= p;
+ fDur /= double( nFreq );
+
+ return fDur;
+}
+
+
+double GetYieldmat( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue,
+ double fRate, double fPrice, sal_Int32 nBase ) THROWDEF_RTE_IAE
+{
+ double fIssMat = GetYearFrac( nNullDate, nIssue, nMat, nBase );
+ double fIssSet = GetYearFrac( nNullDate, nIssue, nSettle, nBase );
+ double fSetMat = GetYearFrac( nNullDate, nSettle, nMat, nBase );
+
+ double y = 1.0 + fIssMat * fRate;
+ y /= fPrice / 100.0 + fIssSet * fRate;
+ y--;
+ y /= fSetMat;
+
+ return y;
+}
+
+
+double GetOddfprice( sal_Int32 /*nNullDate*/, sal_Int32 /*nSettle*/, sal_Int32 /*nMat*/, sal_Int32 /*nIssue*/,
+ sal_Int32 /*nFirstCoup*/, double /*fRate*/, double /*fYield*/, double /*fRedemp*/, sal_Int32 /*nFreq*/,
+ sal_Int32 /*nBase*/ ) THROWDEF_RTE_IAE
+{
+ THROW_RTE; // #87380#
+/*
+ double fN = GetCoupnum( nNullDate, nSettle, nMat, nFreq, nBase ) - 1.0;
+ double fNq = GetCoupnum( nNullDate, nSettle, nFirstCoup, nFreq, nBase ) - 1.0;
+ double fDSC = GetCoupdaysnc( nNullDate, nSettle, nFirstCoup, nFreq, nBase );
+ double fDSC_E = fDSC / GetCoupdays( nNullDate, nSettle, nMat, nFreq, nBase );
+ double fNC = GetCoupnum( nNullDate, nIssue, nFirstCoup, nFreq, nBase );
+ sal_uInt32 nNC = sal_uInt32( fNC );
+ sal_uInt16 nMonthDelta = 12 / sal_uInt16( nFreq );
+
+ sal_uInt32 i;
+ double f1YieldFreq = 1.0 + fYield / double( nFreq );
+ double f100RateFreq = 100.0 * fRate / double( nFreq );
+
+ double* pDC = new double[ nNC + 1 ];
+ double* pNL = new double[ nNC + 1 ];
+ double* pA = new double[ nNC + 1 ];
+
+ pDC[ 0 ] = pNL[ 0 ] = pA[ 0 ] = 1.0;
+
+ ScaDate aStartDate( nNullDate, nSettle, nBase );
+ ScaDate aNextCoup( nNullDate, nFirstCoup, nBase );
+ if( nNC )
+ {
+ pDC[ 1 ] = ScaDate::GetDiff( aStartDate, aNextCoup );
+ pNL[ 1 ] = GetCoupdays( nNullDate, nSettle, nFirstCoup, nFreq, nBase );
+ pA[ 1 ] = pDC[ 1 ];
+ ScaDate aPre;
+ for( i = 1 ; i <= nNC ; i++ )
+ {
+ aPre = aStartDate;
+ aStartDate.addMonths( nMonthDelta );
+ aNextCoup.addMonths( nMonthDelta );
+ pDC[ i ] = ScaDate::GetDiff( aPre, aStartDate );
+ pNL[ i ] = GetCoupdays( nNullDate, aStartDate.GetDate( nNullDate ), aNextCoup.GetDate( nNullDate ),
+ nFreq, nBase );
+ pA[ i ] = ScaDate::GetDiff( aStartDate, aNextCoup );
+ }
+ }
+
+ double fT1 = fRedemp / pow( f1YieldFreq, fN + fNq + fDSC_E );
+
+ double fT2 = 0.0;
+ for( i = 1 ; i <= nNC ; i++ )
+ fT2 += pDC[ i ] / pNL[ i ];
+ fT2 *= f100RateFreq / pow( f1YieldFreq, fNq + fDSC_E );
+
+ double fT3 = 0.0;
+ for( double k = 2.0 ; k <= fN ; k++ )
+ fT3 += 1.0 / pow( f1YieldFreq, k - fNq + fDSC_E );
+ fT3 *= f100RateFreq;
+
+ double fT4 = 0.0;
+ for( i = 1 ; i <= nNC ; i++ )
+ fT4 += pA[ i ] / pNL[ i ];
+ fT4 *= f100RateFreq;
+
+ if( nNC )
+ {
+ delete pDC;
+ delete pNL;
+ delete pA;
+ }
+
+ return fT1 + fT2 + fT3 - fT4;
+*/
+}
+
+
+double getYield_( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double fCoup, double fPrice,
+ double fRedemp, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE
+{
+ double fRate = fCoup;
+ double fPriceN = 0.0;
+ double fYield1 = 0.0;
+ double fYield2 = 1.0;
+ double fPrice1 = getPrice_( nNullDate, nSettle, nMat, fRate, fYield1, fRedemp, nFreq, nBase );
+ double fPrice2 = getPrice_( nNullDate, nSettle, nMat, fRate, fYield2, fRedemp, nFreq, nBase );
+ double fYieldN = ( fYield2 - fYield1 ) * 0.5;
+
+ for( sal_uInt32 nIter = 0 ; nIter < 100 && fPriceN != fPrice ; nIter++ )
+ {
+ fPriceN = getPrice_( nNullDate, nSettle, nMat, fRate, fYieldN, fRedemp, nFreq, nBase );
+
+ if( fPrice == fPrice1 )
+ return fYield1;
+ else if( fPrice == fPrice2 )
+ return fYield2;
+ else if( fPrice == fPriceN )
+ return fYieldN;
+ else if( fPrice < fPrice2 )
+ {
+ fYield2 *= 2.0;
+ fPrice2 = getPrice_( nNullDate, nSettle, nMat, fRate, fYield2, fRedemp, nFreq, nBase );
+
+ fYieldN = ( fYield2 - fYield1 ) * 0.5;
+ }
+ else
+ {
+ if( fPrice < fPriceN )
+ {
+ fYield1 = fYieldN;
+ fPrice1 = fPriceN;
+ }
+ else
+ {
+ fYield2 = fYieldN;
+ fPrice2 = fPriceN;
+ }
+
+ fYieldN = fYield2 - ( fYield2 - fYield1 ) * ( ( fPrice - fPrice2 ) / ( fPrice1 - fPrice2 ) );
+ }
+ }
+
+ if( fabs( fPrice - fPriceN ) > fPrice / 100.0 )
+ THROW_IAE; // result not precise enough
+
+ return fYieldN;
+}
+
+
+double getPrice_( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double fRate, double fYield,
+ double fRedemp, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE
+{
+ double fFreq = nFreq;
+
+ double fE = GetCoupdays( nNullDate, nSettle, nMat, nFreq, nBase );
+ double fDSC_E = GetCoupdaysnc( nNullDate, nSettle, nMat, nFreq, nBase ) / fE;
+ double fN = GetCoupnum( nNullDate, nSettle, nMat, nFreq, nBase );
+ double fA = GetCoupdaybs( nNullDate, nSettle, nMat, nFreq, nBase );
+
+ double fRet = fRedemp / ( pow( 1.0 + fYield / fFreq, fN - 1.0 + fDSC_E ) );
+ fRet -= 100.0 * fRate / fFreq * fA / fE;
+
+ double fT1 = 100.0 * fRate / fFreq;
+ double fT2 = 1.0 + fYield / fFreq;
+
+ for( double fK = 0.0 ; fK < fN ; fK++ )
+ fRet += fT1 / pow( fT2, fK + fDSC_E );
+
+ return fRet;
+}
+
+
+double GetOddfyield( sal_Int32 /*nNullDate*/, sal_Int32 /*nSettle*/, sal_Int32 /*nMat*/, sal_Int32 /*nIssue*/,
+ sal_Int32 /*nFirstCoup*/, double /*fRate*/, double /*fPrice*/, double /*fRedemp*/, sal_Int32 /*nFreq*/,
+ sal_Int32 /*nBase*/ ) THROWDEF_RTE_IAE
+{
+ THROW_RTE; // #87380#
+/*
+ //GetOddfprice( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue,
+ //sal_Int32 nFirstCoup, double fRate, double fYield, double fRedemp, sal_Int32 nFreq,
+ //sal_Int32 nBase )
+ double fPriceN = 0.0;
+ double fYield1 = 0.0;
+ double fYield2 = 1.0;
+ double fPrice1 = GetOddfprice( nNullDate, nSettle, nMat, nIssue, nFirstCoup, fRate, fYield1, fRedemp, nFreq, nBase );
+ double fPrice2 = GetOddfprice( nNullDate, nSettle, nMat, nIssue, nFirstCoup, fRate, fYield2, fRedemp, nFreq, nBase );
+ double fYieldN = ( fYield2 - fYield1 ) * 0.5;
+
+ for( sal_uInt32 nIter = 0 ; nIter < 100 && fPriceN != fPrice ; nIter++ )
+ {
+ fPriceN = GetOddfprice( nNullDate, nSettle, nMat, nIssue, nFirstCoup, fRate, fYieldN, fRedemp, nFreq, nBase );
+
+ if( fPrice == fPrice1 )
+ return fYield1;
+ else if( fPrice == fPrice2 )
+ return fYield2;
+ else if( fPrice == fPriceN )
+ return fYieldN;
+ else if( fPrice < fPrice2 )
+ {
+ fYield2 *= 2.0;
+ fPrice2 = GetOddfprice( nNullDate, nSettle, nMat, nIssue, nFirstCoup, fRate, fYield2, fRedemp, nFreq, nBase );
+
+ fYieldN = ( fYield2 - fYield1 ) * 0.5;
+ }
+ else
+ {
+ if( fPrice < fPriceN )
+ {
+ fYield1 = fYieldN;
+ fPrice1 = fPriceN;
+ }
+ else
+ {
+ fYield2 = fYieldN;
+ fPrice2 = fPriceN;
+ }
+
+ fYieldN = fYield2 - ( fYield2 - fYield1 ) * ( ( fPrice - fPrice2 ) / ( fPrice1 - fPrice2 ) );
+ }
+ }
+
+ if( fabs( fPrice - fPriceN ) > fPrice / 100.0 )
+ THROW_IAE; // result not precise enough
+
+ return fYieldN;
+*/
+}
+
+
+double GetOddlprice( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastCoup,
+ double fRate, double fYield, double fRedemp, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE
+{
+ double fFreq = double( nFreq );
+ double fDCi = GetYearFrac( nNullDate, nLastCoup, nMat, nBase ) * fFreq;
+ double fDSCi = GetYearFrac( nNullDate, nSettle, nMat, nBase ) * fFreq;
+ double fAi = GetYearFrac( nNullDate, nLastCoup, nSettle, nBase ) * fFreq;
+
+ double p = fRedemp + fDCi * 100.0 * fRate / fFreq;
+ p /= fDSCi * fYield / fFreq + 1.0;
+ p -= fAi * 100.0 * fRate / fFreq;
+
+ return p;
+}
+
+
+double GetOddlyield( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastCoup,
+ double fRate, double fPrice, double fRedemp, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE
+{
+ double fFreq = double( nFreq );
+ double fDCi = GetYearFrac( nNullDate, nLastCoup, nMat, nBase ) * fFreq;
+ double fDSCi = GetYearFrac( nNullDate, nSettle, nMat, nBase ) * fFreq;
+ double fAi = GetYearFrac( nNullDate, nLastCoup, nSettle, nBase ) * fFreq;
+
+ double y = fRedemp + fDCi * 100.0 * fRate / fFreq;
+ y /= fPrice + fAi * 100.0 * fRate / fFreq;
+ y--;
+ y *= fFreq / fDSCi;
+
+ return y;
+}
+
+
+double GetRmz( double fZins, double fZzr, double fBw, double fZw, sal_Int32 nF )
+{
+ double fRmz;
+ if( fZins == 0.0 )
+ fRmz = ( fBw + fZw ) / fZzr;
+ else
+ {
+ double fTerm = pow( 1.0 + fZins, fZzr );
+ if( nF > 0 )
+ fRmz = ( fZw * fZins / ( fTerm - 1.0 ) + fBw * fZins / ( 1.0 - 1.0 / fTerm ) ) / ( 1.0 + fZins );
+ else
+ fRmz = fZw * fZins / ( fTerm - 1.0 ) + fBw * fZins / ( 1.0 - 1.0 / fTerm );
+ }
+
+ return -fRmz;
+}
+
+
+double GetZw( double fZins, double fZzr, double fRmz, double fBw, sal_Int32 nF )
+{
+ double fZw;
+ if( fZins == 0.0 )
+ fZw = fBw + fRmz * fZzr;
+ else
+ {
+ double fTerm = pow( 1.0 + fZins, fZzr );
+ if( nF > 0 )
+ fZw = fBw * fTerm + fRmz * ( 1.0 + fZins ) * ( fTerm - 1.0 ) / fZins;
+ else
+ fZw = fBw * fTerm + fRmz * ( fTerm - 1.0 ) / fZins;
+ }
+
+ return -fZw;
+}
+
+
+/*double TBillYield( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fPrice ) THROWDEF_RTE_IAE
+{
+ sal_Int32 nDiff = GetDiffDate360( xOpt, nSettle, nMat, sal_True );
+
+ if( fPrice <= 0.0 || nSettle >= nMat || nDiff > 360 )
+ THROW_IAE;
+
+ double fRet = 100.0;
+ fRet /= fPrice;
+ fRet--;
+ fRet *= double( nDiff );
+ fRet /= 360.0;
+
+ return fRet;
+}*/
+
+
+//-----------------------------------------------------------------------------
+// financial functions COUP***
+
+
+//-------
+// COUPPCD: find last coupon date before settlement (can be equal to settlement)
+void lcl_GetCouppcd( ScaDate& rDate, const ScaDate& rSettle, const ScaDate& rMat, sal_Int32 nFreq )
+ throw( lang::IllegalArgumentException )
+{
+ rDate = rMat;
+ rDate.setYear( rSettle.getYear() );
+ if( rDate < rSettle )
+ rDate.addYears( 1 );
+ while( rDate > rSettle )
+ rDate.addMonths( -12 / nFreq );
+}
+
+double GetCouppcd( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, sal_Int32 nBase )
+ THROWDEF_RTE_IAE
+{
+ if( nSettle >= nMat || CHK_Freq )
+ THROW_IAE;
+
+ ScaDate aDate;
+ lcl_GetCouppcd( aDate, ScaDate( nNullDate, nSettle, nBase ), ScaDate( nNullDate, nMat, nBase ), nFreq );
+ return aDate.getDate( nNullDate );
+}
+
+
+//-------
+// COUPNCD: find first coupon date after settlement (is never equal to settlement)
+void lcl_GetCoupncd( ScaDate& rDate, const ScaDate& rSettle, const ScaDate& rMat, sal_Int32 nFreq )
+ throw( lang::IllegalArgumentException )
+{
+ rDate = rMat;
+ rDate.setYear( rSettle.getYear() );
+ if( rDate > rSettle )
+ rDate.addYears( -1 );
+ while( rDate <= rSettle )
+ rDate.addMonths( 12 / nFreq );
+}
+
+double GetCoupncd( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, sal_Int32 nBase )
+ THROWDEF_RTE_IAE
+{
+ if( nSettle >= nMat || CHK_Freq )
+ THROW_IAE;
+
+ ScaDate aDate;
+ lcl_GetCoupncd( aDate, ScaDate( nNullDate, nSettle, nBase ), ScaDate( nNullDate, nMat, nBase ), nFreq );
+ return aDate.getDate( nNullDate );
+}
+
+
+//-------
+// COUPDAYBS: get day count: coupon date before settlement <-> settlement
+double GetCoupdaybs( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, sal_Int32 nBase )
+ THROWDEF_RTE_IAE
+{
+ if( nSettle >= nMat || CHK_Freq )
+ THROW_IAE;
+
+ ScaDate aSettle( nNullDate, nSettle, nBase );
+ ScaDate aDate;
+ lcl_GetCouppcd( aDate, aSettle, ScaDate( nNullDate, nMat, nBase ), nFreq );
+ return ScaDate::getDiff( aDate, aSettle );
+}
+
+
+//-------
+// COUPDAYSNC: get day count: settlement <-> coupon date after settlement
+double GetCoupdaysnc( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, sal_Int32 nBase )
+ THROWDEF_RTE_IAE
+{
+ if( nSettle >= nMat || CHK_Freq )
+ THROW_IAE;
+
+ if( (nBase != 0) && (nBase != 4) )
+ {
+ ScaDate aSettle( nNullDate, nSettle, nBase );
+ ScaDate aDate;
+ lcl_GetCoupncd( aDate, aSettle, ScaDate( nNullDate, nMat, nBase ), nFreq );
+ return ScaDate::getDiff( aSettle, aDate );
+ }
+ return GetCoupdays( nNullDate, nSettle, nMat, nFreq, nBase ) - GetCoupdaybs( nNullDate, nSettle, nMat, nFreq, nBase );
+}
+
+
+//-------
+// COUPDAYS: get day count: coupon date before settlement <-> coupon date after settlement
+double GetCoupdays( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, sal_Int32 nBase )
+ THROWDEF_RTE_IAE
+{
+ if( nSettle >= nMat || CHK_Freq )
+ THROW_IAE;
+
+ if( nBase == 1 )
+ {
+ ScaDate aDate;
+ lcl_GetCouppcd( aDate, ScaDate( nNullDate, nSettle, nBase ), ScaDate( nNullDate, nMat, nBase ), nFreq );
+ ScaDate aNextDate( aDate );
+ aNextDate.addMonths( 12 / nFreq );
+ return ScaDate::getDiff( aDate, aNextDate );
+ }
+ return static_cast< double >( GetDaysInYear( 0, 0, nBase ) ) / nFreq;
+}
+
+
+//-------
+// COUPNUM: get count of coupon dates
+double GetCoupnum( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, sal_Int32 nBase )
+ THROWDEF_RTE_IAE
+{
+ if( nSettle >= nMat || CHK_Freq )
+ THROW_IAE;
+
+ ScaDate aMat( nNullDate, nMat, nBase );
+ ScaDate aDate;
+ lcl_GetCouppcd( aDate, ScaDate( nNullDate, nSettle, nBase ), aMat, nFreq );
+ sal_uInt16 nMonths = (aMat.getYear() - aDate.getYear()) * 12 + aMat.getMonth() - aDate.getMonth();
+ return static_cast< double >( nMonths * nFreq / 12 );
+}
+
+
+
+
+
+
+
+const sal_uInt32 MyList::nStartSize = 16;
+const sal_uInt32 MyList::nIncrSize = 16;
+
+
+void MyList::_Grow( void )
+{
+ nSize += nIncrSize;
+
+ void** pNewData = new void*[ nSize ];
+ memcpy( pNewData, pData, nNew * sizeof( void* ) );
+
+ delete[] pData;
+ pData = pNewData;
+}
+
+
+MyList::MyList( void )
+{
+ nSize = nStartSize;
+ pData = new void*[ nSize ];
+ nNew = nAct = 0;
+}
+
+
+MyList::~MyList()
+{
+ delete[] pData;
+}
+
+
+void MyList::Insert( void* p, sal_uInt32 n )
+{
+ if( n >= nNew )
+ Append( p );
+ else
+ {
+ Grow();
+
+ void** pIns = pData + n;
+ memmove( pIns + 1, pIns, ( nNew - n ) * sizeof( void* ) );
+
+ *pIns = p;
+
+ nNew++;
+ }
+}
+
+
+
+
+StringList::~StringList()
+{
+ for( STRING* p = ( STRING* ) First() ; p ; p = ( STRING* ) Next() )
+ delete p;
+}
+
+
+class AnalysisRscStrArrLoader : public Resource
+{
+private:
+ ResStringArray aStrArray;
+public:
+ AnalysisRscStrArrLoader( sal_uInt16 nRsc, sal_uInt16 nArrayId, ResMgr& rResMgr ) :
+ Resource( AnalysisResId( nRsc, rResMgr ) ),
+ aStrArray( AnalysisResId( nArrayId, rResMgr ) )
+ {
+ FreeResource();
+ }
+
+ const ResStringArray& GetStringArray() const { return aStrArray; }
+};
+
+
+
+
+FuncData::FuncData( const FuncDataBase& r, ResMgr& rResMgr ) :
+ aIntName( OUString::createFromAscii( r.pIntName ) ),
+ nUINameID( r.nUINameID ),
+ nDescrID( r.nDescrID ),
+ bDouble( r.bDouble ),
+ bWithOpt( r.bWithOpt ),
+ nParam( r.nNumOfParams ),
+ nCompID( r.nCompListID ),
+ eCat( r.eCat )
+{
+ AnalysisRscStrArrLoader aArrLoader( RID_ANALYSIS_DEFFUNCTION_NAMES, nCompID, rResMgr );
+// ResStringArray aDefFuncNameArray( AnalysisResId( nCompID, rResMgr ) );
+ const ResStringArray& rArr = aArrLoader.GetStringArray();
+
+ sal_uInt16 nCount = sal::static_int_cast<sal_uInt16>( rArr.Count() );
+ sal_uInt16 n;
+
+ for( n = 0 ; n < nCount ; n++ )
+ aCompList.Append( rArr.GetString( n ) );
+}
+
+
+FuncData::~FuncData()
+{
+}
+
+
+sal_uInt16 FuncData::GetStrIndex( sal_uInt16 nParamNum ) const
+{
+ if( !bWithOpt )
+ nParamNum++;
+
+ if( nParamNum > nParam )
+ return nParam * 2;
+ else
+ return nParamNum * 2;
+}
+
+
+
+
+FuncDataList::FuncDataList( ResMgr& rResMgr )
+{
+ const sal_uInt32 nNum = sizeof( pFuncDatas ) / sizeof( FuncDataBase );
+
+ for( sal_uInt16 n = 0 ; n < nNum ; n++ )
+ Append( new FuncData( pFuncDatas[ n ], rResMgr ) );
+}
+
+
+FuncDataList::~FuncDataList()
+{
+ for( FuncData* p = ( FuncData* ) First() ; p ; p = ( FuncData* ) Next() )
+ delete p;
+}
+
+
+const FuncData* FuncDataList::Get( const OUString& aProgrammaticName ) const
+{
+ if( aLastName == aProgrammaticName )
+ return Get( nLast );
+
+ ( ( FuncDataList* ) this )->aLastName = aProgrammaticName;
+
+ sal_uInt32 nE = Count();
+ for( sal_uInt32 n = 0 ; n < nE ; n++ )
+ {
+ const FuncData* p = Get( n );
+ if( p->Is( aProgrammaticName ) )
+ {
+ ( ( FuncDataList* ) this )->nLast = n;
+ return p;
+ }
+ }
+
+ ( ( FuncDataList* ) this )->nLast = 0xFFFFFFFF;
+ return NULL;
+}
+
+
+AnalysisResId::AnalysisResId( sal_uInt16 nId, ResMgr& rResMgr ) : ResId( nId, rResMgr )
+{
+}
+
+
+
+
+SortedIndividualInt32List::SortedIndividualInt32List()
+{
+}
+
+
+SortedIndividualInt32List::~SortedIndividualInt32List()
+{
+}
+
+
+void SortedIndividualInt32List::Insert( sal_Int32 nDay )
+{
+ sal_uInt32 nIndex = Count();
+ while( nIndex )
+ {
+ nIndex--;
+ sal_Int32 nRef = Get( nIndex );
+ if( nDay == nRef )
+ return;
+ else if( nDay > nRef )
+ {
+ MyList::Insert( (void*) nDay, nIndex + 1 );
+ return;
+ }
+ }
+ MyList::Insert( (void*) nDay, 0UL );
+}
+
+
+void SortedIndividualInt32List::Insert( sal_Int32 nDay, sal_Int32 nNullDate, sal_Bool bInsertOnWeekend )
+{
+ if( !nDay )
+ return;
+
+ nDay += nNullDate;
+ if( bInsertOnWeekend || (GetDayOfWeek( nDay ) < 5) )
+ Insert( nDay );
+}
+
+
+void SortedIndividualInt32List::Insert(
+ double fDay, sal_Int32 nNullDate, sal_Bool bInsertOnWeekend ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ if( (fDay < -2147483648.0) || (fDay > 2147483649.0) )
+ throw lang::IllegalArgumentException();
+ Insert( static_cast< sal_Int32 >( fDay ), nNullDate, bInsertOnWeekend );
+}
+
+
+sal_Bool SortedIndividualInt32List::Find( sal_Int32 nVal ) const
+{
+ sal_uInt32 nE = Count();
+
+ if( !nE || nVal < Get( 0 ) || nVal > Get( nE - 1 ) )
+ return sal_False;
+
+ // linear search
+
+ for( sal_uInt32 n = 0 ; n < nE ; n++ )
+ {
+ sal_Int32 nRef = Get( n );
+
+ if( nRef == nVal )
+ return sal_True;
+ else if( nRef > nVal )
+ return sal_False;
+ }
+ return sal_False;
+}
+
+
+void SortedIndividualInt32List::InsertHolidayList(
+ const ScaAnyConverter& rAnyConv,
+ const uno::Any& rHolAny,
+ sal_Int32 nNullDate,
+ sal_Bool bInsertOnWeekend ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ double fDay;
+ if( rAnyConv.getDouble( fDay, rHolAny ) )
+ Insert( fDay, nNullDate, bInsertOnWeekend );
+}
+
+
+void SortedIndividualInt32List::InsertHolidayList(
+ ScaAnyConverter& rAnyConv,
+ const uno::Reference< beans::XPropertySet >& xOptions,
+ const uno::Any& rHolAny,
+ sal_Int32 nNullDate,
+ sal_Bool bInsertOnWeekend ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ rAnyConv.init( xOptions );
+ if( rHolAny.getValueTypeClass() == uno::TypeClass_SEQUENCE )
+ {
+ uno::Sequence< uno::Sequence< uno::Any > > aAnySeq;
+ if( rHolAny >>= aAnySeq )
+ {
+ const uno::Sequence< uno::Any >* pSeqArray = aAnySeq.getConstArray();
+ for( sal_Int32 nIndex1 = 0; nIndex1 < aAnySeq.getLength(); nIndex1++ )
+ {
+ const uno::Sequence< uno::Any >& rSubSeq = pSeqArray[ nIndex1 ];
+ const uno::Any* pAnyArray = rSubSeq.getConstArray();
+
+ for( sal_Int32 nIndex2 = 0; nIndex2 < rSubSeq.getLength(); nIndex2++ )
+ InsertHolidayList( rAnyConv, pAnyArray[ nIndex2 ], nNullDate, bInsertOnWeekend );
+ }
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ else
+ InsertHolidayList( rAnyConv, rHolAny, nNullDate, bInsertOnWeekend );
+}
+
+
+
+//-----------------------------------------------------------------------------
+
+ScaDoubleList::~ScaDoubleList()
+{
+ for( double* pDbl = const_cast< double* >( First() ); pDbl; pDbl = const_cast< double* >( Next() ) )
+ delete pDbl;
+}
+
+
+void ScaDoubleList::Append(
+ const uno::Sequence< uno::Sequence< double > >& rValueSeq ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ const uno::Sequence< double >* pSeqArray = rValueSeq.getConstArray();
+ for( sal_Int32 nIndex1 = 0; nIndex1 < rValueSeq.getLength(); nIndex1++ )
+ {
+ const uno::Sequence< double >& rSubSeq = pSeqArray[ nIndex1 ];
+ const double* pArray = rSubSeq.getConstArray();
+ for( sal_Int32 nIndex2 = 0; nIndex2 < rSubSeq.getLength(); nIndex2++ )
+ Append( pArray[ nIndex2 ] );
+ }
+}
+
+
+void ScaDoubleList::Append(
+ const uno::Sequence< uno::Sequence< sal_Int32 > >& rValueSeq ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ const uno::Sequence< sal_Int32 >* pSeqArray = rValueSeq.getConstArray();
+ for( sal_Int32 nIndex1 = 0; nIndex1 < rValueSeq.getLength(); nIndex1++ )
+ {
+ const uno::Sequence< sal_Int32 >& rSubSeq = pSeqArray[ nIndex1 ];
+ const sal_Int32* pArray = rSubSeq.getConstArray();
+ for( sal_Int32 nIndex2 = 0; nIndex2 < rSubSeq.getLength(); nIndex2++ )
+ Append( pArray[ nIndex2 ] );
+ }
+}
+
+
+
+void ScaDoubleList::Append(
+ const ScaAnyConverter& rAnyConv,
+ const uno::Any& rAny,
+ sal_Bool bIgnoreEmpty ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ if( rAny.getValueTypeClass() == uno::TypeClass_SEQUENCE )
+ Append( rAnyConv, *static_cast< const uno::Sequence< uno::Sequence< uno::Any > >* >( rAny.getValue() ), bIgnoreEmpty );
+ else
+ {
+ double fValue;
+ if( rAnyConv.getDouble( fValue, rAny ) )
+ Append( fValue );
+ else if( !bIgnoreEmpty )
+ Append( 0.0 );
+ }
+}
+
+
+void ScaDoubleList::Append(
+ const ScaAnyConverter& rAnyConv,
+ const uno::Sequence< uno::Any >& rAnySeq,
+ sal_Bool bIgnoreEmpty ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ const uno::Any* pArray = rAnySeq.getConstArray();
+ for( sal_Int32 nIndex = 0; nIndex < rAnySeq.getLength(); nIndex++ )
+ Append( rAnyConv, pArray[ nIndex ], bIgnoreEmpty );
+}
+
+
+void ScaDoubleList::Append(
+ const ScaAnyConverter& rAnyConv,
+ const uno::Sequence< uno::Sequence< uno::Any > >& rAnySeq,
+ sal_Bool bIgnoreEmpty ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ const uno::Sequence< uno::Any >* pArray = rAnySeq.getConstArray();
+ for( sal_Int32 nIndex = 0; nIndex < rAnySeq.getLength(); nIndex++ )
+ Append( rAnyConv, pArray[ nIndex ], bIgnoreEmpty );
+}
+
+
+
+void ScaDoubleList::Append(
+ ScaAnyConverter& rAnyConv,
+ const uno::Reference< beans::XPropertySet >& xOpt,
+ const uno::Sequence< uno::Any >& rAnySeq,
+ sal_Bool bIgnoreEmpty ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ rAnyConv.init( xOpt );
+ Append( rAnyConv, rAnySeq, bIgnoreEmpty );
+}
+
+
+sal_Bool ScaDoubleList::CheckInsert( double ) const throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ return sal_True;
+}
+
+
+
+//-----------------------------------------------------------------------------
+
+sal_Bool ScaDoubleListGT0::CheckInsert( double fValue ) const throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ if( fValue < 0.0 )
+ throw lang::IllegalArgumentException();
+ return fValue > 0.0;
+}
+
+
+
+//-----------------------------------------------------------------------------
+
+sal_Bool ScaDoubleListGE0::CheckInsert( double fValue ) const throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ if( fValue < 0.0 )
+ throw lang::IllegalArgumentException();
+ return sal_True;
+}
+
+
+
+//-----------------------------------------------------------------------------
+
+Complex::Complex( const STRING& rStr ) THROWDEF_RTE_IAE
+{
+ if( !ParseString( rStr, *this ) )
+ THROW_IAE;
+}
+
+
+inline sal_Bool Complex::IsImagUnit( sal_Unicode c )
+{
+ return c == 'i' || c == 'j';
+}
+
+sal_Bool Complex::ParseString( const STRING& rStr, Complex& rCompl )
+{
+ rCompl.c = '\0'; // do not force a symbol, if only real part present
+
+ const sal_Unicode* pStr = ( const sal_Unicode * ) rStr;
+
+ if( IsImagUnit( *pStr ) && rStr.getLength() == 1)
+ {
+ rCompl.r = 0.0;
+ rCompl.i = 1.0;
+ rCompl.c = *pStr;
+ return sal_True;
+ }
+
+ double f;
+
+ if( !ParseDouble( pStr, f ) )
+ return sal_False;
+
+ switch( *pStr )
+ {
+ case '-': // imag part follows
+ case '+':
+ {
+ double r = f;
+ if( IsImagUnit( pStr[ 1 ] ) )
+ {
+ rCompl.c = pStr[ 1 ];
+ if( pStr[ 2 ] == 0 )
+ {
+ rCompl.r = f;
+ rCompl.i = ( *pStr == '+' )? 1.0 : -1.0;
+ return sal_True;
+ }
+ }
+ else if( ParseDouble( pStr, f ) && IsImagUnit( *pStr ) )
+ {
+ rCompl.c = *pStr;
+ pStr++;
+ if( *pStr == 0 )
+ {
+ rCompl.r = r;
+ rCompl.i = f;
+ return sal_True;
+ }
+ }
+ }
+ break;
+ case 'j':
+ case 'i':
+ rCompl.c = *pStr;
+ pStr++;
+ if( *pStr == 0 )
+ {
+ rCompl.i = f;
+ rCompl.r = 0.0;
+ return sal_True;
+ }
+ break;
+ case 0: // only real-part
+ rCompl.r = f;
+ rCompl.i = 0.0;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+
+STRING Complex::GetString() const THROWDEF_RTE_IAE
+{
+ static const String aI( 'i' );
+ static const String aJ( 'j' );
+ static const String aPlus( '+' );
+ static const String aMinus( '-' );
+
+ CHK_FINITE(r);
+ CHK_FINITE(i);
+ STRING aRet;
+
+ bool bHasImag = i != 0.0;
+ bool bHasReal = !bHasImag || (r != 0.0);
+
+ if( bHasReal )
+ aRet = ::GetString( r );
+ if( bHasImag )
+ {
+ if( i == 1.0 )
+ {
+ if( bHasReal )
+ aRet += aPlus;
+ }
+ else if( i == -1.0 )
+ aRet += aMinus;
+ else
+ aRet += ::GetString( i, bHasReal );
+ aRet += (c != 'j') ? aI : aJ;
+ }
+
+ return aRet;
+}
+
+
+double Complex::Arg( void ) const THROWDEF_RTE_IAE
+{
+ if( r == 0.0 && i == 0.0 )
+ THROW_IAE;
+
+ double phi = acos( r / Abs() );
+
+ if( i < 0.0 )
+ phi = -phi;
+
+ return phi;
+}
+
+
+void Complex::Power( double fPower ) THROWDEF_RTE_IAE
+{
+ if( r == 0.0 && i == 0.0 )
+ {
+ if( fPower > 0 )
+ {
+ r = i = 0.0;
+ return;
+ }
+ else
+ THROW_IAE;
+ }
+
+ double p, phi;
+
+ p = Abs();
+
+ phi = acos( r / p );
+ if( i < 0.0 )
+ phi = -phi;
+
+ p = pow( p, fPower );
+ phi *= fPower;
+
+ r = cos( phi ) * p;
+ i = sin( phi ) * p;
+}
+
+
+void Complex::Sqrt( void )
+{
+ static const double fMultConst = 0.7071067811865475; // ...2440084436210485 = 1/sqrt(2)
+ double p = Abs();
+ double i_ = sqrt( p - r ) * fMultConst;
+
+ r = sqrt( p + r ) * fMultConst;
+ i = ( i < 0.0 )? -i_ : i_;
+}
+
+
+inline BOOL SinOverflow( double f )
+{
+ return fabs( f ) >= 134217728;
+}
+
+
+void Complex::Sin( void ) THROWDEF_RTE_IAE
+{
+ if( SinOverflow( r ) )
+ THROW_IAE;
+
+ if( i )
+ {
+ double r_;
+
+ r_ = sin( r ) * cosh( i );
+ i = cos( r ) * sinh( i );
+ r = r_;
+ }
+ else
+ r = sin( r );
+}
+
+
+void Complex::Cos( void ) THROWDEF_RTE_IAE
+{
+ if( SinOverflow( r ) )
+ THROW_IAE;
+
+ if( i )
+ {
+ double r_;
+
+ r_ = cos( r ) * cosh( i );
+ i = -( sin( r ) * sinh( i ) );
+ r = r_;
+ }
+ else
+ r = cos( r );
+}
+
+
+void Complex::Div( const Complex& z ) THROWDEF_RTE_IAE
+{
+ if( z.r == 0 && z.i == 0 )
+ THROW_IAE;
+
+ double a1 = r;
+ double a2 = z.r;
+ double b1 = i;
+ double b2 = z.i;
+
+ double f = 1.0 / ( a2 * a2 + b2 * b2 );
+
+ r = ( a1 * a2 + b1 * b2 ) * f;
+ i = ( a2 * b1 - a1 * b2 ) * f;
+
+ if( !c ) c = z.c;
+}
+
+
+void Complex::Exp( void )
+{
+ double fE = exp( r );
+ r = fE * cos( i );
+ i = fE * sin( i );
+}
+
+
+void Complex::Ln( void ) THROWDEF_RTE_IAE
+{
+ if( r == 0.0 && i == 0.0 )
+ THROW_IAE;
+
+ double fAbs = Abs();
+ sal_Bool bNegi = i < 0.0;
+
+ i = acos( r / fAbs );
+
+ if( bNegi )
+ i = -i;
+
+ r = log( fAbs );
+}
+
+
+void Complex::Log10( void ) THROWDEF_RTE_IAE
+{
+ Ln();
+ Mult( 0.434294481903251828 ); // * log10( e )
+}
+
+
+void Complex::Log2( void ) THROWDEF_RTE_IAE
+{
+ Ln();
+ Mult( 1.442695040888963407 ); // * log2( e )
+}
+
+
+
+
+ComplexList::~ComplexList()
+{
+ for( Complex* p = ( Complex* ) First() ; p ; p = ( Complex* ) Next() )
+ delete p;
+}
+
+
+void ComplexList::Append( const SEQSEQ( STRING )& r, ComplListAppendHandl eAH ) THROWDEF_RTE_IAE
+{
+ sal_Int32 n1, n2;
+ sal_Int32 nE1 = r.getLength();
+ sal_Int32 nE2;
+ sal_Bool bEmpty0 = eAH == AH_EmpyAs0;
+ sal_Bool bErrOnEmpty = eAH == AH_EmptyAsErr;
+
+ for( n1 = 0 ; n1 < nE1 ; n1++ )
+ {
+ const SEQ( STRING )& rList = r[ n1 ];
+ nE2 = rList.getLength();
+
+ for( n2 = 0 ; n2 < nE2 ; n2++ )
+ {
+ const STRING& rStr = rList[ n2 ];
+
+ if( rStr.getLength() )
+ Append( new Complex( rStr ) );
+ else if( bEmpty0 )
+ Append( new Complex( 0.0 ) );
+ else if( bErrOnEmpty )
+ THROW_IAE;
+ }
+ }
+}
+
+
+void ComplexList::Append( const SEQ( ANY )& aMultPars, ComplListAppendHandl eAH ) THROWDEF_RTE_IAE
+{
+ sal_Int32 nEle = aMultPars.getLength();
+ sal_Bool bEmpty0 = eAH == AH_EmpyAs0;
+ sal_Bool bErrOnEmpty = eAH == AH_EmptyAsErr;
+
+ for( sal_Int32 i = 0 ; i < nEle ; i++ )
+ {
+ const ANY& r = aMultPars[ i ];
+ switch( r.getValueTypeClass() )
+ {
+ case uno::TypeClass_VOID: break;
+ case uno::TypeClass_STRING:
+ {
+ const STRING* pStr = ( const STRING* ) r.getValue();
+
+ if( pStr->getLength() )
+ Append( new Complex( *( STRING* ) r.getValue() ) );
+ else if( bEmpty0 )
+ Append( new Complex( 0.0 ) );
+ else if( bErrOnEmpty )
+ THROW_IAE;
+ }
+ break;
+ case uno::TypeClass_DOUBLE:
+ Append( new Complex( *( double* ) r.getValue(), 0.0 ) );
+ break;
+ case uno::TypeClass_SEQUENCE:
+ {
+ SEQSEQ( ANY ) aValArr;
+ if( r >>= aValArr )
+ {
+ sal_Int32 nE = aValArr.getLength();
+ const SEQ( ANY )* pArr = aValArr.getConstArray();
+ for( sal_Int32 n = 0 ; n < nE ; n++ )
+ Append( pArr[ n ], eAH );
+ }
+ else
+ THROW_IAE;
+ }
+ break;
+ default:
+ THROW_IAE;
+ }
+ }
+}
+
+
+
+
+ConvertData::ConvertData( const sal_Char p[], double fC, ConvertDataClass e, sal_Bool bPrefSupport ) : aName( p, strlen( p ), RTL_TEXTENCODING_MS_1252 )
+{
+ fConst = fC;
+ eClass = e;
+ bPrefixSupport = bPrefSupport;
+}
+
+ConvertData::~ConvertData()
+{
+}
+
+
+sal_Int16 ConvertData::GetMatchingLevel( const STRING& rRef ) const
+{
+ STRING aStr = rRef;
+ sal_Int32 nLen = rRef.getLength();
+ sal_Int32 nIndex = rRef.lastIndexOf( '^' );
+ if( nIndex > 0 && nIndex == ( nLen - 2 ) )
+ {
+ const sal_Unicode* p = aStr.getStr();
+ aStr = STRING( p, nLen - 2 );
+ aStr += STRING( p[ nLen - 1 ] );
+ }
+ if( aName.equals( aStr ) )
+ return 0;
+ else
+ {
+ const sal_Unicode* p = aStr.getStr();
+
+ nLen = aStr.getLength();
+ bool bPref = IsPrefixSupport();
+ bool bOneChar = (bPref && nLen > 1 && (aName == p + 1));
+ if (bOneChar || (bPref && nLen > 2 && (aName == p + 2) &&
+ *p == 'd' && *(p+1) == 'a'))
+ {
+ sal_Int16 n;
+ switch( *p )
+ {
+ case 'y': n = -24; break; // yocto
+ case 'z': n = -21; break; // zepto
+ case 'a': n = -18; break;
+ case 'f': n = -15; break;
+ case 'p': n = -12; break;
+ case 'n': n = -9; break;
+ case 'u': n = -6; break;
+ case 'm': n = -3; break;
+ case 'c': n = -2; break;
+ case 'd':
+ {
+ if ( bOneChar )
+ n = -1; // deci
+ else
+ n = 1; // deca
+ }
+ break;
+ case 'e': n = 1; break;
+ case 'h': n = 2; break;
+ case 'k': n = 3; break;
+ case 'M': n = 6; break;
+ case 'G': n = 9; break;
+ case 'T': n = 12; break;
+ case 'P': n = 15; break;
+ case 'E': n = 18; break;
+ case 'Z': n = 21; break; // zetta
+ case 'Y': n = 24; break; // yotta
+ default:
+ n = INV_MATCHLEV;
+ }
+
+// We could weed some nonsense out, ODFF doesn't say so though.
+#if 0
+ if (n < 0 && Class() == CDC_Information)
+ n = INV_MATCHLEV; // milli-bits doesn't make sense
+#endif
+
+//! <HACK> #100616# "cm3" is not 10^-2 m^3 but 10^-6 m^3 !!! ------------------
+ if( n != INV_MATCHLEV )
+ {
+ sal_Unicode cLast = p[ aStr.getLength() - 1 ];
+ if( cLast == '2' )
+ n *= 2;
+ else if( cLast == '3' )
+ n *= 3;
+ }
+//! </HACK> -------------------------------------------------------------------
+
+ return n;
+ }
+ else if ( nLen > 2 && ( aName == p + 2 ) && ( Class() == CDC_Information ) )
+ {
+ const sal_Unicode* pStr = aStr.getStr();
+ if ( *(pStr + 1) != 'i')
+ return INV_MATCHLEV;
+ sal_Int16 n;
+ switch( *pStr )
+ {
+ case 'k': n = 10; break;
+ case 'M': n = 20; break;
+ case 'G': n = 30; break;
+ case 'T': n = 40; break;
+ case 'P': n = 50; break;
+ case 'E': n = 60; break;
+ case 'Z': n = 70; break;
+ case 'Y': n = 80; break;
+ default:
+ n = INV_MATCHLEV;
+ }
+ return n;
+ }
+ else
+ return INV_MATCHLEV;
+ }
+}
+
+
+double ConvertData::Convert(
+ double f, const ConvertData& r, sal_Int16 nLevFrom, sal_Int16 nLevTo ) const THROWDEF_RTE_IAE
+{
+ if( Class() != r.Class() )
+ THROW_IAE;
+
+ sal_Bool bBinFromLev = ( nLevFrom > 0 && ( nLevFrom % 10 ) == 0 );
+ sal_Bool bBinToLev = ( nLevTo > 0 && ( nLevTo % 10 ) == 0 );
+
+ if ( Class() == CDC_Information && ( bBinFromLev || bBinToLev ) )
+ {
+ if ( bBinFromLev && bBinToLev )
+ {
+ nLevFrom = sal::static_int_cast<sal_Int16>( nLevFrom - nLevTo );
+ f *= r.fConst / fConst;
+ if( nLevFrom )
+ f *= pow( 2.0, nLevFrom );
+ }
+ else if ( bBinFromLev )
+ f *= ( r.fConst / fConst ) * ( pow( 2.0, nLevFrom ) / pow( 10.0, nLevTo ) );
+ else
+ f *= ( r.fConst / fConst ) * ( pow( 10.0, nLevFrom ) / pow( 2.0, nLevTo ) );
+ return f;
+ }
+
+ nLevFrom = sal::static_int_cast<sal_Int16>( nLevFrom - nLevTo ); // effective level
+
+ f *= r.fConst / fConst;
+
+ if( nLevFrom )
+ f = ::rtl::math::pow10Exp( f, nLevFrom );
+
+ return f;
+}
+
+
+double ConvertData::ConvertToBase( double f, sal_Int16 n ) const
+{
+ return ::rtl::math::pow10Exp( f / fConst, n );
+}
+
+
+double ConvertData::ConvertFromBase( double f, sal_Int16 n ) const
+{
+ return ::rtl::math::pow10Exp( f * fConst, -n );
+}
+
+
+
+ConvertDataLinear::~ConvertDataLinear()
+{
+}
+
+double ConvertDataLinear::Convert(
+ double f, const ConvertData& r, sal_Int16 nLevFrom, sal_Int16 nLevTo ) const THROWDEF_RTE_IAE
+{
+ if( Class() != r.Class() )
+ THROW_IAE;
+
+// return ::rtl::math::round( r.ConvertFromBase( ConvertToBase( f, nLevFrom ), nLevTo ), 13 );
+ return r.ConvertFromBase( ConvertToBase( f, nLevFrom ), nLevTo );
+}
+
+
+double ConvertDataLinear::ConvertToBase( double f, sal_Int16 n ) const
+{
+ if( n )
+ f = ::rtl::math::pow10Exp( f, n );
+
+ f /= fConst;
+ f -= fOffs;
+
+ return f;
+}
+
+
+double ConvertDataLinear::ConvertFromBase( double f, sal_Int16 n ) const
+{
+ f += fOffs;
+ f *= fConst;
+
+ if( n )
+ f = ::rtl::math::pow10Exp( f, -n );
+
+ return f;
+}
+
+
+
+
+ConvertDataList::ConvertDataList( void )
+{
+#define NEWD(str,unit,cl) Append(new ConvertData(str,unit,cl))
+#define NEWDP(str,unit,cl) Append(new ConvertData(str,unit,cl,sal_True))
+#define NEWL(str,unit,offs,cl) Append(new ConvertDataLinear(str,unit,offs,cl))
+#define NEWLP(str,unit,offs,cl) Append(new ConvertDataLinear(str,unit,offs,cl,sal_True))
+
+ // *** are extra and not standard Excel Analysis Addin!
+
+ // MASS: 1 Gram is...
+ NEWDP( "g", 1.0000000000000000E00, CDC_Mass ); // Gram
+ NEWD( "sg", 6.8522050005347800E-05, CDC_Mass ); // Pieces
+ NEWD( "lbm", 2.2046229146913400E-03, CDC_Mass ); // Pound (commercial weight)
+ NEWDP( "u", 6.0221370000000000E23, CDC_Mass ); // U (atomic mass)
+ NEWD( "ozm", 3.5273971800362700E-02, CDC_Mass ); // Ounce (commercial weight)
+ NEWD( "stone", 1.574730e-04, CDC_Mass ); // *** Stone
+ NEWD( "ton", 1.102311e-06, CDC_Mass ); // *** Ton
+ NEWD( "grain", 1.543236E01, CDC_Mass ); // *** Grain
+ NEWD( "pweight", 7.054792E-01, CDC_Mass ); // *** Pennyweight
+ NEWD( "hweight", 1.968413E-05, CDC_Mass ); // *** Hundredweight
+ NEWD( "shweight", 2.204623E-05, CDC_Mass ); // *** Shorthundredweight
+ NEWD( "brton", 9.842065E-07, CDC_Mass ); // *** Gross Registered Ton
+ NEWD( "cwt", 2.2046226218487758E-05, CDC_Mass ); // U.S. (short) hundredweight
+ NEWD( "shweight", 2.2046226218487758E-05, CDC_Mass ); // U.S. (short) hundredweight also
+ NEWD( "uk_cwt", 1.9684130552221213E-05, CDC_Mass ); // Imperial hundredweight
+ NEWD( "lcwt", 1.9684130552221213E-05, CDC_Mass ); // Imperial hundredweight also
+ NEWD( "hweight", 1.9684130552221213E-05, CDC_Mass ); // Imperial hundredweight also
+ NEWD( "uk_ton", 9.8420652761106063E-07, CDC_Mass ); // Imperial ton
+ NEWD( "LTON", 9.8420652761106063E-07, CDC_Mass ); // Imperial ton also
+
+ // LENGTH: 1 Meter is...
+ NEWDP( "m", 1.0000000000000000E00, CDC_Length ); // Meter
+ NEWD( "mi", 6.2137119223733397E-04, CDC_Length ); // Britsh Mile 6,21371192237333969617434184363e-4
+ NEWD( "Nmi", 5.3995680345572354E-04, CDC_Length ); // Nautical Mile 5,39956803455723542116630669546e-4
+ NEWD( "in", 3.9370078740157480E01, CDC_Length ); // Inch 39,37007874015748031496062992126
+ NEWD( "ft", 3.2808398950131234E00, CDC_Length ); // Foot 3,2808398950131233595800524934383
+ NEWD( "yd", 1.0936132983377078E00, CDC_Length ); // Yard 1,0936132983377077865266841644794
+ NEWDP( "ang", 1.0000000000000000E10, CDC_Length ); // Angstroem
+ NEWD( "Pica", 2.8346456692913386E03, CDC_Length ); // Pica (1/72 Inch) 2834,6456692913385826771653543307
+ NEWD( "ell", 8.748906E-01, CDC_Length ); // *** Ell
+ NEWDP( "parsec", 3.240779E-17, CDC_Length ); // *** Parsec
+ NEWDP( "pc", 3.240779E-17, CDC_Length ); // *** Parsec also
+ NEWDP( "lightyear", 1.0570234557732930E-16, CDC_Length ); // *** Light Year
+ NEWDP( "ly", 1.0570234557732930E-16, CDC_Length ); // *** Light Year also
+ NEWD( "survey_mi", 6.2136994949494949E-04, CDC_Length ); // U.S. survey mile
+
+ // TIME: 1 Second is...
+ NEWD( "yr", 3.1688087814028950E-08, CDC_Time ); // Year
+ NEWD( "day", 1.1574074074074074E-05, CDC_Time ); // Day
+ NEWD( "d", 1.1574074074074074E-05, CDC_Time ); // Day also
+ NEWD( "hr", 2.7777777777777778E-04, CDC_Time ); // Hour
+ NEWD( "mn", 1.6666666666666667E-02, CDC_Time ); // Minute
+ NEWD( "min", 1.6666666666666667E-02, CDC_Time ); // Minute also
+ NEWDP( "sec", 1.0000000000000000E00, CDC_Time ); // Second
+ NEWDP( "s", 1.0000000000000000E00, CDC_Time ); // Second also
+
+ // PRESSURE: 1 Pascal is...
+ NEWDP( "Pa", 1.0000000000000000E00, CDC_Pressure ); // Pascal
+ NEWDP( "atm", 9.8692329999819300E-06, CDC_Pressure ); // Atmosphere
+ NEWDP( "at", 9.8692329999819300E-06, CDC_Pressure ); // Atmosphere also
+ NEWDP( "mmHg", 7.5006170799862700E-03, CDC_Pressure ); // mm Hg (Mercury)
+ NEWD( "Torr", 7.5006380000000000E-03, CDC_Pressure ); // *** Torr
+ NEWD( "psi", 1.4503770000000000E-04, CDC_Pressure ); // *** Psi
+
+ // FORCE: 1 Newton is...
+ NEWDP( "N", 1.0000000000000000E00, CDC_Force ); // Newton
+ NEWDP( "dyn", 1.0000000000000000E05, CDC_Force ); // Dyn
+ NEWDP( "dy", 1.0000000000000000E05, CDC_Force ); // Dyn also
+ NEWD( "lbf", 2.24808923655339E-01, CDC_Force ); // Pound-Force
+ NEWDP( "pond", 1.019716E02, CDC_Force ); // *** Pond
+
+ // ENERGY: 1 Joule is...
+ NEWDP( "J", 1.0000000000000000E00, CDC_Energy ); // Joule
+ NEWDP( "e", 1.0000000000000000E07, CDC_Energy ); // Erg -> http://www.chemie.fu-berlin.de/chemistry/general/si.html
+// NEWD( "e", 9.99999519343231E06, CDC_Energy ); // Erg
+ NEWDP( "c", 2.3900624947346700E-01, CDC_Energy ); // Thermodynamical Calorie
+ NEWDP( "cal", 2.3884619064201700E-01, CDC_Energy ); // Calorie
+ NEWDP( "eV", 6.2414570000000000E18, CDC_Energy ); // Electronvolt
+ NEWDP( "ev", 6.2414570000000000E18, CDC_Energy ); // Electronvolt also
+ NEWD( "HPh", 3.7250611111111111E-07, CDC_Energy ); // Horsepower Hours
+ NEWD( "hh", 3.7250611111111111E-07, CDC_Energy ); // Horsepower Hours also
+// NEWD( "HPh", 3.72506430801000E-07, CDC_Energy ); // Horsepower Hours
+ NEWDP( "Wh", 2.7777777777777778E-04, CDC_Energy ); // Watt Hours
+ NEWDP( "wh", 2.7777777777777778E-04, CDC_Energy ); // Watt Hours also
+ NEWD( "flb", 2.37304222192651E01, CDC_Energy ); // Foot Pound
+ NEWD( "BTU", 9.4781506734901500E-04, CDC_Energy ); // British Thermal Unit
+ NEWD( "btu", 9.4781506734901500E-04, CDC_Energy ); // British Thermal Unit also
+
+ // POWER: 1 Watt is...
+ NEWDP( "W", 1.0000000000000000E00, CDC_Power ); // Watt
+ NEWDP( "w", 1.0000000000000000E00, CDC_Power ); // Watt also
+ NEWD( "HP", 1.341022E-03, CDC_Power ); // Horsepower
+ NEWD( "h", 1.341022E-03, CDC_Power ); // Horsepower also
+ NEWD( "PS", 1.359622E-03, CDC_Power ); // *** German Pferdestaerke
+// NEWD( "HP", 1.4102006031908E-03, CDC_Power ); // Excel seams to be a little bit wrong... either this doesn't fit to J -> HPh
+
+ // MAGNETISM: 1 Tesla is...
+ NEWDP( "T", 1.0000000000000000E00, CDC_Magnetism ); // Tesla
+ NEWDP( "ga", 1.0000000000000000E04, CDC_Magnetism ); // Gauss
+
+ // TEMERATURE: 1 Kelvin is...
+ NEWL( "C", 1.0000000000000000E00, -2.7315000000000000E02, CDC_Temperature ); // Celsius
+ NEWL( "cel", 1.0000000000000000E00, -2.7315000000000000E02, CDC_Temperature ); // Celsius also
+ NEWL( "F", 1.8000000000000000E00, -2.5537222222222222E02, CDC_Temperature ); // Fahrenheit
+ NEWL( "fah", 1.8000000000000000E00, -2.5537222222222222E02, CDC_Temperature ); // Fahrenheit also
+ NEWLP( "K", 1.0000000000000000E00, +0.0000000000000000E00, CDC_Temperature ); // Kelvin
+ NEWLP( "kel", 1.0000000000000000E00, +0.0000000000000000E00, CDC_Temperature ); // Kelvin also
+ NEWL( "Reau", 8.0000000000000000E-01, -2.7315000000000000E02, CDC_Temperature ); // *** Reaumur
+ NEWL( "Rank", 1.8000000000000000E00, +0.0000000000000000E00, CDC_Temperature ); // *** Rankine
+
+ // VOLUMNE: 1 Liter is...
+ NEWD( "tsp", 2.0284000000000000E02, CDC_Volume ); // Teaspoon
+ NEWD( "tbs", 6.7613333333333333E01, CDC_Volume ); // Tablespoon
+ NEWD( "oz", 3.3806666666666667E01, CDC_Volume ); // Ounce Liquid
+ NEWD( "cup", 4.2258333333333333E00, CDC_Volume ); // Cup
+ NEWD( "pt", 2.1129166666666667E00, CDC_Volume ); // US Pint
+ NEWD( "us_pt", 2.1129166666666667E00, CDC_Volume ); // US Pint also
+ NEWD( "uk_pt", 1.75975569552166E00, CDC_Volume ); // UK Pint
+ NEWD( "qt", 1.0564583333333333E00, CDC_Volume ); // Quart
+ NEWD( "gal", 2.6411458333333333E-01, CDC_Volume ); // Gallone
+ NEWDP( "l", 1.0000000000000000E00, CDC_Volume ); // Liter
+ NEWDP( "L", 1.0000000000000000E00, CDC_Volume ); // Liter also
+ NEWDP( "lt", 1.0000000000000000E00, CDC_Volume ); // Liter also
+ NEWDP( "m3", 1.0000000000000000E-03, CDC_Volume ); // *** Cubic Meter
+ NEWD( "mi3", 2.3991275857892772E-13, CDC_Volume ); // *** Cubic Britsh Mile
+ NEWD( "Nmi3", 1.5742621468581148E-13, CDC_Volume ); // *** Cubic Nautical Mile
+ NEWD( "in3", 6.1023744094732284E01, CDC_Volume ); // *** Cubic Inch
+ NEWD( "ft3", 3.5314666721488590E-02, CDC_Volume ); // *** Cubic Foot
+ NEWD( "yd3", 1.3079506193143922E-03, CDC_Volume ); // *** Cubic Yard
+ NEWDP( "ang3", 1.0000000000000000E27, CDC_Volume ); // *** Cubic Angstroem
+ NEWD( "Pica3", 2.2776990435870636E07, CDC_Volume ); // *** Cubic Pica
+ NEWD( "barrel", 6.289811E-03, CDC_Volume ); // *** Barrel (=42gal?)
+ NEWD( "bushel", 2.837759E-02, CDC_Volume ); // *** Bushel
+ NEWD( "regton", 3.531467E-04, CDC_Volume ); // *** Register ton
+ NEWD( "GRT", 3.531467E-04, CDC_Volume ); // *** Register ton also
+ NEWD( "Schooner", 2.3529411764705882E00, CDC_Volume ); // *** austr. Schooner
+ NEWD( "Middy", 3.5087719298245614E00, CDC_Volume ); // *** austr. Middy
+ NEWD( "Glass", 5.0000000000000000E00, CDC_Volume ); // *** austr. Glass
+ NEWD( "Sixpack", 0.5, CDC_Volume ); // ***
+ NEWD( "Humpen", 2.0, CDC_Volume ); // ***
+ NEWD( "ly3", 1.1810108125623799E-51, CDC_Volume ); // *** Cubic light-year
+ NEWD( "MTON", 1.4125866688595436E00, CDC_Volume ); // *** Measurement ton
+ NEWD( "tspm", 5.0000000000000000E02, CDC_Volume ); // *** Modern teaspoon
+ NEWD( "uk_gal", 2.6411458333333333E-01, CDC_Volume ); // U.K. / Imperial gallon ??
+ NEWD( "uk_qt", 1.0564583333333333E00, CDC_Volume ); // U.K. / Imperial quart ??
+
+ // 1 Square Meter is...
+ NEWDP( "m2", 1.0000000000000000E00, CDC_Area ); // *** Square Meter
+ NEWD( "mi2", 3.8610215854244585E-07, CDC_Area ); // *** Square Britsh Mile
+ NEWD( "Nmi2", 2.9155334959812286E-07, CDC_Area ); // *** Square Nautical Mile
+ NEWD( "in2", 1.5500031000062000E03, CDC_Area ); // *** Square Inch
+ NEWD( "ft2", 1.0763910416709722E01, CDC_Area ); // *** Square Foot
+ NEWD( "yd2", 1.1959900463010803E00, CDC_Area ); // *** Square Yard
+ NEWDP( "ang2", 1.0000000000000000E20, CDC_Area ); // *** Square Angstroem
+ NEWD( "Pica2", 8.0352160704321409E06, CDC_Area ); // *** Square Pica
+ NEWD( "Morgen", 4.0000000000000000E-04, CDC_Area ); // *** Morgen
+ NEWDP( "ar", 1.000000E-02, CDC_Area ); // *** Ar
+ NEWD( "acre", 2.471053815E-04, CDC_Area ); // *** Acre
+ NEWD( "uk_acre", 2.4710538146716534E-04, CDC_Area ); // *** International acre
+ NEWD( "us_acre", 2.4710439304662790E-04, CDC_Area ); // *** U.S. survey/statute acre
+ NEWD( "ly2", 1.1172985860549147E-32, CDC_Area ); // *** Square Light-year
+ NEWD( "ha", 1.000000E-04, CDC_Area ); // *** Hectare
+ NEWD( "Quadratlatschen",5.6689342403628117914,CDC_Area ); // ***
+
+ // SPEED: 1 Meter per Second is...
+ NEWDP( "m/s", 1.0000000000000000E00, CDC_Speed ); // *** Meters per Second
+ NEWDP( "m/sec", 1.0000000000000000E00, CDC_Speed ); // *** Meters per Second also
+ NEWDP( "m/h", 3.6000000000000000E03, CDC_Speed ); // *** Meters per Hour
+ NEWDP( "m/hr", 3.6000000000000000E03, CDC_Speed ); // *** Meters per Hour also
+ NEWD( "mph", 2.2369362920544023E00, CDC_Speed ); // *** Britsh Miles per Hour
+ NEWD( "kn", 1.9438444924406048E00, CDC_Speed ); // *** Knot = Nautical Miles per Hour
+ NEWD( "admkn", 1.9438446603753486E00, CDC_Speed ); // *** Admiralty Knot
+ NEWD( "wahnsinnige Geschwindigkeit", 2.0494886343432328E-14, CDC_Speed ); // ***
+ NEWD( "ludicrous speed", 2.0494886343432328E-14, CDC_Speed ); // ***
+ NEWD( "laecherliche Geschwindigkeit", 4.0156958471424288E-06, CDC_Speed); // ***
+ NEWD( "ridiculous speed", 4.0156958471424288E-06, CDC_Speed); // ***
+
+ // INFORMATION: 1 Bit is...
+ NEWDP( "bit", 1.00E00, CDC_Information); // *** Bit
+ NEWDP( "byte", 1.25E-01, CDC_Information); // *** Byte
+}
+
+
+ConvertDataList::~ConvertDataList()
+{
+ for( ConvertData* p = First() ; p ; p = Next() )
+ delete p;
+}
+
+
+double ConvertDataList::Convert( double fVal, const STRING& rFrom, const STRING& rTo ) THROWDEF_RTE_IAE
+{
+// This will not catch illegal units
+// if( rFrom == rTo )
+// return fVal;
+
+ ConvertData* pFrom = NULL;
+ ConvertData* pTo = NULL;
+ sal_Bool bSearchFrom = sal_True;
+ sal_Bool bSearchTo = sal_True;
+ sal_Int16 nLevelFrom = 0;
+ sal_Int16 nLevelTo = 0;
+
+ ConvertData* p = First();
+ while( p && ( bSearchFrom || bSearchTo ) )
+ {
+ if( bSearchFrom )
+ {
+ sal_Int16 n = p->GetMatchingLevel( rFrom );
+ if( n != INV_MATCHLEV )
+ {
+ if( n )
+ { // only first match for partial equality rulz a little bit more
+ pFrom = p;
+ nLevelFrom = n;
+ }
+ else
+ { // ... but exact match rulz most
+ pFrom = p;
+ bSearchFrom = sal_False;
+ nLevelFrom = n;
+ }
+ }
+ }
+
+ if( bSearchTo )
+ {
+ sal_Int16 n = p->GetMatchingLevel( rTo );
+ if( n != INV_MATCHLEV )
+ {
+ if( n )
+ { // only first match for partial equality rulz a little bit more
+ pTo = p;
+ nLevelTo = n;
+ }
+ else
+ { // ... but exact match rulz most
+ pTo = p;
+ bSearchTo = sal_False;
+ nLevelTo = n;
+ }
+ }
+ }
+
+ p = Next();
+ }
+
+ if( pFrom && pTo )
+ return pFrom->Convert( fVal, *pTo, nLevelFrom, nLevelTo );
+ else
+ THROW_IAE;
+}
+
+
+
+//-----------------------------------------------------------------------------
+
+ScaDate::ScaDate() :
+ nOrigDay( 1 ),
+ nDay( 1 ),
+ nMonth( 1 ),
+ nYear( 1900 ),
+ bLastDayMode( sal_True ),
+ bLastDay( sal_False ),
+ b30Days( sal_False ),
+ bUSMode( sal_False )
+{
+}
+
+ScaDate::ScaDate( sal_Int32 nNullDate, sal_Int32 nDate, sal_Int32 nBase )
+{
+ DaysToDate( nNullDate + nDate, nOrigDay, nMonth, nYear );
+ bLastDayMode = (nBase != 5);
+ bLastDay = (nOrigDay >= ::DaysInMonth( nMonth, nYear ));
+ b30Days = (nBase == 0) || (nBase == 4);
+ bUSMode = (nBase == 0);
+ setDay();
+}
+
+ScaDate::ScaDate( const ScaDate& rCopy ) :
+ nOrigDay( rCopy.nOrigDay ),
+ nDay( rCopy.nDay ),
+ nMonth( rCopy.nMonth ),
+ nYear( rCopy.nYear ),
+ bLastDayMode( rCopy.bLastDayMode ),
+ bLastDay( rCopy.bLastDay ),
+ b30Days( rCopy.b30Days ),
+ bUSMode( rCopy.bUSMode )
+{
+}
+
+ScaDate& ScaDate::operator=( const ScaDate& rCopy )
+{
+ if( this != &rCopy )
+ {
+ nOrigDay = rCopy.nOrigDay;
+ nDay = rCopy.nDay;
+ nMonth = rCopy.nMonth;
+ nYear = rCopy.nYear;
+ bLastDayMode = rCopy.bLastDayMode;
+ bLastDay = rCopy.bLastDay;
+ b30Days = rCopy.b30Days;
+ bUSMode = rCopy.bUSMode;
+ }
+ return *this;
+}
+
+void ScaDate::setDay()
+{
+ if( b30Days )
+ {
+ // 30-days-mode: set nDay to 30 if original was last day in month
+ nDay = Min( nOrigDay, static_cast< sal_uInt16 >( 30 ) );
+ if( bLastDay || (nDay >= ::DaysInMonth( nMonth, nYear )) )
+ nDay = 30;
+ }
+ else
+ {
+ // set nDay to last day in this month if original was last day
+ sal_uInt16 nLastDay = ::DaysInMonth( nMonth, nYear );
+ nDay = bLastDay ? nLastDay : Min( nOrigDay, nLastDay );
+ }
+}
+
+sal_Int32 ScaDate::getDaysInMonthRange( sal_uInt16 nFrom, sal_uInt16 nTo ) const
+{
+ if( nFrom > nTo )
+ return 0;
+
+ sal_Int32 nRet = 0;
+ if( b30Days )
+ nRet = (nTo - nFrom + 1) * 30;
+ else
+ {
+ for( sal_uInt16 nMonthIx = nFrom; nMonthIx <= nTo; ++nMonthIx )
+ nRet += getDaysInMonth( nMonthIx );
+ }
+ return nRet;
+}
+
+sal_Int32 ScaDate::getDaysInYearRange( sal_uInt16 nFrom, sal_uInt16 nTo ) const
+{
+ if( nFrom > nTo )
+ return 0;
+
+ return b30Days ? ((nTo - nFrom + 1) * 360) : ::GetDaysInYears( nFrom, nTo );
+}
+
+void ScaDate::doAddYears( sal_Int32 nYearCount ) throw( lang::IllegalArgumentException )
+{
+ sal_Int32 nNewYear = nYearCount + nYear;
+ if( (nNewYear < 0) || (nNewYear > 0x7FFF) )
+ throw lang::IllegalArgumentException();
+ nYear = static_cast< sal_uInt16 >( nNewYear );
+}
+
+void ScaDate::addMonths( sal_Int32 nMonthCount ) throw( lang::IllegalArgumentException )
+{
+ sal_Int32 nNewMonth = nMonthCount + nMonth;
+ if( nNewMonth > 12 )
+ {
+ --nNewMonth;
+ doAddYears( nNewMonth / 12 );
+ nMonth = static_cast< sal_uInt16 >( nNewMonth % 12 ) + 1;
+ }
+ else if( nNewMonth < 1 )
+ {
+ doAddYears( nNewMonth / 12 - 1 );
+ nMonth = static_cast< sal_uInt16 >( nNewMonth % 12 + 12 );
+ }
+ else
+ nMonth = static_cast< sal_uInt16 >( nNewMonth );
+ setDay();
+}
+
+sal_Int32 ScaDate::getDate( sal_Int32 nNullDate ) const
+{
+ sal_uInt16 nLastDay = ::DaysInMonth( nMonth, nYear );
+ sal_uInt16 nRealDay = (bLastDayMode && bLastDay) ? nLastDay : Min( nLastDay, nOrigDay );
+ return ::DateToDays( nRealDay, nMonth, nYear ) - nNullDate;
+}
+
+sal_Int32 ScaDate::getDiff( const ScaDate& rFrom, const ScaDate& rTo ) throw( lang::IllegalArgumentException )
+{
+ if( rFrom > rTo )
+ return getDiff( rTo, rFrom );
+
+ sal_Int32 nDiff = 0;
+ ScaDate aFrom( rFrom );
+ ScaDate aTo( rTo );
+
+ if( rTo.b30Days )
+ {
+ // corrections for base 0 (US NASD)
+ if( rTo.bUSMode )
+ {
+ if( ((rFrom.nMonth == 2) || (rFrom.nDay < 30)) && (aTo.nOrigDay == 31) )
+ aTo.nDay = 31;
+ else if( (aTo.nMonth == 2) && aTo.bLastDay )
+ aTo.nDay = ::DaysInMonth( 2, aTo.nYear );
+ }
+ // corrections for base 4 (Europe)
+ else
+ {
+ if( (aFrom.nMonth == 2) && (aFrom.nDay == 30) )
+ aFrom.nDay = ::DaysInMonth( 2, aFrom.nYear );
+ if( (aTo.nMonth == 2) && (aTo.nDay == 30) )
+ aTo.nDay = ::DaysInMonth( 2, aTo.nYear );
+ }
+ }
+
+ if( (aFrom.nYear < aTo.nYear) || ((aFrom.nYear == aTo.nYear) && (aFrom.nMonth < aTo.nMonth)) )
+ {
+ // move aFrom to 1st day of next month
+ nDiff = aFrom.getDaysInMonth() - aFrom.nDay + 1;
+ aFrom.nOrigDay = aFrom.nDay = 1;
+ aFrom.bLastDay = sal_False;
+ aFrom.addMonths( 1 );
+
+ if( aFrom.nYear < aTo.nYear )
+ {
+ // move aFrom to 1st day of next year
+ nDiff += aFrom.getDaysInMonthRange( aFrom.nMonth, 12 );
+ aFrom.addMonths( 13 - aFrom.nMonth );
+
+ // move aFrom to 1st day of this year
+ nDiff += aFrom.getDaysInYearRange( aFrom.nYear, aTo.nYear - 1 );
+ aFrom.addYears( aTo.nYear - aFrom.nYear );
+ }
+
+ // move aFrom to 1st day of this month
+ nDiff += aFrom.getDaysInMonthRange( aFrom.nMonth, aTo.nMonth - 1 );
+ aFrom.addMonths( aTo.nMonth - aFrom.nMonth );
+ }
+ // finally add remaining days in this month
+ nDiff += aTo.nDay - aFrom.nDay;
+ return nDiff > 0 ? nDiff : 0;
+}
+
+sal_Bool ScaDate::operator<( const ScaDate& rCmp ) const
+{
+ if( nYear != rCmp.nYear )
+ return nYear < rCmp.nYear;
+ if( nMonth != rCmp.nMonth )
+ return nMonth < rCmp.nMonth;
+ if( nDay != rCmp.nDay )
+ return nDay < rCmp.nDay;
+ if( bLastDay || rCmp.bLastDay )
+ return !bLastDay && rCmp.bLastDay;
+ return nOrigDay < rCmp.nOrigDay;
+}
+
+
+
+//-----------------------------------------------------------------------------
+
+ScaAnyConverter::ScaAnyConverter( const uno::Reference< lang::XMultiServiceFactory >& xServiceFact ) :
+ bHasValidFormat( sal_False )
+{
+ if( xServiceFact.is() )
+ {
+ uno::Reference< uno::XInterface > xInstance = xServiceFact->createInstance(
+ OUString::createFromAscii( "com.sun.star.util.NumberFormatter" ) );
+ xFormatter = uno::Reference< util::XNumberFormatter >( xInstance, uno::UNO_QUERY );
+ }
+}
+
+ScaAnyConverter::~ScaAnyConverter()
+{
+}
+
+void ScaAnyConverter::init( const uno::Reference< beans::XPropertySet >& xPropSet ) throw( uno::RuntimeException )
+{
+ // try to get default number format
+ bHasValidFormat = sal_False;
+ if( xFormatter.is() )
+ {
+ // get XFormatsSupplier from outer XPropertySet
+ uno::Reference< util::XNumberFormatsSupplier > xFormatsSupp( xPropSet, uno::UNO_QUERY );
+ if( xFormatsSupp.is() )
+ {
+ // get XNumberFormatTypes from XNumberFormatsSupplier to get standard index
+ uno::Reference< util::XNumberFormats > xFormats( xFormatsSupp->getNumberFormats() );
+ uno::Reference< util::XNumberFormatTypes > xFormatTypes( xFormats, uno::UNO_QUERY );
+ if( xFormatTypes.is() )
+ {
+ lang::Locale eLocale;
+ nDefaultFormat = xFormatTypes->getStandardIndex( eLocale );
+ xFormatter->attachNumberFormatsSupplier( xFormatsSupp );
+ bHasValidFormat = sal_True;
+ }
+ }
+ }
+}
+
+double ScaAnyConverter::convertToDouble( const OUString& rString ) const throw( lang::IllegalArgumentException )
+{
+ double fValue = 0.0;
+ if( bHasValidFormat )
+ {
+ try
+ {
+ fValue = xFormatter->convertStringToNumber( nDefaultFormat, rString );
+ }
+ catch( uno::Exception& )
+ {
+ throw lang::IllegalArgumentException();
+ }
+ }
+ else
+ {
+ rtl_math_ConversionStatus eStatus;
+ sal_Int32 nEnd;
+ fValue = ::rtl::math::stringToDouble( rString, '.', ',', &eStatus, &nEnd );
+ if( (eStatus != rtl_math_ConversionStatus_Ok) || (nEnd < rString.getLength()) )
+ throw lang::IllegalArgumentException();
+ }
+ return fValue;
+}
+
+sal_Bool ScaAnyConverter::getDouble(
+ double& rfResult,
+ const uno::Any& rAny ) const throw( lang::IllegalArgumentException )
+{
+ rfResult = 0.0;
+ sal_Bool bContainsVal = sal_True;
+ switch( rAny.getValueTypeClass() )
+ {
+ case uno::TypeClass_VOID:
+ bContainsVal = sal_False;
+ break;
+ case uno::TypeClass_DOUBLE:
+ rAny >>= rfResult;
+ break;
+ case uno::TypeClass_STRING:
+ {
+ const OUString* pString = static_cast< const OUString* >( rAny.getValue() );
+ if( pString->getLength() )
+ rfResult = convertToDouble( *pString );
+ else
+ bContainsVal = sal_False;
+ }
+ break;
+ default:
+ throw lang::IllegalArgumentException();
+ }
+ return bContainsVal;
+}
+
+sal_Bool ScaAnyConverter::getDouble(
+ double& rfResult,
+ const uno::Reference< beans::XPropertySet >& xPropSet,
+ const uno::Any& rAny ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ init( xPropSet );
+ return getDouble( rfResult, rAny );
+}
+
+double ScaAnyConverter::getDouble(
+ const uno::Reference< beans::XPropertySet >& xPropSet,
+ const uno::Any& rAny,
+ double fDefault ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ double fResult;
+ if( !getDouble( fResult, xPropSet, rAny ) )
+ fResult = fDefault;
+ return fResult;
+}
+
+sal_Bool ScaAnyConverter::getInt32(
+ sal_Int32& rnResult,
+ const uno::Reference< beans::XPropertySet >& xPropSet,
+ const uno::Any& rAny ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ double fResult;
+ sal_Bool bContainsVal = getDouble( fResult, xPropSet, rAny );
+ if( (fResult <= -2147483649.0) || (fResult >= 2147483648.0) )
+ throw lang::IllegalArgumentException();
+
+ rnResult = static_cast< sal_Int32 >( fResult );
+ return bContainsVal;
+}
+
+sal_Int32 ScaAnyConverter::getInt32(
+ const uno::Reference< beans::XPropertySet >& xPropSet,
+ const uno::Any& rAny,
+ sal_Int32 nDefault ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ sal_Int32 nResult;
+ if( !getInt32( nResult, xPropSet, rAny ) )
+ nResult = nDefault;
+ return nResult;
+}
+
+
+
+//-----------------------------------------------------------------------------
+
+
diff --git a/scaddins/source/analysis/analysishelper.hxx b/scaddins/source/analysis/analysishelper.hxx
new file mode 100644
index 000000000000..d226a9a98be1
--- /dev/null
+++ b/scaddins/source/analysis/analysishelper.hxx
@@ -0,0 +1,1105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef ANALYSISHELPER_HXX
+#define ANALYSISHELPER_HXX
+
+
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/sheet/XAddIn.hpp>
+#include <com/sun/star/sheet/addin/XAnalysis.hpp>
+
+#include <math.h>
+
+#include <tools/resid.hxx>
+#include <tools/rc.hxx>
+
+#include "analysisdefs.hxx"
+
+
+class ResMgr;
+class SortedIndividualInt32List;
+class ScaAnyConverter;
+
+
+#define PI 3.1415926535897932
+#define PI_2 (PI/2.0)
+//#define EULER 2.7182818284590452
+#define EOL ( ( const sal_Char* ) 1 )
+#define EOE ( ( const sal_Char* ) 2 )
+
+
+//double _Test( sal_Int32 nMode, double f1, double f2, double f3 );
+inline sal_Bool IsLeapYear( sal_uInt16 nYear );
+sal_uInt16 DaysInMonth( sal_uInt16 nMonth, sal_uInt16 nYear );
+sal_Int32 DateToDays( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear );
+void DaysToDate( sal_Int32 nDays, sal_uInt16& rDay, sal_uInt16& rMonth, sal_uInt16& rYear ) throw( ::com::sun::star::lang::IllegalArgumentException );
+sal_Int32 GetNullDate( const REF( CSS::beans::XPropertySet )& xOptions ) THROWDEF_RTE;
+sal_Int32 GetDiffDate360(
+ sal_uInt16 nDay1, sal_uInt16 nMonth1, sal_uInt16 nYear1, sal_Bool bLeapYear1,
+ sal_uInt16 nDay2, sal_uInt16 nMonth2, sal_uInt16 nYear2,
+ sal_Bool bUSAMethod );
+inline sal_Int32 GetDiffDate360( constREFXPS& xOpt, sal_Int32 nDate1, sal_Int32 nDate2, sal_Bool bUSAMethod );
+sal_Int32 GetDiffDate360( sal_Int32 nNullDate, sal_Int32 nDate1, sal_Int32 nDate2, sal_Bool bUSAMethod );
+
+sal_Int32 GetDaysInYears( sal_uInt16 nYear1, sal_uInt16 nYear2 );
+inline sal_Int16 GetDayOfWeek( sal_Int32 nDate );
+void GetDiffParam( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode,
+ sal_uInt16& rYears, sal_Int32& rDayDiffPart, sal_Int32& rDaysInYear ) THROWDEF_RTE_IAE;
+ // rYears = full num of years
+ // rDayDiffPart = num of days for last year
+ // rDaysInYear = num of days in first year
+sal_Int32 GetDiffDate( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode,
+ sal_Int32* pOptDaysIn1stYear = NULL ) THROWDEF_RTE_IAE;
+double GetYearDiff( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode )
+ THROWDEF_RTE_IAE;
+sal_Int32 GetDaysInYear( sal_Int32 nNullDate, sal_Int32 nDate, sal_Int32 nMode ) THROWDEF_RTE_IAE;
+double GetYearFrac( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode )
+ THROWDEF_RTE_IAE;
+inline double GetYearFrac( constREFXPS& xOpt, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode )
+ THROWDEF_RTE_IAE;
+inline void AlignDate( sal_uInt16& rDay, sal_uInt16 nMonth, sal_uInt16 nYear );
+
+double Fak( sal_Int32 n );
+double GetGcd( double f1, double f2 );
+double ConvertToDec( const STRING& rFromNum, sal_uInt16 nBaseFrom, sal_uInt16 nCharLim ) THROWDEF_RTE_IAE;
+STRING ConvertFromDec(
+ double fNum, double fMin, double fMax, sal_uInt16 nBase,
+ sal_Int32 nPlaces, sal_Int32 nMaxPlaces, sal_Bool bUsePlaces ) THROWDEF_RTE_IAE;
+double Erf( double fX );
+double Erfc( double fX );
+sal_Bool ParseDouble( const sal_Unicode*& rpDoubleAsString, double& rReturn );
+STRING GetString( double fNumber, sal_Bool bLeadingSign = sal_False, sal_uInt16 nMaxNumOfDigits = 15 );
+inline double Exp10( sal_Int16 nPower ); // 10 ^ nPower
+
+double GetAmordegrc( sal_Int32 nNullDate, double fCost, sal_Int32 nDate, sal_Int32 nFirstPer,
+ double fRestVal, double fPer, double fRate, sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double GetAmorlinc( sal_Int32 nNullDate, double fCost, sal_Int32 nDate, sal_Int32 nFirstPer,
+ double fRestVal, double fPer, double fRate, sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double GetDuration( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double fCoup,
+ double fYield, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double GetYieldmat( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue,
+ double fRate, double fPrice, sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double GetOddfprice( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue,
+ sal_Int32 nFirstCoup, double fRate, double fYield, double fRedemp,
+ sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double getYield_( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double fCoup, double fPrice,
+ double fRedemp, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double getPrice_( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double fRate, double fYield,
+ double fRedemp, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double GetOddfyield( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue,
+ sal_Int32 nFirstCoup, double fRate, double fPrice, double fRedemp,
+ sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double GetOddlprice( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest,
+ double fRate, double fYield, double fRedemp, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double GetOddlyield( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest,
+ double fRate, double fPrice, double fRedemp, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double GetRmz( double fZins, double fZzr, double fBw, double fZw, sal_Int32 nF );
+double GetZw( double fZins, double fZzr, double fRmz, double fBw, sal_Int32 nF );
+//double TBillYield( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fPrice )THROWDEF_RTE_IAE;
+
+double GetCouppcd( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
+ sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double GetCoupncd( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
+ sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double GetCoupdaybs( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
+ sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double GetCoupdaysnc( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
+ sal_Int32 nBase ) THROWDEF_RTE_IAE;
+
+double GetCoupnum( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat,
+ sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
+double GetCoupdays( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
+ sal_Int32 nBase ) THROWDEF_RTE_IAE;
+
+
+
+
+//-----------------------------------------------------------------------------
+
+
+
+class MyList
+{
+private:
+ static const sal_uInt32 nStartSize;
+ static const sal_uInt32 nIncrSize;
+
+ void** pData; // pointer array
+ sal_uInt32 nSize; // array size
+ sal_uInt32 nNew; // next index to be inserted at
+ sal_uInt32 nAct; // actual for iterations
+
+ void _Grow( void );
+ inline void Grow( void );
+protected:
+public:
+ MyList( void );
+ virtual ~MyList();
+
+ inline const void* GetObject( sal_uInt32 nIndex ) const;
+ inline const void* First( void );
+ inline const void* Next( void );
+
+ inline void Append( void* pNewElement );
+ void Insert( void* pNewLement, sal_uInt32 nPlace );
+
+ inline sal_uInt32 Count( void ) const;
+};
+
+
+
+
+class StringList : protected MyList
+{
+public:
+ virtual ~StringList();
+
+ inline const STRING* First( void );
+ inline const STRING* Next( void );
+ inline const STRING* Get( sal_uInt32 nIndex ) const;
+
+ using MyList::Append;
+ inline void Append( STRING* pNew );
+ inline void Append( const STRING& rNew );
+
+ using MyList::Count;
+};
+
+
+
+
+enum FDCategory
+{
+ FDCat_AddIn,
+ FDCat_DateTime,
+ FDCat_Finance,
+ FDCat_Inf,
+ FDCat_Math,
+ FDCat_Tech
+};
+
+
+struct FuncDataBase
+{
+ const sal_Char* pIntName;
+ sal_uInt16 nUINameID; // resource ID to UI name
+ sal_uInt16 nDescrID; // resource ID to description, parameter names and ~ description
+ sal_Bool bDouble; // name already exist in Calc
+ sal_Bool bWithOpt; // first parameter is internal
+ sal_uInt16 nCompListID; // resource ID to list of valid names
+ sal_uInt16 nNumOfParams; // number of named / described parameters
+ FDCategory eCat; // function category
+};
+
+
+
+
+class FuncData
+{
+private:
+ ::rtl::OUString aIntName;
+ sal_uInt16 nUINameID;
+ sal_uInt16 nDescrID; // leads also to parameter descriptions!
+ sal_Bool bDouble; // flag for names, wich already exist in Calc
+ sal_Bool bWithOpt; // has internal parameter on first position
+
+ sal_uInt16 nParam; // num of parameters
+ sal_uInt16 nCompID;
+ StringList aCompList; // list of all valid names
+ FDCategory eCat; // function category
+public:
+ FuncData( const FuncDataBase& rBaseData, ResMgr& );
+ virtual ~FuncData();
+
+ inline sal_uInt16 GetUINameID( void ) const;
+ inline sal_uInt16 GetDescrID( void ) const;
+ inline sal_Bool IsDouble( void ) const;
+ inline sal_Bool HasIntParam( void ) const;
+
+ sal_uInt16 GetStrIndex( sal_uInt16 nParamNum ) const;
+ inline sal_Bool Is( const ::rtl::OUString& rCompareTo ) const;
+
+ inline const StringList& GetCompNameList( void ) const;
+
+ inline FDCategory GetCategory( void ) const;
+};
+
+
+
+
+class CStrList : private MyList
+{
+public:
+ using MyList::Append;
+ inline void Append( const sal_Char* pNew );
+ inline const sal_Char* Get( sal_uInt32 nIndex ) const;
+ using MyList::Count;
+};
+
+
+
+
+class FuncDataList : private MyList
+{
+ ::rtl::OUString aLastName;
+ sal_uInt32 nLast;
+public:
+ FuncDataList( ResMgr& );
+ virtual ~FuncDataList();
+ using MyList::Append;
+ inline void Append( FuncData* pNew );
+ inline const FuncData* Get( sal_uInt32 nIndex ) const;
+ using MyList::Count;
+
+ const FuncData* Get( const ::rtl::OUString& aProgrammaticName ) const;
+};
+
+
+
+class AnalysisResId : public ResId
+{
+ public:
+ AnalysisResId( sal_uInt16 nId, ResMgr& rResMgr );
+};
+
+
+
+
+class AnalysisRscStrLoader : public Resource
+{
+private:
+ String aStr;
+public:
+ AnalysisRscStrLoader( sal_uInt16 nRsc, sal_uInt16 nStrId, ResMgr& rResMgr ) :
+ Resource( AnalysisResId( nRsc, rResMgr ) ),
+ aStr( AnalysisResId( nStrId, rResMgr ) )
+ {
+ FreeResource();
+ }
+
+ const String& GetString() const { return aStr; }
+
+};
+
+
+
+//-----------------------------------------------------------------------------
+
+/// sorted list with unique sal_Int32 values
+class SortedIndividualInt32List : private MyList
+{
+protected:
+ using MyList::Insert;
+ void Insert( sal_Int32 nDay );
+ void Insert( sal_Int32 nDay, sal_Int32 nNullDate, sal_Bool bInsertOnWeekend );
+ void Insert( double fDay, sal_Int32 nNullDate, sal_Bool bInsertOnWeekend )
+ throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+
+ /** @param rAnyConv must be an initialized ScaAnyConmverter
+ @param bInsertOnWeekend insertion mode: sal_False = holidays on weekend are omitted */
+ void InsertHolidayList(
+ const ScaAnyConverter& rAnyConv,
+ const CSS::uno::Any& rHolAny,
+ sal_Int32 nNullDate,
+ sal_Bool bInsertOnWeekend ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+
+public:
+ SortedIndividualInt32List();
+ virtual ~SortedIndividualInt32List();
+
+ using MyList::Count;
+
+ /// @return element on position nIndex or 0 on invalid index
+ inline sal_Int32 Get( sal_uInt32 nIndex ) const
+ { return (sal_Int32)(sal_IntPtr) MyList::GetObject( nIndex ); }
+
+ /// @return sal_True if nVal (internal date representation) is contained
+ sal_Bool Find( sal_Int32 nVal ) const;
+
+ /** @param rAnyConv is an initialized or uninitialized ScaAnyConverter
+ @param bInsertOnWeekend insertion mode: sal_False = holidays on weekend are omitted */
+ void InsertHolidayList(
+ ScaAnyConverter& rAnyConv,
+ const CSS::uno::Reference< CSS::beans::XPropertySet >& xOptions,
+ const CSS::uno::Any& rHolAny,
+ sal_Int32 nNullDate,
+ sal_Bool bInsertOnWeekend ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+};
+
+
+//-----------------------------------------------------------------------------
+
+class ScaDoubleList : protected MyList
+{
+protected:
+ inline void ListAppend( double fValue ) { MyList::Append( new double( fValue ) ); }
+
+ using MyList::Append;
+ inline void Append( double fValue ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException )
+ { if( CheckInsert( fValue ) ) ListAppend( fValue ); }
+
+ /** @param rAnyConv must be an initialized ScaAnyConmverter
+ @param bIgnoreEmpty handling of empty Any's/strings: sal_False = inserted as 0.0; sal_True = omitted */
+ void Append(
+ const ScaAnyConverter& rAnyConv,
+ const CSS::uno::Any& rAny,
+ sal_Bool bIgnoreEmpty ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+
+ /** @param rAnyConv must be an initialized ScaAnyConmverter
+ @param bIgnoreEmpty handling of empty Any's/strings: sal_False = inserted as 0.0; sal_True = omitted */
+ void Append(
+ const ScaAnyConverter& rAnyConv,
+ const CSS::uno::Sequence< CSS::uno::Any >& rAnySeq,
+ sal_Bool bIgnoreEmpty ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+
+ /** @param rAnyConv must be an initialized ScaAnyConmverter
+ @param bIgnoreEmpty handling of empty Any's/strings: sal_False = inserted as 0.0; sal_True = omitted */
+ void Append(
+ const ScaAnyConverter& rAnyConv,
+ const CSS::uno::Sequence< CSS::uno::Sequence< CSS::uno::Any > >& rAnySeq,
+ sal_Bool bIgnoreEmpty ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+
+public:
+ virtual ~ScaDoubleList();
+
+ using MyList::Count;
+ inline const double* Get( sal_uInt32 nIndex ) const
+ { return static_cast< const double* >( MyList::GetObject( nIndex ) ); }
+
+ inline const double* First() { return static_cast< const double* >( MyList::First() ); }
+ inline const double* Next() { return static_cast< const double* >( MyList::Next() ); }
+
+ void Append( const CSS::uno::Sequence< CSS::uno::Sequence< double > >& rValueArr )
+ throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+ void Append( const CSS::uno::Sequence< CSS::uno::Sequence< sal_Int32 > >& rValueArr )
+ throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+
+ /** @param rAnyConv is an initialized or uninitialized ScaAnyConverter
+ @param bIgnoreEmpty handling of empty Any's/strings: sal_False = inserted as 0.0; sal_True = omitted */
+ void Append(
+ ScaAnyConverter& rAnyConv,
+ const CSS::uno::Reference< CSS::beans::XPropertySet >& xOpt,
+ const CSS::uno::Sequence< CSS::uno::Any >& rAnySeq,
+ sal_Bool bIgnoreEmpty = sal_True ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+
+ virtual sal_Bool CheckInsert( double fValue ) const
+ throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+};
+
+
+//-----------------------------------------------------------------------------
+
+/// stores double values >0.0, throws exception for double values <0.0, does nothing for 0.0
+class ScaDoubleListGT0 : public ScaDoubleList
+{
+public:
+ virtual sal_Bool CheckInsert( double fValue ) const
+ throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+};
+
+
+//-----------------------------------------------------------------------------
+
+/// stores double values >=0.0, throws exception for double values <0.0
+class ScaDoubleListGE0 : public ScaDoubleList
+{
+public:
+ virtual sal_Bool CheckInsert( double fValue ) const
+ throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+};
+
+
+//-----------------------------------------------------------------------------
+
+class Complex
+{
+ double r;
+ double i;
+ sal_Unicode c;
+
+public:
+ inline Complex( double fReal, double fImag = 0.0, sal_Char cC = '\0' );
+ Complex( const STRING& rComplexAsString ) THROWDEF_RTE_IAE;
+
+ inline static sal_Bool IsImagUnit( sal_Unicode c );
+ static sal_Bool ParseString( const STRING& rComplexAsString, Complex& rReturn );
+ STRING GetString() const THROWDEF_RTE_IAE;
+
+ inline double Real( void ) const;
+ inline double Imag( void ) const;
+
+ double Arg( void ) const THROWDEF_RTE_IAE;
+ inline double Abs( void ) const;
+
+ // following functions change the complex number itself to avoid unnecessary copy actions!
+ void Power( double fPower ) THROWDEF_RTE_IAE;
+ void Sqrt( void );
+ void Sin( void ) THROWDEF_RTE_IAE;
+ void Cos( void ) THROWDEF_RTE_IAE;
+ void Div( const Complex& rDivisor ) THROWDEF_RTE_IAE;
+ void Exp( void );
+ inline void Conjugate( void );
+ void Ln( void ) THROWDEF_RTE_IAE;
+ void Log10( void ) THROWDEF_RTE_IAE;
+ void Log2( void ) THROWDEF_RTE_IAE;
+ inline void Mult( double fFact );
+ inline void Mult( const Complex& rMult );
+ inline void Sub( const Complex& rMult );
+ inline void Add( const Complex& rAdd );
+};
+
+
+
+
+enum ComplListAppendHandl
+{
+ AH_EmptyAsErr,
+ AH_EmpyAs0,
+ AH_IgnoreEmpty
+};
+
+
+class ComplexList : protected MyList
+{
+public:
+ virtual ~ComplexList();
+
+ inline const Complex* Get( sal_uInt32 nIndex ) const;
+ inline const Complex* First( void );
+ inline const Complex* Next( void );
+
+ using MyList::Count;
+
+ using MyList::Append;
+ inline void Append( Complex* pNew );
+ void Append( const SEQSEQ( STRING )& rComplexNumList, ComplListAppendHandl eAH = AH_EmpyAs0 ) THROWDEF_RTE_IAE;
+ void Append( const SEQ( ANY )& aMultPars,ComplListAppendHandl eAH = AH_EmpyAs0 ) THROWDEF_RTE_IAE;
+};
+
+
+
+
+enum ConvertDataClass
+{
+ CDC_Mass, CDC_Length, CDC_Time, CDC_Pressure, CDC_Force, CDC_Energy, CDC_Power, CDC_Magnetism,
+ CDC_Temperature, CDC_Volume, CDC_Area, CDC_Speed, CDC_Information
+};
+
+
+#define INV_MATCHLEV 1764 // guess, what this is... :-)
+
+
+class ConvertDataList;
+
+
+
+
+class ConvertData
+{
+protected:
+ friend class ConvertDataList;
+ double fConst;
+ STRING aName;
+ ConvertDataClass eClass;
+ sal_Bool bPrefixSupport;
+public:
+ ConvertData(
+ const sal_Char pUnitName[],
+ double fConvertConstant,
+ ConvertDataClass eClass,
+ sal_Bool bPrefSupport = sal_False );
+
+ virtual ~ConvertData();
+
+ sal_Int16 GetMatchingLevel( const STRING& rRef ) const;
+ // 0.0 = no equality
+ // 1.0 = matches exact
+ // rest = matches without an assumed prefix of one character
+ // rest gives power for 10 represented by the prefix (e.g. 3 for k or -9 for n
+
+ virtual double Convert( double fVal, const ConvertData& rTo,
+ sal_Int16 nMatchLevelFrom, sal_Int16 nMatchLevelTo ) const THROWDEF_RTE_IAE;
+ // converts fVal from this unit to rFrom unit
+ // throws exception if not from same class
+ // this implementation is for proportional cases only
+ virtual double ConvertToBase( double fVal, sal_Int16 nMatchLevel ) const;
+ virtual double ConvertFromBase( double fVal, sal_Int16 nMatchLevel ) const;
+
+ inline ConvertDataClass Class( void ) const;
+ inline sal_Bool IsPrefixSupport( void ) const;
+};
+
+
+
+
+class ConvertDataLinear : public ConvertData
+{
+protected:
+ double fOffs;
+public:
+ inline ConvertDataLinear(
+ const sal_Char pUnitName[],
+ double fConvertConstant,
+ double fConvertOffset,
+ ConvertDataClass eClass,
+ sal_Bool bPrefSupport = sal_False );
+
+ virtual ~ConvertDataLinear();
+
+ virtual double Convert( double fVal, const ConvertData& rTo,
+ sal_Int16 nMatchLevelFrom, sal_Int16 nMatchLevelTo ) const THROWDEF_RTE_IAE;
+ // for cases where f(x) = a + bx applies (e.g. Temperatures)
+
+ virtual double ConvertToBase( double fVal, sal_Int16 nMatchLevel ) const;
+ virtual double ConvertFromBase( double fVal, sal_Int16 nMatchLevel ) const;
+};
+
+
+
+
+class ConvertDataList : protected MyList
+{
+private:
+protected:
+ inline ConvertData* First( void );
+ inline ConvertData* Next( void );
+public:
+ ConvertDataList( void );
+ virtual ~ConvertDataList();
+
+ double Convert( double fVal, const STRING& rFrom, const STRING& rTo ) THROWDEF_RTE_IAE;
+};
+
+
+
+
+inline sal_Bool IsLeapYear( sal_uInt16 n )
+{
+ return ( (( ( n % 4 ) == 0 ) && ( ( n % 100 ) != 0)) || ( ( n % 400 ) == 0 ) );
+}
+
+
+inline sal_Int32 GetDiffDate360( constREFXPS& xOpt, sal_Int32 nDate1, sal_Int32 nDate2, sal_Bool bUSAMethod )
+{
+ return GetDiffDate360( GetNullDate( xOpt ), nDate1, nDate2, bUSAMethod );
+}
+
+
+inline sal_Int16 GetDayOfWeek( sal_Int32 n )
+{ // monday = 0, ..., sunday = 6
+ return static_cast< sal_Int16 >( ( n - 1 ) % 7 );
+}
+
+
+inline double GetYearFrac( constREFXPS& xOpt, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) THROWDEF_RTE_IAE
+{
+ return GetYearFrac( GetNullDate( xOpt ), nStartDate, nEndDate, nMode );
+}
+
+
+inline void AlignDate( sal_uInt16& rD, sal_uInt16 nM, sal_uInt16 nY )
+{
+ sal_uInt16 nMax = DaysInMonth( nM, nY );
+
+ if( rD > nMax )
+ rD = nMax;
+}
+
+
+inline void MyList::Grow( void )
+{
+ if( nNew >= nSize )
+ _Grow();
+}
+
+
+inline const void* MyList::GetObject( sal_uInt32 n ) const
+{
+ if( n < nNew )
+ return pData[ n ];
+ else
+ return NULL;
+}
+
+
+inline const void* MyList::First( void )
+{
+ nAct = 0;
+ if( nNew )
+ return pData[ 0 ];
+ else
+ return NULL;
+}
+
+
+inline const void* MyList::Next( void )
+{
+ nAct++;
+ if( nAct < nNew )
+ return pData[ nAct ];
+ else
+ {
+ nAct--;
+ return NULL;
+ }
+}
+
+
+inline void MyList::Append( void* p )
+{
+ Grow();
+ pData[ nNew ] = p;
+ nNew++;
+}
+
+
+inline sal_uInt32 MyList::Count( void ) const
+{
+ return nNew;
+}
+
+
+
+
+inline const STRING* StringList::First( void )
+{
+ return ( const STRING* ) MyList::First();
+}
+
+
+inline const STRING* StringList::Next( void )
+{
+ return ( const STRING* ) MyList::Next();
+}
+
+
+inline const STRING* StringList::Get( sal_uInt32 n ) const
+{
+ return ( const STRING* ) MyList::GetObject( n );
+}
+
+
+inline void StringList::Append( STRING* p )
+{
+ MyList::Append( p );
+}
+
+
+inline void StringList::Append( const STRING& r )
+{
+ MyList::Append( new STRING( r ) );
+}
+
+
+
+
+inline sal_uInt16 FuncData::GetUINameID( void ) const
+{
+ return nUINameID;
+}
+
+
+inline sal_uInt16 FuncData::GetDescrID( void ) const
+{
+ return nDescrID;
+}
+
+
+inline sal_Bool FuncData::IsDouble( void ) const
+{
+ return bDouble;
+}
+
+
+inline sal_Bool FuncData::HasIntParam( void ) const
+{
+ return bWithOpt;
+}
+
+
+inline sal_Bool FuncData::Is( const ::rtl::OUString& r ) const
+{
+ return aIntName == r;
+}
+
+
+inline const StringList& FuncData::GetCompNameList( void ) const
+{
+ return aCompList;
+}
+
+
+inline FDCategory FuncData::GetCategory( void ) const
+{
+ return eCat;
+}
+
+
+
+
+inline void CStrList::Append( const sal_Char* p )
+{
+ MyList::Append( ( void* ) p );
+}
+
+
+inline const sal_Char* CStrList::Get( sal_uInt32 n ) const
+{
+ return ( const sal_Char* ) MyList::GetObject( n );
+}
+
+
+
+
+inline void FuncDataList::Append( FuncData* p )
+{
+ MyList::Append( p );
+}
+
+
+inline const FuncData* FuncDataList::Get( sal_uInt32 n ) const
+{
+ return ( const FuncData* ) MyList::GetObject( n );
+}
+
+
+inline Complex::Complex( double fReal, double fImag, sal_Char cC ) :
+ r( fReal ), i( fImag ), c( cC )
+{
+}
+
+
+inline double Complex::Real( void ) const
+{
+ return r;
+}
+
+
+inline double Complex::Imag( void ) const
+{
+ return i;
+}
+
+
+inline double Complex::Abs( void ) const
+{
+ return sqrt( r * r + i * i );
+}
+
+
+void Complex::Conjugate( void )
+{
+ i = -i;
+}
+
+
+inline void Complex::Mult( double f )
+{
+ i *= f;
+ r *= f;
+}
+
+
+inline void Complex::Mult( const Complex& rM )
+{
+ double r_ = r;
+ double i_ = i;
+
+ r = r_ * rM.r - i_ * rM.i;
+ i = r_ * rM.i + i_ * rM.r;
+
+ if( !c ) c = rM.c;
+}
+
+
+inline void Complex::Sub( const Complex& rC )
+{
+ r -= rC.r;
+ i -= rC.i;
+ if( !c ) c = rC.c;
+}
+
+
+inline void Complex::Add( const Complex& rAdd )
+{
+ r += rAdd.r;
+ i += rAdd.i;
+ if( !c ) c = rAdd.c;
+}
+
+
+
+
+inline const Complex* ComplexList::Get( sal_uInt32 n ) const
+{
+ return ( const Complex* ) MyList::GetObject( n );
+}
+
+
+inline const Complex* ComplexList::First( void )
+{
+ return ( const Complex* ) MyList::First();
+}
+
+
+inline const Complex* ComplexList::Next( void )
+{
+ return ( const Complex* ) MyList::Next();
+}
+
+
+inline void ComplexList::Append( Complex* p )
+{
+ MyList::Append( p );
+}
+
+
+
+
+inline ConvertDataClass ConvertData::Class( void ) const
+{
+ return eClass;
+}
+
+
+
+inline sal_Bool ConvertData::IsPrefixSupport( void ) const
+{
+ return bPrefixSupport;
+}
+
+inline ConvertDataLinear::ConvertDataLinear( const sal_Char* p, double fC, double fO, ConvertDataClass e,
+ sal_Bool bPrefSupport ) :
+ ConvertData( p, fC, e, bPrefSupport ),
+ fOffs( fO )
+{
+}
+
+
+
+
+inline ConvertData* ConvertDataList::First( void )
+{
+ return ( ConvertData* ) MyList::First();
+}
+
+
+inline ConvertData* ConvertDataList::Next( void )
+{
+ return ( ConvertData* ) MyList::Next();
+}
+
+//-----------------------------------------------------------------------------
+
+/// Helper class for date calculation for various financial functions
+class ScaDate
+{
+private:
+ sal_uInt16 nOrigDay; /// is the day of the original date.
+ sal_uInt16 nDay; /// is the calculated day depending on the current month/year.
+ sal_uInt16 nMonth; /// is the current month (one-based).
+ sal_uInt16 nYear; /// is the current year.
+ sal_Bool bLastDayMode : 1; /// if sal_True, recalculate nDay after every calculation.
+ sal_Bool bLastDay : 1; /// is sal_True, if original date was the last day in month.
+ sal_Bool b30Days : 1; /// is sal_True, if every month has 30 days in calculations.
+ sal_Bool bUSMode : 1; /// is sal_True, if the US method of 30-day-calculations is used.
+
+ /// Calculates nDay from nOrigDay and current date.
+ void setDay();
+
+ /// @return count of days in current month
+ inline sal_uInt16 getDaysInMonth() const;
+ /// @return count of days in given month
+ inline sal_uInt16 getDaysInMonth( sal_uInt16 _nMon ) const;
+
+ /// @ return count of days in the given month range
+ sal_Int32 getDaysInMonthRange( sal_uInt16 nFrom, sal_uInt16 nTo ) const;
+ /// @ return count of days in the given year range
+ sal_Int32 getDaysInYearRange( sal_uInt16 nFrom, sal_uInt16 nTo ) const;
+
+ /// Adds/subtracts the given count of years, does not adjust day.
+ void doAddYears( sal_Int32 nYearCount ) throw( CSS::lang::IllegalArgumentException );
+
+public:
+ ScaDate();
+ /** @param nBase
+ date handling mode (days in month / days in year):
+ 0 = 30 days / 360 days (US NASD)
+ 1 = exact / exact
+ 2 = exact / 360
+ 3 = exact / 365
+ 4 = 30 days / 360 days (Europe)
+ 5 = exact / exact (no last day adjustment) */
+ ScaDate( sal_Int32 nNullDate, sal_Int32 nDate, sal_Int32 nBase );
+ ScaDate( const ScaDate& rCopy );
+ ScaDate& operator=( const ScaDate& rCopy );
+
+ /// @return the current month.
+ inline sal_uInt16 getMonth() const { return nMonth; };
+ /// @return the current year.
+ inline sal_uInt16 getYear() const { return nYear; };
+
+ /// adds/subtracts the given count of months, adjusts day
+ void addMonths( sal_Int32 nMonthCount ) throw( CSS::lang::IllegalArgumentException );
+
+ /// sets the given year, adjusts day
+ inline void setYear( sal_uInt16 nNewYear );
+ /// adds/subtracts the given count of years, adjusts day
+ inline void addYears( sal_Int32 nYearCount ) throw( CSS::lang::IllegalArgumentException );
+
+ /// @return the internal number of the current date
+ sal_Int32 getDate( sal_Int32 nNullDate ) const;
+ /// @return the number of days between the two dates
+ static sal_Int32 getDiff( const ScaDate& rFrom, const ScaDate& rTo ) throw( CSS::lang::IllegalArgumentException );
+
+ sal_Bool operator<( const ScaDate& rCmp ) const;
+ inline sal_Bool operator<=( const ScaDate& rCmp ) const { return !(rCmp < *this); }
+ inline sal_Bool operator>( const ScaDate& rCmp ) const { return rCmp < *this; }
+ inline sal_Bool operator>=( const ScaDate& rCmp ) const { return !(*this < rCmp); }
+};
+
+inline sal_uInt16 ScaDate::getDaysInMonth() const
+{
+ return getDaysInMonth( nMonth );
+}
+
+inline sal_uInt16 ScaDate::getDaysInMonth( sal_uInt16 _nMon ) const
+{
+ return b30Days ? 30 : DaysInMonth( _nMon, nYear );
+}
+
+inline void ScaDate::setYear( sal_uInt16 nNewYear )
+{
+ nYear = nNewYear;
+ setDay();
+}
+
+inline void ScaDate::addYears( sal_Int32 nYearCount ) throw( CSS::lang::IllegalArgumentException )
+{
+ doAddYears( nYearCount );
+ setDay();
+}
+
+
+//-----------------------------------------------------------------------------
+
+/// Helper class for Any->double conversion, using current language settings
+class ScaAnyConverter
+{
+private:
+ CSS::uno::Reference< CSS::util::XNumberFormatter > xFormatter;
+ sal_Int32 nDefaultFormat;
+ sal_Bool bHasValidFormat;
+
+ /** Converts a string to double using the number formatter. If the formatter is not
+ valid, ::rtl::math::stringToDouble() with english separators will be used.
+ @throws com::sun::star::lang::IllegalArgumentException
+ on strings not representing any double value.
+ @return the converted double value. */
+ double convertToDouble(
+ const ::rtl::OUString& rString ) const
+ throw( CSS::lang::IllegalArgumentException );
+
+public:
+ ScaAnyConverter(
+ const CSS::uno::Reference< CSS::lang::XMultiServiceFactory >& xServiceFact );
+ ~ScaAnyConverter();
+
+ /// Initializing with current language settings
+ void init(
+ const CSS::uno::Reference< CSS::beans::XPropertySet >& xPropSet )
+ throw( CSS::uno::RuntimeException );
+
+ /** Converts an Any to double (without initialization).
+ The Any can be empty or contain a double or string.
+ @throws com::sun::star::lang::IllegalArgumentException
+ on other Any types or on invalid strings.
+ @return sal_True if the Any contains a double or a non-empty valid string,
+ sal_False if the Any is empty or the string is empty */
+ sal_Bool getDouble(
+ double& rfResult,
+ const CSS::uno::Any& rAny ) const
+ throw( CSS::lang::IllegalArgumentException );
+
+ /** Converts an Any to double (with initialization).
+ The Any can be empty or contain a double or string.
+ @throws com::sun::star::lang::IllegalArgumentException
+ on other Any types or on invalid strings.
+ @return sal_True if the Any contains a double or a non-empty valid string,
+ sal_False if the Any is empty or the string is empty */
+ sal_Bool getDouble(
+ double& rfResult,
+ const CSS::uno::Reference< CSS::beans::XPropertySet >& xPropSet,
+ const CSS::uno::Any& rAny )
+ throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+
+ /** Converts an Any to double (with initialization).
+ The Any can be empty or contain a double or string.
+ @throws com::sun::star::lang::IllegalArgumentException
+ on other Any types or on invalid strings.
+ @return the value of the double or string or fDefault if the Any or string is empty */
+ double getDouble(
+ const CSS::uno::Reference< CSS::beans::XPropertySet >& xPropSet,
+ const CSS::uno::Any& rAny,
+ double fDefault )
+ throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+
+ /** Converts an Any to sal_Int32 (with initialization).
+ The Any can be empty or contain a double or string.
+ @throws com::sun::star::lang::IllegalArgumentException
+ on other Any types or on invalid values or strings.
+ @return sal_True if the Any contains a double or a non-empty valid string,
+ sal_False if the Any is empty or the string is empty */
+ sal_Bool getInt32(
+ sal_Int32& rnResult,
+ const CSS::uno::Reference< CSS::beans::XPropertySet >& xPropSet,
+ const CSS::uno::Any& rAny )
+ throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+
+ /** Converts an Any to sal_Int32 (with initialization).
+ The Any can be empty or contain a double or string.
+ @throws com::sun::star::lang::IllegalArgumentException
+ on other Any types or on invalid values or strings.
+ @return the truncated value of the double or string or nDefault if the Any or string is empty */
+ sal_Int32 getInt32(
+ const CSS::uno::Reference< CSS::beans::XPropertySet >& xPropSet,
+ const CSS::uno::Any& rAny,
+ sal_Int32 nDefault )
+ throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
+};
+
+
+//-----------------------------------------------------------------------------
+
+
+#endif
+
diff --git a/scaddins/source/analysis/bessel.cxx b/scaddins/source/analysis/bessel.cxx
new file mode 100644
index 000000000000..9b1f79b6d405
--- /dev/null
+++ b/scaddins/source/analysis/bessel.cxx
@@ -0,0 +1,415 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "bessel.hxx"
+#include "analysishelper.hxx"
+
+#include <rtl/math.hxx>
+
+using ::com::sun::star::lang::IllegalArgumentException;
+
+namespace sca {
+namespace analysis {
+
+// ============================================================================
+
+const double f_PI = 3.1415926535897932385;
+const double f_2_PI = 2.0 * f_PI;
+const double f_PI_DIV_2 = f_PI / 2.0;
+const double f_PI_DIV_4 = f_PI / 4.0;
+const double f_2_DIV_PI = 2.0 / f_PI;
+
+const double THRESHOLD = 30.0; // Threshold for usage of approximation formula.
+const double MAXEPSILON = 1e-10; // Maximum epsilon for end of iteration.
+const sal_Int32 MAXITER = 100; // Maximum number of iterations.
+
+
+// ============================================================================
+// BESSEL J
+// ============================================================================
+
+/* The BESSEL function, first kind, unmodified:
+
+ inf (-1)^k (x/2)^(n+2k)
+ J_n(x) = SUM TERM(n,k) with TERM(n,k) := ---------------------
+ k=0 k! (n+k)!
+
+ Approximation for the BESSEL function, first kind, unmodified, for great x:
+
+ J_n(x) ~ sqrt( 2 / (PI x) ) cos( x - n PI/2 - PI/4 ) for x>=0.
+ */
+
+// ----------------------------------------------------------------------------
+
+double BesselJ( double x, sal_Int32 n ) throw( IllegalArgumentException )
+{
+ if( n < 0 )
+ throw IllegalArgumentException();
+
+ double fResult = 0.0;
+ if( fabs( x ) <= THRESHOLD )
+ {
+ /* Start the iteration without TERM(n,0), which is set here.
+
+ TERM(n,0) = (x/2)^n / n!
+ */
+ double fTerm = pow( x / 2.0, (double)n ) / Fak( n );
+ sal_Int32 nK = 1; // Start the iteration with k=1.
+ fResult = fTerm; // Start result with TERM(n,0).
+
+ const double fSqrX = x * x / -4.0;
+
+ do
+ {
+ /* Calculation of TERM(n,k) from TERM(n,k-1):
+
+ (-1)^k (x/2)^(n+2k)
+ TERM(n,k) = ---------------------
+ k! (n+k)!
+
+ (-1)(-1)^(k-1) (x/2)^2 (x/2)^(n+2(k-1))
+ = -----------------------------------------
+ k (k-1)! (n+k) (n+k-1)!
+
+ -(x/2)^2 (-1)^(k-1) (x/2)^(n+2(k-1))
+ = ---------- * -----------------------------
+ k(n+k) (k-1)! (n+k-1)!
+
+ -(x^2/4)
+ = ---------- TERM(n,k-1)
+ k(n+k)
+ */
+ fTerm *= fSqrX; // defined above as -(x^2/4)
+ fTerm /= (nK * (nK + n));
+ fResult += fTerm;
+ }
+ while( (fabs( fTerm ) > MAXEPSILON) && (++nK < MAXITER) );
+ }
+ else
+ {
+ /* Approximation for the BESSEL function, first kind, unmodified:
+
+ J_n(x) ~ sqrt( 2 / (PI x) ) cos( x - n PI/2 - PI/4 ) for x>=0.
+
+ The BESSEL function J_n with n IN {0,2,4,...} is axially symmetric at
+ x=0, means J_n(x) = J_n(-x). Therefore the approximation for x<0 is:
+
+ J_n(x) = J_n(|x|) for x<0 and n IN {0,2,4,...}.
+
+ The BESSEL function J_n with n IN {1,3,5,...} is point-symmetric at
+ x=0, means J_n(x) = -J_n(-x). Therefore the approximation for x<0 is:
+
+ J_n(x) = -J_n(|x|) for x<0 and n IN {1,3,5,...}.
+ */
+ double fXAbs = fabs( x );
+ fResult = sqrt( f_2_DIV_PI / fXAbs ) * cos( fXAbs - n * f_PI_DIV_2 - f_PI_DIV_4 );
+ if( (n & 1) && (x < 0.0) )
+ fResult = -fResult;
+ }
+ return fResult;
+}
+
+
+// ============================================================================
+// BESSEL I
+// ============================================================================
+
+/* The BESSEL function, first kind, modified:
+
+ inf (x/2)^(n+2k)
+ I_n(x) = SUM TERM(n,k) with TERM(n,k) := --------------
+ k=0 k! (n+k)!
+
+ Approximation for the BESSEL function, first kind, modified, for great x:
+
+ I_n(x) ~ e^x / sqrt( 2 PI x ) for x>=0.
+ */
+
+// ----------------------------------------------------------------------------
+
+double BesselI( double x, sal_Int32 n ) throw( IllegalArgumentException )
+{
+ if( n < 0 )
+ throw IllegalArgumentException();
+
+ double fResult = 0.0;
+ if( fabs( x ) <= THRESHOLD )
+ {
+ /* Start the iteration without TERM(n,0), which is set here.
+
+ TERM(n,0) = (x/2)^n / n!
+ */
+ double fTerm = pow( x / 2.0, (double)n ) / Fak( n );
+ sal_Int32 nK = 1; // Start the iteration with k=1.
+ fResult = fTerm; // Start result with TERM(n,0).
+
+ const double fSqrX = x * x / 4.0;
+
+ do
+ {
+ /* Calculation of TERM(n,k) from TERM(n,k-1):
+
+ (x/2)^(n+2k)
+ TERM(n,k) = --------------
+ k! (n+k)!
+
+ (x/2)^2 (x/2)^(n+2(k-1))
+ = --------------------------
+ k (k-1)! (n+k) (n+k-1)!
+
+ (x/2)^2 (x/2)^(n+2(k-1))
+ = --------- * ------------------
+ k(n+k) (k-1)! (n+k-1)!
+
+ x^2/4
+ = -------- TERM(n,k-1)
+ k(n+k)
+ */
+ fTerm *= fSqrX; // defined above as x^2/4
+ fTerm /= (nK * (nK + n));
+ fResult += fTerm;
+ }
+ while( (fabs( fTerm ) > MAXEPSILON) && (++nK < MAXITER) );
+ }
+ else
+ {
+ /* Approximation for the BESSEL function, first kind, modified:
+
+ I_n(x) ~ e^x / sqrt( 2 PI x ) for x>=0.
+
+ The BESSEL function I_n with n IN {0,2,4,...} is axially symmetric at
+ x=0, means I_n(x) = I_n(-x). Therefore the approximation for x<0 is:
+
+ I_n(x) = I_n(|x|) for x<0 and n IN {0,2,4,...}.
+
+ The BESSEL function I_n with n IN {1,3,5,...} is point-symmetric at
+ x=0, means I_n(x) = -I_n(-x). Therefore the approximation for x<0 is:
+
+ I_n(x) = -I_n(|x|) for x<0 and n IN {1,3,5,...}.
+ */
+ double fXAbs = fabs( x );
+ fResult = exp( fXAbs ) / sqrt( f_2_PI * fXAbs );
+ if( (n & 1) && (x < 0.0) )
+ fResult = -fResult;
+ }
+ return fResult;
+}
+
+
+// ============================================================================
+
+double Besselk0( double fNum ) throw( IllegalArgumentException )
+{
+ double fRet;
+
+ if( fNum <= 2.0 )
+ {
+ double fNum2 = fNum * 0.5;
+ double y = fNum2 * fNum2;
+
+ fRet = -log( fNum2 ) * BesselI( fNum, 0 ) +
+ ( -0.57721566 + y * ( 0.42278420 + y * ( 0.23069756 + y * ( 0.3488590e-1 +
+ y * ( 0.262698e-2 + y * ( 0.10750e-3 + y * 0.74e-5 ) ) ) ) ) );
+ }
+ else
+ {
+ double y = 2.0 / fNum;
+
+ fRet = exp( -fNum ) / sqrt( fNum ) * ( 1.25331414 + y * ( -0.7832358e-1 +
+ y * ( 0.2189568e-1 + y * ( -0.1062446e-1 + y * ( 0.587872e-2 +
+ y * ( -0.251540e-2 + y * 0.53208e-3 ) ) ) ) ) );
+ }
+
+ return fRet;
+}
+
+
+double Besselk1( double fNum ) throw( IllegalArgumentException )
+{
+ double fRet;
+
+ if( fNum <= 2.0 )
+ {
+ double fNum2 = fNum * 0.5;
+ double y = fNum2 * fNum2;
+
+ fRet = log( fNum2 ) * BesselI( fNum, 1 ) +
+ ( 1.0 + y * ( 0.15443144 + y * ( -0.67278579 + y * ( -0.18156897 + y * ( -0.1919402e-1 +
+ y * ( -0.110404e-2 + y * ( -0.4686e-4 ) ) ) ) ) ) )
+ / fNum;
+ }
+ else
+ {
+ double y = 2.0 / fNum;
+
+ fRet = exp( -fNum ) / sqrt( fNum ) * ( 1.25331414 + y * ( 0.23498619 +
+ y * ( -0.3655620e-1 + y * ( 0.1504268e-1 + y * ( -0.780353e-2 +
+ y * ( 0.325614e-2 + y * ( -0.68245e-3 ) ) ) ) ) ) );
+ }
+
+ return fRet;
+}
+
+
+double BesselK( double fNum, sal_Int32 nOrder ) throw( IllegalArgumentException )
+{
+ switch( nOrder )
+ {
+ case 0: return Besselk0( fNum );
+ case 1: return Besselk1( fNum );
+ default:
+ {
+ double fBkp;
+
+ double fTox = 2.0 / fNum;
+ double fBkm = Besselk0( fNum );
+ double fBk = Besselk1( fNum );
+
+ for( sal_Int32 n = 1 ; n < nOrder ; n++ )
+ {
+ fBkp = fBkm + double( n ) * fTox * fBk;
+ fBkm = fBk;
+ fBk = fBkp;
+ }
+
+ return fBk;
+ }
+ }
+}
+
+
+double Bessely0( double fNum ) throw( IllegalArgumentException )
+{
+ double fRet;
+
+ if( fNum < 8.0 )
+ {
+ double y = fNum * fNum;
+
+ double f1 = -2957821389.0 + y * ( 7062834065.0 + y * ( -512359803.6 +
+ y * ( 10879881.29 + y * ( -86327.92757 + y * 228.4622733 ) ) ) );
+
+ double f2 = 40076544269.0 + y * ( 745249964.8 + y * ( 7189466.438 +
+ y * ( 47447.26470 + y * ( 226.1030244 + y ) ) ) );
+
+ fRet = f1 / f2 + 0.636619772 * BesselJ( fNum, 0 ) * log( fNum );
+ }
+ else
+ {
+ double z = 8.0 / fNum;
+ double y = z * z;
+ double xx = fNum - 0.785398164;
+
+ double f1 = 1.0 + y * ( -0.1098628627e-2 + y * ( 0.2734510407e-4 +
+ y * ( -0.2073370639e-5 + y * 0.2093887211e-6 ) ) );
+
+ double f2 = -0.1562499995e-1 + y * ( 0.1430488765e-3 +
+ y * ( -0.6911147651e-5 + y * ( 0.7621095161e-6 +
+ y * ( -0.934945152e-7 ) ) ) );
+
+ fRet = sqrt( 0.636619772 / fNum ) * ( sin( xx ) * f1 + z * cos( xx ) * f2 );
+ }
+
+ return fRet;
+}
+
+
+double Bessely1( double fNum ) throw( IllegalArgumentException )
+{
+ double fRet;
+
+ if( fNum < 8.0 )
+ {
+ double y = fNum * fNum;
+
+ double f1 = fNum * ( -0.4900604943e13 + y * ( 0.1275274390e13 +
+ y * ( -0.5153438139e11 + y * ( 0.7349264551e9 +
+ y * ( -0.4237922726e7 + y * 0.8511937935e4 ) ) ) ) );
+
+ double f2 = 0.2499580570e14 + y * ( 0.4244419664e12 +
+ y * ( 0.3733650367e10 + y * ( 0.2245904002e8 +
+ y * ( 0.1020426050e6 + y * ( 0.3549632885e3 + y ) ) ) ) );
+
+ fRet = f1 / f2 + 0.636619772 * ( BesselJ( fNum, 1 ) * log( fNum ) - 1.0 / fNum );
+ }
+ else
+ {
+#if 0
+ // #i12430# don't know the intention of this piece of code...
+ double z = 8.0 / fNum;
+ double y = z * z;
+ double xx = fNum - 2.356194491;
+
+ double f1 = 1.0 + y * ( 0.183105e-2 + y * ( -0.3516396496e-4 +
+ y * ( 0.2457520174e-5 + y * ( -0.240337019e6 ) ) ) );
+
+ double f2 = 0.04687499995 + y * ( -0.2002690873e-3 +
+ y * ( 0.8449199096e-5 + y * ( -0.88228987e-6 +
+ y * 0.105787412e-6 ) ) );
+
+ fRet = sqrt( 0.636619772 / fNum ) * ( sin( xx ) * f1 + z * cos( xx ) * f2 );
+#endif
+ // #i12430# ...but this seems to work much better.
+ fRet = sqrt( 0.636619772 / fNum ) * sin( fNum - 2.356194491 );
+ }
+
+ return fRet;
+}
+
+
+double BesselY( double fNum, sal_Int32 nOrder ) throw( IllegalArgumentException )
+{
+ switch( nOrder )
+ {
+ case 0: return Bessely0( fNum );
+ case 1: return Bessely1( fNum );
+ default:
+ {
+ double fByp;
+
+ double fTox = 2.0 / fNum;
+ double fBym = Bessely0( fNum );
+ double fBy = Bessely1( fNum );
+
+ for( sal_Int32 n = 1 ; n < nOrder ; n++ )
+ {
+ fByp = double( n ) * fTox * fBy - fBym;
+ fBym = fBy;
+ fBy = fByp;
+ }
+
+ return fBy;
+ }
+ }
+}
+
+
+// ============================================================================
+
+} // namespace analysis
+} // namespace sca
+
diff --git a/scaddins/source/analysis/bessel.hxx b/scaddins/source/analysis/bessel.hxx
new file mode 100644
index 000000000000..24e8217537d5
--- /dev/null
+++ b/scaddins/source/analysis/bessel.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SCA_BESSEL_HXX
+#define SCA_BESSEL_HXX
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <sal/types.h>
+
+namespace sca {
+namespace analysis {
+
+// ============================================================================
+// BESSEL functions
+// ============================================================================
+
+/** Returns the result for the unmodified BESSEL function of first kind (J), n-th order, at point x. */
+double BesselJ( double x, sal_Int32 n ) throw( ::com::sun::star::lang::IllegalArgumentException );
+
+/** Returns the result for the modified BESSEL function of first kind (I), n-th order, at point x. */
+double BesselI( double x, sal_Int32 n ) throw( ::com::sun::star::lang::IllegalArgumentException );
+
+/** Returns the result for the unmodified BESSEL function of second kind (Y), n-th order, at point x. */
+double BesselY( double x, sal_Int32 n ) throw( ::com::sun::star::lang::IllegalArgumentException );
+
+/** Returns the result for the modified BESSEL function of second kind (K), n-th order, at point x. */
+double BesselK( double x, sal_Int32 n ) throw( ::com::sun::star::lang::IllegalArgumentException );
+
+// ============================================================================
+
+} // namespace analysis
+} // namespace sca
+
+#endif
+
diff --git a/scaddins/source/analysis/financial.cxx b/scaddins/source/analysis/financial.cxx
new file mode 100644
index 000000000000..fd5731d008a0
--- /dev/null
+++ b/scaddins/source/analysis/financial.cxx
@@ -0,0 +1,667 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "analysis.hxx"
+#include "analysishelper.hxx"
+#include <rtl/math.hxx>
+
+
+
+double SAL_CALL AnalysisAddIn::getAmordegrc( constREFXPS& xOpt,
+ double fCost, sal_Int32 nDate, sal_Int32 nFirstPer, double fRestVal,
+ double fPer, double fRate, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ if( nDate > nFirstPer || fRate <= 0.0 || fRestVal > fCost )
+ THROW_IAE;
+
+ double fRet = GetAmordegrc( GetNullDate( xOpt ), fCost, nDate, nFirstPer, fRestVal, fPer, fRate, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getAmorlinc( constREFXPS& xOpt,
+ double fCost, sal_Int32 nDate, sal_Int32 nFirstPer, double fRestVal,
+ double fPer, double fRate, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ if( nDate > nFirstPer || fRate <= 0.0 || fRestVal > fCost )
+ THROW_IAE;
+
+ double fRet = GetAmorlinc( GetNullDate( xOpt ), fCost, nDate, nFirstPer, fRestVal, fPer, fRate, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getAccrint( constREFXPS& xOpt,
+ sal_Int32 nIssue, sal_Int32 /*nFirstInter*/, sal_Int32 nSettle, double fRate,
+ const ANY &rVal, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ double fVal = aAnyConv.getDouble( xOpt, rVal, 1000.0 );
+
+ if( fRate <= 0.0 || fVal <= 0.0 || CHK_Freq || nIssue >= nSettle )
+ THROW_IAE;
+
+ double fRet = fVal * fRate * GetYearDiff( GetNullDate( xOpt ), nIssue, nSettle, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getAccrintm( constREFXPS& xOpt,
+ sal_Int32 nIssue, sal_Int32 nSettle, double fRate, const ANY& rVal, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ double fVal = aAnyConv.getDouble( xOpt, rVal, 1000.0 );
+
+ if( fRate <= 0.0 || fVal <= 0.0 || nIssue >= nSettle )
+ THROW_IAE;
+
+ double fRet = fVal * fRate * GetYearDiff( GetNullDate( xOpt ), nIssue, nSettle, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getReceived( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, double fInvest, double fDisc, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ if( fInvest <= 0.0 || fDisc <= 0.0 )
+ THROW_IAE;
+
+ double fRet = fInvest / ( 1.0 - ( fDisc * GetYearDiff( GetNullDate( xOpt ), nSettle, nMat, getDateMode( xOpt, rOB ) ) ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getDisc( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, double fPrice, double fRedemp, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ if( fPrice <= 0.0 || fRedemp <= 0.0 || nSettle >= nMat )
+ THROW_IAE;
+ double fRet = ( 1.0 - fPrice / fRedemp ) / GetYearFrac( xOpt, nSettle, nMat, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getDuration( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, double fCoup, double fYield, sal_Int32 nFreq, const ANY& rOB )
+ THROWDEF_RTE_IAE
+{
+ if( fCoup < 0.0 || fYield < 0.0 || CHK_Freq || nSettle >= nMat )
+ THROW_IAE;
+
+ double fRet = GetDuration( GetNullDate( xOpt ), nSettle, nMat, fCoup, fYield, nFreq, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getEffect( double fNominal, sal_Int32 nPeriods ) THROWDEF_RTE_IAE
+{
+ if( nPeriods < 1 || fNominal <= 0.0 )
+ THROW_IAE;
+
+ double fPeriods = nPeriods;
+
+ double fRet = pow( 1.0 + fNominal / fPeriods, fPeriods ) - 1.0;
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getCumprinc( double fRate, sal_Int32 nNumPeriods, double fVal,
+ sal_Int32 nStartPer, sal_Int32 nEndPer, sal_Int32 nPayType ) THROWDEF_RTE_IAE
+{
+ double fRmz, fKapZ;
+
+ if( nStartPer < 1 || nEndPer < nStartPer || fRate <= 0.0 || nEndPer > nNumPeriods || nNumPeriods <= 0 ||
+ fVal <= 0.0 || ( nPayType != 0 && nPayType != 1 ) )
+ THROW_IAE;
+
+ fRmz = GetRmz( fRate, nNumPeriods, fVal, 0.0, nPayType );
+
+ fKapZ = 0.0;
+
+ sal_uInt32 nStart = sal_uInt32( nStartPer );
+ sal_uInt32 nEnd = sal_uInt32( nEndPer );
+
+ if( nStart == 1 )
+ {
+ if( nPayType <= 0 )
+ fKapZ = fRmz + fVal * fRate;
+ else
+ fKapZ = fRmz;
+
+ nStart++;
+ }
+
+ for( sal_uInt32 i = nStart ; i <= nEnd ; i++ )
+ {
+ if( nPayType > 0 )
+ fKapZ += fRmz - ( GetZw( fRate, double( i - 2 ), fRmz, fVal, 1 ) - fRmz ) * fRate;
+ else
+ fKapZ += fRmz - GetZw( fRate, double( i - 1 ), fRmz, fVal, 0 ) * fRate;
+ }
+
+ RETURN_FINITE( fKapZ );
+}
+
+
+double SAL_CALL AnalysisAddIn::getCumipmt( double fRate, sal_Int32 nNumPeriods, double fVal,
+ sal_Int32 nStartPer, sal_Int32 nEndPer, sal_Int32 nPayType ) THROWDEF_RTE_IAE
+{
+ double fRmz, fZinsZ;
+
+ if( nStartPer < 1 || nEndPer < nStartPer || fRate <= 0.0 || nEndPer > nNumPeriods || nNumPeriods <= 0 ||
+ fVal <= 0.0 || ( nPayType != 0 && nPayType != 1 ) )
+ THROW_IAE;
+
+ fRmz = GetRmz( fRate, nNumPeriods, fVal, 0.0, nPayType );
+
+ fZinsZ = 0.0;
+
+ sal_uInt32 nStart = sal_uInt32( nStartPer );
+ sal_uInt32 nEnd = sal_uInt32( nEndPer );
+
+ if( nStart == 1 )
+ {
+ if( nPayType <= 0 )
+ fZinsZ = -fVal;
+
+ nStart++;
+ }
+
+ for( sal_uInt32 i = nStart ; i <= nEnd ; i++ )
+ {
+ if( nPayType > 0 )
+ fZinsZ += GetZw( fRate, double( i - 2 ), fRmz, fVal, 1 ) - fRmz;
+ else
+ fZinsZ += GetZw( fRate, double( i - 1 ), fRmz, fVal, 0 );
+ }
+
+ fZinsZ *= fRate;
+
+ RETURN_FINITE( fZinsZ );
+}
+
+
+double SAL_CALL AnalysisAddIn::getPrice( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, double fRate, double fYield, double fRedemp, sal_Int32 nFreq,
+ const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ if( fYield < 0.0 || fRate < 0.0 || fRedemp <= 0 || CHK_Freq || nSettle >= nMat )
+ THROW_IAE;
+
+ double fRet = getPrice_( GetNullDate( xOpt ), nSettle, nMat, fRate, fYield, fRedemp, nFreq, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getPricedisc( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, double fDisc, double fRedemp, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ if( fDisc <= 0.0 || fRedemp <= 0 || nSettle >= nMat )
+ THROW_IAE;
+
+ double fRet = fRedemp * ( 1.0 - fDisc * GetYearDiff( GetNullDate( xOpt ), nSettle, nMat, getDateMode( xOpt, rOB ) ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getPricemat( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, double fRate, double fYield, const ANY& rOB )
+ THROWDEF_RTE_IAE
+{
+ if( fRate < 0.0 || fYield < 0.0 || nSettle >= nMat )
+ THROW_IAE;
+
+ sal_Int32 nNullDate = GetNullDate( xOpt );
+ sal_Int32 nBase = getDateMode( xOpt, rOB );
+
+ double fIssMat = GetYearFrac( nNullDate, nIssue, nMat, nBase );
+ double fIssSet = GetYearFrac( nNullDate, nIssue, nSettle, nBase );
+ double fSetMat = GetYearFrac( nNullDate, nSettle, nMat, nBase );
+
+ double fRet = 1.0 + fIssMat * fRate;
+ fRet /= 1.0 + fSetMat * fYield;
+ fRet -= fIssSet * fRate;
+ fRet *= 100.0;
+
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getMduration( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, double fCoup, double fYield, sal_Int32 nFreq, const ANY& rOB )
+ THROWDEF_RTE_IAE
+{
+ if( fCoup < 0.0 || fYield < 0.0 || CHK_Freq )
+ THROW_IAE;
+
+ double fRet = GetDuration( GetNullDate( xOpt ), nSettle, nMat, fCoup, fYield, nFreq, getDateMode( xOpt, rOB ) );
+ fRet /= 1.0 + ( fYield / double( nFreq ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getNominal( double fRate, sal_Int32 nPeriods ) THROWDEF_RTE_IAE
+{
+ if( fRate <= 0.0 || nPeriods < 0 )
+ THROW_IAE;
+
+ double fPeriods = nPeriods;
+ double fRet = ( pow( fRate + 1.0, 1.0 / fPeriods ) - 1.0 ) * fPeriods;
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getDollarfr( double fDollarDec, sal_Int32 nFrac ) THROWDEF_RTE_IAE
+{
+ if( nFrac <= 0 )
+ THROW_IAE;
+
+ double fInt;
+ double fFrac = nFrac;
+
+ double fRet = modf( fDollarDec, &fInt );
+
+ fRet *= fFrac;
+
+ fRet *= pow( 10.0, -ceil( log10( fFrac ) ) );
+
+ fRet += fInt;
+
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getDollarde( double fDollarFrac, sal_Int32 nFrac ) THROWDEF_RTE_IAE
+{
+ if( nFrac <= 0 )
+ THROW_IAE;
+
+ double fInt;
+ double fFrac = nFrac;
+
+ double fRet = modf( fDollarFrac, &fInt );
+
+ fRet /= fFrac;
+
+ fRet *= pow( 10.0, ceil( log10( fFrac ) ) );
+
+ fRet += fInt;
+
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getYield( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, double fCoup, double fPrice, double fRedemp, sal_Int32 nFreq, const ANY& rOB )
+ THROWDEF_RTE_IAE
+{
+ if( fCoup < 0.0 || fPrice <= 0.0 || fRedemp <= 0.0 || CHK_Freq || nSettle >= nMat )
+ THROW_IAE;
+
+ double fRet = getYield_( GetNullDate( xOpt ), nSettle, nMat, fCoup, fPrice, fRedemp, nFreq, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getYielddisc( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, double fPrice, double fRedemp, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ if( fPrice <= 0.0 || fRedemp <= 0.0 || nSettle >= nMat )
+ THROW_IAE;
+
+ sal_Int32 nNullDate = GetNullDate( xOpt );
+
+#if 0
+ double fRet = 1.0 - fPrice / fRedemp;
+ fRet /= GetYearFrac( nNullDate, nSettle, nMat, getDateMode( xOpt, rOB ) );
+ fRet /= 0.99795; // don't know what this constant means in original
+#endif
+
+ double fRet = ( fRedemp / fPrice ) - 1.0;
+ fRet /= GetYearFrac( nNullDate, nSettle, nMat, getDateMode( xOpt, rOB ) );
+
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getYieldmat( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, double fRate, double fPrice, const ANY& rOB )
+ THROWDEF_RTE_IAE
+{
+ if( fRate < 0.0 || fRate <= 0.0 || nSettle >= nMat )
+ THROW_IAE;
+
+ double fRet = GetYieldmat( GetNullDate( xOpt ), nSettle, nMat, nIssue, fRate, fPrice, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getTbilleq( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, double fDisc ) THROWDEF_RTE_IAE
+{
+ nMat++;
+
+ sal_Int32 nDiff = GetDiffDate360( xOpt, nSettle, nMat, sal_True );
+
+ if( fDisc <= 0.0 || nSettle >= nMat || nDiff > 360 )
+ THROW_IAE;
+
+ double fRet = ( 365 * fDisc ) / ( 360 - ( fDisc * double( nDiff ) ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getTbillprice( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, double fDisc ) THROWDEF_RTE_IAE
+{
+ if( fDisc <= 0.0 || nSettle > nMat )
+ THROW_IAE;
+
+ nMat++;
+
+ double fFraction = GetYearFrac( xOpt, nSettle, nMat, 0 ); // method: USA 30/360
+
+ double fDummy;
+ if( modf( fFraction, &fDummy ) == 0.0 )
+ THROW_IAE;
+
+ double fRet = 100.0 * ( 1.0 - fDisc * fFraction );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getTbillyield( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fPrice )
+ THROWDEF_RTE_IAE
+{
+ sal_Int32 nDiff = GetDiffDate360( xOpt, nSettle, nMat, sal_True );
+ nDiff++;
+
+ if( fPrice <= 0.0 || nSettle >= nMat || nDiff > 360 )
+ THROW_IAE;
+
+ double fRet = 100.0;
+ fRet /= fPrice;
+ fRet--;
+ fRet /= double( nDiff );
+ fRet *= 360.0;
+
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getOddfprice( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, sal_Int32 nFirstCoup,
+ double fRate, double fYield, double fRedemp, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ if( fRate < 0 || fYield < 0 || CHK_Freq || nMat <= nFirstCoup || nFirstCoup <= nSettle || nSettle <= nIssue )
+ THROW_IAE;
+
+ double fRet = GetOddfprice( GetNullDate( xOpt ), nSettle, nMat, nIssue, nFirstCoup, fRate, fYield, fRedemp, nFreq, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getOddfyield( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, sal_Int32 nFirstCoup,
+ double fRate, double fPrice, double fRedemp, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ if( fRate < 0 || fPrice <= 0 || CHK_Freq || nMat <= nFirstCoup || nFirstCoup <= nSettle || nSettle <= nIssue )
+ THROW_IAE;
+
+ double fRet = GetOddfyield( GetNullDate( xOpt ), nSettle, nMat, nIssue, nFirstCoup, fRate, fPrice, fRedemp, nFreq,
+ getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getOddlprice( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest,
+ double fRate, double fYield, double fRedemp, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ if( fRate < 0 || fYield < 0 || CHK_Freq || nMat <= nSettle || nSettle <= nLastInterest )
+ THROW_IAE;
+
+ double fRet = GetOddlprice( GetNullDate( xOpt ), nSettle, nMat, nLastInterest, fRate, fYield, fRedemp, nFreq,
+ getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getOddlyield( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest,
+ double fRate, double fPrice, double fRedemp, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ if( fRate < 0 || fPrice <= 0 || CHK_Freq || nMat <= nSettle || nSettle <= nLastInterest )
+ THROW_IAE;
+
+ double fRet = GetOddlyield( GetNullDate( xOpt ), nSettle, nMat, nLastInterest, fRate, fPrice, fRedemp, nFreq,
+ getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+// ============================================================================
+// XIRR helper functions
+
+#define V_(i) (*rValues.Get(i))
+#define D_(i) (*rDates.Get(i))
+
+/** Calculates the resulting amount for the passed interest rate and the given XIRR parameters. */
+double lcl_sca_XirrResult( const ScaDoubleList& rValues, const ScaDoubleList& rDates, double fRate )
+{
+ /* V_0 ... V_n = input values.
+ D_0 ... D_n = input dates.
+ R = input interest rate.
+
+ r := R+1
+ E_i := (D_i-D_0) / 365
+
+ n V_i n V_i
+ f(R) = SUM ------- = V_0 + SUM ------- .
+ i=0 r^E_i i=1 r^E_i
+ */
+ double D_0 = D_(0);
+ double r = fRate + 1.0;
+ double fResult = V_(0);
+ for( sal_uInt32 i = 1, nCount = rValues.Count(); i < nCount; ++i )
+ fResult += V_(i) / pow( r, (D_(i) - D_0) / 365.0 );
+ return fResult;
+}
+
+/** Calculates the first derivation of lcl_sca_XirrResult(). */
+double lcl_sca_XirrResult_Deriv1( const ScaDoubleList& rValues, const ScaDoubleList& rDates, double fRate )
+{
+ /* V_0 ... V_n = input values.
+ D_0 ... D_n = input dates.
+ R = input interest rate.
+
+ r := R+1
+ E_i := (D_i-D_0) / 365
+
+ n V_i
+ f'(R) = [ V_0 + SUM ------- ]'
+ i=1 r^E_i
+
+ n V_i n E_i V_i
+ = 0 + SUM -E_i ----------- r' = - SUM ----------- .
+ i=1 r^(E_i+1) i=1 r^(E_i+1)
+ */
+ double D_0 = D_(0);
+ double r = fRate + 1.0;
+ double fResult = 0.0;
+ for( sal_uInt32 i = 1, nCount = rValues.Count(); i < nCount; ++i )
+ {
+ double E_i = (D_(i) - D_0) / 365.0;
+ fResult -= E_i * V_(i) / pow( r, E_i + 1.0 );
+ }
+ return fResult;
+}
+
+#undef V_
+#undef D_
+
+
+// ----------------------------------------------------------------------------
+// XIRR calculation
+
+double SAL_CALL AnalysisAddIn::getXirr(
+ constREFXPS& xOpt, const SEQSEQ( double )& rValues, const SEQSEQ( sal_Int32 )& rDates, const ANY& rGuessRate ) THROWDEF_RTE_IAE
+{
+ ScaDoubleList aValues, aDates;
+ aValues.Append( rValues );
+ aDates.Append( rDates );
+
+ if( (aValues.Count() < 2) || (aValues.Count() != aDates.Count()) )
+ THROW_IAE;
+
+ // result interest rate, initialized with passed guessed rate, or 10%
+ double fResultRate = aAnyConv.getDouble( xOpt, rGuessRate, 0.1 );
+ if( fResultRate <= -1 )
+ THROW_IAE;
+
+ // maximum epsilon for end of iteration
+ static const double fMaxEps = 1e-10;
+ // maximum number of iterations
+ static const sal_Int32 nMaxIter = 50;
+
+ // Newton's method - try to find a fResultRate, so that lcl_sca_XirrResult() returns 0.
+ double fNewRate, fRateEps, fResultValue;
+ sal_Int32 nIter = 0;
+ bool bContLoop;
+ do
+ {
+ fResultValue = lcl_sca_XirrResult( aValues, aDates, fResultRate );
+ fNewRate = fResultRate - fResultValue / lcl_sca_XirrResult_Deriv1( aValues, aDates, fResultRate );
+ fRateEps = fabs( fNewRate - fResultRate );
+ fResultRate = fNewRate;
+ bContLoop = (fRateEps > fMaxEps) && (fabs( fResultValue ) > fMaxEps);
+ }
+ while( bContLoop && (++nIter < nMaxIter) );
+
+ if( bContLoop )
+ THROW_IAE;
+ RETURN_FINITE( fResultRate );
+}
+
+
+// ============================================================================
+
+double SAL_CALL AnalysisAddIn::getXnpv(
+ double fRate, const SEQSEQ( double )& rValues, const SEQSEQ( sal_Int32 )& rDates ) THROWDEF_RTE_IAE
+{
+ ScaDoubleList aValList;
+ ScaDoubleList aDateList;
+
+ aValList.Append( rValues );
+ aDateList.Append( rDates );
+
+ sal_Int32 nNum = aValList.Count();
+
+ if( nNum != sal_Int32( aDateList.Count() ) || nNum < 2 )
+ THROW_IAE;
+
+ double fRet = 0.0;
+ double fNull = *aDateList.Get( 0 );
+ fRate++;
+
+ for( sal_Int32 i = 0 ; i < nNum ; i++ )
+ fRet += *aValList.Get( i ) / ( pow( fRate, ( *aDateList.Get( i ) - fNull ) / 365.0 ) );
+
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getIntrate( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, double fInvest, double fRedemp, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ if( fInvest <= 0.0 || fRedemp <= 0.0 || nSettle >= nMat )
+ THROW_IAE;
+
+ double fRet = ( ( fRedemp / fInvest ) - 1.0 ) / GetYearDiff( GetNullDate( xOpt ), nSettle, nMat, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getCoupncd( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ double fRet = GetCoupncd( GetNullDate( xOpt ), nSettle, nMat, nFreq, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getCoupdays( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ double fRet = GetCoupdays( GetNullDate( xOpt ), nSettle, nMat, nFreq, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getCoupdaysnc( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ double fRet = GetCoupdaysnc( GetNullDate( xOpt ), nSettle, nMat, nFreq, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getCoupdaybs( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ double fRet = GetCoupdaybs( GetNullDate( xOpt ), nSettle, nMat, nFreq, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getCouppcd( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ double fRet = GetCouppcd( GetNullDate( xOpt ), nSettle, nMat, nFreq, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getCoupnum( constREFXPS& xOpt,
+ sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
+{
+ double fRet = GetCoupnum( GetNullDate( xOpt ), nSettle, nMat, nFreq, getDateMode( xOpt, rOB ) );
+ RETURN_FINITE( fRet );
+}
+
+
+double SAL_CALL AnalysisAddIn::getFvschedule( double fPrinc, const SEQSEQ( double )& rSchedule ) THROWDEF_RTE_IAE
+{
+ ScaDoubleList aSchedList;
+
+ aSchedList.Append( rSchedule );
+
+ for( const double* p = aSchedList.First() ; p ; p = aSchedList.Next() )
+ fPrinc *= 1.0 + *p;
+
+ RETURN_FINITE( fPrinc );
+}
+
+
diff --git a/scaddins/source/analysis/makefile.mk b/scaddins/source/analysis/makefile.mk
new file mode 100644
index 000000000000..d837d644dc21
--- /dev/null
+++ b/scaddins/source/analysis/makefile.mk
@@ -0,0 +1,134 @@
+#**************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#**************************************************************************
+
+PRJ=..$/..
+PRJNAME=scaddins
+
+TARGET=analysis
+
+
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+LIBTARGET=NO
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+UNOUCRRDB=$(SOLARBINDIR)$/types.rdb $(BIN)$/analysisadd.rdb
+UNOUCRDEP=$(UNOUCRRDB)
+
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)$/$(TARGET)
+INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+# comprehensive type info, so rdb needn't be installed
+NO_OFFUH=TRUE
+CPPUMAKERFLAGS*=-C
+
+UNOTYPES=\
+ com.sun.star.sheet.addin.XAnalysis \
+ com.sun.star.lang.XComponent \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XSingleComponentFactory \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.uno.XInterface \
+ com.sun.star.registry.XImplementationRegistration \
+ com.sun.star.sheet.LocalizedName \
+ com.sun.star.sheet.XAddIn \
+ com.sun.star.sheet.XCompatibilityNames \
+ com.sun.star.lang.XServiceName \
+ com.sun.star.lang.XServiceInfo \
+ com.sun.star.lang.XTypeProvider \
+ com.sun.star.uno.XWeak \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.uno.XComponentContext \
+ com.sun.star.util.Date \
+ com.sun.star.util.XNumberFormatter \
+ com.sun.star.util.XNumberFormatTypes
+
+# --- Files -------------------------------------
+
+SLOFILES=\
+ $(SLO)$/analysis.obj \
+ $(SLO)$/financial.obj \
+ $(SLO)$/analysishelper.obj \
+ $(SLO)$/bessel.obj
+
+# SCO: the linker does know about weak symbols, but we can't ignore multiple defined symbols
+.IF "$(OS)"=="SCO"
+SLOFILES+=$(SLO)$/staticmb.obj
+.ENDIF
+
+ALLIDLFILES=\
+ analysisadd.idl
+
+SRS1NAME=$(TARGET)
+SRC1FILES = \
+ analysis.src \
+ analysis_funcnames.src \
+ analysis_deffuncnames.src
+
+# --- Library -----------------------------------
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+SHL1OBJS=$(SLOFILES)
+SHL1STDLIBS= \
+ $(TOOLSLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1DEPN=makefile.mk
+
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+# --- Resourcen ----------------------------------------------------
+
+RESLIB1LIST=\
+ $(SRS)$/analysis.srs
+
+RESLIB1NAME=analysis
+RESLIB1SRSFILES=\
+ $(RESLIB1LIST)
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
+$(BIN)$/analysisadd.rdb: $(ALLIDLFILES)
+ $(IDLC) -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $?
+ $(REGMERGE) $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)}
+ touch $@
+
+
diff --git a/scaddins/source/datefunc/dateadd.idl b/scaddins/source/datefunc/dateadd.idl
new file mode 100644
index 000000000000..2ac925678938
--- /dev/null
+++ b/scaddins/source/datefunc/dateadd.idl
@@ -0,0 +1,118 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/beans/XPropertySet.idl>
+#include <com/sun/star/sheet/LocalizedName.idl>
+
+module com
+{
+module sun
+{
+module star
+{
+module sheet
+{
+module addin
+{
+ interface XCompatibilityNames : com::sun::star::uno::XInterface
+ {
+ /// @return a sequence with all localized names for a programmatic name
+ sequence< com::sun::star::sheet::LocalizedName > getCompatibilityNames ( [in] string aProgrammaticName );
+ };
+
+ /**
+ * Interface with date functions.
+ */
+ interface XDateFunctions : com::sun::star::uno::XInterface
+ {
+ /// calculates the number of weeks between two dates.
+ long getDiffWeeks(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long nStartDate, [in] long nEndDate, [in] long nMode )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// calculates the number of months between two dates.
+ long getDiffMonths(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long nStartDate, [in] long nEndDate, [in] long nMode )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// calculates the number of years between two dates.
+ long getDiffYears(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long nStartDate, [in] long nEndDate, [in] long nMode )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// checks if a date is in a leap year.
+ long getIsLeapYear(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long nDate )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// calculates the number of days in a month.
+ long getDaysInMonth(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long nDate )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// calculates the number of days in a year.
+ long getDaysInYear(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long nDate )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /// calculates the number of weeks in a year.
+ long getWeeksInYear(
+ [in] com::sun::star::beans::XPropertySet xOptions,
+ [in] long nDate )
+ raises( com::sun::star::lang::IllegalArgumentException );
+ };
+
+ /**
+ * Interface with miscellaneous functions.
+ */
+ interface XMiscFunctions : com::sun::star::uno::XInterface
+ {
+ /// Encrypts or decrypts a string using the ROT13 algorithm.
+ string getRot13( [in] string aSrcString )
+ raises( com::sun::star::lang::IllegalArgumentException );
+ };
+
+ service DateFunctions
+ {
+ // exported interfaces:
+ interface XDateFunctions;
+ interface XMiscFunctions;
+ };
+};
+};
+};
+};
+};
+
diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx
new file mode 100644
index 000000000000..988f132ff9f4
--- /dev/null
+++ b/scaddins/source/datefunc/datefunc.cxx
@@ -0,0 +1,1000 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+//------------------------------------------------------------------
+//
+// date functions add in
+//
+//------------------------------------------------------------------
+
+#include "datefunc.hxx"
+#ifndef _SCA_DATEFUNC_HRC
+#include "datefunc.hrc"
+#endif
+#include <cppuhelper/factory.hxx>
+#include <osl/diagnose.h>
+#include <rtl/ustrbuf.hxx>
+#include <tools/resmgr.hxx>
+#include <tools/rcid.h>
+#include <com/sun/star/util/Date.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+//------------------------------------------------------------------
+
+#define ADDIN_SERVICE "com.sun.star.sheet.AddIn"
+#define MY_SERVICE "com.sun.star.sheet.addin.DateFunctions"
+#define MY_IMPLNAME "com.sun.star.sheet.addin.DateFunctionsImpl"
+
+//------------------------------------------------------------------
+
+#define STR_FROM_ANSI( s ) OUString( s, strlen( s ), RTL_TEXTENCODING_MS_1252 )
+
+//------------------------------------------------------------------
+
+const sal_uInt32 ScaList::nStartSize = 16;
+const sal_uInt32 ScaList::nIncrSize = 16;
+
+ScaList::ScaList() :
+ pData( new void*[ nStartSize ] ),
+ nSize( nStartSize ),
+ nCount( 0 ),
+ nCurr( 0 )
+{
+}
+
+ScaList::~ScaList()
+{
+ delete[] pData;
+}
+
+void ScaList::_Grow()
+{
+ nSize += nIncrSize;
+
+ void** pNewData = new void*[ nSize ];
+ memcpy( pNewData, pData, nCount * sizeof( void* ) );
+
+ delete[] pData;
+ pData = pNewData;
+}
+
+void ScaList::Insert( void* pNew, sal_uInt32 nIndex )
+{
+ if( nIndex >= nCount )
+ Append( pNew );
+ else
+ {
+ Grow();
+
+ void** pIns = pData + nIndex;
+ memmove( pIns + 1, pIns, (nCount - nIndex) * sizeof( void* ) );
+
+ *pIns = pNew;
+ nCount++;
+ }
+}
+
+
+//------------------------------------------------------------------
+
+ScaStringList::~ScaStringList()
+{
+ for( OUString* pStr = First(); pStr; pStr = Next() )
+ delete pStr;
+}
+
+//------------------------------------------------------------------
+
+ScaResId::ScaResId( sal_uInt16 nId, ResMgr& rResMgr ) :
+ ResId( nId, rResMgr )
+{
+}
+
+
+//------------------------------------------------------------------
+
+#define UNIQUE sal_False // function name does not exist in Calc
+#define DOUBLE sal_True // function name exists in Calc
+
+#define STDPAR sal_False // all parameters are described
+#define INTPAR sal_True // first parameter is internal
+
+#define FUNCDATA( FuncName, ParamCount, Category, Double, IntPar ) \
+ { "get" #FuncName, DATE_FUNCNAME_##FuncName, DATE_FUNCDESC_##FuncName, DATE_DEFFUNCNAME_##FuncName, ParamCount, Category, Double, IntPar }
+
+const ScaFuncDataBase pFuncDataArr[] =
+{
+ FUNCDATA( DiffWeeks, 3, ScaCat_DateTime, UNIQUE, INTPAR ),
+ FUNCDATA( DiffMonths, 3, ScaCat_DateTime, UNIQUE, INTPAR ),
+ FUNCDATA( DiffYears, 3, ScaCat_DateTime, UNIQUE, INTPAR ),
+ FUNCDATA( IsLeapYear, 1, ScaCat_DateTime, UNIQUE, INTPAR ),
+ FUNCDATA( DaysInMonth, 1, ScaCat_DateTime, UNIQUE, INTPAR ),
+ FUNCDATA( DaysInYear, 1, ScaCat_DateTime, UNIQUE, INTPAR ),
+ FUNCDATA( WeeksInYear, 1, ScaCat_DateTime, UNIQUE, INTPAR ),
+ FUNCDATA( Rot13, 1, ScaCat_Text, UNIQUE, STDPAR )
+};
+
+#undef FUNCDATA
+
+
+//------------------------------------------------------------------
+
+ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rResMgr ) :
+ aIntName( OUString::createFromAscii( rBaseData.pIntName ) ),
+ nUINameID( rBaseData.nUINameID ),
+ nDescrID( rBaseData.nDescrID ),
+ nCompListID( rBaseData.nCompListID ),
+ nParamCount( rBaseData.nParamCount ),
+ eCat( rBaseData.eCat ),
+ bDouble( rBaseData.bDouble ),
+ bWithOpt( rBaseData.bWithOpt )
+{
+ ScaResStringArrLoader aArrLoader( RID_DATE_DEFFUNCTION_NAMES, nCompListID, rResMgr );
+ const ResStringArray& rArr = aArrLoader.GetStringArray();
+
+ for( sal_uInt16 nIndex = 0; nIndex < rArr.Count(); nIndex++ )
+ aCompList.Append( rArr.GetString( nIndex ) );
+}
+
+ScaFuncData::~ScaFuncData()
+{
+}
+
+sal_uInt16 ScaFuncData::GetStrIndex( sal_uInt16 nParam ) const
+{
+ if( !bWithOpt )
+ nParam++;
+ return (nParam > nParamCount) ? (nParamCount * 2) : (nParam * 2);
+}
+
+
+//------------------------------------------------------------------
+
+ScaFuncDataList::ScaFuncDataList( ResMgr& rResMgr ) :
+ nLast( 0xFFFFFFFF )
+{
+ const sal_uInt32 nCnt = sizeof( pFuncDataArr ) / sizeof( ScaFuncDataBase );
+
+ for( sal_uInt16 nIndex = 0; nIndex < nCnt; nIndex++ )
+ Append( new ScaFuncData( pFuncDataArr[ nIndex ], rResMgr ) );
+}
+
+ScaFuncDataList::~ScaFuncDataList()
+{
+ for( ScaFuncData* pFData = First(); pFData; pFData = Next() )
+ delete pFData;
+}
+
+const ScaFuncData* ScaFuncDataList::Get( const OUString& rProgrammaticName ) const
+{
+ if( aLastName == rProgrammaticName )
+ return Get( nLast );
+
+ for( sal_uInt32 nIndex = 0; nIndex < Count(); nIndex++ )
+ {
+ const ScaFuncData* pCurr = Get( nIndex );
+ if( pCurr->Is( rProgrammaticName ) )
+ {
+ const_cast< ScaFuncDataList* >( this )->aLastName = rProgrammaticName;
+ const_cast< ScaFuncDataList* >( this )->nLast = nIndex;
+ return pCurr;
+ }
+ }
+ return NULL;
+}
+
+
+//------------------------------------------------------------------
+
+ScaFuncRes::ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUString& rRet ) :
+ Resource( rResId )
+{
+ rRet = String( ScaResId( nIndex, rResMgr ) );
+ FreeResource();
+}
+
+
+//------------------------------------------------------------------
+//
+// entry points for service registration / instantiation
+//
+//------------------------------------------------------------------
+
+uno::Reference< uno::XInterface > SAL_CALL ScaDateAddIn_CreateInstance(
+ const uno::Reference< lang::XMultiServiceFactory >& )
+{
+ static uno::Reference< uno::XInterface > xInst = (cppu::OWeakObject*) new ScaDateAddIn();
+ return xInst;
+}
+
+
+//------------------------------------------------------------------------
+
+extern "C" {
+
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+sal_Bool SAL_CALL component_writeInfo(
+ void * /*pServiceManager*/, registry::XRegistryKey * pRegistryKey )
+{
+ if (pRegistryKey)
+ {
+ try
+ {
+ OUString aImpl = OUString::createFromAscii( "/" );
+ aImpl += ScaDateAddIn::getImplementationName_Static();
+ aImpl += OUString::createFromAscii( "/UNO/SERVICES" );
+
+ uno::Reference< registry::XRegistryKey > xNewKey(
+ reinterpret_cast< registry::XRegistryKey* >( pRegistryKey )->createKey( aImpl ) );
+
+ uno::Sequence< OUString > aSequ = ScaDateAddIn::getSupportedServiceNames_Static();
+ const OUString * pArray = aSequ.getConstArray();
+ for( sal_Int32 i = 0; i < aSequ.getLength(); i++ )
+ xNewKey->createKey( pArray[i] );
+
+ return sal_True;
+ }
+ catch (registry::InvalidRegistryException&)
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
+{
+ void* pRet = 0;
+
+ if ( pServiceManager &&
+ OUString::createFromAscii( pImplName ) == ScaDateAddIn::getImplementationName_Static() )
+ {
+ uno::Reference< lang::XSingleServiceFactory > xFactory( cppu::createOneInstanceFactory(
+ reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
+ ScaDateAddIn::getImplementationName_Static(),
+ ScaDateAddIn_CreateInstance,
+ ScaDateAddIn::getSupportedServiceNames_Static() ) );
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+
+} // extern C
+
+//------------------------------------------------------------------------
+//
+// "normal" service implementation
+//
+//------------------------------------------------------------------------
+
+ScaDateAddIn::ScaDateAddIn() :
+ pDefLocales( NULL ),
+ pResMgr( NULL ),
+ pFuncDataList( NULL )
+{
+}
+
+ScaDateAddIn::~ScaDateAddIn()
+{
+ if( pFuncDataList )
+ delete pFuncDataList;
+ if( pDefLocales )
+ delete[] pDefLocales;
+
+ // pResMgr already deleted (_all_ resource managers are deleted _before_ this dtor is called)
+}
+
+static const sal_Char* pLang[] = { "de", "en" };
+static const sal_Char* pCoun[] = { "DE", "US" };
+static const sal_uInt32 nNumOfLoc = sizeof( pLang ) / sizeof( sal_Char* );
+
+void ScaDateAddIn::InitDefLocales()
+{
+ pDefLocales = new lang::Locale[ nNumOfLoc ];
+
+ for( sal_uInt32 nIndex = 0; nIndex < nNumOfLoc; nIndex++ )
+ {
+ pDefLocales[ nIndex ].Language = OUString::createFromAscii( pLang[ nIndex ] );
+ pDefLocales[ nIndex ].Country = OUString::createFromAscii( pCoun[ nIndex ] );
+ }
+}
+
+const lang::Locale& ScaDateAddIn::GetLocale( sal_uInt32 nIndex )
+{
+ if( !pDefLocales )
+ InitDefLocales();
+
+ return (nIndex < sizeof( pLang )) ? pDefLocales[ nIndex ] : aFuncLoc;
+}
+
+ResMgr& ScaDateAddIn::GetResMgr() throw( uno::RuntimeException )
+{
+ if( !pResMgr )
+ {
+ InitData(); // try to get resource manager
+ if( !pResMgr )
+ throw uno::RuntimeException();
+ }
+ return *pResMgr;
+}
+
+void ScaDateAddIn::InitData()
+{
+ if( pResMgr )
+ delete pResMgr;
+
+ OString aModName( "date" );
+ pResMgr = ResMgr::CreateResMgr( (const sal_Char*) aModName,
+ aFuncLoc );
+
+ if( pFuncDataList )
+ delete pFuncDataList;
+
+ pFuncDataList = pResMgr ? new ScaFuncDataList( *pResMgr ) : NULL;
+
+ if( pDefLocales )
+ {
+ delete pDefLocales;
+ pDefLocales = NULL;
+ }
+}
+
+OUString ScaDateAddIn::GetDisplFuncStr( sal_uInt16 nResId ) throw( uno::RuntimeException )
+{
+ return ScaResStringLoader( RID_DATE_FUNCTION_NAMES, nResId, GetResMgr() ).GetString();
+}
+
+OUString ScaDateAddIn::GetFuncDescrStr( sal_uInt16 nResId, sal_uInt16 nStrIndex ) throw( uno::RuntimeException )
+{
+ OUString aRet;
+
+ ScaResPublisher aResPubl( ScaResId( RID_DATE_FUNCTION_DESCRIPTIONS, GetResMgr() ) );
+ ScaResId aResId( nResId, GetResMgr() );
+ aResId.SetRT( RSC_RESOURCE );
+
+ if( aResPubl.IsAvailableRes( aResId ) )
+ ScaFuncRes aSubRes( aResId, GetResMgr(), nStrIndex, aRet );
+
+ aResPubl.FreeResource();
+ return aRet;
+}
+
+
+//------------------------------------------------------------------------
+
+OUString ScaDateAddIn::getImplementationName_Static()
+{
+ return OUString::createFromAscii( MY_IMPLNAME );
+}
+
+uno::Sequence< OUString > ScaDateAddIn::getSupportedServiceNames_Static()
+{
+ uno::Sequence< OUString > aRet( 2 );
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString::createFromAscii( ADDIN_SERVICE );
+ pArray[1] = OUString::createFromAscii( MY_SERVICE );
+ return aRet;
+}
+
+// XServiceName
+
+OUString SAL_CALL ScaDateAddIn::getServiceName() throw( uno::RuntimeException )
+{
+ // name of specific AddIn service
+ return OUString::createFromAscii( MY_SERVICE );
+}
+
+// XServiceInfo
+
+OUString SAL_CALL ScaDateAddIn::getImplementationName() throw( uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+sal_Bool SAL_CALL ScaDateAddIn::supportsService( const OUString& aServiceName ) throw( uno::RuntimeException )
+{
+ return aServiceName.equalsAscii( ADDIN_SERVICE ) ||
+ aServiceName.equalsAscii( MY_SERVICE );
+}
+
+uno::Sequence< OUString > SAL_CALL ScaDateAddIn::getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+// XLocalizable
+
+void SAL_CALL ScaDateAddIn::setLocale( const lang::Locale& eLocale ) throw( uno::RuntimeException )
+{
+ aFuncLoc = eLocale;
+ InitData(); // change of locale invalidates resources!
+}
+
+lang::Locale SAL_CALL ScaDateAddIn::getLocale() throw( uno::RuntimeException )
+{
+ return aFuncLoc;
+}
+
+//------------------------------------------------------------------
+//
+// function descriptions start here
+//
+//------------------------------------------------------------------
+
+// XAddIn
+
+OUString SAL_CALL ScaDateAddIn::getProgrammaticFuntionName( const OUString& ) throw( uno::RuntimeException )
+{
+ // not used by calc
+ // (but should be implemented for other uses of the AddIn service)
+ return OUString();
+}
+
+OUString SAL_CALL ScaDateAddIn::getDisplayFunctionName( const OUString& aProgrammaticName ) throw( uno::RuntimeException )
+{
+ OUString aRet;
+
+ const ScaFuncData* pFData = pFuncDataList->Get( aProgrammaticName );
+ if( pFData )
+ {
+ aRet = GetDisplFuncStr( pFData->GetUINameID() );
+ if( pFData->IsDouble() )
+ aRet += STR_FROM_ANSI( "_ADD" );
+ }
+ else
+ {
+ aRet = STR_FROM_ANSI( "UNKNOWNFUNC_" );
+ aRet += aProgrammaticName;
+ }
+
+ return aRet;
+}
+
+OUString SAL_CALL ScaDateAddIn::getFunctionDescription( const OUString& aProgrammaticName ) throw( uno::RuntimeException )
+{
+ OUString aRet;
+
+ const ScaFuncData* pFData = pFuncDataList->Get( aProgrammaticName );
+ if( pFData )
+ aRet = GetFuncDescrStr( pFData->GetDescrID(), 1 );
+
+ return aRet;
+}
+
+OUString SAL_CALL ScaDateAddIn::getDisplayArgumentName(
+ const OUString& aProgrammaticName, sal_Int32 nArgument ) throw( uno::RuntimeException )
+{
+ OUString aRet;
+
+ const ScaFuncData* pFData = pFuncDataList->Get( aProgrammaticName );
+ if( pFData && (nArgument <= 0xFFFF) )
+ {
+ sal_uInt16 nStr = pFData->GetStrIndex( static_cast< sal_uInt16 >( nArgument ) );
+ if( nStr )
+ aRet = GetFuncDescrStr( pFData->GetDescrID(), nStr );
+ else
+ aRet = STR_FROM_ANSI( "internal" );
+ }
+
+ return aRet;
+}
+
+OUString SAL_CALL ScaDateAddIn::getArgumentDescription(
+ const OUString& aProgrammaticName, sal_Int32 nArgument ) throw( uno::RuntimeException )
+{
+ OUString aRet;
+
+ const ScaFuncData* pFData = pFuncDataList->Get( aProgrammaticName );
+ if( pFData && (nArgument <= 0xFFFF) )
+ {
+ sal_uInt16 nStr = pFData->GetStrIndex( static_cast< sal_uInt16 >( nArgument ) );
+ if( nStr )
+ aRet = GetFuncDescrStr( pFData->GetDescrID(), nStr + 1 );
+ else
+ aRet = STR_FROM_ANSI( "for internal use only" );
+ }
+
+ return aRet;
+}
+
+OUString SAL_CALL ScaDateAddIn::getProgrammaticCategoryName(
+ const OUString& aProgrammaticName ) throw( uno::RuntimeException )
+{
+ OUString aRet;
+
+ const ScaFuncData* pFData = pFuncDataList->Get( aProgrammaticName );
+ if( pFData )
+ {
+ switch( pFData->GetCategory() )
+ {
+ case ScaCat_DateTime: aRet = STR_FROM_ANSI( "Date&Time" ); break;
+ case ScaCat_Text: aRet = STR_FROM_ANSI( "Text" ); break;
+ case ScaCat_Finance: aRet = STR_FROM_ANSI( "Financial" ); break;
+ case ScaCat_Inf: aRet = STR_FROM_ANSI( "Information" ); break;
+ case ScaCat_Math: aRet = STR_FROM_ANSI( "Mathematical" ); break;
+ case ScaCat_Tech: aRet = STR_FROM_ANSI( "Technical" ); break;
+ default: // to prevent compiler warnings
+ break;
+ }
+ }
+
+ if( !aRet.getLength() )
+ aRet = STR_FROM_ANSI( "Add-In" );
+ return aRet;
+}
+
+OUString SAL_CALL ScaDateAddIn::getDisplayCategoryName(
+ const OUString& aProgrammaticName ) throw( uno::RuntimeException )
+{
+ return getProgrammaticCategoryName( aProgrammaticName );
+}
+
+
+// XCompatibilityNames
+
+uno::Sequence< sheet::LocalizedName > SAL_CALL ScaDateAddIn::getCompatibilityNames(
+ const OUString& aProgrammaticName ) throw( uno::RuntimeException )
+{
+ const ScaFuncData* pFData = pFuncDataList->Get( aProgrammaticName );
+ if( !pFData )
+ return uno::Sequence< sheet::LocalizedName >( 0 );
+
+ const ScaStringList& rStrList = pFData->GetCompNameList();
+ sal_uInt32 nCount = rStrList.Count();
+
+ uno::Sequence< sheet::LocalizedName > aRet( nCount );
+ sheet::LocalizedName* pArray = aRet.getArray();
+
+ for( sal_uInt32 nIndex = 0; nIndex < nCount; nIndex++ )
+ pArray[ nIndex ] = sheet::LocalizedName( GetLocale( nIndex ), *rStrList.Get( nIndex ) );
+
+ return aRet;
+}
+
+
+//------------------------------------------------------------------
+//
+// function implementation starts here
+//
+//------------------------------------------------------------------
+
+// auxiliary functions
+
+sal_Bool IsLeapYear( sal_uInt16 nYear )
+{
+ return ((((nYear % 4) == 0) && ((nYear % 100) != 0)) || ((nYear % 400) == 0));
+}
+
+sal_uInt16 DaysInMonth( sal_uInt16 nMonth, sal_uInt16 nYear )
+{
+ static sal_uInt16 aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30,
+ 31, 31, 30, 31, 30, 31 };
+
+ if ( nMonth != 2 )
+ return aDaysInMonth[nMonth-1];
+ else
+ {
+ if ( IsLeapYear(nYear) )
+ return aDaysInMonth[nMonth-1] + 1;
+ else
+ return aDaysInMonth[nMonth-1];
+ }
+}
+
+/**
+ * Convert a date to a count of days starting from 01/01/0001
+ *
+ * The internal representation of a Date used in this Addin
+ * is the number of days between 01/01/0001 and the date
+ * this function converts a Day , Month, Year representation
+ * to this internal Date value.
+ */
+
+sal_Int32 DateToDays( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear )
+{
+ sal_Int32 nDays = ((sal_Int32)nYear-1) * 365;
+ nDays += ((nYear-1) / 4) - ((nYear-1) / 100) + ((nYear-1) / 400);
+
+ for( sal_uInt16 i = 1; i < nMonth; i++ )
+ nDays += DaysInMonth(i,nYear);
+ nDays += nDay;
+
+ return nDays;
+}
+
+/**
+ * Convert a count of days starting from 01/01/0001 to a date
+ *
+ * The internal representation of a Date used in this Addin
+ * is the number of days between 01/01/0001 and the date
+ * this function converts this internal Date value
+ * to a Day , Month, Year representation of a Date.
+ */
+
+void DaysToDate( sal_Int32 nDays,
+ sal_uInt16& rDay, sal_uInt16& rMonth, sal_uInt16& rYear )
+ throw( lang::IllegalArgumentException )
+{
+ if( nDays < 0 )
+ throw lang::IllegalArgumentException();
+
+ sal_Int32 nTempDays;
+ sal_Int32 i = 0;
+ sal_Bool bCalc;
+
+ do
+ {
+ nTempDays = nDays;
+ rYear = (sal_uInt16)((nTempDays / 365) - i);
+ nTempDays -= ((sal_Int32) rYear -1) * 365;
+ nTempDays -= (( rYear -1) / 4) - (( rYear -1) / 100) + ((rYear -1) / 400);
+ bCalc = sal_False;
+ if ( nTempDays < 1 )
+ {
+ i++;
+ bCalc = sal_True;
+ }
+ else
+ {
+ if ( nTempDays > 365 )
+ {
+ if ( (nTempDays != 366) || !IsLeapYear( rYear ) )
+ {
+ i--;
+ bCalc = sal_True;
+ }
+ }
+ }
+ }
+ while ( bCalc );
+
+ rMonth = 1;
+ while ( (sal_Int32)nTempDays > DaysInMonth( rMonth, rYear ) )
+ {
+ nTempDays -= DaysInMonth( rMonth, rYear );
+ rMonth++;
+ }
+ rDay = (sal_uInt16)nTempDays;
+}
+
+/**
+ * Get the null date used by the spreadsheet document
+ *
+ * The internal representation of a Date used in this Addin
+ * is the number of days between 01/01/0001 and the date
+ * this function returns this internal Date value for the document null date
+ *
+ */
+
+sal_Int32 GetNullDate( const uno::Reference< beans::XPropertySet >& xOptions )
+ throw( uno::RuntimeException )
+{
+ if (xOptions.is())
+ {
+ try
+ {
+ uno::Any aAny = xOptions->getPropertyValue(
+ OUString::createFromAscii( "NullDate" ) );
+ util::Date aDate;
+ if ( aAny >>= aDate )
+ return DateToDays( aDate.Day, aDate.Month, aDate.Year );
+ }
+ catch (uno::Exception&)
+ {
+ }
+ }
+
+ // no null date available -> no calculations possible
+ throw uno::RuntimeException();
+}
+
+// XDateFunctions
+
+/**
+ * Get week difference between 2 dates
+ *
+ * new Weeks(date1,date2,mode) function for StarCalc
+ *
+ * Two modes of operation are provided.
+ * The first is just a simple division by 7 calculation.
+ *
+ * The second calculates the diffence by week of year.
+ *
+ * The International Standard IS-8601 has decreed that Monday
+ * shall be the first day of the week.
+ *
+ * A week that lies partly in one year and partly in annother
+ * is assigned a number in the the year in which most of its days lie.
+ *
+ * That means that week 1 of any year is the week that contains the 4. January
+ *
+ * The internal representation of a Date used in the Addin is the number of days based on 01/01/0001
+ *
+ * A WeekDay can be then calculated by substracting 1 and calculating the rest of
+ * a division by 7, which gives a 0 - 6 value for Monday - Sunday
+ *
+ * Using the 4. January rule explained above the formula
+ *
+ * nWeek1= ( nDays1 - nJan4 + ( (nJan4-1) % 7 ) ) / 7 + 1;
+ *
+ * calculates a number between 0-53 for each day which is in the same year as nJan4
+ * where 0 means that this week belonged to the year before.
+ *
+ * If a day in the same or annother year is used in this formula this calculates
+ * an calendar week offset from a given 4. January
+ *
+ * nWeek2 = ( nDays2 - nJan4 + ( (nJan4-1) % 7 ) ) / 7 + 1;
+ *
+ * The 4.January of first Date Argument can thus be used to calculate
+ * the week difference by calendar weeks which is then nWeek = nWeek2 - nWeek1
+ *
+ * which can be optimized to
+ *
+ * nWeek = ( (nDays2-nJan4+((nJan4-1)%7))/7 ) - ( (nDays1-nJan4+((nJan4-1)%7))/7 )
+ *
+ * Note: All calculations are operating on the long integer data type
+ * % is the modulo operator in C which calculates the rest of an Integer division
+ *
+ *
+ * mode 0 is the interval between the dates in month, that is days / 7
+ *
+ * mode 1 is the difference by week of year
+ *
+ */
+
+sal_Int32 SAL_CALL ScaDateAddIn::getDiffWeeks(
+ const uno::Reference< beans::XPropertySet >& xOptions,
+ sal_Int32 nStartDate, sal_Int32 nEndDate,
+ sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ sal_Int32 nNullDate = GetNullDate( xOptions );
+
+ sal_Int32 nDays1 = nStartDate + nNullDate;
+ sal_Int32 nDays2 = nEndDate + nNullDate;
+
+ sal_Int32 nRet;
+
+ if ( nMode == 1 )
+ {
+ sal_uInt16 nDay,nMonth,nYear;
+ DaysToDate( nDays1, nDay, nMonth, nYear );
+ sal_Int32 nJan4 = DateToDays( 4, 1, nYear );
+
+ nRet = ( (nDays2-nJan4+((nJan4-1)%7))/7 ) - ( (nDays1-nJan4+((nJan4-1)%7))/7 );
+ }
+ else
+ {
+ nRet = (nDays2 - nDays1) / 7;
+ }
+ return nRet;
+}
+
+/**
+ * Get month difference between 2 dates
+ * =Month(start, end, mode) Function for StarCalc
+ *
+ * two modes are provided
+ *
+ * mode 0 is the interval between the dates in month
+ *
+ * mode 1 is the difference in calendar month
+ */
+
+sal_Int32 SAL_CALL ScaDateAddIn::getDiffMonths(
+ const uno::Reference< beans::XPropertySet >& xOptions,
+ sal_Int32 nStartDate, sal_Int32 nEndDate,
+ sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ sal_Int32 nNullDate = GetNullDate( xOptions );
+
+ sal_Int32 nDays1 = nStartDate + nNullDate;
+ sal_Int32 nDays2 = nEndDate + nNullDate;
+
+ sal_uInt16 nDay1,nMonth1,nYear1;
+ sal_uInt16 nDay2,nMonth2,nYear2;
+ DaysToDate(nDays1,nDay1,nMonth1,nYear1);
+ DaysToDate(nDays2,nDay2,nMonth2,nYear2);
+
+ sal_Int32 nRet = nMonth2 - nMonth1 + (nYear2 - nYear1) * 12;
+ if ( nMode == 1 || nDays1 == nDays2 ) return nRet;
+
+ if ( nDays1 < nDays2 )
+ {
+ if ( nDay1 > nDay2 )
+ {
+ nRet -= 1;
+ }
+ }
+ else
+ {
+ if ( nDay1 < nDay2 )
+ {
+ nRet += 1;
+ }
+ }
+
+ return nRet;
+}
+
+/**
+ * Get Year difference between 2 dates
+ *
+ * two modes are provided
+ *
+ * mode 0 is the interval between the dates in years
+ *
+ * mode 1 is the difference in calendar years
+ */
+
+sal_Int32 SAL_CALL ScaDateAddIn::getDiffYears(
+ const uno::Reference< beans::XPropertySet >& xOptions,
+ sal_Int32 nStartDate, sal_Int32 nEndDate,
+ sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ if ( nMode != 1 )
+ return getDiffMonths( xOptions, nStartDate, nEndDate, nMode ) / 12;
+
+ sal_Int32 nNullDate = GetNullDate( xOptions );
+
+ sal_Int32 nDays1 = nStartDate + nNullDate;
+ sal_Int32 nDays2 = nEndDate + nNullDate;
+
+ sal_uInt16 nDay1,nMonth1,nYear1;
+ sal_uInt16 nDay2,nMonth2,nYear2;
+ DaysToDate(nDays1,nDay1,nMonth1,nYear1);
+ DaysToDate(nDays2,nDay2,nMonth2,nYear2);
+
+ return nYear2 - nYear1;
+}
+
+/**
+ * Check if a Date is in a leap year in the Gregorian calendar
+ */
+
+sal_Int32 SAL_CALL ScaDateAddIn::getIsLeapYear(
+ const uno::Reference< beans::XPropertySet >& xOptions,
+ sal_Int32 nDate ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ sal_Int32 nNullDate = GetNullDate( xOptions );
+ sal_Int32 nDays = nDate + nNullDate;
+
+ sal_uInt16 nDay, nMonth, nYear;
+ DaysToDate(nDays,nDay,nMonth,nYear);
+
+ return (sal_Int32)IsLeapYear(nYear);
+}
+
+/**
+ * Get the Number of Days in the month for a date
+ */
+
+sal_Int32 SAL_CALL ScaDateAddIn::getDaysInMonth(
+ const uno::Reference<beans::XPropertySet>& xOptions,
+ sal_Int32 nDate ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ sal_Int32 nNullDate = GetNullDate( xOptions );
+ sal_Int32 nDays = nDate + nNullDate;
+
+ sal_uInt16 nDay, nMonth, nYear;
+ DaysToDate(nDays,nDay,nMonth,nYear);
+
+ return DaysInMonth( nMonth, nYear );
+}
+
+/**
+ * Get number of days in the year of a date specified
+ */
+
+sal_Int32 SAL_CALL ScaDateAddIn::getDaysInYear(
+ const uno::Reference< beans::XPropertySet >& xOptions,
+ sal_Int32 nDate ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ sal_Int32 nNullDate = GetNullDate( xOptions );
+ sal_Int32 nDays = nDate + nNullDate;
+
+ sal_uInt16 nDay, nMonth, nYear;
+ DaysToDate(nDays,nDay,nMonth,nYear);
+
+ return ( IsLeapYear(nYear) ? 366 : 365 );
+}
+
+/**
+ * Get number of weeks in the year for a date
+ *
+ * Most years have 52 weeks, but years that start on a Thursday
+ * and leep years that start on a Wednesday have 53 weeks
+ *
+ * The International Standard IS-8601 has decreed that Monday
+ * shall be the first day of the week.
+ *
+ * A WeekDay can be calculated by substracting 1 and calculating the rest of
+ * a division by 7 from the internal date represention
+ * which gives a 0 - 6 value for Monday - Sunday
+ *
+ * @see #IsLeapYear #WeekNumber
+ */
+
+sal_Int32 SAL_CALL ScaDateAddIn::getWeeksInYear(
+ const uno::Reference< beans::XPropertySet >& xOptions,
+ sal_Int32 nDate ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ sal_Int32 nNullDate = GetNullDate( xOptions );
+ sal_Int32 nDays = nDate + nNullDate;
+
+ sal_uInt16 nDay, nMonth, nYear;
+ DaysToDate(nDays,nDay,nMonth,nYear);
+
+ sal_Int32 nJan1WeekDay = ( DateToDays(1,1,nYear) - 1) % 7;
+
+ sal_Int32 nRet;
+ if ( nJan1WeekDay == 3 ) /* Thursday */
+ nRet = 53;
+ else if ( nJan1WeekDay == 2 ) /* Wednesday */
+ nRet = ( IsLeapYear(nYear) ? 53 : 52 );
+ else
+ nRet = 52;
+
+ return nRet;
+}
+
+/**
+ * Encrypt or decrypt a string using ROT13 algorithm
+ *
+ * This function rotates each character by 13 in the alphabet.
+ * Only the characters 'a' ... 'z' and 'A' ... 'Z' are modified.
+ */
+
+OUString SAL_CALL ScaDateAddIn::getRot13( const OUString& aSrcString ) throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ OUStringBuffer aBuffer( aSrcString );
+ for( sal_Int32 nIndex = 0; nIndex < aBuffer.getLength(); nIndex++ )
+ {
+ sal_Unicode cChar = aBuffer.charAt( nIndex );
+ if( ((cChar >= 'a') && (cChar <= 'z') && ((cChar += 13) > 'z')) ||
+ ((cChar >= 'A') && (cChar <= 'Z') && ((cChar += 13) > 'Z')) )
+ cChar -= 26;
+ aBuffer.setCharAt( nIndex, cChar );
+ }
+ return aBuffer.makeStringAndClear();
+}
+
+//------------------------------------------------------------------
+
diff --git a/scaddins/source/datefunc/datefunc.def b/scaddins/source/datefunc/datefunc.def
new file mode 100644
index 000000000000..cc1b3562a3ef
--- /dev/null
+++ b/scaddins/source/datefunc/datefunc.def
@@ -0,0 +1,7 @@
+LIBRARY datefunc
+DESCRIPTION 'StarView 3.00 Uno BE Reflection data 551 '
+HEAPSIZE 0
+EXPORTS
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
diff --git a/scaddins/source/datefunc/datefunc.hrc b/scaddins/source/datefunc/datefunc.hrc
new file mode 100644
index 000000000000..73d19ac6d080
--- /dev/null
+++ b/scaddins/source/datefunc/datefunc.hrc
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SCA_DATEFUNC_HRC
+#define _SCA_DATEFUNC_HRC
+
+
+#define DATE_RESOURCE_START 1000
+
+#define RID_DATE_FUNCTION_DESCRIPTIONS DATE_RESOURCE_START
+#define RID_DATE_FUNCTION_NAMES (DATE_RESOURCE_START+1000)
+#define RID_DATE_DEFFUNCTION_NAMES (DATE_RESOURCE_START+2000)
+
+
+#define DATE_FUNCDESC_START (RID_DATE_FUNCTION_DESCRIPTIONS+1)
+
+#define DATE_FUNCDESC_DiffWeeks (DATE_FUNCDESC_START)
+#define DATE_FUNCDESC_DiffMonths (DATE_FUNCDESC_START+1)
+#define DATE_FUNCDESC_DiffYears (DATE_FUNCDESC_START+2)
+#define DATE_FUNCDESC_IsLeapYear (DATE_FUNCDESC_START+3)
+#define DATE_FUNCDESC_DaysInMonth (DATE_FUNCDESC_START+4)
+#define DATE_FUNCDESC_DaysInYear (DATE_FUNCDESC_START+5)
+#define DATE_FUNCDESC_WeeksInYear (DATE_FUNCDESC_START+6)
+#define DATE_FUNCDESC_Rot13 (DATE_FUNCDESC_START+7)
+
+
+#define DATE_FUNCNAME_START (RID_DATE_FUNCTION_NAMES+1)
+
+#define DATE_FUNCNAME_DiffWeeks (DATE_FUNCNAME_START)
+#define DATE_FUNCNAME_DiffMonths (DATE_FUNCNAME_START+1)
+#define DATE_FUNCNAME_DiffYears (DATE_FUNCNAME_START+2)
+#define DATE_FUNCNAME_IsLeapYear (DATE_FUNCNAME_START+3)
+#define DATE_FUNCNAME_DaysInMonth (DATE_FUNCNAME_START+4)
+#define DATE_FUNCNAME_DaysInYear (DATE_FUNCNAME_START+5)
+#define DATE_FUNCNAME_WeeksInYear (DATE_FUNCNAME_START+6)
+#define DATE_FUNCNAME_Rot13 (DATE_FUNCNAME_START+7)
+
+
+#define DATE_DEFFUNCNAME_START (RID_DATE_DEFFUNCTION_NAMES+1)
+
+#define DATE_DEFFUNCNAME_DiffWeeks (DATE_DEFFUNCNAME_START)
+#define DATE_DEFFUNCNAME_DiffMonths (DATE_DEFFUNCNAME_START+1)
+#define DATE_DEFFUNCNAME_DiffYears (DATE_DEFFUNCNAME_START+2)
+#define DATE_DEFFUNCNAME_IsLeapYear (DATE_DEFFUNCNAME_START+3)
+#define DATE_DEFFUNCNAME_DaysInMonth (DATE_DEFFUNCNAME_START+4)
+#define DATE_DEFFUNCNAME_DaysInYear (DATE_DEFFUNCNAME_START+5)
+#define DATE_DEFFUNCNAME_WeeksInYear (DATE_DEFFUNCNAME_START+6)
+#define DATE_DEFFUNCNAME_Rot13 (DATE_DEFFUNCNAME_START+7)
+
+
+#endif
diff --git a/scaddins/source/datefunc/datefunc.hxx b/scaddins/source/datefunc/datefunc.hxx
new file mode 100644
index 000000000000..66ba09713583
--- /dev/null
+++ b/scaddins/source/datefunc/datefunc.hxx
@@ -0,0 +1,428 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+//------------------------------------------------------------------
+//
+// date functions add in
+//
+//------------------------------------------------------------------
+
+#ifndef _SCA_DATEFUNC_HXX
+#define _SCA_DATEFUNC_HXX
+
+#include <string.h>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/sheet/XAddIn.hpp>
+#include <com/sun/star/sheet/XCompatibilityNames.hpp>
+#include <com/sun/star/sheet/addin/XDateFunctions.hpp>
+#include <com/sun/star/sheet/addin/XMiscFunctions.hpp>
+#include <cppuhelper/implbase6.hxx> // helper for implementations
+#include <tools/resid.hxx>
+#include <tools/rc.hxx>
+#include <tools/resary.hxx>
+
+//------------------------------------------------------------------
+
+class ScaList
+{
+private:
+ static const sal_uInt32 nStartSize;
+ static const sal_uInt32 nIncrSize;
+
+ void** pData; // pointer array
+ sal_uInt32 nSize; // array size
+ sal_uInt32 nCount; // next index to be inserted at
+ sal_uInt32 nCurr; // current pos for iterations
+
+ void _Grow();
+ inline void Grow();
+
+public:
+ ScaList();
+ virtual ~ScaList();
+
+ inline sal_uInt32 Count() const { return nCount; }
+
+ inline const void* GetObject( sal_uInt32 nIndex ) const
+ { return (nIndex < nCount) ? pData[ nIndex ] : NULL; }
+
+ inline void* First() { return nCount ? pData[ nCurr = 0 ] : NULL; }
+ inline void* Next() { return (nCurr + 1 < nCount) ? pData[ ++nCurr ] : NULL; }
+
+ inline void Append( void* pNew );
+ void Insert( void* pNew, sal_uInt32 nIndex );
+};
+
+
+inline void ScaList::Grow()
+{
+ if( nCount >= nSize )
+ _Grow();
+}
+
+inline void ScaList::Append( void* pNew )
+{
+ Grow();
+ pData[ nCount++ ] = pNew;
+}
+
+
+//------------------------------------------------------------------
+
+class ScaStringList : protected ScaList
+{
+public:
+ inline ScaStringList() : ScaList() {};
+ virtual ~ScaStringList();
+
+ using ScaList::Count;
+
+ inline const ::rtl::OUString* Get( sal_uInt32 nIndex ) const;
+
+ inline ::rtl::OUString* First();
+ inline ::rtl::OUString* Next();
+
+ using ScaList::Append;
+ inline void Append( ::rtl::OUString* pNew );
+ inline void Append( const ::rtl::OUString& rNew );
+};
+
+
+inline const ::rtl::OUString* ScaStringList::Get( sal_uInt32 nIndex ) const
+{
+ return static_cast< const ::rtl::OUString* >( ScaList::GetObject( nIndex ) );
+}
+
+inline ::rtl::OUString* ScaStringList::First()
+{
+ return static_cast< ::rtl::OUString* >( ScaList::First() );
+}
+
+inline ::rtl::OUString* ScaStringList::Next()
+{
+ return static_cast< ::rtl::OUString* >( ScaList::Next() );
+}
+
+inline void ScaStringList::Append( ::rtl::OUString* pNew )
+{
+ ScaList::Append( pNew );
+}
+
+inline void ScaStringList::Append( const ::rtl::OUString& rNew )
+{
+ ScaList::Append( new ::rtl::OUString( rNew ) );
+}
+
+
+//------------------------------------------------------------------
+
+class ScaResId : public ResId
+{
+public:
+ ScaResId( sal_uInt16 nResId, ResMgr& rResMgr );
+};
+
+
+//------------------------------------------------------------------
+
+class ScaResStringLoader : public Resource
+{
+private:
+ String aStr;
+
+public:
+ inline ScaResStringLoader( sal_uInt16 nResId, sal_uInt16 nStrId, ResMgr& rResMgr );
+
+ inline const String& GetString() const { return aStr; }
+
+};
+
+
+inline ScaResStringLoader::ScaResStringLoader( sal_uInt16 nResId, sal_uInt16 nStrId, ResMgr& rResMgr ) :
+ Resource( ScaResId( nResId, rResMgr ) ),
+ aStr( ScaResId( nStrId, rResMgr ) )
+{
+ FreeResource();
+}
+
+
+//------------------------------------------------------------------
+
+class ScaResStringArrLoader : public Resource
+{
+private:
+ ResStringArray aStrArray;
+
+public:
+ inline ScaResStringArrLoader( sal_uInt16 nResId, sal_uInt16 nArrayId, ResMgr& rResMgr );
+
+ inline const ResStringArray& GetStringArray() const { return aStrArray; }
+};
+
+
+
+inline ScaResStringArrLoader::ScaResStringArrLoader( sal_uInt16 nResId, sal_uInt16 nArrayId, ResMgr& rResMgr ) :
+ Resource( ScaResId( nResId, rResMgr ) ),
+ aStrArray( ScaResId( nArrayId, rResMgr ) )
+{
+ FreeResource();
+}
+
+
+//------------------------------------------------------------------
+
+class ScaResPublisher : public Resource
+{
+public:
+ inline ScaResPublisher( const ScaResId& rResId ) : Resource( rResId ) {}
+
+ inline sal_Bool IsAvailableRes( const ResId& rResId ) const
+ { return Resource::IsAvailableRes( rResId ); }
+ inline void FreeResource()
+ { Resource::FreeResource(); }
+};
+
+
+//------------------------------------------------------------------
+
+class ScaFuncRes : public Resource
+{
+public:
+ ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, ::rtl::OUString& rRet );
+};
+
+
+//------------------------------------------------------------------
+
+enum ScaCategory
+{
+ ScaCat_AddIn,
+ ScaCat_DateTime,
+ ScaCat_Text,
+ ScaCat_Finance,
+ ScaCat_Inf,
+ ScaCat_Math,
+ ScaCat_Tech
+};
+
+struct ScaFuncDataBase
+{
+ const sal_Char* pIntName; // internal name (get***)
+ sal_uInt16 nUINameID; // resource ID to UI name
+ sal_uInt16 nDescrID; // resource ID to description, parameter names and ~ description
+ sal_uInt16 nCompListID; // resource ID to list of valid names
+ sal_uInt16 nParamCount; // number of named / described parameters
+ ScaCategory eCat; // function category
+ sal_Bool bDouble; // name already exist in Calc
+ sal_Bool bWithOpt; // first parameter is internal
+};
+
+class ScaFuncData
+{
+private:
+ ::rtl::OUString aIntName; // internal name (get***)
+ sal_uInt16 nUINameID; // resource ID to UI name
+ sal_uInt16 nDescrID; // leads also to parameter descriptions!
+ sal_uInt16 nCompListID; // resource ID to list of valid names
+ sal_uInt16 nParamCount; // num of parameters
+ ScaStringList aCompList; // list of all valid names
+ ScaCategory eCat; // function category
+ sal_Bool bDouble; // name already exist in Calc
+ sal_Bool bWithOpt; // first parameter is internal
+
+public:
+ ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rRscMgr );
+ virtual ~ScaFuncData();
+
+ inline sal_uInt16 GetUINameID() const { return nUINameID; }
+ inline sal_uInt16 GetDescrID() const { return nDescrID; }
+ inline ScaCategory GetCategory() const { return eCat; }
+ inline sal_Bool IsDouble() const { return bDouble; }
+ inline sal_Bool HasIntParam() const { return bWithOpt; }
+
+ sal_uInt16 GetStrIndex( sal_uInt16 nParam ) const;
+ inline sal_Bool Is( const ::rtl::OUString& rCompare ) const
+ { return aIntName == rCompare; }
+
+ inline const ScaStringList& GetCompNameList() const { return aCompList; }
+};
+
+
+//------------------------------------------------------------------
+
+class ScaFuncDataList : private ScaList
+{
+ ::rtl::OUString aLastName;
+ sal_uInt32 nLast;
+
+public:
+ ScaFuncDataList( ResMgr& rResMgr );
+ virtual ~ScaFuncDataList();
+
+ using ScaList::Count;
+
+ inline const ScaFuncData* Get( sal_uInt32 nIndex ) const;
+ const ScaFuncData* Get( const ::rtl::OUString& rProgrammaticName ) const;
+ inline ScaFuncData* First();
+ inline ScaFuncData* Next();
+
+ using ScaList::Append;
+ inline void Append( ScaFuncData* pNew ) { ScaList::Append( pNew ); }
+};
+
+
+inline const ScaFuncData* ScaFuncDataList::Get( sal_uInt32 nIndex ) const
+{
+ return static_cast< const ScaFuncData* >( ScaList::GetObject( nIndex ) );
+}
+
+inline ScaFuncData* ScaFuncDataList::First()
+{
+ return static_cast< ScaFuncData* >( ScaList::First() );
+}
+
+inline ScaFuncData* ScaFuncDataList::Next()
+{
+ return static_cast< ScaFuncData* >( ScaList::Next() );
+}
+
+
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DateFunctionAddIn_CreateInstance(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+
+
+// THE AddIn class for date functions
+
+class ScaDateAddIn : public ::cppu::WeakImplHelper6<
+ ::com::sun::star::sheet::XAddIn,
+ ::com::sun::star::sheet::XCompatibilityNames,
+ ::com::sun::star::sheet::addin::XDateFunctions,
+ ::com::sun::star::sheet::addin::XMiscFunctions,
+ ::com::sun::star::lang::XServiceName,
+ ::com::sun::star::lang::XServiceInfo >
+{
+private:
+ ::com::sun::star::lang::Locale aFuncLoc;
+ ::com::sun::star::lang::Locale* pDefLocales;
+ ResMgr* pResMgr;
+ ScaFuncDataList* pFuncDataList;
+
+
+ void InitDefLocales();
+ const ::com::sun::star::lang::Locale& GetLocale( sal_uInt32 nIndex );
+ ResMgr& GetResMgr() throw( ::com::sun::star::uno::RuntimeException );
+ void InitData();
+
+ ::rtl::OUString GetDisplFuncStr( sal_uInt16 nResId ) throw( ::com::sun::star::uno::RuntimeException );
+ ::rtl::OUString GetFuncDescrStr( sal_uInt16 nResId, sal_uInt16 nStrIndex ) throw( ::com::sun::star::uno::RuntimeException );
+
+public:
+ ScaDateAddIn();
+ virtual ~ScaDateAddIn();
+
+ static ::rtl::OUString getImplementationName_Static();
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static();
+
+ // XAddIn
+ virtual ::rtl::OUString SAL_CALL getProgrammaticFuntionName( const ::rtl::OUString& aDisplayName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getDisplayFunctionName( const ::rtl::OUString& aProgrammaticName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getFunctionDescription( const ::rtl::OUString& aProgrammaticName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getDisplayArgumentName( const ::rtl::OUString& aProgrammaticName, sal_Int32 nArgument ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getArgumentDescription( const ::rtl::OUString& aProgrammaticName, sal_Int32 nArgument ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getProgrammaticCategoryName( const ::rtl::OUString& aProgrammaticName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getDisplayCategoryName( const ::rtl::OUString& aProgrammaticName ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XCompatibilityNames
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::LocalizedName > SAL_CALL getCompatibilityNames( const ::rtl::OUString& aProgrammaticName ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XLocalizable
+ virtual void SAL_CALL setLocale( const ::com::sun::star::lang::Locale& eLocale ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceName
+ virtual ::rtl::OUString SAL_CALL getServiceName() throw( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ // methods from own interfaces start here
+
+ // XDateFunctions
+ virtual sal_Int32 SAL_CALL getDiffWeeks(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xOptions,
+ sal_Int32 nEndDate, sal_Int32 nStartDate,
+ sal_Int32 nMode )
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
+
+ virtual sal_Int32 SAL_CALL getDiffMonths(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xOptions,
+ sal_Int32 nEndDate, sal_Int32 nStartDate,
+ sal_Int32 nMode )
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
+
+ virtual sal_Int32 SAL_CALL getDiffYears(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xOptions,
+ sal_Int32 nEndDate, sal_Int32 nStartDate,
+ sal_Int32 nMode )
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
+
+ virtual sal_Int32 SAL_CALL getIsLeapYear(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xOptions,
+ sal_Int32 nDate )
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
+
+ virtual sal_Int32 SAL_CALL getDaysInMonth(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xOptions,
+ sal_Int32 nDate )
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
+
+ virtual sal_Int32 SAL_CALL getDaysInYear(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xOptions,
+ sal_Int32 nDate )
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
+
+ virtual sal_Int32 SAL_CALL getWeeksInYear(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xOptions,
+ sal_Int32 nDate )
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
+
+ // XMiscFunctions
+ virtual ::rtl::OUString SAL_CALL getRot13(
+ const ::rtl::OUString& aSrcText )
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
+};
+
+//------------------------------------------------------------------
+
+#endif // _SCA_DATEFUNC_HXX
+
diff --git a/scaddins/source/datefunc/datefunc.src b/scaddins/source/datefunc/datefunc.src
new file mode 100644
index 000000000000..80575e7fd933
--- /dev/null
+++ b/scaddins/source/datefunc/datefunc.src
@@ -0,0 +1,348 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "datefunc.hrc"
+
+
+Resource RID_DATE_FUNCTION_DESCRIPTIONS
+{
+ Resource DATE_FUNCDESC_DiffWeeks
+ {
+ String 1 // description DiffWeeks
+ {
+ Text [ en-US ] = "Calculates the number of weeks in a specific period";
+ };
+ String 2 // name of parameter 1 DiffWeeks
+ {
+ Text [ en-US ] = "Start date";
+ };
+ String 3 // description of parameter 1 DiffWeeks
+ {
+ Text [ en-US ] = "First day of the period";
+ };
+ String 4 // name of parameter 2 DiffWeeks
+ {
+ Text [ en-US ] = "End date";
+ };
+ String 5 // description of parameter 2 DiffWeeks
+ {
+ Text [ en-US ] = "Last day of the period";
+ };
+ String 6 // name of parameter 3 DiffWeeks
+ {
+ Text [ en-US ] = "Type";
+ };
+ String 7 // description of parameter 3 DiffWeeks
+ {
+ Text [ en-US ] = "Type of calculation: Type=0 means the time interval, Type=1 means calendar weeks.";
+ };
+ };
+
+ Resource DATE_FUNCDESC_DiffMonths
+ {
+ String 1 // description DiffMonths
+ {
+ Text [ en-US ] = "Determines the number of months in a specific period.";
+ };
+ String 2 // name of parameter 1 DiffMonths
+ {
+ Text [ en-US ] = "Start date";
+ };
+ String 3 // description of parameter 1 DiffMonths
+ {
+ Text [ en-US ] = "First day of the period.";
+ };
+ String 4 // name of parameter 2 DiffMonths
+ {
+ Text [ en-US ] = "End date";
+ };
+ String 5 // description of parameter 2 DiffMonths
+ {
+ Text [ en-US ] = "Last day of the period.";
+ };
+ String 6 // name of parameter 3 DiffMonths
+ {
+ Text [ en-US ] = "Type";
+ };
+ String 7 // description of parameter 3 DiffMonths
+ {
+ Text [ en-US ] = "Type of calculation: Type=0 means the time interval, Type=1 means calendar months.";
+ };
+ };
+
+ Resource DATE_FUNCDESC_DiffYears
+ {
+ String 1 // description DiffYears
+ {
+ Text [ en-US ] = "Calculates the number of years in a specific period.";
+ };
+ String 2 // name of parameter 1 DiffYears
+ {
+ Text [ en-US ] = "Start date";
+ };
+ String 3 // description of parameter 1 DiffYears
+ {
+ Text [ en-US ] = "First day of the period";
+ };
+ String 4 // name of parameter 2 DiffYears
+ {
+ Text [ en-US ] = "End date";
+ };
+ String 5 // description of parameter 2 DiffYears
+ {
+ Text [ en-US ] = "Last day of the period";
+ };
+ String 6 // name of parameter 3 DiffYears
+ {
+ Text [ en-US ] = "Type";
+ };
+ String 7 // description of parameter 3 DiffYears
+ {
+ Text [ en-US ] = "Type of calculation: Type=0 means the time interval, Type=1 means calendar years.";
+ };
+ };
+
+ Resource DATE_FUNCDESC_IsLeapYear
+ {
+ String 1 // description IsLeapYear
+ {
+ Text [ en-US ] = "Returns 1 (TRUE) if the date is a day of a leap year, otherwise 0 (FALSE).";
+ };
+ String 2 // name of parameter 1 IsLeapYear
+ {
+ Text [ en-US ] = "Date";
+ };
+ String 3 // description of parameter 1 IsLeapYear
+ {
+ Text [ en-US ] = "Any day in the desired year";
+ };
+ };
+
+ Resource DATE_FUNCDESC_DaysInMonth
+ {
+ String 1 // description DaysInMonth
+ {
+ Text [ en-US ] = "Returns the number of days of the month in which the date entered occurs";
+ };
+ String 2 // name of parameter 1 DaysInMonth
+ {
+ Text [ en-US ] = "Date";
+ };
+ String 3 // description of parameter 1 DaysInMonth
+ {
+ Text [ en-US ] = "Any day in the desired month";
+ };
+ };
+
+ Resource DATE_FUNCDESC_DaysInYear
+ {
+ String 1 // description DaysInYear
+ {
+ Text [ en-US ] = "Returns the number of days of the year in which the date entered occurs.";
+ };
+ String 2 // name of parameter 1 DaysInYear
+ {
+ Text [ en-US ] = "Date";
+ };
+ String 3 // description of parameter 1 DaysInYear
+ {
+ Text [ en-US ] = "Any day in the desired year";
+ };
+ };
+
+ Resource DATE_FUNCDESC_WeeksInYear
+ {
+ String 1 // description WeeksInYear
+ {
+ Text [ en-US ] = "Returns the number of weeks of the year in which the date entered occurs";
+ };
+ String 2 // name of parameter 1 WeeksInYear
+ {
+ Text [ en-US ] = "Date";
+ };
+ String 3 // description of parameter 1 WeeksInYear
+ {
+ Text [ en-US ] = "Any day in the desired year";
+ };
+ };
+
+ Resource DATE_FUNCDESC_Rot13
+ {
+ String 1 // description Rot13
+ {
+ Text [ en-US ] = "Encrypts or decrypts a text using the ROT13 algorithm";
+ };
+ String 2 // name of parameter 1 Rot13
+ {
+ Text [ en-US ] = "Text";
+ };
+ String 3 // description of parameter 1 Rot13
+ {
+ Text [ en-US ] = "Text to be encrypted or text already encrypted";
+ };
+ };
+};
+
+
+Resource RID_DATE_FUNCTION_NAMES
+{
+ String DATE_FUNCNAME_DiffWeeks
+ {
+ Text [ en-US ] = "WEEKS";
+ };
+ String DATE_FUNCNAME_DiffMonths
+ {
+ Text [ en-US ] = "MONTHS";
+ };
+ String DATE_FUNCNAME_DiffYears
+ {
+ Text [ en-US ] = "YEARS";
+ };
+ String DATE_FUNCNAME_IsLeapYear
+ {
+ Text [ en-US ] = "ISLEAPYEAR";
+ };
+ String DATE_FUNCNAME_DaysInMonth
+ {
+ Text [ en-US ] = "DAYSINMONTH";
+ };
+ String DATE_FUNCNAME_DaysInYear
+ {
+ Text [ en-US ] = "DAYSINYEAR";
+ };
+ String DATE_FUNCNAME_WeeksInYear
+ {
+ Text [ en-US ] = "WEEKSINYEAR";
+ };
+ String DATE_FUNCNAME_Rot13
+ {
+ Text [ en-US ] = "ROT13";
+ };
+};
+
+
+Resource RID_DATE_DEFFUNCTION_NAMES
+{
+
+ StringArray DATE_DEFFUNCNAME_DiffWeeks
+ {
+ ItemList =
+ {
+ < "WOCHEN"; >;
+ < "WEEKS"; >;
+ };
+ };
+ StringArray DATE_DEFFUNCNAME_DiffMonths
+ {
+ ItemList =
+ {
+ < "MONATE"; >;
+ < "MONTHS"; >;
+ };
+ };
+ StringArray DATE_DEFFUNCNAME_DiffYears
+ {
+ ItemList =
+ {
+ < "JAHRE"; >;
+ < "YEARS"; >;
+ };
+ };
+ StringArray DATE_DEFFUNCNAME_IsLeapYear
+ {
+ ItemList =
+ {
+ < "ISTSCHALTJAHR"; >;
+ < "ISLEAPYEAR"; >;
+ };
+ };
+ StringArray DATE_DEFFUNCNAME_DaysInMonth
+ {
+ ItemList =
+ {
+ < "TAGEIMMONAT"; >;
+ < "DAYSINMONTH"; >;
+ };
+ };
+ StringArray DATE_DEFFUNCNAME_DaysInYear
+ {
+ ItemList =
+ {
+ < "TAGEIMJAHR"; >;
+ < "DAYSINYEAR"; >;
+ };
+ };
+ StringArray DATE_DEFFUNCNAME_WeeksInYear
+ {
+ ItemList =
+ {
+ < "WOCHENIMJAHR"; >;
+ < "WEEKSINYEAR"; >;
+ };
+ };
+ StringArray DATE_DEFFUNCNAME_Rot13
+ {
+ ItemList =
+ {
+ < "ROT13"; >;
+ < "ROT13"; >;
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scaddins/source/datefunc/makefile.mk b/scaddins/source/datefunc/makefile.mk
new file mode 100644
index 000000000000..8a2805d76f7d
--- /dev/null
+++ b/scaddins/source/datefunc/makefile.mk
@@ -0,0 +1,121 @@
+#**************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#**************************************************************************
+
+PRJ=..$/..
+PRJNAME=scaddins
+
+TARGET=date
+
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+LIBTARGET=NO
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+UNOUCRRDB=$(SOLARBINDIR)$/types.rdb $(BIN)$/dateadd.rdb
+UNOUCRDEP=$(UNOUCRRDB)
+
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)$/$(TARGET)
+INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+# comprehensive type info, so rdb needn't be installed
+NO_OFFUH=TRUE
+CPPUMAKERFLAGS*=-C
+
+UNOTYPES=\
+ com.sun.star.sheet.addin.XDateFunctions \
+ com.sun.star.sheet.addin.XMiscFunctions \
+ com.sun.star.lang.XComponent \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XSingleComponentFactory \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.uno.XInterface \
+ com.sun.star.registry.XImplementationRegistration \
+ com.sun.star.sheet.XAddIn \
+ com.sun.star.sheet.XCompatibilityNames \
+ com.sun.star.lang.XServiceName \
+ com.sun.star.lang.XServiceInfo \
+ com.sun.star.lang.XTypeProvider \
+ com.sun.star.uno.XWeak \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.uno.XComponentContext \
+ com.sun.star.util.Date
+
+# --- Files -------------------------------------
+
+SLOFILES=\
+ $(SLO)$/datefunc.obj
+
+ALLIDLFILES=\
+ dateadd.idl
+
+SRS1NAME=$(TARGET)
+SRC1FILES =\
+ datefunc.src
+
+# --- Library -----------------------------------
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+SHL1OBJS=$(SLOFILES)
+SHL1STDLIBS= \
+ $(TOOLSLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1DEPN=makefile.mk
+
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+# --- Resourcen ----------------------------------------------------
+
+RESLIB1LIST=\
+ $(SRS)$/date.srs
+
+RESLIB1NAME=date
+RESLIB1SRSFILES=\
+ $(RESLIB1LIST)
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
+$(BIN)$/dateadd.rdb: $(ALLIDLFILES)
+ $(IDLC) -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $?
+ $(REGMERGE) $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)}
+ touch $@
+
+
diff --git a/scaddins/source/datefunc/msdev.mk b/scaddins/source/datefunc/msdev.mk
new file mode 100644
index 000000000000..d50fb23dde8d
--- /dev/null
+++ b/scaddins/source/datefunc/msdev.mk
@@ -0,0 +1,116 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+.SUFFIXES: .urd .idl
+
+# the root directory of the udk
+# also adjust include statements if this is changed
+ROOT=i:\udk100
+
+include i:\udk100\msdev\defines.mk
+
+# the project directory under runtime
+PROJECT=datefunc
+
+# the target of this makefile
+TARGET=$(BINOUT)\datefunc.dll
+
+CPPFLAGS = \
+ -I$(RUNTIME)\vos\inc \
+ -I$(RUNTIME)\sal\inc \
+ -I$(RUNTIME)\cppu\inc \
+ -I$(RUNTIME)\cppuhelper\inc \
+ -I$(RUNTIME)\stoc\inc \
+ -I$(UNOHEADER_OUT)
+
+OBJS=$(OBJOUT)\datefunc.obj
+
+# flags and macros
+include i:\udk100\msdev\flags.mk
+
+URDS = $(URDOUT)\dateadd.urd
+
+CPPUMAKER_OPT=-C
+UNOHEADER_OUT=$(UNOHEADER_COM)
+
+# the rdb files
+RDBS=$(RDBOUT)\applicat.rdb $(RDBOUT)\dateadd.rdb
+
+UNOHEADER=\
+ $(UNOHEADER_OUT)\com\sun\star\lang\XComponent.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\lang\XMultiServiceFactory.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\lang\XSingleServiceFactory.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\uno\TypeClass.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\uno\XInterface.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\registry\XImplementationRegistration.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\sheet\XAddIn.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\lang\XServiceName.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\lang\XServiceInfo.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\lang\XTypeProvider.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\uno\XWeak.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\uno\XAggregation.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\util\Date.hpp \
+ $(UNOHEADER_OUT)\com\sun\star\sheet\addin\XDateFunctions.hpp
+
+$(UNOHEADER_OUT)\com\sun\star\sheet\addin\XDateFunctions.hpp: $(RDBS) $(CPPUMAKER)
+ -$(MKDIR) $(@D)
+ $(CPPUMAKER) $(CPPUMAKER_OPT) -Tcom.sun.star.sheet.addin.XDateFunctions -B/UCR -O$(UNOHEADER_OUT) $(RDBS)
+
+$(UNOHEADER_OUT)\com\sun\star\sheet\XAddIn.hpp: $(RDBS) $(CPPUMAKER)
+ -$(MKDIR) $(@D)
+ $(CPPUMAKER) $(CPPUMAKER_OPT) -Tcom.sun.star.sheet.XAddIn -B/UCR -O$(UNOHEADER_OUT) $(RDBS)
+
+$(UNOHEADER_OUT)\com\sun\star\lang\XServiceName.hpp: $(RDBS) $(CPPUMAKER)
+ -$(MKDIR) $(@D)
+ $(CPPUMAKER) $(CPPUMAKER_OPT) -Tcom.sun.star.lang.XServiceName -B/UCR -O$(UNOHEADER_OUT) $(RDBS)
+
+$(UNOHEADER_OUT)\com\sun\star\util\Date.hpp: $(RDBS) $(CPPUMAKER)
+ -$(MKDIR) $(@D)
+ $(CPPUMAKER) $(CPPUMAKER_OPT) -Tcom.sun.star.util.Date -B/UCR -O$(UNOHEADER_OUT) $(RDBS)
+
+include i:\udk100\msdev\genheader.mk
+
+$(URDS): $(UNOIDL)
+
+.idl{$(URDOUT)}.urd:
+ -$(MKDIR) $(@D)
+ $(UNOIDL) -I$(ROOT)\idl $< -Burd -OH$(@D)
+
+$(RDBOUT)\dateadd.rdb: $(URDS) $(REGMERGE)
+ -$(MKDIR) $(@D)
+ $(REGMERGE) $@ /UCR $(URDS)
+
+.cxx{$(OBJOUT)}.obj:
+ -$(MKDIR) $(@D)
+ $(CC) $(CCPPFLAGS) $(CCFLAGS) $< /Fo$@
+
+$(TARGET): $(UNOHEADER) $(OBJS)
+ -$(MKDIR) $(@D)
+ $(LIB32) $(LFLAGS) /DLL $(OBJS) /out:$@ -def:datefunc.def $(LINKCPPUHELPER) $(LINKCPPU) $(LINKVOS) $(LINKSAL) msvcirtd.lib $(LIBS)
+
+
+