From 33a0f8ce656c8c5bb9c3c3deaa10c182e262b374 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 17 Oct 2012 10:52:52 +0200 Subject: fdo#46808, Adapt awt::Toolkit UNO service to new style Create a merged XToolkit2 interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Also mark sub-interfaces as non-optional. Change-Id: I278d0288e92be277033013302267cf93f7d70480 --- toolkit/inc/toolkit/awt/vclxtoolkit.hxx | 15 +++------------ toolkit/source/awt/vclxtoolkit.cxx | 9 ++------- toolkit/source/helper/vclunohelper.cxx | 12 ++++-------- 3 files changed, 9 insertions(+), 27 deletions(-) (limited to 'toolkit') diff --git a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx index d8bd1c91878c..32a401682ecd 100644 --- a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx +++ b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx @@ -21,14 +21,10 @@ #define _TOOLKIT_AWT_VCLXTOOLKIT_HXX_ #include -#include #include -#include #include -#include -#include #include -#include +#include #include "cppuhelper/interfacecontainer.hxx" #include #include @@ -69,14 +65,9 @@ protected: }; class VCLXToolkit : public VCLXToolkit_Impl, - public cppu::WeakComponentImplHelper7< + public cppu::WeakComponentImplHelper2< ::com::sun::star::awt::XToolkitExperimental, - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::awt::XSystemChildFactory, - ::com::sun::star::awt::XMessageBoxFactory, - ::com::sun::star::awt::XDataTransferProviderAccess, - ::com::sun::star::awt::XExtendedToolkit, - ::com::sun::star::awt::XReschedule > + ::com::sun::star::lang::XServiceInfo > { ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxClipboard; ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxSelection; diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 173d23cfbadf..f320d19b9dac 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -463,14 +463,9 @@ static void SAL_CALL ToolkitWorkerFunction( void* pArgs ) // contructor, which might initialize VCL VCLXToolkit::VCLXToolkit( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ): - cppu::WeakComponentImplHelper7< + cppu::WeakComponentImplHelper2< ::com::sun::star::awt::XToolkitExperimental, - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::awt::XSystemChildFactory, - ::com::sun::star::awt::XMessageBoxFactory, - ::com::sun::star::awt::XDataTransferProviderAccess, - ::com::sun::star::awt::XExtendedToolkit, - ::com::sun::star::awt::XReschedule>( GetMutex() ), + ::com::sun::star::lang::XServiceInfo>( GetMutex() ), m_aTopWindowListeners(rBHelper.rMutex), m_aKeyHandlers(rBHelper.rMutex), m_aFocusListeners(rBHelper.rMutex), diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index 0cdffe41e305..496839ad1723 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -53,6 +53,7 @@ #include #include +#include #include #include @@ -62,15 +63,10 @@ using namespace ::com::sun::star; // class VCLUnoHelper // ---------------------------------------------------- -::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> VCLUnoHelper::CreateToolkit() +uno::Reference< ::com::sun::star::awt::XToolkit> VCLUnoHelper::CreateToolkit() { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) ); - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> xToolkit; - if ( xI.is() ) - xToolkit = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>( xI, ::com::sun::star::uno::UNO_QUERY ); - + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + uno::Reference< awt::XToolkit> xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW ); return xToolkit; } -- cgit