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