1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _UNODISPATCH_HXX
20 #define _UNODISPATCH_HXX
22 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
23 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
24 #include <com/sun/star/view/XSelectionChangeListener.hpp>
25 #include <com/sun/star/lang/XUnoTunnel.hpp>
26 #include <com/sun/star/frame/XDispatch.hpp>
27 #include <cppuhelper/implbase2.hxx>
28 #include <cppuhelper/implbase3.hxx>
30 #include <comphelper/solarmutex.hxx>
31 #include <osl/mutex.hxx>
35 class SwXDispatchProviderInterceptor
: public cppu::WeakImplHelper3
37 ::com::sun::star::frame::XDispatchProviderInterceptor
,
38 ::com::sun::star::lang::XEventListener
,
39 ::com::sun::star::lang::XUnoTunnel
42 class DispatchMutexLock_Impl
44 //::osl::MutexGuard aGuard; #102295# solar mutex has to be used currently
45 osl::Guard
< comphelper::SolarMutex
> aGuard
;
46 DispatchMutexLock_Impl();
48 DispatchMutexLock_Impl(SwXDispatchProviderInterceptor
&);
49 ~DispatchMutexLock_Impl();
51 friend class DispatchMutexLock_Impl
;
53 // ::osl::Mutex m_aMutex;#102295# solar mutex has to be used currently
55 // the component which's dispatches we're intercepting
56 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProviderInterception
> m_xIntercepted
;
59 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> m_xSlaveDispatcher
;
60 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> m_xMasterDispatcher
;
62 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> m_xDispatch
;
67 SwXDispatchProviderInterceptor(SwView
& rView
);
68 ~SwXDispatchProviderInterceptor();
71 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> SAL_CALL
queryDispatch( const ::com::sun::star::util::URL
& aURL
, const OUString
& aTargetFrameName
, sal_Int32 nSearchFlags
) throw(::com::sun::star::uno::RuntimeException
);
72 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
);
74 //XDispatchProviderInterceptor
75 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> SAL_CALL
getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException
);
76 virtual void SAL_CALL
setSlaveDispatchProvider( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
>& xNewDispatchProvider
) throw(::com::sun::star::uno::RuntimeException
);
77 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> SAL_CALL
getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException
);
78 virtual void SAL_CALL
setMasterDispatchProvider( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
>& xNewSupplier
) throw(::com::sun::star::uno::RuntimeException
);
81 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
);
84 static const ::com::sun::star::uno::Sequence
< sal_Int8
> & getUnoTunnelId();
85 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
90 //---------------------------------------------------------------------------------------------------------------------
91 struct StatusStruct_Impl
93 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XStatusListener
> xListener
;
94 ::com::sun::star::util::URL aURL
;
96 typedef std::list
< StatusStruct_Impl
> StatusListenerList
;
97 class SwXDispatch
: public cppu::WeakImplHelper2
99 ::com::sun::star::frame::XDispatch
,
100 ::com::sun::star::view::XSelectionChangeListener
104 StatusListenerList m_aListenerList
;
105 sal_Bool m_bOldEnable
;
106 sal_Bool m_bListenerAdded
;
108 SwXDispatch(SwView
& rView
);
111 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
);
112 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
);
113 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
);
115 //XSelectionChangeListener
116 virtual void SAL_CALL
selectionChanged( const ::com::sun::star::lang::EventObject
& aEvent
) throw(::com::sun::star::uno::RuntimeException
);
119 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
);
121 static const sal_Char
* GetDBChangeURL();
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */