xref: /aoo4110/main/sc/inc/dispuno.hxx (revision b1cdbd2c)
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 									throw(::com::sun::star::uno::RuntimeException);
81 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
82 										::com::sun::star::frame::XDispatch > > SAL_CALL
83 							queryDispatches( const ::com::sun::star::uno::Sequence<
84 										::com::sun::star::frame::DispatchDescriptor >& aDescripts )
85 									throw(::com::sun::star::uno::RuntimeException);
86 
87 							// XDispatchProviderInterceptor
88 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL
89 							getSlaveDispatchProvider() throw(::com::sun::star::uno::RuntimeException);
90 	virtual void SAL_CALL	setSlaveDispatchProvider( const ::com::sun::star::uno::Reference<
91 								::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider )
92 								throw(::com::sun::star::uno::RuntimeException);
93 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL
94 							getMasterDispatchProvider() throw(::com::sun::star::uno::RuntimeException);
95 	virtual void SAL_CALL	setMasterDispatchProvider( const ::com::sun::star::uno::Reference<
96 								::com::sun::star::frame::XDispatchProvider >& xNewSupplier )
97 								throw(::com::sun::star::uno::RuntimeException);
98 
99 							// XEventListener
100 	virtual void SAL_CALL	disposing( const ::com::sun::star::lang::EventObject& Source )
101 								throw(::com::sun::star::uno::RuntimeException);
102 };
103 
104 
105 class ScDispatch : public cppu::WeakImplHelper2<
106 									com::sun::star::frame::XDispatch,
107 									com::sun::star::view::XSelectionChangeListener >,
108 								public SfxListener
109 {
110 	ScTabViewShell*			pViewShell;
111 	XStatusListenerArr_Impl	aDataSourceListeners;
112 	ScImportParam			aLastImport;
113 	sal_Bool				bListeningToView;
114 
115 public:
116 
117 							ScDispatch(ScTabViewShell* pViewSh);
118 	virtual					~ScDispatch();
119 
120 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
121 
122 							// XDispatch
123 	virtual void SAL_CALL	dispatch( const ::com::sun::star::util::URL& aURL,
124 								const ::com::sun::star::uno::Sequence<
125 									::com::sun::star::beans::PropertyValue >& aArgs )
126 								throw(::com::sun::star::uno::RuntimeException);
127 	virtual void SAL_CALL	addStatusListener( const ::com::sun::star::uno::Reference<
128 									::com::sun::star::frame::XStatusListener >& xControl,
129 								const ::com::sun::star::util::URL& aURL )
130 								throw(::com::sun::star::uno::RuntimeException);
131 	virtual void SAL_CALL	removeStatusListener( const ::com::sun::star::uno::Reference<
132 									::com::sun::star::frame::XStatusListener >& xControl,
133 								const ::com::sun::star::util::URL& aURL )
134 								throw(::com::sun::star::uno::RuntimeException);
135 
136                             // XSelectionChangeListener
137     virtual void SAL_CALL   selectionChanged( const ::com::sun::star::lang::EventObject& aEvent )
138                                 throw (::com::sun::star::uno::RuntimeException);
139 
140                             // XEventListener
141     virtual void SAL_CALL   disposing( const ::com::sun::star::lang::EventObject& Source )
142                                 throw (::com::sun::star::uno::RuntimeException);
143 };
144 
145 
146 #endif
147 
148