From 6113c68c7653f545f762b22f70adc518cf8d660d Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Tue, 14 Feb 2017 16:10:19 +0100
Subject: Some simplifications, using UNO_QUERY_THROW

Change-Id: If7a8abbf739aca98616ecb5cc3546ced192361d9
Reviewed-on: https://gerrit.libreoffice.org/34261
Tested-by: Stephan Bergmann <sbergman@redhat.com>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
---
 sc/source/ui/vba/vbaglobals.cxx | 9 ++-------
 sc/source/ui/vba/vbarange.cxx   | 4 +---
 2 files changed, 3 insertions(+), 10 deletions(-)

(limited to 'sc/source')

diff --git a/sc/source/ui/vba/vbaglobals.cxx b/sc/source/ui/vba/vbaglobals.cxx
index 598390fc8074..9799067e26e1 100644
--- a/sc/source/ui/vba/vbaglobals.cxx
+++ b/sc/source/ui/vba/vbaglobals.cxx
@@ -72,13 +72,8 @@ ScVbaGlobals::getExcel()
 uno::Reference< excel::XWorkbook > SAL_CALL
 ScVbaGlobals::getActiveWorkbook()
 {
-    uno::Reference< excel::XWorkbook > xWorkbook( getApplication()->getActiveWorkbook(), uno::UNO_QUERY);
-    if ( xWorkbook.is() )
-    {
-        return xWorkbook;
-    }
-// FIXME check if this is correct/desired behavior
-    throw uno::RuntimeException( "No activeWorkbook available" );
+    uno::Reference< excel::XWorkbook > xWorkbook( getApplication()->getActiveWorkbook(), uno::UNO_QUERY_THROW);
+    return xWorkbook;
 }
 
 uno::Reference< excel::XWindow > SAL_CALL
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 4d444f2aaebc..e11234142647 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -3174,9 +3174,7 @@ ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& L
             // After must be a single cell in the range
             if( xAfterRange->getCount() > 1 )
                 throw uno::RuntimeException("After must be a single cell." );
-            uno::Reference< excel::XRange > xCell( Cells( uno::makeAny( xAfterRange->getRow() ), uno::makeAny( xAfterRange->getColumn() ) ), uno::UNO_QUERY );
-            if( !xCell.is() )
-                throw uno::RuntimeException("After must be in range." );
+            uno::Reference< excel::XRange > xCell( Cells( uno::makeAny( xAfterRange->getRow() ), uno::makeAny( xAfterRange->getColumn() ) ), uno::UNO_QUERY_THROW );
             xStartCell.set( xAfterRange->getCellRange(), uno::UNO_QUERY_THROW );
         }
 
-- 
cgit