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 : #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_UNODISPATCH_HXX
20 : #define INCLUDED_SW_SOURCE_UIBASE_INC_UNODISPATCH_HXX
21 :
22 : #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
23 : #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
24 : #include <com/sun/star/view/XSelectionChangeListener.hpp>
25 : #include <com/sun/star/lang/XUnoTunnel.hpp>
26 : #include <com/sun/star/frame/XDispatch.hpp>
27 : #include <cppuhelper/implbase2.hxx>
28 : #include <cppuhelper/implbase3.hxx>
29 : #include <list>
30 : #include <vcl/svapp.hxx>
31 : #include <osl/mutex.hxx>
32 :
33 : class SwView;
34 :
35 : class SwXDispatchProviderInterceptor : public cppu::WeakImplHelper3
36 : <
37 : ::com::sun::star::frame::XDispatchProviderInterceptor,
38 : ::com::sun::star::lang::XEventListener,
39 : ::com::sun::star::lang::XUnoTunnel
40 : >
41 : {
42 : class DispatchMutexLock_Impl
43 : {
44 : //::osl::MutexGuard aGuard; #102295# solar mutex has to be used currently
45 : SolarMutexGuard aGuard;
46 : DispatchMutexLock_Impl();
47 : public:
48 : DispatchMutexLock_Impl(SwXDispatchProviderInterceptor&);
49 : ~DispatchMutexLock_Impl();
50 : };
51 : friend class DispatchMutexLock_Impl;
52 :
53 : // ::osl::Mutex m_aMutex;#102295# solar mutex has to be used currently
54 :
55 : // the component which's dispatches we're intercepting
56 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception> m_xIntercepted;
57 :
58 : // chaining
59 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xSlaveDispatcher;
60 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xMasterDispatcher;
61 :
62 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch> m_xDispatch;
63 :
64 : SwView* m_pView;
65 :
66 : public:
67 : SwXDispatchProviderInterceptor(SwView& rView);
68 : virtual ~SwXDispatchProviderInterceptor();
69 :
70 : //XDispatchProvider
71 : 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;
72 : 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;
73 :
74 : //XDispatchProviderInterceptor
75 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
76 : 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;
77 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
78 : 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;
79 :
80 : // XEventListener
81 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 :
83 : //XUnoTunnel
84 : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
85 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 :
87 : // view destroyed
88 : void Invalidate();
89 : };
90 :
91 48 : struct StatusStruct_Impl
92 : {
93 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener> xListener;
94 : ::com::sun::star::util::URL aURL;
95 : };
96 : typedef std::list< StatusStruct_Impl > StatusListenerList;
97 : class SwXDispatch : public cppu::WeakImplHelper2
98 : <
99 : ::com::sun::star::frame::XDispatch,
100 : ::com::sun::star::view::XSelectionChangeListener
101 : >
102 : {
103 : SwView* m_pView;
104 : StatusListenerList m_aListenerList;
105 : bool m_bOldEnable;
106 : bool m_bListenerAdded;
107 : public:
108 : SwXDispatch(SwView& rView);
109 : virtual ~SwXDispatch();
110 :
111 : virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs )
112 : throw (::com::sun::star::uno::RuntimeException,
113 : std::exception) SAL_OVERRIDE;
114 : virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 : virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 :
117 : //XSelectionChangeListener
118 : virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
119 :
120 : //XEventListener
121 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 :
123 : static const sal_Char* GetDBChangeURL();
124 : };
125 :
126 : #endif
127 :
128 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|