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