1*2f86921cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2f86921cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2f86921cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2f86921cSAndrew Rist * distributed with this work for additional information 6*2f86921cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2f86921cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2f86921cSAndrew Rist * "License"); you may not use this file except in compliance 9*2f86921cSAndrew Rist * with the License. You may obtain a copy of the License at 10*2f86921cSAndrew Rist * 11*2f86921cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2f86921cSAndrew Rist * 13*2f86921cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2f86921cSAndrew Rist * software distributed under the License is distributed on an 15*2f86921cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2f86921cSAndrew Rist * KIND, either express or implied. See the License for the 17*2f86921cSAndrew Rist * specific language governing permissions and limitations 18*2f86921cSAndrew Rist * under the License. 19*2f86921cSAndrew Rist * 20*2f86921cSAndrew Rist *************************************************************/ 21*2f86921cSAndrew Rist 22*2f86921cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_ucb.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir /************************************************************************** 28cdf0e10cSrcweir TODO 29cdf0e10cSrcweir ************************************************************************** 30cdf0e10cSrcweir 31cdf0e10cSrcweir *************************************************************************/ 32cdf0e10cSrcweir #include <osl/diagnose.h> 33cdf0e10cSrcweir #include <com/sun/star/ucb/OpenMode.hpp> 34cdf0e10cSrcweir #include <ucbhelper/contentidentifier.hxx> 35cdf0e10cSrcweir #include <ucbhelper/providerhelper.hxx> 36cdf0e10cSrcweir #include "webdavdatasupplier.hxx" 37cdf0e10cSrcweir #include "webdavcontent.hxx" 38cdf0e10cSrcweir #include "ContentProperties.hxx" 39cdf0e10cSrcweir #ifndef _WEBDAV_SESSION_HXX 40cdf0e10cSrcweir #include "DAVSession.hxx" 41cdf0e10cSrcweir #endif 42cdf0e10cSrcweir #include "NeonUri.hxx" 43cdf0e10cSrcweir 44cdf0e10cSrcweir using namespace com::sun::star; 45cdf0e10cSrcweir using namespace webdav_ucp; 46cdf0e10cSrcweir 47cdf0e10cSrcweir namespace webdav_ucp 48cdf0e10cSrcweir { 49cdf0e10cSrcweir 50cdf0e10cSrcweir //========================================================================= 51cdf0e10cSrcweir // 52cdf0e10cSrcweir // struct ResultListEntry. 53cdf0e10cSrcweir // 54cdf0e10cSrcweir //========================================================================= 55cdf0e10cSrcweir 56cdf0e10cSrcweir struct ResultListEntry 57cdf0e10cSrcweir { 58cdf0e10cSrcweir rtl::OUString aId; 59cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId; 60cdf0e10cSrcweir uno::Reference< ucb::XContent > xContent; 61cdf0e10cSrcweir uno::Reference< sdbc::XRow > xRow; 62cdf0e10cSrcweir const ContentProperties* pData; 63cdf0e10cSrcweir 64cdf0e10cSrcweir ResultListEntry( const ContentProperties* pEntry ) : pData( pEntry ) {}; 65cdf0e10cSrcweir ~ResultListEntry() { delete pData; } 66cdf0e10cSrcweir }; 67cdf0e10cSrcweir 68cdf0e10cSrcweir //========================================================================= 69cdf0e10cSrcweir // 70cdf0e10cSrcweir // ResultList. 71cdf0e10cSrcweir // 72cdf0e10cSrcweir //========================================================================= 73cdf0e10cSrcweir 74cdf0e10cSrcweir typedef std::vector< ResultListEntry* > ResultList; 75cdf0e10cSrcweir 76cdf0e10cSrcweir //========================================================================= 77cdf0e10cSrcweir // 78cdf0e10cSrcweir // struct DataSupplier_Impl. 79cdf0e10cSrcweir // 80cdf0e10cSrcweir //========================================================================= 81cdf0e10cSrcweir 82cdf0e10cSrcweir struct DataSupplier_Impl 83cdf0e10cSrcweir { 84cdf0e10cSrcweir osl::Mutex m_aMutex; 85cdf0e10cSrcweir ResultList m_aResults; 86cdf0e10cSrcweir rtl::Reference< Content > m_xContent; 87cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > m_xSMgr; 88cdf0e10cSrcweir sal_Int32 m_nOpenMode; 89cdf0e10cSrcweir sal_Bool m_bCountFinal; 90cdf0e10cSrcweir sal_Bool m_bThrowException; 91cdf0e10cSrcweir 92cdf0e10cSrcweir DataSupplier_Impl( 93cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory >& rxSMgr, 94cdf0e10cSrcweir const rtl::Reference< Content >& rContent, 95cdf0e10cSrcweir sal_Int32 nOpenMode ) 96cdf0e10cSrcweir : m_xContent( rContent ), m_xSMgr( rxSMgr ), m_nOpenMode( nOpenMode ), 97cdf0e10cSrcweir m_bCountFinal( sal_False ), m_bThrowException( sal_False ) {} 98cdf0e10cSrcweir ~DataSupplier_Impl(); 99cdf0e10cSrcweir }; 100cdf0e10cSrcweir 101cdf0e10cSrcweir //========================================================================= 102cdf0e10cSrcweir DataSupplier_Impl::~DataSupplier_Impl() 103cdf0e10cSrcweir { 104cdf0e10cSrcweir ResultList::const_iterator it = m_aResults.begin(); 105cdf0e10cSrcweir ResultList::const_iterator end = m_aResults.end(); 106cdf0e10cSrcweir 107cdf0e10cSrcweir while ( it != end ) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir delete (*it); 110cdf0e10cSrcweir it++; 111cdf0e10cSrcweir } 112cdf0e10cSrcweir } 113cdf0e10cSrcweir 114cdf0e10cSrcweir } 115cdf0e10cSrcweir 116cdf0e10cSrcweir //========================================================================= 117cdf0e10cSrcweir //========================================================================= 118cdf0e10cSrcweir // 119cdf0e10cSrcweir // DataSupplier Implementation. 120cdf0e10cSrcweir // 121cdf0e10cSrcweir //========================================================================= 122cdf0e10cSrcweir //========================================================================= 123cdf0e10cSrcweir 124cdf0e10cSrcweir DataSupplier::DataSupplier( 125cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory >& rxSMgr, 126cdf0e10cSrcweir const rtl::Reference< Content >& rContent, 127cdf0e10cSrcweir sal_Int32 nOpenMode ) 128cdf0e10cSrcweir : m_pImpl( new DataSupplier_Impl( rxSMgr, rContent, nOpenMode ) ) 129cdf0e10cSrcweir { 130cdf0e10cSrcweir } 131cdf0e10cSrcweir 132cdf0e10cSrcweir //========================================================================= 133cdf0e10cSrcweir // virtual 134cdf0e10cSrcweir DataSupplier::~DataSupplier() 135cdf0e10cSrcweir { 136cdf0e10cSrcweir delete m_pImpl; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir //========================================================================= 140cdf0e10cSrcweir // virtual 141cdf0e10cSrcweir rtl::OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex ) 142cdf0e10cSrcweir { 143cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 144cdf0e10cSrcweir 145cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir rtl::OUString aId = m_pImpl->m_aResults[ nIndex ]->aId; 148cdf0e10cSrcweir if ( aId.getLength() ) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir // Already cached. 151cdf0e10cSrcweir return aId; 152cdf0e10cSrcweir } 153cdf0e10cSrcweir } 154cdf0e10cSrcweir 155cdf0e10cSrcweir if ( getResult( nIndex ) ) 156cdf0e10cSrcweir { 157cdf0e10cSrcweir rtl::OUString aId = m_pImpl->m_xContent->getResourceAccess().getURL(); 158cdf0e10cSrcweir 159cdf0e10cSrcweir const ContentProperties& props 160cdf0e10cSrcweir = *( m_pImpl->m_aResults[ nIndex ]->pData ); 161cdf0e10cSrcweir 162cdf0e10cSrcweir if ( ( aId.lastIndexOf( '/' ) + 1 ) != aId.getLength() ) 163cdf0e10cSrcweir aId += rtl::OUString::createFromAscii( "/" ); 164cdf0e10cSrcweir 165cdf0e10cSrcweir aId += props.getEscapedTitle(); 166cdf0e10cSrcweir 167cdf0e10cSrcweir if ( props.isTrailingSlash() ) 168cdf0e10cSrcweir aId += rtl::OUString::createFromAscii( "/" ); 169cdf0e10cSrcweir 170cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->aId = aId; 171cdf0e10cSrcweir return aId; 172cdf0e10cSrcweir } 173cdf0e10cSrcweir return rtl::OUString(); 174cdf0e10cSrcweir } 175cdf0e10cSrcweir 176cdf0e10cSrcweir //========================================================================= 177cdf0e10cSrcweir // virtual 178cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > 179cdf0e10cSrcweir DataSupplier::queryContentIdentifier( sal_uInt32 nIndex ) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 182cdf0e10cSrcweir 183cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 184cdf0e10cSrcweir { 185cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId 186cdf0e10cSrcweir = m_pImpl->m_aResults[ nIndex ]->xId; 187cdf0e10cSrcweir if ( xId.is() ) 188cdf0e10cSrcweir { 189cdf0e10cSrcweir // Already cached. 190cdf0e10cSrcweir return xId; 191cdf0e10cSrcweir } 192cdf0e10cSrcweir } 193cdf0e10cSrcweir 194cdf0e10cSrcweir rtl::OUString aId = queryContentIdentifierString( nIndex ); 195cdf0e10cSrcweir if ( aId.getLength() ) 196cdf0e10cSrcweir { 197cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId 198cdf0e10cSrcweir = new ::ucbhelper::ContentIdentifier( aId ); 199cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xId = xId; 200cdf0e10cSrcweir return xId; 201cdf0e10cSrcweir } 202cdf0e10cSrcweir return uno::Reference< ucb::XContentIdentifier >(); 203cdf0e10cSrcweir } 204cdf0e10cSrcweir 205cdf0e10cSrcweir //========================================================================= 206cdf0e10cSrcweir // virtual 207cdf0e10cSrcweir uno::Reference< ucb::XContent > 208cdf0e10cSrcweir DataSupplier::queryContent( sal_uInt32 nIndex ) 209cdf0e10cSrcweir { 210cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 211cdf0e10cSrcweir 212cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 213cdf0e10cSrcweir { 214cdf0e10cSrcweir uno::Reference< ucb::XContent > xContent 215cdf0e10cSrcweir = m_pImpl->m_aResults[ nIndex ]->xContent; 216cdf0e10cSrcweir if ( xContent.is() ) 217cdf0e10cSrcweir { 218cdf0e10cSrcweir // Already cached. 219cdf0e10cSrcweir return xContent; 220cdf0e10cSrcweir } 221cdf0e10cSrcweir } 222cdf0e10cSrcweir 223cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId 224cdf0e10cSrcweir = queryContentIdentifier( nIndex ); 225cdf0e10cSrcweir if ( xId.is() ) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir try 228cdf0e10cSrcweir { 229cdf0e10cSrcweir uno::Reference< ucb::XContent > xContent 230cdf0e10cSrcweir = m_pImpl->m_xContent->getProvider()->queryContent( xId ); 231cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xContent = xContent; 232cdf0e10cSrcweir return xContent; 233cdf0e10cSrcweir 234cdf0e10cSrcweir } 235cdf0e10cSrcweir catch ( ucb::IllegalIdentifierException& ) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir } 238cdf0e10cSrcweir } 239cdf0e10cSrcweir return uno::Reference< ucb::XContent >(); 240cdf0e10cSrcweir } 241cdf0e10cSrcweir 242cdf0e10cSrcweir //========================================================================= 243cdf0e10cSrcweir // virtual 244cdf0e10cSrcweir sal_Bool DataSupplier::getResult( sal_uInt32 nIndex ) 245cdf0e10cSrcweir { 246cdf0e10cSrcweir osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 247cdf0e10cSrcweir 248cdf0e10cSrcweir if ( m_pImpl->m_aResults.size() > nIndex ) 249cdf0e10cSrcweir { 250cdf0e10cSrcweir // Result already present. 251cdf0e10cSrcweir return sal_True; 252cdf0e10cSrcweir } 253cdf0e10cSrcweir 254cdf0e10cSrcweir // Obtain values... 255cdf0e10cSrcweir if ( getData() ) 256cdf0e10cSrcweir { 257cdf0e10cSrcweir if ( m_pImpl->m_aResults.size() > nIndex ) 258cdf0e10cSrcweir { 259cdf0e10cSrcweir // Result already present. 260cdf0e10cSrcweir return sal_True; 261cdf0e10cSrcweir } 262cdf0e10cSrcweir } 263cdf0e10cSrcweir 264cdf0e10cSrcweir return sal_False; 265cdf0e10cSrcweir } 266cdf0e10cSrcweir 267cdf0e10cSrcweir //========================================================================= 268cdf0e10cSrcweir // virtual 269cdf0e10cSrcweir sal_uInt32 DataSupplier::totalCount() 270cdf0e10cSrcweir { 271cdf0e10cSrcweir // Obtain values... 272cdf0e10cSrcweir getData(); 273cdf0e10cSrcweir 274cdf0e10cSrcweir return m_pImpl->m_aResults.size(); 275cdf0e10cSrcweir } 276cdf0e10cSrcweir 277cdf0e10cSrcweir //========================================================================= 278cdf0e10cSrcweir // virtual 279cdf0e10cSrcweir sal_uInt32 DataSupplier::currentCount() 280cdf0e10cSrcweir { 281cdf0e10cSrcweir return m_pImpl->m_aResults.size(); 282cdf0e10cSrcweir } 283cdf0e10cSrcweir 284cdf0e10cSrcweir //========================================================================= 285cdf0e10cSrcweir // virtual 286cdf0e10cSrcweir sal_Bool DataSupplier::isCountFinal() 287cdf0e10cSrcweir { 288cdf0e10cSrcweir return m_pImpl->m_bCountFinal; 289cdf0e10cSrcweir } 290cdf0e10cSrcweir 291cdf0e10cSrcweir //========================================================================= 292cdf0e10cSrcweir // virtual 293cdf0e10cSrcweir uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues( 294cdf0e10cSrcweir sal_uInt32 nIndex ) 295cdf0e10cSrcweir { 296cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 297cdf0e10cSrcweir 298cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir uno::Reference< sdbc::XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xRow; 301cdf0e10cSrcweir if ( xRow.is() ) 302cdf0e10cSrcweir { 303cdf0e10cSrcweir // Already cached. 304cdf0e10cSrcweir return xRow; 305cdf0e10cSrcweir } 306cdf0e10cSrcweir } 307cdf0e10cSrcweir 308cdf0e10cSrcweir if ( getResult( nIndex ) ) 309cdf0e10cSrcweir { 310cdf0e10cSrcweir uno::Reference< sdbc::XRow > xRow 311cdf0e10cSrcweir = Content::getPropertyValues( 312cdf0e10cSrcweir m_pImpl->m_xSMgr, 313cdf0e10cSrcweir getResultSet()->getProperties(), 314cdf0e10cSrcweir *(m_pImpl->m_aResults[ nIndex ]->pData), 315cdf0e10cSrcweir rtl::Reference< ::ucbhelper::ContentProviderImplHelper >( 316cdf0e10cSrcweir m_pImpl->m_xContent->getProvider().get() ), 317cdf0e10cSrcweir queryContentIdentifierString( nIndex ) ); 318cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xRow = xRow; 319cdf0e10cSrcweir return xRow; 320cdf0e10cSrcweir } 321cdf0e10cSrcweir 322cdf0e10cSrcweir return uno::Reference< sdbc::XRow >(); 323cdf0e10cSrcweir } 324cdf0e10cSrcweir 325cdf0e10cSrcweir //========================================================================= 326cdf0e10cSrcweir // virtual 327cdf0e10cSrcweir void DataSupplier::releasePropertyValues( sal_uInt32 nIndex ) 328cdf0e10cSrcweir { 329cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 330cdf0e10cSrcweir 331cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 332cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xRow = uno::Reference< sdbc::XRow >(); 333cdf0e10cSrcweir } 334cdf0e10cSrcweir 335cdf0e10cSrcweir //========================================================================= 336cdf0e10cSrcweir // virtual 337cdf0e10cSrcweir void DataSupplier::close() 338cdf0e10cSrcweir { 339cdf0e10cSrcweir } 340cdf0e10cSrcweir 341cdf0e10cSrcweir //========================================================================= 342cdf0e10cSrcweir // virtual 343cdf0e10cSrcweir void DataSupplier::validate() 344cdf0e10cSrcweir throw( ucb::ResultSetException ) 345cdf0e10cSrcweir { 346cdf0e10cSrcweir if ( m_pImpl->m_bThrowException ) 347cdf0e10cSrcweir throw ucb::ResultSetException(); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir 350cdf0e10cSrcweir //========================================================================= 351cdf0e10cSrcweir sal_Bool DataSupplier::getData() 352cdf0e10cSrcweir { 353cdf0e10cSrcweir osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 354cdf0e10cSrcweir 355cdf0e10cSrcweir if ( !m_pImpl->m_bCountFinal ) 356cdf0e10cSrcweir { 357cdf0e10cSrcweir std::vector< rtl::OUString > propertyNames; 358cdf0e10cSrcweir ContentProperties::UCBNamesToDAVNames( 359cdf0e10cSrcweir getResultSet()->getProperties(), propertyNames ); 360cdf0e10cSrcweir 361cdf0e10cSrcweir // Append "resourcetype", if not already present. It's value is 362cdf0e10cSrcweir // needed to get a valid ContentProperties::pIsFolder value, which 363cdf0e10cSrcweir // is needed for OpenMode handling. 364cdf0e10cSrcweir 365cdf0e10cSrcweir std::vector< rtl::OUString >::const_iterator it 366cdf0e10cSrcweir = propertyNames.begin(); 367cdf0e10cSrcweir std::vector< rtl::OUString >::const_iterator end 368cdf0e10cSrcweir = propertyNames.end(); 369cdf0e10cSrcweir 370cdf0e10cSrcweir while ( it != end ) 371cdf0e10cSrcweir { 372cdf0e10cSrcweir if ( (*it).equals( DAVProperties::RESOURCETYPE ) ) 373cdf0e10cSrcweir break; 374cdf0e10cSrcweir 375cdf0e10cSrcweir it++; 376cdf0e10cSrcweir } 377cdf0e10cSrcweir 378cdf0e10cSrcweir if ( it == end ) 379cdf0e10cSrcweir propertyNames.push_back( DAVProperties::RESOURCETYPE ); 380cdf0e10cSrcweir 381cdf0e10cSrcweir std::vector< DAVResource > resources; 382cdf0e10cSrcweir try 383cdf0e10cSrcweir { 384cdf0e10cSrcweir // propfind depth 1, get property values for parent AND for each 385cdf0e10cSrcweir // child 386cdf0e10cSrcweir m_pImpl->m_xContent->getResourceAccess() 387cdf0e10cSrcweir .PROPFIND( DAVONE, 388cdf0e10cSrcweir propertyNames, 389cdf0e10cSrcweir resources, 390cdf0e10cSrcweir getResultSet()->getEnvironment() ); 391cdf0e10cSrcweir } 392cdf0e10cSrcweir catch ( DAVException & ) 393cdf0e10cSrcweir { 394cdf0e10cSrcweir // OSL_ENSURE( sal_False, "PROPFIND : DAVException" ); 395cdf0e10cSrcweir m_pImpl->m_bThrowException = sal_True; 396cdf0e10cSrcweir } 397cdf0e10cSrcweir 398cdf0e10cSrcweir if ( !m_pImpl->m_bThrowException ) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir try 401cdf0e10cSrcweir { 402cdf0e10cSrcweir NeonUri aURI( 403cdf0e10cSrcweir m_pImpl->m_xContent->getResourceAccess().getURL() ); 404cdf0e10cSrcweir rtl::OUString aPath = aURI.GetPath(); 405cdf0e10cSrcweir 406cdf0e10cSrcweir if ( aPath.getStr()[ aPath.getLength() - 1 ] 407cdf0e10cSrcweir == sal_Unicode( '/' ) ) 408cdf0e10cSrcweir aPath = aPath.copy( 0, aPath.getLength() - 1 ); 409cdf0e10cSrcweir 410cdf0e10cSrcweir aPath = NeonUri::unescape( aPath ); 411cdf0e10cSrcweir bool bFoundParent = false; 412cdf0e10cSrcweir 413cdf0e10cSrcweir for ( sal_uInt32 n = 0; n < resources.size(); ++n ) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir const DAVResource & rRes = resources[ n ]; 416cdf0e10cSrcweir 417cdf0e10cSrcweir // Filter parent, which is contained somewhere(!) in 418cdf0e10cSrcweir // the vector. 419cdf0e10cSrcweir if ( !bFoundParent ) 420cdf0e10cSrcweir { 421cdf0e10cSrcweir try 422cdf0e10cSrcweir { 423cdf0e10cSrcweir NeonUri aCurrURI( rRes.uri ); 424cdf0e10cSrcweir rtl::OUString aCurrPath = aCurrURI.GetPath(); 425cdf0e10cSrcweir if ( aCurrPath.getStr()[ 426cdf0e10cSrcweir aCurrPath.getLength() - 1 ] 427cdf0e10cSrcweir == sal_Unicode( '/' ) ) 428cdf0e10cSrcweir aCurrPath 429cdf0e10cSrcweir = aCurrPath.copy( 430cdf0e10cSrcweir 0, 431cdf0e10cSrcweir aCurrPath.getLength() - 1 ); 432cdf0e10cSrcweir 433cdf0e10cSrcweir aCurrPath = NeonUri::unescape( aCurrPath ); 434cdf0e10cSrcweir if ( aPath == aCurrPath ) 435cdf0e10cSrcweir { 436cdf0e10cSrcweir bFoundParent = true; 437cdf0e10cSrcweir continue; 438cdf0e10cSrcweir } 439cdf0e10cSrcweir } 440cdf0e10cSrcweir catch ( DAVException const & ) 441cdf0e10cSrcweir { 442cdf0e10cSrcweir // do nothing, ignore error. continue. 443cdf0e10cSrcweir } 444cdf0e10cSrcweir } 445cdf0e10cSrcweir 446cdf0e10cSrcweir ContentProperties* pContentProperties 447cdf0e10cSrcweir = new ContentProperties( rRes ); 448cdf0e10cSrcweir 449cdf0e10cSrcweir // Check resource against open mode. 450cdf0e10cSrcweir switch ( m_pImpl->m_nOpenMode ) 451cdf0e10cSrcweir { 452cdf0e10cSrcweir case ucb::OpenMode::FOLDERS: 453cdf0e10cSrcweir { 454cdf0e10cSrcweir sal_Bool bFolder = sal_False; 455cdf0e10cSrcweir 456cdf0e10cSrcweir const uno::Any & rValue 457cdf0e10cSrcweir = pContentProperties->getValue( 458cdf0e10cSrcweir rtl::OUString( 459cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 460cdf0e10cSrcweir "IsFolder" ) ) ); 461cdf0e10cSrcweir rValue >>= bFolder; 462cdf0e10cSrcweir 463cdf0e10cSrcweir if ( !bFolder ) 464cdf0e10cSrcweir continue; 465cdf0e10cSrcweir 466cdf0e10cSrcweir break; 467cdf0e10cSrcweir } 468cdf0e10cSrcweir 469cdf0e10cSrcweir case ucb::OpenMode::DOCUMENTS: 470cdf0e10cSrcweir { 471cdf0e10cSrcweir sal_Bool bDocument = sal_False; 472cdf0e10cSrcweir 473cdf0e10cSrcweir const uno::Any & rValue 474cdf0e10cSrcweir = pContentProperties->getValue( 475cdf0e10cSrcweir rtl::OUString( 476cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 477cdf0e10cSrcweir "IsDocument" ) ) ); 478cdf0e10cSrcweir rValue >>= bDocument; 479cdf0e10cSrcweir 480cdf0e10cSrcweir if ( !bDocument ) 481cdf0e10cSrcweir continue; 482cdf0e10cSrcweir 483cdf0e10cSrcweir break; 484cdf0e10cSrcweir } 485cdf0e10cSrcweir 486cdf0e10cSrcweir case ucb::OpenMode::ALL: 487cdf0e10cSrcweir default: 488cdf0e10cSrcweir break; 489cdf0e10cSrcweir } 490cdf0e10cSrcweir 491cdf0e10cSrcweir m_pImpl->m_aResults.push_back( 492cdf0e10cSrcweir new ResultListEntry( pContentProperties ) ); 493cdf0e10cSrcweir } 494cdf0e10cSrcweir } 495cdf0e10cSrcweir catch ( DAVException const & ) 496cdf0e10cSrcweir { 497cdf0e10cSrcweir } 498cdf0e10cSrcweir } 499cdf0e10cSrcweir 500cdf0e10cSrcweir m_pImpl->m_bCountFinal = sal_True; 501cdf0e10cSrcweir 502cdf0e10cSrcweir // Callback possible, because listeners may be informed! 503cdf0e10cSrcweir aGuard.clear(); 504cdf0e10cSrcweir getResultSet()->rowCountFinal(); 505cdf0e10cSrcweir } 506cdf0e10cSrcweir return !m_pImpl->m_bThrowException; 507cdf0e10cSrcweir } 508cdf0e10cSrcweir 509