diff options
author | Tor Lillqvist <tml@collabora.com> | 2019-08-14 15:46:16 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2019-09-20 15:31:42 +0200 |
commit | 0e39803ea6a71676127ff75cd56bb29b232276ac (patch) | |
tree | 2de384b8de625c4cfbad43fc96be1d84098b4a89 /vbahelper | |
parent | c73da4e98a5cc789573216b9e2bdd1e0a20ffce0 (diff) |
Try harder to avoid exceptions screwing stuff up for OLE clients
Change-Id: I5e9ae8669c4f5c561a09f5f21f11a675a40e5929
(cherry picked from commit 81d6fbf3acaac13180424740a4be996bacf2aba7)
Reviewed-on: https://gerrit.libreoffice.org/79249
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/source/vbahelper/vbaapplicationbase.cxx | 14 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbadocumentsbase.cxx | 20 |
2 files changed, 30 insertions, 4 deletions
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index a441653551e4..35d53044cf12 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -222,8 +222,18 @@ sal_Bool SAL_CALL VbaApplicationBase::getInteractive() uno::Reference< frame::XModel > xModel = getCurrentDocument(); if (!xModel.is()) return true; - uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); - uno::Reference< awt::XWindow2 > xWindow( xFrame->getContainerWindow(), uno::UNO_QUERY_THROW ); + + uno::Reference< frame::XController > xController( xModel->getCurrentController() ); + if (!xController.is()) + return true; + + uno::Reference< frame::XFrame > xFrame( xController->getFrame() ); + if (!xFrame.is()) + return true; + + uno::Reference< awt::XWindow2 > xWindow( xFrame->getContainerWindow(), uno::UNO_QUERY ); + if (!xWindow.is()) + return true; return xWindow->isEnabled(); } diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index 7a993d7aa2cd..ccb28f2ad5fe 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -222,7 +222,15 @@ uno::Any VbaDocumentsBase::createDocument() // #163808# determine state of Application.ScreenUpdating and Application.Interactive symbols (before new document is opened) uno::Reference< XApplicationBase > xApplication( Application(), uno::UNO_QUERY ); bool bScreenUpdating = !xApplication.is() || xApplication->getScreenUpdating(); - bool bInteractive = !xApplication.is() || xApplication->getInteractive(); + bool bInteractive = true; + + try + { + bInteractive = !xApplication.is() || xApplication->getInteractive(); + } + catch( const uno::Exception& ) + { + } uno::Reference< frame::XDesktop2 > xLoader = frame::Desktop::create(mxContext); OUString sURL; @@ -255,7 +263,15 @@ uno::Any VbaDocumentsBase::openDocument( const OUString& rFileName, const uno::A // #163808# determine state of Application.ScreenUpdating and Application.Interactive symbols (before new document is opened) uno::Reference< XApplicationBase > xApplication( Application(), uno::UNO_QUERY ); bool bScreenUpdating = !xApplication.is() || xApplication->getScreenUpdating(); - bool bInteractive = !xApplication.is() || xApplication->getInteractive(); + bool bInteractive = true; + + try + { + bInteractive = !xApplication.is() || xApplication->getInteractive(); + } + catch( const uno::Exception& ) + { + } // we need to detect if this is a URL, if not then assume it's a file path OUString aURL; |