1*d975be8cSAndre Fischer /************************************************************** 2*d975be8cSAndre Fischer * 3*d975be8cSAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 4*d975be8cSAndre Fischer * or more contributor license agreements. See the NOTICE file 5*d975be8cSAndre Fischer * distributed with this work for additional information 6*d975be8cSAndre Fischer * regarding copyright ownership. The ASF licenses this file 7*d975be8cSAndre Fischer * to you under the Apache License, Version 2.0 (the 8*d975be8cSAndre Fischer * "License"); you may not use this file except in compliance 9*d975be8cSAndre Fischer * with the License. You may obtain a copy of the License at 10*d975be8cSAndre Fischer * 11*d975be8cSAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 12*d975be8cSAndre Fischer * 13*d975be8cSAndre Fischer * Unless required by applicable law or agreed to in writing, 14*d975be8cSAndre Fischer * software distributed under the License is distributed on an 15*d975be8cSAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*d975be8cSAndre Fischer * KIND, either express or implied. See the License for the 17*d975be8cSAndre Fischer * specific language governing permissions and limitations 18*d975be8cSAndre Fischer * under the License. 19*d975be8cSAndre Fischer * 20*d975be8cSAndre Fischer *************************************************************/ 21*d975be8cSAndre Fischer 22*d975be8cSAndre Fischer 23*d975be8cSAndre Fischer 24*d975be8cSAndre Fischer #ifndef __FRAMEWORK_SERVICES_EVENT_MULTIPLEXER_HXX_ 25*d975be8cSAndre Fischer #define __FRAMEWORK_SERVICES_EVENT_MULTIPLEXER_HXX_ 26*d975be8cSAndre Fischer 27*d975be8cSAndre Fischer #include <com/sun/star/util/XEventMultiplexer.hpp> 28*d975be8cSAndre Fischer 29*d975be8cSAndre Fischer #include <cppuhelper/compbase3.hxx> 30*d975be8cSAndre Fischer #include <cppuhelper/basemutex.hxx> 31*d975be8cSAndre Fischer 32*d975be8cSAndre Fischer #include "macros/xserviceinfo.hxx" 33*d975be8cSAndre Fischer 34*d975be8cSAndre Fischer namespace 35*d975be8cSAndre Fischer { 36*d975be8cSAndre Fischer typedef ::cppu::WeakComponentImplHelper3 < 37*d975be8cSAndre Fischer css::util::XEventMultiplexer, 38*d975be8cSAndre Fischer css::lang::XSingleComponentFactory, 39*d975be8cSAndre Fischer css::lang::XServiceInfo 40*d975be8cSAndre Fischer > EventMultiplexerInterfaceBase; 41*d975be8cSAndre Fischer } 42*d975be8cSAndre Fischer 43*d975be8cSAndre Fischer 44*d975be8cSAndre Fischer namespace css = ::com::sun::star; 45*d975be8cSAndre Fischer namespace cssu = ::com::sun::star::uno; 46*d975be8cSAndre Fischer namespace cssl = ::com::sun::star::lang; 47*d975be8cSAndre Fischer 48*d975be8cSAndre Fischer namespace framework { 49*d975be8cSAndre Fischer 50*d975be8cSAndre Fischer class EventMultiplexer 51*d975be8cSAndre Fischer : private ::boost::noncopyable, 52*d975be8cSAndre Fischer private ::cppu::BaseMutex, 53*d975be8cSAndre Fischer public EventMultiplexerInterfaceBase 54*d975be8cSAndre Fischer { 55*d975be8cSAndre Fischer public: 56*d975be8cSAndre Fischer EventMultiplexer(const cssu::Reference<css::uno::XComponentContext>& rxContext); 57*d975be8cSAndre Fischer virtual ~EventMultiplexer (void); 58*d975be8cSAndre Fischer 59*d975be8cSAndre Fischer // XEventMultiplexer 60*d975be8cSAndre Fischer virtual void SAL_CALL addEventListener ( 61*d975be8cSAndre Fischer const cssu::Reference<css::util::XEventListener>& rxListener, 62*d975be8cSAndre Fischer const cssu::Reference<cssu::XInterface>& rxEventFocus) 63*d975be8cSAndre Fischer throw(cssu::RuntimeException, cssl::IllegalArgumentException); 64*d975be8cSAndre Fischer virtual void SAL_CALL removeEventListener ( 65*d975be8cSAndre Fischer const cssu::Reference<css::util::XEventListener>& rxListener, 66*d975be8cSAndre Fischer const cssu::Reference<cssu::XInterface>& rxEventFocus) 67*d975be8cSAndre Fischer throw(cssu::RuntimeException, cssl::IllegalArgumentException); 68*d975be8cSAndre Fischer virtual void SAL_CALL removeAllEventListeners ( 69*d975be8cSAndre Fischer const cssu::Reference<css::util::XEventListener>& rxListener) 70*d975be8cSAndre Fischer throw(cssu::RuntimeException, cssl::IllegalArgumentException); 71*d975be8cSAndre Fischer virtual void SAL_CALL broadcastEvent ( 72*d975be8cSAndre Fischer const cssl::EventObject& rEventObject, 73*d975be8cSAndre Fischer const cssu::Reference<cssu::XInterface>& rxEventFocus) 74*d975be8cSAndre Fischer throw(cssu::RuntimeException); 75*d975be8cSAndre Fischer 76*d975be8cSAndre Fischer // XSingleComponentFactory 77*d975be8cSAndre Fischer virtual cssu::Reference<cssu::XInterface> SAL_CALL createInstanceWithContext ( 78*d975be8cSAndre Fischer const cssu::Reference<cssu::XComponentContext>& rxContext) 79*d975be8cSAndre Fischer throw (cssu::Exception, cssu::RuntimeException); 80*d975be8cSAndre Fischer virtual cssu::Reference<cssu::XInterface > SAL_CALL createInstanceWithArgumentsAndContext ( 81*d975be8cSAndre Fischer const cssu::Sequence<cssu::Any>& rArguments, 82*d975be8cSAndre Fischer const cssu::Reference<cssu::XComponentContext>& rxContext) 83*d975be8cSAndre Fischer throw (cssu::Exception, cssu::RuntimeException); 84*d975be8cSAndre Fischer 85*d975be8cSAndre Fischer // XServiceInfo 86*d975be8cSAndre Fischer virtual ::rtl::OUString SAL_CALL getImplementationName (void) 87*d975be8cSAndre Fischer throw (cssu::RuntimeException); 88*d975be8cSAndre Fischer virtual sal_Bool SAL_CALL supportsService ( 89*d975be8cSAndre Fischer const ::rtl::OUString& rsServiceName) 90*d975be8cSAndre Fischer throw (cssu::RuntimeException); 91*d975be8cSAndre Fischer virtual cssu::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) 92*d975be8cSAndre Fischer throw (cssu::RuntimeException); 93*d975be8cSAndre Fischer 94*d975be8cSAndre Fischer static ::rtl::OUString SAL_CALL impl_getStaticImplementationName (void); 95*d975be8cSAndre Fischer static cssu::Reference<cssu::XInterface> SAL_CALL impl_createFactory ( 96*d975be8cSAndre Fischer const cssu::Reference<cssl::XMultiServiceFactory>& xServiceManager); 97*d975be8cSAndre Fischer 98*d975be8cSAndre Fischer private: 99*d975be8cSAndre Fischer typedef ::std::vector<cssu::Reference<css::util::XEventListener> > ListenerContainer; 100*d975be8cSAndre Fischer typedef ::std::map<cssu::Reference<cssu::XInterface>, ListenerContainer> ListenerMap; 101*d975be8cSAndre Fischer ListenerMap maListeners; 102*d975be8cSAndre Fischer 103*d975be8cSAndre Fischer /** Notify all listeners in the container that is associated with 104*d975be8cSAndre Fischer the given event focus. 105*d975be8cSAndre Fischer 106*d975be8cSAndre Fischer Typically called twice from broadcastEvent(), once for the 107*d975be8cSAndre Fischer given event focus and onece for NULL. 108*d975be8cSAndre Fischer */ 109*d975be8cSAndre Fischer void BroadcastEventToSingleContainer ( 110*d975be8cSAndre Fischer const cssl::EventObject& rEventObject, 111*d975be8cSAndre Fischer const cssu::Reference<cssu::XInterface>& rxEventFocus); 112*d975be8cSAndre Fischer 113*d975be8cSAndre Fischer static cssu::Sequence< ::rtl::OUString > SAL_CALL static_GetSupportedServiceNames (void); 114*d975be8cSAndre Fischer static cssu::Reference<cssu::XInterface> SAL_CALL static_CreateInstance ( 115*d975be8cSAndre Fischer const cssu::Reference<cssu::XComponentContext>& rxComponentContext) 116*d975be8cSAndre Fischer throw (cssu::Exception); 117*d975be8cSAndre Fischer }; 118*d975be8cSAndre Fischer 119*d975be8cSAndre Fischer } // end of namespace framework 120*d975be8cSAndre Fischer 121*d975be8cSAndre Fischer #endif 122*d975be8cSAndre Fischer 123