1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unodispatch.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _UNODISPATCH_HXX
31 #define _UNODISPATCH_HXX
33 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
34 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
35 #include <com/sun/star/view/XSelectionChangeListener.hpp>
36 #include <com/sun/star/lang/XUnoTunnel.hpp>
37 #include <com/sun/star/frame/XDispatch.hpp>
38 #include <cppuhelper/implbase2.hxx>
39 #include <cppuhelper/implbase3.hxx>
41 //#ifndef _OSL_MUTEX_HXX_
42 //#include <osl/mutex.hxx>
44 #include <vos/mutex.hxx>
47 //---------------------------------------------------------------------------------------------------------------------
48 class SwXDispatchProviderInterceptor
: public cppu::WeakImplHelper3
50 ::com::sun::star::frame::XDispatchProviderInterceptor
,
51 ::com::sun::star::lang::XEventListener
,
52 ::com::sun::star::lang::XUnoTunnel
55 class DispatchMutexLock_Impl
57 //::osl::MutexGuard aGuard; #102295# solar mutex has to be used currently
59 DispatchMutexLock_Impl();
61 DispatchMutexLock_Impl(SwXDispatchProviderInterceptor
&);
62 ~DispatchMutexLock_Impl();
64 friend class DispatchMutexLock_Impl
;
66 // ::osl::Mutex m_aMutex;#102295# solar mutex has to be used currently
68 // the component which's dispatches we're intercepting
69 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProviderInterception
> m_xIntercepted
;
72 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> m_xSlaveDispatcher
;
73 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> m_xMasterDispatcher
;
75 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> m_xDispatch
;
80 SwXDispatchProviderInterceptor(SwView
& rView
);
81 ~SwXDispatchProviderInterceptor();
84 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
);
85 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
);
87 //XDispatchProviderInterceptor
88 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> SAL_CALL
getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException
);
89 virtual void SAL_CALL
setSlaveDispatchProvider( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
>& xNewDispatchProvider
) throw(::com::sun::star::uno::RuntimeException
);
90 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> SAL_CALL
getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException
);
91 virtual void SAL_CALL
setMasterDispatchProvider( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
>& xNewSupplier
) throw(::com::sun::star::uno::RuntimeException
);
94 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
);
97 static const ::com::sun::star::uno::Sequence
< sal_Int8
> & getUnoTunnelId();
98 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
103 //---------------------------------------------------------------------------------------------------------------------
104 struct StatusStruct_Impl
106 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XStatusListener
> xListener
;
107 ::com::sun::star::util::URL aURL
;
109 typedef std::list
< StatusStruct_Impl
> StatusListenerList
;
110 class SwXDispatch
: public cppu::WeakImplHelper2
112 ::com::sun::star::frame::XDispatch
,
113 ::com::sun::star::view::XSelectionChangeListener
117 StatusListenerList m_aListenerList
;
118 sal_Bool m_bOldEnable
;
119 sal_Bool m_bListenerAdded
;
121 SwXDispatch(SwView
& rView
);
124 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
);
125 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
);
126 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
);
128 //XSelectionChangeListener
129 virtual void SAL_CALL
selectionChanged( const ::com::sun::star::lang::EventObject
& aEvent
) throw(::com::sun::star::uno::RuntimeException
);
132 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
);
134 static const sal_Char
* GetDBChangeURL();