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 --- desktop/source/deployment/gui/dp_gui_updatedialog.cxx | 14 +++----------- desktop/test/deployment/active/active_native.cxx | 10 +++++----- desktop/test/deployment/passive/passive_native.cxx | 10 +++++----- 3 files changed, 13 insertions(+), 21 deletions(-) (limited to 'desktop') diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 27ca935f394f..129663a28dec 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -42,7 +42,7 @@ #include "com/sun/star/awt/WindowAttribute.hpp" #include "com/sun/star/awt/WindowClass.hpp" #include "com/sun/star/awt/WindowDescriptor.hpp" -#include "com/sun/star/awt/XToolkit.hpp" +#include "com/sun/star/awt/Toolkit.hpp" #include "com/sun/star/awt/XWindow.hpp" #include "com/sun/star/awt/XWindowPeer.hpp" #include "com/sun/star/beans/NamedValue.hpp" @@ -554,17 +554,9 @@ UpdateDialog::UpdateDialog( m_xExtensionManager = deployment::ExtensionManager::get( context ); - uno::Reference< awt::XToolkit > toolkit; + uno::Reference< awt::XToolkit2 > toolkit; try { - toolkit = uno::Reference< awt::XToolkit >( - (uno::Reference< lang::XMultiComponentFactory >( - m_context->getServiceManager(), - uno::UNO_QUERY_THROW)-> - createInstanceWithContext( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")), - m_context)), - uno::UNO_QUERY_THROW); + toolkit = awt::Toolkit::create(m_context); } catch (const uno::RuntimeException &) { throw; } catch (const uno::Exception & e) { diff --git a/desktop/test/deployment/active/active_native.cxx b/desktop/test/deployment/active/active_native.cxx index 9845fd511168..493728d44c3a 100644 --- a/desktop/test/deployment/active/active_native.cxx +++ b/desktop/test/deployment/active/active_native.cxx @@ -31,6 +31,7 @@ #include "boost/noncopyable.hpp" #include "com/sun/star/awt/MessageBoxButtons.hpp" #include "com/sun/star/awt/Rectangle.hpp" +#include "com/sun/star/awt/Toolkit.hpp" #include "com/sun/star/awt/XMessageBox.hpp" #include "com/sun/star/awt/XMessageBoxFactory.hpp" #include "com/sun/star/awt/XWindowPeer.hpp" @@ -235,13 +236,12 @@ void Dispatch::dispatch( css::uno::Sequence< css::beans::PropertyValue > const &) throw (css::uno::RuntimeException) { - css::uno::Reference< css::lang::XMultiComponentFactory > smgr( - context_->getServiceManager(), css::uno::UNO_SET_THROW); + css::uno::Reference< css::lang::XMultiComponentFactory > smgr( context_->getServiceManager(), css::uno::UNO_SET_THROW); + css::uno::Reference< css::awt::XToolkit > toolkit( css::awt::Toolkit::create(context_), css::uno::UNO_SET_THROW); + css::uno::Reference< css::awt::XMessageBox > box( css::uno::Reference< css::awt::XMessageBoxFactory >( - smgr->createInstanceWithContext( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.awt.Toolkit")), context_), + toolkit, css::uno::UNO_QUERY_THROW)->createMessageBox( css::uno::Reference< css::awt::XWindowPeer >( css::uno::Reference< css::frame::XFrame >( diff --git a/desktop/test/deployment/passive/passive_native.cxx b/desktop/test/deployment/passive/passive_native.cxx index 0da885d5a31d..5e409f6cb30d 100644 --- a/desktop/test/deployment/passive/passive_native.cxx +++ b/desktop/test/deployment/passive/passive_native.cxx @@ -32,6 +32,7 @@ #include "com/sun/star/awt/MessageBoxButtons.hpp" #include "com/sun/star/awt/Rectangle.hpp" #include "com/sun/star/awt/XMessageBox.hpp" +#include "com/sun/star/awt/Toolkit.hpp" #include "com/sun/star/awt/XMessageBoxFactory.hpp" #include "com/sun/star/awt/XWindowPeer.hpp" #include "com/sun/star/beans/PropertyValue.hpp" @@ -233,13 +234,12 @@ void Dispatch::dispatch( css::uno::Sequence< css::beans::PropertyValue > const &) throw (css::uno::RuntimeException) { - css::uno::Reference< css::lang::XMultiComponentFactory > smgr( - context_->getServiceManager(), css::uno::UNO_SET_THROW); + css::uno::Reference< css::lang::XMultiComponentFactory > smgr(context_->getServiceManager(), css::uno::UNO_SET_THROW); + css::uno::Reference< css::awt::XToolkit > toolkit( css::awt::Toolkit::create(context_), css::uno::UNO_SET_THROW); + css::uno::Reference< css::awt::XMessageBox > box( css::uno::Reference< css::awt::XMessageBoxFactory >( - smgr->createInstanceWithContext( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.awt.Toolkit")), context_), + toolkit, css::uno::UNO_QUERY_THROW)->createMessageBox( css::uno::Reference< css::awt::XWindowPeer >( css::uno::Reference< css::frame::XFrame >( -- cgit