Decrease fragility in odd use cases with no current document
Change-Id: I9966166561d4c6e577f3f7e8e04572f97a0b295e Reviewed-on: https://gerrit.libreoffice.org/49450 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com>
This commit is contained in:
@@ -409,7 +409,10 @@ uno::Reference< vba::XVBACompatibility > getVBACompatibility( const uno::Referen
|
||||
|
||||
bool getDefaultVBAMode( StarBASIC* pb )
|
||||
{
|
||||
uno::Reference< vba::XVBACompatibility > xVBACompat = getVBACompatibility( getDocumentModel( pb ) );
|
||||
uno::Reference< frame::XModel > xModel( getDocumentModel( pb ) );
|
||||
if (!xModel.is())
|
||||
return false;
|
||||
uno::Reference< vba::XVBACompatibility > xVBACompat = getVBACompatibility( xModel );
|
||||
return xVBACompat.is() && xVBACompat->getVBACompatibilityMode();
|
||||
}
|
||||
|
||||
|
@@ -184,7 +184,9 @@ VbaApplicationBase::~VbaApplicationBase()
|
||||
sal_Bool SAL_CALL
|
||||
VbaApplicationBase::getScreenUpdating()
|
||||
{
|
||||
uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
|
||||
uno::Reference< frame::XModel > xModel = getCurrentDocument();
|
||||
if (!xModel.is())
|
||||
return false;
|
||||
return !xModel->hasControllersLocked();
|
||||
}
|
||||
|
||||
@@ -238,7 +240,9 @@ VbaApplicationBase::setDisplayStatusBar(sal_Bool bDisplayStatusBar)
|
||||
|
||||
sal_Bool SAL_CALL VbaApplicationBase::getInteractive()
|
||||
{
|
||||
uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
|
||||
uno::Reference< frame::XModel > xModel = getCurrentDocument();
|
||||
if (!xModel.is())
|
||||
return false;
|
||||
uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
|
||||
uno::Reference< awt::XWindow2 > xWindow( xFrame->getContainerWindow(), uno::UNO_QUERY_THROW );
|
||||
|
||||
|
@@ -277,7 +277,13 @@ getCurrentWordDoc( const uno::Reference< uno::XComponentContext >& xContext )
|
||||
}
|
||||
catch (const uno::Exception&)
|
||||
{
|
||||
xModel = getThisWordDoc( xContext );
|
||||
try
|
||||
{
|
||||
xModel = getThisWordDoc( xContext );
|
||||
}
|
||||
catch (const uno::Exception&)
|
||||
{
|
||||
}
|
||||
}
|
||||
return xModel;
|
||||
}
|
||||
|
Reference in New Issue
Block a user