diff options
24 files changed, 99 insertions, 65 deletions
diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx index 957ae1b8ea1b..9aa94f0ca3e0 100644 --- a/basctl/source/basicide/doceventnotifier.cxx +++ b/basctl/source/basicide/doceventnotifier.cxx @@ -21,7 +21,7 @@ #include "doceventnotifier.hxx" #include "scriptdocument.hxx" -#include <com/sun/star/frame/GlobalEventBroadcaster.hpp> +#include <com/sun/star/frame/theGlobalEventBroadcaster.hpp> #include <com/sun/star/document/XEventBroadcaster.hpp> #include <vcl/svapp.hxx> @@ -50,7 +50,7 @@ namespace basctl 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::frame::theGlobalEventBroadcaster; using ::com::sun::star::uno::UNO_QUERY; namespace csslang = ::com::sun::star::lang; @@ -212,7 +212,7 @@ namespace basctl { Reference< com::sun::star::uno::XComponentContext > aContext( comphelper::getProcessComponentContext() ); - xBroadcaster.set( GlobalEventBroadcaster::create(aContext), UNO_QUERY_THROW ); + xBroadcaster.set( theGlobalEventBroadcaster::get(aContext), UNO_QUERY_THROW ); } void ( SAL_CALL XEventBroadcaster::*listenerAction )( const Reference< XEventListener >& ) = diff --git a/basctl/source/inc/doceventnotifier.hxx b/basctl/source/inc/doceventnotifier.hxx index 4b950b17b893..372f5fcb704c 100644 --- a/basctl/source/inc/doceventnotifier.hxx +++ b/basctl/source/inc/doceventnotifier.hxx @@ -55,7 +55,7 @@ namespace basctl //==================================================================== //= DocumentEventNotifier //==================================================================== - /** allows registering at the GlobalEventBroadcaster for global document events + /** allows registering at theGlobalEventBroadcaster for global document events */ class DocumentEventNotifier { diff --git a/bin/benchmark-document-loading b/bin/benchmark-document-loading index 98d2855a83fa..07dc45978ac9 100644 --- a/bin/benchmark-document-loading +++ b/bin/benchmark-document-loading @@ -275,7 +275,8 @@ def loadFromURL(xContext, url, t, component): xListener = None if component == "writer": xListener = EventListener() - xGEB = xContext.ServiceManager.createInstanceWithContext("com.sun.star.frame.GlobalEventBroadcaster", xContext) + xGEB = xContext.getValueByName( + "/singletons/com.sun.star.frame.theGlobalEventBroadcaster") xGEB.addDocumentEventListener(xListener) try: xDoc = None diff --git a/bin/convwatch.py b/bin/convwatch.py index bdb09beb4b8e..bef3f9e16c77 100644 --- a/bin/convwatch.py +++ b/bin/convwatch.py @@ -237,8 +237,8 @@ def loadFromURL(xContext, url): props = [("Hidden", True), ("ReadOnly", True)] # FilterName? loadProps = tuple([mkPropertyValue(name, value) for (name, value) in props]) xListener = EventListener() - xGEB = xContext.ServiceManager.createInstanceWithContext( - "com.sun.star.frame.GlobalEventBroadcaster", xContext) + xGEB = xContext.getValueByName( + "/singletons/com.sun.star.frame.theGlobalEventBroadcaster") xGEB.addDocumentEventListener(xListener) try: xDoc = xDesktop.loadComponentFromURL(url, "_blank", 0, loadProps) diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx index e3563ee8a5fd..abe8013a35bd 100644 --- a/cui/source/customize/eventdlg.cxx +++ b/cui/source/customize/eventdlg.cxx @@ -21,7 +21,7 @@ #include <tools/diagnose_ex.h> #include <com/sun/star/document/XEventsSupplier.hpp> #include <com/sun/star/frame/Desktop.hpp> -#include <com/sun/star/frame/GlobalEventBroadcaster.hpp> +#include <com/sun/star/frame/theGlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XModuleManager.hpp> #include <comphelper/processfactory.hxx> @@ -83,7 +83,7 @@ SvxEventConfigPage::SvxEventConfigPage( Window *pParent, const SfxItemSet& rSet, uno::Reference< frame::XGlobalEventBroadcaster > xSupplier; xSupplier = - frame::GlobalEventBroadcaster::create(::comphelper::getProcessComponentContext()); + frame::theGlobalEventBroadcaster::get(::comphelper::getProcessComponentContext()); sal_uInt16 nPos(0); m_xAppEvents = xSupplier->getEvents(); diff --git a/dbaccess/qa/complex/dbaccess/Beamer.java b/dbaccess/qa/complex/dbaccess/Beamer.java index 6fc022c4fe52..97c4c6b4f45b 100644 --- a/dbaccess/qa/complex/dbaccess/Beamer.java +++ b/dbaccess/qa/complex/dbaccess/Beamer.java @@ -20,14 +20,15 @@ package complex.dbaccess; import com.sun.star.beans.PropertyState; import com.sun.star.beans.PropertyValue; import com.sun.star.container.XEnumeration; -import com.sun.star.container.XEnumerationAccess; import com.sun.star.frame.FrameSearchFlag; import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XController; import com.sun.star.frame.XDispatch; import com.sun.star.frame.XDispatchProvider; import com.sun.star.frame.XFrame; +import com.sun.star.frame.XGlobalEventBroadcaster; import com.sun.star.frame.XModel; +import com.sun.star.frame.theGlobalEventBroadcaster; import com.sun.star.lang.XComponent; import com.sun.star.sdb.CommandType; import com.sun.star.uno.Exception; @@ -111,7 +112,8 @@ public class Beamer extends TestCase final XFrame beamer = frame.findFrame("_beamer", 0); assertNotNull(beamer); - final XEnumerationAccess evtBc = UnoRuntime.queryInterface(XEnumerationAccess.class, getMSF().createInstance("com.sun.star.frame.GlobalEventBroadcaster")); + final XGlobalEventBroadcaster evtBc = theGlobalEventBroadcaster.get( + getComponentContext()); XEnumeration enumeration = evtBc.createEnumeration(); int count = -1; while (enumeration.hasMoreElements()) diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java index fc5999dcba5f..7f1ab1309811 100644 --- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java +++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java @@ -36,7 +36,6 @@ import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameContainer; import com.sun.star.container.XSet; -import com.sun.star.document.XDocumentEventBroadcaster; import com.sun.star.document.XDocumentEventListener; import com.sun.star.document.XEmbeddedScripts; import com.sun.star.document.XEventsSupplier; @@ -45,10 +44,12 @@ import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XDispatch; import com.sun.star.frame.XDispatchProvider; import com.sun.star.frame.XFrame; +import com.sun.star.frame.XGlobalEventBroadcaster; import com.sun.star.frame.XLoadable; import com.sun.star.frame.XModel; import com.sun.star.frame.XModel2; import com.sun.star.frame.XTitle; +import com.sun.star.frame.theGlobalEventBroadcaster; import com.sun.star.lang.EventObject; import com.sun.star.lang.XServiceInfo; import com.sun.star.lang.XSingleComponentFactory; @@ -260,7 +261,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. globalFactory.insert(m_callbackFactory); // register ourself as listener at the global event broadcaster - final XDocumentEventBroadcaster broadcaster = UnoRuntime.queryInterface(XDocumentEventBroadcaster.class, getMSF().createInstance("com.sun.star.frame.GlobalEventBroadcaster")); + final XGlobalEventBroadcaster broadcaster + = theGlobalEventBroadcaster.get(getComponentContext()); broadcaster.addDocumentEventListener(this); } catch (Exception e) @@ -282,7 +284,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. m_callbackFactory.dispose(); // revoke ourself as listener at the global event broadcaster - final XDocumentEventBroadcaster broadcaster = UnoRuntime.queryInterface(XDocumentEventBroadcaster.class, getMSF().createInstance("com.sun.star.frame.GlobalEventBroadcaster")); + final XGlobalEventBroadcaster broadcaster + = theGlobalEventBroadcaster.get(getComponentContext()); broadcaster.removeDocumentEventListener(this); } catch (Exception e) diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index ba4ec618306f..ae1f9b987b60 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -36,7 +36,7 @@ #include <com/sun/star/embed/XTransactionBroadcaster.hpp> #include <com/sun/star/embed/StorageFactory.hpp> #include <com/sun/star/form/XLoadable.hpp> -#include <com/sun/star/frame/GlobalEventBroadcaster.hpp> +#include <com/sun/star/frame/theGlobalEventBroadcaster.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/sdb/BooleanComparisonMode.hpp> #include <com/sun/star/script/DocumentScriptLibraryContainer.hpp> @@ -952,7 +952,7 @@ Reference< XModel > ODatabaseModelImpl::createNewModel_deliverOwnership( bool _b try { - Reference< XGlobalEventBroadcaster > xModelCollection = GlobalEventBroadcaster::create( m_aContext ); + Reference< XGlobalEventBroadcaster > xModelCollection = theGlobalEventBroadcaster::get( m_aContext ); xModelCollection->insert( makeAny( xModel ) ); } catch( const Exception& ) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 79eabdb69ad6..691dc6cddf35 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -40,7 +40,7 @@ #include <svtools/javacontext.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/AutoRecovery.hpp> -#include <com/sun/star/frame/GlobalEventBroadcaster.hpp> +#include <com/sun/star/frame/theGlobalEventBroadcaster.hpp> #include <com/sun/star/frame/SessionListener.hpp> #include <com/sun/star/frame/XSessionManagerListener.hpp> #include <com/sun/star/frame/XSynchronousDispatch.hpp> @@ -1513,7 +1513,7 @@ int Desktop::Main() // create service for loadin SFX (still needed in startup) pExecGlobals->xGlobalBroadcaster = Reference < css::document::XEventListener > - ( css::frame::GlobalEventBroadcaster::create(xContext), UNO_QUERY_THROW ); + ( css::frame::theGlobalEventBroadcaster::get(xContext), 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 diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index 9d1e53517836..f52f5c53929a 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -28,7 +28,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/frame/theGlobalEventBroadcaster.hpp> #include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/task/XJob.hpp> @@ -155,9 +155,6 @@ private: void AddMenuBarIcon( SystemWindow* pSysWin, bool bAddEventHdl ); Image GetBubbleImage( OUString &rURL ); - uno::Reference< document::XEventBroadcaster > getGlobalEventBroadcaster() const - throw (uno::RuntimeException); - public: UpdateCheckUI(const uno::Reference<uno::XComponentContext>&); virtual ~UpdateCheckUI(); @@ -220,7 +217,7 @@ UpdateCheckUI::UpdateCheckUI(const uno::Reference<uno::XComponentContext>& xCont maTimeoutTimer.SetTimeout( 10000 ); maTimeoutTimer.SetTimeoutHdl( LINK( this, UpdateCheckUI, TimeOutHdl ) ); - uno::Reference< document::XEventBroadcaster > xBroadcaster( getGlobalEventBroadcaster() ); + uno::Reference< document::XEventBroadcaster > xBroadcaster( frame::theGlobalEventBroadcaster::get(m_xContext) ); xBroadcaster->addEventListener( this ); maWindowEventHdl = LINK( this, UpdateCheckUI, WindowEventHdl ); @@ -238,20 +235,6 @@ UpdateCheckUI::~UpdateCheckUI() } //------------------------------------------------------------------------------ -uno::Reference<document::XEventBroadcaster> -UpdateCheckUI::getGlobalEventBroadcaster() const throw (uno::RuntimeException) -{ - if( !m_xContext.is() ) - throw uno::RuntimeException( - "UpdateCheckUI: empty component context", - uno::Reference< uno::XInterface >() ); - - return uno::Reference<document::XEventBroadcaster> ( - frame::GlobalEventBroadcaster::create(m_xContext), - uno::UNO_QUERY_THROW); -} - -//------------------------------------------------------------------------------ OUString SAL_CALL UpdateCheckUI::getImplementationName() throw (uno::RuntimeException) { diff --git a/filter/source/config/cache/lateinitlistener.cxx b/filter/source/config/cache/lateinitlistener.cxx index 141cfffceacc..222446dc4e5d 100644 --- a/filter/source/config/cache/lateinitlistener.cxx +++ b/filter/source/config/cache/lateinitlistener.cxx @@ -25,7 +25,7 @@ #include "lateinitlistener.hxx" #include "lateinitthread.hxx" -#include <com/sun/star/frame/GlobalEventBroadcaster.hpp> +#include <com/sun/star/frame/theGlobalEventBroadcaster.hpp> namespace filter{ @@ -40,7 +40,7 @@ LateInitListener::LateInitListener(const css::uno::Reference< css::uno::XCompone osl_atomic_increment( &m_refCount ); m_xBroadcaster = css::uno::Reference< css::document::XEventBroadcaster >( - css::frame::GlobalEventBroadcaster::create(rxContext), + css::frame::theGlobalEventBroadcaster::get(rxContext), css::uno::UNO_QUERY_THROW); m_xBroadcaster->addEventListener(static_cast< css::document::XEventListener* >(this)); diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 359863cc9ce1..70e2350a57a5 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -24,7 +24,7 @@ #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/frame/GlobalEventBroadcaster.hpp> +#include <com/sun/star/frame/theGlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XConfigManager.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> @@ -166,7 +166,7 @@ XMLFilterTestDialog::XMLFilterTestDialog(Window* pParent, try { - mxGlobalBroadcaster = GlobalEventBroadcaster::create(mxContext); + mxGlobalBroadcaster = theGlobalEventBroadcaster::get(mxContext); mxGlobalEventListener = new GlobalEventListenerImpl( this ); mxGlobalBroadcaster->addEventListener( mxGlobalEventListener ); } diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx index 02ae9a808258..04f0c8f4fdb5 100644 --- a/framework/inc/services/autorecovery.hxx +++ b/framework/inc/services/autorecovery.hxx @@ -31,8 +31,8 @@ #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/frame/GlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XGlobalEventBroadcaster.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/document/XEventListener.hpp> #include <com/sun/star/document/XEventBroadcaster.hpp> diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index fef85c4b985a..1e12efcad48b 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/ucb/NameClash.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/frame/Desktop.hpp> -#include <com/sun/star/frame/GlobalEventBroadcaster.hpp> +#include <com/sun/star/frame/theGlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/frame/ModuleManager.hpp> @@ -1364,7 +1364,7 @@ void AutoRecovery::implts_startListening() if (!xBroadcaster.is()) { - xBroadcaster = css::frame::GlobalEventBroadcaster::create( xContext ); + xBroadcaster = css::frame::theGlobalEventBroadcaster::get( xContext ); // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); m_xNewDocBroadcaster = xBroadcaster; @@ -2597,7 +2597,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa since our last AutoSave. And we deregister us in case we know this state. But directly after one document as recovered ... we must start listening. Otherwhise the first "modify" doesn't reach us. Because we ourself called setModified() - on the document via API. And currently we dont listen for any events (not at the GlobalEventBroadcaster + on the document via API. And currently we dont listen for any events (not at theGlobalEventBroadcaster nor at any document!). */ implts_startModifyListeningOnDoc(rInfo); diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 66d1b6e5b435..bd38826bea31 100755 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -200,6 +200,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/frame,\ StartModule \ TaskCreator \ UICommandDescription \ + theGlobalEventBroadcaster \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/graphic,\ GraphicObject \ diff --git a/offapi/com/sun/star/frame/GlobalEventBroadcaster.idl b/offapi/com/sun/star/frame/GlobalEventBroadcaster.idl index 6fe6af8eb54a..47fbc9e842c3 100644 --- a/offapi/com/sun/star/frame/GlobalEventBroadcaster.idl +++ b/offapi/com/sun/star/frame/GlobalEventBroadcaster.idl @@ -25,12 +25,11 @@ module com { module sun { module star { module frame { /** - This service offers the document event functionality that can be found at any - com::sun::star::document::OfficeDocument, but it does it for all existing documents. - So it is a single place where a listener can be registered for all events in all - documents. - */ + A legacy (single-instance) service-variant of theGlobalEventBroadcaster + singleton. + @deprecated Use theGlobalEventBroadcaster singleton instead. +*/ service GlobalEventBroadcaster : XGlobalEventBroadcaster; diff --git a/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl b/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl index ca5d9fd11eef..e4b6043f2894 100644 --- a/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl +++ b/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl @@ -28,7 +28,7 @@ module com { module sun { module star { module frame { /** - Provides a unified interface for the GlobalEventBroadcaster service to implement. + Provides the unified interface of theGlobalEventBroadcaster singleton. @since LibreOffice 4.0 */ diff --git a/offapi/com/sun/star/frame/theGlobalEventBroadcaster.idl b/offapi/com/sun/star/frame/theGlobalEventBroadcaster.idl new file mode 100644 index 000000000000..b802a1385bc6 --- /dev/null +++ b/offapi/com/sun/star/frame/theGlobalEventBroadcaster.idl @@ -0,0 +1,46 @@ +/* -*- 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_GLOBALEVENTBROADCASTER_IDL +#define COM_SUN_STAR_FRAME_GLOBALEVENTBROADCASTER_IDL + +#include <com/sun/star/frame/XGlobalEventBroadcaster.idl> + +module com { module sun { module star { module frame { + +/** + This singleton offers the document event functionality that can be found at + any com::sun::star::document::OfficeDocument, but it does it for all + existing documents. + + So it is a single place where a listener can be registered for all events in + all documents. + + Prior to LibreOffice 4.3, this singleton was only available as a + (single-instance) GlobalEventBroadcaster service. + + @since LibreOffice 4.3 +*/ +singleton theGlobalEventBroadcaster: XGlobalEventBroadcaster; + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 5256a588a584..a5f1fde1b7fc 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -21,7 +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/theGlobalEventBroadcaster.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -112,7 +112,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::document::XEventListener > xGlobalBroadcaster(css::frame::GlobalEventBroadcaster::create(xContext), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::document::XEventListener > xGlobalBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_QUERY_THROW); css::document::EventObject aEvent2; aEvent2.EventName = "OnCloseApp"; diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index 6b5c3e710fe2..06f056d28483 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -44,7 +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/frame/theGlobalEventBroadcaster.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Reference.hxx> @@ -232,7 +232,7 @@ void PropagateEvent_Impl( SfxObjectShell *pDoc, OUString aEventName, const SvxMa else { xSupplier = uno::Reference < document::XEventsSupplier > - ( frame::GlobalEventBroadcaster::create(::comphelper::getProcessComponentContext()), + ( frame::theGlobalEventBroadcaster::get(::comphelper::getProcessComponentContext()), uno::UNO_QUERY ); } diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 2fa26fc42e8d..311eedcd92fc 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -27,7 +27,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/theGlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XFrame.hpp> @@ -150,7 +150,7 @@ void impl_addToModelCollection(const css::uno::Reference< css::frame::XModel >& css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XGlobalEventBroadcaster > xModelCollection = - css::frame::GlobalEventBroadcaster::create(xContext); + css::frame::theGlobalEventBroadcaster::get(xContext); try { xModelCollection->insert(css::uno::makeAny(xModel)); diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component index a66335e0fc69..30cd3fc698bb 100644 --- a/sfx2/util/sfx.component +++ b/sfx2/util/sfx.component @@ -70,6 +70,7 @@ </implementation> <implementation name="com.sun.star.comp.sfx2.GlobalEventBroadcaster"> <service name="com.sun.star.frame.GlobalEventBroadcaster"/> + <singleton name="com.sun.star.frame.theGlobalEventBroadcaster"/> </implementation> <implementation name="com.sun.star.comp.sfx2.IFrameObject" constructor="com_sun_star_comp_sfx2_IFrameObject_get_implementation"> diff --git a/sw/qa/complex/writer/LoadSaveTest.java b/sw/qa/complex/writer/LoadSaveTest.java index 3a16fd80769a..8fd9fdfd5a4b 100644 --- a/sw/qa/complex/writer/LoadSaveTest.java +++ b/sw/qa/complex/writer/LoadSaveTest.java @@ -27,9 +27,10 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XComponent; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.Pair; +import com.sun.star.frame.XGlobalEventBroadcaster; import com.sun.star.frame.XStorable; +import com.sun.star.frame.theGlobalEventBroadcaster; import com.sun.star.document.DocumentEvent; -import com.sun.star.document.XDocumentEventBroadcaster; import com.sun.star.document.XDocumentEventListener; import org.openoffice.test.OfficeConnection; @@ -63,7 +64,7 @@ public class LoadSaveTest private XMultiServiceFactory m_xMSF = null; private XComponentContext m_xContext = null; - private XDocumentEventBroadcaster m_xGEB = null; + private XGlobalEventBroadcaster m_xGEB = null; private String m_TmpDir = null; private String m_fileURL = "file://"; @@ -77,10 +78,7 @@ public class LoadSaveTest assertNotNull("could not get component context.", m_xContext); m_xMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, m_xContext.getServiceManager()); - Object oGEB = m_xMSF.createInstance( - "com.sun.star.frame.GlobalEventBroadcaster"); - m_xGEB = UnoRuntime.queryInterface(XDocumentEventBroadcaster.class, oGEB); - assertNotNull("could not get global event broadcaster.", m_xGEB); + m_xGEB = theGlobalEventBroadcaster.get(m_xContext); m_TmpDir = util.utils.getOfficeTemp/*Dir*/(m_xMSF); System.out.println("tempdir: " + m_TmpDir); System.out.println("sourcedir: " + m_SourceDir); diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx index c08f9cf5088a..bda606ae3d4a 100644 --- a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx +++ b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx @@ -35,7 +35,7 @@ #include "com/sun/star/beans/XPropertySet.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/theGlobalEventBroadcaster.hpp" #include "com/sun/star/frame/XStorable.hpp" #include "com/sun/star/frame/ModuleManager.hpp" #include "com/sun/star/lang/DisposedException.hpp" @@ -105,7 +105,7 @@ OfficeDocumentsManager::OfficeDocumentsManager( const uno::Reference< uno::XComponentContext > & rxContext, OfficeDocumentsEventListener * pDocEventListener ) : m_xContext( rxContext ), - m_xDocEvtNotifier( frame::GlobalEventBroadcaster::create( rxContext ) ), + m_xDocEvtNotifier( frame::theGlobalEventBroadcaster::get( rxContext ) ), m_pDocEventListener( pDocEventListener ), m_xDocCloseListener( new OfficeDocumentsCloseListener( this ) ) { |