Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SVX_SOURCE_INC_FORMDISPATCHINTERCEPTOR_HXX
21 : #define INCLUDED_SVX_SOURCE_INC_FORMDISPATCHINTERCEPTOR_HXX
22 :
23 : #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
24 : #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
25 :
26 : #include <cppuhelper/compbase2.hxx>
27 : #include <comphelper/uno3.hxx>
28 :
29 :
30 : namespace svxform
31 : {
32 :
33 : class DispatchInterceptor
34 : {
35 : public:
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;
38 :
39 : virtual ::osl::Mutex* getInterceptorMutex() = 0;
40 :
41 : protected:
42 95 : DispatchInterceptor() {}
43 :
44 95 : ~DispatchInterceptor() {}
45 : };
46 :
47 :
48 : //=
49 :
50 : typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::frame::XDispatchProviderInterceptor
51 : , ::com::sun::star::lang::XEventListener
52 : > DispatchInterceptionMultiplexer_BASE;
53 :
54 : class DispatchInterceptionMultiplexer : public DispatchInterceptionMultiplexer_BASE
55 : {
56 : ::osl::Mutex m_aFallback;
57 : ::osl::Mutex* m_pMutex;
58 :
59 : // the component which's dispatches we're intercepting
60 : ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProviderInterception >
61 : m_xIntercepted;
62 : bool m_bListening;
63 :
64 : // the real interceptor
65 : DispatchInterceptor* m_pMaster;
66 :
67 : // chaining
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;
70 :
71 : virtual ~DispatchInterceptionMultiplexer();
72 :
73 : public:
74 32 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception> getIntercepted() const { return m_xIntercepted; }
75 :
76 : public:
77 : DispatchInterceptionMultiplexer(
78 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _rToIntercept,
79 : DispatchInterceptor* _pMaster
80 : );
81 :
82 : // UNO
83 806 : DECLARE_UNO3_DEFAULTS(DispatchInterceptionMultiplexer, DispatchInterceptionMultiplexer_BASE)
84 :
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;
88 :
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;
94 :
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;
97 :
98 : // OComponentHelper
99 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
100 :
101 : protected:
102 : void ImplDetach();
103 : };
104 :
105 :
106 : }
107 :
108 :
109 : #endif // INCLUDED_SVX_SOURCE_INC_FORMDISPATCHINTERCEPTOR_HXX
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|