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