1*08421ca6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*08421ca6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*08421ca6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*08421ca6SAndrew Rist * distributed with this work for additional information 6*08421ca6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*08421ca6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*08421ca6SAndrew Rist * "License"); you may not use this file except in compliance 9*08421ca6SAndrew Rist * with the License. You may obtain a copy of the License at 10*08421ca6SAndrew Rist * 11*08421ca6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*08421ca6SAndrew Rist * 13*08421ca6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*08421ca6SAndrew Rist * software distributed under the License is distributed on an 15*08421ca6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*08421ca6SAndrew Rist * KIND, either express or implied. See the License for the 17*08421ca6SAndrew Rist * specific language governing permissions and limitations 18*08421ca6SAndrew Rist * under the License. 19*08421ca6SAndrew Rist * 20*08421ca6SAndrew Rist *************************************************************/ 21*08421ca6SAndrew Rist 22*08421ca6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _INTERCEPT_HXX_ 25cdf0e10cSrcweir #define _INTERCEPT_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <osl/mutex.hxx> 28cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 29cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 30cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 31cdf0e10cSrcweir #include <com/sun/star/frame/XInterceptorInfo.hpp> 32cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp> 33cdf0e10cSrcweir 34cdf0e10cSrcweir 35cdf0e10cSrcweir class StatusChangeListenerContainer; 36cdf0e10cSrcweir class DocumentHolder; 37cdf0e10cSrcweir 38cdf0e10cSrcweir class Interceptor : public ::cppu::WeakImplHelper3< ::com::sun::star::frame::XDispatchProviderInterceptor, 39cdf0e10cSrcweir ::com::sun::star::frame::XInterceptorInfo, 40cdf0e10cSrcweir ::com::sun::star::frame::XDispatch> 41cdf0e10cSrcweir { 42cdf0e10cSrcweir public: 43cdf0e10cSrcweir 44cdf0e10cSrcweir Interceptor( DocumentHolder* pDocHolder ); 45cdf0e10cSrcweir ~Interceptor(); 46cdf0e10cSrcweir 47cdf0e10cSrcweir void DisconnectDocHolder(); 48cdf0e10cSrcweir // overwritten to release the statuslistner. 49cdf0e10cSrcweir 50cdf0e10cSrcweir // XComponent 51cdf0e10cSrcweir virtual void SAL_CALL 52cdf0e10cSrcweir addEventListener( 53cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& xListener ) 54cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 55cdf0e10cSrcweir 56cdf0e10cSrcweir virtual void SAL_CALL 57cdf0e10cSrcweir removeEventListener( const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& aListener ) 58cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 59cdf0e10cSrcweir 60cdf0e10cSrcweir //XDispatch 61cdf0e10cSrcweir virtual void SAL_CALL 62cdf0e10cSrcweir dispatch( 63cdf0e10cSrcweir const ::com::sun::star::util::URL& URL, 64cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< 65cdf0e10cSrcweir ::com::sun::star::beans::PropertyValue >& Arguments ) 66cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 67cdf0e10cSrcweir 68cdf0e10cSrcweir virtual void SAL_CALL 69cdf0e10cSrcweir addStatusListener( 70cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 71cdf0e10cSrcweir ::com::sun::star::frame::XStatusListener >& Control, 72cdf0e10cSrcweir const ::com::sun::star::util::URL& URL ) 73cdf0e10cSrcweir throw ( 74cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 75cdf0e10cSrcweir ); 76cdf0e10cSrcweir 77cdf0e10cSrcweir virtual void SAL_CALL 78cdf0e10cSrcweir removeStatusListener( 79cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 80cdf0e10cSrcweir ::com::sun::star::frame::XStatusListener >& Control, 81cdf0e10cSrcweir const ::com::sun::star::util::URL& URL ) 82cdf0e10cSrcweir throw ( 83cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 84cdf0e10cSrcweir ); 85cdf0e10cSrcweir 86cdf0e10cSrcweir //XInterceptorInfo 87cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > 88cdf0e10cSrcweir SAL_CALL getInterceptedURLs( ) 89cdf0e10cSrcweir throw ( 90cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 91cdf0e10cSrcweir ); 92cdf0e10cSrcweir 93cdf0e10cSrcweir //XDispatchProvider ( inherited by XDispatchProviderInterceptor ) 94cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 95cdf0e10cSrcweir ::com::sun::star::frame::XDispatch > SAL_CALL 96cdf0e10cSrcweir queryDispatch( 97cdf0e10cSrcweir const ::com::sun::star::util::URL& URL, 98cdf0e10cSrcweir const ::rtl::OUString& TargetFrameName, 99cdf0e10cSrcweir sal_Int32 SearchFlags ) 100cdf0e10cSrcweir throw ( 101cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 102cdf0e10cSrcweir ); 103cdf0e10cSrcweir 104cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< 105cdf0e10cSrcweir ::com::sun::star::uno::Reference< 106cdf0e10cSrcweir ::com::sun::star::frame::XDispatch > > SAL_CALL 107cdf0e10cSrcweir queryDispatches( 108cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< 109cdf0e10cSrcweir ::com::sun::star::frame::DispatchDescriptor >& Requests ) 110cdf0e10cSrcweir throw ( 111cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 112cdf0e10cSrcweir ); 113cdf0e10cSrcweir 114cdf0e10cSrcweir 115cdf0e10cSrcweir //XDispatchProviderInterceptor 116cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 117cdf0e10cSrcweir ::com::sun::star::frame::XDispatchProvider > SAL_CALL 118cdf0e10cSrcweir getSlaveDispatchProvider( ) 119cdf0e10cSrcweir throw ( 120cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 121cdf0e10cSrcweir ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir virtual void SAL_CALL 124cdf0e10cSrcweir setSlaveDispatchProvider( 125cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 126cdf0e10cSrcweir ::com::sun::star::frame::XDispatchProvider >& NewDispatchProvider ) 127cdf0e10cSrcweir throw ( 128cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 129cdf0e10cSrcweir ); 130cdf0e10cSrcweir 131cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 132cdf0e10cSrcweir ::com::sun::star::frame::XDispatchProvider > SAL_CALL 133cdf0e10cSrcweir getMasterDispatchProvider( ) 134cdf0e10cSrcweir throw ( 135cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 136cdf0e10cSrcweir ); 137cdf0e10cSrcweir 138cdf0e10cSrcweir virtual void SAL_CALL 139cdf0e10cSrcweir setMasterDispatchProvider( 140cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 141cdf0e10cSrcweir ::com::sun::star::frame::XDispatchProvider >& NewSupplier ) 142cdf0e10cSrcweir throw ( 143cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 144cdf0e10cSrcweir ); 145cdf0e10cSrcweir 146cdf0e10cSrcweir 147cdf0e10cSrcweir private: 148cdf0e10cSrcweir 149cdf0e10cSrcweir osl::Mutex m_aMutex; 150cdf0e10cSrcweir 151cdf0e10cSrcweir DocumentHolder* m_pDocHolder; 152cdf0e10cSrcweir 153cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatchProvider; 154cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xMasterDispatchProvider; 155cdf0e10cSrcweir 156cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aInterceptedURL; 157cdf0e10cSrcweir 158cdf0e10cSrcweir cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; 159cdf0e10cSrcweir StatusChangeListenerContainer* m_pStatCL; 160cdf0e10cSrcweir }; 161cdf0e10cSrcweir 162cdf0e10cSrcweir #endif 163cdf0e10cSrcweir 164