diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-22 10:53:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-22 13:06:24 +0200 |
commit | b9de047454c2603e2f5a5108254cd3f967e8a88b (patch) | |
tree | 589c20e48bfed9c3cfe6696c24c67d49f568c6bd /scripting/source/provider/MasterScriptProvider.cxx | |
parent | 448e9da1b440561441602e3a0956218b2702767e (diff) |
loplugin:flatten in scaddins..sd
Change-Id: I190323ce910224f883c4370b2c752644a5a35edd
Reviewed-on: https://gerrit.libreoffice.org/42626
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'scripting/source/provider/MasterScriptProvider.cxx')
-rw-r--r-- | scripting/source/provider/MasterScriptProvider.cxx | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx index 972097da4fb1..d9d829197e6c 100644 --- a/scripting/source/provider/MasterScriptProvider.cxx +++ b/scripting/source/provider/MasterScriptProvider.cxx @@ -300,23 +300,7 @@ MasterScriptProvider::getScript( const OUString& scriptURI ) buf.append( "com.sun.star.script.provider.ScriptProviderFor"); buf.append( language ); OUString serviceName = buf.makeStringAndClear(); - if ( providerCache() ) - { - try - { - xScriptProvider.set( - providerCache()->getProvider( serviceName ), - UNO_QUERY_THROW ); - } - catch( const Exception& e ) - { - throw provider::ScriptFrameworkErrorException( - e.Message, Reference< XInterface >(), - sfUri->getName(), language, - provider::ScriptFrameworkErrorType::NOTSUPPORTED ); - } - } - else + if ( !providerCache() ) { throw provider::ScriptFrameworkErrorException( "No LanguageProviders detected", @@ -324,6 +308,21 @@ MasterScriptProvider::getScript( const OUString& scriptURI ) sfUri->getName(), language, provider::ScriptFrameworkErrorType::NOTSUPPORTED ); } + + try + { + xScriptProvider.set( + providerCache()->getProvider( serviceName ), + UNO_QUERY_THROW ); + } + catch( const Exception& e ) + { + throw provider::ScriptFrameworkErrorException( + e.Message, Reference< XInterface >(), + sfUri->getName(), language, + provider::ScriptFrameworkErrorType::NOTSUPPORTED ); + } + xScript=xScriptProvider->getScript( scriptURI ); } else @@ -457,16 +456,13 @@ MasterScriptProvider::insertByName( const OUString& aName, const Any& aElement ) { if ( !m_bIsPkgMSP ) { - if ( m_xMSPPkg.is() ) - { - Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW ); - xCont->insertByName( aName, aElement ); - } - else + if ( !m_xMSPPkg.is() ) { throw RuntimeException( "PackageMasterScriptProvider is unitialised" ); } + Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW ); + xCont->insertByName( aName, aElement ); } else { @@ -529,16 +525,13 @@ MasterScriptProvider::removeByName( const OUString& Name ) { if ( !m_bIsPkgMSP ) { - if ( m_xMSPPkg.is() ) - { - Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW ); - xCont->removeByName( Name ); - } - else + if ( !m_xMSPPkg.is() ) { throw RuntimeException( "PackageMasterScriptProvider is unitialised" ); } + Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW ); + xCont->removeByName( Name ); } else { |