summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-12-14 12:58:00 +0200
committerNoel Grandin <noel@peralex.com>2012-12-21 10:57:09 +0200
commitbb121c864cc3c101ef733a4088c7ba3e36eced14 (patch)
tree2d528ca830aace6e563b7cdc93eb8f8d6c4f70cf /basic
parent6d818ed651aaafcfb12ebc21449d35947d2e85a9 (diff)
fdo#46808, Convert frame::Desktop to new style service.
I had to drop XEventBroadcaster from the merged interface because it introduced method name conflicts (addEventListener). Shouldn't be an issue since it was scheduled to be dropped anyhow, and the service implementation still implements it, so existing clients will be fine. I dropped the interface XPropertySet from the combined IDL because nobody seems to be using it, and it's primary purpose appears to be to set weird flags. I dropped the optional interfaces XStatusIndicatorFactory XDispatchInformationProvider from the combined IDL because the service does not implement them, and nobody seems to be using them. I suspect they were mistakenly copied from XFrame. I also did not convert the Title, UserDefinedAttributes and LayoutManager properties to attributes, again because no-one is using them. Change-Id: I678a00006ed2cca2d6c37c4e39465811442c33af
Diffstat (limited to 'basic')
-rw-r--r--basic/source/basmgr/basicmanagerrepository.cxx8
-rw-r--r--basic/source/basmgr/vbahelper.cxx5
-rw-r--r--basic/source/classes/eventatt.cxx48
-rw-r--r--basic/source/classes/sbxmod.cxx10
4 files changed, 31 insertions, 40 deletions
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index 5f0078d67660..7175fe93ebe3 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <svtools/ehdl.hxx>
#include <svtools/sfxecode.hxx>
#include <unotools/pathoptions.hxx>
@@ -52,7 +53,9 @@ namespace basic
/** === begin UNO using === **/
using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::frame::Desktop;
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::embed::XStorage;
@@ -328,9 +331,8 @@ namespace basic
// global constants
// StarDesktop
- Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory();
- pBasicManager->SetGlobalUNOConstant( "StarDesktop",
- makeAny( xSMgr->createInstance("com.sun.star.frame.Desktop")));
+ Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+ pBasicManager->SetGlobalUNOConstant( "StarDesktop", makeAny( Desktop::create(xContext)));
// (BasicLibraries and DialogLibraries have automatically been added in SetLibraryContainerInfo)
diff --git a/basic/source/basmgr/vbahelper.cxx b/basic/source/basmgr/vbahelper.cxx
index d5c24667f39a..d1c34e4025c8 100644
--- a/basic/source/basmgr/vbahelper.cxx
+++ b/basic/source/basmgr/vbahelper.cxx
@@ -23,7 +23,7 @@
#include <map>
#include <vector>
#include <com/sun/star/container/XEnumeration.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -70,8 +70,7 @@ DocumentsEnumeration::DocumentsEnumeration( const uno::Reference< frame::XModel
{
uno::Reference< frame::XModuleManager2 > xModuleManager( lclCreateModuleManager() );
::rtl::OUString aIdentifier = xModuleManager->identify( rxModel );
- uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XDesktop > xDesktop( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( ::comphelper::getProcessComponentContext() );
uno::Reference< container::XEnumerationAccess > xComponentsEA( xDesktop->getComponents(), uno::UNO_SET_THROW );
uno::Reference< container::XEnumeration > xEnumeration( xComponentsEA->createEnumeration(), uno::UNO_SET_THROW );
while( xEnumeration->hasMoreElements() )
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* );
};