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 33cdf0e10cSrcweir #include <vector> 34cdf0e10cSrcweir #include <ucbhelper/contentidentifier.hxx> 35cdf0e10cSrcweir #include "hierarchydatasupplier.hxx" 36cdf0e10cSrcweir #include "hierarchyprovider.hxx" 37cdf0e10cSrcweir #include "hierarchycontent.hxx" 38cdf0e10cSrcweir 39cdf0e10cSrcweir using namespace com::sun::star; 40cdf0e10cSrcweir using namespace hierarchy_ucp; 41cdf0e10cSrcweir 42cdf0e10cSrcweir namespace hierarchy_ucp 43cdf0e10cSrcweir { 44cdf0e10cSrcweir 45cdf0e10cSrcweir //========================================================================= 46cdf0e10cSrcweir // 47cdf0e10cSrcweir // struct ResultListEntry. 48cdf0e10cSrcweir // 49cdf0e10cSrcweir //========================================================================= 50cdf0e10cSrcweir 51cdf0e10cSrcweir struct ResultListEntry 52cdf0e10cSrcweir { 53cdf0e10cSrcweir rtl::OUString aId; 54cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId; 55cdf0e10cSrcweir uno::Reference< ucb::XContent > xContent; 56cdf0e10cSrcweir uno::Reference< sdbc::XRow > xRow; 57cdf0e10cSrcweir HierarchyEntryData aData; 58cdf0e10cSrcweir 59cdf0e10cSrcweir ResultListEntry( const HierarchyEntryData& rEntry ) : aData( rEntry ) {} 60cdf0e10cSrcweir }; 61cdf0e10cSrcweir 62cdf0e10cSrcweir //========================================================================= 63cdf0e10cSrcweir // 64cdf0e10cSrcweir // ResultList. 65cdf0e10cSrcweir // 66cdf0e10cSrcweir //========================================================================= 67cdf0e10cSrcweir 68cdf0e10cSrcweir typedef std::vector< ResultListEntry* > ResultList; 69cdf0e10cSrcweir 70cdf0e10cSrcweir //========================================================================= 71cdf0e10cSrcweir // 72cdf0e10cSrcweir // struct DataSupplier_Impl. 73cdf0e10cSrcweir // 74cdf0e10cSrcweir //========================================================================= 75cdf0e10cSrcweir 76cdf0e10cSrcweir struct DataSupplier_Impl 77cdf0e10cSrcweir { 78cdf0e10cSrcweir osl::Mutex m_aMutex; 79cdf0e10cSrcweir ResultList m_aResults; 80cdf0e10cSrcweir rtl::Reference< HierarchyContent > m_xContent; 81cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > m_xSMgr; 82cdf0e10cSrcweir HierarchyEntry m_aFolder; 83cdf0e10cSrcweir HierarchyEntry::iterator m_aIterator; 84cdf0e10cSrcweir sal_Int32 m_nOpenMode; 85cdf0e10cSrcweir sal_Bool m_bCountFinal; 86cdf0e10cSrcweir 87cdf0e10cSrcweir DataSupplier_Impl( 88cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory >& rxSMgr, 89cdf0e10cSrcweir const rtl::Reference< HierarchyContent >& rContent, 90cdf0e10cSrcweir sal_Int32 nOpenMode ) 91cdf0e10cSrcweir : m_xContent( rContent ), m_xSMgr( rxSMgr ), 92cdf0e10cSrcweir m_aFolder( rxSMgr, 93cdf0e10cSrcweir static_cast< HierarchyContentProvider * >( 94cdf0e10cSrcweir rContent->getProvider().get() ), 95cdf0e10cSrcweir rContent->getIdentifier()->getContentIdentifier() ), 96cdf0e10cSrcweir m_nOpenMode( nOpenMode ), m_bCountFinal( sal_False ) {} 97cdf0e10cSrcweir ~DataSupplier_Impl(); 98cdf0e10cSrcweir }; 99cdf0e10cSrcweir 100cdf0e10cSrcweir //========================================================================= 101cdf0e10cSrcweir DataSupplier_Impl::~DataSupplier_Impl() 102cdf0e10cSrcweir { 103cdf0e10cSrcweir ResultList::const_iterator it = m_aResults.begin(); 104cdf0e10cSrcweir ResultList::const_iterator end = m_aResults.end(); 105cdf0e10cSrcweir 106cdf0e10cSrcweir while ( it != end ) 107cdf0e10cSrcweir { 108cdf0e10cSrcweir delete (*it); 109cdf0e10cSrcweir it++; 110cdf0e10cSrcweir } 111cdf0e10cSrcweir } 112cdf0e10cSrcweir 113cdf0e10cSrcweir } 114cdf0e10cSrcweir 115cdf0e10cSrcweir //========================================================================= 116cdf0e10cSrcweir //========================================================================= 117cdf0e10cSrcweir // 118cdf0e10cSrcweir // HierarchyResultSetDataSupplier Implementation. 119cdf0e10cSrcweir // 120cdf0e10cSrcweir //========================================================================= 121cdf0e10cSrcweir //========================================================================= 122cdf0e10cSrcweir 123cdf0e10cSrcweir HierarchyResultSetDataSupplier::HierarchyResultSetDataSupplier( 124cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory >& rxSMgr, 125cdf0e10cSrcweir const rtl::Reference< HierarchyContent >& rContent, 126cdf0e10cSrcweir sal_Int32 nOpenMode ) 127cdf0e10cSrcweir : m_pImpl( new DataSupplier_Impl( rxSMgr, rContent, nOpenMode ) ) 128cdf0e10cSrcweir { 129cdf0e10cSrcweir } 130cdf0e10cSrcweir 131cdf0e10cSrcweir //========================================================================= 132cdf0e10cSrcweir // virtual 133cdf0e10cSrcweir HierarchyResultSetDataSupplier::~HierarchyResultSetDataSupplier() 134cdf0e10cSrcweir { 135cdf0e10cSrcweir delete m_pImpl; 136cdf0e10cSrcweir } 137cdf0e10cSrcweir 138cdf0e10cSrcweir //========================================================================= 139cdf0e10cSrcweir // virtual 140cdf0e10cSrcweir rtl::OUString HierarchyResultSetDataSupplier::queryContentIdentifierString( 141cdf0e10cSrcweir 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 158cdf0e10cSrcweir = m_pImpl->m_xContent->getIdentifier()->getContentIdentifier(); 159cdf0e10cSrcweir 160cdf0e10cSrcweir if ( ( aId.lastIndexOf( '/' ) + 1 ) != aId.getLength() ) 161cdf0e10cSrcweir aId += rtl::OUString::createFromAscii( "/" ); 162cdf0e10cSrcweir 163cdf0e10cSrcweir aId += m_pImpl->m_aResults[ nIndex ]->aData.getName(); 164cdf0e10cSrcweir 165cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->aId = aId; 166cdf0e10cSrcweir return aId; 167cdf0e10cSrcweir } 168cdf0e10cSrcweir return rtl::OUString(); 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir //========================================================================= 172cdf0e10cSrcweir // virtual 173cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > 174cdf0e10cSrcweir HierarchyResultSetDataSupplier::queryContentIdentifier( sal_uInt32 nIndex ) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 177cdf0e10cSrcweir 178cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 179cdf0e10cSrcweir { 180cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId 181cdf0e10cSrcweir = m_pImpl->m_aResults[ nIndex ]->xId; 182cdf0e10cSrcweir if ( xId.is() ) 183cdf0e10cSrcweir { 184cdf0e10cSrcweir // Already cached. 185cdf0e10cSrcweir return xId; 186cdf0e10cSrcweir } 187cdf0e10cSrcweir } 188cdf0e10cSrcweir 189cdf0e10cSrcweir rtl::OUString aId = queryContentIdentifierString( nIndex ); 190cdf0e10cSrcweir if ( aId.getLength() ) 191cdf0e10cSrcweir { 192cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId 193cdf0e10cSrcweir = new ::ucbhelper::ContentIdentifier( aId ); 194cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xId = xId; 195cdf0e10cSrcweir return xId; 196cdf0e10cSrcweir } 197cdf0e10cSrcweir return uno::Reference< ucb::XContentIdentifier >(); 198cdf0e10cSrcweir } 199cdf0e10cSrcweir 200cdf0e10cSrcweir //========================================================================= 201cdf0e10cSrcweir // virtual 202cdf0e10cSrcweir uno::Reference< ucb::XContent > 203cdf0e10cSrcweir HierarchyResultSetDataSupplier::queryContent( sal_uInt32 nIndex ) 204cdf0e10cSrcweir { 205cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 206cdf0e10cSrcweir 207cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 208cdf0e10cSrcweir { 209cdf0e10cSrcweir uno::Reference< ucb::XContent > xContent 210cdf0e10cSrcweir = m_pImpl->m_aResults[ nIndex ]->xContent; 211cdf0e10cSrcweir if ( xContent.is() ) 212cdf0e10cSrcweir { 213cdf0e10cSrcweir // Already cached. 214cdf0e10cSrcweir return xContent; 215cdf0e10cSrcweir } 216cdf0e10cSrcweir } 217cdf0e10cSrcweir 218cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId 219cdf0e10cSrcweir = queryContentIdentifier( nIndex ); 220cdf0e10cSrcweir if ( xId.is() ) 221cdf0e10cSrcweir { 222cdf0e10cSrcweir try 223cdf0e10cSrcweir { 224cdf0e10cSrcweir uno::Reference< ucb::XContent > xContent 225cdf0e10cSrcweir = m_pImpl->m_xContent->getProvider()->queryContent( xId ); 226cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xContent = xContent; 227cdf0e10cSrcweir return xContent; 228cdf0e10cSrcweir 229cdf0e10cSrcweir } 230cdf0e10cSrcweir catch ( ucb::IllegalIdentifierException const & ) 231cdf0e10cSrcweir { 232cdf0e10cSrcweir } 233cdf0e10cSrcweir } 234cdf0e10cSrcweir return uno::Reference< ucb::XContent >(); 235cdf0e10cSrcweir } 236cdf0e10cSrcweir 237cdf0e10cSrcweir //========================================================================= 238cdf0e10cSrcweir // virtual 239cdf0e10cSrcweir sal_Bool HierarchyResultSetDataSupplier::getResult( sal_uInt32 nIndex ) 240cdf0e10cSrcweir { 241cdf0e10cSrcweir osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 242cdf0e10cSrcweir 243cdf0e10cSrcweir if ( m_pImpl->m_aResults.size() > nIndex ) 244cdf0e10cSrcweir { 245cdf0e10cSrcweir // Result already present. 246cdf0e10cSrcweir return sal_True; 247cdf0e10cSrcweir } 248cdf0e10cSrcweir 249cdf0e10cSrcweir // Result not (yet) present. 250cdf0e10cSrcweir 251cdf0e10cSrcweir if ( m_pImpl->m_bCountFinal ) 252cdf0e10cSrcweir return sal_False; 253cdf0e10cSrcweir 254cdf0e10cSrcweir // Try to obtain result... 255cdf0e10cSrcweir 256cdf0e10cSrcweir sal_uInt32 nOldCount = m_pImpl->m_aResults.size(); 257cdf0e10cSrcweir sal_Bool bFound = sal_False; 258cdf0e10cSrcweir sal_uInt32 nPos = nOldCount; 259cdf0e10cSrcweir 260cdf0e10cSrcweir while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) ) 261cdf0e10cSrcweir { 262cdf0e10cSrcweir const HierarchyEntryData& rResult = *m_pImpl->m_aIterator; 263cdf0e10cSrcweir if ( checkResult( rResult ) ) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir m_pImpl->m_aResults.push_back( new ResultListEntry( rResult ) ); 266cdf0e10cSrcweir 267cdf0e10cSrcweir if ( nPos == nIndex ) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir // Result obtained. 270cdf0e10cSrcweir bFound = sal_True; 271cdf0e10cSrcweir break; 272cdf0e10cSrcweir } 273cdf0e10cSrcweir } 274cdf0e10cSrcweir nPos++; 275cdf0e10cSrcweir } 276cdf0e10cSrcweir 277cdf0e10cSrcweir if ( !bFound ) 278cdf0e10cSrcweir m_pImpl->m_bCountFinal = sal_True; 279cdf0e10cSrcweir 280cdf0e10cSrcweir rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet().get(); 281cdf0e10cSrcweir if ( xResultSet.is() ) 282cdf0e10cSrcweir { 283cdf0e10cSrcweir // Callbacks follow! 284cdf0e10cSrcweir aGuard.clear(); 285cdf0e10cSrcweir 286cdf0e10cSrcweir if ( nOldCount < m_pImpl->m_aResults.size() ) 287cdf0e10cSrcweir xResultSet->rowCountChanged( 288cdf0e10cSrcweir nOldCount, m_pImpl->m_aResults.size() ); 289cdf0e10cSrcweir 290cdf0e10cSrcweir if ( m_pImpl->m_bCountFinal ) 291cdf0e10cSrcweir xResultSet->rowCountFinal(); 292cdf0e10cSrcweir } 293cdf0e10cSrcweir 294cdf0e10cSrcweir return bFound; 295cdf0e10cSrcweir } 296cdf0e10cSrcweir 297cdf0e10cSrcweir //========================================================================= 298cdf0e10cSrcweir // virtual 299cdf0e10cSrcweir sal_uInt32 HierarchyResultSetDataSupplier::totalCount() 300cdf0e10cSrcweir { 301cdf0e10cSrcweir osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 302cdf0e10cSrcweir 303cdf0e10cSrcweir if ( m_pImpl->m_bCountFinal ) 304cdf0e10cSrcweir return m_pImpl->m_aResults.size(); 305cdf0e10cSrcweir 306cdf0e10cSrcweir sal_uInt32 nOldCount = m_pImpl->m_aResults.size(); 307cdf0e10cSrcweir 308cdf0e10cSrcweir while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) ) 309cdf0e10cSrcweir { 310cdf0e10cSrcweir const HierarchyEntryData& rResult = *m_pImpl->m_aIterator; 311cdf0e10cSrcweir if ( checkResult( rResult ) ) 312cdf0e10cSrcweir m_pImpl->m_aResults.push_back( new ResultListEntry( rResult ) ); 313cdf0e10cSrcweir } 314cdf0e10cSrcweir 315cdf0e10cSrcweir m_pImpl->m_bCountFinal = sal_True; 316cdf0e10cSrcweir 317cdf0e10cSrcweir rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet().get(); 318cdf0e10cSrcweir if ( xResultSet.is() ) 319cdf0e10cSrcweir { 320cdf0e10cSrcweir // Callbacks follow! 321cdf0e10cSrcweir aGuard.clear(); 322cdf0e10cSrcweir 323cdf0e10cSrcweir if ( nOldCount < m_pImpl->m_aResults.size() ) 324cdf0e10cSrcweir xResultSet->rowCountChanged( 325cdf0e10cSrcweir nOldCount, m_pImpl->m_aResults.size() ); 326cdf0e10cSrcweir 327cdf0e10cSrcweir xResultSet->rowCountFinal(); 328cdf0e10cSrcweir } 329cdf0e10cSrcweir 330cdf0e10cSrcweir return m_pImpl->m_aResults.size(); 331cdf0e10cSrcweir } 332cdf0e10cSrcweir 333cdf0e10cSrcweir //========================================================================= 334cdf0e10cSrcweir // virtual 335cdf0e10cSrcweir sal_uInt32 HierarchyResultSetDataSupplier::currentCount() 336cdf0e10cSrcweir { 337cdf0e10cSrcweir return m_pImpl->m_aResults.size(); 338cdf0e10cSrcweir } 339cdf0e10cSrcweir 340cdf0e10cSrcweir //========================================================================= 341cdf0e10cSrcweir // virtual 342cdf0e10cSrcweir sal_Bool HierarchyResultSetDataSupplier::isCountFinal() 343cdf0e10cSrcweir { 344cdf0e10cSrcweir return m_pImpl->m_bCountFinal; 345cdf0e10cSrcweir } 346cdf0e10cSrcweir 347cdf0e10cSrcweir //========================================================================= 348cdf0e10cSrcweir // virtual 349cdf0e10cSrcweir uno::Reference< sdbc::XRow > 350cdf0e10cSrcweir HierarchyResultSetDataSupplier::queryPropertyValues( sal_uInt32 nIndex ) 351cdf0e10cSrcweir { 352cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 353cdf0e10cSrcweir 354cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 355cdf0e10cSrcweir { 356cdf0e10cSrcweir uno::Reference< sdbc::XRow > xRow 357cdf0e10cSrcweir = m_pImpl->m_aResults[ nIndex ]->xRow; 358cdf0e10cSrcweir if ( xRow.is() ) 359cdf0e10cSrcweir { 360cdf0e10cSrcweir // Already cached. 361cdf0e10cSrcweir return xRow; 362cdf0e10cSrcweir } 363cdf0e10cSrcweir } 364cdf0e10cSrcweir 365cdf0e10cSrcweir if ( getResult( nIndex ) ) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir static rtl::OUString aFolderType( 368cdf0e10cSrcweir rtl::OUString::createFromAscii( HIERARCHY_FOLDER_CONTENT_TYPE ) ); 369cdf0e10cSrcweir static rtl::OUString aLinkType( 370cdf0e10cSrcweir rtl::OUString::createFromAscii( HIERARCHY_LINK_CONTENT_TYPE ) ); 371cdf0e10cSrcweir 372cdf0e10cSrcweir HierarchyContentProperties aData( 373cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->aData ); 374cdf0e10cSrcweir 375cdf0e10cSrcweir uno::Reference< sdbc::XRow > xRow 376cdf0e10cSrcweir = HierarchyContent::getPropertyValues( 377cdf0e10cSrcweir m_pImpl->m_xSMgr, 378cdf0e10cSrcweir getResultSet()->getProperties(), 379cdf0e10cSrcweir aData, 380cdf0e10cSrcweir static_cast< HierarchyContentProvider * >( 381cdf0e10cSrcweir m_pImpl->m_xContent->getProvider().get() ), 382cdf0e10cSrcweir queryContentIdentifierString( nIndex ) ); 383cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xRow = xRow; 384cdf0e10cSrcweir return xRow; 385cdf0e10cSrcweir } 386cdf0e10cSrcweir 387cdf0e10cSrcweir return uno::Reference< sdbc::XRow >(); 388cdf0e10cSrcweir } 389cdf0e10cSrcweir 390cdf0e10cSrcweir //========================================================================= 391cdf0e10cSrcweir // virtual 392cdf0e10cSrcweir void HierarchyResultSetDataSupplier::releasePropertyValues( sal_uInt32 nIndex ) 393cdf0e10cSrcweir { 394cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 395cdf0e10cSrcweir 396cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 397cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xRow = uno::Reference< sdbc::XRow >(); 398cdf0e10cSrcweir } 399cdf0e10cSrcweir 400cdf0e10cSrcweir //========================================================================= 401cdf0e10cSrcweir // virtual 402cdf0e10cSrcweir void HierarchyResultSetDataSupplier::close() 403cdf0e10cSrcweir { 404cdf0e10cSrcweir } 405cdf0e10cSrcweir 406cdf0e10cSrcweir //========================================================================= 407cdf0e10cSrcweir // virtual 408cdf0e10cSrcweir void HierarchyResultSetDataSupplier::validate() 409cdf0e10cSrcweir throw( ucb::ResultSetException ) 410cdf0e10cSrcweir { 411cdf0e10cSrcweir } 412cdf0e10cSrcweir 413cdf0e10cSrcweir //========================================================================= 414cdf0e10cSrcweir sal_Bool HierarchyResultSetDataSupplier::checkResult( 415cdf0e10cSrcweir const HierarchyEntryData& rResult ) 416cdf0e10cSrcweir { 417cdf0e10cSrcweir switch ( m_pImpl->m_nOpenMode ) 418cdf0e10cSrcweir { 419cdf0e10cSrcweir case ucb::OpenMode::FOLDERS: 420cdf0e10cSrcweir if ( rResult.getType() == HierarchyEntryData::LINK ) 421cdf0e10cSrcweir { 422cdf0e10cSrcweir // Entry is a link. 423cdf0e10cSrcweir return sal_False; 424cdf0e10cSrcweir } 425cdf0e10cSrcweir break; 426cdf0e10cSrcweir 427cdf0e10cSrcweir case ucb::OpenMode::DOCUMENTS: 428cdf0e10cSrcweir if ( rResult.getType() == HierarchyEntryData::FOLDER ) 429cdf0e10cSrcweir { 430cdf0e10cSrcweir // Entry is a folder. 431cdf0e10cSrcweir return sal_False; 432cdf0e10cSrcweir } 433cdf0e10cSrcweir break; 434cdf0e10cSrcweir 435cdf0e10cSrcweir case ucb::OpenMode::ALL: 436cdf0e10cSrcweir default: 437cdf0e10cSrcweir break; 438cdf0e10cSrcweir } 439cdf0e10cSrcweir 440cdf0e10cSrcweir return sal_True; 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443