1 /************************************************************************* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * Copyright 2000, 2010 Oracle and/or its affiliates. 5 * 6 * OpenOffice.org - a multi-platform office productivity suite 7 * 8 * This file is part of OpenOffice.org. 9 * 10 * OpenOffice.org is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU Lesser General Public License version 3 12 * only, as published by the Free Software Foundation. 13 * 14 * OpenOffice.org is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU Lesser General Public License version 3 for more details 18 * (a copy is included in the LICENSE file that accompanied this code). 19 * 20 * You should have received a copy of the GNU Lesser General Public License 21 * version 3 along with OpenOffice.org. If not, see 22 * <http://www.openoffice.org/license.html> 23 * for a copy of the LGPLv3 License. 24 * 25 ************************************************************************/ 26 27 #ifndef SVX_FORMDISPATCHINTERCEPTOR_HXX 28 #define SVX_FORMDISPATCHINTERCEPTOR_HXX 29 30 /** === begin UNO includes === **/ 31 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 32 #include <com/sun/star/frame/XDispatchProviderInterception.hpp> 33 /** === end UNO includes === **/ 34 35 #include <cppuhelper/compbase2.hxx> 36 #include <comphelper/uno3.hxx> 37 38 //........................................................................ 39 namespace svxform 40 { 41 //........................................................................ 42 43 //==================================================================== 44 //= DispatchInterceptor 45 //==================================================================== 46 class DispatchInterceptor 47 { 48 public: 49 DispatchInterceptor() { } 50 51 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch> interceptedQueryDispatch( 52 const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw( ::com::sun::star::uno::RuntimeException ) = 0; 53 54 virtual ::osl::Mutex* getInterceptorMutex() = 0; 55 }; 56 57 //==================================================================== 58 //= 59 //==================================================================== 60 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::frame::XDispatchProviderInterceptor 61 , ::com::sun::star::lang::XEventListener 62 > DispatchInterceptionMultiplexer_BASE; 63 64 class DispatchInterceptionMultiplexer : public DispatchInterceptionMultiplexer_BASE 65 { 66 ::osl::Mutex m_aFallback; 67 ::osl::Mutex* m_pMutex; 68 69 // the component which's dispatches we're intercepting 70 ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProviderInterception > 71 m_xIntercepted; 72 sal_Bool m_bListening; 73 74 // the real interceptor 75 DispatchInterceptor* m_pMaster; 76 77 // chaining 78 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xSlaveDispatcher; 79 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xMasterDispatcher; 80 81 virtual ~DispatchInterceptionMultiplexer(); 82 83 public: 84 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception> getIntercepted() const { return m_xIntercepted; } 85 86 public: 87 DispatchInterceptionMultiplexer( 88 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _rToIntercept, 89 DispatchInterceptor* _pMaster 90 ); 91 92 // UNO 93 DECLARE_UNO3_DEFAULTS(DispatchInterceptionMultiplexer, DispatchInterceptionMultiplexer_BASE); 94 95 // ::com::sun::star::frame::XDispatchProvider 96 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); 97 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); 98 99 // ::com::sun::star::frame::XDispatchProviderInterceptor 100 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException); 101 virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider ) throw(::com::sun::star::uno::RuntimeException); 102 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException); 103 virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSupplier ) throw(::com::sun::star::uno::RuntimeException); 104 105 // ::com::sun::star::lang::XEventListener 106 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); 107 108 // OComponentHelper 109 virtual void SAL_CALL disposing(); 110 111 protected: 112 void ImplDetach(); 113 }; 114 115 //........................................................................ 116 } // namespace svxform 117 //........................................................................ 118 119 #endif // SVX_FORMDISPATCHINTERCEPTOR_HXX 120