[Libreoffice-commits] .: 6 commits - android/experimental comphelper/inc comphelper/source desktop/source desktop/test embeddedobj/source embedserv/source extensions/source fpicker/source framework/inc framework/source odk/examples offapi/com offapi/type_reference offapi/UnoApi_offapi.mk package/source scripting/source sdext/source sd/workben sfx2/workben slideshow/source sw/source toolkit/inc toolkit/source touch/source ucb/source UnoControls/inc UnoControls/source vcl/unx xmlhelp/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 24 07:51:23 PDT 2012


 UnoControls/inc/basecontainercontrol.hxx                                                     |    2 
 UnoControls/inc/basecontrol.hxx                                                              |    6 
 UnoControls/source/base/basecontainercontrol.cxx                                             |    4 
 UnoControls/source/base/basecontrol.cxx                                                      |   15 +
 UnoControls/source/base/registercontrols.cxx                                                 |    3 
 UnoControls/source/controls/framecontrol.cxx                                                 |   12 -
 UnoControls/source/controls/progressbar.cxx                                                  |    4 
 UnoControls/source/controls/progressmonitor.cxx                                              |   28 +--
 UnoControls/source/controls/statusindicator.cxx                                              |   10 -
 UnoControls/source/inc/framecontrol.hxx                                                      |    2 
 UnoControls/source/inc/progressbar.hxx                                                       |    2 
 UnoControls/source/inc/progressmonitor.hxx                                                   |    2 
 UnoControls/source/inc/statusindicator.hxx                                                   |    2 
 android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java |    6 
 android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java     |    6 
 android/experimental/LibreOffice4Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java   |    6 
 comphelper/inc/comphelper/seekableinput.hxx                                                  |    8 -
 comphelper/source/streaming/seekableinput.cxx                                                |   14 -
 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 -
 embeddedobj/source/general/docholder.cxx                                                     |    8 -
 embedserv/source/embed/docholder.cxx                                                         |   60 +++----
 extensions/source/nsplugin/source/so_instance.cxx                                            |   25 ---
 fpicker/source/win32/filepicker/VistaFilePicker.cxx                                          |    5 
 fpicker/source/win32/folderpicker/FolderPicker.hxx                                           |    2 
 framework/inc/services.h                                                                     |    2 
 framework/inc/tabwin/tabwinfactory.hxx                                                       |    4 
 framework/source/dispatch/menudispatcher.cxx                                                 |    1 
 framework/source/dispatch/popupmenudispatcher.cxx                                            |    1 
 framework/source/layoutmanager/helpers.cxx                                                   |   38 ++---
 framework/source/layoutmanager/helpers.hxx                                                   |    6 
 framework/source/layoutmanager/toolbarlayoutmanager.cxx                                      |   11 -
 framework/source/layoutmanager/toolbarlayoutmanager.hxx                                      |    3 
 framework/source/services/backingcomp.cxx                                                    |   27 +--
 framework/source/services/desktop.cxx                                                        |    1 
 framework/source/services/frame.cxx                                                          |   27 +--
 framework/source/services/taskcreatorsrv.cxx                                                 |    3 
 framework/source/tabwin/tabwindow.cxx                                                        |    6 
 framework/source/tabwin/tabwinfactory.cxx                                                    |   51 +++---
 framework/source/uifactory/windowcontentfactorymanager.cxx                                   |    1 
 odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx            |    7 
 odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx                                |    7 
 offapi/UnoApi_offapi.mk                                                                      |    3 
 offapi/com/sun/star/awt/Toolkit.idl                                                          |   19 --
 offapi/com/sun/star/awt/XToolkit2.idl                                                        |   63 ++++----
 offapi/com/sun/star/awt/XToolkitExperimental.idl                                             |   50 ++++++
 offapi/type_reference/types.rdb                                                              |binary
 package/source/zippackage/ZipPackage.cxx                                                     |    2 
 package/source/zippackage/ZipPackageStream.cxx                                               |    4 
 scripting/source/dlgprov/dlgprov.cxx                                                         |    7 
 sd/workben/custompanel/ctp_panel.cxx                                                         |    7 
 sdext/source/minimizer/unodialog.cxx                                                         |    3 
 sdext/source/presenter/PresenterSlideShowView.cxx                                            |    7 
 sfx2/workben/custompanel/ctp_panel.cxx                                                       |    7 
 slideshow/source/engine/shapes/viewappletshape.cxx                                           |    8 -
 sw/source/ui/utlui/unotools.cxx                                                              |   76 +++++-----
 toolkit/inc/toolkit/awt/vclxtoolkit.hxx                                                      |   21 --
 toolkit/source/awt/vclxtoolkit.cxx                                                           |   11 -
 toolkit/source/helper/vclunohelper.cxx                                                       |   12 -
 touch/source/uno/Document.cxx                                                                |    6 
 ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx                                             |    7 
 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx                                                     |    3 
 vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx                                                   |    3 
 xmlhelp/source/cxxhelp/provider/databases.cxx                                                |   26 +--
 65 files changed, 386 insertions(+), 421 deletions(-)

New commits:
commit cc6ec92330ca304f7b8bdb6fb661317141b96882
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 24 16:49:39 2012 +0200

    Related fdo#46808: Adapt Windows-only code to previous changes
    
    Change-Id: I115fa92ecf0cbcd6159d0de900e5174fe3c96d18

diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
index f05aefc..da1cc07 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
@@ -38,6 +38,7 @@
 
 #include <cppuhelper/interfacecontainer.h>
 #include <comphelper/configurationhelper.hxx>
+#include <comphelper/processfactory.hxx>
 #include <osl/diagnose.h>
 #include <osl/mutex.hxx>
 #include <osl/file.hxx>
@@ -221,13 +222,13 @@ void SAL_CALL VistaFilePicker::setDisplayDirectory(const ::rtl::OUString& sDirec
     const ::rtl::OUString aKey( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged"));
 
     css::uno::Any aValue = ::comphelper::ConfigurationHelper::readDirectKey(
-        m_xSMGR, aPackage, aRelPath, aKey, ::comphelper::ConfigurationHelper::E_READONLY);
+        comphelper::getComponentContext(m_xSMGR), aPackage, aRelPath, aKey, ::comphelper::ConfigurationHelper::E_READONLY);
 
     bool bChanged(false);
     if (( aValue >>= bChanged ) && bChanged )
     {
         ::comphelper::ConfigurationHelper::writeDirectKey(
-            m_xSMGR, aPackage, aRelPath, aKey, css::uno::makeAny(false), ::comphelper::ConfigurationHelper::E_STANDARD);
+            comphelper::getComponentContext(m_xSMGR), aPackage, aRelPath, aKey, css::uno::makeAny(false), ::comphelper::ConfigurationHelper::E_STANDARD);
     }
 
     RequestRef rRequest(new Request());
diff --git a/fpicker/source/win32/folderpicker/FolderPicker.hxx b/fpicker/source/win32/folderpicker/FolderPicker.hxx
index c7bca82..1f1e4c8 100644
--- a/fpicker/source/win32/folderpicker/FolderPicker.hxx
+++ b/fpicker/source/win32/folderpicker/FolderPicker.hxx
@@ -24,7 +24,7 @@
 #include <osl/mutex.hxx>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 
-#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
 #include <com/sun/star/util/XCancellable.hpp>
 
 #include <memory>
commit 69c1bacdd122478ae541369bb8396b5c259e67e0
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Oct 17 12:25:03 2012 +0200

    remove unused #define

diff --git a/framework/inc/services.h b/framework/inc/services.h
index 763c8d0..6af3d9a 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -51,7 +51,6 @@ namespace framework{
 #define SERVICENAME_CONTENTHANDLER                              DECLARE_ASCII("com.sun.star.frame.ContentHandler"                   )
 #define SERVICENAME_CONTENTHANDLERFACTORY                       DECLARE_ASCII("com.sun.star.frame.ContentHandlerFactory"            )
 #define SERVICENAME_STATUSINDICATORFACTORY                      DECLARE_ASCII("com.sun.star.task.StatusIndicatorFactory"            )
-#define SERVICENAME_UIINTERACTIONHANDLER                        DECLARE_ASCII("com.sun.star.task.InteractionHandler"                )
 #define SERVICENAME_JOBEXECUTOR                                 DECLARE_ASCII("com.sun.star.task.JobExecutor"                       )
 #define SERVICENAME_JOB                                         DECLARE_ASCII("com.sun.star.task.Job"                               )
 #define SERVICENAME_DISPATCHRECORDERSUPPLIER                    DECLARE_ASCII("com.sun.star.frame.DispatchRecorderSupplier"         )
commit d3efa1d00da2aba4474d785d0b88885686170884
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 24 16:08:13 2012 +0200

    Related fdo#46808: Improve previous commit slightly
    
    Change-Id: I95da6e3082a3ebd0bebabf233497ae40d6398fdd

diff --git a/extensions/source/nsplugin/source/so_instance.cxx b/extensions/source/nsplugin/source/so_instance.cxx
index a86ddbe..030fd93 100644
--- a/extensions/source/nsplugin/source/so_instance.cxx
+++ b/extensions/source/nsplugin/source/so_instance.cxx
@@ -32,7 +32,6 @@
 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
 #include <com/sun/star/lang/SystemDependent.hpp>
 #include <com/sun/star/awt/Toolkit.hpp>
-#include <com/sun/star/awt/XSystemChildFactory.hpp>
 #include <com/sun/star/awt/XVclWindowPeer.hpp>
 #include <com/sun/star/util/XCloseable.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
@@ -137,7 +136,7 @@ sal_Bool SoPluginInstance::LoadDocument(NSP_HWND hParent)
         Reference< uno::XComponentContext > xContext( xFactoryProperties->getPropertyValue( "DefaultContext" ), UNO_QUERY );
 
         // try to create netscape plugin window
-        Reference< awt::XToolkit > xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW );
+        Reference< awt::XToolkit2 > xToolkit( awt::Toolkit::create(xContext) );
 
         // prepare parameters for plugin window
         css::uno::Any hwndParent = css::uno::makeAny((sal_Int32)hParent);
@@ -148,18 +147,11 @@ sal_Bool SoPluginInstance::LoadDocument(NSP_HWND hParent)
         sal_Int16 nWindowType = css::lang::SystemDependent::SYSTEM_WIN32;
 #endif //end of WNT
 
