summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-09-07 15:14:55 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-27 10:30:42 +0200
commitcd693ff598bbabba66d8ca353a32bcbd81a5b12b (patch)
tree525e9fe8fdd44e6ccba4f61e999aeb1332d2b896
parent526e007bb6340e2c4a2cb96f5612ba268fcd5583 (diff)
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
-rw-r--r--basctl/source/basicide/doceventnotifier.cxx8
-rw-r--r--cui/source/customize/eventdlg.cxx20
-rw-r--r--desktop/source/app/app.cxx4
-rw-r--r--extensions/source/update/ui/updatecheckui.cxx12
-rw-r--r--filter/source/config/cache/filtercache.cxx3
-rw-r--r--filter/source/config/cache/lateinitlistener.cxx7
-rw-r--r--filter/source/config/cache/lateinitlistener.hxx10
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.cxx39
-rw-r--r--offapi/UnoApi_offapi.mk3
-rw-r--r--offapi/com/sun/star/frame/GlobalEventBroadcaster.idl17
-rw-r--r--offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl54
-rw-r--r--sfx2/source/appl/appinit.cxx15
-rw-r--r--sfx2/source/config/evntconf.cxx5
-rw-r--r--sfx2/source/doc/objstor.cxx23
-rw-r--r--sfx2/source/inc/eventsupplier.hxx10
-rw-r--r--ucb/source/ucp/tdoc/tdoc_docmgr.cxx18
-rw-r--r--ucb/source/ucp/tdoc/tdoc_docmgr.hxx6
-rw-r--r--ucb/source/ucp/tdoc/tdoc_provider.cxx3
18 files changed, 139 insertions, 118 deletions
diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx
index 56559e56b4cb..0bff061c09d3 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 8887adc4bbec..55381f5cefe1 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 48c2e0cb91bc..378d18808207 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 a6ce20f64a78..75143fa018d9 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 36f97e5cfc43..b7c3474259a7 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 21c4c808efa4..517b1f27e299 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 2549dfbdc9f1..b2e49eb0c707 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 ad0e65d3f894..f177653ce6fa 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 b053b9bd346e..fb7f0afe2163 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 4a221b0dce1e..e31ebd494d74 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 000000000000..0f3343b654ce
--- /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 d5f776b6e384..0a778788b7fc 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 f5aee6c35eb2..22ef4d0acf01 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 9e7407a7ea65..b9b5f0480551 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 9b2793a33f06..6bd1f284ee36 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 87532955d52a..c4e4bd6b67b2 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 ff1a07e885fe..3ba30a4a7e91 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 be5a4f1920fb..b2f06d575477 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 ) )
{
}