From 56b404001ef83cc151727cc5a489dc493c6b65ec Mon Sep 17 00:00:00 2001 From: Alexandre Vicenzi Date: Mon, 3 Feb 2014 22:42:24 -0200 Subject: fdo#54938 Convert oox and scaddins to cppu::supportsService Change-Id: If75e6e96887d63a555094a2a9c73ca8a157fe964 Reviewed-on: https://gerrit.libreoffice.org/7836 Tested-by: LibreOffice gerrit bot Reviewed-by: Marcos Souza --- scaddins/source/analysis/analysis.cxx | 138 +++------------------------------- scaddins/source/datefunc/datefunc.cxx | 76 ++----------------- scaddins/source/pricing/pricing.cxx | 75 ++---------------- 3 files changed, 22 insertions(+), 267 deletions(-) (limited to 'scaddins') diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index 8e9590b04750..bf600cf765b1 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -18,19 +18,18 @@ */ #include "analysis.hxx" - -#include +#include "analysis.hrc" +#include "bessel.hxx" #include +#include +#include #include #include #include #include #include - #include #include -#include "analysis.hrc" -#include "bessel.hxx" #define ADDIN_SERVICE "com.sun.star.sheet.AddIn" #define MY_SERVICE "com.sun.star.sheet.addin.Analysis" @@ -38,7 +37,6 @@ using namespace ::com::sun::star; - extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL analysis_component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ ) { @@ -62,14 +60,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL analysis_component_getFactory( return pRet; } - -//------------------------------------------------------------------------ -// -// "normal" service implementation -// -//------------------------------------------------------------------------ - - ResMgr& AnalysisAddIn::GetResMgr( void ) throw( uno::RuntimeException ) { if( !pResMgr ) @@ -83,13 +73,11 @@ ResMgr& AnalysisAddIn::GetResMgr( void ) throw( uno::RuntimeException ) return *pResMgr; } - OUString AnalysisAddIn::GetDisplFuncStr( sal_uInt16 nFuncNum ) throw( uno::RuntimeException ) { return AnalysisRscStrLoader( RID_ANALYSIS_FUNCTION_NAMES, nFuncNum, GetResMgr() ).GetString(); } - class AnalysisResourcePublisher : public Resource { public: @@ -98,14 +86,12 @@ public: void FreeResource() { Resource::FreeResource(); } }; - class AnalysisFuncRes : public Resource { public: AnalysisFuncRes( ResId& rRes, ResMgr& rResMgr, sal_uInt16 nInd, OUString& rRet ); }; - AnalysisFuncRes::AnalysisFuncRes( ResId& rRes, ResMgr& rResMgr, sal_uInt16 nInd, OUString& rRet ) : Resource( rRes ) { rRet = AnalysisResId(nInd, rResMgr).toString(); @@ -113,7 +99,6 @@ AnalysisFuncRes::AnalysisFuncRes( ResId& rRes, ResMgr& rResMgr, sal_uInt16 nInd, FreeResource(); } - OUString AnalysisAddIn::GetFuncDescrStr( sal_uInt16 nResId, sal_uInt16 nStrIndex ) throw( uno::RuntimeException ) { OUString aRet; @@ -130,7 +115,6 @@ OUString AnalysisAddIn::GetFuncDescrStr( sal_uInt16 nResId, sal_uInt16 nStrIndex return aRet; } - void AnalysisAddIn::InitData( void ) { if( pResMgr ) @@ -154,7 +138,6 @@ void AnalysisAddIn::InitData( void ) } } - AnalysisAddIn::AnalysisAddIn( const uno::Reference< uno::XComponentContext >& xContext ) : pDefLocales( NULL ), pFD( NULL ), @@ -165,7 +148,6 @@ AnalysisAddIn::AnalysisAddIn( const uno::Reference< uno::XComponentContext >& xC { } - AnalysisAddIn::~AnalysisAddIn() { if( pFD ) @@ -181,7 +163,6 @@ AnalysisAddIn::~AnalysisAddIn() delete[] pDefLocales; } - sal_Int32 AnalysisAddIn::getDateMode( const uno::Reference< beans::XPropertySet >& xPropSet, const uno::Any& rAny ) throw( uno::RuntimeException, lang::IllegalArgumentException ) @@ -192,11 +173,6 @@ sal_Int32 AnalysisAddIn::getDateMode( return nMode; } - - -//----------------------------------------------------------------------------- - - #define MAXFACTDOUBLE 300 double AnalysisAddIn::FactDouble( sal_Int32 nNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) @@ -239,13 +215,11 @@ double AnalysisAddIn::FactDouble( sal_Int32 nNum ) throw( uno::RuntimeException, return pFactDoubles[ nNum ]; } - OUString AnalysisAddIn::getImplementationName_Static() { return OUString( MY_IMPLNAME ); } - uno::Sequence< OUString > AnalysisAddIn::getSupportedServiceNames_Static() { uno::Sequence< OUString > aRet(2); @@ -255,7 +229,6 @@ uno::Sequence< OUString > AnalysisAddIn::getSupportedServiceNames_Static() return aRet; } - uno::Reference< uno::XInterface > SAL_CALL AnalysisAddIn_CreateInstance( const uno::Reference< lang::XMultiServiceFactory >& xServiceFact ) { @@ -263,38 +236,30 @@ uno::Reference< uno::XInterface > SAL_CALL AnalysisAddIn_CreateInstance( return xInst; } - // XServiceName - OUString SAL_CALL AnalysisAddIn::getServiceName() throw( uno::RuntimeException ) { // name of specific AddIn service return OUString( MY_SERVICE ); } - // XServiceInfo - OUString SAL_CALL AnalysisAddIn::getImplementationName() throw( uno::RuntimeException ) { return getImplementationName_Static(); } - sal_Bool SAL_CALL AnalysisAddIn::supportsService( const OUString& aName ) throw( uno::RuntimeException ) { - return aName.equalsAscii( ADDIN_SERVICE ) || aName.equalsAscii( MY_SERVICE ); + return cppu::supportsService(this, aName); } - uno::Sequence< OUString > SAL_CALL AnalysisAddIn::getSupportedServiceNames() throw( uno::RuntimeException ) { return getSupportedServiceNames_Static(); } - // XLocalizable - void SAL_CALL AnalysisAddIn::setLocale( const lang::Locale& eLocale ) throw( uno::RuntimeException ) { aFuncLoc = eLocale; @@ -307,9 +272,7 @@ lang::Locale SAL_CALL AnalysisAddIn::getLocale() throw( uno::RuntimeException ) return aFuncLoc; } - // XAddIn - OUString SAL_CALL AnalysisAddIn::getProgrammaticFuntionName( const OUString& ) throw( uno::RuntimeException ) { // not used by calc @@ -318,7 +281,6 @@ OUString SAL_CALL AnalysisAddIn::getProgrammaticFuntionName( const OUString& ) t return OUString(); } - OUString SAL_CALL AnalysisAddIn::getDisplayFunctionName( const OUString& aProgrammaticName ) throw( uno::RuntimeException ) { OUString aRet; @@ -338,7 +300,6 @@ OUString SAL_CALL AnalysisAddIn::getDisplayFunctionName( const OUString& aProgra return aRet; } - OUString SAL_CALL AnalysisAddIn::getFunctionDescription( const OUString& aProgrammaticName ) throw( uno::RuntimeException ) { OUString aRet; @@ -350,7 +311,6 @@ OUString SAL_CALL AnalysisAddIn::getFunctionDescription( const OUString& aProgra return aRet; } - OUString SAL_CALL AnalysisAddIn::getDisplayArgumentName( const OUString& aName, sal_Int32 nArg ) throw( uno::RuntimeException ) { OUString aRet; @@ -368,7 +328,6 @@ OUString SAL_CALL AnalysisAddIn::getDisplayArgumentName( const OUString& aName, return aRet; } - OUString SAL_CALL AnalysisAddIn::getArgumentDescription( const OUString& aName, sal_Int32 nArg ) throw( uno::RuntimeException ) { OUString aRet; @@ -386,14 +345,12 @@ OUString SAL_CALL AnalysisAddIn::getArgumentDescription( const OUString& aName, return aRet; } - static const OUString pDefCatName("Add-In"); - OUString SAL_CALL AnalysisAddIn::getProgrammaticCategoryName( const OUString& aName ) throw( uno::RuntimeException ) { // return non-translated strings -// return OUString( "Add-In" ); + // return OUString( "Add-In" ); const FuncData* p = pFD->Get( aName ); OUString aRet; if( p ) @@ -415,11 +372,10 @@ OUString SAL_CALL AnalysisAddIn::getProgrammaticCategoryName( const OUString& aN return aRet; } - OUString SAL_CALL AnalysisAddIn::getDisplayCategoryName( const OUString& aProgrammaticFunctionName ) throw( uno::RuntimeException ) { // return translated strings, not used for predefined categories -// return OUString( "Add-In" ); + // return OUString( "Add-In" ); const FuncData* p = pFD->Get( aProgrammaticFunctionName ); OUString aRet; if( p ) @@ -441,12 +397,10 @@ OUString SAL_CALL AnalysisAddIn::getDisplayCategoryName( const OUString& aProgra return aRet; } - static const sal_Char* pLang[] = { "de", "en" }; static const sal_Char* pCoun[] = { "DE", "US" }; static const sal_uInt32 nNumOfLoc = SAL_N_ELEMENTS(pLang); - void AnalysisAddIn::InitDefLocales( void ) { pDefLocales = new lang::Locale[ nNumOfLoc ]; @@ -458,7 +412,6 @@ void AnalysisAddIn::InitDefLocales( void ) } } - inline const lang::Locale& AnalysisAddIn::GetLocale( sal_uInt32 nInd ) { if( !pDefLocales ) @@ -470,7 +423,6 @@ inline const lang::Locale& AnalysisAddIn::GetLocale( sal_uInt32 nInd ) return aFuncLoc; } - uno::Sequence< sheet::LocalizedName > SAL_CALL AnalysisAddIn::getCompatibilityNames( const OUString& aProgrammaticName ) throw( uno::RuntimeException ) { const FuncData* p = pFD->Get( aProgrammaticName ); @@ -493,13 +445,8 @@ uno::Sequence< sheet::LocalizedName > SAL_CALL AnalysisAddIn::getCompatibilityNa return aRet; } - // XAnalysis - -/** - * Workday - */ - +/** Workday */ sal_Int32 SAL_CALL AnalysisAddIn::getWorkday( const uno::Reference< beans::XPropertySet >& xOptions, sal_Int32 nDate, sal_Int32 nDays, const uno::Any& aHDay ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { @@ -556,11 +503,7 @@ sal_Int32 SAL_CALL AnalysisAddIn::getWorkday( const uno::Reference< beans::XProp return nActDate - nNullDate; } - -/** - * Yearfrac - */ - +/** Yearfrac */ double SAL_CALL AnalysisAddIn::getYearfrac( const uno::Reference< beans::XPropertySet >& xOpt, sal_Int32 nStartDate, sal_Int32 nEndDate, const uno::Any& rMode ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { @@ -568,7 +511,6 @@ double SAL_CALL AnalysisAddIn::getYearfrac( const uno::Reference< beans::XProper RETURN_FINITE( fRet ); } - sal_Int32 SAL_CALL AnalysisAddIn::getEdate( const uno::Reference< beans::XPropertySet >& xOpt, sal_Int32 nStartDate, sal_Int32 nMonths ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { sal_Int32 nNullDate = GetNullDate( xOpt ); @@ -577,7 +519,6 @@ sal_Int32 SAL_CALL AnalysisAddIn::getEdate( const uno::Reference< beans::XProper return aDate.getDate( nNullDate ); } - sal_Int32 SAL_CALL AnalysisAddIn::getWeeknum( const uno::Reference< beans::XPropertySet >& xOpt, sal_Int32 nDate, sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { nDate += GetNullDate( xOpt ); @@ -591,7 +532,6 @@ sal_Int32 SAL_CALL AnalysisAddIn::getWeeknum( const uno::Reference< beans::XProp return ( nDate - nFirstInYear + ( ( nMode == 1 )? ( nFirstDayInYear + 1 ) % 7 : nFirstDayInYear ) ) / 7 + 1; } - sal_Int32 SAL_CALL AnalysisAddIn::getEomonth( const uno::Reference< beans::XPropertySet >& xOpt, sal_Int32 nDate, sal_Int32 nMonths ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { sal_Int32 nNullDate = GetNullDate( xOpt ); @@ -618,7 +558,6 @@ sal_Int32 SAL_CALL AnalysisAddIn::getEomonth( const uno::Reference< beans::XProp return DateToDays( DaysInMonth( sal_uInt16( nNewMonth ), nYear ), sal_uInt16( nNewMonth ), nYear ) - nNullDate; } - sal_Int32 SAL_CALL AnalysisAddIn::getNetworkdays( const uno::Reference< beans::XPropertySet >& xOpt, sal_Int32 nStartDate, sal_Int32 nEndDate, const uno::Any& aHDay ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { @@ -656,13 +595,11 @@ sal_Int32 SAL_CALL AnalysisAddIn::getNetworkdays( const uno::Reference< beans::X return nCnt; } - sal_Int32 SAL_CALL AnalysisAddIn::getIseven( sal_Int32 nVal ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { return ( nVal & 0x00000001 )? 0 : 1; } - sal_Int32 SAL_CALL AnalysisAddIn::getIsodd( sal_Int32 nVal ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { return ( nVal & 0x00000001 )? 1 : 0; @@ -699,7 +636,6 @@ AnalysisAddIn::getMultinomial( const uno::Reference< beans::XPropertySet >& xOpt RETURN_FINITE( fRet ); } - double SAL_CALL AnalysisAddIn::getSeriessum( double fX, double fN, double fM, const uno::Sequence< uno::Sequence< double > >& aCoeffList ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fRet = 0.0; @@ -732,7 +668,6 @@ double SAL_CALL AnalysisAddIn::getSeriessum( double fX, double fN, double fM, co RETURN_FINITE( fRet ); } - double SAL_CALL AnalysisAddIn::getQuotient( double fNum, double fDenom ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fRet; @@ -743,7 +678,6 @@ double SAL_CALL AnalysisAddIn::getQuotient( double fNum, double fDenom ) throw( RETURN_FINITE( fRet ); } - double SAL_CALL AnalysisAddIn::getMround( double fNum, double fMult ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { if( fMult == 0.0 ) @@ -753,14 +687,12 @@ double SAL_CALL AnalysisAddIn::getMround( double fNum, double fMult ) throw( uno RETURN_FINITE( fRet ); } - double SAL_CALL AnalysisAddIn::getSqrtpi( double fNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fRet = sqrt( fNum * PI ); RETURN_FINITE( fRet ); } - double SAL_CALL AnalysisAddIn::getRandbetween( double fMin, double fMax ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { fMin = ::rtl::math::round( fMin, 0, rtl_math_RoundingMode_Up ); @@ -777,7 +709,6 @@ double SAL_CALL AnalysisAddIn::getRandbetween( double fMin, double fMax ) throw( RETURN_FINITE( fRet ); } - double SAL_CALL AnalysisAddIn::getGcd( const uno::Reference< beans::XPropertySet >& xOpt, const uno::Sequence< uno::Sequence< double > >& aVLst, const uno::Sequence< uno::Any >& aOptVLst ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { ScaDoubleListGT0 aValList; @@ -797,7 +728,6 @@ double SAL_CALL AnalysisAddIn::getGcd( const uno::Reference< beans::XPropertySet RETURN_FINITE( f ); } - double SAL_CALL AnalysisAddIn::getLcm( const uno::Reference< beans::XPropertySet >& xOpt, const uno::Sequence< uno::Sequence< double > >& aVLst, const uno::Sequence< uno::Any >& aOptVLst ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { ScaDoubleListGE0 aValList; @@ -825,21 +755,18 @@ double SAL_CALL AnalysisAddIn::getLcm( const uno::Reference< beans::XPropertySet RETURN_FINITE( f ); } - double SAL_CALL AnalysisAddIn::getBesseli( double fNum, sal_Int32 nOrder ) throw( uno::RuntimeException, lang::IllegalArgumentException, sheet::NoConvergenceException ) { double fRet = sca::analysis::BesselI( fNum, nOrder ); RETURN_FINITE( fRet ); } - double SAL_CALL AnalysisAddIn::getBesselj( double fNum, sal_Int32 nOrder ) throw( uno::RuntimeException, lang::IllegalArgumentException, sheet::NoConvergenceException ) { double fRet = sca::analysis::BesselJ( fNum, nOrder ); RETURN_FINITE( fRet ); } - double SAL_CALL AnalysisAddIn::getBesselk( double fNum, sal_Int32 nOrder ) throw( uno::RuntimeException, lang::IllegalArgumentException, sheet::NoConvergenceException ) { if( nOrder < 0 || fNum <= 0.0 ) @@ -849,7 +776,6 @@ double SAL_CALL AnalysisAddIn::getBesselk( double fNum, sal_Int32 nOrder ) throw RETURN_FINITE( fRet ); } - double SAL_CALL AnalysisAddIn::getBessely( double fNum, sal_Int32 nOrder ) throw( uno::RuntimeException, lang::IllegalArgumentException, sheet::NoConvergenceException ) { if( nOrder < 0 || fNum <= 0.0 ) @@ -859,7 +785,6 @@ double SAL_CALL AnalysisAddIn::getBessely( double fNum, sal_Int32 nOrder ) throw 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) @@ -868,7 +793,6 @@ const double SCA_MAX16 = 549755813888.0; // max. val for hexadecimal 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 - OUString SAL_CALL AnalysisAddIn::getBin2Oct( const uno::Reference< beans::XPropertySet >& xOpt, const OUString& aNum, const uno::Any& rPlaces ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fVal = ConvertToDec( aNum, 2, SCA_MAXPLACES ); @@ -877,14 +801,12 @@ OUString SAL_CALL AnalysisAddIn::getBin2Oct( const uno::Reference< beans::XPrope return ConvertFromDec( fVal, SCA_MIN8, SCA_MAX8, 8, nPlaces, SCA_MAXPLACES, bUsePlaces ); } - double SAL_CALL AnalysisAddIn::getBin2Dec( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fRet = ConvertToDec( aNum, 2, SCA_MAXPLACES ); RETURN_FINITE( fRet ); } - OUString SAL_CALL AnalysisAddIn::getBin2Hex( const uno::Reference< beans::XPropertySet >& xOpt, const OUString& aNum, const uno::Any& rPlaces ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fVal = ConvertToDec( aNum, 2, SCA_MAXPLACES ); @@ -893,7 +815,6 @@ OUString SAL_CALL AnalysisAddIn::getBin2Hex( const uno::Reference< beans::XPrope return ConvertFromDec( fVal, SCA_MIN16, SCA_MAX16, 16, nPlaces, SCA_MAXPLACES, bUsePlaces ); } - OUString SAL_CALL AnalysisAddIn::getOct2Bin( const uno::Reference< beans::XPropertySet >& xOpt, const OUString& aNum, const uno::Any& rPlaces ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fVal = ConvertToDec( aNum, 8, SCA_MAXPLACES ); @@ -902,14 +823,12 @@ OUString SAL_CALL AnalysisAddIn::getOct2Bin( const uno::Reference< beans::XPrope return ConvertFromDec( fVal, SCA_MIN2, SCA_MAX2, 2, nPlaces, SCA_MAXPLACES, bUsePlaces ); } - double SAL_CALL AnalysisAddIn::getOct2Dec( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fRet = ConvertToDec( aNum, 8, SCA_MAXPLACES ); RETURN_FINITE( fRet ); } - OUString SAL_CALL AnalysisAddIn::getOct2Hex( const uno::Reference< beans::XPropertySet >& xOpt, const OUString& aNum, const uno::Any& rPlaces ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fVal = ConvertToDec( aNum, 8, SCA_MAXPLACES ); @@ -918,7 +837,6 @@ OUString SAL_CALL AnalysisAddIn::getOct2Hex( const uno::Reference< beans::XPrope return ConvertFromDec( fVal, SCA_MIN16, SCA_MAX16, 16, nPlaces, SCA_MAXPLACES, bUsePlaces ); } - OUString SAL_CALL AnalysisAddIn::getDec2Bin( const uno::Reference< beans::XPropertySet >& xOpt, sal_Int32 nNum, const uno::Any& rPlaces ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { sal_Int32 nPlaces = 0; @@ -926,7 +844,6 @@ OUString SAL_CALL AnalysisAddIn::getDec2Bin( const uno::Reference< beans::XPrope return ConvertFromDec( nNum, SCA_MIN2, SCA_MAX2, 2, nPlaces, SCA_MAXPLACES, bUsePlaces ); } - OUString SAL_CALL AnalysisAddIn::getDec2Oct( const uno::Reference< beans::XPropertySet >& xOpt, sal_Int32 nNum, const uno::Any& rPlaces ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { sal_Int32 nPlaces = 0; @@ -934,7 +851,6 @@ OUString SAL_CALL AnalysisAddIn::getDec2Oct( const uno::Reference< beans::XPrope return ConvertFromDec( nNum, SCA_MIN8, SCA_MAX8, 8, nPlaces, SCA_MAXPLACES, bUsePlaces ); } - OUString SAL_CALL AnalysisAddIn::getDec2Hex( const uno::Reference< beans::XPropertySet >& xOpt, double fNum, const uno::Any& rPlaces ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { sal_Int32 nPlaces = 0; @@ -942,7 +858,6 @@ OUString SAL_CALL AnalysisAddIn::getDec2Hex( const uno::Reference< beans::XPrope return ConvertFromDec( fNum, SCA_MIN16, SCA_MAX16, 16, nPlaces, SCA_MAXPLACES, bUsePlaces ); } - OUString SAL_CALL AnalysisAddIn::getHex2Bin( const uno::Reference< beans::XPropertySet >& xOpt, const OUString& aNum, const uno::Any& rPlaces ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fVal = ConvertToDec( aNum, 16, SCA_MAXPLACES ); @@ -951,14 +866,12 @@ OUString SAL_CALL AnalysisAddIn::getHex2Bin( const uno::Reference< beans::XPrope return ConvertFromDec( fVal, SCA_MIN2, SCA_MAX2, 2, nPlaces, SCA_MAXPLACES, bUsePlaces ); } - double SAL_CALL AnalysisAddIn::getHex2Dec( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fRet = ConvertToDec( aNum, 16, SCA_MAXPLACES ); RETURN_FINITE( fRet ); } - OUString SAL_CALL AnalysisAddIn::getHex2Oct( const uno::Reference< beans::XPropertySet >& xOpt, const OUString& aNum, const uno::Any& rPlaces ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fVal = ConvertToDec( aNum, 16, SCA_MAXPLACES ); @@ -967,13 +880,11 @@ OUString SAL_CALL AnalysisAddIn::getHex2Oct( const uno::Reference< beans::XPrope return ConvertFromDec( fVal, SCA_MIN8, SCA_MAX8, 8, nPlaces, SCA_MAXPLACES, bUsePlaces ); } - sal_Int32 SAL_CALL AnalysisAddIn::getDelta( const uno::Reference< beans::XPropertySet >& xOpt, double fNum1, const uno::Any& rNum2 ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { return sal_Int32(fNum1 == aAnyConv.getDouble( xOpt, rNum2, 0.0 )); } - double SAL_CALL AnalysisAddIn::getErf( const uno::Reference< beans::XPropertySet >& xOpt, double fLL, const uno::Any& rUL ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fUL, fRet; @@ -983,41 +894,35 @@ double SAL_CALL AnalysisAddIn::getErf( const uno::Reference< beans::XPropertySet RETURN_FINITE( fRet ); } - double SAL_CALL AnalysisAddIn::getErfc( double f ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fRet = Erfc( f ); RETURN_FINITE( fRet ); } - sal_Int32 SAL_CALL AnalysisAddIn::getGestep( const uno::Reference< beans::XPropertySet >& xOpt, double fNum, const uno::Any& rStep ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { return sal_Int32(fNum >= aAnyConv.getDouble( xOpt, rStep, 0.0 )); } - double SAL_CALL AnalysisAddIn::getFactdouble( sal_Int32 nNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fRet = FactDouble( nNum ); RETURN_FINITE( fRet ); } - double SAL_CALL AnalysisAddIn::getImabs( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fRet = Complex( aNum ).Abs(); RETURN_FINITE( fRet ); } - double SAL_CALL AnalysisAddIn::getImaginary( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fRet = Complex( aNum ).Imag(); RETURN_FINITE( fRet ); } - OUString SAL_CALL AnalysisAddIn::getImpower( const OUString& aNum, double f ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1027,14 +932,12 @@ OUString SAL_CALL AnalysisAddIn::getImpower( const OUString& aNum, double f ) th return z.GetString(); } - double SAL_CALL AnalysisAddIn::getImargument( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fRet = Complex( aNum ).Arg(); RETURN_FINITE( fRet ); } - OUString SAL_CALL AnalysisAddIn::getImcos( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1044,7 +947,6 @@ OUString SAL_CALL AnalysisAddIn::getImcos( const OUString& aNum ) throw( uno::Ru return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImdiv( const OUString& aDivid, const OUString& aDivis ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aDivid ); @@ -1054,7 +956,6 @@ OUString SAL_CALL AnalysisAddIn::getImdiv( const OUString& aDivid, const OUStrin return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImexp( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1064,7 +965,6 @@ OUString SAL_CALL AnalysisAddIn::getImexp( const OUString& aNum ) throw( uno::Ru return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImconjugate( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1074,7 +974,6 @@ OUString SAL_CALL AnalysisAddIn::getImconjugate( const OUString& aNum ) throw( u return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImln( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1084,7 +983,6 @@ OUString SAL_CALL AnalysisAddIn::getImln( const OUString& aNum ) throw( uno::Run return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImlog10( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1094,7 +992,6 @@ OUString SAL_CALL AnalysisAddIn::getImlog10( const OUString& aNum ) throw( uno:: return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImlog2( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1104,7 +1001,6 @@ OUString SAL_CALL AnalysisAddIn::getImlog2( const OUString& aNum ) throw( uno::R return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImproduct( const uno::Reference< beans::XPropertySet >&, const uno::Sequence< uno::Sequence< OUString > >& aNum1, const uno::Sequence< uno::Any >& aNL ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { ComplexList z_list; @@ -1122,14 +1018,12 @@ OUString SAL_CALL AnalysisAddIn::getImproduct( const uno::Reference< beans::XPro return z.GetString(); } - double SAL_CALL AnalysisAddIn::getImreal( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { double fRet = Complex( aNum ).Real(); RETURN_FINITE( fRet ); } - OUString SAL_CALL AnalysisAddIn::getImsin( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1139,7 +1033,6 @@ OUString SAL_CALL AnalysisAddIn::getImsin( const OUString& aNum ) throw( uno::Ru return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImsub( const OUString& aNum1, const OUString& aNum2 ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum1 ); @@ -1149,7 +1042,6 @@ OUString SAL_CALL AnalysisAddIn::getImsub( const OUString& aNum1, const OUString return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImsum( const uno::Reference< beans::XPropertySet >&, const uno::Sequence< uno::Sequence< OUString > >& aNum1, const uno::Sequence< uno::Any >& aFollowingPars ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { ComplexList z_list; @@ -1167,7 +1059,6 @@ OUString SAL_CALL AnalysisAddIn::getImsum( const uno::Reference< beans::XPropert return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImsqrt( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1177,7 +1068,6 @@ OUString SAL_CALL AnalysisAddIn::getImsqrt( const OUString& aNum ) throw( uno::R return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImtan( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1187,7 +1077,6 @@ OUString SAL_CALL AnalysisAddIn::getImtan( const OUString& aNum ) throw( uno::Ru return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImsec( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1197,7 +1086,6 @@ OUString SAL_CALL AnalysisAddIn::getImsec( const OUString& aNum ) throw( uno::Ru return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImcsc( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1207,7 +1095,6 @@ OUString SAL_CALL AnalysisAddIn::getImcsc( const OUString& aNum ) throw( uno::Ru return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImcot( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1217,7 +1104,6 @@ OUString SAL_CALL AnalysisAddIn::getImcot( const OUString& aNum ) throw( uno::Ru return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImsinh( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1227,7 +1113,6 @@ OUString SAL_CALL AnalysisAddIn::getImsinh( const OUString& aNum ) throw( uno::R return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImcosh( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1237,7 +1122,6 @@ OUString SAL_CALL AnalysisAddIn::getImcosh( const OUString& aNum ) throw( uno::R return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImsech( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1247,7 +1131,6 @@ OUString SAL_CALL AnalysisAddIn::getImsech( const OUString& aNum ) throw( uno::R return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getImcsch( const OUString& aNum ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { Complex z( aNum ); @@ -1257,7 +1140,6 @@ OUString SAL_CALL AnalysisAddIn::getImcsch( const OUString& aNum ) throw( uno::R return z.GetString(); } - OUString SAL_CALL AnalysisAddIn::getComplex( double fR, double fI, const uno::Any& rSuff ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { sal_Bool bi; @@ -1282,7 +1164,6 @@ OUString SAL_CALL AnalysisAddIn::getComplex( double fR, double fI, const uno::An return Complex( fR, fI, bi ? 'i' : 'j' ).GetString(); } - double SAL_CALL AnalysisAddIn::getConvert( double f, const OUString& aFU, const OUString& aTU ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { if( !pCDL ) @@ -1292,5 +1173,4 @@ double SAL_CALL AnalysisAddIn::getConvert( double f, const OUString& aFU, const RETURN_FINITE( fRet ); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx index 2615697b05c5..a807eb3140cb 100644 --- a/scaddins/source/datefunc/datefunc.cxx +++ b/scaddins/source/datefunc/datefunc.cxx @@ -17,36 +17,25 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -//------------------------------------------------------------------ -// -// date functions add in -// -//------------------------------------------------------------------ - #include "datefunc.hxx" #include "datefunc.hrc" +#include #include +#include #include #include -#include #include -#include +#include 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; @@ -74,24 +63,17 @@ void ScaList::_Grow() pData = pNewData; } -//------------------------------------------------------------------ - 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 STDPAR sal_False // all parameters are described @@ -114,9 +96,6 @@ const ScaFuncDataBase pFuncDataArr[] = #undef FUNCDATA - -//------------------------------------------------------------------ - ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rResMgr ) : aIntName( OUString::createFromAscii( rBaseData.pIntName ) ), nUINameID( rBaseData.nUINameID ), @@ -146,8 +125,6 @@ sal_uInt16 ScaFuncData::GetStrIndex( sal_uInt16 nParam ) const } -//------------------------------------------------------------------ - ScaFuncDataList::ScaFuncDataList( ResMgr& rResMgr ) : nLast( 0xFFFFFFFF ) { @@ -179,9 +156,6 @@ const ScaFuncData* ScaFuncDataList::Get( const OUString& rProgrammaticName ) con return NULL; } - -//------------------------------------------------------------------ - ScaFuncRes::ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUString& rRet ) : Resource( rResId ) { @@ -189,13 +163,7 @@ ScaFuncRes::ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUStr FreeResource(); } - -//------------------------------------------------------------------ -// // entry points for service registration / instantiation -// -//------------------------------------------------------------------ - uno::Reference< uno::XInterface > SAL_CALL ScaDateAddIn_CreateInstance( const uno::Reference< lang::XMultiServiceFactory >& ) { @@ -203,9 +171,6 @@ uno::Reference< uno::XInterface > SAL_CALL ScaDateAddIn_CreateInstance( return xInst; } - -//------------------------------------------------------------------------ - extern "C" { SAL_DLLPUBLIC_EXPORT void * SAL_CALL date_component_getFactory( @@ -234,12 +199,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL date_component_getFactory( } // extern C -//------------------------------------------------------------------------ -// // "normal" service implementation -// -//------------------------------------------------------------------------ - ScaDateAddIn::ScaDateAddIn() : pDefLocales( NULL ), pResMgr( NULL ), @@ -331,9 +291,6 @@ OUString ScaDateAddIn::GetFuncDescrStr( sal_uInt16 nResId, sal_uInt16 nStrIndex return aRet; } - -//------------------------------------------------------------------------ - OUString ScaDateAddIn::getImplementationName_Static() { return OUString( MY_IMPLNAME ); @@ -349,7 +306,6 @@ uno::Sequence< OUString > ScaDateAddIn::getSupportedServiceNames_Static() } // XServiceName - OUString SAL_CALL ScaDateAddIn::getServiceName() throw( uno::RuntimeException ) { // name of specific AddIn service @@ -357,7 +313,6 @@ OUString SAL_CALL ScaDateAddIn::getServiceName() throw( uno::RuntimeException ) } // XServiceInfo - OUString SAL_CALL ScaDateAddIn::getImplementationName() throw( uno::RuntimeException ) { return getImplementationName_Static(); @@ -365,7 +320,7 @@ OUString SAL_CALL ScaDateAddIn::getImplementationName() throw( uno::RuntimeExcep sal_Bool SAL_CALL ScaDateAddIn::supportsService( const OUString& aServiceName ) throw( uno::RuntimeException ) { - return aServiceName == ADDIN_SERVICE || aServiceName == MY_SERVICE; + return cppu::supportsService(this, aServiceName); } uno::Sequence< OUString > SAL_CALL ScaDateAddIn::getSupportedServiceNames() throw( uno::RuntimeException ) @@ -374,7 +329,6 @@ uno::Sequence< OUString > SAL_CALL ScaDateAddIn::getSupportedServiceNames() thro } // XLocalizable - void SAL_CALL ScaDateAddIn::setLocale( const lang::Locale& eLocale ) throw( uno::RuntimeException ) { aFuncLoc = eLocale; @@ -386,14 +340,6 @@ 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 @@ -500,9 +446,7 @@ OUString SAL_CALL ScaDateAddIn::getDisplayCategoryName( return getProgrammaticCategoryName( aProgrammaticName ); } - // XCompatibilityNames - uno::Sequence< sheet::LocalizedName > SAL_CALL ScaDateAddIn::getCompatibilityNames( const OUString& aProgrammaticName ) throw( uno::RuntimeException ) { @@ -523,8 +467,8 @@ uno::Sequence< sheet::LocalizedName > SAL_CALL ScaDateAddIn::getCompatibilityNam } namespace { -// auxiliary functions +// auxiliary functions sal_Bool IsLeapYear( sal_uInt16 nYear ) { return ((((nYear % 4) == 0) && ((nYear % 100) != 0)) || ((nYear % 400) == 0)); @@ -630,7 +574,6 @@ void DaysToDate( sal_Int32 nDays, * this function returns this internal Date value for the document null date * */ - sal_Int32 GetNullDate( const uno::Reference< beans::XPropertySet >& xOptions ) throw( uno::RuntimeException ) { @@ -745,7 +688,6 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffWeeks( * * 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, @@ -791,7 +733,6 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffMonths( * * 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, @@ -816,7 +757,6 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffYears( /** * 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 ) @@ -833,7 +773,6 @@ sal_Int32 SAL_CALL ScaDateAddIn::getIsLeapYear( /** * Get the Number of Days in the month for a date */ - sal_Int32 SAL_CALL ScaDateAddIn::getDaysInMonth( const uno::Reference& xOptions, sal_Int32 nDate ) throw( uno::RuntimeException, lang::IllegalArgumentException ) @@ -850,7 +789,6 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDaysInMonth( /** * 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 ) @@ -879,7 +817,6 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDaysInYear( * * @see #IsLeapYear #WeekNumber */ - sal_Int32 SAL_CALL ScaDateAddIn::getWeeksInYear( const uno::Reference< beans::XPropertySet >& xOptions, sal_Int32 nDate ) throw( uno::RuntimeException, lang::IllegalArgumentException ) @@ -909,7 +846,6 @@ sal_Int32 SAL_CALL ScaDateAddIn::getWeeksInYear( * 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 ); @@ -924,6 +860,4 @@ OUString SAL_CALL ScaDateAddIn::getRot13( const OUString& aSrcString ) throw( un return aBuffer.makeStringAndClear(); } -//------------------------------------------------------------------ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx index fc0d79afc954..24c66092d76f 100644 --- a/scaddins/source/pricing/pricing.cxx +++ b/scaddins/source/pricing/pricing.cxx @@ -17,43 +17,34 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -//------------------------------------------------------------------ -// // pricing functions add in // // all of the UNO add-in technical details have been copied from // ../datefunc/datefunc.cxx -// -//------------------------------------------------------------------ #include "pricing.hxx" #include "black_scholes.hxx" #include "pricing.hrc" + #include +#include +#include #include -#include #include -#include +#include #include - -#include +#include using namespace ::com::sun::star; using namespace sca::pricing; -//------------------------------------------------------------------ - #define ADDIN_SERVICE "com.sun.star.sheet.AddIn" #define MY_SERVICE "com.sun.star.sheet.addin.PricingFunctions" #define MY_IMPLNAME "com.sun.star.sheet.addin.PricingFunctionsImpl" -//------------------------------------------------------------------ - #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; @@ -81,24 +72,17 @@ void ScaList::_Grow() pData = pNewData; } -//------------------------------------------------------------------ - 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 STDPAR sal_False // all parameters are described @@ -116,9 +100,6 @@ const ScaFuncDataBase pFuncDataArr[] = #undef FUNCDATA - -//------------------------------------------------------------------ - ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rResMgr ) : aIntName( OUString::createFromAscii( rBaseData.pIntName ) ), nUINameID( rBaseData.nUINameID ), @@ -147,9 +128,6 @@ sal_uInt16 ScaFuncData::GetStrIndex( sal_uInt16 nParam ) const return (nParam > nParamCount) ? (nParamCount * 2) : (nParam * 2); } - -//------------------------------------------------------------------ - ScaFuncDataList::ScaFuncDataList( ResMgr& rResMgr ) : nLast( 0xFFFFFFFF ) { @@ -183,7 +161,6 @@ const ScaFuncData* ScaFuncDataList::Get( const OUString& rProgrammaticName ) con } -//------------------------------------------------------------------ ScaFuncRes::ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUString& rRet ) : Resource( rResId ) @@ -192,13 +169,7 @@ ScaFuncRes::ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUStr FreeResource(); } - -//------------------------------------------------------------------ -// -// entry points for service registration / instantiation -// -//------------------------------------------------------------------ - +// entry points for service registration / instantiation uno::Reference< uno::XInterface > SAL_CALL ScaPricingAddIn_CreateInstance( const uno::Reference< lang::XMultiServiceFactory >& ) { @@ -207,8 +178,6 @@ uno::Reference< uno::XInterface > SAL_CALL ScaPricingAddIn_CreateInstance( } -//------------------------------------------------------------------------ - extern "C" { SAL_DLLPUBLIC_EXPORT void * SAL_CALL pricing_component_getFactory( @@ -237,12 +206,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL pricing_component_getFactory( } // extern C -//------------------------------------------------------------------------ -// // "normal" service implementation -// -//------------------------------------------------------------------------ - ScaPricingAddIn::ScaPricingAddIn() : pDefLocales( NULL ), pResMgr( NULL ), @@ -335,9 +299,6 @@ OUString ScaPricingAddIn::GetFuncDescrStr( sal_uInt16 nResId, sal_uInt16 nStrInd return aRet; } - -//------------------------------------------------------------------------ - OUString ScaPricingAddIn::getImplementationName_Static() { return OUString( MY_IMPLNAME ); @@ -353,7 +314,6 @@ uno::Sequence< OUString > ScaPricingAddIn::getSupportedServiceNames_Static() } // XServiceName - OUString SAL_CALL ScaPricingAddIn::getServiceName() throw( uno::RuntimeException ) { // name of specific AddIn service @@ -361,7 +321,6 @@ OUString SAL_CALL ScaPricingAddIn::getServiceName() throw( uno::RuntimeException } // XServiceInfo - OUString SAL_CALL ScaPricingAddIn::getImplementationName() throw( uno::RuntimeException ) { return getImplementationName_Static(); @@ -369,7 +328,7 @@ OUString SAL_CALL ScaPricingAddIn::getImplementationName() throw( uno::RuntimeEx sal_Bool SAL_CALL ScaPricingAddIn::supportsService( const OUString& aServiceName ) throw( uno::RuntimeException ) { - return aServiceName == ADDIN_SERVICE || aServiceName == MY_SERVICE; + return cppu::supportsService(this, aServiceName); } uno::Sequence< OUString > SAL_CALL ScaPricingAddIn::getSupportedServiceNames() throw( uno::RuntimeException ) @@ -378,7 +337,6 @@ uno::Sequence< OUString > SAL_CALL ScaPricingAddIn::getSupportedServiceNames() t } // XLocalizable - void SAL_CALL ScaPricingAddIn::setLocale( const lang::Locale& eLocale ) throw( uno::RuntimeException ) { aFuncLoc = eLocale; @@ -390,12 +348,7 @@ lang::Locale SAL_CALL ScaPricingAddIn::getLocale() throw( uno::RuntimeException return aFuncLoc; } -//------------------------------------------------------------------ -// -// function descriptions start here -// -//------------------------------------------------------------------ - +// function descriptions start here // XAddIn OUString SAL_CALL ScaPricingAddIn::getProgrammaticFuntionName( const OUString& ) throw( uno::RuntimeException ) { @@ -503,9 +456,7 @@ OUString SAL_CALL ScaPricingAddIn::getDisplayCategoryName( return getProgrammaticCategoryName( aProgrammaticName ); } - // XCompatibilityNames - uno::Sequence< sheet::LocalizedName > SAL_CALL ScaPricingAddIn::getCompatibilityNames( const OUString& aProgrammaticName ) throw( uno::RuntimeException ) { @@ -525,13 +476,7 @@ uno::Sequence< sheet::LocalizedName > SAL_CALL ScaPricingAddIn::getCompatibility return aRet; } - - -// --------------------------------------------------------------------- -// --------------------------------------------------------------------- // actual function implementation starts here -// - // auxillary input handling functions namespace { @@ -639,7 +584,6 @@ bool getinput_greek(bs::types::Greeks& greek, const uno::Any& anyval) { } // namespace for auxillary functions - // OPT_BARRIER(...) double SAL_CALL ScaPricingAddIn::getOptBarrier( double spot, double vol, double r, double rf, double T, double strike, @@ -729,7 +673,4 @@ double SAL_CALL ScaPricingAddIn::getOptProbInMoney( double spot, double vol, } - -//------------------------------------------------------------------ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3