xref: /trunk/main/sc/inc/dispuno.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_DISPUNO_HXX
25 #define SC_DISPUNO_HXX
26 
27 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
28 #include <com/sun/star/view/XSelectionChangeListener.hpp>
29 #include <cppuhelper/implbase2.hxx>
30 #include <svl/lstner.hxx>
31 #include <svl/svarray.hxx>
32 #include "global.hxx"       // ScImportParam
33 
34 
35 namespace com { namespace sun { namespace star { namespace frame {
36     class XDispatchProviderInterception;
37 } } } }
38 
39 class ScTabViewShell;
40 
41 
42 typedef ::com::sun::star::uno::Reference<
43             ::com::sun::star::frame::XStatusListener >* XStatusListenerPtr;
44 SV_DECL_PTRARR_DEL( XStatusListenerArr_Impl, XStatusListenerPtr, 4, 4 )
45 
46 
47 class ScDispatchProviderInterceptor : public cppu::WeakImplHelper2<
48                                         com::sun::star::frame::XDispatchProviderInterceptor,
49                                         com::sun::star::lang::XEventListener>,
50                                     public SfxListener
51 {
52     ScTabViewShell*     pViewShell;
53 
54     // the component which's dispatches we're intercepting
55     ::com::sun::star::uno::Reference<
56         ::com::sun::star::frame::XDispatchProviderInterception> m_xIntercepted;
57 
58     // chaining
59     ::com::sun::star::uno::Reference<
60         ::com::sun::star::frame::XDispatchProvider> m_xSlaveDispatcher;
61     ::com::sun::star::uno::Reference<
62         ::com::sun::star::frame::XDispatchProvider> m_xMasterDispatcher;
63 
64     // own dispatch
65     ::com::sun::star::uno::Reference<
66         ::com::sun::star::frame::XDispatch> m_xMyDispatch;
67 
68 public:
69 
70                             ScDispatchProviderInterceptor(ScTabViewShell* pViewSh);
71     virtual                 ~ScDispatchProviderInterceptor();
72 
73     virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
74 
75                             // XDispatchProvider
76     virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL
77                             queryDispatch( const ::com::sun::star::util::URL& aURL,
78                                         const ::rtl::OUString& aTargetFrameName,
79                                         sal_Int32 nSearchFlags );
80     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
81                                         ::com::sun::star::frame::XDispatch > > SAL_CALL
82                             queryDispatches( const ::com::sun::star::uno::Sequence<
83                                         ::com::sun::star::frame::DispatchDescriptor >& aDescripts );
84 
85                             // XDispatchProviderInterceptor
86     virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL
87                             getSlaveDispatchProvider();
88     virtual void SAL_CALL   setSlaveDispatchProvider( const ::com::sun::star::uno::Reference<
89                                 ::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider );
90     virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL
91                             getMasterDispatchProvider();
92     virtual void SAL_CALL   setMasterDispatchProvider( const ::com::sun::star::uno::Reference<
93                                 ::com::sun::star::frame::XDispatchProvider >& xNewSupplier );
94 
95                             // XEventListener
96     virtual void SAL_CALL   disposing( const ::com::sun::star::lang::EventObject& Source );
97 };
98 
99 
100 class ScDispatch : public cppu::WeakImplHelper2<
101                                     com::sun::star::frame::XDispatch,
102                                     com::sun::star::view::XSelectionChangeListener >,
103                                 public SfxListener
104 {
105     ScTabViewShell*         pViewShell;
106     XStatusListenerArr_Impl aDataSourceListeners;
107     ScImportParam           aLastImport;
108     sal_Bool                bListeningToView;
109 
110 public:
111 
112                             ScDispatch(ScTabViewShell* pViewSh);
113     virtual                 ~ScDispatch();
114 
115     virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
116 
117                             // XDispatch
118     virtual void SAL_CALL   dispatch( const ::com::sun::star::util::URL& aURL,
119                                 const ::com::sun::star::uno::Sequence<
120                                     ::com::sun::star::beans::PropertyValue >& aArgs );
121     virtual void SAL_CALL   addStatusListener( const ::com::sun::star::uno::Reference<
122                                     ::com::sun::star::frame::XStatusListener >& xControl,
123                                 const ::com::sun::star::util::URL& aURL );
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 
128                             // XSelectionChangeListener
129     virtual void SAL_CALL   selectionChanged( const ::com::sun::star::lang::EventObject& aEvent );
130 
131                             // XEventListener
132     virtual void SAL_CALL   disposing( const ::com::sun::star::lang::EventObject& Source );
133 };
134 
135 
136 #endif
137