diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-25 11:30:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-25 14:15:56 +0200 |
commit | 87db52ab1e9c39ad8319aaf9c0c59d4435b6ffb5 (patch) | |
tree | 64795c67bc154c4d5bcf4287139d1db7e11c9a6c /svx/source | |
parent | 139cffc531277b57bae8e272fef13af00ace5366 (diff) |
Revert "use more Reference::query instead of UNO_QUERY_THROW"
This reverts commit 7fc6063914432d58d86cfcbd728d967e7c86ebfd.
sberg noticed that there is a difference now:
there's a subtle difference now, in that if y was null originally, it would have thrown a (caught) exception, whereas now it will crash in the y.query<X>() call.
Change-Id: Idbb5a08d635d15b5ca63f4822eddf05fb0a5afa0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156002
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/smarttags/SmartTagMgr.cxx | 26 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 8 | ||||
-rw-r--r-- | svx/source/xml/xmlxtimp.cxx | 8 |
3 files changed, 34 insertions, 8 deletions
diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx index ba3707652342..37b9bc935222 100644 --- a/svx/source/smarttags/SmartTagMgr.cxx +++ b/svx/source/smarttags/SmartTagMgr.cxx @@ -240,8 +240,13 @@ void SmartTagMgr::WriteConfiguration( const bool* pIsLabelTextWithSmartTags, if ( bCommit ) { - if (auto xChangesBatch = mxConfigurationSettings.query<util::XChangesBatch>() ) - xChangesBatch->commitChanges(); + try + { + Reference< util::XChangesBatch >( mxConfigurationSettings, UNO_QUERY_THROW )->commitChanges(); + } + catch ( css::uno::Exception& ) + { + } } } @@ -443,16 +448,25 @@ void SmartTagMgr::RegisterListener() { Reference<deployment::XExtensionManager> xExtensionManager( deployment::ExtensionManager::get( mxContext ) ); - if (auto xMB = xExtensionManager.query<util::XModifyBroadcaster>() ) - xMB->addModifyListener( Reference< util::XModifyListener >( this ) ); + Reference< util::XModifyBroadcaster > xMB ( xExtensionManager, UNO_QUERY_THROW ); + + Reference< util::XModifyListener > xListener( this ); + xMB->addModifyListener( xListener ); } catch ( uno::Exception& ) { } // register as listener at configuration - if (auto xCN = mxConfigurationSettings.query<util::XChangesNotifier>() ) - xCN->addChangesListener( Reference< util::XChangesListener >( this ) ); + try + { + Reference<util::XChangesNotifier> xCN( mxConfigurationSettings, UNO_QUERY_THROW ); + Reference< util::XChangesListener > xListener( this ); + xCN->addChangesListener( xListener ); + } + catch ( uno::Exception& ) + { + } } typedef std::pair < const OUString, ActionReference > SmartTagMapElement; diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index ea0ede8c0f38..0d862f8964f8 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2791,8 +2791,14 @@ SvxLineWindow_Impl::SvxLineWindow_Impl(SvxFrameToolBoxControl* pControl, weld::W , m_xLineStyleLbWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xLineStyleLb)) , m_bIsWriter(false) { - if (auto xServices = m_xFrame->getController()->getModel().query<lang::XServiceInfo>()) + try + { + Reference< lang::XServiceInfo > xServices(m_xFrame->getController()->getModel(), UNO_QUERY_THROW); m_bIsWriter = xServices->supportsService("com.sun.star.text.TextDocument"); + } + catch(const uno::Exception& ) + { + } m_xLineStyleLb->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_TABSTOP) ); diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx index 2da0987c0b61..19c2a66ce1bb 100644 --- a/svx/source/xml/xmlxtimp.cxx +++ b/svx/source/xml/xmlxtimp.cxx @@ -475,8 +475,14 @@ bool SvxXMLXTableImport::load( const OUString &rPath, const OUString &rReferer, if (xGraphicHelper.is()) xGraphicStorageHandler = xGraphicHelper.get(); - if (auto xSeek = aParserInput.aInputStream.query<io::XSeekable>() ) + try + { + uno::Reference< io::XSeekable > xSeek( aParserInput.aInputStream, uno::UNO_QUERY_THROW ); xSeek->seek( 0 ); + } + catch (const uno::Exception&) + { + } rtl::Reference<SvxXMLXTableImport> xImport(new SvxXMLXTableImport(xContext, xTable, xGraphicStorageHandler)); xImport->parseStream( aParserInput ); |