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 /sdext/source/minimizer/impoptimizer.cxx | |
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 'sdext/source/minimizer/impoptimizer.cxx')
-rw-r--r-- | sdext/source/minimizer/impoptimizer.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx index 72be9c666086..8cb61f01cb9c 100644 --- a/sdext/source/minimizer/impoptimizer.cxx +++ b/sdext/source/minimizer/impoptimizer.cxx @@ -73,10 +73,10 @@ static void ImpExtractCustomShow( const Reference< XModel >& rxModel, std::u16st try { PageCollector::CollectNonCustomShowPages( rxModel, rCustomShowName, vNonUsedPageList ); - Reference< XDrawPagesSupplier > xDrawPagesSupplier( rxModel, UNO_QUERY_THROW ); - Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW ); - for( const auto& rxPage : vNonUsedPageList ) - xDrawPages->remove( rxPage ); + if (auto xDrawPagesSupplier = rxModel.query<XDrawPagesSupplier>() ) + if (auto xDrawPages = xDrawPagesSupplier->getDrawPages().query<XDrawPages>() ) + for( const auto& rxPage : vNonUsedPageList ) + xDrawPages->remove( rxPage ); } catch( Exception& ) { @@ -544,10 +544,12 @@ static void DispatchURL( const Reference< XComponentContext >& xContext, const O aUrl.Complete = sURL; xURLTransformer->parseStrict( aUrl ); Sequence< PropertyValue > aArgs; - Reference< XDispatchProvider > xDispatchProvider( xFrame, UNO_QUERY_THROW ); - Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aUrl, OUString(), 0 ); // "_self" - if ( xDispatch.is() ) - xDispatch->dispatch( aUrl, aArgs ); + if (auto xDispatchProvider = xFrame.query<XDispatchProvider>() ) + { + Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aUrl, OUString(), 0 ); // "_self" + if ( xDispatch.is() ) + xDispatch->dispatch( aUrl, aArgs ); + } } catch( Exception& ) { |