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 #ifndef _UNODISPATCH_HXX 24 #define _UNODISPATCH_HXX 25 26 #include <com/sun/star/frame/XDispatchProviderInterception.hpp> 27 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 28 #include <com/sun/star/view/XSelectionChangeListener.hpp> 29 #include <com/sun/star/lang/XUnoTunnel.hpp> 30 #include <com/sun/star/frame/XDispatch.hpp> 31 #include <cppuhelper/implbase2.hxx> 32 #include <cppuhelper/implbase3.hxx> 33 #include <list> 34 //#ifndef _OSL_MUTEX_HXX_ 35 //#include <osl/mutex.hxx> 36 //#endif 37 #include <vos/mutex.hxx> 38 39 class SwView; 40 //--------------------------------------------------------------------------------------------------------------------- 41 class SwXDispatchProviderInterceptor : public cppu::WeakImplHelper3 42 < 43 ::com::sun::star::frame::XDispatchProviderInterceptor, 44 ::com::sun::star::lang::XEventListener, 45 ::com::sun::star::lang::XUnoTunnel 46 > 47 { 48 class DispatchMutexLock_Impl 49 { 50 //::osl::MutexGuard aGuard; #102295# solar mutex has to be used currently 51 vos::OGuard aGuard; 52 DispatchMutexLock_Impl(); 53 public: 54 DispatchMutexLock_Impl(SwXDispatchProviderInterceptor&); 55 ~DispatchMutexLock_Impl(); 56 }; 57 friend class DispatchMutexLock_Impl; 58 59 // ::osl::Mutex m_aMutex;#102295# solar mutex has to be used currently 60 61 // the component which's dispatches we're intercepting 62 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception> m_xIntercepted; 63 64 // chaining 65 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xSlaveDispatcher; 66 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xMasterDispatcher; 67 68 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch> m_xDispatch; 69 70 SwView* m_pView; 71 72 public: 73 SwXDispatchProviderInterceptor(SwView& rView); 74 ~SwXDispatchProviderInterceptor(); 75 76 //XDispatchProvider 77 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw(::com::sun::star::uno::RuntimeException); 78 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw(::com::sun::star::uno::RuntimeException); 79 80 //XDispatchProviderInterceptor 81 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException); 82 virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider ) throw(::com::sun::star::uno::RuntimeException); 83 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException); 84 virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSupplier ) throw(::com::sun::star::uno::RuntimeException); 85 86 // XEventListener 87 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); 88 89 //XUnoTunnel 90 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId(); 91 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); 92 93 // view destroyed 94 void Invalidate(); 95 }; 96 //--------------------------------------------------------------------------------------------------------------------- 97 struct StatusStruct_Impl 98 { 99 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener> xListener; 100 ::com::sun::star::util::URL aURL; 101 }; 102 typedef std::list< StatusStruct_Impl > StatusListenerList; 103 class SwXDispatch : public cppu::WeakImplHelper2 104 < 105 ::com::sun::star::frame::XDispatch, 106 ::com::sun::star::view::XSelectionChangeListener 107 > 108 { 109 SwView* m_pView; 110 StatusListenerList m_aListenerList; 111 sal_Bool m_bOldEnable; 112 sal_Bool m_bListenerAdded; 113 public: 114 SwXDispatch(SwView& rView); 115 ~SwXDispatch(); 116 117 virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw(::com::sun::star::uno::RuntimeException); 118 virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw(::com::sun::star::uno::RuntimeException); 119 virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw(::com::sun::star::uno::RuntimeException); 120 121 //XSelectionChangeListener 122 virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); 123 124 //XEventListener 125 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); 126 127 static const sal_Char* GetDBChangeURL(); 128 }; 129 130 #endif 131