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 SVX_FORMDISPATCHINTERCEPTOR_HXX
21 : #define SVX_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 :
34 : //====================================================================
35 : //= DispatchInterceptor
36 : //====================================================================
37 : class DispatchInterceptor
38 : {
39 : public:
40 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch> interceptedQueryDispatch(
41 : const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw( ::com::sun::star::uno::RuntimeException ) = 0;
42 :
43 : virtual ::osl::Mutex* getInterceptorMutex() = 0;
44 :
45 : protected:
46 0 : DispatchInterceptor() {}
47 :
48 0 : ~DispatchInterceptor() {}
49 : };
50 :
51 : //====================================================================
52 : //=
53 : //====================================================================
54 : typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::frame::XDispatchProviderInterceptor
55 : , ::com::sun::star::lang::XEventListener
56 : > DispatchInterceptionMultiplexer_BASE;
57 :
58 : class DispatchInterceptionMultiplexer : public DispatchInterceptionMultiplexer_BASE
59 : {
60 : ::osl::Mutex m_aFallback;
61 : ::osl::Mutex* m_pMutex;
62 :
63 : // the component which's dispatches we're intercepting
64 : ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProviderInterception >
65 : m_xIntercepted;
66 : sal_Bool m_bListening;
67 :
68 : // the real interceptor
69 : DispatchInterceptor* m_pMaster;
70 :
71 : // chaining
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;
74 :
75 : virtual ~DispatchInterceptionMultiplexer();
76 :
77 : public:
78 0 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception> getIntercepted() const { return m_xIntercepted; }
79 :
80 : public:
81 : DispatchInterceptionMultiplexer(
82 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _rToIntercept,
83 : DispatchInterceptor* _pMaster
84 : );
85 :
86 : // UNO
87 0 : DECLARE_UNO3_DEFAULTS(DispatchInterceptionMultiplexer, DispatchInterceptionMultiplexer_BASE);
88 :
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 ::rtl::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);
92 :
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);
98 :
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);
101 :
102 : // OComponentHelper
103 : virtual void SAL_CALL disposing();
104 :
105 : protected:
106 : void ImplDetach();
107 : };
108 :
109 : //........................................................................
110 : } // namespace svxform
111 : //........................................................................
112 :
113 : #endif // SVX_FORMDISPATCHINTERCEPTOR_HXX
114 :
115 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|