-        Reference< awt::XSystemChildFactory > xToolkitSystemChildFactory(xToolkit, uno::UNO_QUERY);
-        if (!xToolkitSystemChildFactory.is())
-        {
-            debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin, get xToolkitSystemChildFactory failure.\n");
-            return sal_False;
-        }
-
         debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin,  try to create plugin container window HWIN:%ld.\n", hParent);
 
         // create the plugin window
         Reference< awt::XWindowPeer > xNewWinPeer =
-            xToolkitSystemChildFactory->createSystemChild( hwndParent,
+            xToolkit->createSystemChild( hwndParent,
                 css::uno::Sequence<sal_Int8>(), nWindowType );
         if ( !xNewWinPeer.is() )
         {
commit 33a0f8ce656c8c5bb9c3c3deaa10c182e262b374
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Oct 17 10:52:52 2012 +0200

    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

diff --git a/UnoControls/inc/basecontainercontrol.hxx b/UnoControls/inc/basecontainercontrol.hxx
index 857a8d7..a6a0906 100644
--- a/UnoControls/inc/basecontainercontrol.hxx
+++ b/UnoControls/inc/basecontainercontrol.hxx
@@ -78,7 +78,7 @@ public:
         @onerror    -
     */
 
-       BaseContainerControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+       BaseContainerControl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
 
     /**_______________________________________________________________________________________________________
         @short      -
diff --git a/UnoControls/inc/basecontrol.hxx b/UnoControls/inc/basecontrol.hxx
index f54033e..0aa633d 100644
--- a/UnoControls/inc/basecontrol.hxx
+++ b/UnoControls/inc/basecontrol.hxx
@@ -144,7 +144,7 @@ public:
         @onerror    -
     */
 
-    BaseControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+    BaseControl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
 
     /**_______________________________________________________________________________________________________
         @short      -
@@ -1049,7 +1049,7 @@ protected:
         @onerror    -
     */
 
-    const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > impl_getMultiServiceFactory();
+    const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > impl_getComponentContext();
 
     /**_______________________________________________________________________________________________________
         @short      -
@@ -1217,7 +1217,7 @@ private:
 
 private:
 
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >    m_xFactory              ;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >        m_xComponentContext     ;
     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >               m_xDelegator            ;
     OMRCListenerMultiplexerHelper*                  m_pMultiplexer          ;   // multiplex events
     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >               m_xMultiplexer          ;
diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx
index 83bedbf..2ef9a9e 100644
--- a/UnoControls/source/base/basecontainercontrol.cxx
+++ b/UnoControls/source/base/basecontainercontrol.cxx
@@ -39,8 +39,8 @@ namespace unocontrols{
 //  construct/destruct
 //____________________________________________________________________________________________________________
 
-BaseContainerControl::BaseContainerControl( const Reference< XMultiServiceFactory >& xFactory )
-    : BaseControl   ( xFactory  )
+BaseContainerControl::BaseContainerControl( const Reference< XComponentContext >& rxContext )
+    : BaseControl   ( rxContext  )
     , m_aListeners  ( m_aMutex  )
 {
 }
diff --git a/UnoControls/source/base/basecontrol.cxx b/UnoControls/source/base/basecontrol.cxx
index 068317b..02e3a04 100644
--- a/UnoControls/source/base/basecontrol.cxx
+++ b/UnoControls/source/base/basecontrol.cxx
@@ -24,6 +24,8 @@
 #include <com/sun/star/awt/DeviceInfo.hpp>
 #include <com/sun/star/awt/WindowAttribute.hpp>
 #include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
+#include <comphelper/processfactory.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/typeprovider.hxx>
 
@@ -48,16 +50,15 @@ namespace unocontrols{
 #define DEFAULT_VISIBLE                     sal_False
 #define DEFAULT_INDESIGNMODE                sal_False
 #define DEFAULT_ENABLE                      sal_True
-#define SERVICE_VCLTOOLKIT                  "com.sun.star.awt.Toolkit"
 
 //____________________________________________________________________________________________________________
 //  construct/destruct
 //____________________________________________________________________________________________________________
 
-BaseControl::BaseControl( const Reference< XMultiServiceFactory >& xFactory )
+BaseControl::BaseControl( const Reference< XComponentContext >& rxContext )
     : IMPL_MutexContainer       (                       )
     , OComponentHelper          ( m_aMutex              )
-    , m_xFactory    ( xFactory              )
+    , m_xComponentContext       ( rxContext              )
     , m_pMultiplexer            ( DEFAULT_PMULTIPLEXER  )
     , m_nX                      ( DEFAULT_X             )
     , m_nY                      ( DEFAULT_Y             )
@@ -335,8 +336,8 @@ void SAL_CALL BaseControl::createPeer(  const   Reference< XToolkit >&      xToo
         Reference< XToolkit > xLocalToolkit = xToolkit ;
         if ( xLocalToolkit.is() == sal_False )
         {
-            // but first create wellknown toolkit, if it not exist
-            xLocalToolkit = Reference< XToolkit > ( m_xFactory->createInstance( SERVICE_VCLTOOLKIT ), UNO_QUERY );
+            // but first create well known toolkit, if it not exist
+            xLocalToolkit = Reference< XToolkit > ( Toolkit::create(m_xComponentContext), UNO_QUERY_THROW );
         }
         m_xPeer         = xLocalToolkit->createWindow( *pDescriptor );
         m_xPeerWindow   = Reference< XWindow >( m_xPeer, UNO_QUERY );
@@ -848,9 +849,9 @@ const OUString BaseControl::impl_getStaticImplementationName()
 //  protected method
 //____________________________________________________________________________________________________________
 
-const Reference< XMultiServiceFactory > BaseControl::impl_getMultiServiceFactory()
+const Reference< XComponentContext > BaseControl::impl_getComponentContext()
 {
-    return m_xFactory ;
+    return m_xComponentContext ;
 }
 
 //____________________________________________________________________________________________________________
diff --git a/UnoControls/source/base/registercontrols.cxx b/UnoControls/source/base/registercontrols.cxx
index 5738fec..dfcdfb0 100644
--- a/UnoControls/source/base/registercontrols.cxx
+++ b/UnoControls/source/base/registercontrols.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <comphelper/processfactory.hxx>
 #include <cppuhelper/factory.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
@@ -55,7 +56,7 @@ using namespace ::com::sun::star::registry                      ;
                                                                                                                                             \
     static Reference< XInterface > SAL_CALL CLASS##_createInstance ( const Reference< XMultiServiceFactory >& rServiceManager ) throw ( Exception ) \
     {                                                                                                                                       \
-        return Reference< XInterface >( *(OWeakObject*)(new CLASS( rServiceManager )) );                                                    \
+        return Reference< XInterface >( *(OWeakObject*)(new CLASS( comphelper::getComponentContext(rServiceManager) )) );                                                    \
     }
 
 //******************************************************************************************************************************
diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx
index 53f2ce0..27afd5d 100644
--- a/UnoControls/source/controls/framecontrol.cxx
+++ b/UnoControls/source/controls/framecontrol.cxx
@@ -49,8 +49,8 @@ namespace unocontrols{
 //  construct/destruct
 //______________________________________________________________________________________________________________
 
-FrameControl::FrameControl( const Reference< XMultiServiceFactory >& xFactory )
-    : BaseControl                   ( xFactory                                                                              )
+FrameControl::FrameControl( const Reference< XComponentContext >& rxContext)
+    : BaseControl                   ( rxContext                                                                             )
     , OBroadcastHelper              ( m_aMutex                                                                              )
     , OPropertySetHelper            ( *(static_cast< OBroadcastHelper * >(this))  )
     , m_aInterfaceContainer         ( m_aMutex                                                                              )
@@ -467,7 +467,9 @@ void FrameControl::impl_createFrame(    const   Reference< XWindowPeer >&   xPee
         xOldFrame = m_xFrame ;
     }
 
-    xNewFrame = Reference< XFrame >  ( impl_getMultiServiceFactory()->createInstance ( "com.sun.star.frame.Frame" ), UNO_QUERY ) ;
+
+
+    xNewFrame = Reference< XFrame >  ( impl_getComponentContext()->getServiceManager()->createInstanceWithContext("com.sun.star.frame.Frame", impl_getComponentContext()), UNO_QUERY ) ;
     Reference< XDispatchProvider >  xDSP ( xNewFrame, UNO_QUERY ) ;
 
     if (xDSP.is())
@@ -478,9 +480,7 @@ void FrameControl::impl_createFrame(    const   Reference< XWindowPeer >&   xPee
         //  option
         //xFrame->setName( "WhatYouWant" );
 
-        Reference< XURLTransformer >  xTrans (
-               URLTransformer::create(
-                   ::comphelper::getComponentContext( impl_getMultiServiceFactory() ) ) );
+        Reference< XURLTransformer > xTrans = URLTransformer::create( impl_getComponentContext() );
         // load file
         URL aURL ;
 
diff --git a/UnoControls/source/controls/progressbar.cxx b/UnoControls/source/controls/progressbar.cxx
index aff0ff0..ce7c5eb 100644
--- a/UnoControls/source/controls/progressbar.cxx
+++ b/UnoControls/source/controls/progressbar.cxx
@@ -42,8 +42,8 @@ namespace unocontrols{
 //  construct/destruct
 //____________________________________________________________________________________________________________
 
-ProgressBar::ProgressBar( const Reference< XMultiServiceFactory >& xFactory )
-    : BaseControl           (    xFactory                   )
+ProgressBar::ProgressBar( const Reference< XComponentContext >& rxContext )
+    : BaseControl           (    rxContext                   )
     , m_bHorizontal         (    PROGRESSBAR_DEFAULT_HORIZONTAL         )
     , m_aBlockSize          (    PROGRESSBAR_DEFAULT_BLOCKDIMENSION     )
     , m_nForegroundColor    (    PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR    )
diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx
index cea1990..ef4d53f 100644
--- a/UnoControls/source/controls/progressmonitor.cxx
+++ b/UnoControls/source/controls/progressmonitor.cxx
@@ -47,20 +47,21 @@ namespace unocontrols{
 //  construct/destruct
 //____________________________________________________________________________________________________________
 
-ProgressMonitor::ProgressMonitor( const Reference< XMultiServiceFactory >& xFactory )
-    : BaseContainerControl  ( xFactory  )
+ProgressMonitor::ProgressMonitor( const Reference< XComponentContext >& rxContext )
+    : BaseContainerControl  ( rxContext  )
 {
     // Its not allowed to work with member in this method (refcounter !!!)
     // But with a HACK (++refcount) its "OK" :-(
     ++m_refCount ;
 
     // Create instances for fixedtext, button and progress ...
-    m_xTopic_Top    = Reference< XFixedText >   ( xFactory->createInstance ( FIXEDTEXT_SERVICENAME ), UNO_QUERY ) ;
-    m_xText_Top     = Reference< XFixedText >   ( xFactory->createInstance ( FIXEDTEXT_SERVICENAME ), UNO_QUERY ) ;
-    m_xTopic_Bottom = Reference< XFixedText >   ( xFactory->createInstance ( FIXEDTEXT_SERVICENAME ), UNO_QUERY ) ;
-    m_xText_Bottom  = Reference< XFixedText >   ( xFactory->createInstance ( FIXEDTEXT_SERVICENAME ), UNO_QUERY ) ;
-    m_xButton       = Reference< XButton >      ( xFactory->createInstance ( BUTTON_SERVICENAME ), UNO_QUERY ) ;
-    m_xProgressBar  = Reference< XProgressBar > ( xFactory->createInstance ( SERVICENAME_PROGRESSBAR ), UNO_QUERY ) ;
+
+    m_xTopic_Top    = Reference< XFixedText >   ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY ) ;
+    m_xText_Top     = Reference< XFixedText >   ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY ) ;
+    m_xTopic_Bottom = Reference< XFixedText >   ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY ) ;
+    m_xText_Bottom  = Reference< XFixedText >   ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY ) ;
+    m_xButton       = Reference< XButton >      ( rxContext->getServiceManager()->createInstanceWithContext( BUTTON_SERVICENAME, rxContext ), UNO_QUERY ) ;
+    m_xProgressBar  = Reference< XProgressBar > ( rxContext->getServiceManager()->createInstanceWithContext( SERVICENAME_PROGRESSBAR, rxContext ), UNO_QUERY ) ;
 
     // ... cast controls to Reference< XControl >  (for "setModel"!) ...
     Reference< XControl >   xRef_Topic_Top      ( m_xTopic_Top    , UNO_QUERY ) ;
@@ -70,12 +71,13 @@ ProgressMonitor::ProgressMonitor( const Reference< XMultiServiceFactory >& xFact
     Reference< XControl >   xRef_Button         ( m_xButton       , UNO_QUERY ) ;
     Reference< XControl >   xRef_ProgressBar    ( m_xProgressBar  , UNO_QUERY ) ;
 
+
     // ... set models ...
-    xRef_Topic_Top->setModel    ( Reference< XControlModel > ( xFactory->createInstance ( FIXEDTEXT_MODELNAME ), UNO_QUERY ) ) ;
-    xRef_Text_Top->setModel     ( Reference< XControlModel > ( xFactory->createInstance ( FIXEDTEXT_MODELNAME ), UNO_QUERY ) ) ;
-    xRef_Topic_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( FIXEDTEXT_MODELNAME ), UNO_QUERY ) ) ;
-    xRef_Text_Bottom->setModel  ( Reference< XControlModel > ( xFactory->createInstance ( FIXEDTEXT_MODELNAME ), UNO_QUERY ) ) ;
-    xRef_Button->setModel       ( Reference< XControlModel > ( xFactory->createInstance ( BUTTON_MODELNAME ), UNO_QUERY ) ) ;
+    xRef_Topic_Top->setModel    ( Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) ) ;
+    xRef_Text_Top->setModel     ( Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) ) ;
+    xRef_Topic_Bottom->setModel ( Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) ) ;
+    xRef_Text_Bottom->setModel  ( Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) ) ;
+    xRef_Button->setModel       ( Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext( BUTTON_MODELNAME, rxContext ), UNO_QUERY ) ) ;
     // ProgressBar has no model !!!
 
     // ... and add controls to basecontainercontrol!
diff --git a/UnoControls/source/controls/statusindicator.cxx b/UnoControls/source/controls/statusindicator.cxx
index 87d44a2..a3e9515 100644
--- a/UnoControls/source/controls/statusindicator.cxx
+++ b/UnoControls/source/controls/statusindicator.cxx
@@ -39,21 +39,21 @@ namespace unocontrols{
 //  construct/destruct
 //____________________________________________________________________________________________________________
 
-StatusIndicator::StatusIndicator( const Reference< XMultiServiceFactory >& xFactory )
-    : BaseContainerControl  ( xFactory  )
+StatusIndicator::StatusIndicator( const Reference< XComponentContext >& rxContext )
+    : BaseContainerControl  ( rxContext  )
 {
     // Its not allowed to work with member in this method (refcounter !!!)
     // But with a HACK (++refcount) its "OK" :-(
     ++m_refCount ;
 
     // Create instances for fixedtext and progress ...
-    m_xText         = Reference< XFixedText >   ( xFactory->createInstance( FIXEDTEXT_SERVICENAME ), UNO_QUERY );
-    m_xProgressBar  = Reference< XProgressBar > ( xFactory->createInstance( SERVICENAME_PROGRESSBAR ), UNO_QUERY );
+    m_xText         = Reference< XFixedText >   ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY );
+    m_xProgressBar  = Reference< XProgressBar > ( rxContext->getServiceManager()->createInstanceWithContext( SERVICENAME_PROGRESSBAR, rxContext ), UNO_QUERY );
     // ... cast controls to Reference< XControl > and set model ...
     // ( ProgressBar has no model !!! )
     Reference< XControl > xTextControl      ( m_xText       , UNO_QUERY );
     Reference< XControl > xProgressControl  ( m_xProgressBar, UNO_QUERY );
-    xTextControl->setModel( Reference< XControlModel >( xFactory->createInstance( FIXEDTEXT_MODELNAME ), UNO_QUERY ) );
+    xTextControl->setModel( Reference< XControlModel >( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) );
     // ... and add controls to basecontainercontrol!
     addControl( CONTROLNAME_TEXT, xTextControl    );
     addControl( CONTROLNAME_PROGRESSBAR, xProgressControl    );
diff --git a/UnoControls/source/inc/framecontrol.hxx b/UnoControls/source/inc/framecontrol.hxx
index 7f4340c..ca913f6 100644
--- a/UnoControls/source/inc/framecontrol.hxx
+++ b/UnoControls/source/inc/framecontrol.hxx
@@ -84,7 +84,7 @@ public:
         @onerror
     */
 
-    FrameControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+    FrameControl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
 
     /**_________________________________________________________________________________________________________
         @short
diff --git a/UnoControls/source/inc/progressbar.hxx b/UnoControls/source/inc/progressbar.hxx
index 8fb3d8b..1c8d892 100644
--- a/UnoControls/source/inc/progressbar.hxx
+++ b/UnoControls/source/inc/progressbar.hxx
@@ -73,7 +73,7 @@ public:
         @onerror
     */
 
-    ProgressBar( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+    ProgressBar( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
 
     /**_________________________________________________________________________________________________________
         @short
diff --git a/UnoControls/source/inc/progressmonitor.hxx b/UnoControls/source/inc/progressmonitor.hxx
index 3915b46..163dc09 100644
--- a/UnoControls/source/inc/progressmonitor.hxx
+++ b/UnoControls/source/inc/progressmonitor.hxx
@@ -128,7 +128,7 @@ public:
         @onerror
     */
 
-    ProgressMonitor( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+    ProgressMonitor( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
 
     /**_______________________________________________________________________________________________________
         @short
diff --git a/UnoControls/source/inc/statusindicator.hxx b/UnoControls/source/inc/statusindicator.hxx
index 688e186..300cfc6 100644
--- a/UnoControls/source/inc/statusindicator.hxx
+++ b/UnoControls/source/inc/statusindicator.hxx
@@ -84,7 +84,7 @@ class StatusIndicator   : public ::com::sun::star::awt::XLayoutConstrains
             @onerror
         */
 
-        StatusIndicator( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+        StatusIndicator( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
 
         /**_______________________________________________________________________________________________________
             @short
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 27ca935..129663a 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 9845fd5..493728d 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 0da885d..5e409f6 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 >(
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index 75643c9..c7e63d8 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -38,6 +38,7 @@
 #include <com/sun/star/frame/XControllerBorder.hpp>
 #include <com/sun/star/util/XModifyBroadcaster.hpp>
 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/XTopWindow.hpp>
 #include <com/sun/star/awt/PosSize.hpp>
 #include <com/sun/star/awt/XView.hpp>
@@ -454,11 +455,8 @@ sal_Bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >&
                                                 awt::Rectangle(),//aOwnRectangle,
                                                 awt::WindowAttribute::SHOW | awt::VclWindowPeerAttribute::CLIPCHILDREN );
 
-        uno::Reference< awt::XToolkit > xToolkit(
-                            m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" )) ),
-                            uno::UNO_QUERY );
-        if ( !xToolkit.is() )
-            throw uno::RuntimeException();
+        uno::Reference< awt::XToolkit2 > xToolkit =
+                            awt::Toolkit::create(comphelper::getComponentContext(m_xFactory));
 
         uno::Reference< awt::XWindowPeer > xNewWinPeer = xToolkit->createWindow( aOwnWinDescriptor );
         uno::Reference< awt::XWindow > xOwnWindow( xNewWinPeer, uno::UNO_QUERY );
diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx
index a2a91a5..cf2b71c 100644
--- a/embedserv/source/embed/docholder.cxx
+++ b/embedserv/source/embed/docholder.cxx
@@ -31,6 +31,7 @@
 #include "common.h"
 #include <Windows.h>
 #include <com/sun/star/lang/SystemDependent.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/XSystemChildFactory.hpp>
 #include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
 #include <com/sun/star/awt/XSystemDependentMenuPeer.hpp>
@@ -283,36 +284,32 @@ HRESULT DocumentHolder::InPlaceActivate(
             HWND                          hWndxWinParent(0);
             uno::Reference<awt::XWindow>  xWin;
 
-            static const ::rtl::OUString aToolkitServiceName(
-                RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.awt.Toolkit" ) );
-            uno::Reference<awt::XSystemChildFactory> xToolkit(
-                m_xFactory->createInstance(aToolkitServiceName ),uno::UNO_QUERY);
-
-            if(xToolkit.is()) {
-                // create system window wrapper for hwnd
-                if( !m_pCHatchWin )
-                    m_pCHatchWin = new winwrap::CHatchWin(
-                        m_hInstance,this);
-
-                if(m_pCHatchWin->Init(hWndSite,/*ID_HATCHWINDOW*/2000, NULL)) {
-                    m_pCHatchWin->RectsSet(&rcPos,&rcClip); //set visible area
-                    hWndxWinParent = m_pCHatchWin->Window();
-                    ShowWindow(hWndxWinParent,SW_SHOW);  //Make visible.
-                }
-                else {
-                    // no success initializing hatch window
-                    delete m_pCHatchWin, m_pCHatchWin = 0;
-                    hWndxWinParent = hWndSite;
-                }
+            uno::Reference<awt::XToolkit2> xToolkit =
+                awt::Toolkit::create(comphelper::getComponentContext(m_xFactory));
 
-                aAny <<= sal_Int32(hWndxWinParent);
-                xWin = uno::Reference<awt::XWindow>(
-                    xToolkit->createSystemChild(
-                        aAny,
-                        aProcessIdent,
-                        lang::SystemDependent::SYSTEM_WIN32),
-                    uno::UNO_QUERY);
+            // create system window wrapper for hwnd
+            if( !m_pCHatchWin )
+                m_pCHatchWin = new winwrap::CHatchWin(
+                    m_hInstance,this);
+
+            if(m_pCHatchWin->Init(hWndSite,/*ID_HATCHWINDOW*/2000, NULL)) {
+                m_pCHatchWin->RectsSet(&rcPos,&rcClip); //set visible area
+                hWndxWinParent = m_pCHatchWin->Window();
+                ShowWindow(hWndxWinParent,SW_SHOW);  //Make visible.
             }
+            else {
+                // no success initializing hatch window
+                delete m_pCHatchWin, m_pCHatchWin = 0;
+                hWndxWinParent = hWndSite;
+            }
+
+            aAny <<= sal_Int32(hWndxWinParent);
+            xWin = uno::Reference<awt::XWindow>(
+                xToolkit->createSystemChild(
+                    aAny,
+                    aProcessIdent,
+                    lang::SystemDependent::SYSTEM_WIN32),
+                uno::UNO_QUERY);
 
             if(xWin.is()) {
                 xWin->setPosSize(
@@ -1301,12 +1298,9 @@ DocumentHolder::getContainerWindow(
 
     uno::Reference<awt::XWindow> xWin(0);
 
-    static const ::rtl::OUString aToolkitServiceName(
-        RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.awt.Toolkit" ) );
-    uno::Reference<awt::XSystemChildFactory> xToolkit(
-        m_xFactory->createInstance(aToolkitServiceName ),uno::UNO_QUERY);
+    uno::Reference<awt::XToolkit2> xToolkit = awt::Toolkit::create( comphelper::getComponentContext(m_xFactory) );
 
-    if(xToolkit.is() && m_pIOleIPFrame) {
+    if(m_pIOleIPFrame) {
         HWND hWnd;
         m_pIOleIPFrame->GetWindow(&hWnd);
 
diff --git a/extensions/source/nsplugin/source/so_instance.cxx b/extensions/source/nsplugin/source/so_instance.cxx
index 4aeb45a..a86ddbe 100644
--- a/extensions/source/nsplugin/source/so_instance.cxx
+++ b/extensions/source/nsplugin/source/so_instance.cxx
@@ -31,6 +31,7 @@
 #include <com/sun/star/frame/DispatchHelper.hpp>
 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
 #include <com/sun/star/lang/SystemDependent.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/XSystemChildFactory.hpp>
 #include <com/sun/star/awt/XVclWindowPeer.hpp>
 #include <com/sun/star/util/XCloseable.hpp>
@@ -132,15 +133,11 @@ sal_Bool SoPluginInstance::LoadDocument(NSP_HWND hParent)
 
     try
     {
+        Reference< beans::XPropertySet > xFactoryProperties( mxRemoteMSF, uno::UNO_QUERY );
+        Reference< uno::XComponentContext > xContext( xFactoryProperties->getPropertyValue( "DefaultContext" ), UNO_QUERY );
+
         // try to create netscape plugin window
-        Reference< awt::XToolkit > xToolkit(
-            mxRemoteMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")) ),
-            uno::UNO_QUERY );
-        if( !xToolkit.is() )
-        {
-            debug_fprintf(NSP_LOG_APPEND, "Can not create Toolkit!\n");
-            return sal_False;
-        }
+        Reference< awt::XToolkit > xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW );
 
         // prepare parameters for plugin window
         css::uno::Any hwndParent = css::uno::makeAny((sal_Int32)hParent);
@@ -240,8 +237,6 @@ sal_Bool SoPluginInstance::LoadDocument(NSP_HWND hParent)
         }
 
         //create stream for the document
-        Reference< uno::XComponentContext > xContext(
-            comphelper::getComponentContext( mxRemoteMSF ) );
         Reference< ucb::XSimpleFileAccess2 > xSimpleFileAccess( ucb::SimpleFileAccess::create(xContext) );
         Reference<io::XInputStream> xInputStream = xSimpleFileAccess->openFileRead( m_sURL );
 
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 9933309..763c8d0 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -38,7 +38,6 @@ namespace framework{
 #define SERVICENAME_MEDIATYPEDETECTIONHELPER                    DECLARE_ASCII("com.sun.star.frame.MediaTypeDetectionHelper"         )
 #define SERVICENAME_LOGINDIALOG                                 DECLARE_ASCII("com.sun.star.framework.LoginDialog"                  )
 #define SERVICENAME_CONFIGURATION                               DECLARE_ASCII("com.sun.star.configuration.ConfigurationRegistry"    )
-#define SERVICENAME_VCLTOOLKIT                                  DECLARE_ASCII("com.sun.star.awt.Toolkit"                            )
 #define SERVICENAME_SIMPLEREGISTRY                              DECLARE_ASCII("com.sun.star.registry.SimpleRegistry"                )
 #define SERVICENAME_NESTEDREGISTRY                              DECLARE_ASCII("com.sun.star.registry.NestedRegistry"                )
 #define SERVICENAME_GENERICFRAMELOADER                          DECLARE_ASCII("com.sun.star.comp.office.FilterDetect"               )
diff --git a/framework/inc/tabwin/tabwinfactory.hxx b/framework/inc/tabwin/tabwinfactory.hxx
index a594b2a..fb08f20 100644
--- a/framework/inc/tabwin/tabwinfactory.hxx
+++ b/framework/inc/tabwin/tabwinfactory.hxx
@@ -33,7 +33,7 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/XToolkit2.hpp>
 
 #include <cppuhelper/implbase2.hxx>
 #include <rtl/ustring.hxx>
@@ -57,7 +57,7 @@ class TabWinFactory :  protected ThreadHelpBase
 
     private:
         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
-        ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >              m_xToolkit;
+        ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit2 >             m_xToolkit;
 };
 
 }
diff --git a/framework/source/dispatch/menudispatcher.cxx b/framework/source/dispatch/menudispatcher.cxx
index f5661d4..f13af3d 100644
--- a/framework/source/dispatch/menudispatcher.cxx
+++ b/framework/source/dispatch/menudispatcher.cxx
@@ -33,7 +33,6 @@
 #include <services.h>
 
 #include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
 #include <com/sun/star/awt/WindowAttribute.hpp>
 #include <com/sun/star/awt/WindowDescriptor.hpp>
 #include <com/sun/star/awt/PosSize.hpp>
diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx
index c13e80f..37132b4 100644
--- a/framework/source/dispatch/popupmenudispatcher.cxx
+++ b/framework/source/dispatch/popupmenudispatcher.cxx
@@ -34,7 +34,6 @@
 #include <properties.h>
 
 #include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
 #include <com/sun/star/awt/WindowAttribute.hpp>
 #include <com/sun/star/awt/WindowDescriptor.hpp>
 #include <com/sun/star/awt/PosSize.hpp>
diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx
index 1f9a037..ef48be2 100644
--- a/framework/source/layoutmanager/helpers.cxx
+++ b/framework/source/layoutmanager/helpers.cxx
@@ -31,6 +31,7 @@
 #include <services.h>
 
 #include <com/sun/star/ui/DockingArea.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/XTopWindow.hpp>
 #include <com/sun/star/frame/XDispatchHelper.hpp>
 #include <com/sun/star/awt/XDockableWindow.hpp>
@@ -38,6 +39,7 @@
 #include <com/sun/star/awt/XWindowListener.hpp>
 #include <com/sun/star/ui/XUIElement.hpp>
 
+#include <comphelper/processfactory.hxx>
 #include <comphelper/mediadescriptor.hxx>
 #include <vcl/svapp.hxx>
 #include <toolkit/unohlp.hxx>
@@ -169,29 +171,21 @@ bool lcl_checkUIElement(const uno::Reference< ui::XUIElement >& xUIElement, awt:
     return bRet;
 }
 
-uno::Reference< awt::XWindowPeer > createToolkitWindow( const uno::Reference< lang::XMultiServiceFactory >& rFactory, const uno::Reference< awt::XWindowPeer >& rParent, const char* pService )
+uno::Reference< awt::XWindowPeer > createToolkitWindow( const uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< awt::XWindowPeer >& rParent, const char* pService )
 {
-    const rtl::OUString aAWTToolkit( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ));
-
-    uno::Reference< awt::XWindowPeer > xPeer;
-    if ( rFactory.is() )
-    {
-        uno::Reference< awt::XToolkit > xToolkit( rFactory->createInstance( aAWTToolkit ), uno::UNO_QUERY_THROW );
-        if ( xToolkit.is() )
-        {
-            // describe window properties.
-            css::awt::WindowDescriptor aDescriptor;
-            aDescriptor.Type                =   awt::WindowClass_SIMPLE;
-            aDescriptor.WindowServiceName   =   ::rtl::OUString::createFromAscii( pService );
-            aDescriptor.ParentIndex         =   -1;
-            aDescriptor.Parent              =   uno::Reference< awt::XWindowPeer >( rParent, uno::UNO_QUERY );
-            aDescriptor.Bounds              =   awt::Rectangle(0,0,0,0);
-            aDescriptor.WindowAttributes    =   0;
-
-            // create a awt window
-            xPeer = xToolkit->createWindow( aDescriptor );
-        }
-    }
+    uno::Reference< awt::XToolkit2 > xToolkit = awt::Toolkit::create( rxContext );
+
+    // describe window properties.
+    css::awt::WindowDescriptor aDescriptor;
+    aDescriptor.Type                =   awt::WindowClass_SIMPLE;
+    aDescriptor.WindowServiceName   =   ::rtl::OUString::createFromAscii( pService );
+    aDescriptor.ParentIndex         =   -1;
+    aDescriptor.Parent              =   uno::Reference< awt::XWindowPeer >( rParent, uno::UNO_QUERY );
+    aDescriptor.Bounds              =   awt::Rectangle(0,0,0,0);
+    aDescriptor.WindowAttributes    =   0;
+
+    // create a awt window
+    uno::Reference< awt::XWindowPeer > xPeer = xToolkit->createWindow( aDescriptor );
 
     return xPeer;
 }
diff --git a/framework/source/layoutmanager/helpers.hxx b/framework/source/layoutmanager/helpers.hxx
index 3d11ee5..dbe1cd0 100644
--- a/framework/source/layoutmanager/helpers.hxx
+++ b/framework/source/layoutmanager/helpers.hxx
@@ -34,6 +34,8 @@
 #include <properties.h>
 
 #include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/awt/XToolkit2.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/frame/XFrame.hpp>
 #include <com/sun/star/ui/XUIElement.hpp>
@@ -66,7 +68,7 @@ SystemWindow* getTopSystemWindow( const ::com::sun::star::uno::Reference< ::com:
 bool equalRectangles( const css::awt::Rectangle& rRect1, const css::awt::Rectangle& rRect2 );
 void setZeroRectangle( ::Rectangle& rRect );
 bool lcl_checkUIElement(const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xUIElement,::com::sun::star::awt::Rectangle& _rPosSize, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xWindow);
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > createToolkitWindow( const css::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rFactory, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent, const char* pService );
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > createToolkitWindow( const css::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent, const char* pService );
 WindowAlign ImplConvertAlignment( sal_Int16 aAlignment );
 ::rtl::OUString getElementTypeFromResourceURL( const ::rtl::OUString& aResourceURL );
 void parseResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aElementType, rtl::OUString& aElementName );
@@ -77,7 +79,7 @@ sal_Bool implts_isPreviewModel( const ::com::sun::star::uno::Reference< ::com::s
 sal_Bool implts_isFrameOrWindowTop( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
 void impl_setDockingWindowVisibility( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& rSMGR, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible );
 void impl_addWindowListeners( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xThis, const ::com::sun::star::uno::Reference< css::ui::XUIElement >& xUIElement );
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > implts_createToolkitWindow( const css::uno::Reference< ::com::sun::star::awt::XToolkit >& rToolkit, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent );
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > implts_createToolkitWindow( const css::uno::Reference< ::com::sun::star::awt::XToolkit2 >& rToolkit, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent );
 
 }
 
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 179725a..0a67895 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -34,6 +34,7 @@
 #include <uiconfiguration/windowstateconfiguration.hxx>
 
 #include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
 #include <com/sun/star/container/XNameReplace.hpp>
@@ -82,7 +83,7 @@ ToolbarLayoutManager::ToolbarLayoutManager(
     setZeroRectangle( m_aDockingArea );
 
     // create toolkit object
-    m_xToolkit = uno::Reference< awt::XToolkit >( m_xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), uno::UNO_QUERY );
+    m_xToolkit = awt::Toolkit::create( comphelper::getComponentContext(m_xSMGR) );
 }
 
 ToolbarLayoutManager::~ToolbarLayoutManager()
@@ -912,10 +913,10 @@ void ToolbarLayoutManager::setParentWindow(
 {
     static const char DOCKINGAREASTRING[] = "dockingarea";
 
-    uno::Reference< awt::XWindow > xTopDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
-    uno::Reference< awt::XWindow > xLeftDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
-    uno::Reference< awt::XWindow > xRightDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
-    uno::Reference< awt::XWindow > xBottomDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
+    uno::Reference< awt::XWindow > xTopDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( comphelper::getComponentContext(m_xSMGR), xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
+    uno::Reference< awt::XWindow > xLeftDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( comphelper::getComponentContext(m_xSMGR), xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
+    uno::Reference< awt::XWindow > xRightDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( comphelper::getComponentContext(m_xSMGR), xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
+    uno::Reference< awt::XWindow > xBottomDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( comphelper::getComponentContext(m_xSMGR), xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
 
     WriteGuard aWriteLock( m_aLock );
     m_xContainerWindow = uno::Reference< awt::XWindow2 >( xParentWindow, uno::UNO_QUERY );
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
index 0f4d2b7..2d43894 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
@@ -63,6 +63,7 @@
 #include <com/sun/star/util/XURLTransformer.hpp>
 #include <com/sun/star/ui/XUIElementFactory.hpp>
 #include <com/sun/star/ui/DockingArea.hpp>
+#include <com/sun/star/awt/XToolkit2.hpp>
 #include <com/sun/star/awt/XTopWindow2.hpp>
 #include <com/sun/star/awt/XWindow2.hpp>
 #include <com/sun/star/awt/XDockableWindow.hpp>
@@ -305,7 +306,7 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::a
         css::uno::Reference< ::com::sun::star::ui::XUIElementFactory >       m_xUIElementFactoryManager;
         css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xModuleCfgMgr;
         css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocCfgMgr;
-        css::uno::Reference< ::com::sun::star::awt::XToolkit >               m_xToolkit;
+        css::uno::Reference< ::com::sun::star::awt::XToolkit2 >              m_xToolkit;
         css::uno::Reference< ::com::sun::star::container::XNameAccess >      m_xPersistentWindowState;
         ILayoutNotifications*                                                m_pParentLayouter;
 
diff --git a/framework/source/services/backingcomp.cxx b/framework/source/services/backingcomp.cxx
index 9058790..a411b4b 100644
--- a/framework/source/services/backingcomp.cxx
+++ b/framework/source/services/backingcomp.cxx
@@ -44,6 +44,7 @@
 #include <com/sun/star/util/XURLTransformer.hpp>
 #include <com/sun/star/frame/XDispatchProvider.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/XDataTransferProviderAccess.hpp>
 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
 #include <com/sun/star/awt/KeyEvent.hpp>
@@ -471,15 +472,12 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f
     ::framework::DropTargetListener* pDropListener = new ::framework::DropTargetListener(m_xSMGR, m_xFrame);
     m_xDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >(static_cast< ::cppu::OWeakObject* >(pDropListener), css::uno::UNO_QUERY);
 
-    css::uno::Reference< css::awt::XDataTransferProviderAccess > xTransfer(m_xSMGR->createInstance(SERVICENAME_VCLTOOLKIT), css::uno::UNO_QUERY);
-    if (xTransfer.is())
+    css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(m_xSMGR) );
+    css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget(m_xWindow);
+    if (xDropTarget.is())
     {
-        css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xTransfer->getDropTarget(m_xWindow);
-        if (xDropTarget.is())
-        {
-            xDropTarget->addDropTargetListener(m_xDropTargetListener);
-            xDropTarget->setActive(sal_True);
-        }
+        xDropTarget->addDropTargetListener(m_xDropTargetListener);
+        xDropTarget->setActive(sal_True);
     }
 
     // initialize the component and it's parent window
@@ -690,15 +688,12 @@ void SAL_CALL BackingComp::dispose()
     // deregister drag&drop helper
     if (m_xDropTargetListener.is())
     {
-        css::uno::Reference< css::awt::XDataTransferProviderAccess > xTransfer(m_xSMGR->createInstance(SERVICENAME_VCLTOOLKIT), css::uno::UNO_QUERY);
-        if (xTransfer.is())
+        css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(m_xSMGR) );
+        css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget(m_xWindow);
+        if (xDropTarget.is())
         {
-            css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xTransfer->getDropTarget(m_xWindow);
-            if (xDropTarget.is())
-            {
-                xDropTarget->removeDropTargetListener(m_xDropTargetListener);
-                xDropTarget->setActive(sal_False);
-            }
+            xDropTarget->removeDropTargetListener(m_xDropTargetListener);
+            xDropTarget->setActive(sal_False);
         }
         m_xDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >();
     }
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 713ad4a..5f0629d 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -48,7 +48,6 @@
 
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
 #include <com/sun/star/awt/XWindow.hpp>
 #include <com/sun/star/awt/XWindowPeer.hpp>
 #include <com/sun/star/awt/WindowDescriptor.hpp>
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index b56b561..5d95607 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -54,6 +54,7 @@
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <com/sun/star/util/XURLTransformer.hpp>
 #include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/XDevice.hpp>
 #include <com/sun/star/awt/XTopWindow.hpp>
 #include <com/sun/star/frame/XDesktop.hpp>
@@ -2926,15 +2927,12 @@ void Frame::implts_startWindowListening()
         {
             xTopWindow->addTopWindowListener( xTopWindowListener );
 
-            css::uno::Reference< css::awt::XDataTransferProviderAccess > xTransfer( xFactory->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY );
-            if( xTransfer.is() == sal_True )
+            css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xFactory) );
+            css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget( xContainerWindow );
+            if( xDropTarget.is() == sal_True )
             {
-                css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xTransfer->getDropTarget( xContainerWindow );
-                if( xDropTarget.is() == sal_True )
-                {
-                    xDropTarget->addDropTargetListener( xDragDropListener );
-                    xDropTarget->setActive( sal_True );
-                }
+                xDropTarget->addDropTargetListener( xDragDropListener );
+                xDropTarget->setActive( sal_True );
             }
         }
     }
@@ -2969,15 +2967,12 @@ void Frame::implts_stopWindowListening()
         {
             xTopWindow->removeTopWindowListener( xTopWindowListener );
 
-            css::uno::Reference< css::awt::XDataTransferProviderAccess > xTransfer( xFactory->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY );
-            if( xTransfer.is() == sal_True )
+            css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xFactory) );
+            css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget( xContainerWindow );
+            if( xDropTarget.is() == sal_True )
             {
-                css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xTransfer->getDropTarget( xContainerWindow );
-                if( xDropTarget.is() == sal_True )
-                {
-                    xDropTarget->removeDropTargetListener( xDragDropListener );
-                    xDropTarget->setActive( sal_False );
-                }
+                xDropTarget->removeDropTargetListener( xDragDropListener );
+                xDropTarget->setActive( sal_False );
             }
         }
     }
diff --git a/framework/source/services/taskcreatorsrv.cxx b/framework/source/services/taskcreatorsrv.cxx
index 56a308f..d7fb643 100644
--- a/framework/source/services/taskcreatorsrv.cxx
+++ b/framework/source/services/taskcreatorsrv.cxx
@@ -40,6 +40,7 @@
 #include <com/sun/star/frame/XController.hpp>
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/XTopWindow.hpp>
 #include <com/sun/star/awt/WindowDescriptor.hpp>
 #include <com/sun/star/awt/WindowAttribute.hpp>
@@ -220,7 +221,7 @@ css::uno::Reference< css::awt::XWindow > TaskCreatorService::implts_createContai
     // <- SAFE
 
     // get toolkit to create task container window
-    css::uno::Reference< css::awt::XToolkit > xToolkit( xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY_THROW);
+    css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xSMGR) );
 
     // Check if child frames can be created realy. We need at least a valid window at the parent frame ...
     css::uno::Reference< css::awt::XWindowPeer > xParentWindowPeer;
diff --git a/framework/source/tabwin/tabwindow.cxx b/framework/source/tabwin/tabwindow.cxx
index d1b2874..e0bdb92 100644
--- a/framework/source/tabwin/tabwindow.cxx
+++ b/framework/source/tabwin/tabwindow.cxx
@@ -32,6 +32,7 @@
 #include <threadhelp/resetableguard.hxx>
 
 #include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/PosSize.hpp>
 #include <com/sun/star/awt/WindowDescriptor.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -299,15 +300,14 @@ throw (css::uno::Exception, css::uno::RuntimeException)
     {
         css::beans::PropertyValue                   aPropValue;
         css::uno::Reference< css::awt::XTopWindow > xTopWindow;
-        css::uno::Reference< css::awt::XToolkit >   xToolkit;
+        css::uno::Reference< css::awt::XToolkit2 >  xToolkit;
         css::awt::WindowDescriptor                  aDescriptor;
 
         if ( xSMGR.is() )
         {
             try
             {
-                xToolkit = css::uno::Reference< css::awt::XToolkit >(
-                    xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY );
+                xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xSMGR) );
             }
             catch ( const css::uno::RuntimeException& )
             {
diff --git a/framework/source/tabwin/tabwinfactory.cxx b/framework/source/tabwin/tabwinfactory.cxx
index a3d7815..89a58d2 100644
--- a/framework/source/tabwin/tabwinfactory.cxx
+++ b/framework/source/tabwin/tabwinfactory.cxx
@@ -33,6 +33,7 @@
 
 #include <com/sun/star/util/XURLTransformer.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/XTopWindow.hpp>
 #include <com/sun/star/awt/WindowAttribute.hpp>
 
@@ -90,7 +91,7 @@ throw ( css::uno::Exception, css::uno::RuntimeException )
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
     ResetableGuard aLock( m_aLock );
-    css::uno::Reference< css::awt::XToolkit > xToolkit = m_xToolkit;
+    css::uno::Reference< css::awt::XToolkit2 > xToolkit = m_xToolkit;
     css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xServiceManager );
     aLock.unlock();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -110,37 +111,31 @@ throw ( css::uno::Exception, css::uno::RuntimeException )
 
     if ( !xToolkit.is() && xSMGR.is() )
     {
-        xToolkit = css::uno::Reference< css::awt::XToolkit >( xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY );
-        if ( xToolkit.is() )
-        {
-            /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-            aLock.lock();
-            m_xToolkit = xToolkit;
-            aLock.unlock();
-            /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-        }
+        xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xSMGR) );
+        /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+        aLock.lock();
+        m_xToolkit = xToolkit;
+        aLock.unlock();
+        /* SAFE AREA ----------------------------------------------------------------------------------------------- */
     }
 
     if ( !xTopWindow.is() )
     {
-        if ( xToolkit.is() )
-        {
-            // describe window properties.
-            css::awt::WindowDescriptor aDescriptor;
-            aDescriptor.Type                =   css::awt::WindowClass_TOP                                           ;
-            aDescriptor.ParentIndex         =   -1                                                                  ;
-            aDescriptor.Parent              =   css::uno::Reference< css::awt::XWindowPeer >()                      ;
-            aDescriptor.Bounds              =   css::awt::Rectangle(0,0,0,0)                                        ;
-            aDescriptor.WindowAttributes    =   css::awt::WindowAttribute::BORDER|
-                                                css::awt::WindowAttribute::SIZEABLE|
-                                                css::awt::WindowAttribute::MOVEABLE|
-                                                css::awt::WindowAttribute::CLOSEABLE|
-                                                css::awt::WindowAttribute::MINSIZE;
-
-            // create a parent window
-            xTopWindow = css::uno::Reference< css::awt::XTopWindow >(
-                            xToolkit->createWindow( aDescriptor ), css::uno::UNO_QUERY );
-        }
+        // describe window properties.
+        css::awt::WindowDescriptor aDescriptor;
+        aDescriptor.Type                =   css::awt::WindowClass_TOP                                           ;
+        aDescriptor.ParentIndex         =   -1                                                                  ;
+        aDescriptor.Parent              =   css::uno::Reference< css::awt::XWindowPeer >()                      ;
+        aDescriptor.Bounds              =   css::awt::Rectangle(0,0,0,0)                                        ;
+        aDescriptor.WindowAttributes    =   css::awt::WindowAttribute::BORDER|
+                                            css::awt::WindowAttribute::SIZEABLE|
+                                            css::awt::WindowAttribute::MOVEABLE|
+                                            css::awt::WindowAttribute::CLOSEABLE|
+                                            css::awt::WindowAttribute::MINSIZE;
+
+        // create a parent window
+        xTopWindow = css::uno::Reference< css::awt::XTopWindow >(
+                        xToolkit->createWindow( aDescriptor ), css::uno::UNO_QUERY );
     }
 
     if ( xTopWindow.is() )
diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx
index 23c7c97..a6a950b 100644
--- a/framework/source/uifactory/windowcontentfactorymanager.cxx
+++ b/framework/source/uifactory/windowcontentfactorymanager.cxx
@@ -38,7 +38,6 @@
 #include <com/sun/star/container/XContainer.hpp>
 #include <com/sun/star/frame/ModuleManager.hpp>
 #include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
 #include <com/sun/star/awt/XControlModel.hpp>
 #include <com/sun/star/awt/XControl.hpp>
 
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx
index daf0215..fb35eed 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 <addon.hxx>
 #include <osl/diagnose.h>
 #include <rtl/ustring.hxx>
+#include <comphelper/componentcontext.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/frame/XFrame.hpp>
 #include <com/sun/star/frame/XController.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/XWindowPeer.hpp>
 #include <com/sun/star/awt/WindowAttribute.hpp>
 #include <com/sun/star/awt/XMessageBox.hpp>
@@ -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 98a897a..71537c5 100644
--- a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
+++ b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
@@ -43,6 +43,7 @@
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/frame/XControlNotificationListener.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/awt/Toolkitr.hpp>
 #include <com/sun/star/awt/XWindowPeer.hpp>
 #include <com/sun/star/awt/WindowAttribute.hpp>
 #include <com/sun/star/awt/XMessageBox.hpp>
@@ -53,6 +54,7 @@
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/container/XContainerQuery.hpp>
 
+#include <compphelper/componentcontext.hxx>
 #include <osl/file.hxx>
 
 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;
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index b248cf3..c590dac 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -54,6 +54,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/awt,\
 	MenuBar \
 	PopupMenu \
 	TabController \
+	Toolkit \
 	UnoControlDialogModelProvider \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/awt/grid,\
@@ -374,7 +375,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/awt,\
 	RoadmapItem \
 	SpinningProgressControlModel \
 	TabControllerModel \
-	Toolkit \
 	UnoControl \
 	UnoControlButton \
 	UnoControlButtonModel \
@@ -1822,6 +1822,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/awt,\
 	XTimeField \
 	XToggleButton \
 	XToolkit \
+	XToolkit2 \
 	XToolkitExperimental \
 	XTopWindow \
 	XTopWindow2 \
diff --git a/offapi/com/sun/star/awt/Toolkit.idl b/offapi/com/sun/star/awt/Toolkit.idl
index 20cf21d..2290688 100644
--- a/offapi/com/sun/star/awt/Toolkit.idl
+++ b/offapi/com/sun/star/awt/Toolkit.idl
@@ -19,16 +19,11 @@
 #ifndef __com_sun_star_awt_Toolkit_idl__
 #define __com_sun_star_awt_Toolkit_idl__
 
-#include <com/sun/star/awt/XToolkit.idl>
-#include <com/sun/star/awt/XDataTransferProviderAccess.idl>
-#include <com/sun/star/awt/XSystemChildFactory.idl>
-#include <com/sun/star/awt/XMessageBoxFactory.idl>
-
+#include <com/sun/star/awt/XToolkit2.idl>
 
 
 module com {  module sun {  module star {  module awt {
 
-
 /** describes a toolkit that creates windows on a screen.
 
     <p>The design of the interfaces for the toolkit implementation
@@ -36,17 +31,7 @@ module com {  module sun {  module star {  module awt {
     of the toolkit should be one-way. Too many synchronous calls kill the
     remote performance.</p>
  */
-published service Toolkit
-{
-    interface XToolkit;
-
-    [optional] interface com::sun::star::awt::XDataTransferProviderAccess;
-
-    [optional] interface com::sun::star::awt::XSystemChildFactory;
-
-    [optional] interface com::sun::star::awt::XMessageBoxFactory;
-
-};
+published service Toolkit : XToolkit2;
 
 
 }; }; }; };
diff --git a/offapi/com/sun/star/awt/XToolkit2.idl b/offapi/com/sun/star/awt/XToolkit2.idl
new file mode 100644
index 0000000..2d40d9c
--- /dev/null
+++ b/offapi/com/sun/star/awt/XToolkit2.idl
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_awt_XToolkit2_idl__
+#define __com_sun_star_awt_XToolkit2_idl__
+
+#include <com/sun/star/awt/XToolkit.idl>
+#include <com/sun/star/awt/XDataTransferProviderAccess.idl>
+#include <com/sun/star/awt/XSystemChildFactory.idl>
+#include <com/sun/star/awt/XMessageBoxFactory.idl>
+#include <com/sun/star/awt/XExtendedToolkit.idl>
+#include <com/sun/star/awt/XReschedule.idl>
+
+
+
+module com {  module sun {  module star {  module awt {
+
+
+/**
+  Provides a unified interface for the new-style service Toolkit to implement.
+
+  @since LibreOffice 3.7
+ */
+published interface XToolkit2
+{
+    interface XToolkit;
+
+    interface com::sun::star::awt::XDataTransferProviderAccess;
+
+    interface com::sun::star::awt::XSystemChildFactory;
+
+    interface com::sun::star::awt::XMessageBoxFactory;
+
+    interface com::sun::star::awt::XExtendedToolkit;
+
+    interface com::sun::star::awt::XReschedule;
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/awt/XToolkitExperimental.idl b/offapi/com/sun/star/awt/XToolkitExperimental.idl
index c26d916..a60b3bc 100644
--- a/offapi/com/sun/star/awt/XToolkitExperimental.idl
+++ b/offapi/com/sun/star/awt/XToolkitExperimental.idl
@@ -10,14 +10,14 @@
 #ifndef __com_sun_star_awt_XToolkitExperimental_idl__
 #define __com_sun_star_awt_XToolkitExperimental_idl__
 
-#include <com/sun/star/awt/XToolkit.idl>
+#include <com/sun/star/awt/XToolkit2.idl>
 
 module com {  module sun {  module star {  module awt {
 
 /** Work in progress, don't use unless you know what you are doing.
  */
 
-interface XToolkitExperimental: XToolkit
+interface XToolkitExperimental : XToolkit2
 {
   /** Create a bitmap device using a byte buffer allocated outside of UNO territory.
    *
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index 34d7172..da0750a 100644
Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index 964c595..4392c99 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -21,6 +21,7 @@
 #include "DialogModelProvider.hxx"
 #include "dlgprov.hxx"
 #include "dlgevtatt.hxx"
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/XControlContainer.hpp>
 #include <com/sun/star/awt/XWindowPeer.hpp>
 #include <com/sun/star/io/XInputStreamProvider.hpp>
@@ -519,10 +520,8 @@ static ::rtl::OUString aResourceResolverPropName("ResourceResolver");
                     }
 
                     // create a peer
-                    Reference< XToolkit> xToolkit( xSMgr->createInstanceWithContext(
-                        ::rtl::OUString( "com.sun.star.awt.Toolkit"  ), m_xContext ), UNO_QUERY );
-                    if ( xToolkit.is() )
-                        xDialogControl->createPeer( xToolkit, xPeer );
+                    Reference< XToolkit> xToolkit( Toolkit::create( m_xContext ), UNO_QUERY_THROW );
+                    xDialogControl->createPeer( xToolkit, xPeer );
                 }
             }
         }
diff --git a/sd/workben/custompanel/ctp_panel.cxx b/sd/workben/custompanel/ctp_panel.cxx
index 85a9763..bfe6b18 100644
--- a/sd/workben/custompanel/ctp_panel.cxx
+++ b/sd/workben/custompanel/ctp_panel.cxx
@@ -23,7 +23,7 @@
 #include <com/sun/star/drawing/framework/XPane.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/awt/XWindowPeer.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/WindowClass.hpp>
 #include <com/sun/star/awt/WindowAttribute.hpp>
 #include <com/sun/star/awt/PosSize.hpp>
@@ -83,10 +83,7 @@ namespace sd { namespace colortoolpanel
             {
                 ENSURE_OR_THROW( i_rContext.is(), "illegal component context" );
                 Reference< XMultiComponentFactory > xFactory( i_rContext->getServiceManager(), UNO_SET_THROW );
-                Reference< XToolkit > xToolkit( xFactory->createInstanceWithContext(
-                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ),
-                    i_rContext
-                ), UNO_QUERY_THROW );
+                Reference< XToolkit2 > xToolkit = Toolkit::create(i_rContext);
 
                 WindowDescriptor aWindow;
                 aWindow.Type = WindowClass_SIMPLE;
diff --git a/sdext/source/minimizer/unodialog.cxx b/sdext/source/minimizer/unodialog.cxx
index c39e901..bb28f11 100644
--- a/sdext/source/minimizer/unodialog.cxx
+++ b/sdext/source/minimizer/unodialog.cxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/view/XSelectionSupplier.hpp>
 #include <com/sun/star/view/XControlAccess.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/XMessageBoxFactory.hpp>
 #include <com/sun/star/awt/MessageBoxButtons.hpp>
 
@@ -97,7 +98,7 @@ Reference< XWindowPeer > UnoDialog::createWindowPeer( Reference< XWindowPeer > x
     throw ( Exception )
 {
     mxDialogWindow->setVisible( sal_False );
-    Reference< XToolkit > xToolkit( mxMSF->getServiceManager()->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ), mxMSF ), UNO_QUERY_THROW  );
+    Reference< XToolkit > xToolkit( Toolkit::create( mxMSF ), UNO_QUERY_THROW  );
     if ( !xParentPeer.is() )
         xParentPeer = xToolkit->getDesktopWindow();
     mxReschedule = Reference< XReschedule >( xToolkit, UNO_QUERY );
diff --git a/sdext/source/presenter/PresenterSlideShowView.cxx b/sdext/source/presenter/PresenterSlideShowView.cxx
index ba820eb..2201a1e 100644
--- a/sdext/source/presenter/PresenterSlideShowView.cxx
+++ b/sdext/source/presenter/PresenterSlideShowView.cxx
@@ -25,6 +25,7 @@
 #include "PresenterPaneContainer.hxx"
 #include <com/sun/star/awt/InvalidateStyle.hpp>
 #include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/WindowAttribute.hpp>
 #include <com/sun/star/awt/XWindow.hpp>
 #include <com/sun/star/awt/XWindow2.hpp>
@@ -834,11 +835,7 @@ Reference<awt::XWindow> PresenterSlideShowView::CreateViewWindow (
         if ( ! xFactory.is())
             return xViewWindow;
 
-        Reference<awt::XToolkit> xToolkit (
-            xFactory->createInstanceWithContext(
-                OUString("com.sun.star.awt.Toolkit"),
-                mxComponentContext),
-            UNO_QUERY_THROW);
+        Reference<awt::XToolkit2> xToolkit = awt::Toolkit::create(mxComponentContext);
         awt::WindowDescriptor aWindowDescriptor (
             awt::WindowClass_CONTAINER,
             OUString(),
diff --git a/sfx2/workben/custompanel/ctp_panel.cxx b/sfx2/workben/custompanel/ctp_panel.cxx
index 6cde8e4..d41f2e6 100644
--- a/sfx2/workben/custompanel/ctp_panel.cxx
+++ b/sfx2/workben/custompanel/ctp_panel.cxx
@@ -22,7 +22,7 @@
 
 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/awt/XWindowPeer.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/WindowClass.hpp>
 #include <com/sun/star/awt/WindowAttribute.hpp>
 #include <com/sun/star/awt/PosSize.hpp>
@@ -81,10 +81,7 @@ namespace sd { namespace colortoolpanel
             {
                 ENSURE_OR_THROW( i_rContext.is(), "illegal component context" );
                 Reference< XMultiComponentFactory > xFactory( i_rContext->getServiceManager(), UNO_SET_THROW );
-                Reference< XToolkit > xToolkit( xFactory->createInstanceWithContext(
-                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ),
-                    i_rContext
-                ), UNO_QUERY_THROW );
+                Reference< XToolkit2 > xToolkit = Toolkit::create(i_rContext);
 
                 WindowDescriptor aWindow;
                 aWindow.Type = WindowClass_SIMPLE;
diff --git a/slideshow/source/engine/shapes/viewappletshape.cxx b/slideshow/source/engine/shapes/viewappletshape.cxx
index eb0a532..d4ee1d2 100644
--- a/slideshow/source/engine/shapes/viewappletshape.cxx
+++ b/slideshow/source/engine/shapes/viewappletshape.cxx
@@ -41,7 +41,7 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/util/XCloseable.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/XWindow2.hpp>
 #include <com/sun/star/awt/XWindowPeer.hpp>
 #include <com/sun/star/awt/WindowAttribute.hpp>
@@ -150,11 +150,7 @@ namespace slideshow
                     // create an awt window to contain the applet
                     // ==========================================
 
-                    uno::Reference< awt::XToolkit > xToolkit(
-                        xFactory->createInstanceWithContext(
-                            ::rtl::OUString("com.sun.star.awt.Toolkit" ),
-                            mxComponentContext ),
-                        uno::UNO_QUERY_THROW );
+                    uno::Reference< awt::XToolkit2 > xToolkit = awt::Toolkit::create(mxComponentContext);
 
                     awt::WindowDescriptor aOwnWinDescriptor( awt::WindowClass_SIMPLE,
                                                              ::rtl::OUString(),
diff --git a/sw/source/ui/utlui/unotools.cxx b/sw/source/ui/utlui/unotools.cxx
index 6324bdd..e762e72 100644
--- a/sw/source/ui/utlui/unotools.cxx
+++ b/sw/source/ui/utlui/unotools.cxx
@@ -43,6 +43,7 @@
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/style/XStyle.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/PosSize.hpp>
 #include <com/sun/star/view/XViewSettingsSupplier.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
@@ -123,50 +124,49 @@ void    SwOneExampleFrame::CreateControl()
         return ;
     uno::Reference< lang::XMultiServiceFactory >
                                     xMgr = comphelper::getProcessServiceFactory();
+    uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
     uno::Reference< uno::XInterface >  xInst = xMgr->createInstance( C2U("com.sun.star.frame.FrameControl") );
     _xControl = uno::Reference< awt::XControl >(xInst, uno::UNO_QUERY);
     if(_xControl.is())
     {
         uno::Reference< awt::XWindowPeer >  xParent( rWindow.GetComponentInterface() );
 
-        uno::Reference< awt::XToolkit >  xToolkit( xMgr->createInstance( C2U("com.sun.star.awt.Toolkit") ), uno::UNO_QUERY );
-        if(xToolkit.is())
-        {
-            _xControl->createPeer( xToolkit, xParent );
-
-            uno::Reference< awt::XWindow >  xWin( _xControl, uno::UNO_QUERY );
-            xWin->setVisible( sal_False );
-            Size aWinSize(rWindow.GetOutputSizePixel());
-            xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
-
-            uno::Reference< beans::XPropertySet >  xPrSet(xInst, uno::UNO_QUERY);
-            uno::Any aURL;
-            // create new doc
-            rtl::OUString sTempURL(cFactory);
-            if(sArgumentURL.Len())
-                sTempURL = sArgumentURL;
-            aURL <<= sTempURL;
-
-            uno::Sequence<beans::PropertyValue> aSeq(3);
-            beans::PropertyValue* pValues = aSeq.getArray();
-            pValues[0].Name = C2U("ReadOnly");
-            sal_Bool bTrue = sal_True;
-            pValues[0].Value.setValue(&bTrue, ::getBooleanCppuType());
-            pValues[1].Name = C2U("OpenFlags");
-            pValues[1].Value <<= C2U("-RB");
-            pValues[2].Name = C2U("Referer");
-            pValues[2].Value <<= C2U("private:user");
-            uno::Any aArgs;
-            aArgs.setValue(&aSeq, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
-
-            xPrSet->setPropertyValue( C2U("LoaderArguments"), aArgs );
-            //save and set readonly???
-
-            xPrSet->setPropertyValue(C2U("ComponentURL"), aURL);
-
-            aLoadedTimer.Start();
-            bServiceAvailable = sal_True;
-        }
+        uno::Reference< awt::XToolkit >  xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW );
+
+        _xControl->createPeer( xToolkit, xParent );
+
+        uno::Reference< awt::XWindow >  xWin( _xControl, uno::UNO_QUERY );
+        xWin->setVisible( sal_False );
+        Size aWinSize(rWindow.GetOutputSizePixel());
+        xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
+
+        uno::Reference< beans::XPropertySet >  xPrSet(xInst, uno::UNO_QUERY);
+        uno::Any aURL;
+        // create new doc
+        rtl::OUString sTempURL(cFactory);
+        if(sArgumentURL.Len())
+            sTempURL = sArgumentURL;
+        aURL <<= sTempURL;
+
+        uno::Sequence<beans::PropertyValue> aSeq(3);
+        beans::PropertyValue* pValues = aSeq.getArray();
+        pValues[0].Name = C2U("ReadOnly");
+        sal_Bool bTrue = sal_True;
+        pValues[0].Value.setValue(&bTrue, ::getBooleanCppuType());
+        pValues[1].Name = C2U("OpenFlags");
+        pValues[1].Value <<= C2U("-RB");
+        pValues[2].Name = C2U("Referer");
+        pValues[2].Value <<= C2U("private:user");
+        uno::Any aArgs;
+        aArgs.setValue(&aSeq, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
+
+        xPrSet->setPropertyValue( C2U("LoaderArguments"), aArgs );
+        //save and set readonly???
+
+        xPrSet->setPropertyValue(C2U("ComponentURL"), aURL);
+
+        aLoadedTimer.Start();
+        bServiceAvailable = sal_True;
     }
 }
 
diff --git a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx
index d8bd1c9..32a4016 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 <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/awt/XSystemChildFactory.hpp>
 #include <com/sun/star/awt/XToolkitExperimental.hpp>
-#include <com/sun/star/awt/XDataTransferProviderAccess.hpp>
 #include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/awt/XExtendedToolkit.hpp>
-#include <com/sun/star/awt/XReschedule.hpp>
 #include <com/sun/star/awt/XMessageBoxFactory.hpp>
-#include <cppuhelper/compbase7.hxx>
+#include <cppuhelper/compbase2.hxx>
 #include "cppuhelper/interfacecontainer.hxx"
 #include <osl/mutex.hxx>
 #include <osl/module.h>
@@ -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 173d23c..f320d19 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 0cdffe4..496839a 100644
--- a/toolkit/source/helper/vclunohelper.cxx
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -53,6 +53,7 @@
 #include <vcl/graph.hxx>
 #include <comphelper/processfactory.hxx>
 
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/awt/Point.hpp>
 
@@ -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;
 }
 
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index 211c163..5334d8a 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -32,6 +32,7 @@
 #undef _LINUX_SOURCE_COMPAT
 #endif
 
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
 #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
@@ -975,7 +976,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
     int btn = GTK_RESPONSE_NO;
 
     uno::Reference< awt::XExtendedToolkit > xToolkit(
-        createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")) ),
+        awt::Toolkit::create(m_xContext),
         UNO_QUERY_THROW );
 
     uno::Reference< frame::XDesktop > xDesktop(
diff --git a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
index fb0d352..b90293c 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
@@ -32,6 +32,7 @@
 #undef _LINUX_SOURCE_COMPAT
 #endif
 
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
 #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
@@ -145,7 +146,7 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException )
     sal_Int16 retVal = 0;
 
     uno::Reference< awt::XExtendedToolkit > xToolkit(
-        createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit"))),
+        awt::Toolkit::create(m_xContext),
         uno::UNO_QUERY);
 
     uno::Reference< frame::XDesktop > xDesktop(
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 342923d..1d3ca70 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -33,6 +33,7 @@
 #include <rtl/uri.hxx>
 #include <osl/file.hxx>
 #include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
 #include <rtl/ustrbuf.hxx>
 #include "inputstream.hxx"
 #include <algorithm>
@@ -1208,24 +1209,17 @@ void Databases::cascadingStylesheet( const rtl::OUString& Language,
         if ( aCSS.compareToAscii( "default" ) == 0 )
         {
             // #i50760: "default" needs to adapt HC mode
-            uno::Reference< awt::XToolkit > xToolkit = uno::Reference< awt::XToolkit >(
-                    ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( "com.sun.star.awt.Toolkit" ) ), uno::UNO_QUERY );
-            if ( xToolkit.is() )
+            uno::Reference< awt::XToolkit2 > xToolkit =
+                   awt::Toolkit::create( ::comphelper::getProcessComponentContext() );
+            uno::Reference< awt::XTopWindow > xTopWindow = xToolkit->getActiveTopWindow();
+            if ( xTopWindow.is() )
             {
-                uno::Reference< awt::XExtendedToolkit > xExtToolkit( xToolkit, uno::UNO_QUERY );
-                if ( xExtToolkit.is() )
+                uno::Reference< awt::XVclWindowPeer > xVclWindowPeer( xTopWindow, uno::UNO_QUERY );
+                if ( xVclWindowPeer.is() )
                 {
-                    uno::Reference< awt::XTopWindow > xTopWindow = xExtToolkit->getActiveTopWindow();
-                    if ( xTopWindow.is() )
-                    {
-                        uno::Reference< awt::XVclWindowPeer > xVclWindowPeer( xTopWindow, uno::UNO_QUERY );
-                        if ( xVclWindowPeer.is() )
-                        {
-                            uno::Any aHCMode = xVclWindowPeer->getProperty( rtl::OUString( "HighContrastMode" ) );
-                            if ( ( aHCMode >>= bHighContrastMode ) && bHighContrastMode )
-                                aCSS = rtl::OUString( "highcontrastblack" );
-                        }
-                    }
+                    uno::Any aHCMode = xVclWindowPeer->getProperty( rtl::OUString( "HighContrastMode" ) );
+                    if ( ( aHCMode >>= bHighContrastMode ) && bHighContrastMode )
+                        aCSS = rtl::OUString( "highcontrastblack" );
                 }
             }
         }
commit f252b332dd2652abb02851ba0c2521c045787801
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Oct 16 15:45:22 2012 +0200

    fdo#46808, renamet awt::XToolkit2 to XToolkitExperimental..
    
    ..because we want to use the name for the new merged interface
    for the Toolkit service.
    
    Change-Id: Ib1e193c7d04729f6420ee6984231fd50181e59d3

diff --git a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
index 841b341..8c9a713 100644
--- a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
+++ b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
@@ -92,7 +92,7 @@ import com.sun.star.awt.Size;
 import com.sun.star.awt.XBitmap;
 import com.sun.star.awt.XControl;
 import com.sun.star.awt.XDevice;
-import com.sun.star.awt.XToolkit2;
+import com.sun.star.awt.XToolkitExperimental;
 import com.sun.star.beans.PropertyValue;
 import com.sun.star.frame.XComponentLoader;
 import com.sun.star.frame.XController;
@@ -130,7 +130,7 @@ public class DocumentLoader
     XComponentContext context;
     XMultiComponentFactory mcf;
     XComponentLoader componentLoader;
-    XToolkit2 toolkit;
+    XToolkitExperimental toolkit;
     XDevice dummySmallDevice;
     Object doc;
     int pageCount;
@@ -822,7 +822,7 @@ public class DocumentLoader
 
                 Object toolkitService = mcf.createInstanceWithContext
                     ("com.sun.star.awt.Toolkit", context);
-                toolkit = (XToolkit2) UnoRuntime.queryInterface(XToolkit2.class, toolkitService);
+                toolkit = (XToolkitExperimental) UnoRuntime.queryInterface(XToolkitExperimental.class, toolkitService);
 
                 renderable = (XRenderable) UnoRuntime.queryInterface(XRenderable.class, doc);
 
diff --git a/android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java b/android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java
index 601e583..ea41051 100644
--- a/android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java
+++ b/android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java
@@ -79,7 +79,7 @@ import com.sun.star.awt.Size;
 import com.sun.star.awt.XBitmap;
 import com.sun.star.awt.XControl;
 import com.sun.star.awt.XDevice;
-import com.sun.star.awt.XToolkit2;
+import com.sun.star.awt.XToolkitExperimental;
 import com.sun.star.beans.PropertyValue;
 import com.sun.star.frame.XComponentLoader;
 import com.sun.star.frame.XController;
@@ -121,7 +121,7 @@ public class DocumentLoader
     XComponentContext context;
     XMultiComponentFactory mcf;
     XComponentLoader componentLoader;
-    XToolkit2 toolkit;
+    XToolkitExperimental toolkit;
     XDevice dummySmallDevice;
     Object doc;
     int pageCount;
@@ -681,7 +681,7 @@ public class DocumentLoader
 
                 Object toolkitService = mcf.createInstanceWithContext
                     ("com.sun.star.awt.Toolkit", context);
-                toolkit = (XToolkit2) UnoRuntime.queryInterface(XToolkit2.class, toolkitService);
+                toolkit = (XToolkitExperimental) UnoRuntime.queryInterface(XToolkitExperimental.class, toolkitService);
 
                 renderable = (XRenderable) UnoRuntime.queryInterface(XRenderable.class, doc);
 
diff --git a/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java
index d47d255..029db57 100644
--- a/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -64,7 +64,7 @@ import com.sun.star.awt.Size;
 import com.sun.star.awt.XBitmap;
 import com.sun.star.awt.XControl;
 import com.sun.star.awt.XDevice;
-import com.sun.star.awt.XToolkit2;
+import com.sun.star.awt.XToolkitExperimental;
 import com.sun.star.beans.PropertyValue;
 import com.sun.star.frame.XComponentLoader;
 import com.sun.star.frame.XController;
@@ -117,7 +117,7 @@ public class LibreOfficeUIActivity extends SherlockActivity implements ActionBar
     XComponentContext context;
     XMultiComponentFactory mcf;
     XComponentLoader componentLoader;
-    XToolkit2 toolkit;
+    XToolkitExperimental toolkit;
     XDevice dummySmallDevice;
     Object doc;
     int pageCount;
@@ -796,7 +796,7 @@ class ListItemAdapter implements ListAdapter{
 
                     Object toolkitService = mcf.createInstanceWithContext
                         ("com.sun.star.awt.Toolkit", context);
-                    toolkit = (XToolkit2) UnoRuntime.queryInterface(XToolkit2.class, toolkitService);
+                    toolkit = (XToolkitExperimental) UnoRuntime.queryInterface(XToolkitExperimental.class, toolkitService);
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list