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 .
20 #ifndef INCLUDED_SVX_SOURCE_INC_FORMDISPATCHINTERCEPTOR_HXX
21 #define INCLUDED_SVX_SOURCE_INC_FORMDISPATCHINTERCEPTOR_HXX
23 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
24 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
26 #include <cppuhelper/compbase2.hxx>
27 #include <comphelper/uno3.hxx>
33 class DispatchInterceptor
36 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> interceptedQueryDispatch(
37 const ::com::sun::star::util::URL
& aURL
, const OUString
& aTargetFrameName
, sal_Int32 nSearchFlags
) throw( ::com::sun::star::uno::RuntimeException
) = 0;
39 virtual ::osl::Mutex
* getInterceptorMutex() = 0;
42 DispatchInterceptor() {}
44 ~DispatchInterceptor() {}
50 typedef ::cppu::WeakComponentImplHelper2
< ::com::sun::star::frame::XDispatchProviderInterceptor
51 , ::com::sun::star::lang::XEventListener
52 > DispatchInterceptionMultiplexer_BASE
;
54 class DispatchInterceptionMultiplexer
: public DispatchInterceptionMultiplexer_BASE
56 ::osl::Mutex m_aFallback
;
57 ::osl::Mutex
* m_pMutex
;
59 // the component which's dispatches we're intercepting
60 ::com::sun::star::uno::WeakReference
< ::com::sun::star::frame::XDispatchProviderInterception
>
64 // the real interceptor
65 DispatchInterceptor
* m_pMaster
;
68 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> m_xSlaveDispatcher
;
69 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> m_xMasterDispatcher
;
71 virtual ~DispatchInterceptionMultiplexer();
74 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProviderInterception
> getIntercepted() const { return m_xIntercepted
; }
77 DispatchInterceptionMultiplexer(
78 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProviderInterception
>& _rToIntercept
,
79 DispatchInterceptor
* _pMaster
83 DECLARE_UNO3_DEFAULTS(DispatchInterceptionMultiplexer
, DispatchInterceptionMultiplexer_BASE
)
85 // ::com::sun::star::frame::XDispatchProvider
86 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
, std::exception
) SAL_OVERRIDE
;
87 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
, std::exception
) SAL_OVERRIDE
;
89 // ::com::sun::star::frame::XDispatchProviderInterceptor
90 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> SAL_CALL
getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
91 virtual void SAL_CALL
setSlaveDispatchProvider( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
>& xNewDispatchProvider
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
92 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> SAL_CALL
getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 virtual void SAL_CALL
setMasterDispatchProvider( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
>& xNewSupplier
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
95 // ::com::sun::star::lang::XEventListener
96 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
109 #endif // INCLUDED_SVX_SOURCE_INC_FORMDISPATCHINTERCEPTOR_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */