use less exception throwing for flow control

Change-Id: I7ad023479229f89918e588eb8dc7431b5830b45d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171813
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2024-08-13 11:35:17 +02:00
parent cd72aca086
commit ade52eb721
14 changed files with 213 additions and 132 deletions

View File

@ -895,9 +895,15 @@ bool SvtLinguConfig::GetElementNamesFor(
bool bSuccess = false; bool bSuccess = false;
try try
{ {
uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY );
xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY_THROW ); if (!xNA)
xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW ); 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(); rElementNames = xNA->getElementNames();
bSuccess = true; bSuccess = true;
} }
@ -917,10 +923,18 @@ bool SvtLinguConfig::GetSupportedDictionaryFormatsFor(
bool bSuccess = false; bool bSuccess = false;
try try
{ {
uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY );
xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY_THROW ); if (!xNA)
xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW ); return false;
xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW ); 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) if (xNA->getByName( u"SupportedDictionaryFormats"_ustr ) >>= rFormatList)
bSuccess = true; bSuccess = true;
DBG_ASSERT( rFormatList.hasElements(), "supported dictionary format list is empty" ); 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; bool bSuccess = false;
try try
{ {
uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY );
xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY_THROW ); if (!xNA)
xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW ); return false;
xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW ); 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) if (xNA->getByName( u"Locales"_ustr ) >>= rLocaleList)
bSuccess = true; bSuccess = true;
DBG_ASSERT( rLocaleList.hasElements(), "Locale list is empty" ); DBG_ASSERT( rLocaleList.hasElements(), "Locale list is empty" );
@ -1027,8 +1049,12 @@ uno::Sequence< OUString > SvtLinguConfig::GetDisabledDictionaries() const
uno::Sequence< OUString > aResult; uno::Sequence< OUString > aResult;
try try
{ {
uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY );
xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY_THROW ); if (!xNA)
return aResult;
xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY );
if (!xNA)
return aResult;
xNA->getByName( u"DisabledDictionaries"_ustr ) >>= aResult; xNA->getByName( u"DisabledDictionaries"_ustr ) >>= aResult;
} }
catch (uno::Exception &) catch (uno::Exception &)
@ -1084,28 +1110,27 @@ std::vector< SvtLinguConfigDictionaryEntry > SvtLinguConfig::GetActiveDictionari
uno::Reference< util::XChangesBatch > const & SvtLinguConfig::GetMainUpdateAccess() const 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();
// get configuration provider uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider =
uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); configuration::theDefaultProvider::get( xContext );
uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider =
configuration::theDefaultProvider::get( xContext );
// get configuration update access // get configuration update access
beans::PropertyValue aValue; beans::PropertyValue aValue;
aValue.Name = "nodepath"; aValue.Name = "nodepath";
aValue.Value <<= u"org.openoffice.Office.Linguistic"_ustr; aValue.Value <<= u"org.openoffice.Office.Linguistic"_ustr;
uno::Sequence< uno::Any > aProps{ uno::Any(aValue) }; uno::Sequence< uno::Any > aProps{ uno::Any(aValue) };
m_xMainUpdateAccess.set( m_xMainUpdateAccess.set(
xConfigurationProvider->createInstanceWithArguments( xConfigurationProvider->createInstanceWithArguments(
u"com.sun.star.configuration.ConfigurationUpdateAccess"_ustr, aProps), u"com.sun.star.configuration.ConfigurationUpdateAccess"_ustr, aProps),
uno::UNO_QUERY_THROW ); uno::UNO_QUERY );
} }
catch (uno::Exception &) catch (uno::Exception &)
{ {
}
} }
return m_xMainUpdateAccess; return m_xMainUpdateAccess;
@ -1186,9 +1211,15 @@ bool SvtLinguConfig::HasGrammarChecker() const
try try
{ {
uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY );
xNA.set( xNA->getByName(u"ServiceManager"_ustr), uno::UNO_QUERY_THROW ); if (!xNA)
xNA.set( xNA->getByName(u"GrammarCheckerList"_ustr), uno::UNO_QUERY_THROW ); 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() ); uno::Sequence< OUString > aElementNames( xNA->getElementNames() );
bRes = aElementNames.hasElements(); bRes = aElementNames.hasElements();

View File

