summaryrefslogtreecommitdiff
path: root/vbahelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-07 13:03:58 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2018-06-08 01:29:32 +0200
commit5708534b942c1d0ce384f6a8473da6bb569410e7 (patch)
tree2ec4fe87624541c15bf89c8b839e8f8dba8a89f4 /vbahelper
parent1e55a47e89a9d9d6cf9cb3993484022aaf2c097b (diff)
look for unnecessary calls to Reference::is() after an UNO_QUERY_THROW
Since the previous call would throw if there was nothing to be assigned to the value. Idea from tml. Used the following script to find places: git grep -A3 -n UNO_QUERY_THROW | grep -B3 -F 'is()' Change-Id: I36ba7b00bcd014bdf16c0455ab91056f82194969 Reviewed-on: https://gerrit.libreoffice.org/55417 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vbahelper')
-rw-r--r--vbahelper/source/vbahelper/vbaapplicationbase.cxx32
1 files changed, 13 insertions, 19 deletions
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index c1b780c54985..84b193ee9c1f 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -202,11 +202,9 @@ VbaApplicationBase::getDisplayStatusBar()
uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
- if( xProps.is() ){
- uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( "LayoutManager"), uno::UNO_QUERY_THROW );
- if( xLayoutManager.is() && xLayoutManager->isElementVisible( "private:resource/statusbar/statusbar" ) ){
- return true;
- }
+ uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( "LayoutManager"), uno::UNO_QUERY_THROW );
+ if( xLayoutManager->isElementVisible( "private:resource/statusbar/statusbar" ) ){
+ return true;
}
return false;
}
@@ -218,20 +216,16 @@ VbaApplicationBase::setDisplayStatusBar(sal_Bool bDisplayStatusBar)
uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
- if( xProps.is() ){
- uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( "LayoutManager" ), uno::UNO_QUERY_THROW );
- OUString url( "private:resource/statusbar/statusbar" );
- if( xLayoutManager.is() ){
- if( bDisplayStatusBar && !xLayoutManager->isElementVisible( url ) ){
- if( !xLayoutManager->showElement( url ) )
- xLayoutManager->createElement( url );
- return;
- }
- else if( !bDisplayStatusBar && xLayoutManager->isElementVisible( url ) ){
- xLayoutManager->hideElement( url );
- return;
- }
- }
+ uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( "LayoutManager" ), uno::UNO_QUERY_THROW );
+ OUString url( "private:resource/statusbar/statusbar" );
+ if( bDisplayStatusBar && !xLayoutManager->isElementVisible( url ) ){
+ if( !xLayoutManager->showElement( url ) )
+ xLayoutManager->createElement( url );
+ return;
+ }
+ else if( !bDisplayStatusBar && xLayoutManager->isElementVisible( url ) ){
+ xLayoutManager->hideElement( url );
+ return;
}
}