LibreOffice Module sw (master)  1
unodispatch.hxx
Go to the documentation of this file.
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 <com/sun/star/frame/XInterceptorInfo.hpp>
28 #include <cppuhelper/implbase.hxx>
29 #include <vector>
30 #include <vcl/svapp.hxx>
31 
32 class SwView;
33 
34 class SwXDispatchProviderInterceptor : public cppu::WeakImplHelper
35 <
36  css::frame::XDispatchProviderInterceptor,
37  css::lang::XEventListener,
38  css::lang::XUnoTunnel,
39  css::frame::XInterceptorInfo
40 >
41 {
43  {
44  //::osl::MutexGuard aGuard; #102295# solar mutex has to be used currently
46  public:
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  css::uno::Reference< css::frame::XDispatchProviderInterception> m_xIntercepted;
56 
57  // chaining
58  css::uno::Reference< css::frame::XDispatchProvider> m_xSlaveDispatcher;
59  css::uno::Reference< css::frame::XDispatchProvider> m_xMasterDispatcher;
60 
61  css::uno::Reference< css::frame::XDispatch> m_xDispatch;
62 
64 
65 public:
67  virtual ~SwXDispatchProviderInterceptor() override;
68 
69  //XDispatchProvider
70  virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags ) override;
71  virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& aDescripts ) override;
72 
73  //XDispatchProviderInterceptor
74  virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) override;
75  virtual void SAL_CALL setSlaveDispatchProvider( const css::uno::Reference< css::frame::XDispatchProvider >& xNewDispatchProvider ) override;
76  virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) override;
77  virtual void SAL_CALL setMasterDispatchProvider( const css::uno::Reference< css::frame::XDispatchProvider >& xNewSupplier ) override;
78 
79  // XEventListener
80  virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
81 
82  //XUnoTunnel
83  static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
84  virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
85 
86  // XInterceptorInfo
87  virtual css::uno::Sequence<OUString> SAL_CALL getInterceptedURLs() override;
88 
89  // view destroyed
90  void Invalidate();
91 };
92 
94 {
95  css::uno::Reference< css::frame::XStatusListener> xListener;
96  css::util::URL aURL;
97 };
98 class SwXDispatch : public cppu::WeakImplHelper
99 <
100  css::frame::XDispatch,
101  css::view::XSelectionChangeListener
102 >
103 {
105  std::vector< StatusStruct_Impl > m_aStatusListenerVector;
108 public:
109  SwXDispatch(SwView& rView);
110  virtual ~SwXDispatch() override;
111 
112  virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs ) override;
113  virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) override;
114  virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) override;
115 
116  //XSelectionChangeListener
117  virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override;
118 
119  //XEventListener
120  virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
121 
122  static const char* GetDBChangeURL();
123 };
124 
125 #endif
126 
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwXDispatch(SwView &rView)
virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider() override
css::uno::Reference< css::frame::XDispatch > m_xDispatch
Definition: unodispatch.hxx:61
virtual ~SwXDispatchProviderInterceptor() override
Definition: unodispatch.cxx:60
css::uno::Reference< css::frame::XDispatchProviderInterception > m_xIntercepted
Definition: unodispatch.hxx:55
virtual void SAL_CALL setSlaveDispatchProvider(const css::uno::Reference< css::frame::XDispatchProvider > &xNewDispatchProvider) override
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
css::uno::Reference< css::frame::XStatusListener > xListener
Definition: unodispatch.hxx:95
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor > &aDescripts) override
std::vector< StatusStruct_Impl > m_aStatusListenerVector
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
css::uno::Reference< css::frame::XDispatchProvider > m_xMasterDispatcher
Definition: unodispatch.hxx:59
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
css::util::URL aURL
Definition: unodispatch.hxx:96
static const char * GetDBChangeURL()
virtual css::uno::Sequence< OUString > SAL_CALL getInterceptedURLs() override
Definition: unodispatch.cxx:90
bool m_bListenerAdded
virtual ~SwXDispatch() override
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL &aURL, const OUString &aTargetFrameName, sal_Int32 nSearchFlags) override
Definition: unodispatch.cxx:64
virtual void SAL_CALL dispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &aArgs) override
virtual void SAL_CALL setMasterDispatchProvider(const css::uno::Reference< css::frame::XDispatchProvider > &xNewSupplier) override
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xControl, const css::util::URL &aURL) override
SwXDispatchProviderInterceptor(SwView &rView)
Definition: unodispatch.cxx:42
css::uno::Reference< css::frame::XDispatchProvider > m_xSlaveDispatcher
Definition: unodispatch.hxx:58
virtual void SAL_CALL selectionChanged(const css::lang::EventObject &aEvent) override
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
SwView * m_pView
virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xControl, const css::util::URL &aURL) override
virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider() override
Definition: view.hxx:146