@ -121,8 +121,9 @@ void SvtUserOptions::ChangeListener::disposing (lang::EventObject const& rSource
{ {
try try
{ {
uno::Reference<util::XChangesNotifier> xChgNot(rSource.Source, uno::UNO_QUERY_THROW); uno::Reference<util::XChangesNotifier> xChgNot(rSource.Source, uno::UNO_QUERY);
xChgNot->removeChangesListener(this); if (xChgNot)
xChgNot->removeChangesListener(this);
} }
catch (uno::Exception&) catch (uno::Exception&)
{ {

View File

@ -301,21 +301,24 @@ ScVbaControl::getControlSource()
// dependent parts // dependent parts
OUString sControlSource; OUString sControlSource;
uno::Reference< form::binding::XBindableValue > xBindable( m_xProps, uno::UNO_QUERY ); 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; return sControlSource;
} }
@ -364,22 +367,25 @@ ScVbaControl::getRowSource()
{ {
OUString sRowSource; OUString sRowSource;
uno::Reference< form::binding::XListEntrySink > xListSink( m_xProps, uno::UNO_QUERY ); 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 );
{ if ( !xFac )
uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); return sRowSource;
uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( u"com.sun.star.table.CellRangeAddressConversion"_ustr ), uno::UNO_QUERY ); 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 ); uno::Reference< beans::XPropertySet > xProps( xListSink->getListEntrySource(), uno::UNO_QUERY );
table::CellRangeAddress aAddress; if ( !xProps )
xProps->getPropertyValue( u"CellRange"_ustr ) >>= aAddress; return sRowSource;
xConvertor->setPropertyValue( u"Address"_ustr , uno::Any( aAddress ) ); table::CellRangeAddress aAddress;
xConvertor->getPropertyValue( u"XLA1Representation"_ustr ) >>= sRowSource; xProps->getPropertyValue( u"CellRange"_ustr ) >>= aAddress;
} xConvertor->setPropertyValue( u"Address"_ustr , uno::Any( aAddress ) );
catch(const uno::Exception&) xConvertor->getPropertyValue( u"XLA1Representation"_ustr ) >>= sRowSource;
{ }
} catch(const uno::Exception&)
{
} }
return sRowSource; return sRowSource;
} }

View File

