summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-17 15:00:30 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-24 17:59:30 +0200
commit13bedc55b1d533eadcfd4932ef57076e3642caaf (patch)
tree5133f5888e3e7abaf5b83093f0c24b1d274c2d42
parent22d3fb11c65dd0679aab780ca789d2d4d74deac2 (diff)
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.
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx6
-rw-r--r--framework/inc/services.h1
-rw-r--r--framework/inc/services/autorecovery.hxx3
-rw-r--r--framework/source/services/autorecovery.cxx5
-rw-r--r--offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl3
-rw-r--r--sfx2/source/inc/eventsupplier.hxx5
6 files changed, 13 insertions, 10 deletions
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 66745a51e202..2d62e2cfaa32 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -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& )
{
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 7d30422db854..cfbee13ab804 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -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" )
diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx
index 9f7c61c681c8..94347a0050ab 100644
--- a/framework/inc/services/autorecovery.hxx
+++ b/framework/inc/services/autorecovery.hxx
@@ -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
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 6390970898e7..d6928eb28533 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -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;
diff --git a/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl b/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl
index c784fcc75fca..9a311fae4ee6 100644
--- a/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl
+++ b/offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl
@@ -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;
diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx
index a7aefd20753b..2a8aea49fc04 100644
--- a/sfx2/source/inc/eventsupplier.hxx
+++ b/sfx2/source/inc/eventsupplier.hxx
@@ -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
>
{