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