1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef _UNODISPATCH_HXX 28*cdf0e10cSrcweir #define _UNODISPATCH_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProviderInterception.hpp> 31*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/view/XSelectionChangeListener.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp> 35*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 36*cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 37*cdf0e10cSrcweir #include <list> 38*cdf0e10cSrcweir //#ifndef _OSL_MUTEX_HXX_ 39*cdf0e10cSrcweir //#include <osl/mutex.hxx> 40*cdf0e10cSrcweir //#endif 41*cdf0e10cSrcweir #include <vos/mutex.hxx> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir class SwView; 44*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------------------- 45*cdf0e10cSrcweir class SwXDispatchProviderInterceptor : public cppu::WeakImplHelper3 46*cdf0e10cSrcweir < 47*cdf0e10cSrcweir ::com::sun::star::frame::XDispatchProviderInterceptor, 48*cdf0e10cSrcweir ::com::sun::star::lang::XEventListener, 49*cdf0e10cSrcweir ::com::sun::star::lang::XUnoTunnel 50*cdf0e10cSrcweir > 51*cdf0e10cSrcweir { 52*cdf0e10cSrcweir class DispatchMutexLock_Impl 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir //::osl::MutexGuard aGuard; #102295# solar mutex has to be used currently 55*cdf0e10cSrcweir vos::OGuard aGuard; 56*cdf0e10cSrcweir DispatchMutexLock_Impl(); 57*cdf0e10cSrcweir public: 58*cdf0e10cSrcweir DispatchMutexLock_Impl(SwXDispatchProviderInterceptor&); 59*cdf0e10cSrcweir ~DispatchMutexLock_Impl(); 60*cdf0e10cSrcweir }; 61*cdf0e10cSrcweir friend class DispatchMutexLock_Impl; 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir // ::osl::Mutex m_aMutex;#102295# solar mutex has to be used currently 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir // the component which's dispatches we're intercepting 66*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception> m_xIntercepted; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir // chaining 69*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xSlaveDispatcher; 70*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xMasterDispatcher; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch> m_xDispatch; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir SwView* m_pView; 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir public: 77*cdf0e10cSrcweir SwXDispatchProviderInterceptor(SwView& rView); 78*cdf0e10cSrcweir ~SwXDispatchProviderInterceptor(); 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir //XDispatchProvider 81*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw(::com::sun::star::uno::RuntimeException); 82*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw(::com::sun::star::uno::RuntimeException); 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir //XDispatchProviderInterceptor 85*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException); 86*cdf0e10cSrcweir virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider ) throw(::com::sun::star::uno::RuntimeException); 87*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException); 88*cdf0e10cSrcweir virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSupplier ) throw(::com::sun::star::uno::RuntimeException); 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir // XEventListener 91*cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir //XUnoTunnel 94*cdf0e10cSrcweir static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId(); 95*cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir // view destroyed 98*cdf0e10cSrcweir void Invalidate(); 99*cdf0e10cSrcweir }; 100*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------------------- 101*cdf0e10cSrcweir struct StatusStruct_Impl 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener> xListener; 104*cdf0e10cSrcweir ::com::sun::star::util::URL aURL; 105*cdf0e10cSrcweir }; 106*cdf0e10cSrcweir typedef std::list< StatusStruct_Impl > StatusListenerList; 107*cdf0e10cSrcweir class SwXDispatch : public cppu::WeakImplHelper2 108*cdf0e10cSrcweir < 109*cdf0e10cSrcweir ::com::sun::star::frame::XDispatch, 110*cdf0e10cSrcweir ::com::sun::star::view::XSelectionChangeListener 111*cdf0e10cSrcweir > 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir SwView* m_pView; 114*cdf0e10cSrcweir StatusListenerList m_aListenerList; 115*cdf0e10cSrcweir sal_Bool m_bOldEnable; 116*cdf0e10cSrcweir sal_Bool m_bListenerAdded; 117*cdf0e10cSrcweir public: 118*cdf0e10cSrcweir SwXDispatch(SwView& rView); 119*cdf0e10cSrcweir ~SwXDispatch(); 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw(::com::sun::star::uno::RuntimeException); 122*cdf0e10cSrcweir virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw(::com::sun::star::uno::RuntimeException); 123*cdf0e10cSrcweir virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw(::com::sun::star::uno::RuntimeException); 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir //XSelectionChangeListener 126*cdf0e10cSrcweir virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir //XEventListener 129*cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir static const sal_Char* GetDBChangeURL(); 132*cdf0e10cSrcweir }; 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir #endif 135