fdo#46808, Adapt frame::GlobalEventBroadcaster UNO service to new style
Create a merged XGlobalEventBroadcaster interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Also add two interfaces to the IDL, which the service already implemented, and existing client code already used. Change-Id: Ib7a9a30c0e50146ef621f3fe5227f8aad3190516
This commit is contained in:
parent
526e007bb6
commit
cd693ff598
@ -21,6 +21,7 @@
|
||||
#include "doceventnotifier.hxx"
|
||||
#include "scriptdocument.hxx"
|
||||
|
||||
#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
|
||||
#include <com/sun/star/document/XEventBroadcaster.hpp>
|
||||
|
||||
#include <vcl/svapp.hxx>
|
||||
@ -44,11 +45,13 @@ namespace basctl
|
||||
using ::com::sun::star::document::XEventBroadcaster;
|
||||
using ::com::sun::star::document::XEventListener;
|
||||
using ::com::sun::star::document::EventObject;
|
||||
using ::com::sun::star::uno::XComponentContext;
|
||||
using ::com::sun::star::uno::RuntimeException;
|
||||
using ::com::sun::star::uno::Reference;
|
||||
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::uno::UNO_QUERY;
|
||||
/** === end UNO using === **/
|
||||
namespace csslang = ::com::sun::star::lang;
|
||||
@ -210,10 +213,7 @@ namespace basctl
|
||||
{
|
||||
Reference< com::sun::star::uno::XComponentContext > aContext(
|
||||
comphelper::getProcessComponentContext() );
|
||||
xBroadcaster.set(
|
||||
aContext->getServiceManager()->createInstanceWithContext(
|
||||
"com.sun.star.frame.GlobalEventBroadcaster", aContext ),
|
||||
UNO_QUERY_THROW );
|
||||
xBroadcaster.set( GlobalEventBroadcaster::create(aContext), UNO_QUERY_THROW );
|
||||
}
|
||||
|
||||
void ( SAL_CALL XEventBroadcaster::*listenerAction )( const Reference< XEventListener >& ) =
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <svtools/svmedit.hxx>
|
||||
#include <tools/diagnose_ex.h>
|
||||
#include <com/sun/star/document/XEventsSupplier.hpp>
|
||||
#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
|
||||
#include <com/sun/star/frame/XModuleManager.hpp>
|
||||
|
||||
#include <comphelper/processfactory.hxx>
|
||||
@ -91,21 +92,16 @@ SvxEventConfigPage::SvxEventConfigPage( Window *pParent, const SfxItemSet& rSet,
|
||||
uno::Reference< document::XEventsSupplier > xSupplier;
|
||||
|
||||
xSupplier = uno::Reference< document::XEventsSupplier > (
|
||||
::comphelper::getProcessServiceFactory()->createInstance(
|
||||
OUString(RTL_CONSTASCII_USTRINGPARAM(
|
||||
"com.sun.star.frame.GlobalEventBroadcaster" )) ),
|
||||
uno::UNO_QUERY );
|
||||
frame::GlobalEventBroadcaster::create(::comphelper::getProcessComponentContext()),
|
||||
uno::UNO_QUERY_THROW );
|
||||
|
||||
sal_uInt16 nPos(0);
|
||||
if ( xSupplier.is() )
|
||||
{
|
||||
m_xAppEvents = xSupplier->getEvents();
|
||||
nPos = aSaveInListBox.InsertEntry(
|
||||
utl::ConfigManager::getProductName() );
|
||||
aSaveInListBox.SetEntryData( nPos, new bool(true) );
|
||||
aSaveInListBox.SelectEntryPos( nPos, sal_True );
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
void SvxEventConfigPage::LateInit( const uno::Reference< frame::XFrame >& _rxFrame )
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "migration.hxx"
|
||||
|
||||
#include <svtools/javacontext.hxx>
|
||||
#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
|
||||
#include <com/sun/star/frame/XSessionManagerListener.hpp>
|
||||
#include <com/sun/star/frame/XSynchronousDispatch.hpp>
|
||||
#include <com/sun/star/document/CorruptedFilterConfigurationException.hpp>
|
||||
@ -1531,8 +1532,7 @@ int Desktop::Main()
|
||||
|
||||
// create service for loadin SFX (still needed in startup)
|
||||
pExecGlobals->xGlobalBroadcaster = Reference < css::document::XEventListener >
|
||||
( xSMgr->createInstance(
|
||||
rtl::OUString( "com.sun.star.frame.GlobalEventBroadcaster" ) ), UNO_QUERY );
|
||||
( css::frame::GlobalEventBroadcaster::create(comphelper::ComponentContext(xSMgr).getUNOContext()), UNO_QUERY );
|
||||
|
||||
/* ensure existance of a default window that messages can be dispatched to
|
||||
This is for the benefit of testtool which uses PostUserEvent extensively
|
||||
|
@ -36,6 +36,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/graphic/GraphicProvider.hpp>
|
||||
#include <com/sun/star/graphic/XGraphicProvider.hpp>
|
||||
#include <com/sun/star/task/XJob.hpp>
|
||||
@ -255,17 +256,8 @@ UpdateCheckUI::getGlobalEventBroadcaster() const throw (uno::RuntimeException)
|
||||
UNISTRING( "UpdateCheckUI: empty component context" ),
|
||||
uno::Reference< uno::XInterface >() );
|
||||
|
||||
uno::Reference< lang::XMultiComponentFactory > xServiceManager(m_xContext->getServiceManager());
|
||||
|
||||
if( !xServiceManager.is() )
|
||||
throw uno::RuntimeException(
|
||||
UNISTRING( "UpdateCheckUI: unable to obtain service manager from component context" ),
|
||||
uno::Reference< uno::XInterface >() );
|
||||
|
||||
return uno::Reference<document::XEventBroadcaster> (
|
||||
xServiceManager->createInstanceWithContext(
|
||||
UNISTRING( "com.sun.star.frame.GlobalEventBroadcaster" ),
|
||||
m_xContext),
|
||||
frame::GlobalEventBroadcaster::create(m_xContext),
|
||||
uno::UNO_QUERY_THROW);
|
||||
}
|
||||
|
||||
|
3
filter/source/config/cache/filtercache.cxx
vendored
3
filter/source/config/cache/filtercache.cxx
vendored
@ -48,6 +48,7 @@
|
||||
#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>
|
||||
@ -249,7 +250,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(m_xSMGR);
|
||||
/* LateInitListener* pLateInit = */ new LateInitListener(comphelper::ComponentContext(m_xSMGR).getUNOContext());
|
||||
}
|
||||
|
||||
// ------------------------------------------
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "lateinitlistener.hxx"
|
||||
#include "lateinitthread.hxx"
|
||||
|
||||
#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
|
||||
|
||||
|
||||
namespace filter{
|
||||
namespace config{
|
||||
@ -43,9 +45,8 @@ namespace css = ::com::sun::star;
|
||||
|
||||
|
||||
|
||||
LateInitListener::LateInitListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
|
||||
LateInitListener::LateInitListener(const css::uno::Reference< css::uno::XComponentContext >& rxContext)
|
||||
: BaseLock( )
|
||||
, m_xSMGR (xSMGR)
|
||||
{
|
||||
// important to do so ...
|
||||
// Otherwise the temp. reference to ourselves
|
||||
@ -53,7 +54,7 @@ LateInitListener::LateInitListener(const css::uno::Reference< css::lang::XMultiS
|
||||
osl_atomic_increment( &m_refCount );
|
||||
|
||||
m_xBroadcaster = css::uno::Reference< css::document::XEventBroadcaster >(
|
||||
m_xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.GlobalEventBroadcaster" ))),
|
||||
css::frame::GlobalEventBroadcaster::create(rxContext),
|
||||
css::uno::UNO_QUERY_THROW);
|
||||
|
||||
m_xBroadcaster->addEventListener(static_cast< css::document::XEventListener* >(this));
|
||||
|
10
filter/source/config/cache/lateinitlistener.hxx
vendored
10
filter/source/config/cache/lateinitlistener.hxx
vendored
@ -52,10 +52,6 @@ class LateInitListener : public BaseLock // must be the first one to guarantee r
|
||||
|
||||
private:
|
||||
|
||||
/** @short reference to an uno service manager, which can be used
|
||||
to create own needed services. */
|
||||
css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
|
||||
|
||||
/** @short reference to the global event broadcaster, which is usde to find
|
||||
out, when the first office document was opened successfully. */
|
||||
css::uno::Reference< css::document::XEventBroadcaster > m_xBroadcaster;
|
||||
@ -75,11 +71,11 @@ class LateInitListener : public BaseLock // must be the first one to guarantee r
|
||||
on the global event broadcaster to get the information, when
|
||||
loading of the first document was finished.
|
||||
|
||||
@param xSMGR
|
||||
reference to a service manager, which can be used to create
|
||||
@param rxContext
|
||||
reference to a component context, which can be used to create
|
||||
own needed uno services.
|
||||
*/
|
||||
LateInitListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
|
||||
LateInitListener(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
|
||||
|
||||
//---------------------------------------
|
||||
|
||||
|
@ -26,27 +26,29 @@
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include <com/sun/star/frame/XConfigManager.hpp>
|
||||
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
|
||||
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <com/sun/star/document/XFilter.hpp>
|
||||
#include <com/sun/star/document/XExporter.hpp>
|
||||
#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/xml/XImportFilter.hpp>
|
||||
#include <com/sun/star/xml/XExportFilter.hpp>
|
||||
#include <com/sun/star/io/XActiveDataSource.hpp>
|
||||
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
|
||||
#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
|
||||
#include <com/sun/star/frame/XConfigManager.hpp>
|
||||
#include <com/sun/star/frame/XDesktop.hpp>
|
||||
#include <com/sun/star/frame/XComponentLoader.hpp>
|
||||
#include <com/sun/star/frame/XStorable.hpp>
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <com/sun/star/frame/XDesktop.hpp>
|
||||
#include <com/sun/star/document/XFilter.hpp>
|
||||
#include <comphelper/oslfile2streamwrap.hxx>
|
||||
#include <com/sun/star/document/XExporter.hpp>
|
||||
#include <com/sun/star/task/XInteractionHandler.hpp>
|
||||
|
||||
#include <com/sun/star/io/XActiveDataSource.hpp>
|
||||
#include <com/sun/star/system/SystemShellExecute.hpp>
|
||||
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
|
||||
#include <com/sun/star/task/XInteractionHandler.hpp>
|
||||
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
|
||||
#include <com/sun/star/xml/XImportFilter.hpp>
|
||||
#include <com/sun/star/xml/XExportFilter.hpp>
|
||||
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
|
||||
|
||||
#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
|
||||
#include <comphelper/componentcontext.hxx>
|
||||
#include <comphelper/oslfile2streamwrap.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <osl/mutex.hxx>
|
||||
#include <sfx2/filedlghelper.hxx>
|
||||
@ -186,13 +188,10 @@ XMLFilterTestDialog::XMLFilterTestDialog( Window* pParent, ResMgr& rResMgr, cons
|
||||
if( xCfgMgr.is() )
|
||||
sDTDPath = xCfgMgr->substituteVariables( sDTDPath );
|
||||
|
||||
mxGlobalBroadcaster = Reference < XEventBroadcaster >::query( mxMSF->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.GlobalEventBroadcaster" )) ) );
|
||||
if ( mxGlobalBroadcaster.is() )
|
||||
{
|
||||
mxGlobalBroadcaster = Reference < XEventBroadcaster >( GlobalEventBroadcaster::create(comphelper::ComponentContext(mxMSF).getUNOContext()), UNO_QUERY_THROW );
|
||||
mxGlobalEventListener = new GlobalEventListenerImpl( this );
|
||||
mxGlobalBroadcaster->addEventListener( mxGlobalEventListener );
|
||||
}
|
||||
}
|
||||
catch( const Exception& )
|
||||
{
|
||||
OSL_FAIL( "XMLFilterTestDialog::XMLFilterTestDialog exception catched!" );
|
||||
|
@ -133,6 +133,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\
|
||||
DispatchHelper \
|
||||
DispatchRecorderSupplier \
|
||||
DocumentTemplates \
|
||||
GlobalEventBroadcaster \
|
||||
MediaTypeDetectionHelper \
|
||||
ModuleManager \
|
||||
UICommandDescription \
|
||||
@ -814,7 +815,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/frame,\
|
||||
FrameLoader \
|
||||
FrameLoaderFactory \
|
||||
FramesContainer \
|
||||
GlobalEventBroadcaster \
|
||||
LayoutManager \
|
||||
PopupMenuController \
|
||||
PopupMenuControllerFactory \
|
||||
@ -2522,6 +2522,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/frame,\
|
||||
XFrameSetModel \
|
||||
XFrames \
|
||||
XFramesSupplier \
|
||||
XGlobalEventBroadcaster \
|
||||
XInterceptorInfo \
|
||||
XLayoutManager \
|
||||
XLayoutManagerEventBroadcaster \
|
||||
|
@ -19,8 +19,7 @@
|
||||
#ifndef __com_sun_star_frame_GlobalEventBroadcaster_idl__
|
||||
#define __com_sun_star_frame_GlobalEventBroadcaster_idl__
|
||||
|
||||
#include <com/sun/star/document/XEventBroadcaster.idl>
|
||||
#include <com/sun/star/document/XEventsSupplier.idl>
|
||||
#include <com/sun/star/frame/XGlobalEventBroadcaster.idl>
|
||||
|
||||
|
||||
module com { module sun { module star { module frame {
|
||||
@ -32,17 +31,7 @@
|
||||
documents.
|
||||
*/
|
||||
|
||||
service GlobalEventBroadcaster
|
||||
{
|
||||
/** makes it possible to register listeners which are called whenever
|
||||
a document event occurs in any document
|
||||
*/
|
||||
interface ::com::sun::star::document::XEventsSupplier;
|
||||
|
||||
/** access to bound event handlers
|
||||
*/
|
||||
interface ::com::sun::star::document::XEventBroadcaster;
|
||||
};
|
||||
service GlobalEventBroadcaster : XGlobalEventBroadcaster;
|
||||
|
||||
|
||||
}; }; }; };
|
||||
|
54
offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl
Normal file
54
offapi/com/sun/star/frame/XGlobalEventBroadcaster.idl
Normal file
@ -0,0 +1,54 @@
|
||||
/* -*- 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_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>
|
||||
|
||||
|
||||
module com { module sun { module star { module frame {
|
||||
|
||||
/**
|
||||
Provides a unified interface for the GlobalEventBroadcaster service to implement.
|
||||
*/
|
||||
|
||||
interface XGlobalEventBroadcaster
|
||||
{
|
||||
/** makes it possible to register listeners which are called whenever
|
||||
a document event occurs in any document
|
||||
*/
|
||||
interface ::com::sun::star::document::XEventsSupplier;
|
||||
|
||||
/** access to bound event handlers
|
||||
*/
|
||||
interface ::com::sun::star::document::XEventBroadcaster;
|
||||
|
||||
interface ::com::sun::star::container::XSet;
|
||||
|
||||
interface ::com::sun::star::document::XEventListener;
|
||||
};
|
||||
|
||||
|
||||
}; }; }; };
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@ -21,6 +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/XDesktop.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
|
||||
@ -111,14 +112,12 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a
|
||||
pApp->Get_Impl()->pAppDispatch->ReleaseAll();
|
||||
pApp->Get_Impl()->pAppDispatch->release();
|
||||
|
||||
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
|
||||
css::uno::Reference< css::document::XEventListener > xGlobalBroadcaster(xSMGR->createInstance("com.sun.star.frame.GlobalEventBroadcaster"), css::uno::UNO_QUERY);
|
||||
if (xGlobalBroadcaster.is())
|
||||
{
|
||||
css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
|
||||
css::uno::Reference< css::frame::XGlobalEventBroadcaster > xGlobalBroadcaster = css::frame::GlobalEventBroadcaster::create(xContext);
|
||||
|
||||
css::document::EventObject aEvent2;
|
||||
aEvent2.EventName = "OnCloseApp";
|
||||
xGlobalBroadcaster->notifyEvent(aEvent2);
|
||||
}
|
||||
|
||||
delete pApp;
|
||||
Application::Quit();
|
||||
|
@ -44,6 +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/uno/Sequence.hxx>
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
|
||||
@ -231,8 +232,8 @@ void PropagateEvent_Impl( SfxObjectShell *pDoc, rtl::OUString aEventName, const
|
||||
else
|
||||
{
|
||||
xSupplier = uno::Reference < document::XEventsSupplier >
|
||||
( ::comphelper::getProcessServiceFactory()->createInstance(
|
||||
rtl::OUString("com.sun.star.frame.GlobalEventBroadcaster")), uno::UNO_QUERY );
|
||||
( frame::GlobalEventBroadcaster::create(::comphelper::getProcessComponentContext()),
|
||||
uno::UNO_QUERY );
|
||||
}
|
||||
|
||||
if ( xSupplier.is() )
|
||||
|
@ -25,6 +25,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/XStorable.hpp>
|
||||
#include <com/sun/star/frame/XModel.hpp>
|
||||
#include <com/sun/star/frame/XFrame.hpp>
|
||||
@ -147,12 +148,9 @@ void impl_addToModelCollection(const css::uno::Reference< css::frame::XModel >&
|
||||
if (!xModel.is())
|
||||
return;
|
||||
|
||||
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
|
||||
css::uno::Reference< css::container::XSet > xModelCollection(
|
||||
xSMGR->createInstance(::rtl::OUString("com.sun.star.frame.GlobalEventBroadcaster")),
|
||||
css::uno::UNO_QUERY);
|
||||
if (xModelCollection.is())
|
||||
{
|
||||
css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
|
||||
css::uno::Reference< css::frame::XGlobalEventBroadcaster > xModelCollection =
|
||||
css::frame::GlobalEventBroadcaster::create(xContext);
|
||||
try
|
||||
{
|
||||
xModelCollection->insert(css::uno::makeAny(xModel));
|
||||
@ -162,7 +160,6 @@ void impl_addToModelCollection(const css::uno::Reference< css::frame::XModel >&
|
||||
OSL_FAIL( "The document seems to be in the collection already!\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#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>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/task/XJobExecutor.hpp>
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
@ -39,7 +40,6 @@
|
||||
#include <cppuhelper/implbase2.hxx>
|
||||
#include <cppuhelper/implbase3.hxx>
|
||||
#include <cppuhelper/implbase4.hxx>
|
||||
#include <cppuhelper/implbase7.hxx>
|
||||
#include <comphelper/sequenceashashmap.hxx>
|
||||
#include <comphelper/sequenceasvector.hxx>
|
||||
#include <sfx2/sfxuno.hxx>
|
||||
@ -173,13 +173,11 @@ class ModelCollectionEnumeration : public ModelCollectionMutexBase
|
||||
|
||||
//=============================================================================
|
||||
class SfxGlobalEvents_Impl : public ModelCollectionMutexBase
|
||||
, public ::cppu::WeakImplHelper7< ::com::sun::star::lang::XServiceInfo
|
||||
, ::com::sun::star::document::XEventsSupplier
|
||||
, ::com::sun::star::document::XEventBroadcaster
|
||||
, public ::cppu::WeakImplHelper4< ::com::sun::star::lang::XServiceInfo
|
||||
, ::com::sun::star::frame::XGlobalEventBroadcaster
|
||||
, ::com::sun::star::document::XDocumentEventBroadcaster
|
||||
, ::com::sun::star::document::XEventListener
|
||||
, ::com::sun::star::document::XDocumentEventListener
|
||||
, ::com::sun::star::container::XSet >
|
||||
>
|
||||
{
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMGR;
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xEvents;
|
||||
|
@ -39,12 +39,12 @@
|
||||
|
||||
#include "comphelper/documentinfo.hxx"
|
||||
#include "comphelper/namedvaluecollection.hxx"
|
||||
#include "comphelper/processfactory.hxx"
|
||||
|
||||
#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/XStorageBasedDocument.hpp"
|
||||
#include "com/sun/star/frame/GlobalEventBroadcaster.hpp"
|
||||
#include "com/sun/star/frame/XStorable.hpp"
|
||||
#include "com/sun/star/frame/ModuleManager.hpp"
|
||||
#include "com/sun/star/lang/DisposedException.hpp"
|
||||
@ -112,10 +112,10 @@ void SAL_CALL OfficeDocumentsManager::OfficeDocumentsCloseListener::disposing(
|
||||
//=========================================================================
|
||||
|
||||
OfficeDocumentsManager::OfficeDocumentsManager(
|
||||
const uno::Reference< lang::XMultiServiceFactory > & xSMgr,
|
||||
const uno::Reference< uno::XComponentContext > & rxContext,
|
||||
OfficeDocumentsEventListener * pDocEventListener )
|
||||
: m_xSMgr( xSMgr ),
|
||||
m_xDocEvtNotifier( createDocumentEventNotifier( xSMgr ) ),
|
||||
: m_xContext( rxContext ),
|
||||
m_xDocEvtNotifier( createDocumentEventNotifier( rxContext ) ),
|
||||
m_pDocEventListener( pDocEventListener ),
|
||||
m_xDocCloseListener( new OfficeDocumentsCloseListener( this ) )
|
||||
{
|
||||
@ -460,15 +460,12 @@ void SAL_CALL OfficeDocumentsManager::disposing(
|
||||
// static
|
||||
uno::Reference< document::XEventBroadcaster >
|
||||
OfficeDocumentsManager::createDocumentEventNotifier(
|
||||
const uno::Reference< lang::XMultiServiceFactory >& rXSMgr )
|
||||
const uno::Reference< uno::XComponentContext >& rxContext )
|
||||
{
|
||||
uno::Reference< uno::XInterface > xIfc;
|
||||
try
|
||||
{
|
||||
xIfc = rXSMgr->createInstance(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
"com.sun.star.frame.GlobalEventBroadcaster" ) ) );
|
||||
xIfc = frame::GlobalEventBroadcaster::create(rxContext);
|
||||
}
|
||||
catch ( uno::Exception const & )
|
||||
{
|
||||
@ -702,8 +699,7 @@ bool OfficeDocumentsManager::isBasicIDE(
|
||||
{
|
||||
try
|
||||
{
|
||||
m_xModuleMgr = frame::ModuleManager::create(
|
||||
comphelper::getComponentContext(m_xSMgr));
|
||||
m_xModuleMgr = frame::ModuleManager::create( m_xContext );
|
||||
}
|
||||
catch ( uno::Exception const & )
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ namespace tdoc_ucp {
|
||||
public:
|
||||
OfficeDocumentsManager(
|
||||
const com::sun::star::uno::Reference<
|
||||
com::sun::star::lang::XMultiServiceFactory > & xSMgr,
|
||||
com::sun::star::uno::XComponentContext > & rxContext,
|
||||
OfficeDocumentsEventListener * pDocEventListener );
|
||||
virtual ~OfficeDocumentsManager();
|
||||
|
||||
@ -162,7 +162,7 @@ namespace tdoc_ucp {
|
||||
com::sun::star::document::XEventBroadcaster >
|
||||
createDocumentEventNotifier(
|
||||
const com::sun::star::uno::Reference<
|
||||
com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
|
||||
com::sun::star::uno::XComponentContext >& rxContext );
|
||||
|
||||
void buildDocumentsList();
|
||||
|
||||
@ -193,7 +193,7 @@ namespace tdoc_ucp {
|
||||
|
||||
osl::Mutex m_aMtx;
|
||||
com::sun::star::uno::Reference<
|
||||
com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
|
||||
com::sun::star::uno::XComponentContext > m_xContext;
|
||||
com::sun::star::uno::Reference<
|
||||
com::sun::star::document::XEventBroadcaster > m_xDocEvtNotifier;
|
||||
com::sun::star::uno::Reference<
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "com/sun/star/container/XNameAccess.hpp"
|
||||
#include "com/sun/star/embed/XStorage.hpp"
|
||||
|
||||
#include "comphelper/componentcontext.hxx"
|
||||
#include "ucbhelper/contentidentifier.hxx"
|
||||
|
||||
#include "tdoc_provider.hxx"
|
||||
@ -60,7 +61,7 @@ using namespace tdoc_ucp;
|
||||
ContentProvider::ContentProvider(
|
||||
const uno::Reference< lang::XMultiServiceFactory >& xSMgr )
|
||||
: ::ucbhelper::ContentProviderImplHelper( xSMgr ),
|
||||
m_xDocsMgr( new OfficeDocumentsManager( xSMgr, this ) ),
|
||||
m_xDocsMgr( new OfficeDocumentsManager( comphelper::ComponentContext(xSMgr).getUNOContext(), this ) ),
|
||||
m_xStgElemFac( new StorageElementFactory( xSMgr, m_xDocsMgr ) )
|
||||
{
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user