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/compbase.hxx>
32 class DispatchInterceptor
35 /// @throws css::uno::RuntimeException
36 virtual css::uno::Reference
< css::frame::XDispatch
> interceptedQueryDispatch(
37 const css::util::URL
& aURL
, const OUString
& aTargetFrameName
, sal_Int32 nSearchFlags
) = 0;
39 virtual ::osl::Mutex
* getInterceptorMutex() = 0;
42 DispatchInterceptor() {}
44 ~DispatchInterceptor() {}
50 typedef ::cppu::WeakComponentImplHelper
< css::frame::XDispatchProviderInterceptor
51 , css::lang::XEventListener
52 > DispatchInterceptionMultiplexer_BASE
;
54 class DispatchInterceptionMultiplexer final
: public DispatchInterceptionMultiplexer_BASE
57 css::uno::Reference
< css::frame::XDispatchProviderInterception
> getIntercepted() const { return m_xIntercepted
; }
59 DispatchInterceptionMultiplexer(
60 const css::uno::Reference
< css::frame::XDispatchProviderInterception
>& _rToIntercept
,
61 DispatchInterceptor
* _pMaster
64 // css::frame::XDispatchProvider
65 virtual css::uno::Reference
< css::frame::XDispatch
> SAL_CALL
queryDispatch( const css::util::URL
& aURL
, const OUString
& aTargetFrameName
, sal_Int32 nSearchFlags
) override
;
66 virtual css::uno::Sequence
< css::uno::Reference
< css::frame::XDispatch
> > SAL_CALL
queryDispatches( const css::uno::Sequence
< css::frame::DispatchDescriptor
>& aDescripts
) override
;
68 // css::frame::XDispatchProviderInterceptor
69 virtual css::uno::Reference
< css::frame::XDispatchProvider
> SAL_CALL
getSlaveDispatchProvider( ) override
;
70 virtual void SAL_CALL
setSlaveDispatchProvider( const css::uno::Reference
< css::frame::XDispatchProvider
>& xNewDispatchProvider
) override
;
71 virtual css::uno::Reference
< css::frame::XDispatchProvider
> SAL_CALL
getMasterDispatchProvider( ) override
;
72 virtual void SAL_CALL
setMasterDispatchProvider( const css::uno::Reference
< css::frame::XDispatchProvider
>& xNewSupplier
) override
;
74 // css::lang::XEventListener
75 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
78 virtual void SAL_CALL
disposing() override
;
81 virtual ~DispatchInterceptionMultiplexer() override
;
85 ::osl::Mutex m_aFallback
;
86 ::osl::Mutex
* m_pMutex
;
88 // the component which's dispatches we're intercepting
89 css::uno::WeakReference
< css::frame::XDispatchProviderInterception
>
93 // the real interceptor
94 DispatchInterceptor
* m_pMaster
;
97 css::uno::Reference
< css::frame::XDispatchProvider
> m_xSlaveDispatcher
;
98 css::uno::Reference
< css::frame::XDispatchProvider
> m_xMasterDispatcher
;
105 #endif // INCLUDED_SVX_SOURCE_INC_FORMDISPATCHINTERCEPTOR_HXX
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */