12f86921cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 32f86921cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 42f86921cSAndrew Rist * or more contributor license agreements. See the NOTICE file 52f86921cSAndrew Rist * distributed with this work for additional information 62f86921cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 72f86921cSAndrew Rist * to you under the Apache License, Version 2.0 (the 82f86921cSAndrew Rist * "License"); you may not use this file except in compliance 92f86921cSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 112f86921cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 132f86921cSAndrew Rist * Unless required by applicable law or agreed to in writing, 142f86921cSAndrew Rist * software distributed under the License is distributed on an 152f86921cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 162f86921cSAndrew Rist * KIND, either express or implied. See the License for the 172f86921cSAndrew Rist * specific language governing permissions and limitations 182f86921cSAndrew Rist * under the License. 19cdf0e10cSrcweir * 202f86921cSAndrew Rist *************************************************************/ 212f86921cSAndrew Rist 222f86921cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25*421ed02eSdamjan #include "precompiled_tdoc.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir /************************************************************************** 28cdf0e10cSrcweir TODO 29cdf0e10cSrcweir ************************************************************************** 30cdf0e10cSrcweir 31cdf0e10cSrcweir *************************************************************************/ 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include <vector> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include "osl/diagnose.h" 36cdf0e10cSrcweir #include "ucbhelper/contentidentifier.hxx" 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include "tdoc_datasupplier.hxx" 39cdf0e10cSrcweir #include "tdoc_content.hxx" 40cdf0e10cSrcweir 41cdf0e10cSrcweir using namespace com::sun::star; 42cdf0e10cSrcweir using namespace tdoc_ucp; 43cdf0e10cSrcweir 44cdf0e10cSrcweir namespace tdoc_ucp 45cdf0e10cSrcweir { 46cdf0e10cSrcweir 47cdf0e10cSrcweir //========================================================================= 48cdf0e10cSrcweir // 49cdf0e10cSrcweir // struct ResultListEntry. 50cdf0e10cSrcweir // 51cdf0e10cSrcweir //========================================================================= 52cdf0e10cSrcweir 53cdf0e10cSrcweir struct ResultListEntry 54cdf0e10cSrcweir { 55cdf0e10cSrcweir rtl::OUString aURL; 56cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId; 57cdf0e10cSrcweir uno::Reference< ucb::XContent > xContent; 58cdf0e10cSrcweir uno::Reference< sdbc::XRow > xRow; 59cdf0e10cSrcweir 60cdf0e10cSrcweir ResultListEntry( const rtl::OUString& rURL ) : aURL( rURL ) {} 61cdf0e10cSrcweir }; 62cdf0e10cSrcweir 63cdf0e10cSrcweir //========================================================================= 64cdf0e10cSrcweir // 65cdf0e10cSrcweir // ResultList. 66cdf0e10cSrcweir // 67cdf0e10cSrcweir //========================================================================= 68cdf0e10cSrcweir 69cdf0e10cSrcweir typedef std::vector< ResultListEntry* > ResultList; 70cdf0e10cSrcweir 71cdf0e10cSrcweir //========================================================================= 72cdf0e10cSrcweir // 73cdf0e10cSrcweir // struct DataSupplier_Impl. 74cdf0e10cSrcweir // 75cdf0e10cSrcweir //========================================================================= 76cdf0e10cSrcweir 77cdf0e10cSrcweir struct DataSupplier_Impl 78cdf0e10cSrcweir { 79cdf0e10cSrcweir osl::Mutex m_aMutex; 80cdf0e10cSrcweir ResultList m_aResults; 81cdf0e10cSrcweir rtl::Reference< Content > m_xContent; 82cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > m_xSMgr; 83cdf0e10cSrcweir uno::Sequence< rtl::OUString > * m_pNamesOfChildren; 84cdf0e10cSrcweir sal_Int32 m_nOpenMode; 85cdf0e10cSrcweir bool m_bCountFinal; 86cdf0e10cSrcweir bool m_bThrowException; 87cdf0e10cSrcweir 88cdf0e10cSrcweir DataSupplier_Impl( 89cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory >& rxSMgr, 90cdf0e10cSrcweir const rtl::Reference< Content >& rContent, 91cdf0e10cSrcweir sal_Int32 nOpenMode ) 92cdf0e10cSrcweir : m_xContent( rContent ), m_xSMgr( rxSMgr ), 93cdf0e10cSrcweir m_pNamesOfChildren( 0 ), m_nOpenMode( nOpenMode ), 94cdf0e10cSrcweir m_bCountFinal( false ), m_bThrowException( false ) 95cdf0e10cSrcweir {} 96cdf0e10cSrcweir ~DataSupplier_Impl(); 97cdf0e10cSrcweir }; 98cdf0e10cSrcweir 99cdf0e10cSrcweir //========================================================================= 100cdf0e10cSrcweir DataSupplier_Impl::~DataSupplier_Impl() 101cdf0e10cSrcweir { 102cdf0e10cSrcweir ResultList::const_iterator it = m_aResults.begin(); 103cdf0e10cSrcweir ResultList::const_iterator end = m_aResults.end(); 104cdf0e10cSrcweir 105cdf0e10cSrcweir while ( it != end ) 106cdf0e10cSrcweir { 107cdf0e10cSrcweir delete (*it); 108cdf0e10cSrcweir it++; 109cdf0e10cSrcweir } 110cdf0e10cSrcweir 111cdf0e10cSrcweir delete m_pNamesOfChildren; 112cdf0e10cSrcweir } 113cdf0e10cSrcweir 114cdf0e10cSrcweir } 115cdf0e10cSrcweir 116cdf0e10cSrcweir //========================================================================= 117cdf0e10cSrcweir //========================================================================= 118cdf0e10cSrcweir // 119cdf0e10cSrcweir // DataSupplier Implementation. 120cdf0e10cSrcweir // 121cdf0e10cSrcweir //========================================================================= 122cdf0e10cSrcweir //========================================================================= 123cdf0e10cSrcweir 124cdf0e10cSrcweir ResultSetDataSupplier::ResultSetDataSupplier( 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 ResultSetDataSupplier::~ResultSetDataSupplier() 135cdf0e10cSrcweir { 136cdf0e10cSrcweir delete m_pImpl; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir //========================================================================= 140cdf0e10cSrcweir // virtual 141cdf0e10cSrcweir rtl::OUString 142cdf0e10cSrcweir ResultSetDataSupplier::queryContentIdentifierString( sal_uInt32 nIndex ) 143cdf0e10cSrcweir { 144cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 145cdf0e10cSrcweir 146cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 147cdf0e10cSrcweir { 148cdf0e10cSrcweir rtl::OUString aId = m_pImpl->m_aResults[ nIndex ]->aURL; 149cdf0e10cSrcweir if ( aId.getLength() ) 150cdf0e10cSrcweir { 151cdf0e10cSrcweir // Already cached. 152cdf0e10cSrcweir return aId; 153cdf0e10cSrcweir } 154cdf0e10cSrcweir } 155cdf0e10cSrcweir 156cdf0e10cSrcweir if ( getResult( nIndex ) ) 157cdf0e10cSrcweir { 158cdf0e10cSrcweir // Note: getResult fills m_pImpl->m_aResults[ nIndex ]->aURL. 159cdf0e10cSrcweir return m_pImpl->m_aResults[ nIndex ]->aURL; 160cdf0e10cSrcweir } 161cdf0e10cSrcweir return rtl::OUString(); 162cdf0e10cSrcweir } 163cdf0e10cSrcweir 164cdf0e10cSrcweir //========================================================================= 165cdf0e10cSrcweir // virtual 166cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > 167cdf0e10cSrcweir ResultSetDataSupplier::queryContentIdentifier( sal_uInt32 nIndex ) 168cdf0e10cSrcweir { 169cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 170cdf0e10cSrcweir 171cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId 174cdf0e10cSrcweir = m_pImpl->m_aResults[ nIndex ]->xId; 175cdf0e10cSrcweir if ( xId.is() ) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir // Already cached. 178cdf0e10cSrcweir return xId; 179cdf0e10cSrcweir } 180cdf0e10cSrcweir } 181cdf0e10cSrcweir 182cdf0e10cSrcweir rtl::OUString aId = queryContentIdentifierString( nIndex ); 183cdf0e10cSrcweir if ( aId.getLength() ) 184cdf0e10cSrcweir { 185cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId 186cdf0e10cSrcweir = new ::ucbhelper::ContentIdentifier( aId ); 187cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xId = xId; 188cdf0e10cSrcweir return xId; 189cdf0e10cSrcweir } 190cdf0e10cSrcweir return uno::Reference< ucb::XContentIdentifier >(); 191cdf0e10cSrcweir } 192cdf0e10cSrcweir 193cdf0e10cSrcweir //========================================================================= 194cdf0e10cSrcweir // virtual 195cdf0e10cSrcweir uno::Reference< ucb::XContent > 196cdf0e10cSrcweir ResultSetDataSupplier::queryContent( sal_uInt32 nIndex ) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 199cdf0e10cSrcweir 200cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 201cdf0e10cSrcweir { 202cdf0e10cSrcweir uno::Reference< ucb::XContent > xContent 203cdf0e10cSrcweir = m_pImpl->m_aResults[ nIndex ]->xContent; 204cdf0e10cSrcweir if ( xContent.is() ) 205cdf0e10cSrcweir { 206cdf0e10cSrcweir // Already cached. 207cdf0e10cSrcweir return xContent; 208cdf0e10cSrcweir } 209cdf0e10cSrcweir } 210cdf0e10cSrcweir 211cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId 212cdf0e10cSrcweir = queryContentIdentifier( nIndex ); 213cdf0e10cSrcweir if ( xId.is() ) 214cdf0e10cSrcweir { 215cdf0e10cSrcweir try 216cdf0e10cSrcweir { 217cdf0e10cSrcweir uno::Reference< ucb::XContent > xContent 218cdf0e10cSrcweir = m_pImpl->m_xContent->getProvider()->queryContent( xId ); 219cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xContent = xContent; 220cdf0e10cSrcweir return xContent; 221cdf0e10cSrcweir 222cdf0e10cSrcweir } 223cdf0e10cSrcweir catch ( ucb::IllegalIdentifierException const & ) 224cdf0e10cSrcweir { 225cdf0e10cSrcweir } 226cdf0e10cSrcweir } 227cdf0e10cSrcweir return uno::Reference< ucb::XContent >(); 228cdf0e10cSrcweir } 229cdf0e10cSrcweir 230cdf0e10cSrcweir //========================================================================= 231cdf0e10cSrcweir // virtual 232cdf0e10cSrcweir sal_Bool ResultSetDataSupplier::getResult( sal_uInt32 nIndex ) 233cdf0e10cSrcweir { 234cdf0e10cSrcweir osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 235cdf0e10cSrcweir 236cdf0e10cSrcweir if ( m_pImpl->m_aResults.size() > nIndex ) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir // Result already present. 239cdf0e10cSrcweir return sal_True; 240cdf0e10cSrcweir } 241cdf0e10cSrcweir 242cdf0e10cSrcweir // Result not (yet) present. 243cdf0e10cSrcweir 244cdf0e10cSrcweir if ( m_pImpl->m_bCountFinal ) 245cdf0e10cSrcweir return sal_False; 246cdf0e10cSrcweir 247cdf0e10cSrcweir // Try to obtain result... 248cdf0e10cSrcweir 249cdf0e10cSrcweir sal_uInt32 nOldCount = m_pImpl->m_aResults.size(); 250cdf0e10cSrcweir bool bFound = false; 251cdf0e10cSrcweir 252cdf0e10cSrcweir if ( queryNamesOfChildren() ) 253cdf0e10cSrcweir { 254cdf0e10cSrcweir for ( sal_uInt32 n = nOldCount; 255cdf0e10cSrcweir n < sal::static_int_cast<sal_uInt32>( 256cdf0e10cSrcweir m_pImpl->m_pNamesOfChildren->getLength()); 257cdf0e10cSrcweir ++n ) 258cdf0e10cSrcweir { 259cdf0e10cSrcweir const rtl::OUString & rName 260cdf0e10cSrcweir = m_pImpl->m_pNamesOfChildren->getConstArray()[ n ]; 261cdf0e10cSrcweir 262cdf0e10cSrcweir if ( !rName.getLength() ) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir OSL_ENSURE( sal_False, 265cdf0e10cSrcweir "ResultDataSupplier::getResult - Empty name!" ); 266cdf0e10cSrcweir break; 267cdf0e10cSrcweir } 268cdf0e10cSrcweir 269cdf0e10cSrcweir // Assemble URL for child. 270cdf0e10cSrcweir rtl::OUString aURL = assembleChildURL( rName ); 271cdf0e10cSrcweir 272cdf0e10cSrcweir m_pImpl->m_aResults.push_back( new ResultListEntry( aURL ) ); 273cdf0e10cSrcweir 274cdf0e10cSrcweir if ( n == nIndex ) 275cdf0e10cSrcweir { 276cdf0e10cSrcweir // Result obtained. 277cdf0e10cSrcweir bFound = true; 278cdf0e10cSrcweir break; 279cdf0e10cSrcweir } 280cdf0e10cSrcweir } 281cdf0e10cSrcweir } 282cdf0e10cSrcweir 283cdf0e10cSrcweir if ( !bFound ) 284cdf0e10cSrcweir m_pImpl->m_bCountFinal = sal_True; 285cdf0e10cSrcweir 286cdf0e10cSrcweir rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet().get(); 287cdf0e10cSrcweir if ( xResultSet.is() ) 288cdf0e10cSrcweir { 289cdf0e10cSrcweir // Callbacks follow! 290cdf0e10cSrcweir aGuard.clear(); 291cdf0e10cSrcweir 292cdf0e10cSrcweir if ( nOldCount < m_pImpl->m_aResults.size() ) 293cdf0e10cSrcweir xResultSet->rowCountChanged( nOldCount, m_pImpl->m_aResults.size() ); 294cdf0e10cSrcweir 295cdf0e10cSrcweir if ( m_pImpl->m_bCountFinal ) 296cdf0e10cSrcweir xResultSet->rowCountFinal(); 297cdf0e10cSrcweir } 298cdf0e10cSrcweir 299cdf0e10cSrcweir return bFound; 300cdf0e10cSrcweir } 301cdf0e10cSrcweir 302cdf0e10cSrcweir //========================================================================= 303cdf0e10cSrcweir // virtual 304cdf0e10cSrcweir sal_uInt32 ResultSetDataSupplier::totalCount() 305cdf0e10cSrcweir { 306cdf0e10cSrcweir osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 307cdf0e10cSrcweir 308cdf0e10cSrcweir if ( m_pImpl->m_bCountFinal ) 309cdf0e10cSrcweir return m_pImpl->m_aResults.size(); 310cdf0e10cSrcweir 311cdf0e10cSrcweir sal_uInt32 nOldCount = m_pImpl->m_aResults.size(); 312cdf0e10cSrcweir 313cdf0e10cSrcweir if ( queryNamesOfChildren() ) 314cdf0e10cSrcweir { 315cdf0e10cSrcweir for ( sal_uInt32 n = nOldCount; 316cdf0e10cSrcweir n < sal::static_int_cast<sal_uInt32>( 317cdf0e10cSrcweir m_pImpl->m_pNamesOfChildren->getLength()); 318cdf0e10cSrcweir ++n ) 319cdf0e10cSrcweir { 320cdf0e10cSrcweir const rtl::OUString & rName 321cdf0e10cSrcweir = m_pImpl->m_pNamesOfChildren->getConstArray()[ n ]; 322cdf0e10cSrcweir 323cdf0e10cSrcweir if ( !rName.getLength() ) 324cdf0e10cSrcweir { 325cdf0e10cSrcweir OSL_ENSURE( sal_False, 326cdf0e10cSrcweir "ResultDataSupplier::getResult - Empty name!" ); 327cdf0e10cSrcweir break; 328cdf0e10cSrcweir } 329cdf0e10cSrcweir 330cdf0e10cSrcweir // Assemble URL for child. 331cdf0e10cSrcweir rtl::OUString aURL = assembleChildURL( rName ); 332cdf0e10cSrcweir 333cdf0e10cSrcweir m_pImpl->m_aResults.push_back( new ResultListEntry( aURL ) ); 334cdf0e10cSrcweir } 335cdf0e10cSrcweir } 336cdf0e10cSrcweir 337cdf0e10cSrcweir m_pImpl->m_bCountFinal = sal_True; 338cdf0e10cSrcweir 339cdf0e10cSrcweir rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet().get(); 340cdf0e10cSrcweir if ( xResultSet.is() ) 341cdf0e10cSrcweir { 342cdf0e10cSrcweir // Callbacks follow! 343cdf0e10cSrcweir aGuard.clear(); 344cdf0e10cSrcweir 345cdf0e10cSrcweir if ( nOldCount < m_pImpl->m_aResults.size() ) 346cdf0e10cSrcweir xResultSet->rowCountChanged( nOldCount, m_pImpl->m_aResults.size() ); 347cdf0e10cSrcweir 348cdf0e10cSrcweir xResultSet->rowCountFinal(); 349cdf0e10cSrcweir } 350cdf0e10cSrcweir 351cdf0e10cSrcweir return m_pImpl->m_aResults.size(); 352cdf0e10cSrcweir } 353cdf0e10cSrcweir 354cdf0e10cSrcweir //========================================================================= 355cdf0e10cSrcweir // virtual 356cdf0e10cSrcweir sal_uInt32 ResultSetDataSupplier::currentCount() 357cdf0e10cSrcweir { 358cdf0e10cSrcweir return m_pImpl->m_aResults.size(); 359cdf0e10cSrcweir } 360cdf0e10cSrcweir 361cdf0e10cSrcweir //========================================================================= 362cdf0e10cSrcweir // virtual 363cdf0e10cSrcweir sal_Bool ResultSetDataSupplier::isCountFinal() 364cdf0e10cSrcweir { 365cdf0e10cSrcweir return m_pImpl->m_bCountFinal; 366cdf0e10cSrcweir } 367cdf0e10cSrcweir 368cdf0e10cSrcweir //========================================================================= 369cdf0e10cSrcweir // virtual 370cdf0e10cSrcweir uno::Reference< sdbc::XRow > 371cdf0e10cSrcweir ResultSetDataSupplier::queryPropertyValues( sal_uInt32 nIndex ) 372cdf0e10cSrcweir { 373cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 374cdf0e10cSrcweir 375cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 376cdf0e10cSrcweir { 377cdf0e10cSrcweir uno::Reference< sdbc::XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xRow; 378cdf0e10cSrcweir if ( xRow.is() ) 379cdf0e10cSrcweir { 380cdf0e10cSrcweir // Already cached. 381cdf0e10cSrcweir return xRow; 382cdf0e10cSrcweir } 383cdf0e10cSrcweir } 384cdf0e10cSrcweir 385cdf0e10cSrcweir if ( getResult( nIndex ) ) 386cdf0e10cSrcweir { 387cdf0e10cSrcweir uno::Reference< sdbc::XRow > xRow = Content::getPropertyValues( 388cdf0e10cSrcweir m_pImpl->m_xSMgr, 389cdf0e10cSrcweir getResultSet()->getProperties(), 390cdf0e10cSrcweir m_pImpl->m_xContent->getContentProvider().get(), 391cdf0e10cSrcweir queryContentIdentifierString( nIndex ) ); 392cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xRow = xRow; 393cdf0e10cSrcweir return xRow; 394cdf0e10cSrcweir } 395cdf0e10cSrcweir 396cdf0e10cSrcweir return uno::Reference< sdbc::XRow >(); 397cdf0e10cSrcweir } 398cdf0e10cSrcweir 399cdf0e10cSrcweir //========================================================================= 400cdf0e10cSrcweir // virtual 401cdf0e10cSrcweir void ResultSetDataSupplier::releasePropertyValues( sal_uInt32 nIndex ) 402cdf0e10cSrcweir { 403cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 404cdf0e10cSrcweir 405cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) 406cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xRow = uno::Reference< sdbc::XRow >(); 407cdf0e10cSrcweir } 408cdf0e10cSrcweir 409cdf0e10cSrcweir //========================================================================= 410cdf0e10cSrcweir // virtual 411cdf0e10cSrcweir void ResultSetDataSupplier::close() 412cdf0e10cSrcweir { 413cdf0e10cSrcweir } 414cdf0e10cSrcweir 415cdf0e10cSrcweir //========================================================================= 416cdf0e10cSrcweir // virtual 417cdf0e10cSrcweir void ResultSetDataSupplier::validate() 418cdf0e10cSrcweir throw( ucb::ResultSetException ) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir if ( m_pImpl->m_bThrowException ) 421cdf0e10cSrcweir throw ucb::ResultSetException(); 422cdf0e10cSrcweir } 423cdf0e10cSrcweir 424cdf0e10cSrcweir //========================================================================= 425cdf0e10cSrcweir bool ResultSetDataSupplier::queryNamesOfChildren() 426cdf0e10cSrcweir { 427cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); 428cdf0e10cSrcweir 429cdf0e10cSrcweir if ( m_pImpl->m_pNamesOfChildren == 0 ) 430cdf0e10cSrcweir { 431cdf0e10cSrcweir uno::Sequence< rtl::OUString > * pNamesOfChildren 432cdf0e10cSrcweir = new uno::Sequence< rtl::OUString >(); 433cdf0e10cSrcweir 434cdf0e10cSrcweir if ( !m_pImpl->m_xContent->getContentProvider()->queryNamesOfChildren( 435cdf0e10cSrcweir m_pImpl->m_xContent->getIdentifier()->getContentIdentifier(), 436cdf0e10cSrcweir *pNamesOfChildren ) ) 437cdf0e10cSrcweir { 438cdf0e10cSrcweir OSL_ENSURE( false, "Got no list of children!" ); 439cdf0e10cSrcweir m_pImpl->m_bThrowException = sal_True; 440cdf0e10cSrcweir return false; 441cdf0e10cSrcweir } 442cdf0e10cSrcweir else 443cdf0e10cSrcweir { 444cdf0e10cSrcweir m_pImpl->m_pNamesOfChildren = pNamesOfChildren; 445cdf0e10cSrcweir } 446cdf0e10cSrcweir } 447cdf0e10cSrcweir return true; 448cdf0e10cSrcweir } 449cdf0e10cSrcweir 450cdf0e10cSrcweir //========================================================================= 451cdf0e10cSrcweir ::rtl::OUString 452cdf0e10cSrcweir ResultSetDataSupplier::assembleChildURL( const ::rtl::OUString& aName ) 453cdf0e10cSrcweir { 454cdf0e10cSrcweir rtl::OUString aContURL 455cdf0e10cSrcweir = m_pImpl->m_xContent->getIdentifier()->getContentIdentifier(); 456cdf0e10cSrcweir rtl::OUString aURL( aContURL ); 457cdf0e10cSrcweir 458cdf0e10cSrcweir sal_Int32 nUrlEnd = aURL.lastIndexOf( '/' ); 459cdf0e10cSrcweir if ( nUrlEnd != aURL.getLength() - 1 ) 460cdf0e10cSrcweir aURL += rtl::OUString::createFromAscii( "/" ); 461cdf0e10cSrcweir 462cdf0e10cSrcweir aURL += aName; 463cdf0e10cSrcweir return aURL; 464cdf0e10cSrcweir } 465