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< uno::XInterface > > 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& r : seq )
162 uno::Reference< beans::XPropertyChangeListener > listener(
165 listener->propertyChange( aEv );
172 std::vector< uno::Reference< XInterface > > seq;
179 beans::PropertyChangeEvent aEv;
180 aEv.PropertyName =
"IsRowCountFinal";
182 aEv.PropertyHandle = -1;
183 aEv.OldValue <<=
false;
184 aEv.NewValue <<=
true;
185 for(
const auto& r : seq )
187 uno::Reference< beans::XPropertyChangeListener > listener(
190 listener->propertyChange( aEv );
201 osl::FileBase::RC
err;
204 osl::DirectoryItem aDirIte;
205 uno::Reference< sdbc::XRow > aRow;
211 if( err == osl::FileBase::E_NOENT || err == osl::FileBase::E_INVAL )
218 else if( err == osl::FileBase::E_None )
228 if(
m_nOpenMode == ucb::OpenMode::DOCUMENTS && IsRegular )
238 else if(
m_nOpenMode == ucb::OpenMode::DOCUMENTS && ! IsRegular )
242 else if(
m_nOpenMode == ucb::OpenMode::FOLDERS && ! IsRegular )
251 else if(
m_nOpenMode == ucb::OpenMode::FOLDERS && IsRegular )
267 throw sdbc::SQLException(
THROW_WHERE, uno::Reference< uno::XInterface >(), OUString(), 0,
uno::Any() );
277 if( ++
m_nRow < sal::static_int_cast<sal_Int32>(
m_aItems.size()) ) test =
true;
294 return m_nRow >= sal::static_int_cast<sal_Int32>(
m_aItems.size());
308 if(
m_nRow == sal::static_int_cast<sal_Int32>(
m_aItems.size()) - 1 )
365 if( row >= sal::static_int_cast<sal_Int32>(
m_aItems.size()) )
377 return 0<=
m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(
m_aItems.size());
385 throw sdbc::SQLException(
THROW_WHERE, uno::Reference< uno::XInterface >(), OUString(), 0,
uno::Any() );
387 while( row-- )
next();
391 return 0 <=
m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(
m_aItems.size());
402 return 0 <=
m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(
m_aItems.size());
432 uno::Reference< uno::XInterface > SAL_CALL
435 return uno::Reference< uno::XInterface >();
457 uno::Reference< ucb::XContentIdentifier > xContentId
460 if( xContentId.is() )
461 return xContentId->getContentIdentifier();
467 uno::Reference< ucb::XContentIdentifier > SAL_CALL
478 return uno::Reference< ucb::XContentIdentifier >();
482 uno::Reference< ucb::XContent > SAL_CALL
488 return uno::Reference< ucb::XContent >();
496 uno::Reference< sdbc::XResultSet > SAL_CALL
502 throw ucb::ListenerAlreadySetException(
THROW_WHERE );
504 return uno::Reference< sdbc::XResultSet >( this );
511 const uno::Reference< ucb::XDynamicResultSetListener >& Listener )
513 osl::ClearableMutexGuard aGuard(
m_aMutex );
516 throw ucb::ListenerAlreadySetException(
THROW_WHERE );
530 aInfo <<= ucb::WelcomeDynamicResultSetStruct(
this,
533 uno::Sequence< ucb::ListAction > aActions( 1 );
534 aActions.getArray()[ 0 ] = ucb::ListAction( 0,
536 ucb::ListActionType::WELCOME,
542 static_cast< cppu::OWeakObject * >(
this ), aActions ) );
549 const uno::Reference< ucb::XDynamicResultSet > & xCache )
552 throw ucb::ListenerAlreadySetException(
THROW_WHERE );
554 uno::Reference< ucb::XSourceInitialization >
xTarget(
555 xCache, uno::UNO_QUERY );
558 uno::Reference< ucb::XCachedDynamicResultSetStubFactory > xStubFactory;
562 = ucb::CachedDynamicResultSetStubFactory::create(
565 catch ( uno::Exception
const & )
569 if( xStubFactory.is() )
571 xStubFactory->connectToCache(
576 throw ucb::ServiceNotFoundException(
THROW_WHERE );
590 uno::Reference< sdbc::XResultSetMetaData > SAL_CALL
594 [](
const beans::Property& rProp) {
return rProp.Name ==
"Title"; });
597 std::vector< ::ucbhelper::ResultSetColumnData >
601 aColumnData[ n ].isCaseSensitive =
false;
603 return new ::ucbhelper::ResultSetMetaData(
614 uno::Reference< beans::XPropertySetInfo > SAL_CALL
618 uno::Sequence< beans::Property > seq(2);
619 seq[0].Name =
"RowCount";
622 seq[0].Attributes = beans::PropertyAttribute::READONLY;
624 seq[1].Name =
"IsRowCountFinal";
627 seq[1].Attributes = beans::PropertyAttribute::READONLY;
634 const OUString& aPropertyName,
const uno::Any& )
636 if( aPropertyName ==
"IsRowCountFinal" ||
637 aPropertyName ==
"RowCount" )
639 throw beans::UnknownPropertyException( aPropertyName );
644 const OUString& PropertyName )
646 if( PropertyName ==
"IsRowCountFinal" )
650 else if ( PropertyName ==
"RowCount" )
652 sal_Int32
count = sal::static_int_cast<sal_Int32>(
m_aItems.size());
656 throw beans::UnknownPropertyException( PropertyName );
661 const OUString& aPropertyName,
662 const uno::Reference< beans::XPropertyChangeListener >& xListener )
664 if( aPropertyName ==
"IsRowCountFinal" )
673 else if ( aPropertyName ==
"RowCount" )
682 throw beans::UnknownPropertyException( aPropertyName );
687 const OUString& aPropertyName,
688 const uno::Reference< beans::XPropertyChangeListener >& aListener )
690 if( aPropertyName ==
"IsRowCountFinal" &&
696 else if ( aPropertyName ==
"RowCount" &&
704 throw beans::UnknownPropertyException( aPropertyName );
709 const uno::Reference< beans::XVetoableChangeListener >& )
716 const uno::Reference< beans::XVetoableChangeListener >& )
const size_t count(pCandidateA->getBorderLines().size())
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
virtual sal_Bool SAL_CALL isLast() override
std::unique_ptr< comphelper::OInterfaceContainerHelper2 > m_pIsFinalListeners
css::uno::Sequence< css::ucb::NumberedSortingInfo > m_sSortingInfo
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
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
std::unique_ptr< comphelper::OInterfaceContainerHelper2 > m_pRowCountListeners
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
std::unique_ptr< comphelper::OInterfaceContainerHelper2 > m_pDisposeEventListeners
osl::Mutex m_aEventListenerMutex
virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override