Some simplifications, using UNO_QUERY_THROW

Change-Id: I705e4e7e8446a503e3ef0e2828a22554f94585c6
Reviewed-on: https://gerrit.libreoffice.org/34259
Tested-by: Stephan Bergmann <sbergman@redhat.com>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2017-02-14 16:10:10 +01:00
parent 8b3a9d3055
commit c27586115d

View File

@@ -473,12 +473,7 @@ MasterScriptProvider::insertByName( const OUString& aName, const Any& aElement )
{
if ( m_xMSPPkg.is() )
{
Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY );
if ( !xCont.is() )
{
throw RuntimeException(
"PackageMasterScriptProvider doesn't implement XNameContainer" );
}
Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW );
xCont->insertByName( aName, aElement );
}
else
@@ -552,12 +547,7 @@ MasterScriptProvider::removeByName( const OUString& Name )
{
if ( m_xMSPPkg.is() )
{
Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY );
if ( !xCont.is() )
{
throw RuntimeException(
"PackageMasterScriptProvider doesn't implement XNameContainer" );
}
Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW );
xCont->removeByName( Name );
}
else
@@ -651,13 +641,7 @@ MasterScriptProvider::hasByName( const OUString& aName )
{
if ( m_xMSPPkg.is() )
{
Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY );
if ( !xCont.is() )
{
throw RuntimeException(
"PackageMasterScriptProvider doesn't implement XNameContainer" );
}
Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW );
result = xCont->hasByName( aName );
}
// If this is a document provider then we shouldn't