[Libreoffice-commits] .: 2 commits - basctl/source cui/source desktop/source extensions/source filter/source offapi/com offapi/UnoApi_offapi.mk sfx2/source ucb/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 27 01:31:30 PDT 2012


 basctl/source/basicide/doceventnotifier.cxx           |    8 -
 cui/source/customize/eventdlg.cxx                     |   23 ++---
 desktop/source/app/app.cxx                            |   13 +--
 extensions/source/update/ui/updatecheckui.cxx         |   12 --
 filter/source/config/cache/filtercache.cxx            |    2 
 filter/source/config/cache/lateinitlistener.cxx       |    7 -
 filter/source/config/cache/lateinitlistener.hxx       |   10 --
 filter/source/xsltdialog/xmlfiltertestdialog.cxx      |   38 ++++-----
 offapi/UnoApi_offapi.mk                               |    3 
 offapi/com/sun/star/frame/GlobalEventBroadcaster.idl  |   17 ----
 offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl |   56 +++++++++++++
 sfx2/source/appl/appinit.cxx                          |   15 +--
 sfx2/source/config/evntconf.cxx                       |    5 -
 sfx2/source/doc/objstor.cxx                           |   23 ++---
 sfx2/source/inc/eventsupplier.hxx                     |   13 +--
 ucb/source/ucp/tdoc/tdoc_docmgr.cxx                   |   75 +++---------------
 ucb/source/ucp/tdoc/tdoc_docmgr.hxx                   |   14 ---
 ucb/source/ucp/tdoc/tdoc_provider.cxx                 |    3 
 18 files changed, 151 insertions(+), 186 deletions(-)

New commits:
commit 272f0e97b12e634cdf49a1bff45e1b9068af7d9c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Sep 27 10:19:04 2012 +0200

    Improvements on previous commit
    
    * Made XGlobalEventBroadcaster inherit document::XDocumentEventBroadcaster/
      Listener replacements for obsolete document::XEventBroadcaster/Listener.  This
      means some client sides unfortunately still need to use UNO_QUERY_THROW to
      obtain the obsolete interfaces; those client sides should be cleaned up to use
      the replacement interfaces instead.
    
    * Added @since tag (even to unpublished entities, on "it doesn't hurt" grounds).
    
    * Made client sides use XGlobalEventBroadcaster directly instead of querying for
      its super-interfaces.
    
    * Replaced new uses of comphelper::ComponentContext::getUNOContext with
      comphelper::getComponentContext (see 03a9f139bd9ea1a4f9096fc982e6b326def58532
      "ComponentContext::getUnoContext -> getComponentContext simplification;" I
      intend to get rid of comphelper/componentcontext.hxx much sooner than of
      comphelper/processfactory.hxx).
    
    Change-Id: I6d971ebdaea83d0c3fa9ba299fb6b37e58cdfe9b

diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx
index 55381f5..8cd495f 100644
--- a/cui/source/customize/eventdlg.cxx
+++ b/cui/source/customize/eventdlg.cxx
@@ -89,11 +89,10 @@ SvxEventConfigPage::SvxEventConfigPage( Window *pParent, const SfxItemSet& rSet,
     aSaveInListBox.SetSelectHdl( LINK( this, SvxEventConfigPage,
                 SelectHdl_Impl ) );
 
-    uno::Reference< document::XEventsSupplier > xSupplier;
+    uno::Reference< frame::XGlobalEventBroadcaster > xSupplier;
 
-    xSupplier = uno::Reference< document::XEventsSupplier > (
-        frame::GlobalEventBroadcaster::create(::comphelper::getProcessComponentContext()),
-        uno::UNO_QUERY_THROW );
+    xSupplier =
+        frame::GlobalEventBroadcaster::create(::comphelper::getProcessComponentContext());
 
     sal_uInt16 nPos(0);
     m_xAppEvents = xSupplier->getEvents();
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 378d188..4741ce6 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1532,7 +1532,7 @@ int Desktop::Main()
 
         // create service for loadin SFX (still needed in startup)
         pExecGlobals->xGlobalBroadcaster = Reference < css::document::XEventListener >
-            ( css::frame::GlobalEventBroadcaster::create(comphelper::ComponentContext(xSMgr).getUNOContext()), UNO_QUERY );
+            ( css::frame::GlobalEventBroadcaster::create(comphelper::getComponentContext(xSMgr)), UNO_QUERY_THROW );
 
         /* ensure existance of a default window that messages can be dispatched to
            This is for the benefit of testtool which uses PostUserEvent extensively
@@ -1567,12 +1567,9 @@ int Desktop::Main()
         // keep a language options instance...
         pExecGlobals->pLanguageOptions.reset( new SvtLanguageOptions(sal_True));
 
-        if (pExecGlobals->xGlobalBroadcaster.is())
-        {
-            css::document::EventObject aEvent;
-            aEvent.EventName = ::rtl::OUString("OnStartApp");
-            pExecGlobals->xGlobalBroadcaster->notifyEvent(aEvent);
-        }
+        css::document::EventObject aEvent;
+        aEvent.EventName = ::rtl::OUString("OnStartApp");
+        pExecGlobals->xGlobalBroadcaster->notifyEvent(aEvent);
 
         SetSplashScreenProgress(50);
 
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index b7c3474..764c085 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -48,7 +48,6 @@
 #include <com/sun/star/beans/Property.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/document/CorruptedFilterConfigurationException.hpp>
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/sequenceasvector.hxx>
 #include <comphelper/locale.hxx>
 #include <comphelper/processfactory.hxx>
@@ -250,7 +249,7 @@ void FilterCache::load(EFillState eRequired,
         // and starts a thread, which calls loadAll() at this filter cache.
         // Note: Its not a leak to create this listener with new here.
         // It kills itself after working!
-        /* LateInitListener* pLateInit = */ new LateInitListener(comphelper::ComponentContext(m_xSMGR).getUNOContext());
+        /* LateInitListener* pLateInit = */ new LateInitListener(comphelper::getComponentContext(m_xSMGR));
     }
 
     // ------------------------------------------
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
index f177653..2dff65f 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -47,7 +47,6 @@
 #include <com/sun/star/xml/XExportFilter.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/oslfile2streamwrap.hxx>
 #include <vcl/svapp.hxx>
 #include <osl/mutex.hxx>
