1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_INC_DISPUNO_HXX
21 #define INCLUDED_SC_INC_DISPUNO_HXX
23 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
24 #include <com/sun/star/view/XSelectionChangeListener.hpp>
25 #include <cppuhelper/implbase2.hxx>
26 #include <svl/lstner.hxx>
28 #include <boost/ptr_container/ptr_vector.hpp>
30 namespace com
{ namespace sun
{ namespace star
{ namespace frame
{
31 class XDispatchProviderInterception
;
36 typedef ::com::sun::star::uno::Reference
<
37 ::com::sun::star::frame::XStatusListener
> XStatusListenerRef
;
38 typedef boost::ptr_vector
<XStatusListenerRef
> XStatusListenerArr_Impl
;
40 class ScDispatchProviderInterceptor
: public cppu::WeakImplHelper2
<
41 com::sun::star::frame::XDispatchProviderInterceptor
,
42 com::sun::star::lang::XEventListener
>,
45 ScTabViewShell
* pViewShell
;
47 /// the component which's dispatches we're intercepting
48 ::com::sun::star::uno::Reference
<
49 ::com::sun::star::frame::XDispatchProviderInterception
> m_xIntercepted
;
52 ::com::sun::star::uno::Reference
<
53 ::com::sun::star::frame::XDispatchProvider
> m_xSlaveDispatcher
;
54 ::com::sun::star::uno::Reference
<
55 ::com::sun::star::frame::XDispatchProvider
> m_xMasterDispatcher
;
58 ::com::sun::star::uno::Reference
<
59 ::com::sun::star::frame::XDispatch
> m_xMyDispatch
;
63 ScDispatchProviderInterceptor(ScTabViewShell
* pViewSh
);
64 virtual ~ScDispatchProviderInterceptor();
66 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
69 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> SAL_CALL
70 queryDispatch( const ::com::sun::star::util::URL
& aURL
,
71 const OUString
& aTargetFrameName
,
72 sal_Int32 nSearchFlags
)
73 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
74 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
<
75 ::com::sun::star::frame::XDispatch
> > SAL_CALL
76 queryDispatches( const ::com::sun::star::uno::Sequence
<
77 ::com::sun::star::frame::DispatchDescriptor
>& aDescripts
)
78 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
80 /// XDispatchProviderInterceptor
81 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> SAL_CALL
82 getSlaveDispatchProvider() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
83 virtual void SAL_CALL
setSlaveDispatchProvider( const ::com::sun::star::uno::Reference
<
84 ::com::sun::star::frame::XDispatchProvider
>& xNewDispatchProvider
)
85 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> SAL_CALL
87 getMasterDispatchProvider() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
88 virtual void SAL_CALL
setMasterDispatchProvider( const ::com::sun::star::uno::Reference
<
89 ::com::sun::star::frame::XDispatchProvider
>& xNewSupplier
)
90 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
)
94 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
97 class ScDispatch
: public cppu::WeakImplHelper2
<
98 com::sun::star::frame::XDispatch
,
99 com::sun::star::view::XSelectionChangeListener
>,
102 ScTabViewShell
* pViewShell
;
103 XStatusListenerArr_Impl aDataSourceListeners
;
104 ScImportParam aLastImport
;
105 bool bListeningToView
;
109 ScDispatch(ScTabViewShell
* pViewSh
);
110 virtual ~ScDispatch();
112 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
115 virtual void SAL_CALL
dispatch( const ::com::sun::star::util::URL
& aURL
,
116 const ::com::sun::star::uno::Sequence
<
117 ::com::sun::star::beans::PropertyValue
>& aArgs
)
118 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
119 virtual void SAL_CALL
addStatusListener( const ::com::sun::star::uno::Reference
<
120 ::com::sun::star::frame::XStatusListener
>& xControl
,
121 const ::com::sun::star::util::URL
& aURL
)
122 throw(::com::sun::star::uno::RuntimeException
,
123 std::exception
) SAL_OVERRIDE
;
124 virtual void SAL_CALL
removeStatusListener( const ::com::sun::star::uno::Reference
<
125 ::com::sun::star::frame::XStatusListener
>& xControl
,
126 const ::com::sun::star::util::URL
& aURL
)
127 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 /// XSelectionChangeListener
130 virtual void SAL_CALL
selectionChanged( const ::com::sun::star::lang::EventObject
& aEvent
)
131 throw (::com::sun::star::uno::RuntimeException
,
132 std::exception
) SAL_OVERRIDE
;
135 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
)
136 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */