diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-06-06 09:47:11 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-06-06 09:47:32 +0200 |
commit | 9f0ed9d8ebdc31fe546ba280966481a0b2a6994e (patch) | |
tree | a913e3672f61a5a1f846cacb5e52fefe4e0dcd79 /scaddins | |
parent | 61e0433fdf1bfd391378ff9fcbf697aec4c5e61a (diff) |
Use o3tl/any.hxx in scaddins
Change-Id: Ifb19d216a00db90d6a267099077f90e6c54cd942
Diffstat (limited to 'scaddins')
-rw-r--r-- | scaddins/source/analysis/analysis.cxx | 3 | ||||
-rw-r--r-- | scaddins/source/analysis/analysishelper.cxx | 14 |
2 files changed, 10 insertions, 7 deletions
diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index 3375481aa935..b7e1c984beda 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -24,6 +24,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/random.hxx> #include <cppuhelper/supportsservice.hxx> +#include <o3tl/any.hxx> #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> #include <rtl/math.hxx> @@ -1150,7 +1151,7 @@ OUString SAL_CALL AnalysisAddIn::getComplex( double fR, double fI, const uno::An break; case uno::TypeClass_STRING: { - const OUString* pSuff = static_cast<const OUString*>(rSuff.getValue()); + auto pSuff = o3tl::forceGet<OUString>(rSuff); bi = *pSuff == "i" || pSuff->isEmpty(); if( !bi && *pSuff != "j" ) throw lang::IllegalArgumentException(); diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx index 8c65fcb3124b..8bb963e77608 100644 --- a/scaddins/source/analysis/analysishelper.cxx +++ b/scaddins/source/analysis/analysishelper.cxx @@ -22,6 +22,7 @@ #include <string.h> #include <stdio.h> +#include <o3tl/any.hxx> #include <tools/resary.hxx> #include <rtl/math.hxx> #include <sal/macros.h> @@ -1591,8 +1592,9 @@ void ScaDoubleList::Append( const uno::Any& rAny, 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 ); + if( auto s = o3tl::tryGet< + css::uno::Sequence<css::uno::Sequence<css::uno::Any>>>(rAny) ) + Append( rAnyConv, *s, bIgnoreEmpty ); else { double fValue; @@ -2120,10 +2122,10 @@ void ComplexList::Append( const uno::Sequence< uno::Any >& aMultPars, ComplListA case uno::TypeClass_VOID: break; case uno::TypeClass_STRING: { - const OUString* pStr = static_cast<const OUString*>(r.getValue()); + auto pStr = o3tl::forceGet<OUString>(r); if( !pStr->isEmpty() ) - Append( new Complex( *static_cast<OUString const *>(r.getValue()) ) ); + Append( new Complex( *pStr ) ); else if( bEmpty0 ) Append( new Complex( 0.0 ) ); else if( bErrOnEmpty ) @@ -2131,7 +2133,7 @@ void ComplexList::Append( const uno::Sequence< uno::Any >& aMultPars, ComplListA } break; case uno::TypeClass_DOUBLE: - Append( new Complex( *static_cast<double const *>(r.getValue()), 0.0 ) ); + Append( new Complex( *o3tl::forceGet<double>(r), 0.0 ) ); break; case uno::TypeClass_SEQUENCE: { @@ -2870,7 +2872,7 @@ bool ScaAnyConverter::getDouble( break; case uno::TypeClass_STRING: { - const OUString* pString = static_cast< const OUString* >( rAny.getValue() ); + auto pString = o3tl::forceGet< OUString >( rAny ); if( !pString->isEmpty() ) rfResult = convertToDouble( *pString ); else |