23#include <com/sun/star/sdbc/SQLException.hpp>
24#include <com/sun/star/ucb/ListenerAlreadySetException.hpp>
25#include <com/sun/star/ucb/ServiceNotFoundException.hpp>
26#include <com/sun/star/ucb/WelcomeDynamicResultSetStruct.hpp>
31#include <com/sun/star/ucb/OpenMode.hpp>
33#include <com/sun/star/uno/Reference.h>
35#include <com/sun/star/beans/PropertyAttribute.hpp>
36#include <com/sun/star/ucb/ListActionType.hpp>
37#include <com/sun/star/ucb/XSourceInitialization.hpp>
38#include <com/sun/star/ucb/CachedDynamicResultSetStubFactory.hpp>
44#if OSL_DEBUG_LEVEL > 0
45#define THROW_WHERE SAL_WHERE
51 const OUString& aUnqPath,
53 const uno::Sequence< beans::Property >& seq,
54 const uno::Sequence< ucb::NumberedSortingInfo >& seqSort )
55 : m_pMyShell( pMyShell )
57 , m_nWasNull ( false )
58 , m_nOpenMode( OpenMode )
59 , m_bRowCountFinal( false )
60 , m_aBaseDirectory( aUnqPath )
61 , m_aFolder( aUnqPath )
63 , m_sSortingInfo( seqSort )
68 if(
err != osl::FileBase::E_None )
97 const uno::Reference< lang::XEventListener >& Listener )
107 const uno::Reference< lang::XEventListener >& Listener )
109 std::unique_lock aGuard(
m_aMutex );
118 std::unique_lock aGuard(
m_aMutex );
120 lang::EventObject aEvt;
121 aEvt.Source =
static_cast< lang::XComponent *
>( this );
131 sal_Int32 aOldValue,aNewValue;
134 aOldValue = aNewValue-1;
135 beans::PropertyChangeEvent aEv;
136 aEv.PropertyName =
"RowCount";
138 aEv.PropertyHandle = -1;
139 aEv.OldValue <<= aOldValue;
140 aEv.NewValue <<= aNewValue;
141 for(
const auto& listener : seq )
142 listener->propertyChange( aEv );
148 std::vector< uno::Reference< beans::XPropertyChangeListener > > seq;
150 std::unique_lock aGuard(
m_aMutex );
154 beans::PropertyChangeEvent aEv;
155 aEv.PropertyName =
"IsRowCountFinal";
157 aEv.PropertyHandle = -1;
158 aEv.OldValue <<=
false;
159 aEv.NewValue <<=
true;
160 for(
const auto& listener : seq )
161 listener->propertyChange( aEv );
171 osl::FileBase::RC
err;
174 osl::DirectoryItem aDirIte;
175 uno::Reference< sdbc::XRow > aRow;
181 if(
err == osl::FileBase::E_NOENT ||
err == osl::FileBase::E_INVAL )
188 else if(
err == osl::FileBase::E_None )
198 if(
m_nOpenMode == ucb::OpenMode::DOCUMENTS && IsRegular )
200 std::unique_lock aGuard(
m_aMutex );
208 else if(
m_nOpenMode == ucb::OpenMode::DOCUMENTS && ! IsRegular )
212 else if(
m_nOpenMode == ucb::OpenMode::FOLDERS && ! IsRegular )
214 std::unique_lock aGuard(
m_aMutex );
221 else if(
m_nOpenMode == ucb::OpenMode::FOLDERS && IsRegular )
227 std::unique_lock aGuard(
m_aMutex );
237 throw sdbc::SQLException(
THROW_WHERE, uno::Reference< uno::XInterface >(), OUString(), 0,
uno::Any() );
264 return m_nRow >= sal::static_int_cast<sal_Int32>(
m_aItems.size());
278 if(
m_nRow == sal::static_int_cast<sal_Int32>(
m_aItems.size()) - 1 )
335 if( row >= sal::static_int_cast<sal_Int32>(
m_aItems.size()) )
347 return 0<=
m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(
m_aItems.size());
355 throw sdbc::SQLException(
THROW_WHERE, uno::Reference< uno::XInterface >(), OUString(), 0,
uno::Any() );
357 while( row-- )
next();
361 return 0 <=
m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(
m_aItems.size());
372 return 0 <=
m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(
m_aItems.size());
402uno::Reference< uno::XInterface > SAL_CALL
405 return uno::Reference< uno::XInterface >();
418 std::unique_lock aGuard(
m_aMutex );
427 uno::Reference< ucb::XContentIdentifier > xContentId
430 if( xContentId.is() )
431 return xContentId->getContentIdentifier();
437uno::Reference< ucb::XContentIdentifier > SAL_CALL
448 return uno::Reference< ucb::XContentIdentifier >();
452uno::Reference< ucb::XContent > SAL_CALL
458 return uno::Reference< ucb::XContent >();
466uno::Reference< sdbc::XResultSet > SAL_CALL
469 std::unique_lock aGuard(
m_aMutex );
472 throw ucb::ListenerAlreadySetException(
THROW_WHERE );
474 return uno::Reference< sdbc::XResultSet >(
this );
481 const uno::Reference< ucb::XDynamicResultSetListener >& Listener )
483 std::unique_lock aGuard(
m_aMutex );
486 throw ucb::ListenerAlreadySetException(
THROW_WHERE );
500 aInfo <<= ucb::WelcomeDynamicResultSetStruct(
this,
503 uno::Sequence< ucb::ListAction > aActions( 1 );
504 aActions.getArray()[ 0 ] = ucb::ListAction( 0,
506 ucb::ListActionType::WELCOME,
512 getXWeak(), aActions ) );
519 const uno::Reference< ucb::XDynamicResultSet > & xCache )
522 throw ucb::ListenerAlreadySetException(
THROW_WHERE );
524 uno::Reference< ucb::XSourceInitialization >
xTarget(
525 xCache, uno::UNO_QUERY );
528 uno::Reference< ucb::XCachedDynamicResultSetStubFactory > xStubFactory;
532 = ucb::CachedDynamicResultSetStubFactory::create(
535 catch ( uno::Exception
const & )
539 if( xStubFactory.is() )
541 xStubFactory->connectToCache(
546 throw ucb::ServiceNotFoundException(
THROW_WHERE );
560uno::Reference< sdbc::XResultSetMetaData > SAL_CALL
564 [](
const beans::Property& rProp) {
return rProp.Name ==
"Title"; });
567 std::vector< ::ucbhelper::ResultSetColumnData >
569 auto n = std::distance(std::cbegin(
m_sProperty), pProp);
571 aColumnData[
n ].isCaseSensitive =
false;
573 return new ::ucbhelper::ResultSetMetaData(
576 std::move(aColumnData) );
584uno::Reference< beans::XPropertySetInfo > SAL_CALL
588 uno::Sequence< beans::Property > seq
599 const OUString& aPropertyName,
const uno::Any& )
601 if( aPropertyName ==
"IsRowCountFinal" ||
602 aPropertyName ==
"RowCount" )
604 throw beans::UnknownPropertyException( aPropertyName );
609 const OUString& PropertyName )
611 if( PropertyName ==
"IsRowCountFinal" )
615 else if ( PropertyName ==
"RowCount" )
617 sal_Int32
count = sal::static_int_cast<sal_Int32>(
m_aItems.size());
621 throw beans::UnknownPropertyException( PropertyName );
626 const OUString& aPropertyName,
627 const uno::Reference< beans::XPropertyChangeListener >& xListener )
629 if( aPropertyName ==
"IsRowCountFinal" )
631 std::unique_lock aGuard(
m_aMutex );
635 else if ( aPropertyName ==
"RowCount" )
637 std::unique_lock aGuard(
m_aMutex );
642 throw beans::UnknownPropertyException( aPropertyName );
647 const OUString& aPropertyName,
648 const uno::Reference< beans::XPropertyChangeListener >& aListener )
650 if( aPropertyName ==
"IsRowCountFinal" )
652 std::unique_lock aGuard(
m_aMutex );
656 else if ( aPropertyName ==
"RowCount" )
658 std::unique_lock aGuard(
m_aMutex );
663 throw beans::UnknownPropertyException( aPropertyName );
668 const uno::Reference< beans::XVetoableChangeListener >& )
675 const uno::Reference< beans::XVetoableChangeListener >& )
std::vector< css::uno::Reference< ListenerT > > getElements(std::unique_lock< std::mutex > &rGuard) const
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(::std::unique_lock<::std::mutex > &rGuard, const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
css::uno::Type const & get()
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
FileProvider * m_pProvider
css::uno::Reference< css::sdbc::XRow > getv(sal_Int32 CommandId, const OUString &aUnqPath, const css::uno::Sequence< css::beans::Property > &properties)
Reads the values of the properties belonging to fileURL aUnqPath; Returns an XRow object containing t...
virtual void SAL_CALL refreshRow() override
comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aDisposeEventListeners
css::uno::Reference< css::ucb::XDynamicResultSetListener > m_xListener
virtual sal_Bool SAL_CALL previous() override
virtual ~XResultSet_impl() override
comphelper::OInterfaceContainerHelper4< css::beans::XPropertyChangeListener > m_aIsFinalListeners
virtual sal_Bool SAL_CALL isLast() override
virtual sal_Bool SAL_CALL isAfterLast() override
virtual void SAL_CALL close() override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual sal_Int16 SAL_CALL getCapabilities() override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
css::uno::Sequence< css::beans::Property > m_sProperty
virtual sal_Bool SAL_CALL rowDeleted() override
std::vector< OUString > m_aUnqPath
virtual sal_Bool SAL_CALL last() override
virtual OUString SAL_CALL queryContentIdentifierString() override
virtual void SAL_CALL afterLast() override
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent() override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData() override
void rowCountChanged(std::unique_lock< std::mutex > &)
virtual sal_Bool SAL_CALL rowInserted() override
css::uno::Sequence< css::ucb::NumberedSortingInfo > m_sSortingInfo
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual sal_Bool SAL_CALL isFirst() override
virtual void SAL_CALL beforeFirst() override
virtual sal_Bool SAL_CALL rowUpdated() override
virtual void SAL_CALL dispose() override
virtual sal_Int32 SAL_CALL getRow() override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual sal_Bool SAL_CALL isBeforeFirst() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getStaticResultSet() override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override
const OUString m_aBaseDirectory
virtual void SAL_CALL setListener(const css::uno::Reference< css::ucb::XDynamicResultSetListener > &Listener) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL connectToCache(const css::uno::Reference< css::ucb::XDynamicResultSet > &xCache) override
comphelper::OInterfaceContainerHelper4< css::beans::XPropertyChangeListener > m_aRowCountListeners
virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL queryContentIdentifier() override
virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override
virtual sal_Bool SAL_CALL next() override
sal_Int32 m_nMinorErrorCode
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual sal_Bool SAL_CALL first() override
Reference< XInterface > xTarget
#define TASKHANDLER_NO_ERROR
#define TASKHANDLING_OPEN_FOR_DIRECTORYLISTING
#define SAL_WARN(area, stream)