summaryrefslogtreecommitdiff
path: root/sdext/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-08-17 15:42:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-08-18 11:03:02 +0200
commit7fc6063914432d58d86cfcbd728d967e7c86ebfd (patch)
treef71fe9f99edaa4e896c78cdf32e34b516194d748 /sdext/source
parentdb83c41d460103df5d80f5bd99816575c4ead5cd (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')
-rw-r--r--sdext/source/minimizer/impoptimizer.cxx18
-rw-r--r--sdext/source/minimizer/optimizationstats.cxx6
2 files changed, 13 insertions, 11 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& )
{
diff --git a/sdext/source/minimizer/optimizationstats.cxx b/sdext/source/minimizer/optimizationstats.cxx
index 1deef26ac059..ab958b5cf851 100644
--- a/sdext/source/minimizer/optimizationstats.cxx
+++ b/sdext/source/minimizer/optimizationstats.cxx
@@ -74,9 +74,9 @@ void OptimizationStats::InitializeStatusValuesFromDocument( const Reference< XMo
{
try
{
- Reference< XDrawPagesSupplier > xDrawPagesSupplier( rxModel, UNO_QUERY_THROW );
- Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
- SetStatusValue( TK_Pages, Any( awt::Size( 0, xDrawPages->getCount() ) ) );
+ if (auto xDrawPagesSupplier = rxModel.query<XDrawPagesSupplier>() )
+ if (auto xDrawPages = xDrawPagesSupplier->getDrawPages().query<XDrawPages>() )
+ SetStatusValue( TK_Pages, Any( awt::Size( 0, xDrawPages->getCount() ) ) );
}
catch ( Exception& )
{