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