sw/source/writerfilter/dmapper/DomainMapper.cxx | 4 ++-- sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx | 8 ++++++-- sw/source/writerfilter/dmapper/ModelEventListener.cxx | 5 +++-- sw/source/writerfilter/dmapper/PropertyMap.cxx | 7 ++++--- 4 files changed, 15 insertions(+), 9 deletions(-)
New commits: commit 4b833e6b121b6ed653e19daa9d2bf0e1899f375b Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Aug 13 08:51:35 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Aug 13 10:20:56 2024 +0200 use less exception throwing for flow control Change-Id: Ib125a5ab01891d4195544e489596c10e16fba3ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171808 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx b/sw/source/writerfilter/dmapper/DomainMapper.cxx index 23ce1fc4553b..16075184cb45 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx @@ -199,8 +199,8 @@ DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xCon u"com.sun.star.document.OOXMLDocumentPropertiesImporter"_ustr, xContext); - uno::Reference< document::XOOXMLDocumentPropertiesImporter > xImporter( xTemp, uno::UNO_QUERY_THROW ); - if (xModel) + uno::Reference< document::XOOXMLDocumentPropertiesImporter > xImporter( xTemp, uno::UNO_QUERY); + if (xImporter && xModel) xImporter->importProperties(m_pImpl->m_xDocumentStorage, xModel->getDocumentProperties()); } diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx index a24e13449966..74465d781ec2 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -779,8 +779,12 @@ static void reanchorObjects(const uno::Reference<uno::XInterface>& xFrom, try { uno::Reference<text::XTextContent> xShape(xDrawPage->getByIndex(i), - uno::UNO_QUERY_THROW); - uno::Reference<text::XTextRange> xAnchor(xShape->getAnchor(), uno::UNO_SET_THROW); + uno::UNO_QUERY); + if (!xShape) + continue; + uno::Reference<text::XTextRange> xAnchor(xShape->getAnchor()); + if (!xAnchor) + continue; if (xCompare->compareRegionStarts(xAnchor, xRange) <= 0 && xCompare->compareRegionEnds(xAnchor, xRange) >= 0) { diff --git a/sw/source/writerfilter/dmapper/ModelEventListener.cxx b/sw/source/writerfilter/dmapper/ModelEventListener.cxx index 4df26105a37c..f097220ba760 100644 --- a/sw/source/writerfilter/dmapper/ModelEventListener.cxx +++ b/sw/source/writerfilter/dmapper/ModelEventListener.cxx @@ -104,8 +104,9 @@ void ModelEventListener::disposing( const lang::EventObject& rEvent ) { try { - uno::Reference<document::XEventBroadcaster>(rEvent.Source, uno::UNO_QUERY_THROW )->removeEventListener( - uno::Reference<document::XEventListener>(this)); + auto xBroadcaster = uno::Reference<document::XEventBroadcaster>(rEvent.Source, uno::UNO_QUERY ); + if (xBroadcaster) + xBroadcaster->removeEventListener(uno::Reference<document::XEventListener>(this)); } catch( const uno::Exception& ) { diff --git a/sw/source/writerfilter/dmapper/PropertyMap.cxx b/sw/source/writerfilter/dmapper/PropertyMap.cxx index 64f7aa20fd62..eed8ec26284d 100644 --- a/sw/source/writerfilter/dmapper/PropertyMap.cxx +++ b/sw/source/writerfilter/dmapper/PropertyMap.cxx @@ -1740,14 +1740,15 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) uno::Reference< beans::XPropertySet > xRangeProperties; if ( m_xStartingRange.is() ) { - xRangeProperties.set( m_xStartingRange, uno::UNO_QUERY_THROW ); + xRangeProperties.set( m_xStartingRange, uno::UNO_QUERY ); } else { //set the start value at the beginning of the document - xRangeProperties.set( rDM_Impl.GetTextDocument()->getText()->getStart(), uno::UNO_QUERY_THROW ); + xRangeProperties.set( rDM_Impl.GetTextDocument()->getText()->getStart(), uno::UNO_QUERY ); } - xRangeProperties->setPropertyValue( getPropertyName( PROP_BREAK_TYPE ), uno::Any( style::BreakType_COLUMN_BEFORE ) ); + if (xRangeProperties) + xRangeProperties->setPropertyValue( getPropertyName( PROP_BREAK_TYPE ), uno::Any( style::BreakType_COLUMN_BEFORE ) ); } catch ( const uno::Exception& ) {} }