Kaydet (Commit) 13bedc55 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Stephan Bergmann

fdo#46808, use service constructor for frame::GlobalEventBroadcaster

Add document::XEventBroadcaster interface to XGlobalEventBroadcaster,
because a client uses it, and the service always implements it.

This is safe to do because we haven't released an LO version with
XGlobalEventBroadcaster in it yet.
üst 22d3fb11
......@@ -32,6 +32,7 @@
#include <com/sun/star/container/XSet.hpp>
#include <com/sun/star/document/MacroExecMode.hpp>
#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/embed/XTransactionBroadcaster.hpp>
#include <com/sun/star/sdb/BooleanComparisonMode.hpp>
......@@ -976,9 +977,8 @@ Reference< XModel > ODatabaseModelImpl::createNewModel_deliverOwnership( bool _b
try
{
Reference< XSet > xModelCollection;
if ( m_aContext.createComponent( "com.sun.star.frame.GlobalEventBroadcaster", xModelCollection ) )
xModelCollection->insert( makeAny( xModel ) );
Reference< XGlobalEventBroadcaster > xModelCollection = GlobalEventBroadcaster::create( m_aContext.getUNOContext() );
xModelCollection->insert( makeAny( xModel ) );
}
catch( const Exception& )
{
......
......@@ -81,7 +81,6 @@ namespace framework{
#define SERVICENAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.ToolBarControllerFactory" )
#define SERVICENAME_LICENSE SERVICENAME_JOB
#define SERVICENAME_AUTORECOVERY DECLARE_ASCII("com.sun.star.frame.AutoRecovery" )
#define SERVICENAME_GLOBALEVENTBROADCASTER DECLARE_ASCII("com.sun.star.frame.GlobalEventBroadcaster" )
#define SERVICENAME_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.ui.StatusBarFactory" )
#define SERVICENAME_UICATEGORYDESCRIPTION DECLARE_ASCII("com.sun.star.ui.UICategoryDescription" )
#define SERVICENAME_STATUSBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.StatusbarControllerFactory" )
......
......@@ -40,6 +40,7 @@
#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/container/XNameAccess.hpp>
#include <com/sun/star/document/XEventListener.hpp>
......@@ -344,7 +345,7 @@ class AutoRecovery : public css::lang::XTypeProvider
/** @short holds the global event broadcaster alive,
where we listen for new created documents.
*/
css::uno::Reference< css::document::XEventBroadcaster > m_xNewDocBroadcaster;
css::uno::Reference< css::frame::XGlobalEventBroadcaster > m_xNewDocBroadcaster;
//---------------------------------------
/** @short proxy weak binding to forward Events to ourself without
......
......@@ -45,6 +45,7 @@
#include <com/sun/star/ucb/NameClash.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
......@@ -1365,7 +1366,7 @@ void AutoRecovery::implts_startListening()
ReadGuard aReadLock(m_aLock);
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
css::uno::Reference< css::util::XChangesNotifier > xCFG (m_xRecoveryCFG, css::uno::UNO_QUERY);
css::uno::Reference< css::document::XEventBroadcaster > xBroadcaster = m_xNewDocBroadcaster;
css::uno::Reference< css::frame::XGlobalEventBroadcaster > xBroadcaster = m_xNewDocBroadcaster;
sal_Bool bListenForDocEvents = m_bListenForDocEvents;
aReadLock.unlock();
// <- SAFE ----------------------------------
......@@ -1382,7 +1383,7 @@ void AutoRecovery::implts_startListening()
if (!xBroadcaster.is())
{
xBroadcaster = css::uno::Reference< css::document::XEventBroadcaster >(xSMGR->createInstance(SERVICENAME_GLOBALEVENTBROADCASTER), css::uno::UNO_QUERY_THROW);
xBroadcaster = css::frame::GlobalEventBroadcaster::create( comphelper::getComponentContext(xSMGR) );
// SAFE -> ----------------------------------
WriteGuard aWriteLock(m_aLock);
m_xNewDocBroadcaster = xBroadcaster;
......
......@@ -22,6 +22,7 @@
#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/XEventBroadcaster.idl>
#include <com/sun/star/document/XEventsSupplier.idl>
module com { module sun { module star { module frame {
......@@ -43,6 +44,8 @@ interface XGlobalEventBroadcaster
*/
interface ::com::sun::star::document::XDocumentEventBroadcaster;
interface ::com::sun::star::document::XEventBroadcaster;
interface ::com::sun::star::container::XSet;
interface ::com::sun::star::document::XDocumentEventListener;
......
......@@ -37,7 +37,7 @@
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/implbase3.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/sequenceasvector.hxx>
#include <sfx2/sfxuno.hxx>
......@@ -172,9 +172,8 @@ 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
, public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo
, ::com::sun::star::frame::XGlobalEventBroadcaster
, ::com::sun::star::document::XEventBroadcaster
, ::com::sun::star::document::XEventListener
>
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment