diff options
Diffstat (limited to 'basic/source/classes')
-rw-r--r-- | basic/source/classes/eventatt.cxx | 48 | ||||
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 10 |
2 files changed, 24 insertions, 34 deletions
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 173a3cee2ac1..d3da40a5a4a6 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -44,7 +44,7 @@ #include <com/sun/star/awt/XDialogProvider.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <basic/basicmanagerrepository.hxx> #include <basic/basmgr.hxx> @@ -433,8 +433,6 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit (void)bWrite; Reference< XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory() ); - if( !xMSF.is() ) - return; // We need at least 1 parameter if ( rPar.Count() < 2 ) @@ -473,8 +471,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit { return; } - Reference< XComponentContext > xContext( - comphelper::getComponentContext( xMSF ) ); + Reference< XComponentContext > xContext( comphelper::getComponentContext( xMSF ) ); // Import the DialogModel Reference< XInputStream > xInput( xISP->createInputStream() ); @@ -510,33 +507,30 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit // If we found the dialog then it belongs to the Search basic if ( !pFoundBasic ) { - Reference< frame::XDesktop > xDesktop( xMSF->createInstance(OUString("com.sun.star.frame.Desktop")), UNO_QUERY); + Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( xContext ); Reference< container::XEnumeration > xModels; - if ( xDesktop.is() ) + Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY ); + if ( xComponents.is() ) { - Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY ); - if ( xComponents.is() ) - { - xModels.set( xComponents->createEnumeration(), UNO_QUERY ); - } - if ( xModels.is() ) + xModels.set( xComponents->createEnumeration(), UNO_QUERY ); + } + if ( xModels.is() ) + { + while ( xModels->hasMoreElements() ) { - while ( xModels->hasMoreElements() ) + Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY ); + if ( xNextModel.is() ) { - Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY ); - if ( xNextModel.is() ) + BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel ); + if ( pMgr ) { - BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel ); - if ( pMgr ) - { - aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic ); - } - if ( aDlgLibAny.hasValue() ) - { - bDocDialog = true; - xModel = xNextModel; - break; - } + aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic ); + } + if ( aDlgLibAny.hasValue() ) + { + bDocDialog = true; + xModel = xNextModel; + break; } } } diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index b192a4f12913..dc6688777f99 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -44,6 +44,7 @@ #include <basic/vbahelper.hxx> #include <cppuhelper/implbase3.hxx> #include <unotools/eventcfg.hxx> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/script/ModuleType.hpp> #include <com/sun/star/script/vba/XVBACompatibility.hpp> @@ -477,13 +478,8 @@ public: void QuitApplication() { - uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - if ( xFactory.is() ) - { - uno::Reference< frame::XDesktop > xDeskTop( xFactory->createInstance( OUString( "com.sun.star.frame.Desktop" ) ), uno::UNO_QUERY ); - if ( xDeskTop.is() ) - xDeskTop->terminate(); - } + uno::Reference< frame::XDesktop2 > xDeskTop = frame::Desktop::create( comphelper::getProcessComponentContext() ); + xDeskTop->terminate(); } DECL_LINK( OnAsyncQuit, void* ); }; |