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 /xmloff | |
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 'xmloff')
-rw-r--r-- | xmloff/source/chart/SchXMLTableContext.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/core/XMLEmbeddedObjectImportContext.cxx | 14 |
2 files changed, 7 insertions, 15 deletions
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index b12f5886e69b..b13394b54fdb 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -765,9 +765,11 @@ void SchXMLTableHelper::applyTableToInternalDataProvider( { try { - Reference< beans::XPropertySet > xProps( xChartDoc, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue( "DisableDataTableDialog", uno::Any( true ) ); - xProps->setPropertyValue( "DisableComplexChartTypes", uno::Any( true ) ); + if (auto xProps = xChartDoc.query<beans::XPropertySet>() ) + { + xProps->setPropertyValue( "DisableDataTableDialog", uno::Any( true ) ); + xProps->setPropertyValue( "DisableComplexChartTypes", uno::Any( true ) ); + } } catch ( uno::Exception& ) { diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx index 980dd8e0572d..f55edf062e74 100644 --- a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx +++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx @@ -122,14 +122,8 @@ void XMLEmbeddedObjectImportContext::SetComponent( Reference< XComponent > const SvXMLImport *pFastHandler = dynamic_cast<SvXMLImport*>(xFilter.get()); mxFastHandler = pFastHandler; - try - { - Reference < XModifiable2 > xModifiable2( rComp, UNO_QUERY_THROW ); + if (auto xModifiable2 = rComp.query<XModifiable2>() ) xModifiable2->disableSetModified(); - } - catch( Exception& ) - { - } Reference < XImporter > xImporter( mxFastHandler, UNO_QUERY ); xImporter->setTargetDocument( rComp ); @@ -242,15 +236,11 @@ void XMLEmbeddedObjectImportContext::endFastElement(sal_Int32 nElement) mxFastHandler->endFastElement( nElement ); mxFastHandler->endDocument(); - try + if (auto xModifiable2 = xComp.query<XModifiable2>() ) { - Reference < XModifiable2 > xModifiable2( xComp, UNO_QUERY_THROW ); xModifiable2->enableSetModified(); xModifiable2->setModified( true ); // trigger new replacement image generation } - catch( Exception& ) - { - } } void XMLEmbeddedObjectImportContext::characters( const OUString& rChars ) |