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
47 #define THROW_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 )
111 const uno::Reference< lang::XEventListener >& Listener )
125 lang::EventObject aEvt;
126 aEvt.Source =
static_cast< lang::XComponent *
>( this );
145 sal_Int32 aOldValue,aNewValue;
146 std::vector< uno::Reference< beans::XPropertyChangeListener > > seq;
152 aOldValue = aNewValue-1;
154 beans::PropertyChangeEvent aEv;
155 aEv.PropertyName =
"RowCount";
157 aEv.PropertyHandle = -1;
158 aEv.OldValue <<= aOldValue;
159 aEv.NewValue <<= aNewValue;
160 for(
const auto& listener : seq )
161 listener->propertyChange( aEv );
167 std::vector< uno::Reference< beans::XPropertyChangeListener > > seq;
174 beans::PropertyChangeEvent aEv;
175 aEv.PropertyName =
"IsRowCountFinal";
177 aEv.PropertyHandle = -1;
178 aEv.OldValue <<=
false;
179 aEv.NewValue <<=
true;
180 for(
const auto& listener : seq )
181 listener->propertyChange( aEv );
191 osl::FileBase::RC
err;
194 osl::DirectoryItem aDirIte;
195 uno::Reference< sdbc::XRow > aRow;
201 if( err == osl::FileBase::E_NOENT || err == osl::FileBase::E_INVAL )
208 else if( err == osl::FileBase::E_None )
218 if(
m_nOpenMode == ucb::OpenMode::DOCUMENTS && IsRegular )
228 else if(
m_nOpenMode == ucb::OpenMode::DOCUMENTS && ! IsRegular )
232 else if(
m_nOpenMode == ucb::OpenMode::FOLDERS && ! IsRegular )
241 else if(
m_nOpenMode == ucb::OpenMode::FOLDERS && IsRegular )
257 throw sdbc::SQLException(
THROW_WHERE, uno::Reference< uno::XInterface >(), OUString(), 0,
uno::Any() );
267 if( ++
m_nRow < sal::static_int_cast<sal_Int32>(
m_aItems.size()) ) test =
true;
284 return m_nRow >= sal::static_int_cast<sal_Int32>(
m_aItems.size());
298 if(
m_nRow == sal::static_int_cast<sal_Int32>(
m_aItems.size()) - 1 )
355 if( row >= sal::static_int_cast<sal_Int32>(
m_aItems.size()) )
367 return 0<=
m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(
m_aItems.size());
375 throw sdbc::SQLException(
THROW_WHERE, uno::Reference< uno::XInterface >(), OUString(), 0,
uno::Any() );
377 while( row-- )
next();
381 return 0 <=
m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(
m_aItems.size());
392 return 0 <=
m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(
m_aItems.size());
422 uno::Reference< uno::XInterface > SAL_CALL
425 return uno::Reference< uno::XInterface >();
447 uno::Reference< ucb::XContentIdentifier > xContentId
450 if( xContentId.is() )
451 return xContentId->getContentIdentifier();
457 uno::Reference< ucb::XContentIdentifier > SAL_CALL
468 return uno::Reference< ucb::XContentIdentifier >();
472 uno::Reference< ucb::XContent > SAL_CALL
478 return uno::Reference< ucb::XContent >();
486 uno::Reference< sdbc::XResultSet > SAL_CALL
492 throw ucb::ListenerAlreadySetException(
THROW_WHERE );
494 return uno::Reference< sdbc::XResultSet >( this );
501 const uno::Reference< ucb::XDynamicResultSetListener >& Listener )
503 osl::ClearableMutexGuard aGuard(
m_aMutex );
506 throw ucb::ListenerAlreadySetException(
THROW_WHERE );
520 aInfo <<= ucb::WelcomeDynamicResultSetStruct(
this,
523 uno::Sequence< ucb::ListAction > aActions( 1 );
524 aActions.getArray()[ 0 ] = ucb::ListAction( 0,
526 ucb::ListActionType::WELCOME,
532 static_cast< cppu::OWeakObject * >(
this ), aActions ) );
539 const uno::Reference< ucb::XDynamicResultSet > & xCache )
542 throw ucb::ListenerAlreadySetException(
THROW_WHERE );
544 uno::Reference< ucb::XSourceInitialization >
xTarget(
545 xCache, uno::UNO_QUERY );
548 uno::Reference< ucb::XCachedDynamicResultSetStubFactory > xStubFactory;
552 = ucb::CachedDynamicResultSetStubFactory::create(
555 catch ( uno::Exception
const & )
559 if( xStubFactory.is() )
561 xStubFactory->connectToCache(
566 throw ucb::ServiceNotFoundException(
THROW_WHERE );
580 uno::Reference< sdbc::XResultSetMetaData > SAL_CALL
584 [](
const beans::Property& rProp) {
return rProp.Name ==
"Title"; });
587 std::vector< ::ucbhelper::ResultSetColumnData >
589 auto n = std::distance(std::cbegin(
m_sProperty), pProp);
591 aColumnData[ n ].isCaseSensitive =
false;
593 return new ::ucbhelper::ResultSetMetaData(
596 std::move(aColumnData) );
604 uno::Reference< beans::XPropertySetInfo > SAL_CALL
608 uno::Sequence< beans::Property > seq
619 const OUString& aPropertyName,
const uno::Any& )
621 if( aPropertyName ==
"IsRowCountFinal" ||
622 aPropertyName ==
"RowCount" )
624 throw beans::UnknownPropertyException( aPropertyName );
629 const OUString& PropertyName )
631 if( PropertyName ==
"IsRowCountFinal" )
635 else if ( PropertyName ==
"RowCount" )
637 sal_Int32
count = sal::static_int_cast<sal_Int32>(
m_aItems.size());
641 throw beans::UnknownPropertyException( PropertyName );
646 const OUString& aPropertyName,
647 const uno::Reference< beans::XPropertyChangeListener >& xListener )
649 if( aPropertyName ==
"IsRowCountFinal" )
658 else if ( aPropertyName ==
"RowCount" )
667 throw beans::UnknownPropertyException( aPropertyName );
672 const OUString& aPropertyName,
673 const uno::Reference< beans::XPropertyChangeListener >& aListener )
675 if( aPropertyName ==
"IsRowCountFinal" &&
681 else if ( aPropertyName ==
"RowCount" &&
689 throw beans::UnknownPropertyException( aPropertyName );
694 const uno::Reference< beans::XVetoableChangeListener >& )
701 const uno::Reference< beans::XVetoableChangeListener >& )
virtual OUString SAL_CALL queryContentIdentifierString() override
virtual sal_Bool SAL_CALL rowDeleted() override
virtual sal_Bool SAL_CALL first() override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
css::uno::Reference< css::ucb::XDynamicResultSetListener > m_xListener
virtual sal_Bool SAL_CALL rowUpdated() override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Reference< XInterface > xTarget
virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData() override
virtual void SAL_CALL close() override
virtual sal_Int32 SAL_CALL getRow() override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getStaticResultSet() override
virtual sal_Int16 SAL_CALL getCapabilities() override
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL queryContentIdentifier() override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
XResultSet_impl(TaskManager *pMyShell, const OUString &aUnqPath, sal_Int32 OpenMode, const css::uno::Sequence< css::beans::Property > &seq, const css::uno::Sequence< css::ucb::NumberedSortingInfo > &seqSort)
virtual sal_Bool SAL_CALL next() override
FileProvider * m_pProvider
std::unique_ptr< comphelper::OInterfaceContainerHelper3< css::lang::XEventListener > > m_pDisposeEventListeners
virtual sal_Bool SAL_CALL isLast() override
std::unique_ptr< comphelper::OInterfaceContainerHelper3< css::beans::XPropertyChangeListener > > m_pRowCountListeners
css::uno::Sequence< css::ucb::NumberedSortingInfo > m_sSortingInfo
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
std::unique_ptr< comphelper::OInterfaceContainerHelper3< css::beans::XPropertyChangeListener > > m_pIsFinalListeners
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual void SAL_CALL dispose() override
#define TASKHANDLING_OPEN_FOR_DIRECTORYLISTING
virtual void SAL_CALL setListener(const css::uno::Reference< css::ucb::XDynamicResultSetListener > &Listener) override
virtual void SAL_CALL beforeFirst() override
virtual sal_Bool SAL_CALL isBeforeFirst() override
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override
css::uno::Type const & get()
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual ~XResultSet_impl() override
virtual sal_Bool SAL_CALL previous() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual void SAL_CALL connectToCache(const css::uno::Reference< css::ucb::XDynamicResultSet > &xCache) override
virtual void SAL_CALL afterLast() override
const OUString m_aBaseDirectory
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
virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override
virtual sal_Bool SAL_CALL isAfterLast() override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
sal_Int32 m_nMinorErrorCode
virtual sal_Bool SAL_CALL last() override
std::vector< OUString > m_aUnqPath
#define SAL_WARN(area, stream)
css::uno::Sequence< css::beans::Property > m_sProperty
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual sal_Bool SAL_CALL isFirst() override
#define TASKHANDLER_NO_ERROR
virtual sal_Bool SAL_CALL rowInserted() override
osl::Mutex m_aEventListenerMutex
virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override
bool m_bDetectedRangeSegmentation false