1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filrset.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #ifndef __SGI_STL_VECTOR
36 #include <ucbhelper/macros.hxx>
37 #include <osl/file.hxx>
39 #include "osl/mutex.hxx"
40 #include <cppuhelper/weak.hxx>
41 #include <cppuhelper/interfacecontainer.hxx>
42 #include <com/sun/star/lang/XTypeProvider.hpp>
43 #include <com/sun/star/ucb/XContentAccess.hpp>
44 #include <com/sun/star/sdbc/XCloseable.hpp>
45 #include <com/sun/star/beans/XPropertySet.hpp>
46 #ifndef _COM_SUN_STAR_UCB_XDYNAMICRESULTSET_HPP__
47 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
49 #include <com/sun/star/ucb/XDynamicResultSetListener.hpp>
50 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
51 #include <com/sun/star/ucb/NumberedSortingInfo.hpp>
52 #include <com/sun/star/ucb/XContentProvider.hpp>
53 #include <com/sun/star/ucb/XContentIdentifier.hpp>
54 #include <com/sun/star/beans/Property.hpp>
60 namespace fileaccess
{
65 : public cppu::OWeakObject
,
66 public com::sun::star::lang::XTypeProvider
,
67 public com::sun::star::lang::XEventListener
,
68 public com::sun::star::sdbc::XRow
,
69 public com::sun::star::sdbc::XResultSet
,
70 public com::sun::star::ucb::XDynamicResultSet
,
71 public com::sun::star::sdbc::XCloseable
,
72 public com::sun::star::sdbc::XResultSetMetaDataSupplier
,
73 public com::sun::star::beans::XPropertySet
,
74 public com::sun::star::ucb::XContentAccess
,
79 XResultSet_impl( shell
* pMyShell
,
80 const rtl::OUString
& aUnqPath
,
82 const com::sun::star::uno::Sequence
< com::sun::star::beans::Property
>& seq
,
83 const com::sun::star::uno::Sequence
< com::sun::star::ucb::NumberedSortingInfo
>& seqSort
);
85 virtual ~XResultSet_impl();
87 virtual ContentEventNotifier
* cDEL( void )
92 virtual ContentEventNotifier
* cEXC( const rtl::OUString
)
97 virtual ContentEventNotifier
* cCEL( void )
102 virtual PropertySetInfoChangeNotifier
* cPSL( void )
107 virtual PropertyChangeNotifier
* cPCL( void )
112 virtual rtl::OUString
getKey( void )
114 return m_aBaseDirectory
;
117 sal_Int32 SAL_CALL
CtorSuccess();
118 sal_Int32 SAL_CALL
getMinorError();
121 virtual com::sun::star::uno::Any SAL_CALL
123 const com::sun::star::uno::Type
& aType
)
124 throw( com::sun::star::uno::RuntimeException
);
126 virtual void SAL_CALL
131 virtual void SAL_CALL
143 virtual void SAL_CALL
145 const com::sun::star::lang::EventObject
& Source
)
146 throw( com::sun::star::uno::RuntimeException
);
149 virtual void SAL_CALL
152 throw( com::sun::star::uno::RuntimeException
);
154 virtual void SAL_CALL
156 const com::sun::star::uno::Reference
< com::sun::star::lang::XEventListener
>& xListener
)
157 throw( com::sun::star::uno::RuntimeException
);
159 virtual void SAL_CALL
160 removeEventListener( const com::sun::star::uno::Reference
< com::sun::star::lang::XEventListener
>& aListener
)
161 throw( com::sun::star::uno::RuntimeException
);
165 virtual sal_Bool SAL_CALL
168 throw( com::sun::star::sdbc::SQLException
,
169 com::sun::star::uno::RuntimeException
)
171 if( 0<= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
172 m_nWasNull
= m_aItems
[m_nRow
]->wasNull();
178 virtual rtl::OUString SAL_CALL
180 sal_Int32 columnIndex
)
181 throw( com::sun::star::sdbc::SQLException
,
182 com::sun::star::uno::RuntimeException
)
184 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
185 return m_aItems
[m_nRow
]->getString( columnIndex
);
187 return rtl::OUString();
190 virtual sal_Bool SAL_CALL
192 sal_Int32 columnIndex
)
193 throw( com::sun::star::sdbc::SQLException
,
194 com::sun::star::uno::RuntimeException
)
196 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
197 return m_aItems
[m_nRow
]->getBoolean( columnIndex
);
202 virtual sal_Int8 SAL_CALL
204 sal_Int32 columnIndex
)
205 throw( com::sun::star::sdbc::SQLException
,
206 com::sun::star::uno::RuntimeException
)
208 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
209 return m_aItems
[m_nRow
]->getByte( columnIndex
);
211 return sal_Int8( 0 );
214 virtual sal_Int16 SAL_CALL
216 sal_Int32 columnIndex
)
218 com::sun::star::sdbc::SQLException
,
219 com::sun::star::uno::RuntimeException
)
221 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
222 return m_aItems
[m_nRow
]->getShort( columnIndex
);
224 return sal_Int16( 0 );
227 virtual sal_Int32 SAL_CALL
229 sal_Int32 columnIndex
)
230 throw( com::sun::star::sdbc::SQLException
,
231 com::sun::star::uno::RuntimeException
)
233 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
234 return m_aItems
[m_nRow
]->getInt( columnIndex
);
236 return sal_Int32( 0 );
239 virtual sal_Int64 SAL_CALL
241 sal_Int32 columnIndex
)
242 throw( com::sun::star::sdbc::SQLException
,
243 com::sun::star::uno::RuntimeException
)
245 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
246 return m_aItems
[m_nRow
]->getLong( columnIndex
);
248 return sal_Int64( 0 );
251 virtual float SAL_CALL
253 sal_Int32 columnIndex
)
254 throw( com::sun::star::sdbc::SQLException
,
255 com::sun::star::uno::RuntimeException
)
257 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
258 return m_aItems
[m_nRow
]->getFloat( columnIndex
);
263 virtual double SAL_CALL
265 sal_Int32 columnIndex
)
266 throw( com::sun::star::sdbc::SQLException
,
267 com::sun::star::uno::RuntimeException
)
269 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
270 return m_aItems
[m_nRow
]->getDouble( columnIndex
);
275 virtual com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
277 sal_Int32 columnIndex
)
278 throw( com::sun::star::sdbc::SQLException
,
279 com::sun::star::uno::RuntimeException
)
281 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
282 return m_aItems
[m_nRow
]->getBytes( columnIndex
);
284 return com::sun::star::uno::Sequence
< sal_Int8
>();
287 virtual com::sun::star::util::Date SAL_CALL
289 sal_Int32 columnIndex
)
290 throw( com::sun::star::sdbc::SQLException
,
291 com::sun::star::uno::RuntimeException
)
293 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
294 return m_aItems
[m_nRow
]->getDate( columnIndex
);
296 return com::sun::star::util::Date();
299 virtual com::sun::star::util::Time SAL_CALL
301 sal_Int32 columnIndex
)
302 throw( com::sun::star::sdbc::SQLException
,
303 com::sun::star::uno::RuntimeException
)
305 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
306 return m_aItems
[m_nRow
]->getTime( columnIndex
);
308 return com::sun::star::util::Time();
311 virtual com::sun::star::util::DateTime SAL_CALL
313 sal_Int32 columnIndex
)
314 throw( com::sun::star::sdbc::SQLException
,
315 com::sun::star::uno::RuntimeException
)
317 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
318 return m_aItems
[m_nRow
]->getTimestamp( columnIndex
);
320 return com::sun::star::util::DateTime();
323 virtual com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> SAL_CALL
325 sal_Int32 columnIndex
)
326 throw( com::sun::star::sdbc::SQLException
,
327 com::sun::star::uno::RuntimeException
)
329 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
330 return m_aItems
[m_nRow
]->getBinaryStream( columnIndex
);
332 return com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>();
335 virtual com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> SAL_CALL
337 sal_Int32 columnIndex
)
338 throw( com::sun::star::sdbc::SQLException
,
339 com::sun::star::uno::RuntimeException
)
341 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
342 return m_aItems
[m_nRow
]->getCharacterStream( columnIndex
);
344 return com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>();
347 virtual com::sun::star::uno::Any SAL_CALL
349 sal_Int32 columnIndex
,
350 const com::sun::star::uno::Reference
< com::sun::star::container::XNameAccess
>& typeMap
)
351 throw( com::sun::star::sdbc::SQLException
,
352 com::sun::star::uno::RuntimeException
)
354 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
355 return m_aItems
[m_nRow
]->getObject( columnIndex
,typeMap
);
357 return com::sun::star::uno::Any();
360 virtual com::sun::star::uno::Reference
< com::sun::star::sdbc::XRef
> SAL_CALL
362 sal_Int32 columnIndex
)
363 throw( com::sun::star::sdbc::SQLException
,
364 com::sun::star::uno::RuntimeException
)
366 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
367 return m_aItems
[m_nRow
]->getRef( columnIndex
);
369 return com::sun::star::uno::Reference
< com::sun::star::sdbc::XRef
>();
372 virtual com::sun::star::uno::Reference
< com::sun::star::sdbc::XBlob
> SAL_CALL
374 sal_Int32 columnIndex
)
375 throw( com::sun::star::sdbc::SQLException
,
376 com::sun::star::uno::RuntimeException
)
378 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
379 return m_aItems
[m_nRow
]->getBlob( columnIndex
);
381 return com::sun::star::uno::Reference
< com::sun::star::sdbc::XBlob
>();
384 virtual com::sun::star::uno::Reference
< com::sun::star::sdbc::XClob
> SAL_CALL
386 sal_Int32 columnIndex
)
387 throw( com::sun::star::sdbc::SQLException
,
388 com::sun::star::uno::RuntimeException
)
390 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
391 return m_aItems
[m_nRow
]->getClob( columnIndex
);
393 return com::sun::star::uno::Reference
< com::sun::star::sdbc::XClob
>();
396 virtual com::sun::star::uno::Reference
< com::sun::star::sdbc::XArray
> SAL_CALL
398 sal_Int32 columnIndex
)
399 throw( com::sun::star::sdbc::SQLException
,
400 com::sun::star::uno::RuntimeException
)
402 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
403 return m_aItems
[m_nRow
]->getArray( columnIndex
);
405 return com::sun::star::uno::Reference
< com::sun::star::sdbc::XArray
>();
411 virtual sal_Bool SAL_CALL
414 throw( com::sun::star::sdbc::SQLException
,
415 com::sun::star::uno::RuntimeException
);
417 virtual sal_Bool SAL_CALL
420 throw( com::sun::star::sdbc::SQLException
,
421 com::sun::star::uno::RuntimeException
);
423 virtual sal_Bool SAL_CALL
426 throw( com::sun::star::sdbc::SQLException
,
427 com::sun::star::uno::RuntimeException
);
429 virtual sal_Bool SAL_CALL
432 throw( com::sun::star::sdbc::SQLException
,
433 com::sun::star::uno::RuntimeException
);
435 virtual sal_Bool SAL_CALL
438 throw( com::sun::star::sdbc::SQLException
,
439 com::sun::star::uno::RuntimeException
);
441 virtual void SAL_CALL
444 throw( com::sun::star::sdbc::SQLException
,
445 com::sun::star::uno::RuntimeException
);
447 virtual void SAL_CALL
450 throw( com::sun::star::sdbc::SQLException
,
451 com::sun::star::uno::RuntimeException
);
453 virtual sal_Bool SAL_CALL
456 throw( com::sun::star::sdbc::SQLException
,
457 com::sun::star::uno::RuntimeException
);
459 virtual sal_Bool SAL_CALL
462 throw( com::sun::star::sdbc::SQLException
,
463 com::sun::star::uno::RuntimeException
);
465 virtual sal_Int32 SAL_CALL
468 throw( com::sun::star::sdbc::SQLException
,
469 com::sun::star::uno::RuntimeException
);
471 virtual sal_Bool SAL_CALL
474 throw( com::sun::star::sdbc::SQLException
,
475 com::sun::star::uno::RuntimeException
);
477 virtual sal_Bool SAL_CALL
480 throw( com::sun::star::sdbc::SQLException
,
481 com::sun::star::uno::RuntimeException
);
483 virtual sal_Bool SAL_CALL
486 throw( com::sun::star::sdbc::SQLException
,
487 com::sun::star::uno::RuntimeException
);
489 virtual void SAL_CALL
492 throw( com::sun::star::sdbc::SQLException
,
493 com::sun::star::uno::RuntimeException
);
495 virtual sal_Bool SAL_CALL
498 throw( com::sun::star::sdbc::SQLException
,
499 com::sun::star::uno::RuntimeException
);
501 virtual sal_Bool SAL_CALL
504 throw( com::sun::star::sdbc::SQLException
,
505 com::sun::star::uno::RuntimeException
);
507 virtual sal_Bool SAL_CALL
510 throw( com::sun::star::sdbc::SQLException
,
511 com::sun::star::uno::RuntimeException
);
514 virtual com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
> SAL_CALL
517 throw( com::sun::star::sdbc::SQLException
,
518 com::sun::star::uno::RuntimeException
);
523 virtual com::sun::star::uno::Reference
< com::sun::star::sdbc::XResultSet
> SAL_CALL
526 throw( com::sun::star::ucb::ListenerAlreadySetException
,
527 com::sun::star::uno::RuntimeException
);
529 virtual void SAL_CALL
531 const com::sun::star::uno::Reference
<
532 com::sun::star::ucb::XDynamicResultSetListener
>& Listener
)
533 throw( com::sun::star::ucb::ListenerAlreadySetException
,
534 com::sun::star::uno::RuntimeException
);
536 virtual void SAL_CALL
537 connectToCache( const com::sun::star::uno::Reference
< com::sun::star::ucb::XDynamicResultSet
> & xCache
)
538 throw( com::sun::star::ucb::ListenerAlreadySetException
,
539 com::sun::star::ucb::AlreadyInitializedException
,
540 com::sun::star::ucb::ServiceNotFoundException
,
541 com::sun::star::uno::RuntimeException
);
543 virtual sal_Int16 SAL_CALL
545 throw( com::sun::star::uno::RuntimeException
);
550 virtual void SAL_CALL
553 throw( com::sun::star::sdbc::SQLException
,
554 com::sun::star::uno::RuntimeException
);
558 virtual rtl::OUString SAL_CALL
559 queryContentIdentifierString(
561 throw( com::sun::star::uno::RuntimeException
);
563 virtual com::sun::star::uno::Reference
< com::sun::star::ucb::XContentIdentifier
> SAL_CALL
564 queryContentIdentifier(
566 throw( com::sun::star::uno::RuntimeException
);
568 virtual com::sun::star::uno::Reference
< com::sun::star::ucb::XContent
> SAL_CALL
571 throw( com::sun::star::uno::RuntimeException
);
573 // XResultSetMetaDataSupplier
574 virtual com::sun::star::uno::Reference
< com::sun::star::sdbc::XResultSetMetaData
> SAL_CALL
577 throw( com::sun::star::sdbc::SQLException
,
578 com::sun::star::uno::RuntimeException
);
582 virtual com::sun::star::uno::Reference
< com::sun::star::beans::XPropertySetInfo
> SAL_CALL
584 throw( com::sun::star::uno::RuntimeException
);
586 virtual void SAL_CALL
setPropertyValue(
587 const rtl::OUString
& aPropertyName
,
588 const com::sun::star::uno::Any
& aValue
)
589 throw( com::sun::star::beans::UnknownPropertyException
,
590 com::sun::star::beans::PropertyVetoException
,
591 com::sun::star::lang::IllegalArgumentException
,
592 com::sun::star::lang::WrappedTargetException
,
593 com::sun::star::uno::RuntimeException
);
595 virtual com::sun::star::uno::Any SAL_CALL
597 const rtl::OUString
& PropertyName
)
598 throw( com::sun::star::beans::UnknownPropertyException
,
599 com::sun::star::lang::WrappedTargetException
,
600 com::sun::star::uno::RuntimeException
);
602 virtual void SAL_CALL
603 addPropertyChangeListener(
604 const rtl::OUString
& aPropertyName
,
605 const com::sun::star::uno::Reference
< com::sun::star::beans::XPropertyChangeListener
>& xListener
)
606 throw( com::sun::star::beans::UnknownPropertyException
,
607 com::sun::star::lang::WrappedTargetException
,
608 com::sun::star::uno::RuntimeException
);
610 virtual void SAL_CALL
611 removePropertyChangeListener(
612 const rtl::OUString
& aPropertyName
,
613 const com::sun::star::uno::Reference
< com::sun::star::beans::XPropertyChangeListener
>& aListener
)
614 throw( com::sun::star::beans::UnknownPropertyException
,
615 com::sun::star::lang::WrappedTargetException
,
616 com::sun::star::uno::RuntimeException
);
618 virtual void SAL_CALL
619 addVetoableChangeListener(
620 const rtl::OUString
& PropertyName
,
621 const com::sun::star::uno::Reference
< com::sun::star::beans::XVetoableChangeListener
>& aListener
)
622 throw( com::sun::star::beans::UnknownPropertyException
,
623 com::sun::star::lang::WrappedTargetException
,
624 com::sun::star::uno::RuntimeException
);
626 virtual void SAL_CALL
removeVetoableChangeListener(
627 const rtl::OUString
& PropertyName
,
628 const com::sun::star::uno::Reference
< com::sun::star::beans::XVetoableChangeListener
>& aListener
)
629 throw( com::sun::star::beans::UnknownPropertyException
,
630 com::sun::star::lang::WrappedTargetException
,
631 com::sun::star::uno::RuntimeException
);
636 // const uno::Reference< lang::XMultiServiceFactory > m_xMSF;
637 // const uno::Reference< ucb::XContentProvider > m_xProvider;
640 com::sun::star::uno::Reference
< com::sun::star::ucb::XContentProvider
> m_xProvider
;
644 sal_Int32 m_nOpenMode
;
645 sal_Bool m_bRowCountFinal
;
647 typedef std::vector
< com::sun::star::uno::Reference
< com::sun::star::ucb::XContentIdentifier
> > IdentSet
;
648 typedef std::vector
< com::sun::star::uno::Reference
< com::sun::star::sdbc::XRow
> > ItemSet
;
649 typedef std::vector
< rtl::OUString
> UnqPathSet
;
653 UnqPathSet m_aUnqPath
;
654 const rtl::OUString m_aBaseDirectory
;
656 osl::Directory m_aFolder
;
657 com::sun::star::uno::Sequence
< com::sun::star::beans::Property
> m_sProperty
;
658 com::sun::star::uno::Sequence
< com::sun::star::ucb::NumberedSortingInfo
> m_sSortingInfo
;
661 osl::Mutex m_aEventListenerMutex
;
662 cppu::OInterfaceContainerHelper
* m_pDisposeEventListeners
;
664 cppu::OInterfaceContainerHelper
* m_pRowCountListeners
;
665 cppu::OInterfaceContainerHelper
* m_pIsFinalListeners
;
667 com::sun::star::uno::Reference
< com::sun::star::ucb::XDynamicResultSetListener
> m_xListener
;
670 sal_Int32 m_nErrorCode
;
671 sal_Int32 m_nMinorErrorCode
;
674 sal_Bool SAL_CALL
OneMore( void )
675 throw( com::sun::star::sdbc::SQLException
,
676 com::sun::star::uno::RuntimeException
);
678 void rowCountChanged();
679 void isFinalChanged();
683 } // end namespace fileaccess