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.cxx,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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_ucb.hxx"
33 #include <com/sun/star/ucb/WelcomeDynamicResultSetStruct.hpp>
37 #include "filrset.hxx"
38 #include <com/sun/star/ucb/OpenMode.hpp>
40 #include <com/sun/star/uno/Reference.h>
42 #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBBUTE_HPP_
43 #include <com/sun/star/beans/PropertyAttribute.hpp>
45 #include <com/sun/star/ucb/ListActionType.hpp>
46 #include <com/sun/star/ucb/XSourceInitialization.hpp>
47 #include <com/sun/star/ucb/XCachedDynamicResultSetStubFactory.hpp>
48 #include <ucbhelper/resultsetmetadata.hxx>
50 using namespace fileaccess
;
51 using namespace com::sun::star
;
53 XResultSet_impl::XResultSet_impl(
55 const rtl::OUString
& aUnqPath
,
57 const uno::Sequence
< beans::Property
>& seq
,
58 const uno::Sequence
< ucb::NumberedSortingInfo
>& seqSort
)
59 : m_pMyShell( pMyShell
),
60 m_xProvider( pMyShell
->m_pProvider
),
62 m_nOpenMode( OpenMode
),
63 m_bRowCountFinal( false ),
64 m_aBaseDirectory( aUnqPath
),
65 m_aFolder( aUnqPath
),
67 m_sSortingInfo( seqSort
),
68 m_pDisposeEventListeners( 0 ),
69 m_pRowCountListeners( 0 ),
70 m_pIsFinalListeners( 0 ),
72 m_nErrorCode( TASKHANDLER_NO_ERROR
),
73 m_nMinorErrorCode( TASKHANDLER_NO_ERROR
)
75 osl::FileBase::RC err
= m_aFolder
.open();
76 if( err
!= osl::FileBase::E_None
)
81 m_nErrorCode
= TASKHANDLING_OPEN_FOR_DIRECTORYLISTING
;
82 m_nMinorErrorCode
= err
;
87 m_pMyShell
->registerNotifier( m_aBaseDirectory
,this );
91 XResultSet_impl::~XResultSet_impl()
93 m_pMyShell
->deregisterNotifier( m_aBaseDirectory
,this );
98 delete m_pDisposeEventListeners
;
99 delete m_pRowCountListeners
;
100 delete m_pIsFinalListeners
;
105 sal_Int32 SAL_CALL
XResultSet_impl::CtorSuccess()
112 sal_Int32 SAL_CALL
XResultSet_impl::getMinorError()
114 return m_nMinorErrorCode
;
119 XResultSet_impl::acquire(
123 OWeakObject::acquire();
128 XResultSet_impl::release(
132 OWeakObject::release();
138 XResultSet_impl::queryInterface(
139 const uno::Type
& rType
)
140 throw( uno::RuntimeException
)
142 uno::Any aRet
= cppu::queryInterface(
144 SAL_STATIC_CAST( lang::XComponent
*, this),
145 SAL_STATIC_CAST( lang::XTypeProvider
*, this),
146 SAL_STATIC_CAST( lang::XEventListener
*, this),
147 SAL_STATIC_CAST( sdbc::XRow
*, this),
148 SAL_STATIC_CAST( sdbc::XResultSet
*, this),
149 SAL_STATIC_CAST( sdbc::XCloseable
*, this),
150 SAL_STATIC_CAST( sdbc::XResultSetMetaDataSupplier
*, this),
151 SAL_STATIC_CAST( beans::XPropertySet
*, this ),
152 SAL_STATIC_CAST( ucb::XContentAccess
*, this),
153 SAL_STATIC_CAST( ucb::XDynamicResultSet
*,this) );
154 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( rType
);
159 XResultSet_impl::disposing( const lang::EventObject
& )
160 throw( uno::RuntimeException
)
166 XTYPEPROVIDER_IMPL_10( XResultSet_impl
,
169 lang::XEventListener
,
174 sdbc::XResultSetMetaDataSupplier
,
176 ucb::XContentAccess
)
180 XResultSet_impl::addEventListener(
181 const uno::Reference
< lang::XEventListener
>& Listener
)
182 throw( uno::RuntimeException
)
184 osl::MutexGuard
aGuard( m_aMutex
);
186 if ( ! m_pDisposeEventListeners
)
187 m_pDisposeEventListeners
=
188 new cppu::OInterfaceContainerHelper( m_aEventListenerMutex
);
190 m_pDisposeEventListeners
->addInterface( Listener
);
195 XResultSet_impl::removeEventListener(
196 const uno::Reference
< lang::XEventListener
>& Listener
)
197 throw( uno::RuntimeException
)
199 osl::MutexGuard
aGuard( m_aMutex
);
201 if ( m_pDisposeEventListeners
)
202 m_pDisposeEventListeners
->removeInterface( Listener
);
208 XResultSet_impl::dispose()
209 throw( uno::RuntimeException
)
211 osl::MutexGuard
aGuard( m_aMutex
);
213 lang::EventObject aEvt
;
214 aEvt
.Source
= static_cast< lang::XComponent
* >( this );
216 if ( m_pDisposeEventListeners
&& m_pDisposeEventListeners
->getLength() )
218 m_pDisposeEventListeners
->disposeAndClear( aEvt
);
220 if( m_pRowCountListeners
&& m_pRowCountListeners
->getLength() )
222 m_pRowCountListeners
->disposeAndClear( aEvt
);
224 if( m_pIsFinalListeners
&& m_pIsFinalListeners
->getLength() )
226 m_pIsFinalListeners
->disposeAndClear( aEvt
);
232 void XResultSet_impl::rowCountChanged()
234 sal_Int32 aOldValue
,aNewValue
;
235 uno::Sequence
< uno::Reference
< uno::XInterface
> > seq
;
237 osl::MutexGuard
aGuard( m_aMutex
);
238 if( m_pRowCountListeners
)
239 seq
= m_pRowCountListeners
->getElements();
240 aNewValue
= m_aItems
.size();
241 aOldValue
= aNewValue
-1;
243 beans::PropertyChangeEvent aEv
;
244 aEv
.PropertyName
= rtl::OUString::createFromAscii( "RowCount" );
246 aEv
.PropertyHandle
= -1;
247 aEv
.OldValue
<<= aOldValue
;
248 aEv
.NewValue
<<= aNewValue
;
249 for( sal_Int32 i
= 0; i
< seq
.getLength(); ++i
)
251 uno::Reference
< beans::XPropertyChangeListener
> listener(
252 seq
[i
], uno::UNO_QUERY
);
254 listener
->propertyChange( aEv
);
259 void XResultSet_impl::isFinalChanged()
261 uno::Sequence
< uno::Reference
< XInterface
> > seq
;
263 osl::MutexGuard
aGuard( m_aMutex
);
264 if( m_pIsFinalListeners
)
265 seq
= m_pIsFinalListeners
->getElements();
266 m_bRowCountFinal
= true;
268 beans::PropertyChangeEvent aEv
;
269 aEv
.PropertyName
= rtl::OUString::createFromAscii( "IsRowCountFinal" );
271 aEv
.PropertyHandle
= -1;
272 sal_Bool fval
= false;
273 sal_Bool tval
= true;
274 aEv
.OldValue
<<= fval
;
275 aEv
.NewValue
<<= tval
;
276 for( sal_Int32 i
= 0; i
< seq
.getLength(); ++i
)
278 uno::Reference
< beans::XPropertyChangeListener
> listener(
279 seq
[i
], uno::UNO_QUERY
);
281 listener
->propertyChange( aEv
);
287 XResultSet_impl::OneMore(
289 throw( sdbc::SQLException
,
290 uno::RuntimeException
)
295 osl::FileBase::RC err
;
297 rtl::OUString aUnqPath
;
298 osl::DirectoryItem m_aDirIte
;
299 uno::Reference
< sdbc::XRow
> aRow
;
303 err
= m_aFolder
.getNextItem( m_aDirIte
);
305 if( err
== osl::FileBase::E_NOENT
|| err
== osl::FileBase::E_INVAL
)
309 return ( m_nIsOpen
= false );
311 else if( err
== osl::FileBase::E_None
)
313 aRow
= m_pMyShell
->getv(
314 this, m_sProperty
, m_aDirIte
, aUnqPath
, IsRegular
);
316 if( m_nOpenMode
== ucb::OpenMode::DOCUMENTS
&& IsRegular
)
318 osl::MutexGuard
aGuard( m_aMutex
);
319 m_aItems
.push_back( aRow
);
321 uno::Reference
< ucb::XContentIdentifier
>() );
322 m_aUnqPath
.push_back( aUnqPath
);
327 else if( m_nOpenMode
== ucb::OpenMode::DOCUMENTS
&& ! IsRegular
)
331 else if( m_nOpenMode
== ucb::OpenMode::FOLDERS
&& ! IsRegular
)
333 osl::MutexGuard
aGuard( m_aMutex
);
334 m_aItems
.push_back( aRow
);
336 uno::Reference
< ucb::XContentIdentifier
>() );
337 m_aUnqPath
.push_back( aUnqPath
);
341 else if( m_nOpenMode
== ucb::OpenMode::FOLDERS
&& IsRegular
)
347 osl::MutexGuard
aGuard( m_aMutex
);
348 m_aItems
.push_back( aRow
);
350 uno::Reference
< ucb::XContentIdentifier
>() );
351 m_aUnqPath
.push_back( aUnqPath
);
356 else // error fetching anything
358 throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>(), ::rtl::OUString(), 0, uno::Any() );
368 XResultSet_impl::next(
370 throw( sdbc::SQLException
,
371 uno::RuntimeException
)
374 if( ++m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) ) test
= true;
382 XResultSet_impl::isBeforeFirst(
384 throw( sdbc::SQLException
,
385 uno::RuntimeException
)
392 XResultSet_impl::isAfterLast(
394 throw( sdbc::SQLException
,
395 uno::RuntimeException
)
397 return m_nRow
>= sal::static_int_cast
<sal_Int32
>(m_aItems
.size()); // Cannot happen, if m_aFolder.isOpen()
402 XResultSet_impl::isFirst(
404 throw( sdbc::SQLException
,
405 uno::RuntimeException
)
412 XResultSet_impl::isLast(
414 throw( sdbc::SQLException
,
415 uno::RuntimeException
)
417 if( m_nRow
== sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) - 1 )
425 XResultSet_impl::beforeFirst(
427 throw( sdbc::SQLException
,
428 uno::RuntimeException
)
435 XResultSet_impl::afterLast(
437 throw( sdbc::SQLException
,
438 uno::RuntimeException
)
440 m_nRow
= sal::static_int_cast
<sal_Int32
>(m_aItems
.size());
447 XResultSet_impl::first(
449 throw( sdbc::SQLException
,
450 uno::RuntimeException
)
458 XResultSet_impl::last(
460 throw( sdbc::SQLException
,
461 uno::RuntimeException
)
463 m_nRow
= sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) - 1;
471 XResultSet_impl::getRow(
473 throw( sdbc::SQLException
,
474 uno::RuntimeException
)
476 // Test, whether behind last row
477 if( -1 == m_nRow
|| m_nRow
>= sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
485 sal_Bool SAL_CALL
XResultSet_impl::absolute( sal_Int32 row
)
486 throw( sdbc::SQLException
, uno::RuntimeException
)
491 if( row
>= sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
492 while( row
-- && OneMore() )
498 m_nRow
+= ( row
+ 1 );
503 return 0<= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size());
510 XResultSet_impl::relative(
512 throw( sdbc::SQLException
,
513 uno::RuntimeException
)
515 if( isAfterLast() || isBeforeFirst() )
516 throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>(), ::rtl::OUString(), 0, uno::Any() );
518 while( row
-- ) next();
520 while( row
++ && m_nRow
> - 1 ) previous();
522 return 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size());
528 XResultSet_impl::previous(
530 throw( sdbc::SQLException
,
531 uno::RuntimeException
)
533 if( m_nRow
> sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
534 m_nRow
= sal::static_int_cast
<sal_Int32
>(m_aItems
.size()); // Correct Handling of afterLast
535 if( 0 <= m_nRow
) -- m_nRow
;
537 return 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size());
542 XResultSet_impl::refreshRow(
544 throw( sdbc::SQLException
,
545 uno::RuntimeException
)
547 // get the row from the filesystem
553 XResultSet_impl::rowUpdated(
555 throw( sdbc::SQLException
,
556 uno::RuntimeException
)
562 XResultSet_impl::rowInserted(
564 throw( sdbc::SQLException
,
565 uno::RuntimeException
)
571 XResultSet_impl::rowDeleted(
573 throw( sdbc::SQLException
,
574 uno::RuntimeException
)
580 uno::Reference
< uno::XInterface
> SAL_CALL
581 XResultSet_impl::getStatement(
583 throw( sdbc::SQLException
,
584 uno::RuntimeException
)
586 return uno::Reference
< uno::XInterface
>();
593 XResultSet_impl::close(
595 throw( sdbc::SQLException
,
596 uno::RuntimeException
)
602 osl::MutexGuard
aGuard( m_aMutex
);
609 rtl::OUString SAL_CALL
610 XResultSet_impl::queryContentIdentifierString(
612 throw( uno::RuntimeException
)
614 uno::Reference
< ucb::XContentIdentifier
> xContentId
615 = queryContentIdentifier();
617 if( xContentId
.is() )
618 return xContentId
->getContentIdentifier();
620 return rtl::OUString();
624 uno::Reference
< ucb::XContentIdentifier
> SAL_CALL
625 XResultSet_impl::queryContentIdentifier(
627 throw( uno::RuntimeException
)
629 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
631 if( ! m_aIdents
[m_nRow
].is() )
633 FileContentIdentifier
* p
634 = new FileContentIdentifier( m_pMyShell
,
635 m_aUnqPath
[ m_nRow
] );
636 m_aIdents
[m_nRow
] = uno::Reference
< ucb::XContentIdentifier
>(p
);
638 return m_aIdents
[m_nRow
];
640 return uno::Reference
< ucb::XContentIdentifier
>();
644 uno::Reference
< ucb::XContent
> SAL_CALL
645 XResultSet_impl::queryContent(
647 throw( uno::RuntimeException
)
649 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
650 return m_pMyShell
->m_pProvider
->queryContent( queryContentIdentifier() );
652 return uno::Reference
< ucb::XContent
>();
660 uno::Reference
< sdbc::XResultSet
> SAL_CALL
661 XResultSet_impl::getStaticResultSet()
662 throw( ucb::ListenerAlreadySetException
,
663 uno::RuntimeException
)
665 osl::MutexGuard
aGuard( m_aMutex
);
667 if ( m_xListener
.is() )
668 throw ucb::ListenerAlreadySetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
670 return uno::Reference
< sdbc::XResultSet
>( this );
673 //=========================================================================
676 XResultSet_impl::setListener(
677 const uno::Reference
< ucb::XDynamicResultSetListener
>& Listener
)
678 throw( ucb::ListenerAlreadySetException
,
679 uno::RuntimeException
)
681 osl::ClearableMutexGuard
aGuard( m_aMutex
);
683 if ( m_xListener
.is() )
684 throw ucb::ListenerAlreadySetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
686 m_xListener
= Listener
;
688 //////////////////////////////////////////////////////////////////////
689 // Create "welcome event" and send it to listener.
690 //////////////////////////////////////////////////////////////////////
692 // Note: We only have the implementation for a static result set at the
693 // moment (src590). The dynamic result sets passed to the listener
694 // are a fake. This implementation will never call "notify" at the
695 // listener to propagate any changes!!!
698 aInfo
<<= ucb::WelcomeDynamicResultSetStruct( this, /* "old" */
701 uno::Sequence
< ucb::ListAction
> aActions( 1 );
702 aActions
.getArray()[ 0 ] = ucb::ListAction( 0, // Position; not used
703 0, // Count; not used
704 ucb::ListActionType::WELCOME
,
710 static_cast< cppu::OWeakObject
* >( this ), aActions
) );
713 //=========================================================================
716 XResultSet_impl::connectToCache(
717 const uno::Reference
< ucb::XDynamicResultSet
> & xCache
)
718 throw( ucb::ListenerAlreadySetException
,
719 ucb::AlreadyInitializedException
,
720 ucb::ServiceNotFoundException
,
721 uno::RuntimeException
)
723 uno::Reference
< lang::XMultiServiceFactory
> mxSMgr
724 = m_pMyShell
->m_xMultiServiceFactory
;
726 if( m_xListener
.is() )
727 throw ucb::ListenerAlreadySetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
729 throw ucb::ListenerAlreadySetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
731 uno::Reference
< ucb::XSourceInitialization
> xTarget(
732 xCache
, uno::UNO_QUERY
);
733 if( xTarget
.is() && mxSMgr
.is() )
735 uno::Reference
< ucb::XCachedDynamicResultSetStubFactory
> xStubFactory
;
739 = uno::Reference
< ucb::XCachedDynamicResultSetStubFactory
>(
740 mxSMgr
->createInstance(
741 rtl::OUString::createFromAscii(
742 "com.sun.star.ucb.CachedDynamicResultSetStubFactory" ) ),
745 catch ( uno::Exception
const & )
749 if( xStubFactory
.is() )
751 xStubFactory
->connectToCache(
752 this, xCache
,m_sSortingInfo
, NULL
);
756 throw ucb::ServiceNotFoundException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
759 //=========================================================================
762 XResultSet_impl::getCapabilities()
763 throw( uno::RuntimeException
)
765 // Never set ucb::ContentResultSetCapability::SORTED
766 // - Underlying content cannot provide sorted data...
770 // XResultSetMetaDataSupplier
771 uno::Reference
< sdbc::XResultSetMetaData
> SAL_CALL
772 XResultSet_impl::getMetaData(
774 throw( sdbc::SQLException
,
775 uno::RuntimeException
)
777 for ( sal_Int32 n
= 0; n
< m_sProperty
.getLength(); ++n
)
779 if ( m_sProperty
.getConstArray()[ n
].Name
.compareToAscii( "Title" )
782 // @@@ #82177# - Determine correct value!
783 sal_Bool bCaseSensitiveChildren
= sal_False
;
785 std::vector
< ::ucbhelper::ResultSetColumnData
>
786 aColumnData( m_sProperty
.getLength() );
787 aColumnData
[ n
].isCaseSensitive
= bCaseSensitiveChildren
;
789 ::ucbhelper::ResultSetMetaData
* p
=
790 new ::ucbhelper::ResultSetMetaData(
791 m_pMyShell
->m_xMultiServiceFactory
,
794 return uno::Reference
< sdbc::XResultSetMetaData
>( p
);
798 ::ucbhelper::ResultSetMetaData
* p
=
799 new ::ucbhelper::ResultSetMetaData(
800 m_pMyShell
->m_xMultiServiceFactory
, m_sProperty
);
801 return uno::Reference
< sdbc::XResultSetMetaData
>( p
);
807 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
808 XResultSet_impl::getPropertySetInfo()
809 throw( uno::RuntimeException
)
812 uno::Sequence
< beans::Property
> seq(2);
813 seq
[0].Name
= rtl::OUString::createFromAscii( "RowCount" );
815 seq
[0].Type
= getCppuType( static_cast< sal_Int32
* >(0) );
816 seq
[0].Attributes
= beans::PropertyAttribute::READONLY
;
818 seq
[0].Name
= rtl::OUString::createFromAscii( "IsRowCountFinal" );
820 seq
[0].Type
= getCppuType( static_cast< sal_Bool
* >(0) );
821 seq
[0].Attributes
= beans::PropertyAttribute::READONLY
;
823 XPropertySetInfo_impl
* p
= new XPropertySetInfo_impl( m_pMyShell
,
825 return uno::Reference
< beans::XPropertySetInfo
> ( p
);
830 void SAL_CALL
XResultSet_impl::setPropertyValue(
831 const rtl::OUString
& aPropertyName
, const uno::Any
& )
832 throw( beans::UnknownPropertyException
,
833 beans::PropertyVetoException
,
834 lang::IllegalArgumentException
,
835 lang::WrappedTargetException
,
836 uno::RuntimeException
)
838 if( aPropertyName
== rtl::OUString::createFromAscii( "IsRowCountFinal" ) ||
839 aPropertyName
== rtl::OUString::createFromAscii( "RowCount" ) )
841 throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
845 uno::Any SAL_CALL
XResultSet_impl::getPropertyValue(
846 const rtl::OUString
& PropertyName
)
847 throw( beans::UnknownPropertyException
,
848 lang::WrappedTargetException
,
849 uno::RuntimeException
)
851 if( PropertyName
== rtl::OUString::createFromAscii( "IsRowCountFinal" ) )
854 aAny
<<= m_bRowCountFinal
;
857 else if ( PropertyName
== rtl::OUString::createFromAscii( "RowCount" ) )
860 sal_Int32 count
= sal::static_int_cast
<sal_Int32
>(m_aItems
.size());
865 throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
869 void SAL_CALL
XResultSet_impl::addPropertyChangeListener(
870 const rtl::OUString
& aPropertyName
,
871 const uno::Reference
< beans::XPropertyChangeListener
>& xListener
)
872 throw( beans::UnknownPropertyException
,
873 lang::WrappedTargetException
,
874 uno::RuntimeException
)
876 if( aPropertyName
== rtl::OUString::createFromAscii( "IsRowCountFinal" ) )
878 osl::MutexGuard
aGuard( m_aMutex
);
879 if ( ! m_pIsFinalListeners
)
880 m_pIsFinalListeners
=
881 new cppu::OInterfaceContainerHelper( m_aEventListenerMutex
);
883 m_pIsFinalListeners
->addInterface( xListener
);
885 else if ( aPropertyName
== rtl::OUString::createFromAscii( "RowCount" ) )
887 osl::MutexGuard
aGuard( m_aMutex
);
888 if ( ! m_pRowCountListeners
)
889 m_pRowCountListeners
=
890 new cppu::OInterfaceContainerHelper( m_aEventListenerMutex
);
891 m_pRowCountListeners
->addInterface( xListener
);
894 throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
898 void SAL_CALL
XResultSet_impl::removePropertyChangeListener(
899 const rtl::OUString
& aPropertyName
,
900 const uno::Reference
< beans::XPropertyChangeListener
>& aListener
)
901 throw( beans::UnknownPropertyException
,
902 lang::WrappedTargetException
,
903 uno::RuntimeException
)
905 if( aPropertyName
== rtl::OUString::createFromAscii( "IsRowCountFinal" ) &&
906 m_pIsFinalListeners
)
908 osl::MutexGuard
aGuard( m_aMutex
);
909 m_pIsFinalListeners
->removeInterface( aListener
);
911 else if ( aPropertyName
== rtl::OUString::createFromAscii( "RowCount" ) &&
912 m_pRowCountListeners
)
914 osl::MutexGuard
aGuard( m_aMutex
);
916 m_pRowCountListeners
->removeInterface( aListener
);
919 throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
922 void SAL_CALL
XResultSet_impl::addVetoableChangeListener(
923 const rtl::OUString
&,
924 const uno::Reference
< beans::XVetoableChangeListener
>& )
925 throw( beans::UnknownPropertyException
,
926 lang::WrappedTargetException
,
927 uno::RuntimeException
)
932 void SAL_CALL
XResultSet_impl::removeVetoableChangeListener(
933 const rtl::OUString
&,
934 const uno::Reference
< beans::XVetoableChangeListener
>& )
935 throw( beans::UnknownPropertyException
,
936 lang::WrappedTargetException
,
937 uno::RuntimeException
)