@ -90,10 +90,13 @@ ScVbaUserForm::Show( )
try try
{ {
uno::Reference< lang::XComponent > xComp( m_xDialog, uno::UNO_QUERY_THROW ); uno::Reference< lang::XComponent > xComp( m_xDialog, uno::UNO_QUERY );
m_xDialog = nullptr; if (xComp)
xComp->dispose(); {
mbDispose = false; m_xDialog = nullptr;
xComp->dispose();
mbDispose = false;
}
} }
catch( uno::Exception& ) catch( uno::Exception& )
{ {

View File

@ -141,32 +141,35 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
xModifiable->setModified( false ); xModifiable->setModified( false );
// first try to close the document using UI dispatch functionality // first try to close the document using UI dispatch functionality
bool bUIClose = false;
try try
{ {
uno::Reference< frame::XController > xController( getModel()->getCurrentController(), uno::UNO_SET_THROW ); uno::Reference< frame::XController > xController( getModel()->getCurrentController() );
uno::Reference< frame::XDispatchProvider > xDispatchProvider( xController->getFrame(), uno::UNO_QUERY_THROW ); 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 ); util::URL aURL;
uno::Reference< util::XURLTransformer > xURLTransformer( util::URLTransformer::create(mxContext) ); aURL.Complete = ".uno:CloseDoc";
xURLTransformer->parseStrict( aURL );
util::URL aURL; uno::Reference< css::frame::XDispatch > xDispatch(
aURL.Complete = ".uno:CloseDoc"; xDispatchProvider->queryDispatch( aURL, u"_self"_ustr , 0 ) );
xURLTransformer->parseStrict( aURL ); if (xDispatch)
{
uno::Reference< css::frame::XDispatch > xDispatch( xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() );
xDispatchProvider->queryDispatch( aURL, u"_self"_ustr , 0 ), return;
uno::UNO_SET_THROW ); }
xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() ); }
bUIClose = true; }
} }
catch(const uno::Exception&) catch(const uno::Exception&)
{ {
} }
if ( bUIClose )
return;
// if it is not possible to use UI dispatch, try to close the model directly // if it is not possible to use UI dispatch, try to close the model directly
bool bCloseable = false; bool bCloseable = false;
uno::Reference< frame::XModel > xModel = getModel(); 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. // 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 // But if the model disagree with a reset request for the modify state
// we shouldn't do so. Otherwise some strange things can happen. // we shouldn't do so. Otherwise some strange things can happen.
uno::Reference< lang::XComponent > xDisposable ( xModel, uno::UNO_QUERY_THROW ); if (xModel)
xDisposable->dispose(); xModel->dispose();
} }
catch(const uno::Exception&) catch(const uno::Exception&)
{ {
@ -277,13 +280,20 @@ VbaDocumentBase::getVBProject()
{ {
if( !mxVBProject.is() ) try if( !mxVBProject.is() ) try
{ {
uno::Reference< XApplicationBase > xApp( Application(), uno::UNO_QUERY_THROW ); uno::Reference< XApplicationBase > xApp( Application(), uno::UNO_QUERY );
uno::Reference< XInterface > xVBE( xApp->getVBE(), uno::UNO_QUERY_THROW ); if (xApp)
uno::Sequence< uno::Any > aArgs{ uno::Any(xVBE), // the VBE {
uno::Any(getModel()) }; // document model for script container access uno::Reference< XInterface > xVBE( xApp->getVBE(), uno::UNO_QUERY );
uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW ); if (xVBE)
mxVBProject = xServiceManager->createInstanceWithArgumentsAndContext( {
u"ooo.vba.vbide.VBProject"_ustr, aArgs, mxContext ); 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&) catch(const uno::Exception&)
{ {

View File

@ -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::XModel > xModel( rxComponent, uno::UNO_QUERY );
uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); if (!xModel)
uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_SET_THROW ); return;
uno::Reference< awt::XWindow >( xFrame->getContainerWindow(), uno::UNO_SET_THROW )->setEnable( false ); 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& ) catch( uno::Exception& )
{ {

View File

@ -1078,7 +1078,9 @@ uno::Reference< XHelperInterface > getVBADocument( const uno::Reference< frame::
uno::Reference< XHelperInterface > xIf; uno::Reference< XHelperInterface > xIf;
try 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; OUString aCodeName;
xDocProps->getPropertyValue( u"CodeName"_ustr ) >>= aCodeName; xDocProps->getPropertyValue( u"CodeName"_ustr ) >>= aCodeName;
xIf = getUnoDocModule( aCodeName, getSfxObjShell( xModel ) ); xIf = getUnoDocModule( aCodeName, getSfxObjShell( xModel ) );

View File

@ -142,7 +142,9 @@ bool WpftLoader::impl_load()
} }
const uno::Reference<document::XExtendedFilterDetection> xDetector(m_xFilter, const uno::Reference<document::XExtendedFilterDetection> xDetector(m_xFilter,
uno::UNO_QUERY_THROW); uno::UNO_QUERY);
if (!xDetector)
return false;
const OUString aTypeName(xDetector->detect(aDescriptor)); const OUString aTypeName(xDetector->detect(aDescriptor));
if (aTypeName.isEmpty()) if (aTypeName.isEmpty())

View File

@ -59,25 +59,28 @@ uno::Reference<io::XInputStream> findStream(ucbhelper::Content& rContent, std::u
{ {
const uno::Reference<sdbc::XResultSet> xResultSet( const uno::Reference<sdbc::XResultSet> xResultSet(
rContent.createCursor(lPropNames, ucbhelper::INCLUDE_DOCUMENTS_ONLY)); rContent.createCursor(lPropNames, ucbhelper::INCLUDE_DOCUMENTS_ONLY));
if (xResultSet->first()) if (!xResultSet->first())
return xInputStream;
const uno::Reference<ucb::XContentAccess> xContentAccess(xResultSet, uno::UNO_QUERY);
if (!xContentAccess)
return xInputStream;
const uno::Reference<sdbc::XRow> xRow(xResultSet, uno::UNO_QUERY);
if (!xRow)
return xInputStream;
do
{ {
const uno::Reference<ucb::XContentAccess> xContentAccess(xResultSet, const OUString aTitle(xRow->getString(1));
uno::UNO_QUERY_THROW); if (aTitle == rName)
const uno::Reference<sdbc::XRow> xRow(xResultSet, uno::UNO_QUERY_THROW);
do
{ {
const OUString aTitle(xRow->getString(1)); const uno::Reference<ucb::XContent> xSubContent(xContentAccess->queryContent());
if (aTitle == rName) ucbhelper::Content aSubContent(xSubContent,
{ uno::Reference<ucb::XCommandEnvironment>(),
const uno::Reference<ucb::XContent> xSubContent(xContentAccess->queryContent()); comphelper::getProcessComponentContext());
ucbhelper::Content aSubContent(xSubContent, xInputStream = aSubContent.openStream();
uno::Reference<ucb::XCommandEnvironment>(), break;
comphelper::getProcessComponentContext()); }
xInputStream = aSubContent.openStream(); } while (xResultSet->next());
break;
}
} while (xResultSet->next());
}
} }
catch (const uno::RuntimeException&) catch (const uno::RuntimeException&)
{ {

View File

@ -369,7 +369,9 @@ Reference<XInputStream> ZipStorageImpl::createStream(const OUString& rPath)
try try
{ {
const Reference<XInputStream> xInputStream(mxContainer->getByName(rPath), UNO_QUERY_THROW); const Reference<XInputStream> xInputStream(mxContainer->getByName(rPath), UNO_QUERY);
if (!xInputStream)
return xStream;
const Reference<XSeekable> xSeekable(xInputStream, UNO_QUERY); const Reference<XSeekable> xSeekable(xInputStream, UNO_QUERY);
if (xSeekable.is()) if (xSeekable.is())

View File

@ -1640,8 +1640,9 @@ void SchXMLExportHelper_Impl::exportTable()
try try
{ {
bool bProtected = false; bool bProtected = false;
Reference< beans::XPropertySet > xProps( mrExport.GetModel(), uno::UNO_QUERY_THROW ); Reference< beans::XPropertySet > xProps( mrExport.GetModel(), uno::UNO_QUERY );
if ( ( xProps->getPropertyValue(u"DisableDataTableDialog"_ustr) >>= bProtected ) && if ( xProps &&
( xProps->getPropertyValue(u"DisableDataTableDialog"_ustr) >>= bProtected ) &&
bProtected ) bProtected )
{ {
mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE ); mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE );

View File

@ -762,9 +762,12 @@ void SchXMLTableHelper::applyTableToInternalDataProvider(
{ {
try try
{ {
Reference< beans::XPropertySet > xProps( xChartDoc, uno::UNO_QUERY_THROW ); Reference< beans::XPropertySet > xProps( xChartDoc, uno::UNO_QUERY );
xProps->setPropertyValue( u"DisableDataTableDialog"_ustr, uno::Any( true ) ); if (xProps)
xProps->setPropertyValue( u"DisableComplexChartTypes"_ustr, uno::Any( true ) ); {
xProps->setPropertyValue( u"DisableDataTableDialog"_ustr, uno::Any( true ) );
xProps->setPropertyValue( u"DisableComplexChartTypes"_ustr, uno::Any( true ) );
}
} }
catch ( uno::Exception& ) catch ( uno::Exception& )
{ {

View File

@ -123,8 +123,9 @@ void XMLEmbeddedObjectImportContext::SetComponent( Reference< XComponent > const
try try
{ {
Reference < XModifiable2 > xModifiable2( rComp, UNO_QUERY_THROW ); Reference < XModifiable2 > xModifiable2( rComp, UNO_QUERY );
xModifiable2->disableSetModified(); if (xModifiable2)
xModifiable2->disableSetModified();
} }
catch( Exception& ) catch( Exception& )
{ {
@ -243,9 +244,12 @@ void XMLEmbeddedObjectImportContext::endFastElement(sal_Int32 nElement)
try try
{ {
Reference < XModifiable2 > xModifiable2( xComp, UNO_QUERY_THROW ); Reference < XModifiable2 > xModifiable2( xComp, UNO_QUERY );
xModifiable2->enableSetModified(); if (xModifiable2)
xModifiable2->setModified( true ); // trigger new replacement image generation {
xModifiable2->enableSetModified();
xModifiable2->setModified( true ); // trigger new replacement image generation
}
} }
catch( Exception& ) catch( Exception& )
{ {

View File

@ -46,7 +46,9 @@ void SdXMLDescriptionContext::endFastElement(sal_Int32 )
try 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) if( (mnElement & TOKEN_MASK) == XML_TITLE)
{ {
xPropSet->setPropertyValue(u"Title"_ustr, Any(msText)); xPropSet->setPropertyValue(u"Title"_ustr, Any(msText));