@@ -188,7 +187,7 @@ XMLFilterTestDialog::XMLFilterTestDialog( Window* pParent, ResMgr& rResMgr, cons
         if( xCfgMgr.is() )
             sDTDPath = xCfgMgr->substituteVariables( sDTDPath );
 
-        mxGlobalBroadcaster = Reference < XEventBroadcaster >( GlobalEventBroadcaster::create(comphelper::ComponentContext(mxMSF).getUNOContext()), UNO_QUERY_THROW );
+        mxGlobalBroadcaster = Reference < XEventBroadcaster >( GlobalEventBroadcaster::create(comphelper::getComponentContext(mxMSF)), UNO_QUERY_THROW );
         mxGlobalEventListener = new GlobalEventListenerImpl( this );
         mxGlobalBroadcaster->addEventListener( mxGlobalEventListener );
     }
diff --git a/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl b/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl
index 0f3343b..c784fcc 100644
--- a/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl
+++ b/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl
@@ -19,15 +19,17 @@
 #ifndef __com_sun_star_frame_XGlobalEventBroadcaster_idl__
 #define __com_sun_star_frame_XGlobalEventBroadcaster_idl__
 
-#include <com/sun/star/document/XEventBroadcaster.idl>
-#include <com/sun/star/document/XEventsSupplier.idl>
 #include <com/sun/star/container/XSet.idl>
+#include <com/sun/star/document/XDocumentEventBroadcaster.idl>
+#include <com/sun/star/document/XDocumentEventListener.idl>
+#include <com/sun/star/document/XEventsSupplier.idl>
 
