diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index f5cdb65cde58..f48b61240543 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -895,9 +895,15 @@ bool SvtLinguConfig::GetElementNamesFor( bool bSuccess = false; try { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY ); + if (!xNA) + return false; + xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY ); + if (!xNA) + return false; + xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY ); + if (!xNA) + return false; rElementNames = xNA->getElementNames(); bSuccess = true; } @@ -917,10 +923,18 @@ bool SvtLinguConfig::GetSupportedDictionaryFormatsFor( bool bSuccess = false; try { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY ); + if (!xNA) + return false; + xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY ); + if (!xNA) + return false; + xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY ); + if (!xNA) + return false; + xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY ); + if (!xNA) + return false; if (xNA->getByName( u"SupportedDictionaryFormats"_ustr ) >>= rFormatList) bSuccess = true; DBG_ASSERT( rFormatList.hasElements(), "supported dictionary format list is empty" ); @@ -938,10 +952,18 @@ bool SvtLinguConfig::GetLocaleListFor( const OUString &rSetName, const OUString bool bSuccess = false; try { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY ); + if (!xNA) + return false; + xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY ); + if (!xNA) + return false; + xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY ); + if (!xNA) + return false; + xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY ); + if (!xNA) + return false; if (xNA->getByName( u"Locales"_ustr ) >>= rLocaleList) bSuccess = true; DBG_ASSERT( rLocaleList.hasElements(), "Locale list is empty" ); @@ -1027,8 +1049,12 @@ uno::Sequence< OUString > SvtLinguConfig::GetDisabledDictionaries() const uno::Sequence< OUString > aResult; try { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY ); + if (!xNA) + return aResult; + xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY ); + if (!xNA) + return aResult; xNA->getByName( u"DisabledDictionaries"_ustr ) >>= aResult; } catch (uno::Exception &) @@ -1084,28 +1110,27 @@ std::vector< SvtLinguConfigDictionaryEntry > SvtLinguConfig::GetActiveDictionari uno::Reference< util::XChangesBatch > const & SvtLinguConfig::GetMainUpdateAccess() const { - if (!m_xMainUpdateAccess.is()) + if (m_xMainUpdateAccess) + return m_xMainUpdateAccess; + try { - try - { - // get configuration provider - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider = - configuration::theDefaultProvider::get( xContext ); + // get configuration provider + uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider = + configuration::theDefaultProvider::get( xContext ); - // get configuration update access - beans::PropertyValue aValue; - aValue.Name = "nodepath"; - aValue.Value <<= u"org.openoffice.Office.Linguistic"_ustr; - uno::Sequence< uno::Any > aProps{ uno::Any(aValue) }; - m_xMainUpdateAccess.set( - xConfigurationProvider->createInstanceWithArguments( - u"com.sun.star.configuration.ConfigurationUpdateAccess"_ustr, aProps), - uno::UNO_QUERY_THROW ); - } - catch (uno::Exception &) - { - } + // get configuration update access + beans::PropertyValue aValue; + aValue.Name = "nodepath"; + aValue.Value <<= u"org.openoffice.Office.Linguistic"_ustr; + uno::Sequence< uno::Any > aProps{ uno::Any(aValue) }; + m_xMainUpdateAccess.set( + xConfigurationProvider->createInstanceWithArguments( + u"com.sun.star.configuration.ConfigurationUpdateAccess"_ustr, aProps), + uno::UNO_QUERY ); + } + catch (uno::Exception &) + { } return m_xMainUpdateAccess; @@ -1186,9 +1211,15 @@ bool SvtLinguConfig::HasGrammarChecker() const try { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName(u"GrammarCheckerList"_ustr), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY ); + if (!xNA) + return false; + xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY ); + if (!xNA) + return false; + xNA.set( xNA->getByName(u"GrammarCheckerList"_ustr), uno::UNO_QUERY ); + if (!xNA) + return false; uno::Sequence< OUString > aElementNames( xNA->getElementNames() ); bRes = aElementNames.hasElements(); diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx index 7ea5a3fd415f..3ce4665289bf 100644 --- a/unotools/source/config/useroptions.cxx +++ b/unotools/source/config/useroptions.cxx @@ -121,8 +121,9 @@ void SvtUserOptions::ChangeListener::disposing (lang::EventObject const& rSource { try { - uno::Reference xChgNot(rSource.Source, uno::UNO_QUERY_THROW); - xChgNot->removeChangesListener(this); + uno::Reference xChgNot(rSource.Source, uno::UNO_QUERY); + if (xChgNot) + xChgNot->removeChangesListener(this); } catch (uno::Exception&) { diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index 3b7976cf574c..c144babe5512 100644 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -301,21 +301,24 @@ ScVbaControl::getControlSource() // dependent parts OUString sControlSource; uno::Reference< form::binding::XBindableValue > xBindable( m_xProps, uno::UNO_QUERY ); - if ( xBindable.is() ) + if ( !xBindable ) + return sControlSource; + try + { + uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); + if ( !xFac ) + return sControlSource; + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( u"com.sun.star.table.CellAddressConversion"_ustr ), uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xProps( xBindable->getValueBinding(), uno::UNO_QUERY); + if ( !xProps ) + return sControlSource; + table::CellAddress aAddress; + xProps->getPropertyValue( u"BoundCell"_ustr ) >>= aAddress; + xConvertor->setPropertyValue( u"Address"_ustr , uno::Any( aAddress ) ); + xConvertor->getPropertyValue( u"XLA1Representation"_ustr ) >>= sControlSource; + } + catch(const uno::Exception&) { - try - { - uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( u"com.sun.star.table.CellAddressConversion"_ustr ), uno::UNO_QUERY ); - uno::Reference< beans::XPropertySet > xProps( xBindable->getValueBinding(), uno::UNO_QUERY_THROW ); - table::CellAddress aAddress; - xProps->getPropertyValue( u"BoundCell"_ustr ) >>= aAddress; - xConvertor->setPropertyValue( u"Address"_ustr , uno::Any( aAddress ) ); - xConvertor->getPropertyValue( u"XLA1Representation"_ustr ) >>= sControlSource; - } - catch(const uno::Exception&) - { - } } return sControlSource; } @@ -364,22 +367,25 @@ ScVbaControl::getRowSource() { OUString sRowSource; uno::Reference< form::binding::XListEntrySink > xListSink( m_xProps, uno::UNO_QUERY ); - if ( xListSink.is() ) + if ( !xListSink ) + return sRowSource; + try { - try - { - uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( u"com.sun.star.table.CellRangeAddressConversion"_ustr ), uno::UNO_QUERY ); + uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY ); + if ( !xFac ) + return sRowSource; + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( u"com.sun.star.table.CellRangeAddressConversion"_ustr ), uno::UNO_QUERY ); - uno::Reference< beans::XPropertySet > xProps( xListSink->getListEntrySource(), uno::UNO_QUERY_THROW ); - table::CellRangeAddress aAddress; - xProps->getPropertyValue( u"CellRange"_ustr ) >>= aAddress; - xConvertor->setPropertyValue( u"Address"_ustr , uno::Any( aAddress ) ); - xConvertor->getPropertyValue( u"XLA1Representation"_ustr ) >>= sRowSource; - } - catch(const uno::Exception&) - { - } + uno::Reference< beans::XPropertySet > xProps( xListSink->getListEntrySource(), uno::UNO_QUERY ); + if ( !xProps ) + return sRowSource; + table::CellRangeAddress aAddress; + xProps->getPropertyValue( u"CellRange"_ustr ) >>= aAddress; + xConvertor->setPropertyValue( u"Address"_ustr , uno::Any( aAddress ) ); + xConvertor->getPropertyValue( u"XLA1Representation"_ustr ) >>= sRowSource; + } + catch(const uno::Exception&) + { } return sRowSource; } diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx index 663a51d7cf8f..8f99b6f39bec 100644 --- a/vbahelper/source/msforms/vbauserform.cxx +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -90,10 +90,13 @@ ScVbaUserForm::Show( ) try { - uno::Reference< lang::XComponent > xComp( m_xDialog, uno::UNO_QUERY_THROW ); - m_xDialog = nullptr; - xComp->dispose(); - mbDispose = false; + uno::Reference< lang::XComponent > xComp( m_xDialog, uno::UNO_QUERY ); + if (xComp) + { + m_xDialog = nullptr; + xComp->dispose(); + mbDispose = false; + } } catch( uno::Exception& ) { diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index 80cd896cb44d..ff9ef8c1bc72 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -141,32 +141,35 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, xModifiable->setModified( false ); // first try to close the document using UI dispatch functionality - bool bUIClose = false; try { - uno::Reference< frame::XController > xController( getModel()->getCurrentController(), uno::UNO_SET_THROW ); - uno::Reference< frame::XDispatchProvider > xDispatchProvider( xController->getFrame(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XController > xController( getModel()->getCurrentController() ); + if (xController) + { + uno::Reference< frame::XDispatchProvider > xDispatchProvider( xController->getFrame(), uno::UNO_QUERY ); + uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager() ); + if (xDispatchProvider && xServiceManager) + { + uno::Reference< util::XURLTransformer > xURLTransformer( util::URLTransformer::create(mxContext) ); - uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW ); - uno::Reference< util::XURLTransformer > xURLTransformer( util::URLTransformer::create(mxContext) ); + util::URL aURL; + aURL.Complete = ".uno:CloseDoc"; + xURLTransformer->parseStrict( aURL ); - util::URL aURL; - aURL.Complete = ".uno:CloseDoc"; - xURLTransformer->parseStrict( aURL ); - - uno::Reference< css::frame::XDispatch > xDispatch( - xDispatchProvider->queryDispatch( aURL, u"_self"_ustr , 0 ), - uno::UNO_SET_THROW ); - xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() ); - bUIClose = true; + uno::Reference< css::frame::XDispatch > xDispatch( + xDispatchProvider->queryDispatch( aURL, u"_self"_ustr , 0 ) ); + if (xDispatch) + { + xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() ); + return; + } + } + } } catch(const uno::Exception&) { } - if ( bUIClose ) - return; - // if it is not possible to use UI dispatch, try to close the model directly bool bCloseable = false; uno::Reference< frame::XModel > xModel = getModel(); @@ -196,8 +199,8 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, // If close is not supported by this model - try to dispose it. // But if the model disagree with a reset request for the modify state // we shouldn't do so. Otherwise some strange things can happen. - uno::Reference< lang::XComponent > xDisposable ( xModel, uno::UNO_QUERY_THROW ); - xDisposable->dispose(); + if (xModel) + xModel->dispose(); } catch(const uno::Exception&) { @@ -277,13 +280,20 @@ VbaDocumentBase::getVBProject() { if( !mxVBProject.is() ) try { - uno::Reference< XApplicationBase > xApp( Application(), uno::UNO_QUERY_THROW ); - uno::Reference< XInterface > xVBE( xApp->getVBE(), uno::UNO_QUERY_THROW ); - uno::Sequence< uno::Any > aArgs{ uno::Any(xVBE), // the VBE - uno::Any(getModel()) }; // document model for script container access - uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW ); - mxVBProject = xServiceManager->createInstanceWithArgumentsAndContext( - u"ooo.vba.vbide.VBProject"_ustr, aArgs, mxContext ); + uno::Reference< XApplicationBase > xApp( Application(), uno::UNO_QUERY ); + if (xApp) + { + uno::Reference< XInterface > xVBE( xApp->getVBE(), uno::UNO_QUERY ); + if (xVBE) + { + uno::Sequence< uno::Any > aArgs{ uno::Any(xVBE), // the VBE + uno::Any(getModel()) }; // document model for script container access + uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager() ); + if (xServiceManager) + mxVBProject = xServiceManager->createInstanceWithArgumentsAndContext( + u"ooo.vba.vbide.VBProject"_ustr, aArgs, mxContext ); + } + } } catch(const uno::Exception&) { diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index 4821fc5c1c09..ec7694c59294 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -206,12 +206,23 @@ void lclSetupComponent( const uno::Reference< lang::XComponent >& rxComponent, b { } - if( !bInteractive ) try + if( bInteractive ) + return; + try { - uno::Reference< frame::XModel > xModel( rxComponent, uno::UNO_QUERY_THROW ); - uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); - uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_SET_THROW ); - uno::Reference< awt::XWindow >( xFrame->getContainerWindow(), uno::UNO_SET_THROW )->setEnable( false ); + uno::Reference< frame::XModel > xModel( rxComponent, uno::UNO_QUERY ); + if (!xModel) + return; + uno::Reference< frame::XController > xController( xModel->getCurrentController() ); + if (!xController) + return; + uno::Reference< frame::XFrame > xFrame( xController->getFrame() ); + if (!xFrame) + return; + uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow() ); + if (!xWindow) + return; + xWindow->setEnable( false ); } catch( uno::Exception& ) { diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index d8d2818d4fb9..99494d8cc7e1 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -1078,7 +1078,9 @@ uno::Reference< XHelperInterface > getVBADocument( const uno::Reference< frame:: uno::Reference< XHelperInterface > xIf; try { - uno::Reference< beans::XPropertySet > xDocProps( xModel, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xDocProps( xModel, uno::UNO_QUERY ); + if (!xDocProps) + return xIf; OUString aCodeName; xDocProps->getPropertyValue( u"CodeName"_ustr ) >>= aCodeName; xIf = getUnoDocModule( aCodeName, getSfxObjShell( xModel ) ); diff --git a/writerperfect/qa/unit/WpftLoader.cxx b/writerperfect/qa/unit/WpftLoader.cxx index bbacb128e19d..7d75033098d9 100644 --- a/writerperfect/qa/unit/WpftLoader.cxx +++ b/writerperfect/qa/unit/WpftLoader.cxx @@ -142,7 +142,9 @@ bool WpftLoader::impl_load() } const uno::Reference xDetector(m_xFilter, - uno::UNO_QUERY_THROW); + uno::UNO_QUERY); + if (!xDetector) + return false; const OUString aTypeName(xDetector->detect(aDescriptor)); if (aTypeName.isEmpty()) diff --git a/writerperfect/source/common/DirectoryStream.cxx b/writerperfect/source/common/DirectoryStream.cxx index 9238a4f3ab51..79b7aeadb680 100644 --- a/writerperfect/source/common/DirectoryStream.cxx +++ b/writerperfect/source/common/DirectoryStream.cxx @@ -59,25 +59,28 @@ uno::Reference findStream(ucbhelper::Content& rContent, std::u { const uno::Reference xResultSet( rContent.createCursor(lPropNames, ucbhelper::INCLUDE_DOCUMENTS_ONLY)); - if (xResultSet->first()) + if (!xResultSet->first()) + return xInputStream; + + const uno::Reference xContentAccess(xResultSet, uno::UNO_QUERY); + if (!xContentAccess) + return xInputStream; + const uno::Reference xRow(xResultSet, uno::UNO_QUERY); + if (!xRow) + return xInputStream; + do { - const uno::Reference xContentAccess(xResultSet, - uno::UNO_QUERY_THROW); - const uno::Reference xRow(xResultSet, uno::UNO_QUERY_THROW); - do + const OUString aTitle(xRow->getString(1)); + if (aTitle == rName) { - const OUString aTitle(xRow->getString(1)); - if (aTitle == rName) - { - const uno::Reference xSubContent(xContentAccess->queryContent()); - ucbhelper::Content aSubContent(xSubContent, - uno::Reference(), - comphelper::getProcessComponentContext()); - xInputStream = aSubContent.openStream(); - break; - } - } while (xResultSet->next()); - } + const uno::Reference xSubContent(xContentAccess->queryContent()); + ucbhelper::Content aSubContent(xSubContent, + uno::Reference(), + comphelper::getProcessComponentContext()); + xInputStream = aSubContent.openStream(); + break; + } + } while (xResultSet->next()); } catch (const uno::RuntimeException&) { diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index a43acba44cc6..a22c94a8b3e5 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -369,7 +369,9 @@ Reference ZipStorageImpl::createStream(const OUString& rPath) try { - const Reference xInputStream(mxContainer->getByName(rPath), UNO_QUERY_THROW); + const Reference xInputStream(mxContainer->getByName(rPath), UNO_QUERY); + if (!xInputStream) + return xStream; const Reference xSeekable(xInputStream, UNO_QUERY); if (xSeekable.is()) diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index ec24fef1ebb0..ebdf3bf1ca2f 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -1640,8 +1640,9 @@ void SchXMLExportHelper_Impl::exportTable() try { bool bProtected = false; - Reference< beans::XPropertySet > xProps( mrExport.GetModel(), uno::UNO_QUERY_THROW ); - if ( ( xProps->getPropertyValue(u"DisableDataTableDialog"_ustr) >>= bProtected ) && + Reference< beans::XPropertySet > xProps( mrExport.GetModel(), uno::UNO_QUERY ); + if ( xProps && + ( xProps->getPropertyValue(u"DisableDataTableDialog"_ustr) >>= bProtected ) && bProtected ) { mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE ); diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index 8a40e1e53997..ecff70a1bc0d 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -762,9 +762,12 @@ void SchXMLTableHelper::applyTableToInternalDataProvider( { try { - Reference< beans::XPropertySet > xProps( xChartDoc, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue( u"DisableDataTableDialog"_ustr, uno::Any( true ) ); - xProps->setPropertyValue( u"DisableComplexChartTypes"_ustr, uno::Any( true ) ); + Reference< beans::XPropertySet > xProps( xChartDoc, uno::UNO_QUERY ); + if (xProps) + { + xProps->setPropertyValue( u"DisableDataTableDialog"_ustr, uno::Any( true ) ); + xProps->setPropertyValue( u"DisableComplexChartTypes"_ustr, uno::Any( true ) ); + } } catch ( uno::Exception& ) { diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx index 91b9ee234954..25b0522ab28f 100644 --- a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx +++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx @@ -123,8 +123,9 @@ void XMLEmbeddedObjectImportContext::SetComponent( Reference< XComponent > const try { - Reference < XModifiable2 > xModifiable2( rComp, UNO_QUERY_THROW ); - xModifiable2->disableSetModified(); + Reference < XModifiable2 > xModifiable2( rComp, UNO_QUERY ); + if (xModifiable2) + xModifiable2->disableSetModified(); } catch( Exception& ) { @@ -243,9 +244,12 @@ void XMLEmbeddedObjectImportContext::endFastElement(sal_Int32 nElement) try { - Reference < XModifiable2 > xModifiable2( xComp, UNO_QUERY_THROW ); - xModifiable2->enableSetModified(); - xModifiable2->setModified( true ); // trigger new replacement image generation + Reference < XModifiable2 > xModifiable2( xComp, UNO_QUERY ); + if (xModifiable2) + { + xModifiable2->enableSetModified(); + xModifiable2->setModified( true ); // trigger new replacement image generation + } } catch( Exception& ) { diff --git a/xmloff/source/draw/descriptionimp.cxx b/xmloff/source/draw/descriptionimp.cxx index 0e9990fbac06..ed735125c9b7 100644 --- a/xmloff/source/draw/descriptionimp.cxx +++ b/xmloff/source/draw/descriptionimp.cxx @@ -46,7 +46,9 @@ void SdXMLDescriptionContext::endFastElement(sal_Int32 ) try { - uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY_THROW); + uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); + if (!xPropSet) + return; if( (mnElement & TOKEN_MASK) == XML_TITLE) { xPropSet->setPropertyValue(u"Title"_ustr, Any(msText));