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>
This commit is contained in:
@@ -395,8 +395,8 @@ static uno::Reference< vba::XVBACompatibility > getVBACompatibility( const uno::
|
||||
uno::Reference< vba::XVBACompatibility > xVBACompat;
|
||||
try
|
||||
{
|
||||
uno::Reference< beans::XPropertySet > xModelProps( rxModel, uno::UNO_QUERY_THROW );
|
||||
xVBACompat.set( xModelProps->getPropertyValue( "BasicLibraries" ), uno::UNO_QUERY );
|
||||
if (auto xModelProps = rxModel.query<beans::XPropertySet>() )
|
||||
xVBACompat.set( xModelProps->getPropertyValue( "BasicLibraries" ), uno::UNO_QUERY );
|
||||
}
|
||||
catch(const uno::Exception& )
|
||||
{
|
||||
|
||||
@@ -1477,9 +1477,9 @@ bool EmbeddedObjectContainer::SetPersistentEntries(const uno::Reference< embed::
|
||||
// if this method is used as part of SaveCompleted the object must stay unmodified after execution
|
||||
try
|
||||
{
|
||||
uno::Reference< util::XModifiable > xModif( xObj->getComponent(), uno::UNO_QUERY_THROW );
|
||||
if ( xModif->isModified() )
|
||||
xModif->setModified( false );
|
||||
if (auto xModif = xObj->getComponent().query<util::XModifiable>() )
|
||||
if ( xModif->isModified() )
|
||||
xModif->setModified( false );
|
||||
}
|
||||
catch (const uno::Exception&)
|
||||
{
|
||||
|
||||
@@ -238,13 +238,8 @@ void OLockListener::Dispose()
|
||||
|
||||
if ( nMode & embed::Actions::PREVENT_TERMINATION )
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< frame::XDesktop > xDesktop( xInstance, uno::UNO_QUERY_THROW );
|
||||
if (auto xDesktop = xInstance.query<frame::XDesktop>() )
|
||||
xDesktop->removeTerminateListener( static_cast< frame::XTerminateListener* >( this ) );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -679,8 +679,8 @@ OUString OStorageHelper::GetODFVersionFromStorage(const uno::Reference<embed::XS
|
||||
OUString aODFVersion;
|
||||
try
|
||||
{
|
||||
uno::Reference<beans::XPropertySet> xPropSet(xStorage, uno::UNO_QUERY_THROW);
|
||||
xPropSet->getPropertyValue("Version") >>= aODFVersion;
|
||||
if (auto xPropSet = xStorage.query<beans::XPropertySet>())
|
||||
xPropSet->getPropertyValue("Version") >>= aODFVersion;
|
||||
}
|
||||
catch (uno::Exception&)
|
||||
{
|
||||
|
||||
@@ -603,31 +603,14 @@ void DocumentHolder::FreeOffice()
|
||||
|
||||
void DocumentHolder::DisconnectFrameDocument( bool bComplete )
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< util::XModifyBroadcaster > xModifiable( m_xDocument, uno::UNO_QUERY_THROW );
|
||||
if (auto xModifiable = m_xDocument.query<util::XModifyBroadcaster>() )
|
||||
xModifiable->removeModifyListener( static_cast<util::XModifyListener*>(this) );
|
||||
}
|
||||
catch( const uno::Exception& )
|
||||
{}
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< util::XCloseBroadcaster > xBroadcaster(
|
||||
m_xDocument, uno::UNO_QUERY_THROW );
|
||||
if (auto xBroadcaster = m_xDocument.query<util::XCloseBroadcaster>() )
|
||||
xBroadcaster->removeCloseListener( static_cast<util::XCloseListener*>(this) );
|
||||
}
|
||||
catch( const uno::Exception& )
|
||||
{}
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< util::XCloseBroadcaster > xBroadcaster(
|
||||
m_xFrame, uno::UNO_QUERY_THROW );
|
||||
if (auto xBroadcaster = m_xFrame.query<util::XCloseBroadcaster>() )
|
||||
xBroadcaster->removeCloseListener( static_cast<util::XCloseListener*>(this) );
|
||||
}
|
||||
catch( const uno::Exception& )
|
||||
{}
|
||||
|
||||
if ( bComplete )
|
||||
{
|
||||
@@ -661,14 +644,8 @@ void DocumentHolder::CloseDocument()
|
||||
|
||||
void DocumentHolder::CloseFrame()
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< util::XCloseBroadcaster > xBroadcaster(
|
||||
m_xFrame, uno::UNO_QUERY_THROW );
|
||||
if (auto xBroadcaster = m_xFrame.query<util::XCloseBroadcaster>() )
|
||||
xBroadcaster->removeCloseListener( static_cast<util::XCloseListener*>(this) );
|
||||
}
|
||||
catch( const uno::Exception& )
|
||||
{}
|
||||
|
||||
uno::Reference<util::XCloseable> xCloseable(
|
||||
m_xFrame,uno::UNO_QUERY);
|
||||
|
||||
@@ -277,15 +277,9 @@ void ConverterRoot::registerTitleLayout( const Reference< XTitle >& rxTitle,
|
||||
|
||||
void ConverterRoot::convertTitlePositions()
|
||||
{
|
||||
try
|
||||
{
|
||||
Reference< cssc::XChartDocument > xChart1Doc( mxData->mxDoc, UNO_QUERY_THROW );
|
||||
if (auto xChart1Doc = mxData->mxDoc.query<cssc::XChartDocument>() )
|
||||
for (auto & title : mxData->maTitles)
|
||||
title.second.convertTitlePos( *this, xChart1Doc );
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -74,14 +74,8 @@ OleObjectHelper::OleObjectHelper(
|
||||
|
||||
OleObjectHelper::~OleObjectHelper()
|
||||
{
|
||||
try
|
||||
{
|
||||
Reference< XComponent > xResolverComp( mxResolver, UNO_QUERY_THROW );
|
||||
if (auto xResolverComp = mxResolver.query<XComponent>() )
|
||||
xResolverComp->dispose();
|
||||
}
|
||||
catch(const Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: this is probably a sub-optimal approach: ideally the media type
|
||||
|
||||
@@ -323,14 +323,8 @@ void VbaModule::createModule( std::u16string_view rVBASourceCode,
|
||||
aSourceCode.append( "End Sub\n" );
|
||||
|
||||
// insert extended module info
|
||||
try
|
||||
{
|
||||
Reference< XVBAModuleInfo > xVBAModuleInfo( rxBasicLib, UNO_QUERY_THROW );
|
||||
if (auto xVBAModuleInfo = rxBasicLib.query<XVBAModuleInfo>() )
|
||||
xVBAModuleInfo->insertModuleInfo( maName, aModuleInfo );
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
}
|
||||
|
||||
// insert the module into the passed Basic library
|
||||
try
|
||||
|
||||
@@ -3988,15 +3988,10 @@ void XclImpChChart::Convert( const Reference<XChartDocument>& xChartDoc,
|
||||
}
|
||||
|
||||
// chart title
|
||||
if( mxTitle ) try
|
||||
{
|
||||
Reference< XTitled > xTitled( xChartDoc, UNO_QUERY_THROW );
|
||||
Reference< XTitle > xTitle( mxTitle->CreateTitle(), UNO_SET_THROW );
|
||||
xTitled->setTitleObject( xTitle );
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
}
|
||||
if( mxTitle )
|
||||
if (auto xTitled = xChartDoc.query<XTitled>() )
|
||||
if (auto xTitle = mxTitle->CreateTitle().query<XTitle>() )
|
||||
xTitled->setTitleObject( xTitle );
|
||||
|
||||
/* Create the diagram object and attach it to the chart document. Currently,
|
||||
one diagram is used to carry all coordinate systems and data series. */
|
||||
|
||||
@@ -159,8 +159,8 @@ bool ScfPropertySet::HasProperty( const OUString& rPropName ) const
|
||||
bool bHasProp = false;
|
||||
try
|
||||
{
|
||||
Reference< XPropertyState > xPropState( mxPropSet, UNO_QUERY_THROW );
|
||||
bHasProp = xPropState->getPropertyState( rPropName ) == css::beans::PropertyState_DIRECT_VALUE;
|
||||
if (auto xPropState = mxPropSet.query<XPropertyState>() )
|
||||
bHasProp = xPropState->getPropertyState( rPropName ) == css::beans::PropertyState_DIRECT_VALUE;
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
|
||||
@@ -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" );
|
||||
}
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -568,9 +568,9 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCode& rError )
|
||||
VBA Globals object and does all related initialization. */
|
||||
if ( xModelSet.is() ) try
|
||||
{
|
||||
uno::Reference< script::vba::XVBACompatibility > xVBACompat( xModelSet->getPropertyValue(
|
||||
"BasicLibraries" ), uno::UNO_QUERY_THROW );
|
||||
xVBACompat->setVBACompatibilityMode( true );
|
||||
if (auto xVBACompat = xModelSet->getPropertyValue(
|
||||
"BasicLibraries" ).query<script::vba::XVBACompatibility>() )
|
||||
xVBACompat->setVBACompatibilityMode( true );
|
||||
}
|
||||
catch( const uno::Exception& )
|
||||
{
|
||||
@@ -853,9 +853,8 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
|
||||
&& aVersion != ODFVER_010_TEXT
|
||||
&& aVersion != ODFVER_011_TEXT )
|
||||
{
|
||||
const uno::Reference< rdf::XDocumentMetadataAccess > xDMA(
|
||||
xModel, uno::UNO_QUERY_THROW );
|
||||
xDMA->storeMetadataToStorage( xStorage );
|
||||
if (auto xDMA = xModel.query<rdf::XDocumentMetadataAccess>() )
|
||||
xDMA->storeMetadataToStorage( xStorage );
|
||||
}
|
||||
}
|
||||
catch ( const beans::UnknownPropertyException &)
|
||||
|
||||
@@ -999,14 +999,8 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
|
||||
TOOLS_WARN_EXCEPTION( "sc", "SfxEventHintId::SaveDoc" );
|
||||
SC_MOD()->SetInSharedDocSaving( false );
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< util::XCloseable > xClose( xModel, uno::UNO_QUERY_THROW );
|
||||
if (auto xClose = xModel.query<util::XCloseable>() )
|
||||
xClose->close( true );
|
||||
}
|
||||
catch ( uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1174,14 +1174,8 @@ void ScDocShell::Execute( SfxRequest& rReq )
|
||||
TOOLS_WARN_EXCEPTION( "sc", "SID_SHARE_DOC" );
|
||||
SC_MOD()->SetInSharedDocSaving( false );
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< util::XCloseable > xClose( xModel, uno::UNO_QUERY_THROW );
|
||||
if (auto xClose = xModel.query<util::XCloseable>() )
|
||||
xClose->close( true );
|
||||
}
|
||||
catch ( uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,26 +425,14 @@ void SAL_CALL ScVbaEventListener::disposing( const lang::EventObject& rEvent )
|
||||
|
||||
void ScVbaEventListener::startModelListening()
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< util::XChangesNotifier > xChangesNotifier( mxModel, uno::UNO_QUERY_THROW );
|
||||
if (auto xChangesNotifier = mxModel.query<util::XChangesNotifier>() )
|
||||
xChangesNotifier->addChangesListener( this );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void ScVbaEventListener::stopModelListening()
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< util::XChangesNotifier > xChangesNotifier( mxModel, uno::UNO_QUERY_THROW );
|
||||
if (auto xChangesNotifier = mxModel.query<util::XChangesNotifier>() )
|
||||
xChangesNotifier->removeChangesListener( this );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
uno::Reference< frame::XController > ScVbaEventListener::getControllerForWindow( vcl::Window* pWindow ) const
|
||||
|
||||
@@ -353,15 +353,8 @@ ScriptEventHelper::~ScriptEventHelper()
|
||||
// dispose control ( and remove any associated event registrations )
|
||||
if ( m_bDispose )
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< lang::XComponent > xComp( m_xControl, uno::UNO_QUERY_THROW );
|
||||
if (auto xComp = m_xControl.query<lang::XComponent>() )
|
||||
xComp->dispose();
|
||||
}
|
||||
// destructor can't throw
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,17 +36,10 @@ Reference<presentation::XSlideShowController> PresenterHelper::GetSlideShowContr
|
||||
{
|
||||
Reference<presentation::XSlideShowController> xSlideShowController;
|
||||
|
||||
if( rxController.is() ) try
|
||||
{
|
||||
Reference<XPresentationSupplier> xPS ( rxController->getModel(), UNO_QUERY_THROW);
|
||||
|
||||
Reference<XPresentation2> xPresentation(xPS->getPresentation(), UNO_QUERY_THROW);
|
||||
|
||||
xSlideShowController = xPresentation->getController();
|
||||
}
|
||||
catch(RuntimeException&)
|
||||
{
|
||||
}
|
||||
if( rxController.is() )
|
||||
if (auto xPS = rxController->getModel().query<XPresentationSupplier>())
|
||||
if (auto xPresentation = xPS->getPresentation().query<XPresentation2>())
|
||||
xSlideShowController = xPresentation->getController();
|
||||
|
||||
return xSlideShowController;
|
||||
}
|
||||
|
||||
@@ -411,8 +411,8 @@ void PresenterScreen::SwitchMonitors()
|
||||
nNewScreen++; // otherwise we store screens offset by one.
|
||||
|
||||
// Set the new presentation display
|
||||
Reference<beans::XPropertySet> xProperties (xPresentation, UNO_QUERY_THROW);
|
||||
xProperties->setPropertyValue("Display", Any(nNewScreen));
|
||||
if (auto xProperties = xPresentation.query<beans::XPropertySet>())
|
||||
xProperties->setPropertyValue("Display", Any(nNewScreen));
|
||||
} catch (const uno::Exception &) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -799,8 +799,8 @@ Reference<awt::XWindow> PresenterSlideShowView::CreateViewWindow (
|
||||
xViewWindow.set( xToolkit->createWindow(aWindowDescriptor),UNO_QUERY_THROW);
|
||||
|
||||
// Make the background transparent. The slide show paints its own background.
|
||||
Reference<awt::XWindowPeer> xPeer (xViewWindow, UNO_QUERY_THROW);
|
||||
xPeer->setBackground(0xff000000);
|
||||
if (auto xPeer = xViewWindow.query<awt::XWindowPeer>())
|
||||
xPeer->setBackground(0xff000000);
|
||||
|
||||
xViewWindow->setVisible(true);
|
||||
}
|
||||
|
||||
@@ -309,9 +309,9 @@ bool SdStyleSheet::IsUsed() const
|
||||
Reference< XStyle > xStyle( rListener, UNO_QUERY );
|
||||
try
|
||||
{
|
||||
Reference<XPropertySet> xPropertySet(xStyle, UNO_QUERY_THROW);
|
||||
if (xPropertySet->getPropertyValue("IsPhysical").get<bool>())
|
||||
return true;
|
||||
if (auto xPropertySet = xStyle.query<XPropertySet>() )
|
||||
if (xPropertySet->getPropertyValue("IsPhysical").get<bool>())
|
||||
return true;
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
|
||||
@@ -1944,8 +1944,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
|
||||
try
|
||||
{
|
||||
// try to get the aspect when available
|
||||
css::uno::Reference< css::beans::XPropertySet > xShapeProps( mXShape, css::uno::UNO_QUERY_THROW );
|
||||
xShapeProps->getPropertyValue("Aspect") >>= nAspect;
|
||||
if (auto xShapeProps = mXShape.query<css::beans::XPropertySet>() )
|
||||
xShapeProps->getPropertyValue("Aspect") >>= nAspect;
|
||||
}
|
||||
catch( css::uno::Exception& )
|
||||
{}
|
||||
@@ -2527,8 +2527,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
|
||||
try
|
||||
{
|
||||
// try to get the aspect when available
|
||||
css::uno::Reference< css::beans::XPropertySet > xShapeProps( mXShape, css::uno::UNO_QUERY_THROW );
|
||||
xShapeProps->getPropertyValue("Aspect") >>= nAspect;
|
||||
if (auto xShapeProps = mXShape.query<css::beans::XPropertySet>() )
|
||||
xShapeProps->getPropertyValue("Aspect") >>= nAspect;
|
||||
}
|
||||
catch( css::uno::Exception& )
|
||||
{}
|
||||
|
||||
@@ -183,29 +183,15 @@ void AnnotationManagerImpl::init()
|
||||
TOOLS_WARN_EXCEPTION( "sd", "sd::AnnotationManagerImpl::AnnotationManagerImpl()" );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Reference<XEventBroadcaster> xModel (mrBase.GetDocShell()->GetModel(), UNO_QUERY_THROW );
|
||||
Reference<XEventListener> xListener( this );
|
||||
xModel->addEventListener( xListener );
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
}
|
||||
if (auto xModel = mrBase.GetDocShell()->GetModel().query<XEventBroadcaster>() )
|
||||
xModel->addEventListener( Reference<XEventListener>( this ) );
|
||||
}
|
||||
|
||||
// WeakComponentImplHelper
|
||||
void AnnotationManagerImpl::disposing (std::unique_lock<std::mutex>&)
|
||||
{
|
||||
try
|
||||
{
|
||||
Reference<XEventBroadcaster> xModel (mrBase.GetDocShell()->GetModel(), UNO_QUERY_THROW );
|
||||
Reference<XEventListener> xListener( this );
|
||||
xModel->removeEventListener( xListener );
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
}
|
||||
if (auto xModel = mrBase.GetDocShell()->GetModel().query<XEventBroadcaster>() )
|
||||
xModel->removeEventListener( Reference<XEventListener>( this ) );
|
||||
|
||||
removeListener();
|
||||
DisposeTags();
|
||||
|
||||
@@ -125,10 +125,9 @@ SlideShowView::SlideShowView( ShowWindow& rOutputWindow,
|
||||
{
|
||||
try
|
||||
{
|
||||
Reference< beans::XPropertySet > xCanvasProps( getCanvas(),
|
||||
uno::UNO_QUERY_THROW );
|
||||
xCanvasProps->setPropertyValue("UnsafeScrolling",
|
||||
uno::Any( true ) );
|
||||
if (auto xCanvasProps = getCanvas().query<beans::XPropertySet>() )
|
||||
xCanvasProps->setPropertyValue("UnsafeScrolling",
|
||||
uno::Any( true ) );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
|
||||
@@ -73,10 +73,10 @@ static void ImpExtractCustomShow( const Reference< XModel >& rxModel, std::u16st
|
||||
try
|
||||
{
|
||||
PageCollector::CollectNonCustomShowPages( rxModel, rCustomShowName, vNonUsedPageList );
|
||||
Reference< XDrawPagesSupplier > xDrawPagesSupplier( rxModel, UNO_QUERY_THROW );
|
||||
Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
|
||||
for( const auto& rxPage : vNonUsedPageList )
|
||||
xDrawPages->remove( rxPage );
|
||||
if (auto xDrawPagesSupplier = rxModel.query<XDrawPagesSupplier>() )
|
||||
if (auto xDrawPages = xDrawPagesSupplier->getDrawPages().query<XDrawPages>() )
|
||||
for( const auto& rxPage : vNonUsedPageList )
|
||||
xDrawPages->remove( rxPage );
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
@@ -544,10 +544,12 @@ static void DispatchURL( const Reference< XComponentContext >& xContext, const O
|
||||
aUrl.Complete = sURL;
|
||||
xURLTransformer->parseStrict( aUrl );
|
||||
Sequence< PropertyValue > aArgs;
|
||||
Reference< XDispatchProvider > xDispatchProvider( xFrame, UNO_QUERY_THROW );
|
||||
Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aUrl, OUString(), 0 ); // "_self"
|
||||
if ( xDispatch.is() )
|
||||
xDispatch->dispatch( aUrl, aArgs );
|
||||
if (auto xDispatchProvider = xFrame.query<XDispatchProvider>() )
|
||||
{
|
||||
Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aUrl, OUString(), 0 ); // "_self"
|
||||
if ( xDispatch.is() )
|
||||
xDispatch->dispatch( aUrl, aArgs );
|
||||
}
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
|
||||
@@ -74,9 +74,9 @@ void OptimizationStats::InitializeStatusValuesFromDocument( const Reference< XMo
|
||||
{
|
||||
try
|
||||
{
|
||||
Reference< XDrawPagesSupplier > xDrawPagesSupplier( rxModel, UNO_QUERY_THROW );
|
||||
Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
|
||||
SetStatusValue( TK_Pages, Any( awt::Size( 0, xDrawPages->getCount() ) ) );
|
||||
if (auto xDrawPagesSupplier = rxModel.query<XDrawPagesSupplier>() )
|
||||
if (auto xDrawPages = xDrawPagesSupplier->getDrawPages().query<XDrawPages>() )
|
||||
SetStatusValue( TK_Pages, Any( awt::Size( 0, xDrawPages->getCount() ) ) );
|
||||
}
|
||||
catch ( Exception& )
|
||||
{
|
||||
|
||||
@@ -1109,11 +1109,8 @@ FileDialogHelper_Impl::FileDialogHelper_Impl(
|
||||
if ( mbExport )
|
||||
{
|
||||
mxFileDlg->setTitle( SfxResId( STR_SFX_EXPLORERFILE_EXPORT ) );
|
||||
try {
|
||||
css::uno::Reference < XFilePickerControlAccess > xCtrlAccess( mxFileDlg, UNO_QUERY_THROW );
|
||||
xCtrlAccess->enableControl( ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR, true );
|
||||
}
|
||||
catch( const Exception & ) { }
|
||||
if (auto xCtrlAccess = mxFileDlg.query<XFilePickerControlAccess>() )
|
||||
xCtrlAccess->enableControl( ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR, true );
|
||||
}
|
||||
|
||||
// Save a copy dialog
|
||||
|
||||
@@ -1806,8 +1806,8 @@ bool SfxObjectShell_Impl::hasTrustedScriptingSignature( bool bAllowUIToAddAuthor
|
||||
OUString aVersion;
|
||||
try
|
||||
{
|
||||
uno::Reference < beans::XPropertySet > xPropSet( rDocShell.GetStorage(), uno::UNO_QUERY_THROW );
|
||||
xPropSet->getPropertyValue("Version") >>= aVersion;
|
||||
if (auto xPropSet = rDocShell.GetStorage().query<beans::XPropertySet>() )
|
||||
xPropSet->getPropertyValue("Version") >>= aVersion;
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
|
||||
+24
-42
@@ -1197,8 +1197,8 @@ bool SfxObjectShell::SaveTo_Impl
|
||||
OUString aODFVersion;
|
||||
try
|
||||
{
|
||||
uno::Reference < beans::XPropertySet > xPropSet( GetStorage(), uno::UNO_QUERY_THROW );
|
||||
xPropSet->getPropertyValue("Version") >>= aODFVersion;
|
||||
if (auto xPropSet = GetStorage().query<beans::XPropertySet>() )
|
||||
xPropSet->getPropertyValue("Version") >>= aODFVersion;
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{}
|
||||
@@ -1375,9 +1375,9 @@ bool SfxObjectShell::SaveTo_Impl
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< beans::XPropertySet > xProps( rMedium.GetStorage(), uno::UNO_QUERY_THROW );
|
||||
xProps->setPropertyValue("MediaType",
|
||||
uno::Any( aDataFlavor.MimeType ) );
|
||||
if (auto xProps = rMedium.GetStorage().query<beans::XPropertySet>() )
|
||||
xProps->setPropertyValue("MediaType",
|
||||
uno::Any( aDataFlavor.MimeType ) );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
@@ -1591,8 +1591,8 @@ bool SfxObjectShell::SaveTo_Impl
|
||||
OUString aVersion;
|
||||
try
|
||||
{
|
||||
uno::Reference < beans::XPropertySet > xPropSet( rMedium.GetStorage(), uno::UNO_QUERY_THROW );
|
||||
xPropSet->getPropertyValue("Version") >>= aVersion;
|
||||
if (auto xPropSet = rMedium.GetStorage().query<beans::XPropertySet>() )
|
||||
xPropSet->getPropertyValue("Version") >>= aVersion;
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
@@ -1817,14 +1817,16 @@ bool SfxObjectShell::ConnectTmpStorage_Impl(
|
||||
try
|
||||
{
|
||||
// the empty argument means that the storage will create temporary stream itself
|
||||
uno::Reference< embed::XOptimizedStorage > xOptStorage( xStorage, uno::UNO_QUERY_THROW );
|
||||
xOptStorage->writeAndAttachToStream( uno::Reference< io::XStream >() );
|
||||
if (auto xOptStorage = xStorage.query<embed::XOptimizedStorage>() )
|
||||
{
|
||||
xOptStorage->writeAndAttachToStream( uno::Reference< io::XStream >() );
|
||||
|
||||
// the storage is successfully disconnected from the original sources, thus the medium must not dispose it
|
||||
if ( pMediumArg )
|
||||
pMediumArg->CanDisposeStorage_Impl( false );
|
||||
// the storage is successfully disconnected from the original sources, thus the medium must not dispose it
|
||||
if ( pMediumArg )
|
||||
pMediumArg->CanDisposeStorage_Impl( false );
|
||||
|
||||
bResult = true;
|
||||
bResult = true;
|
||||
}
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
@@ -1849,20 +1851,10 @@ bool SfxObjectShell::ConnectTmpStorage_Impl(
|
||||
pImpl->aBasicManager.setStorage( xTmpStorage );
|
||||
|
||||
// Get rid of this workaround after issue i113914 is fixed
|
||||
try
|
||||
{
|
||||
uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImpl->xBasicLibraries, uno::UNO_QUERY_THROW );
|
||||
if (auto xBasicLibraries = pImpl->xBasicLibraries.query<script::XStorageBasedLibraryContainer>() )
|
||||
xBasicLibraries->setRootStorage( xTmpStorage );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{}
|
||||
try
|
||||
{
|
||||
uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImpl->xDialogLibraries, uno::UNO_QUERY_THROW );
|
||||
if (auto xDialogLibraries = pImpl->xDialogLibraries.query<script::XStorageBasedLibraryContainer>() )
|
||||
xDialogLibraries->setRootStorage( xTmpStorage );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{}
|
||||
}
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
@@ -2013,20 +2005,10 @@ bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed, bool bRegisterRecent )
|
||||
pImpl->aBasicManager.setStorage( xStorage );
|
||||
|
||||
// Get rid of this workaround after issue i113914 is fixed
|
||||
try
|
||||
{
|
||||
uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImpl->xBasicLibraries, uno::UNO_QUERY_THROW );
|
||||
if (auto xBasicLibraries = pImpl->xBasicLibraries.query<script::XStorageBasedLibraryContainer>() )
|
||||
xBasicLibraries->setRootStorage( xStorage );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{}
|
||||
try
|
||||
{
|
||||
uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImpl->xDialogLibraries, uno::UNO_QUERY_THROW );
|
||||
if (auto xDialogLibraries = pImpl->xDialogLibraries.query<script::XStorageBasedLibraryContainer>() )
|
||||
xDialogLibraries->setRootStorage( xStorage );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3450,9 +3432,9 @@ static bool StoragesOfUnknownMediaTypeAreCopied_Impl( const uno::Reference< embe
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< embed::XOptimizedStorage > xOptStorage( xSource, uno::UNO_QUERY_THROW );
|
||||
bGotMediaType =
|
||||
( xOptStorage->getElementPropertyValue( rSubElement, aMediaTypePropName ) >>= aMediaType );
|
||||
if (auto xOptStorage = xSource.query<embed::XOptimizedStorage>() )
|
||||
bGotMediaType =
|
||||
( xOptStorage->getElementPropertyValue( rSubElement, aMediaTypePropName ) >>= aMediaType );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{}
|
||||
@@ -3593,8 +3575,8 @@ bool SfxObjectShell::CopyStoragesOfUnknownMediaType(const uno::Reference< embed:
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< embed::XOptimizedStorage > xOptStorage( xSource, uno::UNO_QUERY_THROW );
|
||||
bGotMediaType = (xOptStorage->getElementPropertyValue(rSubElement, aMediaTypePropName)
|
||||
if (auto xOptStorage = xSource.query<embed::XOptimizedStorage>() )
|
||||
bGotMediaType = (xOptStorage->getElementPropertyValue(rSubElement, aMediaTypePropName)
|
||||
>>= aMediaType);
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
|
||||
@@ -95,13 +95,8 @@ OLESimpleStorage::OLESimpleStorage(
|
||||
|
||||
if ( xInputStream.is() )
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< io::XSeekable > xSeek( xInputStream, uno::UNO_QUERY_THROW );
|
||||
if (auto xSeek = xInputStream.query<io::XSeekable>() )
|
||||
xSeek->seek( 0 );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{}
|
||||
|
||||
::comphelper::OStorageHelper::CopyInputToOutput( xInputStream, xTempOut );
|
||||
xTempOut->closeOutput();
|
||||
|
||||
@@ -45,9 +45,9 @@ static bool lcl_isNamedRange( const OUString& sAddress, const uno::Reference< fr
|
||||
uno::Reference< sheet::XCellRangeReferrer > xReferrer;
|
||||
try
|
||||
{
|
||||
uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW );
|
||||
uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( "NamedRanges" ), uno::UNO_QUERY_THROW );
|
||||
xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY );
|
||||
if (auto xPropSet = xModel.query<beans::XPropertySet>() )
|
||||
if (auto xNamed = xPropSet->getPropertyValue( "NamedRanges" ).query<container::XNameAccess>() )
|
||||
xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY );
|
||||
}
|
||||
catch( uno::Exception& /*e*/ )
|
||||
{
|
||||
|
||||
@@ -240,13 +240,8 @@ void SmartTagMgr::WriteConfiguration( const bool* pIsLabelTextWithSmartTags,
|
||||
|
||||
if ( bCommit )
|
||||
{
|
||||
try
|
||||
{
|
||||
Reference< util::XChangesBatch >( mxConfigurationSettings, UNO_QUERY_THROW )->commitChanges();
|
||||
}
|
||||
catch ( css::uno::Exception& )
|
||||
{
|
||||
}
|
||||
if (auto xChangesBatch = mxConfigurationSettings.query<util::XChangesBatch>() )
|
||||
xChangesBatch->commitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,25 +443,16 @@ void SmartTagMgr::RegisterListener()
|
||||
{
|
||||
Reference<deployment::XExtensionManager> xExtensionManager(
|
||||
deployment::ExtensionManager::get( mxContext ) );
|
||||
Reference< util::XModifyBroadcaster > xMB ( xExtensionManager, UNO_QUERY_THROW );
|
||||
|
||||
Reference< util::XModifyListener > xListener( this );
|
||||
xMB->addModifyListener( xListener );
|
||||
if (auto xMB = xExtensionManager.query<util::XModifyBroadcaster>() )
|
||||
xMB->addModifyListener( Reference< util::XModifyListener >( this ) );
|
||||
}
|
||||
catch ( uno::Exception& )
|
||||
{
|
||||
}
|
||||
|
||||
// register as listener at configuration
|
||||
try
|
||||
{
|
||||
Reference<util::XChangesNotifier> xCN( mxConfigurationSettings, UNO_QUERY_THROW );
|
||||
Reference< util::XChangesListener > xListener( this );
|
||||
xCN->addChangesListener( xListener );
|
||||
}
|
||||
catch ( uno::Exception& )
|
||||
{
|
||||
}
|
||||
if (auto xCN = mxConfigurationSettings.query<util::XChangesNotifier>() )
|
||||
xCN->addChangesListener( Reference< util::XChangesListener >( this ) );
|
||||
}
|
||||
|
||||
typedef std::pair < const OUString, ActionReference > SmartTagMapElement;
|
||||
|
||||
@@ -2791,14 +2791,8 @@ SvxLineWindow_Impl::SvxLineWindow_Impl(SvxFrameToolBoxControl* pControl, weld::W
|
||||
, m_xLineStyleLbWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xLineStyleLb))
|
||||
, m_bIsWriter(false)
|
||||
{
|
||||
try
|
||||
{
|
||||
Reference< lang::XServiceInfo > xServices(m_xFrame->getController()->getModel(), UNO_QUERY_THROW);
|
||||
if (auto xServices = m_xFrame->getController()->getModel().query<lang::XServiceInfo>())
|
||||
m_bIsWriter = xServices->supportsService("com.sun.star.text.TextDocument");
|
||||
}
|
||||
catch(const uno::Exception& )
|
||||
{
|
||||
}
|
||||
|
||||
m_xLineStyleLb->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_TABSTOP) );
|
||||
|
||||
|
||||
@@ -475,14 +475,8 @@ bool SvxXMLXTableImport::load( const OUString &rPath, const OUString &rReferer,
|
||||
if (xGraphicHelper.is())
|
||||
xGraphicStorageHandler = xGraphicHelper.get();
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< io::XSeekable > xSeek( aParserInput.aInputStream, uno::UNO_QUERY_THROW );
|
||||
if (auto xSeek = aParserInput.aInputStream.query<io::XSeekable>() )
|
||||
xSeek->seek( 0 );
|
||||
}
|
||||
catch (const uno::Exception&)
|
||||
{
|
||||
}
|
||||
|
||||
rtl::Reference<SvxXMLXTableImport> xImport(new SvxXMLXTableImport(xContext, xTable, xGraphicStorageHandler));
|
||||
xImport->parseStream( aParserInput );
|
||||
|
||||
@@ -623,10 +623,12 @@ void SwOLENode::BreakFileLink_Impl()
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< embed::XLinkageSupport > xLinkSupport( maOLEObj.GetOleRef(), uno::UNO_QUERY_THROW );
|
||||
xLinkSupport->breakLink( xStorage, maOLEObj.GetCurrentPersistName() );
|
||||
DisconnectFileLink_Impl();
|
||||
maLinkURL.clear();
|
||||
if (auto xLinkSupport = maOLEObj.GetOleRef().query<embed::XLinkageSupport>() )
|
||||
{
|
||||
xLinkSupport->breakLink( xStorage, maOLEObj.GetCurrentPersistName() );
|
||||
DisconnectFileLink_Impl();
|
||||
maLinkURL.clear();
|
||||
}
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
|
||||
@@ -295,9 +295,11 @@ 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( "MediaType", uno::Any( aMime ) );
|
||||
if (auto xRootProps = m_xRoot.query<beans::XPropertySet>() )
|
||||
{
|
||||
OUString aMime( SotExchange::GetFormatMimeType( SotClipboardFormatId::STARWRITER_8 ) );
|
||||
xRootProps->setPropertyValue( "MediaType", uno::Any( aMime ) );
|
||||
}
|
||||
}
|
||||
catch (const uno::Exception&)
|
||||
{
|
||||
|
||||
@@ -69,15 +69,8 @@ void SwChartHelper::DoUpdateAllCharts( SwDoc* pDoc )
|
||||
uno::Reference < embed::XEmbeddedObject > xIP = pONd->GetOLEObj().GetOleRef();
|
||||
if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< util::XModifiable > xModif( xIP->getComponent(), uno::UNO_QUERY_THROW );
|
||||
if (auto xModif = xIP->getComponent().query<util::XModifiable>() )
|
||||
xModif->setModified( true );
|
||||
}
|
||||
catch ( uno::Exception& )
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
|
||||
|
||||
@@ -307,9 +307,8 @@ ErrCode SwXMLWriter::Write_(const SfxItemSet* pMediumItemSet)
|
||||
&& Version != ODFVER_010_TEXT
|
||||
&& Version != ODFVER_011_TEXT)
|
||||
{
|
||||
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(
|
||||
xModelComp, uno::UNO_QUERY_THROW);
|
||||
xDMA->storeMetadataToStorage(m_xStg);
|
||||
if (auto xDMA = xModelComp.query<rdf::XDocumentMetadataAccess>())
|
||||
xDMA->storeMetadataToStorage(m_xStg);
|
||||
}
|
||||
}
|
||||
catch (beans::UnknownPropertyException &)
|
||||
|
||||
@@ -167,15 +167,8 @@ namespace
|
||||
{
|
||||
void lcl_dispose_nothrow( const Any& i_component )
|
||||
{
|
||||
try
|
||||
{
|
||||
const Reference< XComponent > xComponent( i_component, UNO_QUERY_THROW );
|
||||
if (auto xComponent = i_component.query<XComponent>() )
|
||||
xComponent->dispose();
|
||||
}
|
||||
catch( const Exception& )
|
||||
{
|
||||
DBG_UNHANDLED_EXCEPTION("toolkit.controls");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,15 +124,8 @@ IMPL_STATIC_LINK( MainThreadFrameCloserRequest, worker, void*, p, void )
|
||||
// ignore all the errors
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< util::XCloseable > xCloseable( pMTRequest->m_xFrame, uno::UNO_QUERY_THROW );
|
||||
if (auto xCloseable = pMTRequest->m_xFrame.query<util::XCloseable>() )
|
||||
xCloseable->close( true );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
// ignore all the errors
|
||||
}
|
||||
}
|
||||
|
||||
delete pMTRequest;
|
||||
|
||||
@@ -146,15 +146,8 @@ namespace utl
|
||||
OUString OConfigurationNode::getLocalName() const
|
||||
{
|
||||
OUString sLocalName;
|
||||
try
|
||||
{
|
||||
Reference< XNamed > xNamed( m_xDirectAccess, UNO_QUERY_THROW );
|
||||
if (auto xNamed = m_xDirectAccess.query<XNamed>() )
|
||||
sLocalName = xNamed->getName();
|
||||
}
|
||||
catch( const Exception& )
|
||||
{
|
||||
DBG_UNHANDLED_EXCEPTION("unotools");
|
||||
}
|
||||
return sLocalName;
|
||||
}
|
||||
|
||||
|
||||
@@ -1016,9 +1016,11 @@ 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("ServiceManager"), uno::UNO_QUERY_THROW );
|
||||
xNA->getByName( "DisabledDictionaries" ) >>= aResult;
|
||||
if (auto xNA = GetMainUpdateAccess().query<container::XNameAccess>() )
|
||||
{
|
||||
xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW );
|
||||
xNA->getByName( "DisabledDictionaries" ) >>= aResult;
|
||||
}
|
||||
}
|
||||
catch (uno::Exception &)
|
||||
{
|
||||
|
||||
@@ -117,14 +117,8 @@ void SvtUserOptions::ChangeListener::changesOccurred (util::ChangesEvent const&
|
||||
|
||||
void SvtUserOptions::ChangeListener::disposing (lang::EventObject const& rSource)
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference<util::XChangesNotifier> xChgNot(rSource.Source, uno::UNO_QUERY_THROW);
|
||||
if (auto xChgNot = rSource.Source.query<util::XChangesNotifier>())
|
||||
xChgNot->removeChangesListener(this);
|
||||
}
|
||||
catch (uno::Exception&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
SvtUserOptions::Impl::Impl() :
|
||||
|
||||
@@ -88,16 +88,12 @@ ScVbaUserForm::Show( )
|
||||
if ( !mbDispose )
|
||||
return;
|
||||
|
||||
try
|
||||
if (auto xComp = m_xDialog.query<lang::XComponent>() )
|
||||
{
|
||||
uno::Reference< lang::XComponent > xComp( m_xDialog, uno::UNO_QUERY_THROW );
|
||||
m_xDialog = nullptr;
|
||||
xComp->dispose();
|
||||
mbDispose = false;
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
OUString SAL_CALL
|
||||
|
||||
@@ -43,14 +43,10 @@ ScVbaColorFormat::ScVbaColorFormat( const uno::Reference< XHelperInterface >& xP
|
||||
{
|
||||
m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW );
|
||||
m_nFillFormatBackColor = 0;
|
||||
try
|
||||
{
|
||||
uno::Reference< ov::msforms::XFillFormat > xFillFormat( xInternalParent, uno::UNO_QUERY_THROW );
|
||||
if (auto xFillFormat = xInternalParent.query<ov::msforms::XFillFormat>() )
|
||||
m_pFillFormat = static_cast<ScVbaFillFormat*>( xFillFormat.get() );
|
||||
}catch ( uno::RuntimeException& )
|
||||
{
|
||||
else
|
||||
m_pFillFormat = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// Attribute
|
||||
|
||||
@@ -192,16 +192,11 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
|
||||
if (bCloseable)
|
||||
return;
|
||||
|
||||
try {
|
||||
// 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 );
|
||||
// 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.
|
||||
if (auto xDisposable = xModel.query<lang::XComponent>() )
|
||||
xDisposable->dispose();
|
||||
}
|
||||
catch(const uno::Exception&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -198,24 +198,21 @@ namespace {
|
||||
|
||||
void lclSetupComponent( const uno::Reference< lang::XComponent >& rxComponent, bool bScreenUpdating, bool bInteractive )
|
||||
{
|
||||
if( !bScreenUpdating ) try
|
||||
{
|
||||
uno::Reference< frame::XModel >( rxComponent, uno::UNO_QUERY_THROW )->lockControllers();
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
}
|
||||
auto xModel = rxComponent.query<frame::XModel>();
|
||||
if( !bScreenUpdating && xModel )
|
||||
xModel->lockControllers();
|
||||
|
||||
if( !bInteractive ) 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 );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
}
|
||||
if( !bInteractive )
|
||||
try
|
||||
{
|
||||
if (auto xController = xModel->getCurrentController().query<frame::XController>() )
|
||||
if (auto xFrame = xController->getFrame().query<frame::XFrame>() )
|
||||
if (auto xWindow = xFrame->getContainerWindow().query<awt::XWindow>() )
|
||||
xWindow->setEnable( false );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -4498,16 +4498,12 @@ void DomainMapper_Impl::PopShapeContext()
|
||||
// or anchored to a discarded header or footer
|
||||
if ( m_aAnchoredStack.top().bToRemove || m_bDiscardHeaderFooter )
|
||||
{
|
||||
try
|
||||
if (auto xDrawPageSupplier = m_xTextDocument.query<drawing::XDrawPageSupplier>())
|
||||
{
|
||||
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(m_xTextDocument, uno::UNO_QUERY_THROW);
|
||||
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
|
||||
if ( xDrawPage.is() )
|
||||
xDrawPage->remove( xShape );
|
||||
}
|
||||
catch( const uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Relative width calculations deferred until section's margins are defined.
|
||||
|
||||
@@ -102,14 +102,8 @@ void ModelEventListener::notifyEvent( const document::EventObject& rEvent )
|
||||
|
||||
void ModelEventListener::disposing( const lang::EventObject& rEvent )
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference<document::XEventBroadcaster>(rEvent.Source, uno::UNO_QUERY_THROW )->removeEventListener(
|
||||
uno::Reference<document::XEventListener>(this));
|
||||
}
|
||||
catch( const uno::Exception& )
|
||||
{
|
||||
}
|
||||
if (auto xEventBroadcaster = rEvent.Source.query<document::XEventBroadcaster>())
|
||||
xEventBroadcaster->removeEventListener(uno::Reference<document::XEventListener>(this));
|
||||
}
|
||||
|
||||
} //namespace writerfilter::dmapper
|
||||
|
||||
@@ -315,8 +315,8 @@ OUString OLEHandler::copyOLEOStream(
|
||||
sRet = aPersistName.copy( strlen("vnd.sun.star.EmbeddedObject:") );
|
||||
|
||||
}
|
||||
uno::Reference< lang::XComponent > xComp( xEmbeddedResolver, uno::UNO_QUERY_THROW );
|
||||
xComp->dispose();
|
||||
if (auto xComp = xEmbeddedResolver.query<lang::XComponent>() )
|
||||
xComp->dispose();
|
||||
m_aURL = aURL;
|
||||
}
|
||||
catch( const uno::Exception& )
|
||||
|
||||
@@ -765,9 +765,11 @@ void SchXMLTableHelper::applyTableToInternalDataProvider(
|
||||
{
|
||||
try
|
||||
{
|
||||
Reference< beans::XPropertySet > xProps( xChartDoc, uno::UNO_QUERY_THROW );
|
||||
xProps->setPropertyValue( "DisableDataTableDialog", uno::Any( true ) );
|
||||
xProps->setPropertyValue( "DisableComplexChartTypes", uno::Any( true ) );
|
||||
if (auto xProps = xChartDoc.query<beans::XPropertySet>() )
|
||||
{
|
||||
xProps->setPropertyValue( "DisableDataTableDialog", uno::Any( true ) );
|
||||
xProps->setPropertyValue( "DisableComplexChartTypes", uno::Any( true ) );
|
||||
}
|
||||
}
|
||||
catch ( uno::Exception& )
|
||||
{
|
||||
|
||||
@@ -122,14 +122,8 @@ void XMLEmbeddedObjectImportContext::SetComponent( Reference< XComponent > const
|
||||
SvXMLImport *pFastHandler = dynamic_cast<SvXMLImport*>(xFilter.get());
|
||||
mxFastHandler = pFastHandler;
|
||||
|
||||
try
|
||||
{
|
||||
Reference < XModifiable2 > xModifiable2( rComp, UNO_QUERY_THROW );
|
||||
if (auto xModifiable2 = rComp.query<XModifiable2>() )
|
||||
xModifiable2->disableSetModified();
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
}
|
||||
|
||||
Reference < XImporter > xImporter( mxFastHandler, UNO_QUERY );
|
||||
xImporter->setTargetDocument( rComp );
|
||||
@@ -242,15 +236,11 @@ void XMLEmbeddedObjectImportContext::endFastElement(sal_Int32 nElement)
|
||||
mxFastHandler->endFastElement( nElement );
|
||||
mxFastHandler->endDocument();
|
||||
|
||||
try
|
||||
if (auto xModifiable2 = xComp.query<XModifiable2>() )
|
||||
{
|
||||
Reference < XModifiable2 > xModifiable2( xComp, UNO_QUERY_THROW );
|
||||
xModifiable2->enableSetModified();
|
||||
xModifiable2->setModified( true ); // trigger new replacement image generation
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void XMLEmbeddedObjectImportContext::characters( const OUString& rChars )
|
||||
|
||||
Reference in New Issue
Block a user