Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 : : *
5 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
6 : : *
7 : : * OpenOffice.org - a multi-platform office productivity suite
8 : : *
9 : : * This file is part of OpenOffice.org.
10 : : *
11 : : * OpenOffice.org is free software: you can redistribute it and/or modify
12 : : * it under the terms of the GNU Lesser General Public License version 3
13 : : * only, as published by the Free Software Foundation.
14 : : *
15 : : * OpenOffice.org is distributed in the hope that it will be useful,
16 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 : : * GNU Lesser General Public License version 3 for more details
19 : : * (a copy is included in the LICENSE file that accompanied this code).
20 : : *
21 : : * You should have received a copy of the GNU Lesser General Public License
22 : : * version 3 along with OpenOffice.org. If not, see
23 : : * <http://www.openoffice.org/license.html>
24 : : * for a copy of the LGPLv3 License.
25 : : *
26 : : ************************************************************************/
27 : :
28 : : #ifndef SVX_FORMDISPATCHINTERCEPTOR_HXX
29 : : #define SVX_FORMDISPATCHINTERCEPTOR_HXX
30 : :
31 : : #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
32 : : #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
33 : :
34 : : #include <cppuhelper/compbase2.hxx>
35 : : #include <comphelper/uno3.hxx>
36 : :
37 : : //........................................................................
38 : : namespace svxform
39 : : {
40 : : //........................................................................
41 : :
42 : : //====================================================================
43 : : //= DispatchInterceptor
44 : : //====================================================================
45 : : class DispatchInterceptor
46 : : {
47 : : public:
48 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch> interceptedQueryDispatch(
49 : : const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw( ::com::sun::star::uno::RuntimeException ) = 0;
50 : :
51 : : virtual ::osl::Mutex* getInterceptorMutex() = 0;
52 : :
53 : : protected:
54 : 20 : DispatchInterceptor() {}
55 : :
56 : 17 : ~DispatchInterceptor() {}
57 : : };
58 : :
59 : : //====================================================================
60 : : //=
61 : : //====================================================================
62 : : typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::frame::XDispatchProviderInterceptor
63 : : , ::com::sun::star::lang::XEventListener
64 : : > DispatchInterceptionMultiplexer_BASE;
65 : :
66 : : class DispatchInterceptionMultiplexer : public DispatchInterceptionMultiplexer_BASE
67 : : {
68 : : ::osl::Mutex m_aFallback;
69 : : ::osl::Mutex* m_pMutex;
70 : :
71 : : // the component which's dispatches we're intercepting
72 : : ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProviderInterception >
73 : : m_xIntercepted;
74 : : sal_Bool m_bListening;
75 : :
76 : : // the real interceptor
77 : : DispatchInterceptor* m_pMaster;
78 : :
79 : : // chaining
80 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xSlaveDispatcher;
81 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xMasterDispatcher;
82 : :
83 : : virtual ~DispatchInterceptionMultiplexer();
84 : :
85 : : public:
86 : 20 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception> getIntercepted() const { return m_xIntercepted; }
87 : :
88 : : public:
89 : : DispatchInterceptionMultiplexer(
90 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _rToIntercept,
91 : : DispatchInterceptor* _pMaster
92 : : );
93 : :
94 : : // UNO
95 : 468 : DECLARE_UNO3_DEFAULTS(DispatchInterceptionMultiplexer, DispatchInterceptionMultiplexer_BASE);
96 : :
97 : : // ::com::sun::star::frame::XDispatchProvider
98 : : 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);
99 : : 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);
100 : :
101 : : // ::com::sun::star::frame::XDispatchProviderInterceptor
102 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException);
103 : : virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider ) throw(::com::sun::star::uno::RuntimeException);
104 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException);
105 : : virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSupplier ) throw(::com::sun::star::uno::RuntimeException);
106 : :
107 : : // ::com::sun::star::lang::XEventListener
108 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
109 : :
110 : : // OComponentHelper
111 : : virtual void SAL_CALL disposing();
112 : :
113 : : protected:
114 : : void ImplDetach();
115 : : };
116 : :
117 : : //........................................................................
118 : : } // namespace svxform
119 : : //........................................................................
120 : :
121 : : #endif // SVX_FORMDISPATCHINTERCEPTOR_HXX
122 : :
123 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|