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
This commit is contained in:
parent
cd693ff598
commit
272f0e97b1
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
3
filter/source/config/cache/filtercache.cxx
vendored
3
filter/source/config/cache/filtercache.cxx
vendored
@ -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));
|
||||
}
|
||||
|
||||
// ------------------------------------------
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
@ -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";
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 ) )
|
||||
{
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user