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