-
- module com {  module sun {  module star {  module frame {
+module com {  module sun {  module star {  module frame {
 
 /**
    Provides a unified interface for the GlobalEventBroadcaster service to implement.
+
+   @since LibreOffice 3.7
  */
 
 interface XGlobalEventBroadcaster
@@ -39,11 +41,11 @@ interface XGlobalEventBroadcaster
 
         /** access to bound event handlers
          */
-        interface ::com::sun::star::document::XEventBroadcaster;
+        interface ::com::sun::star::document::XDocumentEventBroadcaster;
 
         interface ::com::sun::star::container::XSet;
 
-        interface ::com::sun::star::document::XEventListener;
+        interface ::com::sun::star::document::XDocumentEventListener;
 };
 
 
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 0a77878..4d53e49 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -113,7 +113,7 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a
     pApp->Get_Impl()->pAppDispatch->release();
 
     css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
-    css::uno::Reference< css::frame::XGlobalEventBroadcaster > xGlobalBroadcaster = css::frame::GlobalEventBroadcaster::create(xContext);
+    css::uno::Reference< css::document::XEventListener > xGlobalBroadcaster(css::frame::GlobalEventBroadcaster::create(xContext), css::uno::UNO_QUERY_THROW);
 
     css::document::EventObject aEvent2;
     aEvent2.EventName = "OnCloseApp";
diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx
index 6bd1f28..a7aefd2 100644
--- a/sfx2/source/inc/eventsupplier.hxx
+++ b/sfx2/source/inc/eventsupplier.hxx
@@ -25,7 +25,6 @@
 #include <com/sun/star/container/XSet.hpp>
 #include <com/sun/star/document/XEventListener.hpp>
 #include <com/sun/star/document/XEventBroadcaster.hpp>
-#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
 #include <com/sun/star/document/XDocumentEventListener.hpp>
 #include <com/sun/star/document/XEventsSupplier.hpp>
 #include <com/sun/star/frame/XGlobalEventBroadcaster.hpp>
@@ -38,7 +37,6 @@
 #include <cppuhelper/weak.hxx>
 #include <cppuhelper/implbase1.hxx>
 #include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
 #include <cppuhelper/implbase4.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 #include <comphelper/sequenceasvector.hxx>
@@ -172,11 +170,12 @@ class ModelCollectionEnumeration : public ModelCollectionMutexBase
 };
 
 //=============================================================================
+//TODO: remove support of obsolete document::XEventBroadcaster/Listener
 class SfxGlobalEvents_Impl : public ModelCollectionMutexBase
                            , public ::cppu::WeakImplHelper4< ::com::sun::star::lang::XServiceInfo
                                                            , ::com::sun::star::frame::XGlobalEventBroadcaster
-                                                           , ::com::sun::star::document::XDocumentEventBroadcaster
-                                                           , ::com::sun::star::document::XDocumentEventListener
+                                                           , ::com::sun::star::document::XEventBroadcaster
+                                                           , ::com::sun::star::document::XEventListener
                                                             >
 {
     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMGR;
diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
index c4e4bd6..b9c7c81 100644
--- a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
@@ -42,7 +42,7 @@
 
 #include "com/sun/star/awt/XTopWindow.hpp"
 #include "com/sun/star/beans/XPropertySet.hpp"
-#include "com/sun/star/container/XEnumerationAccess.hpp"
+#include "com/sun/star/document/XEventBroadcaster.hpp"
 #include "com/sun/star/document/XStorageBasedDocument.hpp"
 #include "com/sun/star/frame/GlobalEventBroadcaster.hpp"
 #include "com/sun/star/frame/XStorable.hpp"
@@ -115,16 +115,14 @@ OfficeDocumentsManager::OfficeDocumentsManager(
             const uno::Reference< uno::XComponentContext > & rxContext,
             OfficeDocumentsEventListener * pDocEventListener )
 : m_xContext( rxContext ),
-  m_xDocEvtNotifier( createDocumentEventNotifier( rxContext ) ),
+  m_xDocEvtNotifier( frame::GlobalEventBroadcaster::create( rxContext ) ),
   m_pDocEventListener( pDocEventListener ),
   m_xDocCloseListener( new OfficeDocumentsCloseListener( this ) )
 {
-    if ( m_xDocEvtNotifier.is() )
-    {
-        // Order is important (multithreaded environment)
-        m_xDocEvtNotifier->addEventListener( this );
-        buildDocumentsList();
-    }
+    // Order is important (multithreaded environment)
+    uno::Reference< document::XEventBroadcaster >(
+        m_xDocEvtNotifier, uno::UNO_QUERY_THROW )->addEventListener( this );
+    buildDocumentsList();
 }
 
 //=========================================================================
@@ -141,8 +139,8 @@ OfficeDocumentsManager::~OfficeDocumentsManager()
 //=========================================================================
 void OfficeDocumentsManager::destroy()
 {
-    if ( m_xDocEvtNotifier.is() )
-        m_xDocEvtNotifier->removeEventListener( this );
+    uno::Reference< document::XEventBroadcaster >(
+        m_xDocEvtNotifier, uno::UNO_QUERY_THROW )->removeEventListener( this );
 }
 
 //=========================================================================
@@ -457,53 +455,10 @@ void SAL_CALL OfficeDocumentsManager::disposing(
 //
 //=========================================================================
 
-// static
-uno::Reference< document::XEventBroadcaster >
-OfficeDocumentsManager::createDocumentEventNotifier(
-        const uno::Reference< uno::XComponentContext >& rxContext )
-{
-    uno::Reference< uno::XInterface > xIfc;
-    try
-    {
-        xIfc = frame::GlobalEventBroadcaster::create(rxContext);
-    }
-    catch ( uno::Exception const & )
-    {
-        // handled below.
-    }
-
-    OSL_ENSURE(
-        xIfc.is(),
-        "Could not instanciate com.sun.star.frame.GlobalEventBroadcaster" );
-
-    if ( xIfc.is() )
-    {
-        uno::Reference< document::XEventBroadcaster > xBC(
-            xIfc, uno::UNO_QUERY );
-
-        OSL_ENSURE(
-            xBC.is(),
-            "com.sun.star.frame.GlobalEventBroadcaster does not implement "
-            "interface com.sun.star.document.XEventBroadcaster!" );
-
-        return xBC;
-    }
-    else
-        return uno::Reference< document::XEventBroadcaster >();
-}
-
-//=========================================================================
 void OfficeDocumentsManager::buildDocumentsList()
 {
-    OSL_ENSURE( m_xDocEvtNotifier.is(),
-                "OfficeDocumentsManager::buildDocumentsList - "
-                "No document event notifier!" );
-
-    uno::Reference< container::XEnumerationAccess > xEnumAccess(
-        m_xDocEvtNotifier, uno::UNO_QUERY_THROW );
-
     uno::Reference< container::XEnumeration > xEnum
-        = xEnumAccess->createEnumeration();
+        = m_xDocEvtNotifier->createEnumeration();
 
     osl::MutexGuard aGuard( m_aMtx );
 
diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx
index 3ba30a4..086f714 100644
--- a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx
@@ -35,11 +35,11 @@
 
 #include "cppuhelper/implbase1.hxx"
 
-#include "com/sun/star/document/XEventBroadcaster.hpp"
 #include "com/sun/star/document/XEventListener.hpp"
 #include "com/sun/star/embed/XStorage.hpp"
 #include "com/sun/star/frame/XModel.hpp"
 #include "com/sun/star/frame/XModuleManager2.hpp"
+#include "com/sun/star/frame/XGlobalEventBroadcaster.hpp"
 #include "com/sun/star/util/XCloseListener.hpp"
 
 namespace tdoc_ucp {
@@ -158,12 +158,6 @@ namespace tdoc_ucp {
         queryStorageTitle( const rtl::OUString & rDocId );
 
     private:
-        static com::sun::star::uno::Reference<
-            com::sun::star::document::XEventBroadcaster >
-        createDocumentEventNotifier(
-            const com::sun::star::uno::Reference<
-                com::sun::star::uno::XComponentContext >& rxContext );
-
         void buildDocumentsList();
 
         bool
@@ -195,7 +189,7 @@ namespace tdoc_ucp {
         com::sun::star::uno::Reference<
             com::sun::star::uno::XComponentContext >        m_xContext;
         com::sun::star::uno::Reference<
-            com::sun::star::document::XEventBroadcaster >   m_xDocEvtNotifier;
+            com::sun::star::frame::XGlobalEventBroadcaster > m_xDocEvtNotifier;
         com::sun::star::uno::Reference<
             com::sun::star::frame::XModuleManager2 >        m_xModuleMgr;
         DocumentList                                        m_aDocs;
diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx
index b2f06d5..494fa71 100644
--- a/ucb/source/ucp/tdoc/tdoc_provider.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx
@@ -38,7 +38,7 @@
 #include "com/sun/star/container/XNameAccess.hpp"
 #include "com/sun/star/embed/XStorage.hpp"
 
-#include "comphelper/componentcontext.hxx"
+#include "comphelper/processfactory.hxx"
 #include "ucbhelper/contentidentifier.hxx"
 
 #include "tdoc_provider.hxx"
@@ -61,7 +61,7 @@ using namespace tdoc_ucp;
 ContentProvider::ContentProvider(
             const uno::Reference< lang::XMultiServiceFactory >& xSMgr )
 : ::ucbhelper::ContentProviderImplHelper( xSMgr ),
-  m_xDocsMgr( new OfficeDocumentsManager( comphelper::ComponentContext(xSMgr).getUNOContext(), this ) ),
+  m_xDocsMgr( new OfficeDocumentsManager( comphelper::getComponentContext(xSMgr), this ) ),
   m_xStgElemFac( new StorageElementFactory( xSMgr, m_xDocsMgr ) )
 {
 }
commit cd693ff598bbabba66d8ca353a32bcbd81a5b12b
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Sep 7 15:14:55 2012 +0200

    fdo#46808, Adapt frame::GlobalEventBroadcaster UNO service to new style
    
    Create a merged XGlobalEventBroadcaster interface for this service to implement.
    Which is backwards-compatible, but does not require creating a new service.
    
    Also add two interfaces to the IDL, which the service already implemented,
    and existing client code already used.
    
    Change-Id: Ib7a9a30c0e50146ef621f3fe5227f8aad3190516

diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx
index 56559e5..0bff061 100644
--- a/basctl/source/basicide/doceventnotifier.cxx
+++ b/basctl/source/basicide/doceventnotifier.cxx
@@ -21,6 +21,7 @@
 #include "doceventnotifier.hxx"
 #include "scriptdocument.hxx"
 
+#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
 #include <com/sun/star/document/XEventBroadcaster.hpp>
 
 #include <vcl/svapp.hxx>
@@ -44,11 +45,13 @@ namespace basctl
     using ::com::sun::star::document::XEventBroadcaster;
     using ::com::sun::star::document::XEventListener;
     using ::com::sun::star::document::EventObject;
+    using ::com::sun::star::uno::XComponentContext;
     using ::com::sun::star::uno::RuntimeException;
     using ::com::sun::star::uno::Reference;
     using ::com::sun::star::uno::UNO_QUERY_THROW;
     using ::com::sun::star::uno::Exception;
     using ::com::sun::star::frame::XModel;
+    using ::com::sun::star::frame::GlobalEventBroadcaster;
     using ::com::sun::star::uno::UNO_QUERY;
     /** === end UNO using === **/
     namespace csslang = ::com::sun::star::lang;
@@ -210,10 +213,7 @@ namespace basctl
             {
                 Reference< com::sun::star::uno::XComponentContext > aContext(
                     comphelper::getProcessComponentContext() );
-                xBroadcaster.set(
-                    aContext->getServiceManager()->createInstanceWithContext(
-                        "com.sun.star.frame.GlobalEventBroadcaster", aContext ),
-                    UNO_QUERY_THROW );
+                xBroadcaster.set( GlobalEventBroadcaster::create(aContext), UNO_QUERY_THROW );
             }
 
             void ( SAL_CALL XEventBroadcaster::*listenerAction )( const Reference< XEventListener >& ) =
diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx
index 8887adc..55381f5 100644
--- a/cui/source/customize/eventdlg.cxx
+++ b/cui/source/customize/eventdlg.cxx
@@ -29,6 +29,7 @@
 #include <svtools/svmedit.hxx>
 #include <tools/diagnose_ex.h>
 #include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
 #include <com/sun/star/frame/XModuleManager.hpp>
 
 #include <comphelper/processfactory.hxx>
@@ -91,20 +92,15 @@ SvxEventConfigPage::SvxEventConfigPage( Window *pParent, const SfxItemSet& rSet,
     uno::Reference< document::XEventsSupplier > xSupplier;
 
     xSupplier = uno::Reference< document::XEventsSupplier > (
-        ::comphelper::getProcessServiceFactory()->createInstance(
-            OUString(RTL_CONSTASCII_USTRINGPARAM(
-                "com.sun.star.frame.GlobalEventBroadcaster" )) ),
-        uno::UNO_QUERY );
+        frame::GlobalEventBroadcaster::create(::comphelper::getProcessComponentContext()),
+        uno::UNO_QUERY_THROW );
 
     sal_uInt16 nPos(0);
-    if ( xSupplier.is() )
-    {
-        m_xAppEvents = xSupplier->getEvents();
-        nPos = aSaveInListBox.InsertEntry(
-            utl::ConfigManager::getProductName() );
-        aSaveInListBox.SetEntryData( nPos, new bool(true) );
-        aSaveInListBox.SelectEntryPos( nPos, sal_True );
-    }
+    m_xAppEvents = xSupplier->getEvents();
+    nPos = aSaveInListBox.InsertEntry(
+        utl::ConfigManager::getProductName() );
+    aSaveInListBox.SetEntryData( nPos, new bool(true) );
+    aSaveInListBox.SelectEntryPos( nPos, sal_True );
 }
 
 // -----------------------------------------------------------------------
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 48c2e0c..378d188 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -43,6 +43,7 @@
 #include "migration.hxx"
 
 #include <svtools/javacontext.hxx>
+#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
 #include <com/sun/star/frame/XSessionManagerListener.hpp>
 #include <com/sun/star/frame/XSynchronousDispatch.hpp>
 #include <com/sun/star/document/CorruptedFilterConfigurationException.hpp>
@@ -1531,8 +1532,7 @@ int Desktop::Main()
 
         // create service for loadin SFX (still needed in startup)
         pExecGlobals->xGlobalBroadcaster = Reference < css::document::XEventListener >
-            ( xSMgr->createInstance(
-            rtl::OUString( "com.sun.star.frame.GlobalEventBroadcaster" ) ), UNO_QUERY );
+            ( css::frame::GlobalEventBroadcaster::create(comphelper::ComponentContext(xSMgr).getUNOContext()), UNO_QUERY );
 
         /* ensure existance of a default window that messages can be dispatched to
            This is for the benefit of testtool which uses PostUserEvent extensively
diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx
index a6ce20f..75143fa 100644
--- a/extensions/source/update/ui/updatecheckui.cxx
+++ b/extensions/source/update/ui/updatecheckui.cxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/document/XEventListener.hpp>
 #include <com/sun/star/document/XEventBroadcaster.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
 #include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/task/XJob.hpp>
@@ -255,17 +256,8 @@ UpdateCheckUI::getGlobalEventBroadcaster() const throw (uno::RuntimeException)
             UNISTRING( "UpdateCheckUI: empty component context" ),
                 uno::Reference< uno::XInterface >() );
 
-    uno::Reference< lang::XMultiComponentFactory > xServiceManager(m_xContext->getServiceManager());
-
-    if( !xServiceManager.is() )
-        throw uno::RuntimeException(
-            UNISTRING( "UpdateCheckUI: unable to obtain service manager from component context" ),
-                uno::Reference< uno::XInterface >() );
-
     return uno::Reference<document::XEventBroadcaster> (
-        xServiceManager->createInstanceWithContext(
-            UNISTRING( "com.sun.star.frame.GlobalEventBroadcaster" ),
-            m_xContext),
+        frame::GlobalEventBroadcaster::create(m_xContext),
         uno::UNO_QUERY_THROW);
 }
 
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index 36f97e5..b7c3474 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -48,6 +48,7 @@
 #include <com/sun/star/beans/Property.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/document/CorruptedFilterConfigurationException.hpp>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/sequenceasvector.hxx>
 #include <comphelper/locale.hxx>
 #include <comphelper/processfactory.hxx>
@@ -249,7 +250,7 @@ void FilterCache::load(EFillState eRequired,
         // and starts a thread, which calls loadAll() at this filter cache.
         // Note: Its not a leak to create this listener with new here.
         // It kills itself after working!
-        /* LateInitListener* pLateInit = */ new LateInitListener(m_xSMGR);
+        /* LateInitListener* pLateInit = */ new LateInitListener(comphelper::ComponentContext(m_xSMGR).getUNOContext());
     }
 
     // ------------------------------------------
diff --git a/filter/source/config/cache/lateinitlistener.cxx b/filter/source/config/cache/lateinitlistener.cxx
index 21c4c80..517b1f2 100644
--- a/filter/source/config/cache/lateinitlistener.cxx
+++ b/filter/source/config/cache/lateinitlistener.cxx
@@ -34,6 +34,8 @@
 #include "lateinitlistener.hxx"
 #include "lateinitthread.hxx"
 
+#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
+
 
 namespace filter{
     namespace config{
@@ -43,9 +45,8 @@ namespace css = ::com::sun::star;
 
 
 
-LateInitListener::LateInitListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+LateInitListener::LateInitListener(const css::uno::Reference< css::uno::XComponentContext >& rxContext)
     : BaseLock(     )
-    , m_xSMGR (xSMGR)
 {
     // important to do so ...
     // Otherwise the temp. reference to ourselves
@@ -53,7 +54,7 @@ LateInitListener::LateInitListener(const css::uno::Reference< css::lang::XMultiS
     osl_atomic_increment( &m_refCount );
 
     m_xBroadcaster = css::uno::Reference< css::document::XEventBroadcaster >(
-        m_xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.GlobalEventBroadcaster" ))),
+        css::frame::GlobalEventBroadcaster::create(rxContext),
         css::uno::UNO_QUERY_THROW);
 
     m_xBroadcaster->addEventListener(static_cast< css::document::XEventListener* >(this));
diff --git a/filter/source/config/cache/lateinitlistener.hxx b/filter/source/config/cache/lateinitlistener.hxx
index 2549dfb..b2e49eb 100644
--- a/filter/source/config/cache/lateinitlistener.hxx
+++ b/filter/source/config/cache/lateinitlistener.hxx
@@ -52,10 +52,6 @@ class LateInitListener : public BaseLock // must be the first one to guarantee r
 
     private:
 
-        /** @short  reference to an uno service manager, which can be used
-                    to create own needed services. */
-        css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
-
         /** @short  reference to the global event broadcaster, which is usde to find
                     out, when the first office document was opened successfully. */
         css::uno::Reference< css::document::XEventBroadcaster > m_xBroadcaster;
@@ -75,11 +71,11 @@ class LateInitListener : public BaseLock // must be the first one to guarantee r
                     on the global event broadcaster to get the information, when
                     loading of the first document was finished.
 
-            @param  xSMGR
-                    reference to a service manager, which can be used to create
+            @param  rxContext
+                    reference to a component context, which can be used to create
                     own needed uno services.
          */
-        LateInitListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+        LateInitListener(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
 
         //---------------------------------------
 
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
index ad0e65d..f177653 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -26,27 +26,29 @@
  *
  ************************************************************************/
 
-#include <com/sun/star/frame/XConfigManager.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
 #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
-#include <com/sun/star/xml/XImportFilter.hpp>
-#include <com/sun/star/xml/XExportFilter.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
+#include <com/sun/star/frame/XConfigManager.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
 #include <com/sun/star/frame/XComponentLoader.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
-#include <com/sun/star/document/XFilter.hpp>
-#include <comphelper/oslfile2streamwrap.hxx>
-#include <com/sun/star/document/XExporter.hpp>
-#include <com/sun/star/task/XInteractionHandler.hpp>
-
+#include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/system/SystemShellExecute.hpp>
 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/xml/XImportFilter.hpp>
+#include <com/sun/star/xml/XExportFilter.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 
-#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/oslfile2streamwrap.hxx>
 #include <vcl/svapp.hxx>
 #include <osl/mutex.hxx>
 #include <sfx2/filedlghelper.hxx>
@@ -186,12 +188,9 @@ XMLFilterTestDialog::XMLFilterTestDialog( Window* pParent, ResMgr& rResMgr, cons
         if( xCfgMgr.is() )
             sDTDPath = xCfgMgr->substituteVariables( sDTDPath );
 
-        mxGlobalBroadcaster = Reference < XEventBroadcaster >::query( mxMSF->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.GlobalEventBroadcaster" )) ) );
-        if ( mxGlobalBroadcaster.is() )
-        {
-            mxGlobalEventListener = new GlobalEventListenerImpl( this );
-            mxGlobalBroadcaster->addEventListener( mxGlobalEventListener );
-        }
+        mxGlobalBroadcaster = Reference < XEventBroadcaster >( GlobalEventBroadcaster::create(comphelper::ComponentContext(mxMSF).getUNOContext()), UNO_QUERY_THROW );
+        mxGlobalEventListener = new GlobalEventListenerImpl( this );
+        mxGlobalBroadcaster->addEventListener( mxGlobalEventListener );
     }
     catch( const Exception& )
     {
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index b053b9b..fb7f0af 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -133,6 +133,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\
 	DispatchHelper \
 	DispatchRecorderSupplier \
 	DocumentTemplates \
+	GlobalEventBroadcaster \
 	MediaTypeDetectionHelper \
 	ModuleManager \
 	UICommandDescription \
@@ -814,7 +815,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/frame,\
 	FrameLoader \
 	FrameLoaderFactory \
 	FramesContainer \
-	GlobalEventBroadcaster \
 	LayoutManager \
 	PopupMenuController \
 	PopupMenuControllerFactory \
@@ -2522,6 +2522,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/frame,\
 	XFrameSetModel \
 	XFrames \
 	XFramesSupplier \
+	XGlobalEventBroadcaster \
 	XInterceptorInfo \
 	XLayoutManager \
 	XLayoutManagerEventBroadcaster \
diff --git a/offapi/com/sun/star/frame/GlobalEventBroadcaster.idl b/offapi/com/sun/star/frame/GlobalEventBroadcaster.idl
index 4a221b0..e31ebd4 100644
--- a/offapi/com/sun/star/frame/GlobalEventBroadcaster.idl
+++ b/offapi/com/sun/star/frame/GlobalEventBroadcaster.idl
@@ -19,11 +19,10 @@
 #ifndef __com_sun_star_frame_GlobalEventBroadcaster_idl__
 #define __com_sun_star_frame_GlobalEventBroadcaster_idl__
 
-#include <com/sun/star/document/XEventBroadcaster.idl>
-#include <com/sun/star/document/XEventsSupplier.idl>
+#include <com/sun/star/frame/XGlobalEventBroadcaster.idl>
 
 
- module com {  module sun {  module star {  module frame {
+module com {  module sun {  module star {  module frame {
 
 /**
     This service offers the document event functionality that can be found at any
@@ -32,17 +31,7 @@
     documents.
  */
 
-service GlobalEventBroadcaster
-{
-        /** makes it possible to register listeners which are called whenever
-            a document event occurs in any document
-         */
-        interface ::com::sun::star::document::XEventsSupplier;
-
-        /** access to bound event handlers
-         */
-        interface ::com::sun::star::document::XEventBroadcaster;
-};
+service GlobalEventBroadcaster : XGlobalEventBroadcaster;
 
 
 }; }; }; };
diff --git a/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl b/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl
new file mode 100644
index 0000000..0f3343b
--- /dev/null
+++ b/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl
@@ -0,0 +1,54 @@
+/* -*- 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_frame_XGlobalEventBroadcaster_idl__
+#define __com_sun_star_frame_XGlobalEventBroadcaster_idl__
+
+#include <com/sun/star/document/XEventBroadcaster.idl>
+#include <com/sun/star/document/XEventsSupplier.idl>
+#include <com/sun/star/container/XSet.idl>
+
+
+ module com {  module sun {  module star {  module frame {
+
+/**
+   Provides a unified interface for the GlobalEventBroadcaster service to implement.
+ */
+
+interface XGlobalEventBroadcaster
+{
+        /** makes it possible to register listeners which are called whenever
+            a document event occurs in any document
+         */
+        interface ::com::sun::star::document::XEventsSupplier;
+
+        /** access to bound event handlers
+         */
+        interface ::com::sun::star::document::XEventBroadcaster;
+
+        interface ::com::sun::star::container::XSet;
+
+        interface ::com::sun::star::document::XEventListener;
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index d5f776b..0a77878 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -21,6 +21,7 @@
 #include <sfx2/app.hxx>
 #include <com/sun/star/frame/XTerminateListener.hpp>
 #include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
 #include <com/sun/star/frame/XDesktop.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 
@@ -111,14 +112,12 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a
     pApp->Get_Impl()->pAppDispatch->ReleaseAll();
     pApp->Get_Impl()->pAppDispatch->release();
 
-    css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
-    css::uno::Reference< css::document::XEventListener > xGlobalBroadcaster(xSMGR->createInstance("com.sun.star.frame.GlobalEventBroadcaster"), css::uno::UNO_QUERY);
-    if (xGlobalBroadcaster.is())
-    {
-        css::document::EventObject aEvent2;
-        aEvent2.EventName = "OnCloseApp";
-        xGlobalBroadcaster->notifyEvent(aEvent2);
-    }
+    css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+    css::uno::Reference< css::frame::XGlobalEventBroadcaster > xGlobalBroadcaster = css::frame::GlobalEventBroadcaster::create(xContext);
+
+    css::document::EventObject aEvent2;
+    aEvent2.EventName = "OnCloseApp";
+    xGlobalBroadcaster->notifyEvent(aEvent2);
 
     delete pApp;
     Application::Quit();
diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx
index f5aee6c..22ef4d0 100644
--- a/sfx2/source/config/evntconf.cxx
+++ b/sfx2/source/config/evntconf.cxx
@@ -44,6 +44,7 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/container/XNameReplace.hpp>
 #include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/uno/Reference.hxx>
 
@@ -231,8 +232,8 @@ void PropagateEvent_Impl( SfxObjectShell *pDoc, rtl::OUString aEventName, const
     else
     {
         xSupplier = uno::Reference < document::XEventsSupplier >
-                ( ::comphelper::getProcessServiceFactory()->createInstance(
-                rtl::OUString("com.sun.star.frame.GlobalEventBroadcaster")), uno::UNO_QUERY );
+                ( frame::GlobalEventBroadcaster::create(::comphelper::getProcessComponentContext()),
+                  uno::UNO_QUERY );
     }
 
     if ( xSupplier.is() )
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 9e7407a..b9b5f04 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -25,6 +25,7 @@
 #include <svl/eitem.hxx>
 #include <svl/stritem.hxx>
 #include <svl/intitem.hxx>
+#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/frame/XFrame.hpp>
@@ -147,20 +148,16 @@ void impl_addToModelCollection(const css::uno::Reference< css::frame::XModel >&
     if (!xModel.is())
         return;
 
-    css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
-    css::uno::Reference< css::container::XSet > xModelCollection(
-        xSMGR->createInstance(::rtl::OUString("com.sun.star.frame.GlobalEventBroadcaster")),
-        css::uno::UNO_QUERY);
-    if (xModelCollection.is())
+    css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+    css::uno::Reference< css::frame::XGlobalEventBroadcaster > xModelCollection =
+        css::frame::GlobalEventBroadcaster::create(xContext);
+    try
     {
-        try
-        {
-            xModelCollection->insert(css::uno::makeAny(xModel));
-        }
-        catch ( uno::Exception& )
-        {
-            OSL_FAIL( "The document seems to be in the collection already!\n" );
-        }
+        xModelCollection->insert(css::uno::makeAny(xModel));
+    }
+    catch ( uno::Exception& )
+    {
+        OSL_FAIL( "The document seems to be in the collection already!\n" );
     }
 }
 
diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx
index 9b2793a..6bd1f28 100644
--- a/sfx2/source/inc/eventsupplier.hxx
+++ b/sfx2/source/inc/eventsupplier.hxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
 #include <com/sun/star/document/XDocumentEventListener.hpp>
 #include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/frame/XGlobalEventBroadcaster.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/task/XJobExecutor.hpp>
 #include <com/sun/star/uno/Reference.hxx>
@@ -39,7 +40,6 @@
 #include <cppuhelper/implbase2.hxx>
 #include <cppuhelper/implbase3.hxx>
 #include <cppuhelper/implbase4.hxx>
-#include <cppuhelper/implbase7.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 #include <comphelper/sequenceasvector.hxx>
 #include <sfx2/sfxuno.hxx>
@@ -173,13 +173,11 @@ class ModelCollectionEnumeration : public ModelCollectionMutexBase
 
 //=============================================================================
 class SfxGlobalEvents_Impl : public ModelCollectionMutexBase
-                           , public ::cppu::WeakImplHelper7< ::com::sun::star::lang::XServiceInfo
-                                                           , ::com::sun::star::document::XEventsSupplier
-                                                           , ::com::sun::star::document::XEventBroadcaster
+                           , public ::cppu::WeakImplHelper4< ::com::sun::star::lang::XServiceInfo
+                                                           , ::com::sun::star::frame::XGlobalEventBroadcaster
                                                            , ::com::sun::star::document::XDocumentEventBroadcaster
-                                                           , ::com::sun::star::document::XEventListener
                                                            , ::com::sun::star::document::XDocumentEventListener
-                                                           , ::com::sun::star::container::XSet >
+                                                            >
 {
     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMGR;
     ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xEvents;
diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
index 8753295..c4e4bd6 100644
--- a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
@@ -39,12 +39,12 @@
 
 #include "comphelper/documentinfo.hxx"
 #include "comphelper/namedvaluecollection.hxx"
-#include "comphelper/processfactory.hxx"
 
 #include "com/sun/star/awt/XTopWindow.hpp"
 #include "com/sun/star/beans/XPropertySet.hpp"
 #include "com/sun/star/container/XEnumerationAccess.hpp"
 #include "com/sun/star/document/XStorageBasedDocument.hpp"
+#include "com/sun/star/frame/GlobalEventBroadcaster.hpp"
 #include "com/sun/star/frame/XStorable.hpp"
 #include "com/sun/star/frame/ModuleManager.hpp"
 #include "com/sun/star/lang/DisposedException.hpp"
@@ -112,10 +112,10 @@ void SAL_CALL OfficeDocumentsManager::OfficeDocumentsCloseListener::disposing(
 //=========================================================================
 
 OfficeDocumentsManager::OfficeDocumentsManager(
-            const uno::Reference< lang::XMultiServiceFactory > & xSMgr,
+            const uno::Reference< uno::XComponentContext > & rxContext,
             OfficeDocumentsEventListener * pDocEventListener )
-: m_xSMgr( xSMgr ),
-  m_xDocEvtNotifier( createDocumentEventNotifier( xSMgr ) ),
+: m_xContext( rxContext ),
+  m_xDocEvtNotifier( createDocumentEventNotifier( rxContext ) ),
   m_pDocEventListener( pDocEventListener ),
   m_xDocCloseListener( new OfficeDocumentsCloseListener( this ) )
 {
@@ -460,15 +460,12 @@ void SAL_CALL OfficeDocumentsManager::disposing(
 // static
 uno::Reference< document::XEventBroadcaster >
 OfficeDocumentsManager::createDocumentEventNotifier(
-        const uno::Reference< lang::XMultiServiceFactory >& rXSMgr )
+        const uno::Reference< uno::XComponentContext >& rxContext )
 {
     uno::Reference< uno::XInterface > xIfc;
     try
     {
-        xIfc = rXSMgr->createInstance(
-            rtl::OUString(
-                RTL_CONSTASCII_USTRINGPARAM(
-                    "com.sun.star.frame.GlobalEventBroadcaster" ) ) );
+        xIfc = frame::GlobalEventBroadcaster::create(rxContext);
     }
     catch ( uno::Exception const & )
     {
@@ -702,8 +699,7 @@ bool OfficeDocumentsManager::isBasicIDE(
         {
             try
             {
-                m_xModuleMgr = frame::ModuleManager::create(
-                    comphelper::getComponentContext(m_xSMgr));
+                m_xModuleMgr = frame::ModuleManager::create( m_xContext );
             }
             catch ( uno::Exception const & )
             {
diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx
index ff1a07e..3ba30a4 100644
--- a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx
@@ -123,7 +123,7 @@ namespace tdoc_ucp {
     public:
         OfficeDocumentsManager(
             const com::sun::star::uno::Reference<
-                com::sun::star::lang::XMultiServiceFactory > & xSMgr,
+                com::sun::star::uno::XComponentContext > & rxContext,
             OfficeDocumentsEventListener * pDocEventListener );
         virtual ~OfficeDocumentsManager();
 
@@ -162,7 +162,7 @@ namespace tdoc_ucp {
             com::sun::star::document::XEventBroadcaster >
         createDocumentEventNotifier(
             const com::sun::star::uno::Reference<
-                com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
+                com::sun::star::uno::XComponentContext >& rxContext );
 
         void buildDocumentsList();
 
@@ -193,7 +193,7 @@ namespace tdoc_ucp {
 
         osl::Mutex                                          m_aMtx;
         com::sun::star::uno::Reference<
-            com::sun::star::lang::XMultiServiceFactory >    m_xSMgr;
+            com::sun::star::uno::XComponentContext >        m_xContext;
         com::sun::star::uno::Reference<
             com::sun::star::document::XEventBroadcaster >   m_xDocEvtNotifier;
         com::sun::star::uno::Reference<
diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx
index be5a4f1..b2f06d5 100644
--- a/ucb/source/ucp/tdoc/tdoc_provider.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx
@@ -38,6 +38,7 @@
 #include "com/sun/star/container/XNameAccess.hpp"
 #include "com/sun/star/embed/XStorage.hpp"
 
+#include "comphelper/componentcontext.hxx"
 #include "ucbhelper/contentidentifier.hxx"
 
 #include "tdoc_provider.hxx"
@@ -60,7 +61,7 @@ using namespace tdoc_ucp;
 ContentProvider::ContentProvider(
             const uno::Reference< lang::XMultiServiceFactory >& xSMgr )
 : ::ucbhelper::ContentProviderImplHelper( xSMgr ),
-  m_xDocsMgr( new OfficeDocumentsManager( xSMgr, this ) ),
+  m_xDocsMgr( new OfficeDocumentsManager( comphelper::ComponentContext(xSMgr).getUNOContext(), this ) ),
   m_xStgElemFac( new StorageElementFactory( xSMgr, m_xDocsMgr ) )
 {
 }


More information about the Libreoffice-commits mailing list