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 <ucbhelper/providerhelper.hxx>
36cdf0e10cSrcweir #include "odma_datasupplier.hxx"
37cdf0e10cSrcweir #include "odma_content.hxx"
38cdf0e10cSrcweir #include "odma_contentprops.hxx"
39cdf0e10cSrcweir #include "odma_provider.hxx"
40cdf0e10cSrcweir #include "odma_lib.hxx"
41cdf0e10cSrcweir 
42cdf0e10cSrcweir using namespace com::sun::star::beans;
43cdf0e10cSrcweir using namespace com::sun::star::lang;
44cdf0e10cSrcweir using namespace com::sun::star::ucb;
45cdf0e10cSrcweir using namespace com::sun::star::uno;
46cdf0e10cSrcweir using namespace com::sun::star::sdbc;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir using namespace odma;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir namespace odma
51cdf0e10cSrcweir {
52cdf0e10cSrcweir 
53cdf0e10cSrcweir //=========================================================================
54cdf0e10cSrcweir //
55cdf0e10cSrcweir // struct ResultListEntry.
56cdf0e10cSrcweir //
57cdf0e10cSrcweir //=========================================================================
58cdf0e10cSrcweir 
59cdf0e10cSrcweir struct ResultListEntry
60cdf0e10cSrcweir {
61cdf0e10cSrcweir 	::rtl::OUString					    aId;
62cdf0e10cSrcweir 	Reference< XContentIdentifier >     xId;
63cdf0e10cSrcweir 	Reference< XContent > 			    xContent;
64cdf0e10cSrcweir 	Reference< XRow > 				    xRow;
65cdf0e10cSrcweir 	::rtl::Reference<ContentProperties>	rData;
66cdf0e10cSrcweir 
ResultListEntryodma::ResultListEntry67cdf0e10cSrcweir 	ResultListEntry( const ::rtl::Reference<ContentProperties>& rEntry ) : rData( rEntry ) {}
68cdf0e10cSrcweir };
69cdf0e10cSrcweir 
70cdf0e10cSrcweir //=========================================================================
71cdf0e10cSrcweir //
72cdf0e10cSrcweir // ResultList.
73cdf0e10cSrcweir //
74cdf0e10cSrcweir //=========================================================================
75cdf0e10cSrcweir 
76cdf0e10cSrcweir typedef std::vector< ResultListEntry* > ResultList;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir //=========================================================================
79cdf0e10cSrcweir //
80cdf0e10cSrcweir // struct DataSupplier_Impl.
81cdf0e10cSrcweir //
82cdf0e10cSrcweir //=========================================================================
83cdf0e10cSrcweir 
84cdf0e10cSrcweir struct DataSupplier_Impl
85cdf0e10cSrcweir {
86cdf0e10cSrcweir 	osl::Mutex					      m_aMutex;
87cdf0e10cSrcweir 	ResultList					      m_aResults;
88cdf0e10cSrcweir 	rtl::Reference< Content >     	  m_xContent;
89cdf0e10cSrcweir 	Reference< XMultiServiceFactory > m_xSMgr;
90cdf0e10cSrcweir // @@@ The data source and an iterator for it
91cdf0e10cSrcweir //	Entry 		 	      	  		  m_aFolder;
92cdf0e10cSrcweir //	Entry::iterator 		  		  m_aIterator;
93cdf0e10cSrcweir   	sal_Int32					      m_nOpenMode;
94cdf0e10cSrcweir   	sal_Bool					      m_bCountFinal;
95cdf0e10cSrcweir 
DataSupplier_Implodma::DataSupplier_Impl96cdf0e10cSrcweir 	DataSupplier_Impl( const Reference< XMultiServiceFactory >& rxSMgr,
97cdf0e10cSrcweir 	                   const rtl::Reference< Content >& rContent,
98cdf0e10cSrcweir 					   sal_Int32 nOpenMode )
99cdf0e10cSrcweir 	: m_xContent( rContent ), m_xSMgr( rxSMgr ),
100cdf0e10cSrcweir //	  m_aFolder( rxSMgr, rContent->getIdentifier()->getContentIdentifier() ),
101cdf0e10cSrcweir 	  m_nOpenMode( nOpenMode ), m_bCountFinal( sal_False ) {}
102cdf0e10cSrcweir 	~DataSupplier_Impl();
103cdf0e10cSrcweir };
104cdf0e10cSrcweir 
105cdf0e10cSrcweir //=========================================================================
~DataSupplier_Impl()106cdf0e10cSrcweir DataSupplier_Impl::~DataSupplier_Impl()
107cdf0e10cSrcweir {
108cdf0e10cSrcweir 	ResultList::const_iterator it  = m_aResults.begin();
109cdf0e10cSrcweir 	ResultList::const_iterator end = m_aResults.end();
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	while ( it != end )
112cdf0e10cSrcweir 	{
113cdf0e10cSrcweir 		delete (*it);
114cdf0e10cSrcweir 		it++;
115cdf0e10cSrcweir 	}
116cdf0e10cSrcweir }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir //=========================================================================
121cdf0e10cSrcweir //=========================================================================
122cdf0e10cSrcweir //
123cdf0e10cSrcweir // DataSupplier Implementation.
124cdf0e10cSrcweir //
125cdf0e10cSrcweir //=========================================================================
126cdf0e10cSrcweir //=========================================================================
127cdf0e10cSrcweir 
DataSupplier(const Reference<XMultiServiceFactory> & rxSMgr,const rtl::Reference<::odma::Content> & rContent,sal_Int32 nOpenMode)128cdf0e10cSrcweir DataSupplier::DataSupplier( const Reference<XMultiServiceFactory >& rxSMgr,
129cdf0e10cSrcweir 						   const rtl::Reference< ::odma::Content >& rContent,
130cdf0e10cSrcweir 							sal_Int32 nOpenMode )
131cdf0e10cSrcweir : m_pImpl( new DataSupplier_Impl( rxSMgr, rContent, nOpenMode ) )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir //=========================================================================
136cdf0e10cSrcweir // virtual
~DataSupplier()137cdf0e10cSrcweir DataSupplier::~DataSupplier()
138cdf0e10cSrcweir {
139cdf0e10cSrcweir 	delete m_pImpl;
140cdf0e10cSrcweir }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir //=========================================================================
143cdf0e10cSrcweir // virtual
queryContentIdentifierString(sal_uInt32 nIndex)144cdf0e10cSrcweir ::rtl::OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
145cdf0e10cSrcweir {
146cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 	if ( nIndex < m_pImpl->m_aResults.size() )
149cdf0e10cSrcweir 	{
150cdf0e10cSrcweir 		::rtl::OUString aId = m_pImpl->m_aResults[ nIndex ]->aId;
151cdf0e10cSrcweir 		if ( aId.getLength() )
152cdf0e10cSrcweir 		{
153cdf0e10cSrcweir 			// Already cached.
154cdf0e10cSrcweir 			return aId;
155cdf0e10cSrcweir 		}
156cdf0e10cSrcweir 	}
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 	if ( getResult( nIndex ) )
159cdf0e10cSrcweir 	{
160cdf0e10cSrcweir 		::rtl::OUString aId
161cdf0e10cSrcweir 			= m_pImpl->m_xContent->getIdentifier()->getContentIdentifier();
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 		aId += m_pImpl->m_aResults[ nIndex ]->rData->m_sTitle;
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 		m_pImpl->m_aResults[ nIndex ]->aId = aId;
166cdf0e10cSrcweir 		return aId;
167cdf0e10cSrcweir 	}
168cdf0e10cSrcweir 	return ::rtl::OUString();
169cdf0e10cSrcweir }
170cdf0e10cSrcweir 
171cdf0e10cSrcweir //=========================================================================
172cdf0e10cSrcweir // virtual
queryContentIdentifier(sal_uInt32 nIndex)173cdf0e10cSrcweir Reference< XContentIdentifier > DataSupplier::queryContentIdentifier(
174cdf0e10cSrcweir 														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 		Reference< 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 		Reference< XContentIdentifier > xId
193cdf0e10cSrcweir             = new ucbhelper::ContentIdentifier( aId );
194cdf0e10cSrcweir 		m_pImpl->m_aResults[ nIndex ]->xId = xId;
195cdf0e10cSrcweir 		return xId;
196cdf0e10cSrcweir 	}
197cdf0e10cSrcweir 	return Reference< XContentIdentifier >();
198cdf0e10cSrcweir }
199cdf0e10cSrcweir 
200cdf0e10cSrcweir //=========================================================================
201cdf0e10cSrcweir // virtual
queryContent(sal_uInt32 nIndex)202cdf0e10cSrcweir Reference< XContent > DataSupplier::queryContent( sal_uInt32 nIndex )
203cdf0e10cSrcweir {
204cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 	if ( nIndex < m_pImpl->m_aResults.size() )
207cdf0e10cSrcweir 	{
208cdf0e10cSrcweir 		Reference< XContent > xContent
209cdf0e10cSrcweir 								= m_pImpl->m_aResults[ nIndex ]->xContent;
210cdf0e10cSrcweir 		if ( xContent.is() )
211cdf0e10cSrcweir 		{
212cdf0e10cSrcweir 			// Already cached.
213cdf0e10cSrcweir 			return xContent;
214cdf0e10cSrcweir 		}
215cdf0e10cSrcweir 	}
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 	Reference< XContentIdentifier > xId = queryContentIdentifier( nIndex );
218cdf0e10cSrcweir 	if ( xId.is() )
219cdf0e10cSrcweir 	{
220cdf0e10cSrcweir 		try
221cdf0e10cSrcweir 		{
222cdf0e10cSrcweir 			Reference< XContent > xContent
223cdf0e10cSrcweir 				= m_pImpl->m_xContent->getProvider()->queryContent( xId );
224cdf0e10cSrcweir 			m_pImpl->m_aResults[ nIndex ]->xContent = xContent;
225cdf0e10cSrcweir 			return xContent;
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 		}
228cdf0e10cSrcweir 		catch ( IllegalIdentifierException& )
229cdf0e10cSrcweir 		{
230cdf0e10cSrcweir 		}
231cdf0e10cSrcweir 	}
232cdf0e10cSrcweir 	return Reference< XContent >();
233cdf0e10cSrcweir }
234cdf0e10cSrcweir 
235cdf0e10cSrcweir //=========================================================================
236cdf0e10cSrcweir // virtual
getResult(sal_uInt32 nIndex)237cdf0e10cSrcweir sal_Bool DataSupplier::getResult( sal_uInt32 nIndex )
238cdf0e10cSrcweir {
239cdf0e10cSrcweir 	osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 	if ( m_pImpl->m_aResults.size() > nIndex )
242cdf0e10cSrcweir 	{
243cdf0e10cSrcweir 		// Result already present.
244cdf0e10cSrcweir 		return sal_True;
245cdf0e10cSrcweir 	}
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 	// Result not (yet) present.
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 	if ( m_pImpl->m_bCountFinal )
250cdf0e10cSrcweir 		return sal_False;
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 	// Try to obtain result...
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 	sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
255cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
256cdf0e10cSrcweir //	sal_uInt32 nPos = nOldCount;
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 	// @@@ Obtain data and put it into result list...
259cdf0e10cSrcweir /*
260cdf0e10cSrcweir 	while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) )
261cdf0e10cSrcweir 	{
262cdf0e10cSrcweir 		m_pImpl->m_aResults.push_back(
263cdf0e10cSrcweir 						new ResultListEntry( *m_pImpl->m_aIterator ) );
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 		if ( nPos == nIndex )
266cdf0e10cSrcweir 		{
267cdf0e10cSrcweir 			// Result obtained.
268cdf0e10cSrcweir 			bFound = sal_True;
269cdf0e10cSrcweir 			break;
270cdf0e10cSrcweir 		}
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 		nPos++;
273cdf0e10cSrcweir 	}
274cdf0e10cSrcweir */
275cdf0e10cSrcweir 	// now query for all documents in the DMS
276cdf0e10cSrcweir 	OSL_ENSURE(ContentProvider::getHandle(),"No Handle!");
277cdf0e10cSrcweir 	sal_Char* pQueryId		= new sal_Char[ODM_QUERYID_MAX];
278cdf0e10cSrcweir 	sal_Char* lpszDMSList	= new sal_Char[ODM_DMSID_MAX];
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 	ODMSTATUS odm = NODMGetDMS(ODMA_ODMA_REGNAME, lpszDMSList);
281cdf0e10cSrcweir 	lpszDMSList[strlen(lpszDMSList)+1] = '\0';
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 	::rtl::OString sQuery("SELECT ODM_DOCID, ODM_NAME");
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 	DWORD dwFlags = ODM_SPECIFIC;
286cdf0e10cSrcweir 	odm = NODMQueryExecute(ContentProvider::getHandle(), sQuery,dwFlags, lpszDMSList, pQueryId );
287cdf0e10cSrcweir 	if(odm != ODM_SUCCESS)
288cdf0e10cSrcweir 		return sal_False;
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 	sal_uInt16 nCount		= 10;
291cdf0e10cSrcweir 	sal_uInt16 nMaxCount	= 10;
292cdf0e10cSrcweir 	sal_Char* lpszDocId		= new sal_Char[ODM_DOCID_MAX * nMaxCount];
293cdf0e10cSrcweir 	sal_Char* lpszDocName	= new sal_Char[ODM_NAME_MAX * nMaxCount];
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	::rtl::OUString sContentType(RTL_CONSTASCII_USTRINGPARAM(ODMA_CONTENT_TYPE));
297cdf0e10cSrcweir 	sal_uInt32 nCurrentCount = 0;
298cdf0e10cSrcweir 	do
299cdf0e10cSrcweir 	{
300cdf0e10cSrcweir 		if(nCount >= nMaxCount)
301cdf0e10cSrcweir 		{
302cdf0e10cSrcweir 			nCount = nMaxCount;
303cdf0e10cSrcweir 			odm = NODMQueryGetResults(ContentProvider::getHandle(), pQueryId,lpszDocId, lpszDocName, ODM_NAME_MAX, (WORD*)&nCount);
304cdf0e10cSrcweir 			nCurrentCount += nCount;
305cdf0e10cSrcweir 		}
306cdf0e10cSrcweir 		if(odm == ODM_SUCCESS && nIndex < nCurrentCount)
307cdf0e10cSrcweir 		{
308cdf0e10cSrcweir 			bFound = sal_True;
309cdf0e10cSrcweir 			for(sal_uInt16 i = 0; i < nCount; ++i)
310cdf0e10cSrcweir 			{
311cdf0e10cSrcweir 				::rtl::Reference<ContentProperties> rProps = new ContentProperties();
312cdf0e10cSrcweir 				rProps->m_sDocumentId	= ::rtl::OString(&lpszDocId[ODM_DOCID_MAX*i]);
313cdf0e10cSrcweir 				rProps->m_sContentType	= sContentType;
314cdf0e10cSrcweir 				m_pImpl->m_xContent->getContentProvider()->append(rProps);
315cdf0e10cSrcweir 				m_pImpl->m_aResults.push_back( new ResultListEntry(rProps));
316cdf0e10cSrcweir 			}
317cdf0e10cSrcweir 		}
318cdf0e10cSrcweir 	}
319cdf0e10cSrcweir 	while(nCount > nMaxCount);
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 	// now close the query
323cdf0e10cSrcweir 	odm = NODMQueryClose(ContentProvider::getHandle(), pQueryId);
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 	delete [] lpszDMSList;
326cdf0e10cSrcweir 	delete [] pQueryId;
327cdf0e10cSrcweir 	delete [] lpszDocId;
328cdf0e10cSrcweir 	delete [] lpszDocName;
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 	if ( !bFound )
331cdf0e10cSrcweir 		m_pImpl->m_bCountFinal = sal_True;
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 	rtl::Reference< ucbhelper::ResultSet > xResultSet = getResultSet();
334cdf0e10cSrcweir 	if ( xResultSet.is() )
335cdf0e10cSrcweir 	{
336cdf0e10cSrcweir 		// Callbacks follow!
337cdf0e10cSrcweir 		aGuard.clear();
338cdf0e10cSrcweir 
339cdf0e10cSrcweir 		if ( nOldCount < m_pImpl->m_aResults.size() )
340cdf0e10cSrcweir 			xResultSet->rowCountChanged(
341cdf0e10cSrcweir 									nOldCount, m_pImpl->m_aResults.size() );
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 		if ( m_pImpl->m_bCountFinal )
344cdf0e10cSrcweir 			xResultSet->rowCountFinal();
345cdf0e10cSrcweir 	}
346cdf0e10cSrcweir 
347cdf0e10cSrcweir 	return bFound;
348cdf0e10cSrcweir }
349cdf0e10cSrcweir 
350cdf0e10cSrcweir //=========================================================================
351cdf0e10cSrcweir // virtual
totalCount()352cdf0e10cSrcweir sal_uInt32 DataSupplier::totalCount()
353cdf0e10cSrcweir {
354cdf0e10cSrcweir 	osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 	if ( m_pImpl->m_bCountFinal )
357cdf0e10cSrcweir 		return m_pImpl->m_aResults.size();
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 	sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 	// @@@ Obtain data and put it into result list...
362cdf0e10cSrcweir /*
363cdf0e10cSrcweir 	while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) )
364cdf0e10cSrcweir 		m_pImpl->m_aResults.push_back(
365cdf0e10cSrcweir 						new ResultListEntry( *m_pImpl->m_aIterator ) );
366cdf0e10cSrcweir */
367cdf0e10cSrcweir 	m_pImpl->m_bCountFinal = sal_True;
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 	rtl::Reference< ucbhelper::ResultSet > xResultSet = getResultSet();
370cdf0e10cSrcweir 	if ( xResultSet.is() )
371cdf0e10cSrcweir 	{
372cdf0e10cSrcweir 		// Callbacks follow!
373cdf0e10cSrcweir 		aGuard.clear();
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 		if ( nOldCount < m_pImpl->m_aResults.size() )
376cdf0e10cSrcweir 			xResultSet->rowCountChanged(
377cdf0e10cSrcweir 									nOldCount, m_pImpl->m_aResults.size() );
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 		xResultSet->rowCountFinal();
380cdf0e10cSrcweir 	}
381cdf0e10cSrcweir 
382cdf0e10cSrcweir 	return m_pImpl->m_aResults.size();
383cdf0e10cSrcweir }
384cdf0e10cSrcweir 
385cdf0e10cSrcweir //=========================================================================
386cdf0e10cSrcweir // virtual
currentCount()387cdf0e10cSrcweir sal_uInt32 DataSupplier::currentCount()
388cdf0e10cSrcweir {
389cdf0e10cSrcweir 	return m_pImpl->m_aResults.size();
390cdf0e10cSrcweir }
391cdf0e10cSrcweir 
392cdf0e10cSrcweir //=========================================================================
393cdf0e10cSrcweir // virtual
isCountFinal()394cdf0e10cSrcweir sal_Bool DataSupplier::isCountFinal()
395cdf0e10cSrcweir {
396cdf0e10cSrcweir 	return m_pImpl->m_bCountFinal;
397cdf0e10cSrcweir }
398cdf0e10cSrcweir 
399cdf0e10cSrcweir //=========================================================================
400cdf0e10cSrcweir // virtual
queryPropertyValues(sal_uInt32 nIndex)401cdf0e10cSrcweir Reference< XRow > DataSupplier::queryPropertyValues( sal_uInt32 nIndex  )
402cdf0e10cSrcweir {
403cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 	if ( nIndex < m_pImpl->m_aResults.size() )
406cdf0e10cSrcweir 	{
407cdf0e10cSrcweir 		Reference< XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xRow;
408cdf0e10cSrcweir 		if ( xRow.is() )
409cdf0e10cSrcweir 		{
410cdf0e10cSrcweir 			// Already cached.
411cdf0e10cSrcweir 			return xRow;
412cdf0e10cSrcweir 		}
413cdf0e10cSrcweir 	}
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 	if ( getResult( nIndex ) )
416cdf0e10cSrcweir 	{
417cdf0e10cSrcweir 		Reference< XRow > xRow = Content::getPropertyValues(
418cdf0e10cSrcweir 									m_pImpl->m_xSMgr,
419cdf0e10cSrcweir 									getResultSet()->getProperties(),
420cdf0e10cSrcweir 									m_pImpl->m_aResults[ nIndex ]->rData,
421cdf0e10cSrcweir 									m_pImpl->m_xContent->getProvider(),
422cdf0e10cSrcweir 									queryContentIdentifierString( nIndex ) );
423cdf0e10cSrcweir 		m_pImpl->m_aResults[ nIndex ]->xRow = xRow;
424cdf0e10cSrcweir 		return xRow;
425cdf0e10cSrcweir 	}
426cdf0e10cSrcweir 
427cdf0e10cSrcweir 	return Reference< XRow >();
428cdf0e10cSrcweir }
429cdf0e10cSrcweir 
430cdf0e10cSrcweir //=========================================================================
431cdf0e10cSrcweir // virtual
releasePropertyValues(sal_uInt32 nIndex)432cdf0e10cSrcweir void DataSupplier::releasePropertyValues( sal_uInt32 nIndex )
433cdf0e10cSrcweir {
434cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
435cdf0e10cSrcweir 
436cdf0e10cSrcweir 	if ( nIndex < m_pImpl->m_aResults.size() )
437cdf0e10cSrcweir 		m_pImpl->m_aResults[ nIndex ]->xRow = Reference< XRow >();
438cdf0e10cSrcweir }
439cdf0e10cSrcweir 
440cdf0e10cSrcweir //=========================================================================
441cdf0e10cSrcweir // virtual
close()442cdf0e10cSrcweir void DataSupplier::close()
443cdf0e10cSrcweir {
444cdf0e10cSrcweir }
445cdf0e10cSrcweir 
446cdf0e10cSrcweir //=========================================================================
447cdf0e10cSrcweir // virtual
validate()448cdf0e10cSrcweir void DataSupplier::validate()
449cdf0e10cSrcweir 	throw( ResultSetException )
450cdf0e10cSrcweir {
451cdf0e10cSrcweir }
452