summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-27 10:19:04 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-27 10:30:42 +0200
commit272f0e97b12e634cdf49a1bff45e1b9068af7d9c (patch)
treed3ba7bf2885c4d5e2285caf3bb89aaedacc08a4c
parentcd693ff598bbabba66d8ca353a32bcbd81a5b12b (diff)
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
-rw-r--r--cui/source/customize/eventdlg.cxx7
-rw-r--r--desktop/source/app/app.cxx11
-rw-r--r--filter/source/config/cache/filtercache.cxx3
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.cxx3
-rw-r--r--offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl14
-rw-r--r--sfx2/source/appl/appinit.cxx2
-rw-r--r--sfx2/source/inc/eventsupplier.hxx7
-rw-r--r--ucb/source/ucp/tdoc/tdoc_docmgr.cxx63
-rw-r--r--ucb/source/ucp/tdoc/tdoc_docmgr.hxx10
-rw-r--r--ucb/source/ucp/tdoc/tdoc_provider.cxx4
10 files changed, 34 insertions, 90 deletions
diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx
index 55381f5cefe1..8cd495f0d372 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 378d18808207..4741ce6833a8 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 b7c3474259a7..764c085d98c2 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 f177653ce6fa..2dff65f92db3 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 0f3343b654ce..c784fcc75fca 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 0a778788b7fc..4d53e49d5fc5 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 6bd1f284ee36..a7aefd20753b 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 c4e4bd6b67b2..b9c7c81c1dc3 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 3ba30a4a7e91..086f71433c9a 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 b2f06d575477..494fa71ee7a1 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 ) )
{
}