LibreOffice Module ucb (master)  1
contentresultsetwrapper.cxx
Go to the documentation of this file.
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 
22 #include <com/sun/star/lang/DisposedException.hpp>
23 #include <rtl/ustring.hxx>
24 #include <osl/diagnose.h>
27 
28 using namespace com::sun::star::beans;
29 using namespace com::sun::star::lang;
30 using namespace com::sun::star::sdbc;
31 using namespace com::sun::star::ucb;
32 using namespace com::sun::star::uno;
33 using namespace com::sun::star::util;
34 using namespace comphelper;
35 using namespace cppu;
36 
37 
38 // class ContentResultSetWrapper
39 
40 
42  Reference< XResultSet > const & xOrigin )
43  : m_xResultSetOrigin( xOrigin )
44  , m_nForwardOnly( 2 )
45  , m_bDisposed( false )
46  , m_bInDispose( false )
47 {
49 
50  OSL_ENSURE( m_xResultSetOrigin.is(), "XResultSet is required" );
51 
53 };
54 
55 
57 {
58  {
59  osl::Guard< osl::Mutex > aGuard( m_aMutex );
60  if(m_xRowOrigin.is())
61  return;
62  }
63 
64  Reference< XRow > xOrgig( m_xResultSetOrigin, UNO_QUERY );
65 
66  {
67  osl::Guard< osl::Mutex > aGuard( m_aMutex );
68  m_xRowOrigin = xOrgig;
69  OSL_ENSURE( m_xRowOrigin.is(), "interface XRow is required" );
70  }
71 }
72 
74 {
75  {
76  osl::Guard< osl::Mutex > aGuard( m_aMutex );
77  if(m_xContentAccessOrigin.is())
78  return;
79  }
80 
82 
83  {
84  osl::Guard< osl::Mutex > aGuard( m_aMutex );
85  m_xContentAccessOrigin = xOrgig;
86  OSL_ENSURE( m_xContentAccessOrigin.is(), "interface XContentAccess is required" );
87  }
88 }
89 
90 
92 {
93  {
94  osl::Guard< osl::Mutex > aGuard( m_aMutex );
95  if( m_xPropertySetOrigin.is() )
96  return;
97  }
98 
100 
101  {
102  osl::Guard< osl::Mutex > aGuard( m_aMutex );
103  m_xPropertySetOrigin = xOrig;
104  OSL_ENSURE( m_xPropertySetOrigin.is(), "interface XPropertySet is required" );
105  }
106 }
107 
109 {
110  //call this at the end of constructor of derived class
111 
112 
113  //listen to disposing from Origin:
114  Reference< XComponent > xComponentOrigin( m_xResultSetOrigin, UNO_QUERY );
115  OSL_ENSURE( xComponentOrigin.is(), "interface XComponent is required" );
116  xComponentOrigin->addEventListener( static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) );
117 }
118 
120 {
121  //call impl_deinit() at start of destructor of derived class
122 };
123 
125 {
126  //call this at start of destructor of derived class
127 
128  m_xMyListenerImpl->impl_OwnerDies();
129 }
130 
131 //virtual
133 {
134  {
135  osl::Guard< osl::Mutex > aGuard( m_aMutex );
136  if( m_xPropertySetInfo.is() )
137  return;
138 
140  if( !m_xPropertySetOrigin.is() )
141  return;
142  }
143 
145  m_xPropertySetOrigin->getPropertySetInfo();
146 
147  {
148  osl::Guard< osl::Mutex > aGuard( m_aMutex );
149  m_xPropertySetInfo = xOrig;
150  }
151 }
152 
154 {
155  osl::Guard< osl::Mutex > aGuard( m_aMutex );
156  if( m_bDisposed )
157  throw DisposedException();
158 }
159 
161 {
162  osl::Guard< osl::Mutex > aGuard( m_aMutex );
166 }
167 
169 {
170  osl::Guard< osl::Mutex > aGuard( m_aMutex );
174 }
175 
176 void ContentResultSetWrapper::impl_notifyPropertyChangeListeners( const PropertyChangeEvent& rEvt )
177 {
178  {
179  osl::Guard< osl::Mutex > aGuard( m_aMutex );
181  return;
182  }
183 
184  // Notify listeners interested especially in the changed property.
185  OInterfaceContainerHelper* pContainer =
186  m_pPropertyChangeListeners->getContainer( rEvt.PropertyName );
187  if( pContainer )
188  {
189  OInterfaceIteratorHelper aIter( *pContainer );
190  while( aIter.hasMoreElements() )
191  {
193  aIter.next(), UNO_QUERY );
194  if( xListener.is() )
195  xListener->propertyChange( rEvt );
196  }
197  }
198 
199  // Notify listeners interested in all properties.
200  pContainer = m_pPropertyChangeListeners->getContainer( OUString() );
201  if( pContainer )
202  {
203  OInterfaceIteratorHelper aIter( *pContainer );
204  while( aIter.hasMoreElements() )
205  {
207  aIter.next(), UNO_QUERY );
208  if( xListener.is() )
209  xListener->propertyChange( rEvt );
210  }
211  }
212 }
213 
214 void ContentResultSetWrapper::impl_notifyVetoableChangeListeners( const PropertyChangeEvent& rEvt )
215 {
216  {
217  osl::Guard< osl::Mutex > aGuard( m_aMutex );
219  return;
220  }
221 
222  // Notify listeners interested especially in the changed property.
223  OInterfaceContainerHelper* pContainer =
224  m_pVetoableChangeListeners->getContainer( rEvt.PropertyName );
225  if( pContainer )
226  {
227  OInterfaceIteratorHelper aIter( *pContainer );
228  while( aIter.hasMoreElements() )
229  {
231  aIter.next(), UNO_QUERY );
232  if( xListener.is() )
233  xListener->vetoableChange( rEvt );
234  }
235  }
236 
237  // Notify listeners interested in all properties.
238  pContainer = m_pVetoableChangeListeners->getContainer( OUString() );
239  if( pContainer )
240  {
241  OInterfaceIteratorHelper aIter( *pContainer );
242  while( aIter.hasMoreElements() )
243  {
245  aIter.next(), UNO_QUERY );
246  if( xListener.is() )
247  xListener->vetoableChange( rEvt );
248  }
249  }
250 }
251 
253 {
254  //m_nForwardOnly == 2 -> don't know
255  //m_nForwardOnly == 1 -> YES
256  //m_nForwardOnly == 0 -> NO
257 
258  //@todo replace this with lines in comment
259  osl::Guard< osl::Mutex > aGuard( m_aMutex );
260  m_nForwardOnly = 0;
261  return false;
262 
263 
264  /*
265  ReacquireableGuard aGuard( m_aMutex );
266  if( m_nForwardOnly == 2 )
267  {
268  aGuard.clear();
269  if( !getPropertySetInfo().is() )
270  {
271  aGuard.reacquire();
272  m_nForwardOnly = 0;
273  return m_nForwardOnly;
274  }
275  aGuard.reacquire();
276 
277  OUString aName("ResultSetType");
278  //find out, if we are ForwardOnly and cache the value:
279 
280  impl_init_xPropertySetOrigin();
281  if( !m_xPropertySetOrigin.is() )
282  {
283  OSL_FAIL( "broadcaster was disposed already" );
284  m_nForwardOnly = 0;
285  return m_nForwardOnly;
286  }
287 
288  aGuard.clear();
289  Any aAny = m_xPropertySetOrigin->getPropertyValue( aName );
290 
291  aGuard.reacquire();
292  long nResultSetType;
293  if( ( aAny >>= nResultSetType ) &&
294  ( nResultSetType == ResultSetType::FORWARD_ONLY ) )
295  m_nForwardOnly = 1;
296  else
297  m_nForwardOnly = 0;
298  }
299  return m_nForwardOnly;
300  */
301 }
302 
303 
304 // XInterface methods.
305 
306 css::uno::Any SAL_CALL ContentResultSetWrapper::queryInterface( const css::uno::Type & rType )
307 {
308  //list all interfaces inclusive baseclasses of interfaces
309  css::uno::Any aRet = cppu::queryInterface( rType,
310  static_cast< XComponent* >(this),
311  static_cast< XCloseable* >(this),
312  static_cast< XResultSetMetaDataSupplier* >(this),
313  static_cast< XPropertySet* >(this),
314  static_cast< XContentAccess* >(this),
315  static_cast< XResultSet* >(this),
316  static_cast< XRow* >(this)
317  );
318  return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
319 }
320 
321 // XComponent methods.
322 
323 // virtual
325 {
327 
328  bool isCleared = false;
329  osl::ResettableMutexGuard aGuard(m_aMutex);
330  if( m_bInDispose || m_bDisposed )
331  return;
332  m_bInDispose = true;
333 
334  if( m_xPropertySetOrigin.is() )
335  {
336  aGuard.clear();
337  isCleared = true;
338  try
339  {
340  m_xPropertySetOrigin->removePropertyChangeListener(
341  OUString(), static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) );
342  }
343  catch( Exception& )
344  {
345  OSL_FAIL( "could not remove PropertyChangeListener" );
346  }
347  try
348  {
349  m_xPropertySetOrigin->removeVetoableChangeListener(
350  OUString(), static_cast< XVetoableChangeListener * >( m_xMyListenerImpl.get() ) );
351  }
352  catch( Exception& )
353  {
354  OSL_FAIL( "could not remove VetoableChangeListener" );
355  }
356 
357  Reference< XComponent > xComponentOrigin( m_xResultSetOrigin, UNO_QUERY );
358  OSL_ENSURE( xComponentOrigin.is(), "interface XComponent is required" );
359  xComponentOrigin->removeEventListener( static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) );
360  }
361 
362  if (isCleared)
363  {
364  aGuard.reset();
365  isCleared = false;
366  }
368  {
369  EventObject aEvt;
370  aEvt.Source = static_cast< XComponent * >( this );
371 
372  aGuard.clear();
373  isCleared = true;
374  m_pDisposeEventListeners->disposeAndClear( aEvt );
375  }
376 
377  if (isCleared)
378  {
379  aGuard.reset();
380  isCleared = false;
381  }
383  {
384  EventObject aEvt;
385  aEvt.Source = static_cast< XPropertySet * >( this );
386 
387  aGuard.clear();
388  isCleared = true;
389  m_pPropertyChangeListeners->disposeAndClear( aEvt );
390  }
391 
392  if (isCleared)
393  {
394  aGuard.reset();
395  isCleared = false;
396  }
398  {
399  EventObject aEvt;
400  aEvt.Source = static_cast< XPropertySet * >( this );
401 
402  aGuard.clear();
403  isCleared = true;
404  m_pVetoableChangeListeners->disposeAndClear( aEvt );
405  }
406 
407  if (isCleared)
408  {
409  aGuard.reset();
410  }
411  m_bDisposed = true;
412  m_bInDispose = false;
413 }
414 
415 
416 // virtual
418 {
420  osl::Guard< osl::Mutex > aGuard( m_aMutex );
421 
425 
426  m_pDisposeEventListeners->addInterface( Listener );
427 }
428 
429 
430 // virtual
432 {
434  osl::Guard< osl::Mutex > aGuard( m_aMutex );
435 
437  m_pDisposeEventListeners->removeInterface( Listener );
438 }
439 
440 
441 //XCloseable methods.
442 
443 //virtual
445 {
447  dispose();
448 }
449 
450 
451 //XResultSetMetaDataSupplier methods.
452 
453 //virtual
455 {
457 
458  osl::ResettableMutexGuard aGuard(m_aMutex);
459  if( !m_xMetaDataFromOrigin.is() && m_xResultSetOrigin.is() )
460  {
461  Reference< XResultSetMetaDataSupplier > xMetaDataSupplier(
462  m_xResultSetOrigin, UNO_QUERY );
463 
464  if( xMetaDataSupplier.is() )
465  {
466  aGuard.clear();
467 
469  = xMetaDataSupplier->getMetaData();
470 
471  aGuard.reset();
472  m_xMetaDataFromOrigin = xMetaData;
473  }
474  }
475  return m_xMetaDataFromOrigin;
476 }
477 
478 
479 // XPropertySet methods.
480 
481 // virtual
483 {
485  {
486  osl::Guard< osl::Mutex > aGuard( m_aMutex );
487  if( m_xPropertySetInfo.is() )
488  return m_xPropertySetInfo;
489  }
491  return m_xPropertySetInfo;
492 }
493 
494 // virtual
495 void SAL_CALL ContentResultSetWrapper::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
496 {
499  if( !m_xPropertySetOrigin.is() )
500  {
501  OSL_FAIL( "broadcaster was disposed already" );
502  throw UnknownPropertyException();
503  }
504  m_xPropertySetOrigin->setPropertyValue( rPropertyName, rValue );
505 }
506 
507 
508 // virtual
509 Any SAL_CALL ContentResultSetWrapper::getPropertyValue( const OUString& rPropertyName )
510 {
513  if( !m_xPropertySetOrigin.is() )
514  {
515  OSL_FAIL( "broadcaster was disposed already" );
516  throw UnknownPropertyException();
517  }
518  return m_xPropertySetOrigin->getPropertyValue( rPropertyName );
519 }
520 
521 
522 // virtual
523 void SAL_CALL ContentResultSetWrapper::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener )
524 {
526 
527  if( !getPropertySetInfo().is() )
528  {
529  OSL_FAIL( "broadcaster was disposed already" );
530  throw UnknownPropertyException();
531  }
532 
533  if( !aPropertyName.isEmpty() )
534  {
535  m_xPropertySetInfo->getPropertyByName( aPropertyName );
536  //throws UnknownPropertyException, if so
537  }
538 
540  bool bNeedRegister = !m_pPropertyChangeListeners->
541  getContainedTypes().hasElements();
542  m_pPropertyChangeListeners->addInterface( aPropertyName, xListener );
543  if( bNeedRegister )
544  {
546  {
547  osl::Guard< osl::Mutex > aGuard( m_aMutex );
548  if( !m_xPropertySetOrigin.is() )
549  {
550  OSL_FAIL( "broadcaster was disposed already" );
551  return;
552  }
553  }
554  try
555  {
556  m_xPropertySetOrigin->addPropertyChangeListener(
557  OUString(), static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) );
558  }
559  catch( Exception& )
560  {
561  m_pPropertyChangeListeners->removeInterface( aPropertyName, xListener );
562  throw;
563  }
564  }
565 }
566 
567 
568 // virtual
569 void SAL_CALL ContentResultSetWrapper::addVetoableChangeListener( const OUString& rPropertyName, const Reference< XVetoableChangeListener >& xListener )
570 {
572 
573  if( !getPropertySetInfo().is() )
574  {
575  OSL_FAIL( "broadcaster was disposed already" );
576  throw UnknownPropertyException();
577  }
578  if( !rPropertyName.isEmpty() )
579  {
580  m_xPropertySetInfo->getPropertyByName( rPropertyName );
581  //throws UnknownPropertyException, if so
582  }
583 
585  bool bNeedRegister = !m_pVetoableChangeListeners->
586  getContainedTypes().hasElements();
587  m_pVetoableChangeListeners->addInterface( rPropertyName, xListener );
588  if( bNeedRegister )
589  {
591  {
592  osl::Guard< osl::Mutex > aGuard( m_aMutex );
593  if( !m_xPropertySetOrigin.is() )
594  {
595  OSL_FAIL( "broadcaster was disposed already" );
596  return;
597  }
598  }
599  try
600  {
601  m_xPropertySetOrigin->addVetoableChangeListener(
602  OUString(), static_cast< XVetoableChangeListener * >( m_xMyListenerImpl.get() ) );
603  }
604  catch( Exception& )
605  {
606  m_pVetoableChangeListeners->removeInterface( rPropertyName, xListener );
607  throw;
608  }
609  }
610 }
611 
612 
613 // virtual
614 void SAL_CALL ContentResultSetWrapper::removePropertyChangeListener( const OUString& rPropertyName, const Reference< XPropertyChangeListener >& xListener )
615 {
617 
618  {
619  //noop, if no listener registered
620  osl::Guard< osl::Mutex > aGuard( m_aMutex );
622  return;
623  }
624  OInterfaceContainerHelper* pContainer =
625  m_pPropertyChangeListeners->getContainer( rPropertyName );
626 
627  if( !pContainer )
628  {
629  if( !rPropertyName.isEmpty() )
630  {
631  if( !getPropertySetInfo().is() )
632  throw UnknownPropertyException();
633 
634  m_xPropertySetInfo->getPropertyByName( rPropertyName );
635  //throws UnknownPropertyException, if so
636  }
637  return; //the listener was not registered
638  }
639 
640  m_pPropertyChangeListeners->removeInterface( rPropertyName, xListener );
641 
642  if( !m_pPropertyChangeListeners->getContainedTypes().hasElements() )
643  {
645  {
646  osl::Guard< osl::Mutex > aGuard( m_aMutex );
647  if( !m_xPropertySetOrigin.is() )
648  {
649  OSL_FAIL( "broadcaster was disposed already" );
650  return;
651  }
652  }
653  try
654  {
655  m_xPropertySetOrigin->removePropertyChangeListener(
656  OUString(), static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) );
657  }
658  catch( Exception& )
659  {
660  OSL_FAIL( "could not remove PropertyChangeListener" );
661  }
662  }
663 }
664 
665 
666 // virtual
667 void SAL_CALL ContentResultSetWrapper::removeVetoableChangeListener( const OUString& rPropertyName, const Reference< XVetoableChangeListener >& xListener )
668 {
670 
671  {
672  //noop, if no listener registered
673  osl::Guard< osl::Mutex > aGuard( m_aMutex );
675  return;
676  }
677  OInterfaceContainerHelper* pContainer =
678  m_pVetoableChangeListeners->getContainer( rPropertyName );
679 
680  if( !pContainer )
681  {
682  if( !rPropertyName.isEmpty() )
683  {
684  if( !getPropertySetInfo().is() )
685  throw UnknownPropertyException(rPropertyName);
686 
687  m_xPropertySetInfo->getPropertyByName( rPropertyName );
688  //throws UnknownPropertyException, if so
689  }
690  return; //the listener was not registered
691  }
692 
693  m_pVetoableChangeListeners->removeInterface( rPropertyName, xListener );
694 
695  if( !m_pVetoableChangeListeners->getContainedTypes().hasElements() )
696  {
698  {
699  osl::Guard< osl::Mutex > aGuard( m_aMutex );
700  if( !m_xPropertySetOrigin.is() )
701  {
702  OSL_FAIL( "broadcaster was disposed already" );
703  return;
704  }
705  }
706  try
707  {
708  m_xPropertySetOrigin->removeVetoableChangeListener(
709  OUString(), static_cast< XVetoableChangeListener * >( m_xMyListenerImpl.get() ) );
710  }
711  catch( Exception& )
712  {
713  OSL_FAIL( "could not remove VetoableChangeListener" );
714  }
715  }
716 }
717 
718 
719 // own methods.
720 
721 
722 //virtual
723 void ContentResultSetWrapper::impl_disposing( const EventObject& )
724 {
726 
727  osl::Guard< osl::Mutex > aGuard( m_aMutex );
728 
729  if( !m_xResultSetOrigin.is() )
730  return;
731 
732  //release all references to the broadcaster:
733  m_xResultSetOrigin.clear();
734  if(m_xRowOrigin.is())
735  m_xRowOrigin.clear();
736  if(m_xContentAccessOrigin.is())
737  m_xContentAccessOrigin.clear();
738  if(m_xPropertySetOrigin.is())
739  m_xPropertySetOrigin.clear();
740  m_xMetaDataFromOrigin.clear();
741  if(m_xPropertySetInfo.is())
742  m_xPropertySetInfo.clear();
743 }
744 
745 //virtual
746 void ContentResultSetWrapper::impl_propertyChange( const PropertyChangeEvent& rEvt )
747 {
749 
750  PropertyChangeEvent aEvt( rEvt );
751  aEvt.Source = static_cast< XPropertySet * >( this );
752  aEvt.Further = false;
754 }
755 
756 //virtual
757 void ContentResultSetWrapper::impl_vetoableChange( const PropertyChangeEvent& rEvt )
758 {
760 
761  PropertyChangeEvent aEvt( rEvt );
762  aEvt.Source = static_cast< XPropertySet * >( this );
763  aEvt.Further = false;
764 
766 }
767 
768 
769 // XContentAccess methods. ( -- position dependent )
770 
771 
772 // virtual
774 {
777  if( !m_xContentAccessOrigin.is() )
778  {
779  OSL_FAIL( "broadcaster was disposed already" );
780  throw RuntimeException();
781  }
782  return m_xContentAccessOrigin->queryContentIdentifierString();
783 }
784 
785 
786 // virtual
788 {
791  if( !m_xContentAccessOrigin.is() )
792  {
793  OSL_FAIL( "broadcaster was disposed already" );
794  throw RuntimeException();
795  }
796  return m_xContentAccessOrigin->queryContentIdentifier();
797 }
798 
799 
800 // virtual
802 {
805  if( !m_xContentAccessOrigin.is() )
806  {
807  OSL_FAIL( "broadcaster was disposed already" );
808  throw RuntimeException();
809  }
810  return m_xContentAccessOrigin->queryContent();
811 }
812 
813 
814 // XResultSet methods.
815 
816 //virtual
817 
819 {
821 
822  if( !m_xResultSetOrigin.is() )
823  {
824  OSL_FAIL( "broadcaster was disposed already" );
825  throw RuntimeException();
826  }
827  return m_xResultSetOrigin->next();
828 }
829 
830 //virtual
832 {
834 
835  if( !m_xResultSetOrigin.is() )
836  {
837  OSL_FAIL( "broadcaster was disposed already" );
838  throw RuntimeException();
839  }
840  return m_xResultSetOrigin->previous();
841 }
842 
843 //virtual
845 {
847 
848  if( !m_xResultSetOrigin.is() )
849  {
850  OSL_FAIL( "broadcaster was disposed already" );
851  throw RuntimeException();
852  }
853  return m_xResultSetOrigin->absolute( row );
854 }
855 
856 //virtual
857 sal_Bool SAL_CALL ContentResultSetWrapper::relative( sal_Int32 rows )
858 {
860 
861  if( !m_xResultSetOrigin.is() )
862  {
863  OSL_FAIL( "broadcaster was disposed already" );
864  throw RuntimeException();
865  }
866  return m_xResultSetOrigin->relative( rows );
867 }
868 
869 
870 //virtual
872 {
874 
875  if( !m_xResultSetOrigin.is() )
876  {
877  OSL_FAIL( "broadcaster was disposed already" );
878  throw RuntimeException();
879  }
880  return m_xResultSetOrigin->first();
881 }
882 
883 //virtual
885 {
887 
888  if( !m_xResultSetOrigin.is() )
889  {
890  OSL_FAIL( "broadcaster was disposed already" );
891  throw RuntimeException();
892  }
893  return m_xResultSetOrigin->last();
894 }
895 
896 //virtual
898 {
900 
901  if( !m_xResultSetOrigin.is() )
902  {
903  OSL_FAIL( "broadcaster was disposed already" );
904  throw RuntimeException();
905  }
906  m_xResultSetOrigin->beforeFirst();
907 }
908 
909 //virtual
911 {
913 
914  if( !m_xResultSetOrigin.is() )
915  {
916  OSL_FAIL( "broadcaster was disposed already" );
917  throw RuntimeException();
918  }
919  m_xResultSetOrigin->afterLast();
920 }
921 
922 //virtual
924 {
926 
927  if( !m_xResultSetOrigin.is() )
928  {
929  OSL_FAIL( "broadcaster was disposed already" );
930  throw RuntimeException();
931  }
932  return m_xResultSetOrigin->isAfterLast();
933 }
934 
935 //virtual
937 {
939 
940  if( !m_xResultSetOrigin.is() )
941  {
942  OSL_FAIL( "broadcaster was disposed already" );
943  throw RuntimeException();
944  }
945  return m_xResultSetOrigin->isBeforeFirst();
946 }
947 
948 //virtual
950 {
952 
953  if( !m_xResultSetOrigin.is() )
954  {
955  OSL_FAIL( "broadcaster was disposed already" );
956  throw RuntimeException();
957  }
958  return m_xResultSetOrigin->isFirst();
959 }
960 
961 //virtual
963 {
965 
966  if( !m_xResultSetOrigin.is() )
967  {
968  OSL_FAIL( "broadcaster was disposed already" );
969  throw RuntimeException();
970  }
971  return m_xResultSetOrigin->isLast();
972 }
973 
974 
975 //virtual
977 {
979 
980  if( !m_xResultSetOrigin.is() )
981  {
982  OSL_FAIL( "broadcaster was disposed already" );
983  throw RuntimeException();
984  }
985  return m_xResultSetOrigin->getRow();
986 }
987 
988 //virtual
990 {
992 
993  if( !m_xResultSetOrigin.is() )
994  {
995  OSL_FAIL( "broadcaster was disposed already" );
996  throw RuntimeException();
997  }
998  m_xResultSetOrigin->refreshRow();
999 }
1000 
1001 //virtual
1003 {
1005 
1006  if( !m_xResultSetOrigin.is() )
1007  {
1008  OSL_FAIL( "broadcaster was disposed already" );
1009  throw RuntimeException();
1010  }
1011  return m_xResultSetOrigin->rowUpdated();
1012 }
1013 
1014 //virtual
1016 {
1018 
1019  if( !m_xResultSetOrigin.is() )
1020  {
1021  OSL_FAIL( "broadcaster was disposed already" );
1022  throw RuntimeException();
1023  }
1024  return m_xResultSetOrigin->rowInserted();
1025 }
1026 
1027 //virtual
1029 {
1031 
1032  if( !m_xResultSetOrigin.is() )
1033  {
1034  OSL_FAIL( "broadcaster was disposed already" );
1035  throw RuntimeException();
1036  }
1037  return m_xResultSetOrigin->rowDeleted();
1038 }
1039 
1040 //virtual
1042 {
1044  //@todo ?return anything
1045  return Reference< XInterface >();
1046 }
1047 
1048 
1049 // XRow methods.
1050 
1051 
1053 {
1056  if( !m_xRowOrigin.is() )
1057  {
1058  OSL_FAIL( "broadcaster was disposed already" );
1059  throw RuntimeException();
1060  }
1061 }
1062 
1063 //virtual
1065 {
1068  if( !m_xRowOrigin.is() )
1069  {
1070  OSL_FAIL( "broadcaster was disposed already" );
1071  throw RuntimeException();
1072  }
1073  return m_xRowOrigin->wasNull();
1074 }
1075 
1076 //virtual
1077 OUString SAL_CALL ContentResultSetWrapper::getString( sal_Int32 columnIndex )
1078 {
1079  verifyGet();
1080  return m_xRowOrigin->getString( columnIndex );
1081 }
1082 
1083 //virtual
1084 sal_Bool SAL_CALL ContentResultSetWrapper::getBoolean( sal_Int32 columnIndex )
1085 {
1086  verifyGet();
1087  return m_xRowOrigin->getBoolean( columnIndex );
1088 }
1089 
1090 //virtual
1091 sal_Int8 SAL_CALL ContentResultSetWrapper::getByte( sal_Int32 columnIndex )
1092 {
1093  verifyGet();
1094  return m_xRowOrigin->getByte( columnIndex );
1095 }
1096 
1097 //virtual
1098 sal_Int16 SAL_CALL ContentResultSetWrapper::getShort( sal_Int32 columnIndex )
1099 {
1100  verifyGet();
1101  return m_xRowOrigin->getShort( columnIndex );
1102 }
1103 
1104 //virtual
1105 sal_Int32 SAL_CALL ContentResultSetWrapper::getInt( sal_Int32 columnIndex )
1106 {
1107  verifyGet();
1108  return m_xRowOrigin->getInt( columnIndex );
1109 }
1110 
1111 //virtual
1112 sal_Int64 SAL_CALL ContentResultSetWrapper::getLong( sal_Int32 columnIndex )
1113 {
1114  verifyGet();
1115  return m_xRowOrigin->getLong( columnIndex );
1116 }
1117 
1118 //virtual
1119 float SAL_CALL ContentResultSetWrapper::getFloat( sal_Int32 columnIndex )
1120 {
1121  verifyGet();
1122  return m_xRowOrigin->getFloat( columnIndex );
1123 }
1124 
1125 //virtual
1126 double SAL_CALL ContentResultSetWrapper::getDouble( sal_Int32 columnIndex )
1127 {
1128  verifyGet();
1129  return m_xRowOrigin->getDouble( columnIndex );
1130 }
1131 
1132 //virtual
1134 {
1135  verifyGet();
1136  return m_xRowOrigin->getBytes( columnIndex );
1137 }
1138 
1139 //virtual
1140 Date SAL_CALL ContentResultSetWrapper::getDate( sal_Int32 columnIndex )
1141 {
1142  verifyGet();
1143  return m_xRowOrigin->getDate( columnIndex );
1144 }
1145 
1146 //virtual
1147 Time SAL_CALL ContentResultSetWrapper::getTime( sal_Int32 columnIndex )
1148 {
1149  verifyGet();
1150  return m_xRowOrigin->getTime( columnIndex );
1151 }
1152 
1153 //virtual
1154 DateTime SAL_CALL ContentResultSetWrapper::getTimestamp( sal_Int32 columnIndex )
1155 {
1156  verifyGet();
1157  return m_xRowOrigin->getTimestamp( columnIndex );
1158 }
1159 
1160 //virtual
1162 {
1163  verifyGet();
1164  return m_xRowOrigin->getBinaryStream( columnIndex );
1165 }
1166 
1167 //virtual
1169 {
1170  verifyGet();
1171  return m_xRowOrigin->getCharacterStream( columnIndex );
1172 }
1173 
1174 //virtual
1176 {
1177  //if you change this macro please pay attention to
1178  //define XROW_GETXXX, where this is similar implemented
1179 
1182  if( !m_xRowOrigin.is() )
1183  {
1184  OSL_FAIL( "broadcaster was disposed already" );
1185  throw RuntimeException();
1186  }
1187  return m_xRowOrigin->getObject( columnIndex, typeMap );
1188 }
1189 
1190 //virtual
1191 Reference< XRef > SAL_CALL ContentResultSetWrapper::getRef( sal_Int32 columnIndex )
1192 {
1193  verifyGet();
1194  return m_xRowOrigin->getRef( columnIndex );
1195 }
1196 
1197 //virtual
1198 Reference< XBlob > SAL_CALL ContentResultSetWrapper::getBlob( sal_Int32 columnIndex )
1199 {
1200  verifyGet();
1201  return m_xRowOrigin->getBlob( columnIndex );
1202 }
1203 
1204 //virtual
1205 Reference< XClob > SAL_CALL ContentResultSetWrapper::getClob( sal_Int32 columnIndex )
1206 {
1207  verifyGet();
1208  return m_xRowOrigin->getClob( columnIndex );
1209 }
1210 
1211 //virtual
1213 {
1214  verifyGet();
1215  return m_xRowOrigin->getArray( columnIndex );
1216 }
1217 
1218 
1219 // class ContentResultSetWrapperListener
1220 
1221 
1223  ContentResultSetWrapper* pOwner )
1224  : m_pOwner( pOwner )
1225 {
1226 }
1227 
1229 {
1230 }
1231 
1232 
1233 // XInterface methods.
1235  throw()
1236 {
1237  OWeakObject::acquire();
1238 }
1239 
1241  throw()
1242 {
1243  OWeakObject::release();
1244 }
1245 
1246 css::uno::Any SAL_CALL ContentResultSetWrapperListener::queryInterface( const css::uno::Type & rType )
1247 {
1248  //list all interfaces inclusive baseclasses of interfaces
1249  css::uno::Any aRet = cppu::queryInterface( rType,
1250  static_cast< XEventListener * >(
1251  static_cast< XPropertyChangeListener * >(this)),
1252  static_cast< XPropertyChangeListener* >(this),
1253  static_cast< XVetoableChangeListener* >(this)
1254  );
1255  return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
1256 }
1257 
1258 //XEventListener methods.
1259 
1260 
1261 //virtual
1262 void SAL_CALL ContentResultSetWrapperListener::disposing( const EventObject& rEventObject )
1263 {
1264  if( m_pOwner )
1265  m_pOwner->impl_disposing( rEventObject );
1266 }
1267 
1268 
1269 //XPropertyChangeListener methods.
1270 
1271 
1272 //virtual
1273 void SAL_CALL ContentResultSetWrapperListener::propertyChange( const PropertyChangeEvent& rEvt )
1274 {
1275  if( m_pOwner )
1276  m_pOwner->impl_propertyChange( rEvt );
1277 }
1278 
1279 
1280 //XVetoableChangeListener methods.
1281 
1282 //virtual
1283 void SAL_CALL ContentResultSetWrapperListener::vetoableChange( const PropertyChangeEvent& rEvt )
1284 {
1285  if( m_pOwner )
1286  m_pOwner->impl_vetoableChange( rEvt );
1287 }
1288 
1290 {
1291  m_pOwner = nullptr;
1292 }
1293 
1294 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 columnIndex) override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream(sal_Int32 columnIndex) override
virtual void impl_disposing(const css::lang::EventObject &Source)
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual sal_Bool SAL_CALL getBoolean(sal_Int32 columnIndex) override
void impl_notifyPropertyChangeListeners(const css::beans::PropertyChangeEvent &rEvt)
ContentResultSetWrapper(css::uno::Reference< css::sdbc::XResultSet > const &xOrigin)
virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef(sal_Int32 columnIndex) override
signed char sal_Int8
css::uno::Reference< css::sdbc::XResultSetMetaData > m_xMetaDataFromOrigin
void impl_notifyVetoableChangeListeners(const css::beans::PropertyChangeEvent &rEvt)
virtual sal_Bool SAL_CALL rowDeleted() override
virtual OUString SAL_CALL getString(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL rowUpdated() override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual void SAL_CALL vetoableChange(const css::beans::PropertyChangeEvent &aEvent) override
virtual sal_Bool SAL_CALL first() override
virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData() override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
css::uno::XInterface *SAL_CALL next()
virtual sal_Bool SAL_CALL isAfterLast() override
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray(sal_Int32 columnIndex) override
virtual css::util::Time SAL_CALL getTime(sal_Int32 columnIndex) override
ContentResultSetWrapperListener(ContentResultSetWrapper *pOwner)
virtual css::uno::Any SAL_CALL getObject(sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess > &typeMap) override
virtual sal_Int32 SAL_CALL getInt(sal_Int32 columnIndex) override
virtual sal_Int32 SAL_CALL getRow() override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream(sal_Int32 columnIndex) override
bool m_bInDispose
Dispose call ready.
virtual sal_Bool SAL_CALL last() override
virtual void SAL_CALL acquire() override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
virtual sal_Int8 SAL_CALL getByte(sal_Int32 columnIndex) override
std::unique_ptr< PropertyChangeListenerContainer_Impl > m_pVetoableChangeListeners
css::uno::Reference< css::ucb::XContentAccess > m_xContentAccessOrigin
! call impl_init_xRowOrigin() bevor you access this member
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &evt) override
virtual void SAL_CALL release() override
virtual sal_Bool SAL_CALL isFirst() override
virtual sal_Bool SAL_CALL previous() override
virtual sal_Int16 SAL_CALL getShort(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL next() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
std::unique_ptr< comphelper::OInterfaceContainerHelper2 > m_pDisposeEventListeners
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
class SAL_NO_VTABLE XPropertySet
cppu::OMultiTypeInterfaceContainerHelperVar< OUString > PropertyChangeListenerContainer_Impl
virtual void SAL_CALL afterLast() override
virtual void SAL_CALL refreshRow() override
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent() override
css::uno::Reference< css::sdbc::XRow > m_xRowOrigin
unsigned char sal_Bool
virtual sal_Bool SAL_CALL rowInserted() override
virtual sal_Int64 SAL_CALL getLong(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL queryContentIdentifier() override
virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob(sal_Int32 columnIndex) override
virtual double SAL_CALL getDouble(sal_Int32 columnIndex) override
virtual float SAL_CALL getFloat(sal_Int32 columnIndex) override
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
std::unique_ptr< PropertyChangeListenerContainer_Impl > m_pPropertyChangeListeners
virtual void impl_vetoableChange(const css::beans::PropertyChangeEvent &aEvent)
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override
virtual css::util::DateTime SAL_CALL getTimestamp(sal_Int32 columnIndex) override
virtual void SAL_CALL beforeFirst() override
virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 columnIndex) override
virtual void SAL_CALL close() override
css::uno::Reference< css::beans::XPropertySet > m_xPropertySetOrigin
! call impl_init_xContentAccessOrigin() bevor you access this member
virtual void SAL_CALL dispose() override
virtual void impl_propertyChange(const css::beans::PropertyChangeEvent &evt)
rtl::Reference< ContentResultSetWrapperListener > m_xMyListenerImpl
virtual css::util::Date SAL_CALL getDate(sal_Int32 columnIndex) override
css::uno::Reference< css::sdbc::XResultSet > m_xResultSetOrigin
css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo
! call impl_init_xPropertySetOrigin() bevor you access this member
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual sal_Bool SAL_CALL isBeforeFirst() override
osl::Mutex m_aContainerMutex
In dispose call.
virtual OUString SAL_CALL queryContentIdentifierString() override
virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override
virtual ~ContentResultSetWrapper() override
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
virtual sal_Bool SAL_CALL isLast() override
virtual sal_Bool SAL_CALL wasNull() override
bool SAL_CALL hasMoreElements() const
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override