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