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 #include <contentresultsetwrapper.hxx>
32*cdf0e10cSrcweir #include <com/sun/star/sdbc/FetchDirection.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/ucb/FetchError.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetType.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
37*cdf0e10cSrcweir #include <rtl/ustring.hxx>
38*cdf0e10cSrcweir #include <osl/diagnose.h>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir using namespace com::sun::star::beans;
41*cdf0e10cSrcweir using namespace com::sun::star::lang;
42*cdf0e10cSrcweir using namespace com::sun::star::sdbc;
43*cdf0e10cSrcweir using namespace com::sun::star::ucb;
44*cdf0e10cSrcweir using namespace com::sun::star::uno;
45*cdf0e10cSrcweir using namespace com::sun::star::util;
46*cdf0e10cSrcweir using namespace cppu;
47*cdf0e10cSrcweir using namespace rtl;
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir //--------------------------------------------------------------------------
50*cdf0e10cSrcweir //--------------------------------------------------------------------------
51*cdf0e10cSrcweir // class ContentResultSetWrapper
52*cdf0e10cSrcweir //--------------------------------------------------------------------------
53*cdf0e10cSrcweir //--------------------------------------------------------------------------
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir ContentResultSetWrapper::ContentResultSetWrapper(
56*cdf0e10cSrcweir 								Reference< XResultSet > xOrigin )
57*cdf0e10cSrcweir 				: m_xResultSetOrigin( xOrigin )
58*cdf0e10cSrcweir 				, m_xRowOrigin( NULL )
59*cdf0e10cSrcweir 				, m_xContentAccessOrigin( NULL )
60*cdf0e10cSrcweir 				, m_xPropertySetOrigin( NULL )
61*cdf0e10cSrcweir 				, m_xPropertySetInfo( NULL )
62*cdf0e10cSrcweir 				, m_nForwardOnly( 2 )
63*cdf0e10cSrcweir 				, m_xMetaDataFromOrigin( NULL )
64*cdf0e10cSrcweir 				, m_bDisposed( sal_False )
65*cdf0e10cSrcweir 				, m_bInDispose( sal_False )
66*cdf0e10cSrcweir 				, m_pDisposeEventListeners( NULL )
67*cdf0e10cSrcweir 				, m_pPropertyChangeListeners( NULL )
68*cdf0e10cSrcweir 				, m_pVetoableChangeListeners( NULL )
69*cdf0e10cSrcweir {
70*cdf0e10cSrcweir 	m_pMyListenerImpl = new ContentResultSetWrapperListener( this );
71*cdf0e10cSrcweir 	m_xMyListenerImpl = Reference< XPropertyChangeListener >( m_pMyListenerImpl );
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir 	OSL_ENSURE( m_xResultSetOrigin.is(), "XResultSet is required" );
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir 	//!! call impl_init() at the end of constructor of derived class
76*cdf0e10cSrcweir };
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper::impl_init_xRowOrigin()
80*cdf0e10cSrcweir {
81*cdf0e10cSrcweir 	{
82*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
83*cdf0e10cSrcweir 		if(m_xRowOrigin.is())
84*cdf0e10cSrcweir 			return;
85*cdf0e10cSrcweir 	}
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 	Reference< XRow > xOrgig =
88*cdf0e10cSrcweir 		Reference< XRow >( m_xResultSetOrigin, UNO_QUERY );
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 	{
91*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
92*cdf0e10cSrcweir 		m_xRowOrigin = xOrgig;
93*cdf0e10cSrcweir 		OSL_ENSURE( m_xRowOrigin.is(), "interface XRow is required" );
94*cdf0e10cSrcweir 	}
95*cdf0e10cSrcweir }
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper::impl_init_xContentAccessOrigin()
98*cdf0e10cSrcweir {
99*cdf0e10cSrcweir 	{
100*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
101*cdf0e10cSrcweir 		if(m_xContentAccessOrigin.is())
102*cdf0e10cSrcweir 			return;
103*cdf0e10cSrcweir 	}
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 	Reference< XContentAccess > xOrgig =
106*cdf0e10cSrcweir 		Reference< XContentAccess >( m_xResultSetOrigin, UNO_QUERY );
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir 	{
109*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
110*cdf0e10cSrcweir 		m_xContentAccessOrigin = xOrgig;
111*cdf0e10cSrcweir 		OSL_ENSURE( m_xContentAccessOrigin.is(), "interface XContentAccess is required" );
112*cdf0e10cSrcweir 	}
113*cdf0e10cSrcweir }
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper::impl_init_xPropertySetOrigin()
117*cdf0e10cSrcweir {
118*cdf0e10cSrcweir 	{
119*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
120*cdf0e10cSrcweir 		if( m_xPropertySetOrigin.is() )
121*cdf0e10cSrcweir 			return;
122*cdf0e10cSrcweir 	}
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 	Reference< XPropertySet > xOrig =
125*cdf0e10cSrcweir 		Reference< XPropertySet >( m_xResultSetOrigin, UNO_QUERY );
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 	{
128*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
129*cdf0e10cSrcweir 		m_xPropertySetOrigin = xOrig;
130*cdf0e10cSrcweir 		OSL_ENSURE( m_xPropertySetOrigin.is(), "interface XPropertySet is required" );
131*cdf0e10cSrcweir 	}
132*cdf0e10cSrcweir }
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper::impl_init()
135*cdf0e10cSrcweir {
136*cdf0e10cSrcweir 	//call this at the end of constructor of derived class
137*cdf0e10cSrcweir 	//
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 	//listen to disposing from Origin:
140*cdf0e10cSrcweir 	Reference< XComponent > xComponentOrigin( m_xResultSetOrigin, UNO_QUERY );
141*cdf0e10cSrcweir 	OSL_ENSURE( xComponentOrigin.is(), "interface XComponent is required" );
142*cdf0e10cSrcweir 	xComponentOrigin->addEventListener( static_cast< XPropertyChangeListener * >( m_pMyListenerImpl ) );
143*cdf0e10cSrcweir }
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir ContentResultSetWrapper::~ContentResultSetWrapper()
146*cdf0e10cSrcweir {
147*cdf0e10cSrcweir 	//call impl_deinit() at start of destructor of derived class
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 	delete m_pDisposeEventListeners;
150*cdf0e10cSrcweir 	delete m_pPropertyChangeListeners;
151*cdf0e10cSrcweir 	delete m_pVetoableChangeListeners;
152*cdf0e10cSrcweir };
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper::impl_deinit()
155*cdf0e10cSrcweir {
156*cdf0e10cSrcweir 	//call this at start of destructor of derived class
157*cdf0e10cSrcweir 	//
158*cdf0e10cSrcweir 	m_pMyListenerImpl->impl_OwnerDies();
159*cdf0e10cSrcweir }
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir //virtual
162*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
163*cdf0e10cSrcweir 	::impl_initPropertySetInfo()
164*cdf0e10cSrcweir {
165*cdf0e10cSrcweir 	{
166*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
167*cdf0e10cSrcweir 		if( m_xPropertySetInfo.is() )
168*cdf0e10cSrcweir 			return;
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 		impl_init_xPropertySetOrigin();
171*cdf0e10cSrcweir 		if( !m_xPropertySetOrigin.is() )
172*cdf0e10cSrcweir 			return;
173*cdf0e10cSrcweir 	}
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 	Reference< XPropertySetInfo > xOrig =
176*cdf0e10cSrcweir 			m_xPropertySetOrigin->getPropertySetInfo();
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 	{
179*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
180*cdf0e10cSrcweir 		m_xPropertySetInfo = xOrig;
181*cdf0e10cSrcweir 	}
182*cdf0e10cSrcweir }
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
185*cdf0e10cSrcweir ::impl_EnsureNotDisposed()
186*cdf0e10cSrcweir 	throw( DisposedException, RuntimeException )
187*cdf0e10cSrcweir {
188*cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_aMutex );
189*cdf0e10cSrcweir 	if( m_bDisposed )
190*cdf0e10cSrcweir 		throw DisposedException();
191*cdf0e10cSrcweir }
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir ContentResultSetWrapper::PropertyChangeListenerContainer_Impl* SAL_CALL
194*cdf0e10cSrcweir 	ContentResultSetWrapper
195*cdf0e10cSrcweir 	::impl_getPropertyChangeListenerContainer()
196*cdf0e10cSrcweir {
197*cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_aMutex );
198*cdf0e10cSrcweir 	if ( !m_pPropertyChangeListeners )
199*cdf0e10cSrcweir 		m_pPropertyChangeListeners =
200*cdf0e10cSrcweir 			new PropertyChangeListenerContainer_Impl( m_aContainerMutex );
201*cdf0e10cSrcweir 	return m_pPropertyChangeListeners;
202*cdf0e10cSrcweir }
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir ContentResultSetWrapper::PropertyChangeListenerContainer_Impl* SAL_CALL
205*cdf0e10cSrcweir 	ContentResultSetWrapper
206*cdf0e10cSrcweir 	::impl_getVetoableChangeListenerContainer()
207*cdf0e10cSrcweir {
208*cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_aMutex );
209*cdf0e10cSrcweir 	if ( !m_pVetoableChangeListeners )
210*cdf0e10cSrcweir 		m_pVetoableChangeListeners =
211*cdf0e10cSrcweir 			new PropertyChangeListenerContainer_Impl( m_aContainerMutex );
212*cdf0e10cSrcweir 	return m_pVetoableChangeListeners;
213*cdf0e10cSrcweir }
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
216*cdf0e10cSrcweir 	::impl_notifyPropertyChangeListeners(
217*cdf0e10cSrcweir 					const PropertyChangeEvent& rEvt )
218*cdf0e10cSrcweir {
219*cdf0e10cSrcweir 	{
220*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
221*cdf0e10cSrcweir 		if( !m_pPropertyChangeListeners )
222*cdf0e10cSrcweir 			return;
223*cdf0e10cSrcweir 	}
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir 	// Notify listeners interested especially in the changed property.
226*cdf0e10cSrcweir 	OInterfaceContainerHelper* pContainer =
227*cdf0e10cSrcweir 			m_pPropertyChangeListeners->getContainer( rEvt.PropertyName );
228*cdf0e10cSrcweir 	if( pContainer )
229*cdf0e10cSrcweir 	{
230*cdf0e10cSrcweir 		OInterfaceIteratorHelper aIter( *pContainer );
231*cdf0e10cSrcweir 		while( aIter.hasMoreElements() )
232*cdf0e10cSrcweir 		{
233*cdf0e10cSrcweir 			Reference< XPropertyChangeListener > xListener(
234*cdf0e10cSrcweir 													aIter.next(), UNO_QUERY );
235*cdf0e10cSrcweir 			if( xListener.is() )
236*cdf0e10cSrcweir 				xListener->propertyChange( rEvt );
237*cdf0e10cSrcweir 		}
238*cdf0e10cSrcweir 	}
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 	// Notify listeners interested in all properties.
241*cdf0e10cSrcweir 	pContainer = m_pPropertyChangeListeners->getContainer( OUString() );
242*cdf0e10cSrcweir 	if( pContainer )
243*cdf0e10cSrcweir 	{
244*cdf0e10cSrcweir 		OInterfaceIteratorHelper aIter( *pContainer );
245*cdf0e10cSrcweir 		while( aIter.hasMoreElements() )
246*cdf0e10cSrcweir 		{
247*cdf0e10cSrcweir 			Reference< XPropertyChangeListener > xListener(
248*cdf0e10cSrcweir 													aIter.next(), UNO_QUERY );
249*cdf0e10cSrcweir 			if( xListener.is() )
250*cdf0e10cSrcweir 				xListener->propertyChange( rEvt );
251*cdf0e10cSrcweir 		}
252*cdf0e10cSrcweir 	}
253*cdf0e10cSrcweir }
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
256*cdf0e10cSrcweir 	::impl_notifyVetoableChangeListeners( const PropertyChangeEvent& rEvt )
257*cdf0e10cSrcweir 	throw( PropertyVetoException,
258*cdf0e10cSrcweir 		   RuntimeException )
259*cdf0e10cSrcweir {
260*cdf0e10cSrcweir 	{
261*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
262*cdf0e10cSrcweir 		if( !m_pVetoableChangeListeners )
263*cdf0e10cSrcweir 			return;
264*cdf0e10cSrcweir 	}
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 	// Notify listeners interested especially in the changed property.
267*cdf0e10cSrcweir 	OInterfaceContainerHelper* pContainer =
268*cdf0e10cSrcweir 			m_pVetoableChangeListeners->getContainer( rEvt.PropertyName );
269*cdf0e10cSrcweir 	if( pContainer )
270*cdf0e10cSrcweir 	{
271*cdf0e10cSrcweir 		OInterfaceIteratorHelper aIter( *pContainer );
272*cdf0e10cSrcweir 		while( aIter.hasMoreElements() )
273*cdf0e10cSrcweir 		{
274*cdf0e10cSrcweir 			Reference< XVetoableChangeListener > xListener(
275*cdf0e10cSrcweir 													aIter.next(), UNO_QUERY );
276*cdf0e10cSrcweir 			if( xListener.is() )
277*cdf0e10cSrcweir 				xListener->vetoableChange( rEvt );
278*cdf0e10cSrcweir 		}
279*cdf0e10cSrcweir 	}
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir 	// Notify listeners interested in all properties.
282*cdf0e10cSrcweir 	pContainer = m_pVetoableChangeListeners->getContainer( OUString() );
283*cdf0e10cSrcweir 	if( pContainer )
284*cdf0e10cSrcweir 	{
285*cdf0e10cSrcweir 		OInterfaceIteratorHelper aIter( *pContainer );
286*cdf0e10cSrcweir 		while( aIter.hasMoreElements() )
287*cdf0e10cSrcweir 		{
288*cdf0e10cSrcweir 			Reference< XVetoableChangeListener > xListener(
289*cdf0e10cSrcweir 													aIter.next(), UNO_QUERY );
290*cdf0e10cSrcweir 			if( xListener.is() )
291*cdf0e10cSrcweir 				xListener->vetoableChange( rEvt );
292*cdf0e10cSrcweir 		}
293*cdf0e10cSrcweir 	}
294*cdf0e10cSrcweir }
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
297*cdf0e10cSrcweir 	::impl_isForwardOnly()
298*cdf0e10cSrcweir {
299*cdf0e10cSrcweir 	//m_nForwardOnly == 2 -> don't know
300*cdf0e10cSrcweir 	//m_nForwardOnly == 1 -> YES
301*cdf0e10cSrcweir 	//m_nForwardOnly == 0 -> NO
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 	//@todo replace this with lines in comment
304*cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_aMutex );
305*cdf0e10cSrcweir 	m_nForwardOnly = 0;
306*cdf0e10cSrcweir 	return false;
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 	/*
310*cdf0e10cSrcweir 	ReacquireableGuard aGuard( m_aMutex );
311*cdf0e10cSrcweir 	if( m_nForwardOnly == 2 )
312*cdf0e10cSrcweir 	{
313*cdf0e10cSrcweir 		aGuard.clear();
314*cdf0e10cSrcweir 		if( !getPropertySetInfo().is() )
315*cdf0e10cSrcweir 		{
316*cdf0e10cSrcweir 			aGuard.reacquire();
317*cdf0e10cSrcweir 			m_nForwardOnly = 0;
318*cdf0e10cSrcweir 			return m_nForwardOnly;
319*cdf0e10cSrcweir 		}
320*cdf0e10cSrcweir 		aGuard.reacquire();
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir 		rtl::OUString aName = OUString::createFromAscii( "ResultSetType" );
323*cdf0e10cSrcweir 		//find out, if we are ForwardOnly and cache the value:
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir 		impl_init_xPropertySetOrigin();
326*cdf0e10cSrcweir 		if( !m_xPropertySetOrigin.is() )
327*cdf0e10cSrcweir 		{
328*cdf0e10cSrcweir 			OSL_ENSURE( sal_False, "broadcaster was disposed already" );
329*cdf0e10cSrcweir 			m_nForwardOnly = 0;
330*cdf0e10cSrcweir 			return m_nForwardOnly;
331*cdf0e10cSrcweir 		}
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir 		aGuard.clear();
334*cdf0e10cSrcweir 		Any aAny = m_xPropertySetOrigin->getPropertyValue( aName );
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir 		aGuard.reacquire();
337*cdf0e10cSrcweir 		long nResultSetType;
338*cdf0e10cSrcweir 		if( ( aAny >>= nResultSetType ) &&
339*cdf0e10cSrcweir 			( nResultSetType == ResultSetType::FORWARD_ONLY ) )
340*cdf0e10cSrcweir 			m_nForwardOnly = 1;
341*cdf0e10cSrcweir 		else
342*cdf0e10cSrcweir 			m_nForwardOnly = 0;
343*cdf0e10cSrcweir 	}
344*cdf0e10cSrcweir 	return m_nForwardOnly;
345*cdf0e10cSrcweir 	*/
346*cdf0e10cSrcweir }
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir //--------------------------------------------------------------------------
349*cdf0e10cSrcweir // XInterface methods.
350*cdf0e10cSrcweir //--------------------------------------------------------------------------
351*cdf0e10cSrcweir //list all interfaces inclusive baseclasses of interfaces
352*cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( ContentResultSetWrapper )
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir 	SAL_STATIC_CAST( XComponent*, this ),
355*cdf0e10cSrcweir 	SAL_STATIC_CAST( XCloseable*, this ),
356*cdf0e10cSrcweir 	SAL_STATIC_CAST( XResultSetMetaDataSupplier*, this ),
357*cdf0e10cSrcweir 	SAL_STATIC_CAST( XPropertySet*, this ),
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir 	SAL_STATIC_CAST( XContentAccess*, this ),
360*cdf0e10cSrcweir 	SAL_STATIC_CAST( XResultSet*, this ),
361*cdf0e10cSrcweir 	SAL_STATIC_CAST( XRow*, this )
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir QUERYINTERFACE_IMPL_END
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir //--------------------------------------------------------------------------
366*cdf0e10cSrcweir // XComponent methods.
367*cdf0e10cSrcweir //--------------------------------------------------------------------------
368*cdf0e10cSrcweir // virtual
369*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
370*cdf0e10cSrcweir 	::dispose() throw( RuntimeException )
371*cdf0e10cSrcweir {
372*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir 	ReacquireableGuard aGuard( m_aMutex );
375*cdf0e10cSrcweir 	if( m_bInDispose || m_bDisposed )
376*cdf0e10cSrcweir 		return;
377*cdf0e10cSrcweir 	m_bInDispose = sal_True;
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir 	if( m_xPropertySetOrigin.is() )
380*cdf0e10cSrcweir 	{
381*cdf0e10cSrcweir 		aGuard.clear();
382*cdf0e10cSrcweir 		try
383*cdf0e10cSrcweir 		{
384*cdf0e10cSrcweir 			m_xPropertySetOrigin->removePropertyChangeListener(
385*cdf0e10cSrcweir 				OUString(), static_cast< XPropertyChangeListener * >( m_pMyListenerImpl ) );
386*cdf0e10cSrcweir 		}
387*cdf0e10cSrcweir 		catch( Exception& )
388*cdf0e10cSrcweir 		{
389*cdf0e10cSrcweir 			OSL_ENSURE( sal_False, "could not remove PropertyChangeListener" );
390*cdf0e10cSrcweir 		}
391*cdf0e10cSrcweir 		try
392*cdf0e10cSrcweir 		{
393*cdf0e10cSrcweir 			m_xPropertySetOrigin->removeVetoableChangeListener(
394*cdf0e10cSrcweir 				OUString(), static_cast< XVetoableChangeListener * >( m_pMyListenerImpl ) );
395*cdf0e10cSrcweir 		}
396*cdf0e10cSrcweir 		catch( Exception& )
397*cdf0e10cSrcweir 		{
398*cdf0e10cSrcweir 			OSL_ENSURE( sal_False, "could not remove VetoableChangeListener" );
399*cdf0e10cSrcweir 		}
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir 		Reference< XComponent > xComponentOrigin( m_xResultSetOrigin, UNO_QUERY );
402*cdf0e10cSrcweir 		OSL_ENSURE( xComponentOrigin.is(), "interface XComponent is required" );
403*cdf0e10cSrcweir 		xComponentOrigin->removeEventListener( static_cast< XPropertyChangeListener * >( m_pMyListenerImpl ) );
404*cdf0e10cSrcweir 	}
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir 	aGuard.reacquire();
407*cdf0e10cSrcweir 	if( m_pDisposeEventListeners && m_pDisposeEventListeners->getLength() )
408*cdf0e10cSrcweir 	{
409*cdf0e10cSrcweir 		EventObject aEvt;
410*cdf0e10cSrcweir 		aEvt.Source = static_cast< XComponent * >( this );
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir 		aGuard.clear();
413*cdf0e10cSrcweir 		m_pDisposeEventListeners->disposeAndClear( aEvt );
414*cdf0e10cSrcweir 	}
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir 	aGuard.reacquire();
417*cdf0e10cSrcweir 	if( m_pPropertyChangeListeners )
418*cdf0e10cSrcweir 	{
419*cdf0e10cSrcweir 		EventObject aEvt;
420*cdf0e10cSrcweir 		aEvt.Source = static_cast< XPropertySet * >( this );
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir 		aGuard.clear();
423*cdf0e10cSrcweir 		m_pPropertyChangeListeners->disposeAndClear( aEvt );
424*cdf0e10cSrcweir 	}
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir 	aGuard.reacquire();
427*cdf0e10cSrcweir 	if( m_pVetoableChangeListeners )
428*cdf0e10cSrcweir 	{
429*cdf0e10cSrcweir 		EventObject aEvt;
430*cdf0e10cSrcweir 		aEvt.Source = static_cast< XPropertySet * >( this );
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir 		aGuard.clear();
433*cdf0e10cSrcweir 		m_pVetoableChangeListeners->disposeAndClear( aEvt );
434*cdf0e10cSrcweir 	}
435*cdf0e10cSrcweir 
436*cdf0e10cSrcweir 	aGuard.reacquire();
437*cdf0e10cSrcweir 	m_bDisposed = sal_True;
438*cdf0e10cSrcweir 	m_bInDispose = sal_False;
439*cdf0e10cSrcweir }
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir //--------------------------------------------------------------------------
442*cdf0e10cSrcweir // virtual
443*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
444*cdf0e10cSrcweir 	::addEventListener(	const Reference< XEventListener >& Listener )
445*cdf0e10cSrcweir 	throw( RuntimeException )
446*cdf0e10cSrcweir {
447*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
448*cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_aMutex );
449*cdf0e10cSrcweir 
450*cdf0e10cSrcweir 	if ( !m_pDisposeEventListeners )
451*cdf0e10cSrcweir 		m_pDisposeEventListeners =
452*cdf0e10cSrcweir 					new OInterfaceContainerHelper( m_aContainerMutex );
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir 	m_pDisposeEventListeners->addInterface( Listener );
455*cdf0e10cSrcweir }
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir //--------------------------------------------------------------------------
458*cdf0e10cSrcweir // virtual
459*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
460*cdf0e10cSrcweir 	::removeEventListener( const Reference< XEventListener >& Listener )
461*cdf0e10cSrcweir 	throw( RuntimeException )
462*cdf0e10cSrcweir {
463*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
464*cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_aMutex );
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir 	if ( m_pDisposeEventListeners )
467*cdf0e10cSrcweir 		m_pDisposeEventListeners->removeInterface( Listener );
468*cdf0e10cSrcweir }
469*cdf0e10cSrcweir 
470*cdf0e10cSrcweir //--------------------------------------------------------------------------
471*cdf0e10cSrcweir //XCloseable methods.
472*cdf0e10cSrcweir //--------------------------------------------------------------------------
473*cdf0e10cSrcweir //virtual
474*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
475*cdf0e10cSrcweir 	::close()
476*cdf0e10cSrcweir 	throw( SQLException,
477*cdf0e10cSrcweir 		   RuntimeException )
478*cdf0e10cSrcweir {
479*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
480*cdf0e10cSrcweir 	dispose();
481*cdf0e10cSrcweir }
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir //--------------------------------------------------------------------------
484*cdf0e10cSrcweir //XResultSetMetaDataSupplier methods.
485*cdf0e10cSrcweir //--------------------------------------------------------------------------
486*cdf0e10cSrcweir //virtual
487*cdf0e10cSrcweir Reference< XResultSetMetaData > SAL_CALL ContentResultSetWrapper
488*cdf0e10cSrcweir 	::getMetaData()
489*cdf0e10cSrcweir 	throw( SQLException,
490*cdf0e10cSrcweir 		   RuntimeException )
491*cdf0e10cSrcweir {
492*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir 	ReacquireableGuard aGuard( m_aMutex );
495*cdf0e10cSrcweir 	if( !m_xMetaDataFromOrigin.is() && m_xResultSetOrigin.is() )
496*cdf0e10cSrcweir 	{
497*cdf0e10cSrcweir 		Reference< XResultSetMetaDataSupplier > xMetaDataSupplier
498*cdf0e10cSrcweir 			= Reference< XResultSetMetaDataSupplier >(
499*cdf0e10cSrcweir 				m_xResultSetOrigin, UNO_QUERY );
500*cdf0e10cSrcweir 
501*cdf0e10cSrcweir 		if( xMetaDataSupplier.is() )
502*cdf0e10cSrcweir 		{
503*cdf0e10cSrcweir 			aGuard.clear();
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir 			Reference< XResultSetMetaData > xMetaData
506*cdf0e10cSrcweir 				= xMetaDataSupplier->getMetaData();
507*cdf0e10cSrcweir 
508*cdf0e10cSrcweir 			aGuard.reacquire();
509*cdf0e10cSrcweir 			m_xMetaDataFromOrigin = xMetaData;
510*cdf0e10cSrcweir 		}
511*cdf0e10cSrcweir 	}
512*cdf0e10cSrcweir 	return m_xMetaDataFromOrigin;
513*cdf0e10cSrcweir }
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir 
516*cdf0e10cSrcweir //--------------------------------------------------------------------------
517*cdf0e10cSrcweir // XPropertySet methods.
518*cdf0e10cSrcweir //--------------------------------------------------------------------------
519*cdf0e10cSrcweir // virtual
520*cdf0e10cSrcweir Reference< XPropertySetInfo > SAL_CALL ContentResultSetWrapper
521*cdf0e10cSrcweir 	::getPropertySetInfo() throw( RuntimeException )
522*cdf0e10cSrcweir {
523*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
524*cdf0e10cSrcweir 	{
525*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
526*cdf0e10cSrcweir 		if( m_xPropertySetInfo.is() )
527*cdf0e10cSrcweir 			return m_xPropertySetInfo;
528*cdf0e10cSrcweir 	}
529*cdf0e10cSrcweir 	impl_initPropertySetInfo();
530*cdf0e10cSrcweir 	return m_xPropertySetInfo;
531*cdf0e10cSrcweir }
532*cdf0e10cSrcweir //--------------------------------------------------------------------------
533*cdf0e10cSrcweir // virtual
534*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
535*cdf0e10cSrcweir 	::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
536*cdf0e10cSrcweir 	throw( UnknownPropertyException,
537*cdf0e10cSrcweir 		   PropertyVetoException,
538*cdf0e10cSrcweir 		   IllegalArgumentException,
539*cdf0e10cSrcweir 		   WrappedTargetException,
540*cdf0e10cSrcweir 		   RuntimeException )
541*cdf0e10cSrcweir {
542*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
543*cdf0e10cSrcweir 	impl_init_xPropertySetOrigin();
544*cdf0e10cSrcweir 	if( !m_xPropertySetOrigin.is() )
545*cdf0e10cSrcweir 	{
546*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
547*cdf0e10cSrcweir 		throw UnknownPropertyException();
548*cdf0e10cSrcweir 	}
549*cdf0e10cSrcweir 	m_xPropertySetOrigin->setPropertyValue( rPropertyName, rValue );
550*cdf0e10cSrcweir }
551*cdf0e10cSrcweir 
552*cdf0e10cSrcweir //--------------------------------------------------------------------------
553*cdf0e10cSrcweir // virtual
554*cdf0e10cSrcweir Any SAL_CALL ContentResultSetWrapper
555*cdf0e10cSrcweir 	::getPropertyValue( const OUString& rPropertyName )
556*cdf0e10cSrcweir 	throw( UnknownPropertyException,
557*cdf0e10cSrcweir 		   WrappedTargetException,
558*cdf0e10cSrcweir 		   RuntimeException )
559*cdf0e10cSrcweir {
560*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
561*cdf0e10cSrcweir 	impl_init_xPropertySetOrigin();
562*cdf0e10cSrcweir 	if( !m_xPropertySetOrigin.is() )
563*cdf0e10cSrcweir 	{
564*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
565*cdf0e10cSrcweir 		throw UnknownPropertyException();
566*cdf0e10cSrcweir 	}
567*cdf0e10cSrcweir 	return m_xPropertySetOrigin->getPropertyValue( rPropertyName );
568*cdf0e10cSrcweir }
569*cdf0e10cSrcweir 
570*cdf0e10cSrcweir //--------------------------------------------------------------------------
571*cdf0e10cSrcweir // virtual
572*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
573*cdf0e10cSrcweir 	::addPropertyChangeListener(
574*cdf0e10cSrcweir 			const OUString& aPropertyName,
575*cdf0e10cSrcweir 			const Reference< XPropertyChangeListener >& xListener )
576*cdf0e10cSrcweir 	throw( UnknownPropertyException,
577*cdf0e10cSrcweir 		   WrappedTargetException,
578*cdf0e10cSrcweir 		   RuntimeException )
579*cdf0e10cSrcweir {
580*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
581*cdf0e10cSrcweir 
582*cdf0e10cSrcweir 	if( !getPropertySetInfo().is() )
583*cdf0e10cSrcweir 	{
584*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
585*cdf0e10cSrcweir 		throw UnknownPropertyException();
586*cdf0e10cSrcweir 	}
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir 	if( aPropertyName.getLength() )
589*cdf0e10cSrcweir 	{
590*cdf0e10cSrcweir 		m_xPropertySetInfo->getPropertyByName( aPropertyName );
591*cdf0e10cSrcweir 		//throws UnknownPropertyException, if so
592*cdf0e10cSrcweir 	}
593*cdf0e10cSrcweir 
594*cdf0e10cSrcweir 	impl_getPropertyChangeListenerContainer();
595*cdf0e10cSrcweir 	sal_Bool bNeedRegister = !m_pPropertyChangeListeners->
596*cdf0e10cSrcweir 						getContainedTypes().getLength();
597*cdf0e10cSrcweir 	m_pPropertyChangeListeners->addInterface( aPropertyName, xListener );
598*cdf0e10cSrcweir 	if( bNeedRegister )
599*cdf0e10cSrcweir 	{
600*cdf0e10cSrcweir 		impl_init_xPropertySetOrigin();
601*cdf0e10cSrcweir 		{
602*cdf0e10cSrcweir 			osl::Guard< osl::Mutex > aGuard( m_aMutex );
603*cdf0e10cSrcweir 			if( !m_xPropertySetOrigin.is() )
604*cdf0e10cSrcweir 			{
605*cdf0e10cSrcweir 				OSL_ENSURE( sal_False, "broadcaster was disposed already" );
606*cdf0e10cSrcweir 				return;
607*cdf0e10cSrcweir 			}
608*cdf0e10cSrcweir 		}
609*cdf0e10cSrcweir 		try
610*cdf0e10cSrcweir 		{
611*cdf0e10cSrcweir 			m_xPropertySetOrigin->addPropertyChangeListener(
612*cdf0e10cSrcweir 				OUString(), static_cast< XPropertyChangeListener * >( m_pMyListenerImpl ) );
613*cdf0e10cSrcweir 		}
614*cdf0e10cSrcweir 		catch( Exception& rEx )
615*cdf0e10cSrcweir 		{
616*cdf0e10cSrcweir 			m_pPropertyChangeListeners->removeInterface( aPropertyName, xListener );
617*cdf0e10cSrcweir 			throw rEx;
618*cdf0e10cSrcweir 		}
619*cdf0e10cSrcweir 	}
620*cdf0e10cSrcweir }
621*cdf0e10cSrcweir 
622*cdf0e10cSrcweir //--------------------------------------------------------------------------
623*cdf0e10cSrcweir // virtual
624*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
625*cdf0e10cSrcweir 	::addVetoableChangeListener(
626*cdf0e10cSrcweir 			const OUString& rPropertyName,
627*cdf0e10cSrcweir 			const Reference< XVetoableChangeListener >& xListener )
628*cdf0e10cSrcweir 	throw( UnknownPropertyException,
629*cdf0e10cSrcweir 		   WrappedTargetException,
630*cdf0e10cSrcweir 		   RuntimeException )
631*cdf0e10cSrcweir {
632*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
633*cdf0e10cSrcweir 
634*cdf0e10cSrcweir 	if( !getPropertySetInfo().is() )
635*cdf0e10cSrcweir 	{
636*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
637*cdf0e10cSrcweir 		throw UnknownPropertyException();
638*cdf0e10cSrcweir 	}
639*cdf0e10cSrcweir 	if( rPropertyName.getLength() )
640*cdf0e10cSrcweir 	{
641*cdf0e10cSrcweir 		m_xPropertySetInfo->getPropertyByName( rPropertyName );
642*cdf0e10cSrcweir 		//throws UnknownPropertyException, if so
643*cdf0e10cSrcweir 	}
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir 	impl_getVetoableChangeListenerContainer();
646*cdf0e10cSrcweir 	sal_Bool bNeedRegister = !m_pVetoableChangeListeners->
647*cdf0e10cSrcweir 						getContainedTypes().getLength();
648*cdf0e10cSrcweir 	m_pVetoableChangeListeners->addInterface( rPropertyName, xListener );
649*cdf0e10cSrcweir 	if( bNeedRegister )
650*cdf0e10cSrcweir 	{
651*cdf0e10cSrcweir 		impl_init_xPropertySetOrigin();
652*cdf0e10cSrcweir 		{
653*cdf0e10cSrcweir 			osl::Guard< osl::Mutex > aGuard( m_aMutex );
654*cdf0e10cSrcweir 			if( !m_xPropertySetOrigin.is() )
655*cdf0e10cSrcweir 			{
656*cdf0e10cSrcweir 				OSL_ENSURE( sal_False, "broadcaster was disposed already" );
657*cdf0e10cSrcweir 				return;
658*cdf0e10cSrcweir 			}
659*cdf0e10cSrcweir 		}
660*cdf0e10cSrcweir 		try
661*cdf0e10cSrcweir 		{
662*cdf0e10cSrcweir 			m_xPropertySetOrigin->addVetoableChangeListener(
663*cdf0e10cSrcweir 				OUString(), static_cast< XVetoableChangeListener * >( m_pMyListenerImpl ) );
664*cdf0e10cSrcweir 		}
665*cdf0e10cSrcweir 		catch( Exception& rEx )
666*cdf0e10cSrcweir 		{
667*cdf0e10cSrcweir 			m_pVetoableChangeListeners->removeInterface( rPropertyName, xListener );
668*cdf0e10cSrcweir 			throw rEx;
669*cdf0e10cSrcweir 		}
670*cdf0e10cSrcweir 	}
671*cdf0e10cSrcweir }
672*cdf0e10cSrcweir 
673*cdf0e10cSrcweir //--------------------------------------------------------------------------
674*cdf0e10cSrcweir // virtual
675*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
676*cdf0e10cSrcweir 	::removePropertyChangeListener(
677*cdf0e10cSrcweir 			const OUString& rPropertyName,
678*cdf0e10cSrcweir 			const Reference< XPropertyChangeListener >& xListener )
679*cdf0e10cSrcweir 	throw( UnknownPropertyException,
680*cdf0e10cSrcweir 		   WrappedTargetException,
681*cdf0e10cSrcweir 		   RuntimeException )
682*cdf0e10cSrcweir {
683*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir 	{
686*cdf0e10cSrcweir 		//noop, if no listener registered
687*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
688*cdf0e10cSrcweir 		if( !m_pPropertyChangeListeners )
689*cdf0e10cSrcweir 			return;
690*cdf0e10cSrcweir 	}
691*cdf0e10cSrcweir 	OInterfaceContainerHelper* pContainer =
692*cdf0e10cSrcweir 		m_pPropertyChangeListeners->getContainer( rPropertyName );
693*cdf0e10cSrcweir 
694*cdf0e10cSrcweir 	if( !pContainer )
695*cdf0e10cSrcweir 	{
696*cdf0e10cSrcweir 		if( rPropertyName.getLength() )
697*cdf0e10cSrcweir 		{
698*cdf0e10cSrcweir 			if( !getPropertySetInfo().is() )
699*cdf0e10cSrcweir 				throw UnknownPropertyException();
700*cdf0e10cSrcweir 
701*cdf0e10cSrcweir 			m_xPropertySetInfo->getPropertyByName( rPropertyName );
702*cdf0e10cSrcweir 			//throws UnknownPropertyException, if so
703*cdf0e10cSrcweir 		}
704*cdf0e10cSrcweir 		return; //the listener was not registered
705*cdf0e10cSrcweir 	}
706*cdf0e10cSrcweir 
707*cdf0e10cSrcweir 	m_pPropertyChangeListeners->removeInterface( rPropertyName, xListener );
708*cdf0e10cSrcweir 
709*cdf0e10cSrcweir 	if( !m_pPropertyChangeListeners->getContainedTypes().getLength() )
710*cdf0e10cSrcweir 	{
711*cdf0e10cSrcweir 		impl_init_xPropertySetOrigin();
712*cdf0e10cSrcweir 		{
713*cdf0e10cSrcweir 			osl::Guard< osl::Mutex > aGuard( m_aMutex );
714*cdf0e10cSrcweir 			if( !m_xPropertySetOrigin.is() )
715*cdf0e10cSrcweir 			{
716*cdf0e10cSrcweir 				OSL_ENSURE( sal_False, "broadcaster was disposed already" );
717*cdf0e10cSrcweir 				return;
718*cdf0e10cSrcweir 			}
719*cdf0e10cSrcweir 		}
720*cdf0e10cSrcweir 		try
721*cdf0e10cSrcweir 		{
722*cdf0e10cSrcweir 			m_xPropertySetOrigin->removePropertyChangeListener(
723*cdf0e10cSrcweir 				OUString(), static_cast< XPropertyChangeListener * >( m_pMyListenerImpl ) );
724*cdf0e10cSrcweir 		}
725*cdf0e10cSrcweir 		catch( Exception& )
726*cdf0e10cSrcweir 		{
727*cdf0e10cSrcweir 			OSL_ENSURE( sal_False, "could not remove PropertyChangeListener" );
728*cdf0e10cSrcweir 		}
729*cdf0e10cSrcweir 	}
730*cdf0e10cSrcweir }
731*cdf0e10cSrcweir 
732*cdf0e10cSrcweir //--------------------------------------------------------------------------
733*cdf0e10cSrcweir // virtual
734*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
735*cdf0e10cSrcweir 	::removeVetoableChangeListener(
736*cdf0e10cSrcweir 			const OUString& rPropertyName,
737*cdf0e10cSrcweir 			const Reference< XVetoableChangeListener >& xListener )
738*cdf0e10cSrcweir 	throw( UnknownPropertyException,
739*cdf0e10cSrcweir 		   WrappedTargetException,
740*cdf0e10cSrcweir 		   RuntimeException )
741*cdf0e10cSrcweir {
742*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
743*cdf0e10cSrcweir 
744*cdf0e10cSrcweir 	{
745*cdf0e10cSrcweir 		//noop, if no listener registered
746*cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( m_aMutex );
747*cdf0e10cSrcweir 		if( !m_pVetoableChangeListeners )
748*cdf0e10cSrcweir 			return;
749*cdf0e10cSrcweir 	}
750*cdf0e10cSrcweir 	OInterfaceContainerHelper* pContainer =
751*cdf0e10cSrcweir 		m_pVetoableChangeListeners->getContainer( rPropertyName );
752*cdf0e10cSrcweir 
753*cdf0e10cSrcweir 	if( !pContainer )
754*cdf0e10cSrcweir 	{
755*cdf0e10cSrcweir 		if( rPropertyName.getLength() )
756*cdf0e10cSrcweir 		{
757*cdf0e10cSrcweir 			if( !getPropertySetInfo().is() )
758*cdf0e10cSrcweir 				throw UnknownPropertyException();
759*cdf0e10cSrcweir 
760*cdf0e10cSrcweir 			m_xPropertySetInfo->getPropertyByName( rPropertyName );
761*cdf0e10cSrcweir 			//throws UnknownPropertyException, if so
762*cdf0e10cSrcweir 		}
763*cdf0e10cSrcweir 		return; //the listener was not registered
764*cdf0e10cSrcweir 	}
765*cdf0e10cSrcweir 
766*cdf0e10cSrcweir 	m_pVetoableChangeListeners->removeInterface( rPropertyName, xListener );
767*cdf0e10cSrcweir 
768*cdf0e10cSrcweir 	if( !m_pVetoableChangeListeners->getContainedTypes().getLength() )
769*cdf0e10cSrcweir 	{
770*cdf0e10cSrcweir 		impl_init_xPropertySetOrigin();
771*cdf0e10cSrcweir 		{
772*cdf0e10cSrcweir 			osl::Guard< osl::Mutex > aGuard( m_aMutex );
773*cdf0e10cSrcweir 			if( !m_xPropertySetOrigin.is() )
774*cdf0e10cSrcweir 			{
775*cdf0e10cSrcweir 				OSL_ENSURE( sal_False, "broadcaster was disposed already" );
776*cdf0e10cSrcweir 				return;
777*cdf0e10cSrcweir 			}
778*cdf0e10cSrcweir 		}
779*cdf0e10cSrcweir 		try
780*cdf0e10cSrcweir 		{
781*cdf0e10cSrcweir 			m_xPropertySetOrigin->removeVetoableChangeListener(
782*cdf0e10cSrcweir 				OUString(), static_cast< XVetoableChangeListener * >( m_pMyListenerImpl ) );
783*cdf0e10cSrcweir 		}
784*cdf0e10cSrcweir 		catch( Exception& )
785*cdf0e10cSrcweir 		{
786*cdf0e10cSrcweir 			OSL_ENSURE( sal_False, "could not remove VetoableChangeListener" );
787*cdf0e10cSrcweir 		}
788*cdf0e10cSrcweir 	}
789*cdf0e10cSrcweir }
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir //--------------------------------------------------------------------------
792*cdf0e10cSrcweir // own methods.
793*cdf0e10cSrcweir //--------------------------------------------------------------------------
794*cdf0e10cSrcweir 
795*cdf0e10cSrcweir //virtual
796*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
797*cdf0e10cSrcweir 	::impl_disposing( const EventObject& )
798*cdf0e10cSrcweir 	throw( RuntimeException )
799*cdf0e10cSrcweir {
800*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
801*cdf0e10cSrcweir 
802*cdf0e10cSrcweir 	osl::Guard< osl::Mutex > aGuard( m_aMutex );
803*cdf0e10cSrcweir 
804*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
805*cdf0e10cSrcweir 		return;
806*cdf0e10cSrcweir 
807*cdf0e10cSrcweir 	//release all references to the broadcaster:
808*cdf0e10cSrcweir 	m_xResultSetOrigin.clear();
809*cdf0e10cSrcweir 	if(m_xRowOrigin.is())
810*cdf0e10cSrcweir 		m_xRowOrigin.clear();
811*cdf0e10cSrcweir 	if(m_xContentAccessOrigin.is())
812*cdf0e10cSrcweir 		m_xContentAccessOrigin.clear();
813*cdf0e10cSrcweir 	if(m_xPropertySetOrigin.is())
814*cdf0e10cSrcweir 		m_xPropertySetOrigin.clear();
815*cdf0e10cSrcweir 	m_xMetaDataFromOrigin.clear();
816*cdf0e10cSrcweir 	if(m_xPropertySetInfo.is())
817*cdf0e10cSrcweir 		m_xPropertySetInfo.clear();
818*cdf0e10cSrcweir }
819*cdf0e10cSrcweir 
820*cdf0e10cSrcweir //virtual
821*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
822*cdf0e10cSrcweir 	::impl_propertyChange( const PropertyChangeEvent& rEvt )
823*cdf0e10cSrcweir 	throw( RuntimeException )
824*cdf0e10cSrcweir {
825*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
826*cdf0e10cSrcweir 
827*cdf0e10cSrcweir 	PropertyChangeEvent aEvt( rEvt );
828*cdf0e10cSrcweir 	aEvt.Source = static_cast< XPropertySet * >( this );
829*cdf0e10cSrcweir 	aEvt.Further = sal_False;
830*cdf0e10cSrcweir 	impl_notifyPropertyChangeListeners(	aEvt );
831*cdf0e10cSrcweir }
832*cdf0e10cSrcweir 
833*cdf0e10cSrcweir //virtual
834*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
835*cdf0e10cSrcweir 	::impl_vetoableChange( const PropertyChangeEvent& rEvt )
836*cdf0e10cSrcweir 	throw( PropertyVetoException,
837*cdf0e10cSrcweir 		   RuntimeException )
838*cdf0e10cSrcweir {
839*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
840*cdf0e10cSrcweir 
841*cdf0e10cSrcweir 	PropertyChangeEvent aEvt( rEvt );
842*cdf0e10cSrcweir 	aEvt.Source = static_cast< XPropertySet * >( this );
843*cdf0e10cSrcweir 	aEvt.Further = sal_False;
844*cdf0e10cSrcweir 
845*cdf0e10cSrcweir 	impl_notifyVetoableChangeListeners( aEvt );
846*cdf0e10cSrcweir }
847*cdf0e10cSrcweir 
848*cdf0e10cSrcweir //--------------------------------------------------------------------------
849*cdf0e10cSrcweir // XContentAccess methods.	( -- position dependent )
850*cdf0e10cSrcweir //--------------------------------------------------------------------------
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir // virtual
853*cdf0e10cSrcweir OUString SAL_CALL ContentResultSetWrapper
854*cdf0e10cSrcweir 	::queryContentIdentifierString()
855*cdf0e10cSrcweir 	throw( RuntimeException )
856*cdf0e10cSrcweir {
857*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
858*cdf0e10cSrcweir 	impl_init_xContentAccessOrigin();
859*cdf0e10cSrcweir 	if( !m_xContentAccessOrigin.is() )
860*cdf0e10cSrcweir 	{
861*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
862*cdf0e10cSrcweir 		throw RuntimeException();
863*cdf0e10cSrcweir 	}
864*cdf0e10cSrcweir 	return m_xContentAccessOrigin->queryContentIdentifierString();
865*cdf0e10cSrcweir }
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir //--------------------------------------------------------------------------
868*cdf0e10cSrcweir // virtual
869*cdf0e10cSrcweir Reference< XContentIdentifier > SAL_CALL ContentResultSetWrapper
870*cdf0e10cSrcweir 	::queryContentIdentifier()
871*cdf0e10cSrcweir 	throw( RuntimeException )
872*cdf0e10cSrcweir {
873*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
874*cdf0e10cSrcweir 	impl_init_xContentAccessOrigin();
875*cdf0e10cSrcweir 	if( !m_xContentAccessOrigin.is() )
876*cdf0e10cSrcweir 	{
877*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
878*cdf0e10cSrcweir 		throw RuntimeException();
879*cdf0e10cSrcweir 	}
880*cdf0e10cSrcweir 	return m_xContentAccessOrigin->queryContentIdentifier();
881*cdf0e10cSrcweir }
882*cdf0e10cSrcweir 
883*cdf0e10cSrcweir //--------------------------------------------------------------------------
884*cdf0e10cSrcweir // virtual
885*cdf0e10cSrcweir Reference< XContent > SAL_CALL ContentResultSetWrapper
886*cdf0e10cSrcweir 	::queryContent()
887*cdf0e10cSrcweir 	throw( RuntimeException )
888*cdf0e10cSrcweir {
889*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
890*cdf0e10cSrcweir 	impl_init_xContentAccessOrigin();
891*cdf0e10cSrcweir 	if( !m_xContentAccessOrigin.is() )
892*cdf0e10cSrcweir 	{
893*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
894*cdf0e10cSrcweir 		throw RuntimeException();
895*cdf0e10cSrcweir 	}
896*cdf0e10cSrcweir 	return m_xContentAccessOrigin->queryContent();
897*cdf0e10cSrcweir }
898*cdf0e10cSrcweir 
899*cdf0e10cSrcweir //-----------------------------------------------------------------
900*cdf0e10cSrcweir // XResultSet methods.
901*cdf0e10cSrcweir //-----------------------------------------------------------------
902*cdf0e10cSrcweir //virtual
903*cdf0e10cSrcweir 
904*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
905*cdf0e10cSrcweir 	::next()
906*cdf0e10cSrcweir 	throw( SQLException,
907*cdf0e10cSrcweir 		   RuntimeException )
908*cdf0e10cSrcweir {
909*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
912*cdf0e10cSrcweir 	{
913*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
914*cdf0e10cSrcweir 		throw RuntimeException();
915*cdf0e10cSrcweir 	}
916*cdf0e10cSrcweir 	return m_xResultSetOrigin->next();
917*cdf0e10cSrcweir }
918*cdf0e10cSrcweir 
919*cdf0e10cSrcweir //virtual
920*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
921*cdf0e10cSrcweir 	::previous()
922*cdf0e10cSrcweir 	throw( SQLException,
923*cdf0e10cSrcweir 		   RuntimeException )
924*cdf0e10cSrcweir {
925*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
926*cdf0e10cSrcweir 
927*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
928*cdf0e10cSrcweir 	{
929*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
930*cdf0e10cSrcweir 		throw RuntimeException();
931*cdf0e10cSrcweir 	}
932*cdf0e10cSrcweir 	return m_xResultSetOrigin->previous();
933*cdf0e10cSrcweir }
934*cdf0e10cSrcweir 
935*cdf0e10cSrcweir //virtual
936*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
937*cdf0e10cSrcweir 	::absolute( sal_Int32 row )
938*cdf0e10cSrcweir 	throw( SQLException,
939*cdf0e10cSrcweir 		   RuntimeException )
940*cdf0e10cSrcweir {
941*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
942*cdf0e10cSrcweir 
943*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
944*cdf0e10cSrcweir 	{
945*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
946*cdf0e10cSrcweir 		throw RuntimeException();
947*cdf0e10cSrcweir 	}
948*cdf0e10cSrcweir 	return m_xResultSetOrigin->absolute( row );
949*cdf0e10cSrcweir }
950*cdf0e10cSrcweir 
951*cdf0e10cSrcweir //virtual
952*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
953*cdf0e10cSrcweir 	::relative( sal_Int32 rows )
954*cdf0e10cSrcweir 	throw( SQLException,
955*cdf0e10cSrcweir 		   RuntimeException )
956*cdf0e10cSrcweir {
957*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
958*cdf0e10cSrcweir 
959*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
960*cdf0e10cSrcweir 	{
961*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
962*cdf0e10cSrcweir 		throw RuntimeException();
963*cdf0e10cSrcweir 	}
964*cdf0e10cSrcweir 	return m_xResultSetOrigin->relative( rows );
965*cdf0e10cSrcweir }
966*cdf0e10cSrcweir 
967*cdf0e10cSrcweir 
968*cdf0e10cSrcweir //virtual
969*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
970*cdf0e10cSrcweir 	::first()
971*cdf0e10cSrcweir 	throw( SQLException,
972*cdf0e10cSrcweir 		   RuntimeException )
973*cdf0e10cSrcweir {
974*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
975*cdf0e10cSrcweir 
976*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
977*cdf0e10cSrcweir 	{
978*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
979*cdf0e10cSrcweir 		throw RuntimeException();
980*cdf0e10cSrcweir 	}
981*cdf0e10cSrcweir 	return m_xResultSetOrigin->first();
982*cdf0e10cSrcweir }
983*cdf0e10cSrcweir 
984*cdf0e10cSrcweir //virtual
985*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
986*cdf0e10cSrcweir 	::last()
987*cdf0e10cSrcweir 	throw( SQLException,
988*cdf0e10cSrcweir 		   RuntimeException )
989*cdf0e10cSrcweir {
990*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
991*cdf0e10cSrcweir 
992*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
993*cdf0e10cSrcweir 	{
994*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
995*cdf0e10cSrcweir 		throw RuntimeException();
996*cdf0e10cSrcweir 	}
997*cdf0e10cSrcweir 	return m_xResultSetOrigin->last();
998*cdf0e10cSrcweir }
999*cdf0e10cSrcweir 
1000*cdf0e10cSrcweir //virtual
1001*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
1002*cdf0e10cSrcweir 	::beforeFirst()
1003*cdf0e10cSrcweir 	throw( SQLException,
1004*cdf0e10cSrcweir 		   RuntimeException )
1005*cdf0e10cSrcweir {
1006*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1007*cdf0e10cSrcweir 
1008*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
1009*cdf0e10cSrcweir 	{
1010*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1011*cdf0e10cSrcweir 		throw RuntimeException();
1012*cdf0e10cSrcweir 	}
1013*cdf0e10cSrcweir 	m_xResultSetOrigin->beforeFirst();
1014*cdf0e10cSrcweir }
1015*cdf0e10cSrcweir 
1016*cdf0e10cSrcweir //virtual
1017*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
1018*cdf0e10cSrcweir 	::afterLast()
1019*cdf0e10cSrcweir 	throw( SQLException,
1020*cdf0e10cSrcweir 		   RuntimeException )
1021*cdf0e10cSrcweir {
1022*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1023*cdf0e10cSrcweir 
1024*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
1025*cdf0e10cSrcweir 	{
1026*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1027*cdf0e10cSrcweir 		throw RuntimeException();
1028*cdf0e10cSrcweir 	}
1029*cdf0e10cSrcweir 	m_xResultSetOrigin->afterLast();
1030*cdf0e10cSrcweir }
1031*cdf0e10cSrcweir 
1032*cdf0e10cSrcweir //virtual
1033*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
1034*cdf0e10cSrcweir 	::isAfterLast()
1035*cdf0e10cSrcweir 	throw( SQLException,
1036*cdf0e10cSrcweir 		   RuntimeException )
1037*cdf0e10cSrcweir {
1038*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1039*cdf0e10cSrcweir 
1040*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
1041*cdf0e10cSrcweir 	{
1042*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1043*cdf0e10cSrcweir 		throw RuntimeException();
1044*cdf0e10cSrcweir 	}
1045*cdf0e10cSrcweir 	return m_xResultSetOrigin->isAfterLast();
1046*cdf0e10cSrcweir }
1047*cdf0e10cSrcweir 
1048*cdf0e10cSrcweir //virtual
1049*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
1050*cdf0e10cSrcweir 	::isBeforeFirst()
1051*cdf0e10cSrcweir 	throw( SQLException,
1052*cdf0e10cSrcweir 		   RuntimeException )
1053*cdf0e10cSrcweir {
1054*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1055*cdf0e10cSrcweir 
1056*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
1057*cdf0e10cSrcweir 	{
1058*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1059*cdf0e10cSrcweir 		throw RuntimeException();
1060*cdf0e10cSrcweir 	}
1061*cdf0e10cSrcweir 	return m_xResultSetOrigin->isBeforeFirst();
1062*cdf0e10cSrcweir }
1063*cdf0e10cSrcweir 
1064*cdf0e10cSrcweir //virtual
1065*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
1066*cdf0e10cSrcweir 	::isFirst()
1067*cdf0e10cSrcweir 	throw( SQLException,
1068*cdf0e10cSrcweir 		   RuntimeException )
1069*cdf0e10cSrcweir {
1070*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1071*cdf0e10cSrcweir 
1072*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
1073*cdf0e10cSrcweir 	{
1074*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1075*cdf0e10cSrcweir 		throw RuntimeException();
1076*cdf0e10cSrcweir 	}
1077*cdf0e10cSrcweir 	return m_xResultSetOrigin->isFirst();
1078*cdf0e10cSrcweir }
1079*cdf0e10cSrcweir 
1080*cdf0e10cSrcweir //virtual
1081*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
1082*cdf0e10cSrcweir 	::isLast()
1083*cdf0e10cSrcweir 	throw( SQLException,
1084*cdf0e10cSrcweir 		   RuntimeException )
1085*cdf0e10cSrcweir {
1086*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1087*cdf0e10cSrcweir 
1088*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
1089*cdf0e10cSrcweir 	{
1090*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1091*cdf0e10cSrcweir 		throw RuntimeException();
1092*cdf0e10cSrcweir 	}
1093*cdf0e10cSrcweir 	return m_xResultSetOrigin->isLast();
1094*cdf0e10cSrcweir }
1095*cdf0e10cSrcweir 
1096*cdf0e10cSrcweir 
1097*cdf0e10cSrcweir //virtual
1098*cdf0e10cSrcweir sal_Int32 SAL_CALL ContentResultSetWrapper
1099*cdf0e10cSrcweir 	::getRow()
1100*cdf0e10cSrcweir 	throw( SQLException,
1101*cdf0e10cSrcweir 		   RuntimeException )
1102*cdf0e10cSrcweir {
1103*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1104*cdf0e10cSrcweir 
1105*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
1106*cdf0e10cSrcweir 	{
1107*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1108*cdf0e10cSrcweir 		throw RuntimeException();
1109*cdf0e10cSrcweir 	}
1110*cdf0e10cSrcweir 	return m_xResultSetOrigin->getRow();
1111*cdf0e10cSrcweir }
1112*cdf0e10cSrcweir 
1113*cdf0e10cSrcweir //virtual
1114*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapper
1115*cdf0e10cSrcweir 	::refreshRow()
1116*cdf0e10cSrcweir 	throw( SQLException,
1117*cdf0e10cSrcweir 		   RuntimeException )
1118*cdf0e10cSrcweir {
1119*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1120*cdf0e10cSrcweir 
1121*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
1122*cdf0e10cSrcweir 	{
1123*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1124*cdf0e10cSrcweir 		throw RuntimeException();
1125*cdf0e10cSrcweir 	}
1126*cdf0e10cSrcweir 	m_xResultSetOrigin->refreshRow();
1127*cdf0e10cSrcweir }
1128*cdf0e10cSrcweir 
1129*cdf0e10cSrcweir //virtual
1130*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
1131*cdf0e10cSrcweir 	::rowUpdated()
1132*cdf0e10cSrcweir 	throw( SQLException,
1133*cdf0e10cSrcweir 		   RuntimeException )
1134*cdf0e10cSrcweir {
1135*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1136*cdf0e10cSrcweir 
1137*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
1138*cdf0e10cSrcweir 	{
1139*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1140*cdf0e10cSrcweir 		throw RuntimeException();
1141*cdf0e10cSrcweir 	}
1142*cdf0e10cSrcweir 	return m_xResultSetOrigin->rowUpdated();
1143*cdf0e10cSrcweir }
1144*cdf0e10cSrcweir //virtual
1145*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
1146*cdf0e10cSrcweir 	::rowInserted()
1147*cdf0e10cSrcweir 	throw( SQLException,
1148*cdf0e10cSrcweir 		   RuntimeException )
1149*cdf0e10cSrcweir {
1150*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1151*cdf0e10cSrcweir 
1152*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
1153*cdf0e10cSrcweir 	{
1154*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1155*cdf0e10cSrcweir 		throw RuntimeException();
1156*cdf0e10cSrcweir 	}
1157*cdf0e10cSrcweir 	return m_xResultSetOrigin->rowInserted();
1158*cdf0e10cSrcweir }
1159*cdf0e10cSrcweir 
1160*cdf0e10cSrcweir //virtual
1161*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
1162*cdf0e10cSrcweir 	::rowDeleted()
1163*cdf0e10cSrcweir 	throw( SQLException,
1164*cdf0e10cSrcweir 		   RuntimeException )
1165*cdf0e10cSrcweir {
1166*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1167*cdf0e10cSrcweir 
1168*cdf0e10cSrcweir 	if( !m_xResultSetOrigin.is() )
1169*cdf0e10cSrcweir 	{
1170*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1171*cdf0e10cSrcweir 		throw RuntimeException();
1172*cdf0e10cSrcweir 	}
1173*cdf0e10cSrcweir 	return m_xResultSetOrigin->rowDeleted();
1174*cdf0e10cSrcweir }
1175*cdf0e10cSrcweir 
1176*cdf0e10cSrcweir //virtual
1177*cdf0e10cSrcweir Reference< XInterface > SAL_CALL ContentResultSetWrapper
1178*cdf0e10cSrcweir 	::getStatement()
1179*cdf0e10cSrcweir 	throw( SQLException,
1180*cdf0e10cSrcweir 		   RuntimeException )
1181*cdf0e10cSrcweir {
1182*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1183*cdf0e10cSrcweir 	//@todo ?return anything
1184*cdf0e10cSrcweir 	return Reference< XInterface >();
1185*cdf0e10cSrcweir }
1186*cdf0e10cSrcweir 
1187*cdf0e10cSrcweir //-----------------------------------------------------------------
1188*cdf0e10cSrcweir // XRow methods.
1189*cdf0e10cSrcweir //-----------------------------------------------------------------
1190*cdf0e10cSrcweir 
1191*cdf0e10cSrcweir #define XROW_GETXXX( getXXX )									\
1192*cdf0e10cSrcweir impl_EnsureNotDisposed();										\
1193*cdf0e10cSrcweir impl_init_xRowOrigin();											\
1194*cdf0e10cSrcweir if( !m_xRowOrigin.is() )										\
1195*cdf0e10cSrcweir {																\
1196*cdf0e10cSrcweir 	OSL_ENSURE( sal_False, "broadcaster was disposed already" );\
1197*cdf0e10cSrcweir 	throw RuntimeException();									\
1198*cdf0e10cSrcweir }																\
1199*cdf0e10cSrcweir return m_xRowOrigin->getXXX( columnIndex );
1200*cdf0e10cSrcweir 
1201*cdf0e10cSrcweir //virtual
1202*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
1203*cdf0e10cSrcweir 	::wasNull()
1204*cdf0e10cSrcweir 	throw( SQLException,
1205*cdf0e10cSrcweir 		   RuntimeException )
1206*cdf0e10cSrcweir {
1207*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1208*cdf0e10cSrcweir 	impl_init_xRowOrigin();
1209*cdf0e10cSrcweir 	if( !m_xRowOrigin.is() )
1210*cdf0e10cSrcweir 	{
1211*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1212*cdf0e10cSrcweir 		throw RuntimeException();
1213*cdf0e10cSrcweir 	}
1214*cdf0e10cSrcweir 	return m_xRowOrigin->wasNull();
1215*cdf0e10cSrcweir }
1216*cdf0e10cSrcweir 
1217*cdf0e10cSrcweir //virtual
1218*cdf0e10cSrcweir rtl::OUString SAL_CALL ContentResultSetWrapper
1219*cdf0e10cSrcweir 	::getString( sal_Int32 columnIndex )
1220*cdf0e10cSrcweir 	throw( SQLException,
1221*cdf0e10cSrcweir 		   RuntimeException )
1222*cdf0e10cSrcweir {
1223*cdf0e10cSrcweir 	XROW_GETXXX( getString );
1224*cdf0e10cSrcweir }
1225*cdf0e10cSrcweir 
1226*cdf0e10cSrcweir //virtual
1227*cdf0e10cSrcweir sal_Bool SAL_CALL ContentResultSetWrapper
1228*cdf0e10cSrcweir 	::getBoolean( sal_Int32 columnIndex )
1229*cdf0e10cSrcweir 	throw( SQLException,
1230*cdf0e10cSrcweir 		   RuntimeException )
1231*cdf0e10cSrcweir {
1232*cdf0e10cSrcweir 	XROW_GETXXX( getBoolean );
1233*cdf0e10cSrcweir }
1234*cdf0e10cSrcweir 
1235*cdf0e10cSrcweir //virtual
1236*cdf0e10cSrcweir sal_Int8 SAL_CALL ContentResultSetWrapper
1237*cdf0e10cSrcweir 	::getByte( sal_Int32 columnIndex )
1238*cdf0e10cSrcweir 	throw( SQLException,
1239*cdf0e10cSrcweir 		   RuntimeException )
1240*cdf0e10cSrcweir {
1241*cdf0e10cSrcweir 	XROW_GETXXX( getByte );
1242*cdf0e10cSrcweir }
1243*cdf0e10cSrcweir 
1244*cdf0e10cSrcweir //virtual
1245*cdf0e10cSrcweir sal_Int16 SAL_CALL ContentResultSetWrapper
1246*cdf0e10cSrcweir 	::getShort( sal_Int32 columnIndex )
1247*cdf0e10cSrcweir 	throw( SQLException,
1248*cdf0e10cSrcweir 		   RuntimeException )
1249*cdf0e10cSrcweir {
1250*cdf0e10cSrcweir 	XROW_GETXXX( getShort );
1251*cdf0e10cSrcweir }
1252*cdf0e10cSrcweir 
1253*cdf0e10cSrcweir //virtual
1254*cdf0e10cSrcweir sal_Int32 SAL_CALL ContentResultSetWrapper
1255*cdf0e10cSrcweir 	::getInt( sal_Int32 columnIndex )
1256*cdf0e10cSrcweir 	throw( SQLException,
1257*cdf0e10cSrcweir 		   RuntimeException )
1258*cdf0e10cSrcweir {
1259*cdf0e10cSrcweir 	XROW_GETXXX( getInt );
1260*cdf0e10cSrcweir }
1261*cdf0e10cSrcweir 
1262*cdf0e10cSrcweir //virtual
1263*cdf0e10cSrcweir sal_Int64 SAL_CALL ContentResultSetWrapper
1264*cdf0e10cSrcweir 	::getLong( sal_Int32 columnIndex )
1265*cdf0e10cSrcweir 	throw( SQLException,
1266*cdf0e10cSrcweir 		   RuntimeException )
1267*cdf0e10cSrcweir {
1268*cdf0e10cSrcweir 	XROW_GETXXX( getLong );
1269*cdf0e10cSrcweir }
1270*cdf0e10cSrcweir 
1271*cdf0e10cSrcweir //virtual
1272*cdf0e10cSrcweir float SAL_CALL ContentResultSetWrapper
1273*cdf0e10cSrcweir 	::getFloat( sal_Int32 columnIndex )
1274*cdf0e10cSrcweir 	throw( SQLException,
1275*cdf0e10cSrcweir 		   RuntimeException )
1276*cdf0e10cSrcweir {
1277*cdf0e10cSrcweir 	XROW_GETXXX( getFloat );
1278*cdf0e10cSrcweir }
1279*cdf0e10cSrcweir 
1280*cdf0e10cSrcweir //virtual
1281*cdf0e10cSrcweir double SAL_CALL ContentResultSetWrapper
1282*cdf0e10cSrcweir 	::getDouble( sal_Int32 columnIndex )
1283*cdf0e10cSrcweir 	throw( SQLException,
1284*cdf0e10cSrcweir 		   RuntimeException )
1285*cdf0e10cSrcweir {
1286*cdf0e10cSrcweir 	XROW_GETXXX( getDouble );
1287*cdf0e10cSrcweir }
1288*cdf0e10cSrcweir 
1289*cdf0e10cSrcweir //virtual
1290*cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL ContentResultSetWrapper
1291*cdf0e10cSrcweir 	::getBytes( sal_Int32 columnIndex )
1292*cdf0e10cSrcweir 	throw( SQLException,
1293*cdf0e10cSrcweir 		   RuntimeException )
1294*cdf0e10cSrcweir {
1295*cdf0e10cSrcweir 	XROW_GETXXX( getBytes );
1296*cdf0e10cSrcweir }
1297*cdf0e10cSrcweir 
1298*cdf0e10cSrcweir //virtual
1299*cdf0e10cSrcweir Date SAL_CALL ContentResultSetWrapper
1300*cdf0e10cSrcweir 	::getDate( sal_Int32 columnIndex )
1301*cdf0e10cSrcweir 	throw( SQLException,
1302*cdf0e10cSrcweir 		   RuntimeException )
1303*cdf0e10cSrcweir {
1304*cdf0e10cSrcweir 	XROW_GETXXX( getDate );
1305*cdf0e10cSrcweir }
1306*cdf0e10cSrcweir 
1307*cdf0e10cSrcweir //virtual
1308*cdf0e10cSrcweir Time SAL_CALL ContentResultSetWrapper
1309*cdf0e10cSrcweir 	::getTime( sal_Int32 columnIndex )
1310*cdf0e10cSrcweir 	throw( SQLException,
1311*cdf0e10cSrcweir 		   RuntimeException )
1312*cdf0e10cSrcweir {
1313*cdf0e10cSrcweir 	XROW_GETXXX( getTime );
1314*cdf0e10cSrcweir }
1315*cdf0e10cSrcweir 
1316*cdf0e10cSrcweir //virtual
1317*cdf0e10cSrcweir DateTime SAL_CALL ContentResultSetWrapper
1318*cdf0e10cSrcweir 	::getTimestamp( sal_Int32 columnIndex )
1319*cdf0e10cSrcweir 	throw( SQLException,
1320*cdf0e10cSrcweir 		   RuntimeException )
1321*cdf0e10cSrcweir {
1322*cdf0e10cSrcweir 	XROW_GETXXX( getTimestamp );
1323*cdf0e10cSrcweir }
1324*cdf0e10cSrcweir 
1325*cdf0e10cSrcweir //virtual
1326*cdf0e10cSrcweir Reference< com::sun::star::io::XInputStream >
1327*cdf0e10cSrcweir 	SAL_CALL ContentResultSetWrapper
1328*cdf0e10cSrcweir 	::getBinaryStream( sal_Int32 columnIndex )
1329*cdf0e10cSrcweir 	throw( SQLException,
1330*cdf0e10cSrcweir 		   RuntimeException )
1331*cdf0e10cSrcweir {
1332*cdf0e10cSrcweir 	XROW_GETXXX( getBinaryStream );
1333*cdf0e10cSrcweir }
1334*cdf0e10cSrcweir 
1335*cdf0e10cSrcweir //virtual
1336*cdf0e10cSrcweir Reference< com::sun::star::io::XInputStream >
1337*cdf0e10cSrcweir 	SAL_CALL ContentResultSetWrapper
1338*cdf0e10cSrcweir 	::getCharacterStream( sal_Int32 columnIndex )
1339*cdf0e10cSrcweir 	throw( SQLException,
1340*cdf0e10cSrcweir 		   RuntimeException )
1341*cdf0e10cSrcweir {
1342*cdf0e10cSrcweir 	XROW_GETXXX( getCharacterStream );
1343*cdf0e10cSrcweir }
1344*cdf0e10cSrcweir 
1345*cdf0e10cSrcweir //virtual
1346*cdf0e10cSrcweir Any SAL_CALL ContentResultSetWrapper
1347*cdf0e10cSrcweir 	::getObject( sal_Int32 columnIndex,
1348*cdf0e10cSrcweir 		   const Reference<
1349*cdf0e10cSrcweir 			com::sun::star::container::XNameAccess >& typeMap )
1350*cdf0e10cSrcweir 	throw( SQLException,
1351*cdf0e10cSrcweir 		   RuntimeException )
1352*cdf0e10cSrcweir {
1353*cdf0e10cSrcweir 	//if you change this macro please pay attention to
1354*cdf0e10cSrcweir 	//define XROW_GETXXX, where this is similar implemented
1355*cdf0e10cSrcweir 
1356*cdf0e10cSrcweir 	impl_EnsureNotDisposed();
1357*cdf0e10cSrcweir 	impl_init_xRowOrigin();
1358*cdf0e10cSrcweir 	if( !m_xRowOrigin.is() )
1359*cdf0e10cSrcweir 	{
1360*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "broadcaster was disposed already" );
1361*cdf0e10cSrcweir 		throw RuntimeException();
1362*cdf0e10cSrcweir 	}
1363*cdf0e10cSrcweir 	return m_xRowOrigin->getObject( columnIndex, typeMap );
1364*cdf0e10cSrcweir }
1365*cdf0e10cSrcweir 
1366*cdf0e10cSrcweir //virtual
1367*cdf0e10cSrcweir Reference< XRef > SAL_CALL ContentResultSetWrapper
1368*cdf0e10cSrcweir 	::getRef( sal_Int32 columnIndex )
1369*cdf0e10cSrcweir 	throw( SQLException,
1370*cdf0e10cSrcweir 		   RuntimeException )
1371*cdf0e10cSrcweir {
1372*cdf0e10cSrcweir 	XROW_GETXXX( getRef );
1373*cdf0e10cSrcweir }
1374*cdf0e10cSrcweir 
1375*cdf0e10cSrcweir //virtual
1376*cdf0e10cSrcweir Reference< XBlob > SAL_CALL ContentResultSetWrapper
1377*cdf0e10cSrcweir 	::getBlob( sal_Int32 columnIndex )
1378*cdf0e10cSrcweir 	throw( SQLException,
1379*cdf0e10cSrcweir 		   RuntimeException )
1380*cdf0e10cSrcweir {
1381*cdf0e10cSrcweir 	XROW_GETXXX( getBlob );
1382*cdf0e10cSrcweir }
1383*cdf0e10cSrcweir 
1384*cdf0e10cSrcweir //virtual
1385*cdf0e10cSrcweir Reference< XClob > SAL_CALL ContentResultSetWrapper
1386*cdf0e10cSrcweir 	::getClob( sal_Int32 columnIndex )
1387*cdf0e10cSrcweir 	throw( SQLException,
1388*cdf0e10cSrcweir 		   RuntimeException )
1389*cdf0e10cSrcweir {
1390*cdf0e10cSrcweir 	XROW_GETXXX( getClob );
1391*cdf0e10cSrcweir }
1392*cdf0e10cSrcweir 
1393*cdf0e10cSrcweir //virtual
1394*cdf0e10cSrcweir Reference< XArray > SAL_CALL ContentResultSetWrapper
1395*cdf0e10cSrcweir 	::getArray( sal_Int32 columnIndex )
1396*cdf0e10cSrcweir 	throw( SQLException,
1397*cdf0e10cSrcweir 		   RuntimeException )
1398*cdf0e10cSrcweir {
1399*cdf0e10cSrcweir 	XROW_GETXXX( getArray );
1400*cdf0e10cSrcweir }
1401*cdf0e10cSrcweir 
1402*cdf0e10cSrcweir //--------------------------------------------------------------------------
1403*cdf0e10cSrcweir //--------------------------------------------------------------------------
1404*cdf0e10cSrcweir // class ContentResultSetWrapperListener
1405*cdf0e10cSrcweir //--------------------------------------------------------------------------
1406*cdf0e10cSrcweir //--------------------------------------------------------------------------
1407*cdf0e10cSrcweir 
1408*cdf0e10cSrcweir ContentResultSetWrapperListener::ContentResultSetWrapperListener(
1409*cdf0e10cSrcweir 	ContentResultSetWrapper* pOwner )
1410*cdf0e10cSrcweir 	: m_pOwner( pOwner )
1411*cdf0e10cSrcweir {
1412*cdf0e10cSrcweir }
1413*cdf0e10cSrcweir 
1414*cdf0e10cSrcweir ContentResultSetWrapperListener::~ContentResultSetWrapperListener()
1415*cdf0e10cSrcweir {
1416*cdf0e10cSrcweir }
1417*cdf0e10cSrcweir 
1418*cdf0e10cSrcweir //--------------------------------------------------------------------------
1419*cdf0e10cSrcweir // XInterface methods.
1420*cdf0e10cSrcweir //--------------------------------------------------------------------------
1421*cdf0e10cSrcweir //list all interfaces inclusive baseclasses of interfaces
1422*cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( ContentResultSetWrapperListener )
1423*cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( ContentResultSetWrapperListener )
1424*cdf0e10cSrcweir 
1425*cdf0e10cSrcweir 	static_cast< XEventListener * >(
1426*cdf0e10cSrcweir 					 static_cast< XPropertyChangeListener * >(this))
1427*cdf0e10cSrcweir 	, SAL_STATIC_CAST( XPropertyChangeListener*, this )
1428*cdf0e10cSrcweir 	, SAL_STATIC_CAST( XVetoableChangeListener*, this )
1429*cdf0e10cSrcweir 
1430*cdf0e10cSrcweir QUERYINTERFACE_IMPL_END
1431*cdf0e10cSrcweir 
1432*cdf0e10cSrcweir 
1433*cdf0e10cSrcweir //--------------------------------------------------------------------------
1434*cdf0e10cSrcweir //XEventListener methods.
1435*cdf0e10cSrcweir //--------------------------------------------------------------------------
1436*cdf0e10cSrcweir 
1437*cdf0e10cSrcweir //virtual
1438*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapperListener
1439*cdf0e10cSrcweir 	::disposing( const EventObject& rEventObject )
1440*cdf0e10cSrcweir 	throw( RuntimeException )
1441*cdf0e10cSrcweir {
1442*cdf0e10cSrcweir 	if( m_pOwner )
1443*cdf0e10cSrcweir 		m_pOwner->impl_disposing( rEventObject );
1444*cdf0e10cSrcweir }
1445*cdf0e10cSrcweir 
1446*cdf0e10cSrcweir //--------------------------------------------------------------------------
1447*cdf0e10cSrcweir //XPropertyChangeListener methods.
1448*cdf0e10cSrcweir //--------------------------------------------------------------------------
1449*cdf0e10cSrcweir 
1450*cdf0e10cSrcweir //virtual
1451*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapperListener
1452*cdf0e10cSrcweir 	::propertyChange( const PropertyChangeEvent& rEvt )
1453*cdf0e10cSrcweir 	throw( RuntimeException )
1454*cdf0e10cSrcweir {
1455*cdf0e10cSrcweir 	if( m_pOwner )
1456*cdf0e10cSrcweir 		m_pOwner->impl_propertyChange( rEvt );
1457*cdf0e10cSrcweir }
1458*cdf0e10cSrcweir 
1459*cdf0e10cSrcweir //--------------------------------------------------------------------------
1460*cdf0e10cSrcweir //XVetoableChangeListener methods.
1461*cdf0e10cSrcweir //--------------------------------------------------------------------------
1462*cdf0e10cSrcweir //virtual
1463*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapperListener
1464*cdf0e10cSrcweir 	::vetoableChange( const PropertyChangeEvent& rEvt )
1465*cdf0e10cSrcweir 	throw( PropertyVetoException,
1466*cdf0e10cSrcweir 		   RuntimeException )
1467*cdf0e10cSrcweir {
1468*cdf0e10cSrcweir 	if( m_pOwner )
1469*cdf0e10cSrcweir 		m_pOwner->impl_vetoableChange( rEvt );
1470*cdf0e10cSrcweir }
1471*cdf0e10cSrcweir 
1472*cdf0e10cSrcweir void SAL_CALL ContentResultSetWrapperListener
1473*cdf0e10cSrcweir 	::impl_OwnerDies()
1474*cdf0e10cSrcweir {
1475*cdf0e10cSrcweir 	m_pOwner = NULL;
1476*cdf0e10cSrcweir }
1477*cdf0e10cSrcweir 
1478