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 SVX_FORMDISPATCHINTERCEPTOR_HXX
21 #define SVX_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>
29 //........................................................................
32 //........................................................................
34 //====================================================================
35 //= DispatchInterceptor
36 //====================================================================
37 class DispatchInterceptor
40 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> interceptedQueryDispatch(
41 const ::com::sun::star::util::URL
& aURL
, const OUString
& aTargetFrameName
, sal_Int32 nSearchFlags
) throw( ::com::sun::star::uno::RuntimeException
) = 0;
43 virtual ::osl::Mutex
* getInterceptorMutex() = 0;
46 DispatchInterceptor() {}
48 ~DispatchInterceptor() {}
51 //====================================================================
53 //====================================================================
54 typedef ::cppu::WeakComponentImplHelper2
< ::com::sun::star::frame::XDispatchProviderInterceptor
55 , ::com::sun::star::lang::XEventListener
56 > DispatchInterceptionMultiplexer_BASE
;
58 class DispatchInterceptionMultiplexer
: public DispatchInterceptionMultiplexer_BASE
60 ::osl::Mutex m_aFallback
;
61 ::osl::Mutex
* m_pMutex
;
63 // the component which's dispatches we're intercepting
64 ::com::sun::star::uno::WeakReference
< ::com::sun::star::frame::XDispatchProviderInterception
>
66 sal_Bool m_bListening
;
68 // the real interceptor
69 DispatchInterceptor
* m_pMaster
;
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 virtual ~DispatchInterceptionMultiplexer();
78 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProviderInterception
> getIntercepted() const { return m_xIntercepted
; }
81 DispatchInterceptionMultiplexer(
82 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProviderInterception
>& _rToIntercept
,
83 DispatchInterceptor
* _pMaster
87 DECLARE_UNO3_DEFAULTS(DispatchInterceptionMultiplexer
, DispatchInterceptionMultiplexer_BASE
);
89 // ::com::sun::star::frame::XDispatchProvider
90 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
);
91 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
);
93 // ::com::sun::star::frame::XDispatchProviderInterceptor
94 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> SAL_CALL
getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException
);
95 virtual void SAL_CALL
setSlaveDispatchProvider( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
>& xNewDispatchProvider
) throw(::com::sun::star::uno::RuntimeException
);
96 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> SAL_CALL
getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException
);
97 virtual void SAL_CALL
setMasterDispatchProvider( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
>& xNewSupplier
) throw(::com::sun::star::uno::RuntimeException
);
99 // ::com::sun::star::lang::XEventListener
100 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
);
103 virtual void SAL_CALL
disposing();
109 //........................................................................
110 } // namespace svxform
111 //........................................................................
113 #endif // SVX_FORMDISPATCHINTERCEPTOR_HXX
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */