xref: /aoo42x/main/sc/inc/linkuno.hxx (revision 38d50f7b)
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_LINKUNO_HXX
25 #define SC_LINKUNO_HXX
26 
27 #include <svl/lstner.hxx>
28 #include <svl/itemprop.hxx>
29 #include <com/sun/star/sheet/XDDELink.hpp>
30 #include <com/sun/star/sheet/XDDELinkResults.hpp>
31 #include <com/sun/star/sheet/XDDELinks.hpp>
32 #include <com/sun/star/sheet/XExternalDocLink.hpp>
33 #include <com/sun/star/sheet/XExternalDocLinks.hpp>
34 #include <com/sun/star/sheet/XExternalSheetCache.hpp>
35 #include <com/sun/star/sheet/XAreaLink.hpp>
36 #include <com/sun/star/sheet/XAreaLinks.hpp>
37 #include <com/sun/star/util/XRefreshable.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <com/sun/star/container/XEnumerationAccess.hpp>
41 #include <com/sun/star/container/XNameAccess.hpp>
42 #include <com/sun/star/container/XIndexAccess.hpp>
43 #include <com/sun/star/container/XNamed.hpp>
44 #include <cppuhelper/implbase1.hxx>
45 #include <cppuhelper/implbase3.hxx>
46 #include <cppuhelper/implbase4.hxx>
47 #include <cppuhelper/implbase5.hxx>
48 
49 #include "externalrefmgr.hxx"
50 
51 #include <hash_map>
52 #include <vector>
53 
54 class ScAreaLink;
55 class ScDocShell;
56 class ScTableLink;
57 
58 typedef ::com::sun::star::uno::Reference<
59 			::com::sun::star::util::XRefreshListener >* XRefreshListenerPtr;
60 SV_DECL_PTRARR_DEL( XRefreshListenerArr_Impl, XRefreshListenerPtr, 4, 4 )
61 
62 
63 
64 class ScSheetLinkObj : public cppu::WeakImplHelper4<
65 							com::sun::star::container::XNamed,
66 							com::sun::star::util::XRefreshable,
67 							com::sun::star::beans::XPropertySet,
68 							com::sun::star::lang::XServiceInfo >,
69 						public SfxListener
70 {
71 private:
72 	SfxItemPropertySet		aPropSet;
73 	ScDocShell*				pDocShell;
74 	String					aFileName;
75 	XRefreshListenerArr_Impl aRefreshListeners;
76 
77 	ScTableLink*			GetLink_Impl() const;
78 	void					Refreshed_Impl();
79 	void					ModifyRefreshDelay_Impl( sal_Int32 nRefresh );
80 
81 public:
82 							ScSheetLinkObj(ScDocShell* pDocSh, const String& rName);
83 	virtual					~ScSheetLinkObj();
84 
85 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
86 
87 							// XNamed
88 	virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
89 	virtual void SAL_CALL	setName( const ::rtl::OUString& aName )
90 								throw(::com::sun::star::uno::RuntimeException);
91 
92 							// XRefreshable
93 	virtual void SAL_CALL	refresh() throw(::com::sun::star::uno::RuntimeException);
94 	virtual void SAL_CALL	addRefreshListener( const ::com::sun::star::uno::Reference<
95 									::com::sun::star::util::XRefreshListener >& l )
96 								throw(::com::sun::star::uno::RuntimeException);
97 	virtual void SAL_CALL	removeRefreshListener( const ::com::sun::star::uno::Reference<
98 									::com::sun::star::util::XRefreshListener >& l )
99 								throw(::com::sun::star::uno::RuntimeException);
100 
101 							// XPropertySet
102 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
103 							SAL_CALL getPropertySetInfo(  )
104 								throw(::com::sun::star::uno::RuntimeException);
105 	virtual void SAL_CALL	setPropertyValue( const ::rtl::OUString& aPropertyName,
106 									const ::com::sun::star::uno::Any& aValue )
107 								throw(::com::sun::star::beans::UnknownPropertyException,
108 									::com::sun::star::beans::PropertyVetoException,
109 									::com::sun::star::lang::IllegalArgumentException,
110 									::com::sun::star::lang::WrappedTargetException,
111 									::com::sun::star::uno::RuntimeException);
112 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
113 									const ::rtl::OUString& PropertyName )
114 								throw(::com::sun::star::beans::UnknownPropertyException,
115 									::com::sun::star::lang::WrappedTargetException,
116 									::com::sun::star::uno::RuntimeException);
117 	virtual void SAL_CALL	addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
118 									const ::com::sun::star::uno::Reference<
119 										::com::sun::star::beans::XPropertyChangeListener >& xListener )
120 								throw(::com::sun::star::beans::UnknownPropertyException,
121 									::com::sun::star::lang::WrappedTargetException,
122 									::com::sun::star::uno::RuntimeException);
123 	virtual void SAL_CALL	removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
124 									const ::com::sun::star::uno::Reference<
125 										::com::sun::star::beans::XPropertyChangeListener >& aListener )
126 								throw(::com::sun::star::beans::UnknownPropertyException,
127 									::com::sun::star::lang::WrappedTargetException,
128 									::com::sun::star::uno::RuntimeException);
129 	virtual void SAL_CALL	addVetoableChangeListener( const ::rtl::OUString& PropertyName,
130 									const ::com::sun::star::uno::Reference<
131 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
132 								throw(::com::sun::star::beans::UnknownPropertyException,
133 									::com::sun::star::lang::WrappedTargetException,
134 									::com::sun::star::uno::RuntimeException);
135 	virtual void SAL_CALL	removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
136 									const ::com::sun::star::uno::Reference<
137 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
138 								throw(::com::sun::star::beans::UnknownPropertyException,
139 									::com::sun::star::lang::WrappedTargetException,
140 									::com::sun::star::uno::RuntimeException);
141 
142 							// aus get/setPropertyValue gerufen:
143 	::rtl::OUString			getFileName(void) const;
144 	void					setFileName(const ::rtl::OUString& FileName);
145 	::rtl::OUString			getFilter(void) const;
146 	void					setFilter(const ::rtl::OUString& Filter);
147 	::rtl::OUString			getFilterOptions(void) const;
148 	void					setFilterOptions(const ::rtl::OUString& FilterOptions);
149 	sal_Int32				getRefreshDelay(void) const;
150 	void					setRefreshDelay(sal_Int32 nRefreshDelay);
151 
152 							// XServiceInfo
153 	virtual ::rtl::OUString SAL_CALL getImplementationName()
154 								throw(::com::sun::star::uno::RuntimeException);
155 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
156 								throw(::com::sun::star::uno::RuntimeException);
157 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
158 								throw(::com::sun::star::uno::RuntimeException);
159 };
160 
161 
162 class ScSheetLinksObj : public cppu::WeakImplHelper4<
163 							com::sun::star::container::XNameAccess,
164 							com::sun::star::container::XEnumerationAccess,
165 							com::sun::star::container::XIndexAccess,
166 							com::sun::star::lang::XServiceInfo >,
167 						public SfxListener
168 {
169 private:
170 	ScDocShell*				pDocShell;
171 
172 	ScSheetLinkObj*			GetObjectByIndex_Impl(sal_Int32 nIndex);
173 	ScSheetLinkObj*			GetObjectByName_Impl(const ::rtl::OUString& aName);
174 
175 public:
176 							ScSheetLinksObj(ScDocShell* pDocSh);
177 	virtual					~ScSheetLinksObj();
178 
179 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
180 
181 							// XNameAccess
182 	virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
183 								throw(::com::sun::star::container::NoSuchElementException,
184 									::com::sun::star::lang::WrappedTargetException,
185 									::com::sun::star::uno::RuntimeException);
186 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
187 								throw(::com::sun::star::uno::RuntimeException);
188 	virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
189 								throw(::com::sun::star::uno::RuntimeException);
190 
191 							// XIndexAccess
192 	virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
193 	virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
194 								throw(::com::sun::star::lang::IndexOutOfBoundsException,
195 									::com::sun::star::lang::WrappedTargetException,
196 									::com::sun::star::uno::RuntimeException);
197 
198 							// XEnumerationAccess
199 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
200 							createEnumeration() throw(::com::sun::star::uno::RuntimeException);
201 
202 							// XElementAccess
203 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
204 								throw(::com::sun::star::uno::RuntimeException);
205 	virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
206 
207 							// XServiceInfo
208 	virtual ::rtl::OUString SAL_CALL getImplementationName()
209 								throw(::com::sun::star::uno::RuntimeException);
210 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
211 								throw(::com::sun::star::uno::RuntimeException);
212 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
213 								throw(::com::sun::star::uno::RuntimeException);
214 };
215 
216 
217 class ScAreaLinkObj : public cppu::WeakImplHelper4<
218 							com::sun::star::sheet::XAreaLink,
219 							com::sun::star::util::XRefreshable,
220 							com::sun::star::beans::XPropertySet,
221 							com::sun::star::lang::XServiceInfo >,
222 						public SfxListener
223 {
224 private:
225 	SfxItemPropertySet		aPropSet;
226 	ScDocShell*				pDocShell;
227 	sal_uInt16					nPos;
228 	XRefreshListenerArr_Impl aRefreshListeners;
229 
230 	void	Modify_Impl( const ::rtl::OUString* pNewFile, const ::rtl::OUString* pNewFilter,
231 						 const ::rtl::OUString* pNewOptions, const ::rtl::OUString* pNewSource,
232 						 const com::sun::star::table::CellRangeAddress* pNewDest );
233 	void	ModifyRefreshDelay_Impl( sal_Int32 nRefresh );
234 	void	Refreshed_Impl();
235 
236 public:
237 							ScAreaLinkObj(ScDocShell* pDocSh, sal_uInt16 nP);
238 	virtual					~ScAreaLinkObj();
239 
240 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
241 
242 							// XRefreshable
243 	virtual void SAL_CALL	refresh() throw(::com::sun::star::uno::RuntimeException);
244 	virtual void SAL_CALL	addRefreshListener( const ::com::sun::star::uno::Reference<
245 									::com::sun::star::util::XRefreshListener >& l )
246 								throw(::com::sun::star::uno::RuntimeException);
247 	virtual void SAL_CALL	removeRefreshListener( const ::com::sun::star::uno::Reference<
248 									::com::sun::star::util::XRefreshListener >& l )
249 								throw(::com::sun::star::uno::RuntimeException);
250 
251 							// XPropertySet
252 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
253 							SAL_CALL getPropertySetInfo(  )
254 								throw(::com::sun::star::uno::RuntimeException);
255 	virtual void SAL_CALL	setPropertyValue( const ::rtl::OUString& aPropertyName,
256 									const ::com::sun::star::uno::Any& aValue )
257 								throw(::com::sun::star::beans::UnknownPropertyException,
258 									::com::sun::star::beans::PropertyVetoException,
259 									::com::sun::star::lang::IllegalArgumentException,
260 									::com::sun::star::lang::WrappedTargetException,
261 									::com::sun::star::uno::RuntimeException);
262 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
263 									const ::rtl::OUString& PropertyName )
264 								throw(::com::sun::star::beans::UnknownPropertyException,
265 									::com::sun::star::lang::WrappedTargetException,
266 									::com::sun::star::uno::RuntimeException);
267 	virtual void SAL_CALL	addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
268 									const ::com::sun::star::uno::Reference<
269 										::com::sun::star::beans::XPropertyChangeListener >& xListener )
270 								throw(::com::sun::star::beans::UnknownPropertyException,
271 									::com::sun::star::lang::WrappedTargetException,
272 									::com::sun::star::uno::RuntimeException);
273 	virtual void SAL_CALL	removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
274 									const ::com::sun::star::uno::Reference<
275 										::com::sun::star::beans::XPropertyChangeListener >& aListener )
276 								throw(::com::sun::star::beans::UnknownPropertyException,
277 									::com::sun::star::lang::WrappedTargetException,
278 									::com::sun::star::uno::RuntimeException);
279 	virtual void SAL_CALL	addVetoableChangeListener( const ::rtl::OUString& PropertyName,
280 									const ::com::sun::star::uno::Reference<
281 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
282 								throw(::com::sun::star::beans::UnknownPropertyException,
283 									::com::sun::star::lang::WrappedTargetException,
284 									::com::sun::star::uno::RuntimeException);
285 	virtual void SAL_CALL	removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
286 									const ::com::sun::star::uno::Reference<
287 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
288 								throw(::com::sun::star::beans::UnknownPropertyException,
289 									::com::sun::star::lang::WrappedTargetException,
290 									::com::sun::star::uno::RuntimeException);
291 
292 							// aus get/setPropertyValue gerufen:
293 	::rtl::OUString			getFileName(void) const;
294 	void					setFileName(const ::rtl::OUString& FileName);
295 	::rtl::OUString			getFilter(void) const;
296 	void					setFilter(const ::rtl::OUString& Filter);
297 	::rtl::OUString			getFilterOptions(void) const;
298 	void					setFilterOptions(const ::rtl::OUString& FilterOptions);
299 	sal_Int32				getRefreshDelay(void) const;
300 	void					setRefreshDelay(sal_Int32 nRefreshDelay);
301 
302 							// XAreaLink
303 	virtual ::rtl::OUString SAL_CALL getSourceArea() throw(::com::sun::star::uno::RuntimeException);
304 	virtual void SAL_CALL 	setSourceArea( const ::rtl::OUString& aSourceArea )
305 								throw(::com::sun::star::uno::RuntimeException);
306 	virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getDestArea()
307 								throw(::com::sun::star::uno::RuntimeException);
308 	virtual void SAL_CALL setDestArea( const ::com::sun::star::table::CellRangeAddress& aDestArea )
309 								throw(::com::sun::star::uno::RuntimeException);
310 
311 							// XServiceInfo
312 	virtual ::rtl::OUString SAL_CALL getImplementationName()
313 								throw(::com::sun::star::uno::RuntimeException);
314 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
315 								throw(::com::sun::star::uno::RuntimeException);
316 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
317 								throw(::com::sun::star::uno::RuntimeException);
318 };
319 
320 
321 class ScAreaLinksObj : public cppu::WeakImplHelper3<
322 							com::sun::star::sheet::XAreaLinks,
323 							com::sun::star::container::XEnumerationAccess,
324 							com::sun::star::lang::XServiceInfo >,
325 						public SfxListener
326 {
327 private:
328 	ScDocShell*				pDocShell;
329 
330 	ScAreaLinkObj*			GetObjectByIndex_Impl(sal_Int32 nIndex);
331 
332 public:
333 							ScAreaLinksObj(ScDocShell* pDocSh);
334 	virtual					~ScAreaLinksObj();
335 
336 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
337 
338 							// XAreaLinks
339 	virtual void SAL_CALL	insertAtPosition( const ::com::sun::star::table::CellAddress& aDestPos,
340 												const ::rtl::OUString& aFileName,
341 												const ::rtl::OUString& aSourceArea,
342 												const ::rtl::OUString& aFilter,
343 												const ::rtl::OUString& aFilterOptions )
344 											throw(::com::sun::star::uno::RuntimeException);
345 	virtual void SAL_CALL	removeByIndex( sal_Int32 nIndex )
346 											throw(::com::sun::star::uno::RuntimeException);
347 
348 							// XIndexAccess
349 	virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
350 	virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
351 								throw(::com::sun::star::lang::IndexOutOfBoundsException,
352 									::com::sun::star::lang::WrappedTargetException,
353 									::com::sun::star::uno::RuntimeException);
354 
355 							// XEnumerationAccess
356 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
357 							createEnumeration() throw(::com::sun::star::uno::RuntimeException);
358 
359 							// XElementAccess
360 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
361 								throw(::com::sun::star::uno::RuntimeException);
362 	virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
363 
364 							// XServiceInfo
365 	virtual ::rtl::OUString SAL_CALL getImplementationName()
366 								throw(::com::sun::star::uno::RuntimeException);
367 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
368 								throw(::com::sun::star::uno::RuntimeException);
369 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
370 								throw(::com::sun::star::uno::RuntimeException);
371 };
372 
373 
374 //!	order of XNamed and DDELink changed to avoid "duplicate comdat" symbols
375 
376 class ScDDELinkObj : public cppu::WeakImplHelper5<
377 							com::sun::star::sheet::XDDELink,
378 							com::sun::star::container::XNamed,
379 							com::sun::star::util::XRefreshable,
380                             com::sun::star::sheet::XDDELinkResults,
381 							com::sun::star::lang::XServiceInfo >,
382 						public SfxListener
383 {
384 private:
385 	ScDocShell*				pDocShell;
386 	String					aAppl;
387 	String					aTopic;
388 	String					aItem;
389 	XRefreshListenerArr_Impl aRefreshListeners;
390 
391 	void					Refreshed_Impl();
392 
393 public:
394 							ScDDELinkObj(ScDocShell* pDocSh, const String& rA,
395 											const String& rT, const String& rI);
396 	virtual					~ScDDELinkObj();
397 
398 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
399 
400 							// XNamed
401 	virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
402 	virtual void SAL_CALL	setName( const ::rtl::OUString& aName )
403 								throw(::com::sun::star::uno::RuntimeException);
404 
405 							// XDDELink
406 	virtual ::rtl::OUString SAL_CALL getApplication() throw(::com::sun::star::uno::RuntimeException);
407 	virtual ::rtl::OUString SAL_CALL getTopic() throw(::com::sun::star::uno::RuntimeException);
408 	virtual ::rtl::OUString SAL_CALL getItem() throw(::com::sun::star::uno::RuntimeException);
409 
410 							// XRefreshable
411 	virtual void SAL_CALL	refresh() throw(::com::sun::star::uno::RuntimeException);
412 	virtual void SAL_CALL	addRefreshListener( const ::com::sun::star::uno::Reference<
413 									::com::sun::star::util::XRefreshListener >& l )
414 								throw(::com::sun::star::uno::RuntimeException);
415 	virtual void SAL_CALL	removeRefreshListener( const ::com::sun::star::uno::Reference<
416 									::com::sun::star::util::XRefreshListener >& l )
417 								throw(::com::sun::star::uno::RuntimeException);
418 
419                             // XDDELinkResults
420     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >
421         SAL_CALL getResults(  )
422         throw (::com::sun::star::uno::RuntimeException);
423     virtual void SAL_CALL setResults(
424         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aResults )
425         throw (::com::sun::star::uno::RuntimeException);
426 
427 							// XServiceInfo
428 	virtual ::rtl::OUString SAL_CALL getImplementationName()
429 								throw(::com::sun::star::uno::RuntimeException);
430 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
431 								throw(::com::sun::star::uno::RuntimeException);
432 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
433 								throw(::com::sun::star::uno::RuntimeException);
434 };
435 
436 
437 class ScDDELinksObj : public cppu::WeakImplHelper4<
438 							com::sun::star::container::XEnumerationAccess,
439 							com::sun::star::container::XIndexAccess,
440                             com::sun::star::sheet::XDDELinks,
441 							com::sun::star::lang::XServiceInfo >,
442 						public SfxListener
443 {
444 private:
445 	ScDocShell*				pDocShell;
446 
447 	ScDDELinkObj*			GetObjectByIndex_Impl(sal_Int32 nIndex);
448 	ScDDELinkObj*			GetObjectByName_Impl(const ::rtl::OUString& aName);
449 
450 public:
451 							ScDDELinksObj(ScDocShell* pDocSh);
452 	virtual					~ScDDELinksObj();
453 
454 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
455 
456 							// XNameAccess
457 	virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
458 								throw(::com::sun::star::container::NoSuchElementException,
459 									::com::sun::star::lang::WrappedTargetException,
460 									::com::sun::star::uno::RuntimeException);
461 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
462 								throw(::com::sun::star::uno::RuntimeException);
463 	virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
464 								throw(::com::sun::star::uno::RuntimeException);
465 
466 							// XIndexAccess
467 	virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
468 	virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
469 								throw(::com::sun::star::lang::IndexOutOfBoundsException,
470 									::com::sun::star::lang::WrappedTargetException,
471 									::com::sun::star::uno::RuntimeException);
472 
473 							// XEnumerationAccess
474 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
475 							createEnumeration() throw(::com::sun::star::uno::RuntimeException);
476 
477 							// XElementAccess
478 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
479 								throw(::com::sun::star::uno::RuntimeException);
480 	virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
481 
482                             // XDDELinks
483     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDDELink > SAL_CALL addDDELink(
484         const ::rtl::OUString& aApplication, const ::rtl::OUString& aTopic,
485         const ::rtl::OUString& aItem, ::com::sun::star::sheet::DDELinkMode nMode )
486         throw (::com::sun::star::uno::RuntimeException);
487 
488 							// XServiceInfo
489 	virtual ::rtl::OUString SAL_CALL getImplementationName()
490 								throw(::com::sun::star::uno::RuntimeException);
491 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
492 								throw(::com::sun::star::uno::RuntimeException);
493 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
494 								throw(::com::sun::star::uno::RuntimeException);
495 };
496 
497 // ============================================================================
498 
499 class ScExternalSheetCacheObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalSheetCache >
500 {
501 public:
502     explicit ScExternalSheetCacheObj(ScExternalRefCache::TableTypeRef pTable, size_t nIndex);
503     ~ScExternalSheetCacheObj();
504 
505                             // XExternalSheetCache
506     virtual void SAL_CALL setCellValue(
507         sal_Int32 nCol, sal_Int32 nRow, const ::com::sun::star::uno::Any& rAny)
508         throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
509 
510     virtual ::com::sun::star::uno::Any SAL_CALL getCellValue(sal_Int32 nCol, sal_Int32 nRow)
511         throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
512 
513     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getAllRows()
514         throw (::com::sun::star::uno::RuntimeException);
515 
516     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getAllColumns(sal_Int32 nRow)
517         throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
518 
519     // Attributes
520     virtual sal_Int32 SAL_CALL getTokenIndex()
521             throw (::com::sun::star::uno::RuntimeException);
522 
523 private:
524     ScExternalSheetCacheObj();
525     ScExternalSheetCacheObj(const ScExternalSheetCacheObj&);
526 
527 private:
528     ScExternalRefCache::TableTypeRef mpTable;
529     size_t mnIndex;
530 };
531 
532 // ============================================================================
533 
534 class ScExternalDocLinkObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalDocLink >
535 {
536 public:
537     ScExternalDocLinkObj(ScExternalRefManager* pRefMgr, sal_uInt16 nFileId);
538     ~ScExternalDocLinkObj();
539 
540                             // XExternalDocLink
541     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >
542         SAL_CALL addSheetCache( const ::rtl::OUString& aSheetName, sal_Bool bDynamicCache )
543             throw (::com::sun::star::uno::RuntimeException);
544 
545                             // XNameAccess
546     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
547                                 throw(::com::sun::star::container::NoSuchElementException,
548                                     ::com::sun::star::lang::WrappedTargetException,
549                                     ::com::sun::star::uno::RuntimeException);
550     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
551                                 throw(::com::sun::star::uno::RuntimeException);
552     virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
553                                 throw(::com::sun::star::uno::RuntimeException);
554 
555                             // XIndexAccess
556     virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
557     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex )
558                                 throw(::com::sun::star::lang::IndexOutOfBoundsException,
559                                     ::com::sun::star::lang::WrappedTargetException,
560                                     ::com::sun::star::uno::RuntimeException);
561 
562                             // XEnumerationAccess
563     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
564                             createEnumeration() throw(::com::sun::star::uno::RuntimeException);
565 
566                             // XElementAccess
567     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
568                                 throw(::com::sun::star::uno::RuntimeException);
569     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
570 
571     // Attributes
572     virtual sal_Int32 SAL_CALL getTokenIndex()
573             throw (::com::sun::star::uno::RuntimeException);
574 
575 private:
576     ScExternalRefManager*   mpRefMgr;
577     sal_uInt16              mnFileId;
578 };
579 
580 // ============================================================================
581 
582 /** This is the UNO API equivalent of ScExternalRefManager. */
583 class ScExternalDocLinksObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalDocLinks >
584 {
585 public:
586     ScExternalDocLinksObj(ScDocShell* pDocShell);
587     ~ScExternalDocLinksObj();
588 
589                             // XExternalDocLinks
590     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalDocLink >
591         SAL_CALL addDocLink( const ::rtl::OUString& aDocName )
592             throw (::com::sun::star::uno::RuntimeException);
593 
594                             // XNameAccess
595     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
596                                 throw(::com::sun::star::container::NoSuchElementException,
597                                     ::com::sun::star::lang::WrappedTargetException,
598                                     ::com::sun::star::uno::RuntimeException);
599     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
600                                 throw(::com::sun::star::uno::RuntimeException);
601     virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
602                                 throw(::com::sun::star::uno::RuntimeException);
603 
604                             // XIndexAccess
605     virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
606     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex )
607                                 throw(::com::sun::star::lang::IndexOutOfBoundsException,
608                                     ::com::sun::star::lang::WrappedTargetException,
609                                     ::com::sun::star::uno::RuntimeException);
610 
611                             // XEnumerationAccess
612     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
613                             createEnumeration() throw(::com::sun::star::uno::RuntimeException);
614 
615                             // XElementAccess
616     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
617                                 throw(::com::sun::star::uno::RuntimeException);
618     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
619 
620 private:
621     ScExternalDocLinksObj();
622     ScExternalDocLinksObj(const ScExternalDocLinksObj&);
623 
624 private:
625     ScDocShell*                         mpDocShell;
626     ScExternalRefManager*               mpRefMgr;
627 };
628 
629 #endif
630 
631