xref: /aoo42x/main/sw/source/ui/inc/unodispatch.hxx (revision 1d2dbeb0)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19*1d2dbeb0SAndrew Rist  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _UNODISPATCH_HXX
24cdf0e10cSrcweir #define _UNODISPATCH_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
27cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
28cdf0e10cSrcweir #include <com/sun/star/view/XSelectionChangeListener.hpp>
29cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
30cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp>
31cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
32cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
33cdf0e10cSrcweir #include <list>
34cdf0e10cSrcweir //#ifndef _OSL_MUTEX_HXX_
35cdf0e10cSrcweir //#include <osl/mutex.hxx>
36cdf0e10cSrcweir //#endif
37cdf0e10cSrcweir #include <vos/mutex.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class SwView;
40cdf0e10cSrcweir //---------------------------------------------------------------------------------------------------------------------
41cdf0e10cSrcweir class SwXDispatchProviderInterceptor : public cppu::WeakImplHelper3
42cdf0e10cSrcweir <
43cdf0e10cSrcweir 	::com::sun::star::frame::XDispatchProviderInterceptor,
44cdf0e10cSrcweir     ::com::sun::star::lang::XEventListener,
45cdf0e10cSrcweir     ::com::sun::star::lang::XUnoTunnel
46cdf0e10cSrcweir >
47cdf0e10cSrcweir {
48cdf0e10cSrcweir     class DispatchMutexLock_Impl
49cdf0e10cSrcweir     {
50cdf0e10cSrcweir         //::osl::MutexGuard   aGuard; #102295# solar mutex has to be used currently
51cdf0e10cSrcweir         vos::OGuard         aGuard;
52cdf0e10cSrcweir         DispatchMutexLock_Impl();
53cdf0e10cSrcweir     public:
54cdf0e10cSrcweir         DispatchMutexLock_Impl(SwXDispatchProviderInterceptor&);
55cdf0e10cSrcweir         ~DispatchMutexLock_Impl();
56cdf0e10cSrcweir     };
57cdf0e10cSrcweir     friend class DispatchMutexLock_Impl;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir //    ::osl::Mutex                     m_aMutex;#102295# solar mutex has to be used currently
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     // the component which's dispatches we're intercepting
62cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>	m_xIntercepted;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	// chaining
65cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider>			m_xSlaveDispatcher;
66cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider>			m_xMasterDispatcher;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch>                   m_xDispatch;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     SwView* m_pView;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir public:
73cdf0e10cSrcweir 	SwXDispatchProviderInterceptor(SwView& rView);
74cdf0e10cSrcweir 	~SwXDispatchProviderInterceptor();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	//XDispatchProvider
77cdf0e10cSrcweir 	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);
78cdf0e10cSrcweir     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);
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	//XDispatchProviderInterceptor
81cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider(  ) throw(::com::sun::star::uno::RuntimeException);
82cdf0e10cSrcweir     virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider ) throw(::com::sun::star::uno::RuntimeException);
83cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider(  ) throw(::com::sun::star::uno::RuntimeException);
84cdf0e10cSrcweir     virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSupplier ) throw(::com::sun::star::uno::RuntimeException);
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	// XEventListener
87cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     //XUnoTunnel
90cdf0e10cSrcweir 	static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
91cdf0e10cSrcweir 	virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     // view destroyed
94cdf0e10cSrcweir     void    Invalidate();
95cdf0e10cSrcweir };
96cdf0e10cSrcweir //---------------------------------------------------------------------------------------------------------------------
97cdf0e10cSrcweir struct StatusStruct_Impl
98cdf0e10cSrcweir {
99cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener> xListener;
100cdf0e10cSrcweir     ::com::sun::star::util::URL                                                 aURL;
101cdf0e10cSrcweir };
102cdf0e10cSrcweir typedef std::list< StatusStruct_Impl > StatusListenerList;
103cdf0e10cSrcweir class SwXDispatch : public cppu::WeakImplHelper2
104cdf0e10cSrcweir <
105cdf0e10cSrcweir     ::com::sun::star::frame::XDispatch,
106cdf0e10cSrcweir     ::com::sun::star::view::XSelectionChangeListener
107cdf0e10cSrcweir >
108cdf0e10cSrcweir {
109cdf0e10cSrcweir     SwView*             m_pView;
110cdf0e10cSrcweir     StatusListenerList  m_aListenerList;
111cdf0e10cSrcweir     sal_Bool            m_bOldEnable;
112cdf0e10cSrcweir     sal_Bool            m_bListenerAdded;
113cdf0e10cSrcweir public:
114cdf0e10cSrcweir     SwXDispatch(SwView& rView);
115cdf0e10cSrcweir 	~SwXDispatch();
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	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);
118cdf0e10cSrcweir     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);
119cdf0e10cSrcweir     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);
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     //XSelectionChangeListener
122cdf0e10cSrcweir     virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     //XEventListener
125cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     static const sal_Char* GetDBChangeURL();
128cdf0e10cSrcweir };
129cdf0e10cSrcweir 
130cdf0e10cSrcweir #endif
131