1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_ucb.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir /**************************************************************************
32*cdf0e10cSrcweir 								TODO
33*cdf0e10cSrcweir  **************************************************************************
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir  *************************************************************************/
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir #include <vector>
38*cdf0e10cSrcweir #include <ucbhelper/contentidentifier.hxx>
39*cdf0e10cSrcweir #include "hierarchydatasupplier.hxx"
40*cdf0e10cSrcweir #include "hierarchyprovider.hxx"
41*cdf0e10cSrcweir #include "hierarchycontent.hxx"
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir using namespace com::sun::star;
44*cdf0e10cSrcweir using namespace hierarchy_ucp;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir namespace hierarchy_ucp
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir //=========================================================================
50*cdf0e10cSrcweir //
51*cdf0e10cSrcweir // struct ResultListEntry.
52*cdf0e10cSrcweir //
53*cdf0e10cSrcweir //=========================================================================
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir struct ResultListEntry
56*cdf0e10cSrcweir {
57*cdf0e10cSrcweir     rtl::OUString                             aId;
58*cdf0e10cSrcweir     uno::Reference< ucb::XContentIdentifier > xId;
59*cdf0e10cSrcweir     uno::Reference< ucb::XContent >           xContent;
60*cdf0e10cSrcweir     uno::Reference< sdbc::XRow >              xRow;
61*cdf0e10cSrcweir     HierarchyEntryData                        aData;
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir 	ResultListEntry( const HierarchyEntryData& rEntry ) : aData( rEntry ) {}
64*cdf0e10cSrcweir };
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir //=========================================================================
67*cdf0e10cSrcweir //
68*cdf0e10cSrcweir // ResultList.
69*cdf0e10cSrcweir //
70*cdf0e10cSrcweir //=========================================================================
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir typedef std::vector< ResultListEntry* > ResultList;
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir //=========================================================================
75*cdf0e10cSrcweir //
76*cdf0e10cSrcweir // struct DataSupplier_Impl.
77*cdf0e10cSrcweir //
78*cdf0e10cSrcweir //=========================================================================
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir struct DataSupplier_Impl
81*cdf0e10cSrcweir {
82*cdf0e10cSrcweir     osl::Mutex                                      m_aMutex;
83*cdf0e10cSrcweir     ResultList                                      m_aResults;
84*cdf0e10cSrcweir     rtl::Reference< HierarchyContent >              m_xContent;
85*cdf0e10cSrcweir     uno::Reference< lang::XMultiServiceFactory >    m_xSMgr;
86*cdf0e10cSrcweir     HierarchyEntry                                  m_aFolder;
87*cdf0e10cSrcweir     HierarchyEntry::iterator                        m_aIterator;
88*cdf0e10cSrcweir     sal_Int32                                       m_nOpenMode;
89*cdf0e10cSrcweir     sal_Bool                                        m_bCountFinal;
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir     DataSupplier_Impl(
92*cdf0e10cSrcweir         const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
93*cdf0e10cSrcweir         const rtl::Reference< HierarchyContent >& rContent,
94*cdf0e10cSrcweir         sal_Int32 nOpenMode )
95*cdf0e10cSrcweir 	: m_xContent( rContent ), m_xSMgr( rxSMgr ),
96*cdf0e10cSrcweir 	  m_aFolder( rxSMgr,
97*cdf0e10cSrcweir 				 static_cast< HierarchyContentProvider * >(
98*cdf0e10cSrcweir                      rContent->getProvider().get() ),
99*cdf0e10cSrcweir 				 rContent->getIdentifier()->getContentIdentifier() ),
100*cdf0e10cSrcweir 	  m_nOpenMode( nOpenMode ), m_bCountFinal( sal_False ) {}
101*cdf0e10cSrcweir 	~DataSupplier_Impl();
102*cdf0e10cSrcweir };
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir //=========================================================================
105*cdf0e10cSrcweir DataSupplier_Impl::~DataSupplier_Impl()
106*cdf0e10cSrcweir {
107*cdf0e10cSrcweir 	ResultList::const_iterator it  = m_aResults.begin();
108*cdf0e10cSrcweir 	ResultList::const_iterator end = m_aResults.end();
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 	while ( it != end )
111*cdf0e10cSrcweir 	{
112*cdf0e10cSrcweir 		delete (*it);
113*cdf0e10cSrcweir 		it++;
114*cdf0e10cSrcweir 	}
115*cdf0e10cSrcweir }
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir }
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir //=========================================================================
120*cdf0e10cSrcweir //=========================================================================
121*cdf0e10cSrcweir //
122*cdf0e10cSrcweir // HierarchyResultSetDataSupplier Implementation.
123*cdf0e10cSrcweir //
124*cdf0e10cSrcweir //=========================================================================
125*cdf0e10cSrcweir //=========================================================================
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir HierarchyResultSetDataSupplier::HierarchyResultSetDataSupplier(
128*cdf0e10cSrcweir                 const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
129*cdf0e10cSrcweir                 const rtl::Reference< HierarchyContent >& rContent,
130*cdf0e10cSrcweir                 sal_Int32 nOpenMode )
131*cdf0e10cSrcweir : m_pImpl( new DataSupplier_Impl( rxSMgr, rContent, nOpenMode ) )
132*cdf0e10cSrcweir {
133*cdf0e10cSrcweir }
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir //=========================================================================
136*cdf0e10cSrcweir // virtual
137*cdf0e10cSrcweir HierarchyResultSetDataSupplier::~HierarchyResultSetDataSupplier()
138*cdf0e10cSrcweir {
139*cdf0e10cSrcweir 	delete m_pImpl;
140*cdf0e10cSrcweir }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir //=========================================================================
143*cdf0e10cSrcweir // virtual
144*cdf0e10cSrcweir rtl::OUString HierarchyResultSetDataSupplier::queryContentIdentifierString(
145*cdf0e10cSrcweir 														sal_uInt32 nIndex )
146*cdf0e10cSrcweir {
147*cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 	if ( nIndex < m_pImpl->m_aResults.size() )
150*cdf0e10cSrcweir 	{
151*cdf0e10cSrcweir         rtl::OUString aId = m_pImpl->m_aResults[ nIndex ]->aId;
152*cdf0e10cSrcweir 		if ( aId.getLength() )
153*cdf0e10cSrcweir 		{
154*cdf0e10cSrcweir 			// Already cached.
155*cdf0e10cSrcweir 			return aId;
156*cdf0e10cSrcweir 		}
157*cdf0e10cSrcweir 	}
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir 	if ( getResult( nIndex ) )
160*cdf0e10cSrcweir 	{
161*cdf0e10cSrcweir         rtl::OUString aId
162*cdf0e10cSrcweir 			= m_pImpl->m_xContent->getIdentifier()->getContentIdentifier();
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 		if ( ( aId.lastIndexOf( '/' ) + 1 ) != aId.getLength() )
165*cdf0e10cSrcweir             aId += rtl::OUString::createFromAscii( "/" );
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir         aId += m_pImpl->m_aResults[ nIndex ]->aData.getName();
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir 		m_pImpl->m_aResults[ nIndex ]->aId = aId;
170*cdf0e10cSrcweir 		return aId;
171*cdf0e10cSrcweir 	}
172*cdf0e10cSrcweir     return rtl::OUString();
173*cdf0e10cSrcweir }
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir //=========================================================================
176*cdf0e10cSrcweir // virtual
177*cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier >
178*cdf0e10cSrcweir HierarchyResultSetDataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
179*cdf0e10cSrcweir {
180*cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 	if ( nIndex < m_pImpl->m_aResults.size() )
183*cdf0e10cSrcweir 	{
184*cdf0e10cSrcweir         uno::Reference< ucb::XContentIdentifier > xId
185*cdf0e10cSrcweir 								= m_pImpl->m_aResults[ nIndex ]->xId;
186*cdf0e10cSrcweir 		if ( xId.is() )
187*cdf0e10cSrcweir 		{
188*cdf0e10cSrcweir 			// Already cached.
189*cdf0e10cSrcweir 			return xId;
190*cdf0e10cSrcweir 		}
191*cdf0e10cSrcweir 	}
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir     rtl::OUString aId = queryContentIdentifierString( nIndex );
194*cdf0e10cSrcweir 	if ( aId.getLength() )
195*cdf0e10cSrcweir 	{
196*cdf0e10cSrcweir         uno::Reference< ucb::XContentIdentifier > xId
197*cdf0e10cSrcweir             = new ::ucbhelper::ContentIdentifier( aId );
198*cdf0e10cSrcweir 		m_pImpl->m_aResults[ nIndex ]->xId = xId;
199*cdf0e10cSrcweir 		return xId;
200*cdf0e10cSrcweir 	}
201*cdf0e10cSrcweir     return uno::Reference< ucb::XContentIdentifier >();
202*cdf0e10cSrcweir }
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir //=========================================================================
205*cdf0e10cSrcweir // virtual
206*cdf0e10cSrcweir uno::Reference< ucb::XContent >
207*cdf0e10cSrcweir HierarchyResultSetDataSupplier::queryContent( sal_uInt32 nIndex )
208*cdf0e10cSrcweir {
209*cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 	if ( nIndex < m_pImpl->m_aResults.size() )
212*cdf0e10cSrcweir 	{
213*cdf0e10cSrcweir         uno::Reference< ucb::XContent > xContent
214*cdf0e10cSrcweir 								= m_pImpl->m_aResults[ nIndex ]->xContent;
215*cdf0e10cSrcweir 		if ( xContent.is() )
216*cdf0e10cSrcweir 		{
217*cdf0e10cSrcweir 			// Already cached.
218*cdf0e10cSrcweir 			return xContent;
219*cdf0e10cSrcweir 		}
220*cdf0e10cSrcweir 	}
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir     uno::Reference< ucb::XContentIdentifier > xId
223*cdf0e10cSrcweir         = queryContentIdentifier( nIndex );
224*cdf0e10cSrcweir 	if ( xId.is() )
225*cdf0e10cSrcweir 	{
226*cdf0e10cSrcweir 		try
227*cdf0e10cSrcweir 		{
228*cdf0e10cSrcweir             uno::Reference< ucb::XContent > xContent
229*cdf0e10cSrcweir 				= m_pImpl->m_xContent->getProvider()->queryContent( xId );
230*cdf0e10cSrcweir 			m_pImpl->m_aResults[ nIndex ]->xContent = xContent;
231*cdf0e10cSrcweir 			return xContent;
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 		}
234*cdf0e10cSrcweir         catch ( ucb::IllegalIdentifierException const & )
235*cdf0e10cSrcweir 		{
236*cdf0e10cSrcweir 		}
237*cdf0e10cSrcweir 	}
238*cdf0e10cSrcweir     return uno::Reference< ucb::XContent >();
239*cdf0e10cSrcweir }
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir //=========================================================================
242*cdf0e10cSrcweir // virtual
243*cdf0e10cSrcweir sal_Bool HierarchyResultSetDataSupplier::getResult( sal_uInt32 nIndex )
244*cdf0e10cSrcweir {
245*cdf0e10cSrcweir 	osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir 	if ( m_pImpl->m_aResults.size() > nIndex )
248*cdf0e10cSrcweir 	{
249*cdf0e10cSrcweir 		// Result already present.
250*cdf0e10cSrcweir 		return sal_True;
251*cdf0e10cSrcweir 	}
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 	// Result not (yet) present.
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir 	if ( m_pImpl->m_bCountFinal )
256*cdf0e10cSrcweir 		return sal_False;
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 	// Try to obtain result...
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir 	sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
261*cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
262*cdf0e10cSrcweir 	sal_uInt32 nPos = nOldCount;
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 	while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) )
265*cdf0e10cSrcweir 	{
266*cdf0e10cSrcweir 		const HierarchyEntryData& rResult = *m_pImpl->m_aIterator;
267*cdf0e10cSrcweir 		if ( checkResult( rResult ) )
268*cdf0e10cSrcweir 		{
269*cdf0e10cSrcweir 			m_pImpl->m_aResults.push_back( new ResultListEntry( rResult ) );
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 			if ( nPos == nIndex )
272*cdf0e10cSrcweir 			{
273*cdf0e10cSrcweir 				// Result obtained.
274*cdf0e10cSrcweir 				bFound = sal_True;
275*cdf0e10cSrcweir 				break;
276*cdf0e10cSrcweir 			}
277*cdf0e10cSrcweir 		}
278*cdf0e10cSrcweir 		nPos++;
279*cdf0e10cSrcweir 	}
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir 	if ( !bFound )
282*cdf0e10cSrcweir 		m_pImpl->m_bCountFinal = sal_True;
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir     rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet().get();
285*cdf0e10cSrcweir     if ( xResultSet.is() )
286*cdf0e10cSrcweir 	{
287*cdf0e10cSrcweir 		// Callbacks follow!
288*cdf0e10cSrcweir 		aGuard.clear();
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir 		if ( nOldCount < m_pImpl->m_aResults.size() )
291*cdf0e10cSrcweir 			xResultSet->rowCountChanged(
292*cdf0e10cSrcweir 									nOldCount, m_pImpl->m_aResults.size() );
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 		if ( m_pImpl->m_bCountFinal )
295*cdf0e10cSrcweir 			xResultSet->rowCountFinal();
296*cdf0e10cSrcweir 	}
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir 	return bFound;
299*cdf0e10cSrcweir }
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir //=========================================================================
302*cdf0e10cSrcweir // virtual
303*cdf0e10cSrcweir sal_uInt32 HierarchyResultSetDataSupplier::totalCount()
304*cdf0e10cSrcweir {
305*cdf0e10cSrcweir 	osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir 	if ( m_pImpl->m_bCountFinal )
308*cdf0e10cSrcweir 		return m_pImpl->m_aResults.size();
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir 	sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir 	while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) )
313*cdf0e10cSrcweir 	{
314*cdf0e10cSrcweir 		const HierarchyEntryData& rResult = *m_pImpl->m_aIterator;
315*cdf0e10cSrcweir 		if ( checkResult( rResult ) )
316*cdf0e10cSrcweir 			m_pImpl->m_aResults.push_back( new ResultListEntry( rResult ) );
317*cdf0e10cSrcweir 	}
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir 	m_pImpl->m_bCountFinal = sal_True;
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir     rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet().get();
322*cdf0e10cSrcweir     if ( xResultSet.is() )
323*cdf0e10cSrcweir 	{
324*cdf0e10cSrcweir 		// Callbacks follow!
325*cdf0e10cSrcweir 		aGuard.clear();
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 		if ( nOldCount < m_pImpl->m_aResults.size() )
328*cdf0e10cSrcweir 			xResultSet->rowCountChanged(
329*cdf0e10cSrcweir 									nOldCount, m_pImpl->m_aResults.size() );
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir 		xResultSet->rowCountFinal();
332*cdf0e10cSrcweir 	}
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir 	return m_pImpl->m_aResults.size();
335*cdf0e10cSrcweir }
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir //=========================================================================
338*cdf0e10cSrcweir // virtual
339*cdf0e10cSrcweir sal_uInt32 HierarchyResultSetDataSupplier::currentCount()
340*cdf0e10cSrcweir {
341*cdf0e10cSrcweir 	return m_pImpl->m_aResults.size();
342*cdf0e10cSrcweir }
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir //=========================================================================
345*cdf0e10cSrcweir // virtual
346*cdf0e10cSrcweir sal_Bool HierarchyResultSetDataSupplier::isCountFinal()
347*cdf0e10cSrcweir {
348*cdf0e10cSrcweir 	return m_pImpl->m_bCountFinal;
349*cdf0e10cSrcweir }
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir //=========================================================================
352*cdf0e10cSrcweir // virtual
353*cdf0e10cSrcweir uno::Reference< sdbc::XRow >
354*cdf0e10cSrcweir HierarchyResultSetDataSupplier::queryPropertyValues( sal_uInt32 nIndex  )
355*cdf0e10cSrcweir {
356*cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir 	if ( nIndex < m_pImpl->m_aResults.size() )
359*cdf0e10cSrcweir 	{
360*cdf0e10cSrcweir         uno::Reference< sdbc::XRow > xRow
361*cdf0e10cSrcweir             = m_pImpl->m_aResults[ nIndex ]->xRow;
362*cdf0e10cSrcweir 		if ( xRow.is() )
363*cdf0e10cSrcweir 		{
364*cdf0e10cSrcweir 			// Already cached.
365*cdf0e10cSrcweir 			return xRow;
366*cdf0e10cSrcweir 		}
367*cdf0e10cSrcweir 	}
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir 	if ( getResult( nIndex ) )
370*cdf0e10cSrcweir 	{
371*cdf0e10cSrcweir         static rtl::OUString aFolderType(
372*cdf0e10cSrcweir             rtl::OUString::createFromAscii( HIERARCHY_FOLDER_CONTENT_TYPE ) );
373*cdf0e10cSrcweir         static rtl::OUString aLinkType(
374*cdf0e10cSrcweir             rtl::OUString::createFromAscii( HIERARCHY_LINK_CONTENT_TYPE ) );
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir         HierarchyContentProperties aData(
377*cdf0e10cSrcweir             m_pImpl->m_aResults[ nIndex ]->aData );
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir         uno::Reference< sdbc::XRow > xRow
380*cdf0e10cSrcweir             = HierarchyContent::getPropertyValues(
381*cdf0e10cSrcweir                 m_pImpl->m_xSMgr,
382*cdf0e10cSrcweir                 getResultSet()->getProperties(),
383*cdf0e10cSrcweir                 aData,
384*cdf0e10cSrcweir                 static_cast< HierarchyContentProvider * >(
385*cdf0e10cSrcweir                     m_pImpl->m_xContent->getProvider().get() ),
386*cdf0e10cSrcweir                 queryContentIdentifierString( nIndex ) );
387*cdf0e10cSrcweir 		m_pImpl->m_aResults[ nIndex ]->xRow = xRow;
388*cdf0e10cSrcweir 		return xRow;
389*cdf0e10cSrcweir 	}
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir     return uno::Reference< sdbc::XRow >();
392*cdf0e10cSrcweir }
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir //=========================================================================
395*cdf0e10cSrcweir // virtual
396*cdf0e10cSrcweir void HierarchyResultSetDataSupplier::releasePropertyValues( sal_uInt32 nIndex )
397*cdf0e10cSrcweir {
398*cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir 	if ( nIndex < m_pImpl->m_aResults.size() )
401*cdf0e10cSrcweir         m_pImpl->m_aResults[ nIndex ]->xRow = uno::Reference< sdbc::XRow >();
402*cdf0e10cSrcweir }
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir //=========================================================================
405*cdf0e10cSrcweir // virtual
406*cdf0e10cSrcweir void HierarchyResultSetDataSupplier::close()
407*cdf0e10cSrcweir {
408*cdf0e10cSrcweir }
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir //=========================================================================
411*cdf0e10cSrcweir // virtual
412*cdf0e10cSrcweir void HierarchyResultSetDataSupplier::validate()
413*cdf0e10cSrcweir     throw( ucb::ResultSetException )
414*cdf0e10cSrcweir {
415*cdf0e10cSrcweir }
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir //=========================================================================
418*cdf0e10cSrcweir sal_Bool HierarchyResultSetDataSupplier::checkResult(
419*cdf0e10cSrcweir 									const HierarchyEntryData& rResult )
420*cdf0e10cSrcweir {
421*cdf0e10cSrcweir 	switch ( m_pImpl->m_nOpenMode )
422*cdf0e10cSrcweir 	{
423*cdf0e10cSrcweir         case ucb::OpenMode::FOLDERS:
424*cdf0e10cSrcweir             if ( rResult.getType() == HierarchyEntryData::LINK )
425*cdf0e10cSrcweir 			{
426*cdf0e10cSrcweir 				// Entry is a link.
427*cdf0e10cSrcweir 				return sal_False;
428*cdf0e10cSrcweir 			}
429*cdf0e10cSrcweir 			break;
430*cdf0e10cSrcweir 
431*cdf0e10cSrcweir         case ucb::OpenMode::DOCUMENTS:
432*cdf0e10cSrcweir             if ( rResult.getType() == HierarchyEntryData::FOLDER )
433*cdf0e10cSrcweir 			{
434*cdf0e10cSrcweir 				// Entry is a folder.
435*cdf0e10cSrcweir 				return sal_False;
436*cdf0e10cSrcweir 			}
437*cdf0e10cSrcweir 			break;
438*cdf0e10cSrcweir 
439*cdf0e10cSrcweir         case ucb::OpenMode::ALL:
440*cdf0e10cSrcweir 		default:
441*cdf0e10cSrcweir 			break;
442*cdf0e10cSrcweir 	}
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir 	return sal_True;
445*cdf0e10cSrcweir }
446*cdf0e10cSrcweir 
447