summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-02-14 16:10:07 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-02-15 14:17:33 +0000
commit8b3a9d3055d261a3ba16932bf7f361e0ca5c77c2 (patch)
treeb3ace491d95038fe2ee50f2b602ec790b39af2ec
parent9a7d112603393ad45b71d36860ac7d0d8175c06d (diff)
Some simplifications, using UNO_QUERY_THROW
Change-Id: Ida366e40ade98443019d3c312ae19864f93c9e5e Reviewed-on: https://gerrit.libreoffice.org/34258 Tested-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--sfx2/source/appl/imestatuswindow.cxx7
-rw-r--r--sfx2/source/doc/guisaveas.cxx17
-rw-r--r--sfx2/source/doc/objstor.cxx12
-rw-r--r--sfx2/source/view/ipclient.cxx21
4 files changed, 13 insertions, 44 deletions
diff --git a/sfx2/source/appl/imestatuswindow.cxx b/sfx2/source/appl/imestatuswindow.cxx
index 4d46add22663..0e5bb44445a9 100644
--- a/sfx2/source/appl/imestatuswindow.cxx
+++ b/sfx2/source/appl/imestatuswindow.cxx
@@ -205,12 +205,7 @@ css::uno::Reference< css::beans::XPropertySet > ImeStatusWindow::getConfig()
xProvider->createInstanceWithArguments(
"com.sun.star.configuration.ConfigurationUpdateAccess",
aArgs),
- css::uno::UNO_QUERY);
- if (!m_xConfig.is())
- throw css::uno::RuntimeException(
- "null com.sun.star.configuration."
- "ConfigurationUpdateAccess",
- nullptr);
+ css::uno::UNO_QUERY_THROW);
bAdd = true;
}
xConfig = m_xConfig;
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index b465b54ff244..8f08c35ca2c1 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -395,9 +395,7 @@ uno::Reference< frame::XStorable > const & ModelData_Impl::GetStorable()
{
if ( !m_xStorable.is() )
{
- m_xStorable.set( m_xModel, uno::UNO_QUERY );
- if ( !m_xStorable.is() )
- throw uno::RuntimeException();
+ m_xStorable.set( m_xModel, uno::UNO_QUERY_THROW );
}
return m_xStorable;
@@ -408,9 +406,7 @@ uno::Reference< frame::XStorable2 > const & ModelData_Impl::GetStorable2()
{
if ( !m_xStorable2.is() )
{
- m_xStorable2.set( m_xModel, uno::UNO_QUERY );
- if ( !m_xStorable2.is() )
- throw uno::RuntimeException();
+ m_xStorable2.set( m_xModel, uno::UNO_QUERY_THROW );
}
return m_xStorable2;
@@ -1274,10 +1270,7 @@ uno::Reference< container::XNameAccess > const & SfxStoringHelper::GetFilterConf
if ( !m_xFilterCFG.is() )
{
m_xFilterCFG.set( comphelper::getProcessServiceFactory()->createInstance("com.sun.star.document.FilterFactory"),
- uno::UNO_QUERY );
-
- if ( !m_xFilterCFG.is() )
- throw uno::RuntimeException();
+ uno::UNO_QUERY_THROW );
}
return m_xFilterCFG;
@@ -1288,9 +1281,7 @@ uno::Reference< container::XContainerQuery > const & SfxStoringHelper::GetFilter
{
if ( !m_xFilterQuery.is() )
{
- m_xFilterQuery.set( GetFilterConfiguration(), uno::UNO_QUERY );
- if ( !m_xFilterQuery.is() )
- throw uno::RuntimeException();
+ m_xFilterQuery.set( GetFilterConfiguration(), uno::UNO_QUERY_THROW );
}
return m_xFilterQuery;
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 92ad92347f1e..1bf7099e496c 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -232,11 +232,7 @@ bool SfxObjectShell::PutURLContentsToVersionStream_Impl(
throw uno::RuntimeException();
uno::Reference< io::XOutputStream > xOutStream = xVerStream->getOutputStream();
- uno::Reference< io::XTruncate > xTrunc( xOutStream, uno::UNO_QUERY );
-
- DBG_ASSERT( xTrunc.is(), "The output stream must exist and implement XTruncate interface!\n" );
- if ( !xTrunc.is() )
- throw RuntimeException();
+ uno::Reference< io::XTruncate > xTrunc( xOutStream, uno::UNO_QUERY_THROW );
uno::Reference< io::XInputStream > xTmpInStream =
::comphelper::OStorageHelper::GetInputStreamFromURL(
@@ -1345,11 +1341,7 @@ bool SfxObjectShell::SaveTo_Impl
try
{
- uno::Reference< beans::XPropertySet > xProps( rMedium.GetStorage(), uno::UNO_QUERY );
- DBG_ASSERT( xProps.is(), "The storage implementation must implement XPropertySet!" );
- if ( !xProps.is() )
- throw uno::RuntimeException();
-
+ uno::Reference< beans::XPropertySet > xProps( rMedium.GetStorage(), uno::UNO_QUERY_THROW );
xProps->setPropertyValue("MediaType",
uno::makeAny( aDataFlavor.MimeType ) );
}
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index 41d6092c3cb6..f35b41aa379c 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -214,9 +214,7 @@ void SAL_CALL SfxInPlaceClient_Impl::saveObject()
return;
// the common persistence is supported by objects and links
- uno::Reference< embed::XCommonEmbedPersist > xPersist( m_xObject, uno::UNO_QUERY );
- if ( !xPersist.is() )
- throw uno::RuntimeException();
+ uno::Reference< embed::XCommonEmbedPersist > xPersist( m_xObject, uno::UNO_QUERY_THROW );
uno::Reference< frame::XFrame > xFrame;
uno::Reference< task::XStatusIndicator > xStatusIndicator;
@@ -363,9 +361,7 @@ void SAL_CALL SfxInPlaceClient_Impl::deactivatedUI()
uno::Reference< css::frame::XLayoutManager > SAL_CALL SfxInPlaceClient_Impl::getLayoutManager()
{
- uno::Reference < beans::XPropertySet > xFrame( GetFrame(), uno::UNO_QUERY );
- if ( !xFrame.is() )
- throw uno::RuntimeException();
+ uno::Reference < beans::XPropertySet > xFrame( GetFrame(), uno::UNO_QUERY_THROW );
uno::Reference< css::frame::XLayoutManager > xMan;
try
@@ -436,8 +432,8 @@ void SAL_CALL SfxInPlaceClient_Impl::scrollObject( const awt::Size& /*aOffset*/
void SAL_CALL SfxInPlaceClient_Impl::changedPlacement( const awt::Rectangle& aPosRect )
{
- uno::Reference< embed::XInplaceObject > xInplace( m_xObject, uno::UNO_QUERY );
- if ( !xInplace.is() || !m_pClient || !m_pClient->GetEditWin() || !m_pClient->GetViewShell() )
+ uno::Reference< embed::XInplaceObject > xInplace( m_xObject, uno::UNO_QUERY_THROW );
+ if ( !m_pClient || !m_pClient->GetEditWin() || !m_pClient->GetViewShell() )
throw uno::RuntimeException();
// check if the change is at least one pixel in size
@@ -493,10 +489,7 @@ uno::Reference< util::XCloseable > SAL_CALL SfxInPlaceClient_Impl::getComponent(
throw uno::RuntimeException();
// all the components must implement XCloseable
- uno::Reference< util::XCloseable > xComp( pDocShell->GetModel(), uno::UNO_QUERY );
- if ( !xComp.is() )
- throw uno::RuntimeException();
-
+ uno::Reference< util::XCloseable > xComp( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
return xComp;
}
@@ -526,9 +519,7 @@ void SfxInPlaceClient_Impl::SizeHasChanged()
|| m_xObject->getCurrentState() == embed::EmbedStates::UI_ACTIVE ) )
{
// only possible in active states
- uno::Reference< embed::XInplaceObject > xInplace( m_xObject, uno::UNO_QUERY );
- if ( !xInplace.is() )
- throw uno::RuntimeException();
+ uno::Reference< embed::XInplaceObject > xInplace( m_xObject, uno::UNO_QUERY_THROW );
if ( m_bResizeNoScale )
{