xref: /aoo41x/main/sw/source/ui/inc/unodispatch.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _UNODISPATCH_HXX
28 #define _UNODISPATCH_HXX
29 
30 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
31 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
32 #include <com/sun/star/view/XSelectionChangeListener.hpp>
33 #include <com/sun/star/lang/XUnoTunnel.hpp>
34 #include <com/sun/star/frame/XDispatch.hpp>
35 #include <cppuhelper/implbase2.hxx>
36 #include <cppuhelper/implbase3.hxx>
37 #include <list>
38 //#ifndef _OSL_MUTEX_HXX_
39 //#include <osl/mutex.hxx>
40 //#endif
41 #include <vos/mutex.hxx>
42 
43 class SwView;
44 //---------------------------------------------------------------------------------------------------------------------
45 class SwXDispatchProviderInterceptor : public cppu::WeakImplHelper3
46 <
47 	::com::sun::star::frame::XDispatchProviderInterceptor,
48     ::com::sun::star::lang::XEventListener,
49     ::com::sun::star::lang::XUnoTunnel
50 >
51 {
52     class DispatchMutexLock_Impl
53     {
54         //::osl::MutexGuard   aGuard; #102295# solar mutex has to be used currently
55         vos::OGuard         aGuard;
56         DispatchMutexLock_Impl();
57     public:
58         DispatchMutexLock_Impl(SwXDispatchProviderInterceptor&);
59         ~DispatchMutexLock_Impl();
60     };
61     friend class DispatchMutexLock_Impl;
62 
63 //    ::osl::Mutex                     m_aMutex;#102295# solar mutex has to be used currently
64 
65     // the component which's dispatches we're intercepting
66 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>	m_xIntercepted;
67 
68 	// chaining
69 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider>			m_xSlaveDispatcher;
70 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider>			m_xMasterDispatcher;
71 
72     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch>                   m_xDispatch;
73 
74     SwView* m_pView;
75 
76 public:
77 	SwXDispatchProviderInterceptor(SwView& rView);
78 	~SwXDispatchProviderInterceptor();
79 
80 	//XDispatchProvider
81 	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);
82     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);
83 
84 	//XDispatchProviderInterceptor
85 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider(  ) throw(::com::sun::star::uno::RuntimeException);
86     virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider ) throw(::com::sun::star::uno::RuntimeException);
87     virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider(  ) throw(::com::sun::star::uno::RuntimeException);
88     virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSupplier ) throw(::com::sun::star::uno::RuntimeException);
89 
90 	// XEventListener
91     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
92 
93     //XUnoTunnel
94 	static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
95 	virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
96 
97     // view destroyed
98     void    Invalidate();
99 };
100 //---------------------------------------------------------------------------------------------------------------------
101 struct StatusStruct_Impl
102 {
103     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener> xListener;
104     ::com::sun::star::util::URL                                                 aURL;
105 };
106 typedef std::list< StatusStruct_Impl > StatusListenerList;
107 class SwXDispatch : public cppu::WeakImplHelper2
108 <
109     ::com::sun::star::frame::XDispatch,
110     ::com::sun::star::view::XSelectionChangeListener
111 >
112 {
113     SwView*             m_pView;
114     StatusListenerList  m_aListenerList;
115     sal_Bool            m_bOldEnable;
116     sal_Bool            m_bListenerAdded;
117 public:
118     SwXDispatch(SwView& rView);
119 	~SwXDispatch();
120 
121 	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);
122     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);
123     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);
124 
125     //XSelectionChangeListener
126     virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
127 
128     //XEventListener
129     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
130 
131     static const sal_Char* GetDBChangeURL();
132 };
133 
134 #endif
135