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 --- .../Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx | 7 +++---- odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx | 7 ++++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'odk') diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx index daf02152559d..fb35eeda7321 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx @@ -36,11 +36,12 @@ #include #include #include +#include #include #include #include #include -#include +#include #include #include #include @@ -104,9 +105,7 @@ void SAL_CALL Addon::initialize( const Sequence< Any >& aArguments ) throw ( Exc } // Create the toolkit to have access to it later - mxToolkit = Reference< XToolkit >( mxMSF->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.awt.Toolkit" ))), UNO_QUERY ); + mxToolkit = Reference< XToolkit >( Toolkit::create(comphelper::getComponentContext(mxMSF)), UNO_QUERY_THROW ); } /** diff --git a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx index 98a897acc22d..71537c5454c6 100644 --- a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx +++ b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +54,7 @@ #include #include +#include #include using namespace com::sun::star::uno; @@ -77,9 +79,8 @@ ListenerHelper aListenerHelper; void BaseDispatch::ShowMessageBox( const Reference< XFrame >& rFrame, const ::rtl::OUString& aTitle, const ::rtl::OUString& aMsgText ) { if ( !mxToolkit.is() ) - mxToolkit = Reference< XToolkit > ( mxMSF->createInstance( - ::rtl::OUString( "com.sun.star.awt.Toolkit" )), UNO_QUERY ); - if ( rFrame.is() && mxToolkit.is() ) + mxToolkit = Reference< XToolkit > ( Toolkit::create(comphelper::getComponentContext(mxMSF)), UNO_QUERY_THROW ); + if ( rFrame.is() ) { // describe window properties. WindowDescriptor aDescriptor; -- cgit