diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-17 15:42:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-18 11:03:02 +0200 |
commit | 7fc6063914432d58d86cfcbd728d967e7c86ebfd (patch) | |
tree | f71fe9f99edaa4e896c78cdf32e34b516194d748 /svx/source | |
parent | db83c41d460103df5d80f5bd99816575c4ead5cd (diff) |
use more Reference::query instead of UNO_QUERY_THROW
since querying with exceptions is consideably more expensive
Change-Id: I968a9a40766b2abb0d3058549b0ed44011fd5716
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155791
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, 8 insertions, 34 deletions
diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx index 37b9bc935222..ba3707652342 100644 --- a/svx/source/smarttags/SmartTagMgr.cxx +++ b/svx/source/smarttags/SmartTagMgr.cxx @@ -240,13 +240,8 @@ void SmartTagMgr::WriteConfiguration( const bool* pIsLabelTextWithSmartTags, if ( bCommit ) { - try - { - Reference< util::XChangesBatch >( mxConfigurationSettings, UNO_QUERY_THROW )->commitChanges(); - } - catch ( css::uno::Exception& ) - { - } + if (auto xChangesBatch = mxConfigurationSettings.query<util::XChangesBatch>() ) + xChangesBatch->commitChanges(); } } @@ -448,25 +443,16 @@ void SmartTagMgr::RegisterListener() { Reference<deployment::XExtensionManager> xExtensionManager( deployment::ExtensionManager::get( mxContext ) ); - Reference< util::XModifyBroadcaster > xMB ( xExtensionManager, UNO_QUERY_THROW ); - - Reference< util::XModifyListener > xListener( this ); - xMB->addModifyListener( xListener ); + if (auto xMB = xExtensionManager.query<util::XModifyBroadcaster>() ) + xMB->addModifyListener( Reference< util::XModifyListener >( this ) ); } catch ( uno::Exception& ) { } // register as listener at configuration - try - { - Reference<util::XChangesNotifier> xCN( mxConfigurationSettings, UNO_QUERY_THROW ); - Reference< util::XChangesListener > xListener( this ); - xCN->addChangesListener( xListener ); - } - catch ( uno::Exception& ) - { - } + if (auto xCN = mxConfigurationSettings.query<util::XChangesNotifier>() ) + xCN->addChangesListener( Reference< util::XChangesListener >( this ) ); } typedef std::pair < const OUString, ActionReference > SmartTagMapElement; diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 0d862f8964f8..ea0ede8c0f38 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2791,14 +2791,8 @@ SvxLineWindow_Impl::SvxLineWindow_Impl(SvxFrameToolBoxControl* pControl, weld::W , m_xLineStyleLbWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xLineStyleLb)) , m_bIsWriter(false) { - try - { - Reference< lang::XServiceInfo > xServices(m_xFrame->getController()->getModel(), UNO_QUERY_THROW); + if (auto xServices = m_xFrame->getController()->getModel().query<lang::XServiceInfo>()) 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 19c2a66ce1bb..2da0987c0b61 100644 --- a/svx/source/xml/xmlxtimp.cxx +++ b/svx/source/xml/xmlxtimp.cxx @@ -475,14 +475,8 @@ bool SvxXMLXTableImport::load( const OUString &rPath, const OUString &rReferer, if (xGraphicHelper.is()) xGraphicStorageHandler = xGraphicHelper.get(); - try - { - uno::Reference< io::XSeekable > xSeek( aParserInput.aInputStream, uno::UNO_QUERY_THROW ); + if (auto xSeek = aParserInput.aInputStream.query<io::XSeekable>() ) xSeek->seek( 0 ); - } - catch (const uno::Exception&) - { - } rtl::Reference<SvxXMLXTableImport> xImport(new SvxXMLXTableImport(xContext, xTable, xGraphicStorageHandler)); xImport->parseStream( aParserInput ); |