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 /sc/source/filter/oox | |
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 'sc/source/filter/oox')
-rw-r--r-- | sc/source/filter/oox/numberformatsbuffer.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/oox/pivotcachebuffer.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/oox/pivottablebuffer.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheethelper.cxx | 9 |
4 files changed, 5 insertions, 28 deletions
diff --git a/sc/source/filter/oox/numberformatsbuffer.cxx b/sc/source/filter/oox/numberformatsbuffer.cxx index 447878000226..8aa9124d882b 100644 --- a/sc/source/filter/oox/numberformatsbuffer.cxx +++ b/sc/source/filter/oox/numberformatsbuffer.cxx @@ -1866,14 +1866,8 @@ private: NumberFormatFinalizer::NumberFormatFinalizer( const WorkbookHelper& rHelper ) : maEnUsLocale( "en", "US", OUString() ) { - try - { - Reference< XNumberFormatsSupplier > xNumFmtsSupp( rHelper.getDocument(), UNO_QUERY_THROW ); + if (auto xNumFmtsSupp = rHelper.getDocument().query<XNumberFormatsSupplier>() ) mxNumFmts = xNumFmtsSupp->getNumberFormats(); - } - catch( Exception& ) - { - } OSL_ENSURE( mxNumFmts.is(), "NumberFormatFinalizer::NumberFormatFinalizer - cannot get number formats" ); } diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx b/sc/source/filter/oox/pivotcachebuffer.cxx index cbbacc8a6123..e796cfe53da0 100644 --- a/sc/source/filter/oox/pivotcachebuffer.cxx +++ b/sc/source/filter/oox/pivotcachebuffer.cxx @@ -646,14 +646,8 @@ OUString PivotCacheField::createDateGroupField( const Reference< XDataPilotField default: OSL_FAIL( "PivotCacheField::convertRangeGrouping - unknown date/time interval" ); } - try - { - Reference< XDataPilotFieldGrouping > xDPGrouping( rxBaseDPField, UNO_QUERY_THROW ); + if (auto xDPGrouping = rxBaseDPField.query<XDataPilotFieldGrouping>() ) xDPGroupField = xDPGrouping->createDateGroup( aGroupInfo ); - } - catch( Exception& ) - { - } } Reference< XNamed > xFieldName( xDPGroupField, UNO_QUERY ); diff --git a/sc/source/filter/oox/pivottablebuffer.cxx b/sc/source/filter/oox/pivottablebuffer.cxx index 637637eb378c..08c0bc8a7dca 100644 --- a/sc/source/filter/oox/pivottablebuffer.cxx +++ b/sc/source/filter/oox/pivottablebuffer.cxx @@ -1409,14 +1409,8 @@ Reference< XDataPilotField > PivotTable::getDataPilotField( sal_Int32 nFieldIdx Reference< XDataPilotField > PivotTable::getDataLayoutField() const { Reference< XDataPilotField > xDPField; - try - { - Reference< XDataPilotDataLayoutFieldSupplier > xDPDataFieldSupp( mxDPDescriptor, UNO_QUERY_THROW ); + if (auto xDPDataFieldSupp = mxDPDescriptor.query<XDataPilotDataLayoutFieldSupplier>() ) xDPField = xDPDataFieldSupp->getDataLayoutField(); - } - catch( Exception& ) - { - } return xDPField; } diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 495cc0ff7828..34d393c08b3e 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -527,13 +527,8 @@ Reference< XCellRange > WorksheetGlobals::getRow( sal_Int32 nRow ) const Reference< XDrawPage > WorksheetGlobals::getDrawPage() const { Reference< XDrawPage > xDrawPage; - try - { - xDrawPage = Reference< XDrawPageSupplier >( mxSheet, UNO_QUERY_THROW )->getDrawPage(); - } - catch( Exception& ) - { - } + if (auto xSupplier = mxSheet.query<XDrawPageSupplier>()) + xDrawPage = xSupplier->getDrawPage(); return xDrawPage; } |