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