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