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 DBA_INTERCEPT_HXX 25 #define DBA_INTERCEPT_HXX 26 27 #ifndef _OSL_MUTEX_HXX_ 28 #include <osl/mutex.hxx> 29 #endif 30 #ifndef _CPPUHELPER_IMPLBASE4_HXX_ 31 #include <cppuhelper/implbase4.hxx> 32 #endif 33 #ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_ 34 #include <cppuhelper/interfacecontainer.hxx> 35 #endif 36 #ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDERINTERCEPTOR_HPP_ 37 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 38 #endif 39 #ifndef _COM_SUN_STAR_FRAME_XINTERCEPTORINFO_HPP_ 40 #include <com/sun/star/frame/XInterceptorInfo.hpp> 41 #endif 42 #ifndef _COM_SUN_STAR_DOCUMENT_XEVENTLISTENER_HPP_ 43 #include <com/sun/star/document/XEventListener.hpp> 44 #endif 45 #ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_ 46 #include <com/sun/star/frame/XDispatch.hpp> 47 #endif 48 #ifndef _DBA_COREDATAACCESS_DOCUMENTDEFINITION_HXX_ 49 #include "documentdefinition.hxx" 50 #endif 51 #include <vcl/svapp.hxx> 52 53 namespace dbaccess 54 { 55 56 57 class OInterceptor : public ::cppu::WeakImplHelper4< ::com::sun::star::frame::XDispatchProviderInterceptor, 58 ::com::sun::star::frame::XInterceptorInfo, 59 ::com::sun::star::frame::XDispatch, 60 ::com::sun::star::document::XEventListener> 61 { 62 DECL_LINK( OnDispatch, void* _aURL ); 63 protected: 64 virtual ~OInterceptor(); 65 public: 66 67 OInterceptor( ODocumentDefinition* _pContentHolder,sal_Bool _bAllowEditDoc ); 68 69 void SAL_CALL dispose(); 70 71 //XDispatch 72 virtual void SAL_CALL 73 dispatch( 74 const ::com::sun::star::util::URL& URL, 75 const ::com::sun::star::uno::Sequence< 76 ::com::sun::star::beans::PropertyValue >& Arguments ); 77 78 virtual void SAL_CALL 79 addStatusListener( 80 const ::com::sun::star::uno::Reference< 81 ::com::sun::star::frame::XStatusListener >& Control, 82 const ::com::sun::star::util::URL& URL ); 83 84 virtual void SAL_CALL 85 removeStatusListener( 86 const ::com::sun::star::uno::Reference< 87 ::com::sun::star::frame::XStatusListener >& Control, 88 const ::com::sun::star::util::URL& URL ); 89 90 //XInterceptorInfo 91 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > 92 SAL_CALL getInterceptedURLs( ); 93 94 //XDispatchProvider ( inherited by XDispatchProviderInterceptor ) 95 virtual ::com::sun::star::uno::Reference< 96 ::com::sun::star::frame::XDispatch > SAL_CALL 97 queryDispatch( 98 const ::com::sun::star::util::URL& URL, 99 const ::rtl::OUString& TargetFrameName, 100 sal_Int32 SearchFlags ); 101 102 virtual ::com::sun::star::uno::Sequence< 103 ::com::sun::star::uno::Reference< 104 ::com::sun::star::frame::XDispatch > > SAL_CALL 105 queryDispatches( 106 const ::com::sun::star::uno::Sequence< 107 ::com::sun::star::frame::DispatchDescriptor >& Requests ); 108 109 110 //XDispatchProviderInterceptor 111 virtual ::com::sun::star::uno::Reference< 112 ::com::sun::star::frame::XDispatchProvider > SAL_CALL 113 getSlaveDispatchProvider( ); 114 115 virtual void SAL_CALL 116 setSlaveDispatchProvider( 117 const ::com::sun::star::uno::Reference< 118 ::com::sun::star::frame::XDispatchProvider >& NewDispatchProvider ); 119 120 virtual ::com::sun::star::uno::Reference< 121 ::com::sun::star::frame::XDispatchProvider > SAL_CALL 122 getMasterDispatchProvider( ); 123 124 virtual void SAL_CALL 125 setMasterDispatchProvider( 126 const ::com::sun::star::uno::Reference< 127 ::com::sun::star::frame::XDispatchProvider >& NewSupplier ); 128 129 // XEventListener 130 virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ); 131 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ); 132 133 134 private: 135 136 osl::Mutex m_aMutex; 137 138 ODocumentDefinition* m_pContentHolder; 139 140 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatchProvider; 141 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xMasterDispatchProvider; 142 143 ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aInterceptedURL; 144 145 cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; 146 PropertyChangeListenerContainer* m_pStatCL; 147 sal_Bool m_bAllowEditDoc; 148 }; 149 150 151 //........................................................................ 152 } // namespace dbaccess 153 //........................................................................ 154 155 156 #endif //DBA_INTERCEPT_HXX 157