diff options
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/doc/docxforms.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/layout/dumpfilter.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/ole/ndole.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/swg/SwXMLTextBlocks.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/swg/SwXMLTextBlocks1.cxx | 17 | ||||
-rw-r--r-- | sw/source/core/unocore/unochart.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8gr.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 19 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmoutputtypepage.cxx | 13 | ||||
-rw-r--r-- | sw/source/ui/vba/vbadocument.cxx | 14 | ||||
-rw-r--r-- | sw/source/ui/vba/vbarange.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 15 | ||||
-rw-r--r-- | sw/source/uibase/misc/glshell.cxx | 5 | ||||
-rw-r--r-- | sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx | 4 |
14 files changed, 82 insertions, 56 deletions
diff --git a/sw/source/core/doc/docxforms.cxx b/sw/source/core/doc/docxforms.cxx index 65dd7221ae7d..1924cddc56db 100644 --- a/sw/source/core/doc/docxforms.cxx +++ b/sw/source/core/doc/docxforms.cxx @@ -70,9 +70,10 @@ void SwDoc::initXForms( bool bCreateDefaultModel ) OUString sName(u"Model 1"_ustr); Reference<XModel2> xModel = xforms::Model::create( comphelper::getProcessComponentContext() ); xModel->setID( sName ); - Reference<XFormsUIHelper1>( xModel, uno::UNO_QUERY_THROW )->newInstance( - u"Instance 1"_ustr, - OUString(), true ); + Reference<XFormsUIHelper1> xHelper( xModel, uno::UNO_QUERY ); + if (!xHelper) + return; + xHelper->newInstance(u"Instance 1"_ustr, OUString(), true ); xModel->initialize(); mxXForms->insertByName( sName, Any( xModel ) ); OSL_ENSURE( mxXForms->hasElements(), "can't create XForms model" ); diff --git a/sw/source/core/layout/dumpfilter.cxx b/sw/source/core/layout/dumpfilter.cxx index f5dfc2d661ae..28b667b0a7b6 100644 --- a/sw/source/core/layout/dumpfilter.cxx +++ b/sw/source/core/layout/dumpfilter.cxx @@ -53,8 +53,9 @@ namespace try { uno::XInterface* pObj = static_cast<uno::XInterface*>(pContext); - uno::Reference< io::XOutputStream > xOut( pObj, uno::UNO_QUERY_THROW ); - xOut->closeOutput( ); + uno::Reference< io::XOutputStream > xOut( pObj, uno::UNO_QUERY ); + if (xOut) + xOut->closeOutput( ); } catch (const uno::Exception&) { diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index ea16a0aca80f..26dbd086f8c1 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -626,7 +626,9 @@ void SwOLENode::BreakFileLink_Impl() try { - uno::Reference< embed::XLinkageSupport > xLinkSupport( maOLEObj.GetOleRef(), uno::UNO_QUERY_THROW ); + uno::Reference< embed::XLinkageSupport > xLinkSupport( maOLEObj.GetOleRef(), uno::UNO_QUERY ); + if (!xLinkSupport) + return; xLinkSupport->breakLink( xStorage, maOLEObj.GetCurrentPersistName() ); DisconnectFileLink_Impl(); maLinkURL.clear(); diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index b9ec1e2b35fe..00e1d750d5b6 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -293,9 +293,12 @@ ErrCode SwXMLTextBlocks::StartPutBlock( const OUString& rShort, const OUString& { m_xRoot = m_xBlkRoot->openStorageElement( rPackageName, embed::ElementModes::READWRITE ); - uno::Reference< beans::XPropertySet > xRootProps( m_xRoot, uno::UNO_QUERY_THROW ); - OUString aMime( SotExchange::GetFormatMimeType( SotClipboardFormatId::STARWRITER_8 ) ); - xRootProps->setPropertyValue( u"MediaType"_ustr, uno::Any( aMime ) ); + uno::Reference< beans::XPropertySet > xRootProps( m_xRoot, uno::UNO_QUERY ); + if (xRootProps) + { + OUString aMime( SotExchange::GetFormatMimeType( SotClipboardFormatId::STARWRITER_8 ) ); + xRootProps->setPropertyValue( u"MediaType"_ustr, uno::Any( aMime ) ); + } } catch (const uno::Exception&) { diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index f5beebf6164d..3821138022ed 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -76,14 +76,17 @@ ErrCode SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) OUString sObjReplacements( u"ObjectReplacements"_ustr ); if ( m_xRoot->hasByName( sObjReplacements ) ) { - uno::Reference< document::XStorageBasedDocument > xDocStor( m_xDoc->GetDocShell()->GetModel(), uno::UNO_QUERY_THROW ); - uno::Reference< embed::XStorage > xStr( xDocStor->getDocumentStorage() ); - if ( xStr.is() ) + uno::Reference< document::XStorageBasedDocument > xDocStor( m_xDoc->GetDocShell()->GetModel(), uno::UNO_QUERY ); + if (xDocStor) { - m_xRoot->copyElementTo( sObjReplacements, xStr, sObjReplacements ); - uno::Reference< embed::XTransactedObject > xTrans( xStr, uno::UNO_QUERY ); - if ( xTrans.is() ) - xTrans->commit(); + uno::Reference< embed::XStorage > xStr( xDocStor->getDocumentStorage() ); + if ( xStr.is() ) + { + m_xRoot->copyElementTo( sObjReplacements, xStr, sObjReplacements ); + uno::Reference< embed::XTransactedObject > xTrans( xStr, uno::UNO_QUERY ); + if ( xTrans.is() ) + xTrans->commit(); + } } } } diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 5872b607f753..996f96cfcc63 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -71,8 +71,9 @@ void SwChartHelper::DoUpdateAllCharts( SwDoc* pDoc ) { try { - uno::Reference< util::XModifiable > xModif( xIP->getComponent(), uno::UNO_QUERY_THROW ); - xModif->setModified( true ); + uno::Reference< util::XModifiable > xModif( xIP->getComponent(), uno::UNO_QUERY ); + if (xModif) + xModif->setModified( true ); } catch ( uno::Exception& ) { diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index f8f4c813cd6f..721cd574be08 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -151,14 +151,14 @@ bool WW8Export::TestOleNeedsGraphic(const SwAttrSet& rSet, rtl::Reference<SotSto comphelper::EmbeddedObjectContainer aCnt( m_rDoc.GetDocStorage() ); try { - uno::Reference< embed::XEmbedPersist > xPersist( - xObj, - uno::UNO_QUERY_THROW ); - - // it makes no sense to search the object in the container by reference since the object was created - // outside of the container and was not inserted there, only the name makes sense - pGraphicStream = - ::utl::UcbStreamHelper::CreateStream( aCnt.GetGraphicStream( xPersist->getEntryName() ) ); + uno::Reference< embed::XEmbedPersist > xPersist(xObj, uno::UNO_QUERY ); + if (xPersist) + { + // it makes no sense to search the object in the container by reference since the object was created + // outside of the container and was not inserted there, only the name makes sense + pGraphicStream = + ::utl::UcbStreamHelper::CreateStream( aCnt.GetGraphicStream( xPersist->getEntryName() ) ); + } } catch( const uno::Exception& ) {} diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 9812199f1d64..ef09c6e08006 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -398,17 +398,18 @@ OUString BasicProjImportHelper::getProjectName() const { OUString sProjName( u"Standard"_ustr ); uno::Reference< beans::XPropertySet > xProps( mrDocShell.GetModel(), uno::UNO_QUERY ); - if ( xProps.is() ) + if ( !xProps ) + return sProjName; + try { - try - { - uno::Reference< script::vba::XVBACompatibility > xVBA( xProps->getPropertyValue( u"BasicLibraries"_ustr ), uno::UNO_QUERY_THROW ); - sProjName = xVBA->getProjectName(); + uno::Reference< script::vba::XVBACompatibility > xVBA( xProps->getPropertyValue( u"BasicLibraries"_ustr ), uno::UNO_QUERY ); + if ( !xVBA ) + return sProjName; + sProjName = xVBA->getProjectName(); - } - catch( const uno::Exception& ) - { - } + } + catch( const uno::Exception& ) + { } return sProjName; } diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index 33033f0a94ce..27430ce63c60 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -173,11 +173,14 @@ void SwMailDispatcherListener_Impl::DeleteAttachments( uno::Reference< mail::XMa { try { - uno::Reference< beans::XPropertySet > xTransferableProperties( rAttachment.Data, uno::UNO_QUERY_THROW); - OUString sURL; - xTransferableProperties->getPropertyValue(u"URL"_ustr) >>= sURL; - if(!sURL.isEmpty()) - SWUnoHelper::UCB_DeleteFile( sURL ); + uno::Reference< beans::XPropertySet > xTransferableProperties( rAttachment.Data, uno::UNO_QUERY); + if (xTransferableProperties) + { + OUString sURL; + xTransferableProperties->getPropertyValue(u"URL"_ustr) >>= sURL; + if(!sURL.isEmpty()) + SWUnoHelper::UCB_DeleteFile( sURL ); + } } catch (const uno::Exception&) { diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx index 2588c153788a..c7a110d016ef 100644 --- a/sw/source/ui/vba/vbadocument.cxx +++ b/sw/source/ui/vba/vbadocument.cxx @@ -692,13 +692,19 @@ SwVbaDocument::getFormControls() const uno::Reference< container::XNameAccess > xFormControls; try { - uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY_THROW ); - uno::Reference< form::XFormsSupplier > xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); - uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY_THROW ); + uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY ); + if (!xDrawPageSupplier) + return xFormControls; + uno::Reference< form::XFormsSupplier > xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY ); + if (!xFormSupplier) + return xFormControls; + uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY ); + if (!xIndexAccess) + return xFormControls; // get the www-standard container ( maybe we should access the // 'www-standard' by name rather than index, this seems an // implementation detail - xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW ); + xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY ); } catch(const uno::Exception&) { diff --git a/sw/source/ui/vba/vbarange.cxx b/sw/source/ui/vba/vbarange.cxx index 39d369c92144..722dcfce92b1 100644 --- a/sw/source/ui/vba/vbarange.cxx +++ b/sw/source/ui/vba/vbarange.cxx @@ -134,8 +134,9 @@ SwVbaRange::setText( const OUString& rText ) uno::Reference< text::XTextContent > xBookmark = SwVbaRangeHelper::findBookmarkByPosition( mxTextDocument, xRange->getStart() ); if( xBookmark.is() ) { - uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW ); - sName = xNamed->getName(); + uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY ); + if (xNamed) + sName = xNamed->getName(); } } catch (const uno::Exception&) diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 51e7cc4c259a..fd1b7bd1f6db 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1887,13 +1887,14 @@ uno::Reference< sdbc::XConnection> SwDBManager::GetConnection(const OUString& rD try { uno::Reference<sdb::XCompletedConnection> xComplConnection(dbtools::getDataSource(rDataSource, xContext), uno::UNO_QUERY); - if ( xComplConnection.is() ) - { - rxSource.set(xComplConnection, uno::UNO_QUERY); - weld::Window* pWindow = pView ? pView->GetFrameWeld() : nullptr; - uno::Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createWithParent(xContext, pWindow ? pWindow->GetXWindow() : nullptr), uno::UNO_QUERY_THROW ); - xConnection = xComplConnection->connectWithCompletion( xHandler ); - } + if ( !xComplConnection ) + return xConnection; + rxSource.set(xComplConnection, uno::UNO_QUERY); + weld::Window* pWindow = pView ? pView->GetFrameWeld() : nullptr; + uno::Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createWithParent(xContext, pWindow ? pWindow->GetXWindow() : nullptr) ); + if (!xHandler) + return xConnection; + xConnection = xComplConnection->connectWithCompletion( xHandler ); } catch(const uno::Exception&) { diff --git a/sw/source/uibase/misc/glshell.cxx b/sw/source/uibase/misc/glshell.cxx index b15be1f8f833..fcd31ec39ea8 100644 --- a/sw/source/uibase/misc/glshell.cxx +++ b/sw/source/uibase/misc/glshell.cxx @@ -252,8 +252,9 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const OUString& rGroup, const OUString try { // set the UI-title - uno::Reference< frame::XTitle > xTitle( xDocSh->GetModel(), uno::UNO_QUERY_THROW ); - xTitle->setTitle( aDocTitle ); + uno::Reference< frame::XTitle > xTitle( xDocSh->GetModel(), uno::UNO_QUERY ); + if (xTitle) + xTitle->setTitle( aDocTitle ); } catch (const uno::Exception&) { diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx index 8f871c2a19df..9dde50e56336 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -5755,7 +5755,9 @@ void DomainMapper_Impl::SetNumberFormat( const OUString& rCommand, try { sal_Int32 nKey = 0; - uno::Reference< util::XNumberFormatsSupplier > xNumberSupplier( static_cast<cppu::OWeakObject*>(m_xTextDocument.get()), uno::UNO_QUERY_THROW ); + uno::Reference< util::XNumberFormatsSupplier > xNumberSupplier( static_cast<cppu::OWeakObject*>(m_xTextDocument.get()), uno::UNO_QUERY ); + if (!xNumberSupplier) + return; if( bDetectFormat ) { uno::Reference< util::XNumberFormatter> xFormatter(util::NumberFormatter::create(m_xComponentContext), uno::UNO_QUERY_THROW); |