Kaydet (Commit) 3557c078 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Revert "Revert "sfx: Use constructor feature for SfxGlobalEvents_Impl.""

This reverts commit ef377816, now that
constructor function support for singleton implementations is in place and the
proper singleton theGlobalEventBroadcaster has been introduced (and drops
sfx_component_getFactory completely, which had become unused except for
SfxGlobalEvents_Impl in the meantime).

Change-Id: I2d587989dd0a1fbea6fe75f7dc2af954ac81c4ed
üst 62951cdd
......@@ -236,6 +236,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/menu/thessubmenu \
sfx2/source/menu/virtmenu \
sfx2/source/notify/eventsupplier \
sfx2/source/notify/globalevents \
sfx2/source/notify/hintpost \
sfx2/source/sidebar/Sidebar \
sfx2/source/sidebar/SidebarChildWindow \
......
......@@ -21,7 +21,6 @@
#pragma warning( disable : 4290 )
#endif
#include "eventsupplier.hxx"
#include "fltoptint.hxx"
#include "objshimp.hxx"
#include <sfx2/app.hxx>
......@@ -1693,50 +1692,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
rArgs = aSequ;
}
// -----------------------------------------------------------------------
extern "C" {
SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory(
const sal_Char* pImplementationName ,
void* pServiceManager ,
void* )
{
// Set default return value for this operation - if it failed.
void* pReturn = NULL ;
if (
( pImplementationName != NULL ) &&
( pServiceManager != NULL )
)
{
// Define variables which are used in following macros.
uno::Reference<uno::XInterface> xFactory;
uno::Reference<lang::XMultiServiceFactory> xServiceManager( reinterpret_cast<lang::XMultiServiceFactory*>( pServiceManager ) ) ;
//=============================================================================
// Add new macro line to handle new service.
// !!! ATTENTION !!!
// Write no ";" at end of line and dont forget "else" ! (see macro)
//=============================================================================
IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl )
// Factory is valid - service was found.
// Factory is valid - service was found.
if ( xFactory.is() )
{
xFactory->acquire();
pReturn = xFactory.get();
}
}
// Return with result of this operation.
return pReturn ;
}
} // extern "C"
//=========================================================================
void SAL_CALL FilterOptionsContinuation::setFilterOptions(
const uno::Sequence<beans::PropertyValue>& rProps )
throw (uno::RuntimeException)
......
......@@ -20,9 +20,9 @@
#ifndef INCLUDED_SFX2_SOURCE_INC_EVENTSUPPLIER_HXX
#define INCLUDED_SFX2_SOURCE_INC_EVENTSUPPLIER_HXX
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <sal/types.h>
#include <com/sun/star/container/XNameReplace.hpp>
#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/XDocumentEventListener.hpp>
......@@ -32,11 +32,7 @@
#include <com/sun/star/task/XJobExecutor.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Type.hxx>
#include <sal/types.h>
#include <osl/mutex.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/sequenceasvector.hxx>
#include <sfx2/sfxuno.hxx>
......@@ -98,134 +94,7 @@ public:
const ::comphelper::NamedValueCollection& i_eventDescriptor,
::comphelper::NamedValueCollection& o_normalizedDescriptor,
SfxObjectShell* i_document );
};
//=============================================================================
struct ModelCollectionMutexBase
{
public:
::osl::Mutex m_aLock;
};
//=============================================================================
typedef ::std::vector< css::uno::Reference< css::frame::XModel > > TModelList;
//=============================================================================
class ModelCollectionEnumeration : public ModelCollectionMutexBase
, public ::cppu::WeakImplHelper1< css::container::XEnumeration >
{
//-------------------------------------------------------------------------
// member
//-------------------------------------------------------------------------
private:
TModelList m_lModels;
TModelList::iterator m_pEnumerationIt;
//-------------------------------------------------------------------------
// native interface
//-------------------------------------------------------------------------
public:
ModelCollectionEnumeration();
virtual ~ModelCollectionEnumeration();
void setModelList(const TModelList& rList);
//-------------------------------------------------------------------------
// uno interface
//-------------------------------------------------------------------------
public:
// css.container.XEnumeration
virtual sal_Bool SAL_CALL hasMoreElements()
throw(css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL nextElement()
throw(css::container::NoSuchElementException,
css::lang::WrappedTargetException ,
css::uno::RuntimeException );
};
//=============================================================================
//TODO: remove support of obsolete document::XEventBroadcaster/Listener
class SfxGlobalEvents_Impl : public ModelCollectionMutexBase
, public ::cppu::WeakImplHelper3< css::lang::XServiceInfo
, css::frame::XGlobalEventBroadcaster
, css::document::XEventListener
>
{
css::uno::Reference< css::container::XNameReplace > m_xEvents;
css::uno::Reference< css::document::XEventListener > m_xJobExecutorListener;
::cppu::OInterfaceContainerHelper m_aLegacyListeners;
::cppu::OInterfaceContainerHelper m_aDocumentListeners;
TModelList m_lModels;
GlobalEventConfig* pImp;
public:
SfxGlobalEvents_Impl(const css::uno::Reference < css::uno::XComponentContext >& rxContext);
virtual ~SfxGlobalEvents_Impl();
SFX_DECL_XSERVICEINFO
// css.document.XEventBroadcaster
virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents()
throw(css::uno::RuntimeException);
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::document::XEventListener >& xListener)
throw(css::uno::RuntimeException);
virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::document::XEventListener >& xListener)
throw(css::uno::RuntimeException);
// css.document.XDocumentEventBroadcaster
virtual void SAL_CALL addDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& _Listener ) throw (css::uno::RuntimeException);
virtual void SAL_CALL removeDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& _Listener ) throw (css::uno::RuntimeException);
virtual void SAL_CALL notifyDocumentEvent( const OUString& _EventName, const css::uno::Reference< css::frame::XController2 >& _ViewController, const css::uno::Any& _Supplement ) throw (css::lang::IllegalArgumentException, css::lang::NoSupportException, css::uno::RuntimeException);
// css.document.XEventListener
virtual void SAL_CALL notifyEvent(const css::document::EventObject& aEvent)
throw(css::uno::RuntimeException);
// css.document.XDocumentEventListener
virtual void SAL_CALL documentEventOccured( const css::document::DocumentEvent& Event ) throw (css::uno::RuntimeException);
// css.container.XSet
virtual sal_Bool SAL_CALL has(const css::uno::Any& aElement)
throw(css::uno::RuntimeException);
virtual void SAL_CALL insert(const css::uno::Any& aElement)
throw(css::lang::IllegalArgumentException ,
css::container::ElementExistException,
css::uno::RuntimeException );
virtual void SAL_CALL remove(const css::uno::Any& aElement)
throw(css::lang::IllegalArgumentException ,
css::container::NoSuchElementException,
css::uno::RuntimeException );
// css.container.XEnumerationAccess
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration()
throw(css::uno::RuntimeException);
// css.container.XElementAccess
virtual css::uno::Type SAL_CALL getElementType()
throw(css::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasElements()
throw(css::uno::RuntimeException);
// css.lang.XEventListener
virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
throw(css::uno::RuntimeException);
private:
// threadsafe
void implts_notifyJobExecution(const css::document::EventObject& aEvent);
void implts_checkAndExecuteEventBindings(const css::document::DocumentEvent& aEvent);
void implts_notifyListener(const css::document::DocumentEvent& aEvent);
// not threadsafe
TModelList::iterator impl_searchDoc(const css::uno::Reference< css::frame::XModel >& xModel);
static void Execute( css::uno::Any& aEventData, const css::document::DocumentEvent& aTrigger, SfxObjectShell* pDoc );
};
#endif
......
This diff is collapsed.
......@@ -68,7 +68,8 @@
constructor="com_sun_star_comp_sfx2_DocumentTemplates_get_implementation">
<service name="com.sun.star.frame.DocumentTemplates"/>
</implementation>
<implementation name="com.sun.star.comp.sfx2.GlobalEventBroadcaster">
<implementation name="com.sun.star.comp.sfx2.GlobalEventBroadcaster"
constructor="com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation">
<service name="com.sun.star.frame.GlobalEventBroadcaster"/>
<singleton name="com.sun.star.frame.theGlobalEventBroadcaster"/>
</implementation>
......
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