1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _INTERCEPT_HXX_ 29 #define _INTERCEPT_HXX_ 30 31 #include <osl/mutex.hxx> 32 #include <cppuhelper/implbase3.hxx> 33 #include <cppuhelper/interfacecontainer.hxx> 34 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 35 #include <com/sun/star/frame/XInterceptorInfo.hpp> 36 #include <com/sun/star/frame/XDispatch.hpp> 37 38 39 class StatusChangeListenerContainer; 40 class DocumentHolder; 41 42 class Interceptor : public ::cppu::WeakImplHelper3< ::com::sun::star::frame::XDispatchProviderInterceptor, 43 ::com::sun::star::frame::XInterceptorInfo, 44 ::com::sun::star::frame::XDispatch> 45 { 46 public: 47 48 Interceptor( DocumentHolder* pDocHolder ); 49 ~Interceptor(); 50 51 void DisconnectDocHolder(); 52 // overwritten to release the statuslistner. 53 54 // XComponent 55 virtual void SAL_CALL 56 addEventListener( 57 const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& xListener ) 58 throw( com::sun::star::uno::RuntimeException ); 59 60 virtual void SAL_CALL 61 removeEventListener( const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& aListener ) 62 throw( com::sun::star::uno::RuntimeException ); 63 64 //XDispatch 65 virtual void SAL_CALL 66 dispatch( 67 const ::com::sun::star::util::URL& URL, 68 const ::com::sun::star::uno::Sequence< 69 ::com::sun::star::beans::PropertyValue >& Arguments ) 70 throw (::com::sun::star::uno::RuntimeException); 71 72 virtual void SAL_CALL 73 addStatusListener( 74 const ::com::sun::star::uno::Reference< 75 ::com::sun::star::frame::XStatusListener >& Control, 76 const ::com::sun::star::util::URL& URL ) 77 throw ( 78 ::com::sun::star::uno::RuntimeException 79 ); 80 81 virtual void SAL_CALL 82 removeStatusListener( 83 const ::com::sun::star::uno::Reference< 84 ::com::sun::star::frame::XStatusListener >& Control, 85 const ::com::sun::star::util::URL& URL ) 86 throw ( 87 ::com::sun::star::uno::RuntimeException 88 ); 89 90 //XInterceptorInfo 91 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > 92 SAL_CALL getInterceptedURLs( ) 93 throw ( 94 ::com::sun::star::uno::RuntimeException 95 ); 96 97 //XDispatchProvider ( inherited by XDispatchProviderInterceptor ) 98 virtual ::com::sun::star::uno::Reference< 99 ::com::sun::star::frame::XDispatch > SAL_CALL 100 queryDispatch( 101 const ::com::sun::star::util::URL& URL, 102 const ::rtl::OUString& TargetFrameName, 103 sal_Int32 SearchFlags ) 104 throw ( 105 ::com::sun::star::uno::RuntimeException 106 ); 107 108 virtual ::com::sun::star::uno::Sequence< 109 ::com::sun::star::uno::Reference< 110 ::com::sun::star::frame::XDispatch > > SAL_CALL 111 queryDispatches( 112 const ::com::sun::star::uno::Sequence< 113 ::com::sun::star::frame::DispatchDescriptor >& Requests ) 114 throw ( 115 ::com::sun::star::uno::RuntimeException 116 ); 117 118 119 //XDispatchProviderInterceptor 120 virtual ::com::sun::star::uno::Reference< 121 ::com::sun::star::frame::XDispatchProvider > SAL_CALL 122 getSlaveDispatchProvider( ) 123 throw ( 124 ::com::sun::star::uno::RuntimeException 125 ); 126 127 virtual void SAL_CALL 128 setSlaveDispatchProvider( 129 const ::com::sun::star::uno::Reference< 130 ::com::sun::star::frame::XDispatchProvider >& NewDispatchProvider ) 131 throw ( 132 ::com::sun::star::uno::RuntimeException 133 ); 134 135 virtual ::com::sun::star::uno::Reference< 136 ::com::sun::star::frame::XDispatchProvider > SAL_CALL 137 getMasterDispatchProvider( ) 138 throw ( 139 ::com::sun::star::uno::RuntimeException 140 ); 141 142 virtual void SAL_CALL 143 setMasterDispatchProvider( 144 const ::com::sun::star::uno::Reference< 145 ::com::sun::star::frame::XDispatchProvider >& NewSupplier ) 146 throw ( 147 ::com::sun::star::uno::RuntimeException 148 ); 149 150 151 private: 152 153 osl::Mutex m_aMutex; 154 155 DocumentHolder* m_pDocHolder; 156 157 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatchProvider; 158 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xMasterDispatchProvider; 159 160 static ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aInterceptedURL; 161 162 cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; 163 StatusChangeListenerContainer* m_pStatCL; 164 }; 165 166 #endif 167 168