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>
26
27using namespace com::sun::star::beans;
28using namespace com::sun::star::lang;
29using namespace com::sun::star::sdbc;
30using namespace com::sun::star::ucb;
31using namespace com::sun::star::uno;
32using namespace com::sun::star::util;
33using namespace comphelper;
34using namespace cppu;
35
36
37
38
40 Reference< XResultSet > const & xOrigin )
41 : m_xResultSetOrigin( xOrigin )
42 , m_nForwardOnly( 2 )
43 , m_bDisposed( false )
44 , m_bInDispose( false )
45{
47
48 OSL_ENSURE( m_xResultSetOrigin.is(), "XResultSet is required" );
49
51};
52
53
55{
56 {
57 osl::Guard< osl::Mutex > aGuard( m_aMutex );
58 if(m_xRowOrigin.is())
59 return;
60 }
61
62 Reference< XRow > xOrgig( m_xResultSetOrigin, UNO_QUERY );
63
64 {
65 osl::Guard< osl::Mutex > aGuard( m_aMutex );
66 m_xRowOrigin = xOrgig;
67 OSL_ENSURE( m_xRowOrigin.is(), "interface XRow is required" );
68 }
69}
70
72{
73 {
74 osl::Guard< osl::Mutex > aGuard( m_aMutex );
76 return;
77 }
78
80
81 {
82 osl::Guard< osl::Mutex > aGuard( m_aMutex );
84 OSL_ENSURE( m_xContentAccessOrigin.is(), "interface XContentAccess is required" );
85 }
86}
87
88
90{
91 {
92 osl::Guard< osl::Mutex > aGuard( m_aMutex );
93 if( m_xPropertySetOrigin.is() )
94 return;
95 }
96
98
99 {
100 osl::Guard< osl::Mutex > aGuard( m_aMutex );
101 m_xPropertySetOrigin = xOrig;
102 OSL_ENSURE( m_xPropertySetOrigin.is(), "interface XPropertySet is required" );
103 }
104}
105
107{
108 //call this at the end of constructor of derived class
109
110
111 //listen to disposing from Origin:
112 Reference< XComponent > xComponentOrigin( m_xResultSetOrigin, UNO_QUERY );
113 OSL_ENSURE( xComponentOrigin.is(), "interface XComponent is required" );
114 xComponentOrigin->addEventListener( static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) );
115}
116
118{
119 //call impl_deinit() at start of destructor of derived class
120};
121
123{
124 //call this at start of destructor of derived class
125
126 m_xMyListenerImpl->impl_OwnerDies();
127}
128
129//virtual
131{
132 {
133 osl::Guard< osl::Mutex > aGuard( m_aMutex );
134 if( m_xPropertySetInfo.is() )
135 return;
136
138 if( !m_xPropertySetOrigin.is() )
139 return;
140 }
141
143 m_xPropertySetOrigin->getPropertySetInfo();
144
145 {
146 osl::Guard< osl::Mutex > aGuard( m_aMutex );
147 m_xPropertySetInfo = xOrig;
148 }
149}
150
152{
153 osl::Guard< osl::Mutex > aGuard( m_aMutex );
154 if( m_bDisposed )
155 throw DisposedException();
156}
157
159{
160 osl::Guard< osl::Mutex > aGuard( m_aMutex );
164}
165
167{
168 osl::Guard< osl::Mutex > aGuard( m_aMutex );
172}
173
175{
176 {
177 osl::Guard< osl::Mutex > aGuard( m_aMutex );
179 return;
180 }
181
182 // Notify listeners interested especially in the changed property.
184 m_pPropertyChangeListeners->getContainer( rEvt.PropertyName );
185 if( pContainer )
186 {
187 pContainer->notifyEach( &XPropertyChangeListener::propertyChange, rEvt );
188 }
189
190 // Notify listeners interested in all properties.
191 pContainer = m_pPropertyChangeListeners->getContainer( OUString() );
192 if( pContainer )
193 {
194 pContainer->notifyEach( &XPropertyChangeListener::propertyChange, rEvt );
195 }
196}
197
199{
200 {
201 osl::Guard< osl::Mutex > aGuard( m_aMutex );
203 return;
204 }
205
206 // Notify listeners interested especially in the changed property.
208 m_pVetoableChangeListeners->getContainer( rEvt.PropertyName );
209 if( pContainer )
210 {
211 pContainer->notifyEach( &XVetoableChangeListener::vetoableChange, rEvt );
212 }
213
214 // Notify listeners interested in all properties.
215 pContainer = m_pVetoableChangeListeners->getContainer( OUString() );
216 if( pContainer )
217 {
218 pContainer->notifyEach( &XVetoableChangeListener::vetoableChange, rEvt );
219 }
220}
221
223{
224 //m_nForwardOnly == 2 -> don't know
225 //m_nForwardOnly == 1 -> YES
226 //m_nForwardOnly == 0 -> NO
227
228 //@todo replace this with lines in comment
229 osl::Guard< osl::Mutex > aGuard( m_aMutex );
230 m_nForwardOnly = 0;
231 return false;
232
233
234 /*
235 ReacquireableGuard aGuard( m_aMutex );
236 if( m_nForwardOnly == 2 )
237 {
238 aGuard.clear();
239 if( !getPropertySetInfo().is() )
240 {
241 aGuard.reacquire();
242 m_nForwardOnly = 0;
243 return m_nForwardOnly;
244 }
245 aGuard.reacquire();
246
247 OUString aName("ResultSetType");
248 //find out, if we are ForwardOnly and cache the value:
249
250 impl_init_xPropertySetOrigin();
251 if( !m_xPropertySetOrigin.is() )
252 {
253 OSL_FAIL( "broadcaster was disposed already" );
254 m_nForwardOnly = 0;
255 return m_nForwardOnly;
256 }
257
258 aGuard.clear();
259 Any aAny = m_xPropertySetOrigin->getPropertyValue( aName );
260
261 aGuard.reacquire();
262 long nResultSetType;
263 if( ( aAny >>= nResultSetType ) &&
264 ( nResultSetType == ResultSetType::FORWARD_ONLY ) )
265 m_nForwardOnly = 1;
266 else
267 m_nForwardOnly = 0;
268 }
269 return m_nForwardOnly;
270 */
271}
272
273
274// XInterface methods.
275
276css::uno::Any SAL_CALL ContentResultSetWrapper::queryInterface( const css::uno::Type & rType )
277{
278 //list all interfaces inclusive baseclasses of interfaces
279 css::uno::Any aRet = cppu::queryInterface( rType,
280 static_cast< XComponent* >(this),
281 static_cast< XCloseable* >(this),
282 static_cast< XResultSetMetaDataSupplier* >(this),
283 static_cast< XPropertySet* >(this),
284 static_cast< XContentAccess* >(this),
285 static_cast< XResultSet* >(this),
286 static_cast< XRow* >(this)
287 );
288 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
289}
290
291// XComponent methods.
292
293// virtual
295{
297
298 bool isCleared = false;
299 osl::ResettableMutexGuard aGuard(m_aMutex);
301 return;
302 m_bInDispose = true;
303
304 if( m_xPropertySetOrigin.is() )
305 {
306 aGuard.clear();
307 isCleared = true;
308 try
309 {
310 m_xPropertySetOrigin->removePropertyChangeListener(
311 OUString(), static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) );
312 }
313 catch( Exception& )
314 {
315 OSL_FAIL( "could not remove PropertyChangeListener" );
316 }
317 try
318 {
319 m_xPropertySetOrigin->removeVetoableChangeListener(
320 OUString(), static_cast< XVetoableChangeListener * >( m_xMyListenerImpl.get() ) );
321 }
322 catch( Exception& )
323 {
324 OSL_FAIL( "could not remove VetoableChangeListener" );
325 }
326
327 Reference< XComponent > xComponentOrigin( m_xResultSetOrigin, UNO_QUERY );
328 OSL_ENSURE( xComponentOrigin.is(), "interface XComponent is required" );
329 xComponentOrigin->removeEventListener( static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) );
330 }
331
332 if (isCleared)
333 {
334 aGuard.reset();
335 isCleared = false;
336 }
338 {
339 EventObject aEvt;
340 aEvt.Source = static_cast< XComponent * >( this );
341
342 aGuard.clear();
343 isCleared = true;
344 m_pDisposeEventListeners->disposeAndClear( aEvt );
345 }
346
347 if (isCleared)
348 {
349 aGuard.reset();
350 isCleared = false;
351 }
353 {
354 EventObject aEvt;
355 aEvt.Source = static_cast< XPropertySet * >( this );
356
357 aGuard.clear();
358 isCleared = true;
359 m_pPropertyChangeListeners->disposeAndClear( aEvt );
360 }
361
362 if (isCleared)
363 {
364 aGuard.reset();
365 isCleared = false;
366 }
368 {
369 EventObject aEvt;
370 aEvt.Source = static_cast< XPropertySet * >( this );
371
372 aGuard.clear();
373 isCleared = true;
374 m_pVetoableChangeListeners->disposeAndClear( aEvt );
375 }
376
377 if (isCleared)
378 {
379 aGuard.reset();
380 }
381 m_bDisposed = true;
382 m_bInDispose = false;
383}
384
385
386// virtual
388{
390 osl::Guard< osl::Mutex > aGuard( m_aMutex );
391
395
396 m_pDisposeEventListeners->addInterface( Listener );
397}
398
399
400// virtual
402{
404 osl::Guard< osl::Mutex > aGuard( m_aMutex );
405
407 m_pDisposeEventListeners->removeInterface( Listener );
408}
409
410
411//XCloseable methods.
412
413//virtual
415{
417 dispose();
418}
419
420
421//XResultSetMetaDataSupplier methods.
422
423//virtual
425{
427
428 osl::ResettableMutexGuard aGuard(m_aMutex);
429 if( !m_xMetaDataFromOrigin.is() && m_xResultSetOrigin.is() )
430 {
432 m_xResultSetOrigin, UNO_QUERY );
433
434 if( xMetaDataSupplier.is() )
435 {
436 aGuard.clear();
437
439 = xMetaDataSupplier->getMetaData();
440
441 aGuard.reset();
442 m_xMetaDataFromOrigin = xMetaData;
443 }
444 }
446}
447
448
449// XPropertySet methods.
450
451// virtual
453{
455 {
456 osl::Guard< osl::Mutex > aGuard( m_aMutex );
457 if( m_xPropertySetInfo.is() )
458 return m_xPropertySetInfo;
459 }
461 return m_xPropertySetInfo;
462}
463
464// virtual
465void SAL_CALL ContentResultSetWrapper::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
466{
469 if( !m_xPropertySetOrigin.is() )
470 {
471 OSL_FAIL( "broadcaster was disposed already" );
472 throw UnknownPropertyException();
473 }
474 m_xPropertySetOrigin->setPropertyValue( rPropertyName, rValue );
475}
476
477
478// virtual
479Any SAL_CALL ContentResultSetWrapper::getPropertyValue( const OUString& rPropertyName )
480{
483 if( !m_xPropertySetOrigin.is() )
484 {
485 OSL_FAIL( "broadcaster was disposed already" );
486 throw UnknownPropertyException();
487 }
488 return m_xPropertySetOrigin->getPropertyValue( rPropertyName );
489}
490
491
492// virtual
493void SAL_CALL ContentResultSetWrapper::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener )
494{
496
497 if( !getPropertySetInfo().is() )
498 {
499 OSL_FAIL( "broadcaster was disposed already" );
500 throw UnknownPropertyException();
501 }
502
503 if( !aPropertyName.isEmpty() )
504 {
505 m_xPropertySetInfo->getPropertyByName( aPropertyName );
506 //throws UnknownPropertyException, if so
507 }
508
510 bool bNeedRegister = !m_pPropertyChangeListeners->hasContainedTypes();
511 m_pPropertyChangeListeners->addInterface( aPropertyName, xListener );
512 if( !bNeedRegister )
513 return;
514
516 {
517 osl::Guard< osl::Mutex > aGuard( m_aMutex );
518 if( !m_xPropertySetOrigin.is() )
519 {
520 OSL_FAIL( "broadcaster was disposed already" );
521 return;
522 }
523 }
524 try
525 {
526 m_xPropertySetOrigin->addPropertyChangeListener(
527 OUString(), static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) );
528 }
529 catch( Exception& )
530 {
531 m_pPropertyChangeListeners->removeInterface( aPropertyName, xListener );
532 throw;
533 }
534}
535
536
537// virtual
538void SAL_CALL ContentResultSetWrapper::addVetoableChangeListener( const OUString& rPropertyName, const Reference< XVetoableChangeListener >& xListener )
539{
541
542 if( !getPropertySetInfo().is() )
543 {
544 OSL_FAIL( "broadcaster was disposed already" );
545 throw UnknownPropertyException();
546 }
547 if( !rPropertyName.isEmpty() )
548 {
549 m_xPropertySetInfo->getPropertyByName( rPropertyName );
550 //throws UnknownPropertyException, if so
551 }
552
554 bool bNeedRegister = !m_pVetoableChangeListeners->hasContainedTypes();
555 m_pVetoableChangeListeners->addInterface( rPropertyName, xListener );
556 if( !bNeedRegister )
557 return;
558
560 {
561 osl::Guard< osl::Mutex > aGuard( m_aMutex );
562 if( !m_xPropertySetOrigin.is() )
563 {
564 OSL_FAIL( "broadcaster was disposed already" );
565 return;
566 }
567 }
568 try
569 {
570 m_xPropertySetOrigin->addVetoableChangeListener(
571 OUString(), static_cast< XVetoableChangeListener * >( m_xMyListenerImpl.get() ) );
572 }
573 catch( Exception& )
574 {
575 m_pVetoableChangeListeners->removeInterface( rPropertyName, xListener );
576 throw;
577 }
578}
579
580
581// virtual
582void SAL_CALL ContentResultSetWrapper::removePropertyChangeListener( const OUString& rPropertyName, const Reference< XPropertyChangeListener >& xListener )
583{
585
586 {
587 //noop, if no listener registered
588 osl::Guard< osl::Mutex > aGuard( m_aMutex );
590 return;
591 }
593 m_pPropertyChangeListeners->getContainer( rPropertyName );
594
595 if( !pContainer )
596 {
597 if( !rPropertyName.isEmpty() )
598 {
599 if( !getPropertySetInfo().is() )
600 throw UnknownPropertyException();
601
602 m_xPropertySetInfo->getPropertyByName( rPropertyName );
603 //throws UnknownPropertyException, if so
604 }
605 return; //the listener was not registered
606 }
607
608 m_pPropertyChangeListeners->removeInterface( rPropertyName, xListener );
609
610 if( m_pPropertyChangeListeners->hasContainedTypes() )
611 return;
612
614 {
615 osl::Guard< osl::Mutex > aGuard( m_aMutex );
616 if( !m_xPropertySetOrigin.is() )
617 {
618 OSL_FAIL( "broadcaster was disposed already" );
619 return;
620 }
621 }
622 try
623 {
624 m_xPropertySetOrigin->removePropertyChangeListener(
625 OUString(), static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) );
626 }
627 catch( Exception& )
628 {
629 OSL_FAIL( "could not remove PropertyChangeListener" );
630 }
631}
632
633
634// virtual
635void SAL_CALL ContentResultSetWrapper::removeVetoableChangeListener( const OUString& rPropertyName, const Reference< XVetoableChangeListener >& xListener )
636{
638
639 {
640 //noop, if no listener registered
641 osl::Guard< osl::Mutex > aGuard( m_aMutex );
643 return;
644 }
646 m_pVetoableChangeListeners->getContainer( rPropertyName );
647
648 if( !pContainer )
649 {
650 if( !rPropertyName.isEmpty() )
651 {
652 if( !getPropertySetInfo().is() )
653 throw UnknownPropertyException(rPropertyName);
654
655 m_xPropertySetInfo->getPropertyByName( rPropertyName );
656 //throws UnknownPropertyException, if so
657 }
658 return; //the listener was not registered
659 }
660
661 m_pVetoableChangeListeners->removeInterface( rPropertyName, xListener );
662
663 if( m_pVetoableChangeListeners->hasContainedTypes() )
664 return;
665
667 {
668 osl::Guard< osl::Mutex > aGuard( m_aMutex );
669 if( !m_xPropertySetOrigin.is() )
670 {
671 OSL_FAIL( "broadcaster was disposed already" );
672 return;
673 }
674 }
675 try
676 {
677 m_xPropertySetOrigin->removeVetoableChangeListener(
678 OUString(), static_cast< XVetoableChangeListener * >( m_xMyListenerImpl.get() ) );
679 }
680 catch( Exception& )
681 {
682 OSL_FAIL( "could not remove VetoableChangeListener" );
683 }
684}
685
686
687// own methods.
688
689
690//virtual
692{
694
695 osl::Guard< osl::Mutex > aGuard( m_aMutex );
696
697 if( !m_xResultSetOrigin.is() )
698 return;
699
700 //release all references to the broadcaster:
701 m_xResultSetOrigin.clear();
702 if(m_xRowOrigin.is())
703 m_xRowOrigin.clear();
706 if(m_xPropertySetOrigin.is())
707 m_xPropertySetOrigin.clear();
708 m_xMetaDataFromOrigin.clear();
709 if(m_xPropertySetInfo.is())
710 m_xPropertySetInfo.clear();
711}
712
713//virtual
714void ContentResultSetWrapper::impl_propertyChange( const PropertyChangeEvent& rEvt )
715{
717
718 PropertyChangeEvent aEvt( rEvt );
719 aEvt.Source = static_cast< XPropertySet * >( this );
720 aEvt.Further = false;
722}
723
724//virtual
725void ContentResultSetWrapper::impl_vetoableChange( const PropertyChangeEvent& rEvt )
726{
728
729 PropertyChangeEvent aEvt( rEvt );
730 aEvt.Source = static_cast< XPropertySet * >( this );
731 aEvt.Further = false;
732
734}
735
736
737// XContentAccess methods. ( -- position dependent )
738
739
740// virtual
742{
745 if( !m_xContentAccessOrigin.is() )
746 {
747 OSL_FAIL( "broadcaster was disposed already" );
748 throw RuntimeException();
749 }
750 return m_xContentAccessOrigin->queryContentIdentifierString();
751}
752
753
754// virtual
756{
759 if( !m_xContentAccessOrigin.is() )
760 {
761 OSL_FAIL( "broadcaster was disposed already" );
762 throw RuntimeException();
763 }
764 return m_xContentAccessOrigin->queryContentIdentifier();
765}
766
767
768// virtual
770{
773 if( !m_xContentAccessOrigin.is() )
774 {
775 OSL_FAIL( "broadcaster was disposed already" );
776 throw RuntimeException();
777 }
778 return m_xContentAccessOrigin->queryContent();
779}
780
781
782// XResultSet methods.
783
784//virtual
785
787{
789
790 if( !m_xResultSetOrigin.is() )
791 {
792 OSL_FAIL( "broadcaster was disposed already" );
793 throw RuntimeException();
794 }
795 return m_xResultSetOrigin->next();
796}
797
798//virtual
800{
802
803 if( !m_xResultSetOrigin.is() )
804 {
805 OSL_FAIL( "broadcaster was disposed already" );
806 throw RuntimeException();
807 }
808 return m_xResultSetOrigin->previous();
809}
810
811//virtual
813{
815
816 if( !m_xResultSetOrigin.is() )
817 {
818 OSL_FAIL( "broadcaster was disposed already" );
819 throw RuntimeException();
820 }
821 return m_xResultSetOrigin->absolute( row );
822}
823
824//virtual
826{
828
829 if( !m_xResultSetOrigin.is() )
830 {
831 OSL_FAIL( "broadcaster was disposed already" );
832 throw RuntimeException();
833 }
834 return m_xResultSetOrigin->relative( rows );
835}
836
837
838//virtual
840{
842
843 if( !m_xResultSetOrigin.is() )
844 {
845 OSL_FAIL( "broadcaster was disposed already" );
846 throw RuntimeException();
847 }
848 return m_xResultSetOrigin->first();
849}
850
851//virtual
853{
855
856 if( !m_xResultSetOrigin.is() )
857 {
858 OSL_FAIL( "broadcaster was disposed already" );
859 throw RuntimeException();
860 }
861 return m_xResultSetOrigin->last();
862}
863
864//virtual
866{
868
869 if( !m_xResultSetOrigin.is() )
870 {
871 OSL_FAIL( "broadcaster was disposed already" );
872 throw RuntimeException();
873 }
874 m_xResultSetOrigin->beforeFirst();
875}
876
877//virtual
879{
881
882 if( !m_xResultSetOrigin.is() )
883 {
884 OSL_FAIL( "broadcaster was disposed already" );
885 throw RuntimeException();
886 }
887 m_xResultSetOrigin->afterLast();
888}
889
890//virtual
892{
894
895 if( !m_xResultSetOrigin.is() )
896 {
897 OSL_FAIL( "broadcaster was disposed already" );
898 throw RuntimeException();
899 }
900 return m_xResultSetOrigin->isAfterLast();
901}
902
903//virtual
905{
907
908 if( !m_xResultSetOrigin.is() )
909 {
910 OSL_FAIL( "broadcaster was disposed already" );
911 throw RuntimeException();
912 }
913 return m_xResultSetOrigin->isBeforeFirst();
914}
915
916//virtual
918{
920
921 if( !m_xResultSetOrigin.is() )
922 {
923 OSL_FAIL( "broadcaster was disposed already" );
924 throw RuntimeException();
925 }
926 return m_xResultSetOrigin->isFirst();
927}
928
929//virtual
931{
933
934 if( !m_xResultSetOrigin.is() )
935 {
936 OSL_FAIL( "broadcaster was disposed already" );
937 throw RuntimeException();
938 }
939 return m_xResultSetOrigin->isLast();
940}
941
942
943//virtual
945{
947
948 if( !m_xResultSetOrigin.is() )
949 {
950 OSL_FAIL( "broadcaster was disposed already" );
951 throw RuntimeException();
952 }
953 return m_xResultSetOrigin->getRow();
954}
955
956//virtual
958{
960
961 if( !m_xResultSetOrigin.is() )
962 {
963 OSL_FAIL( "broadcaster was disposed already" );
964 throw RuntimeException();
965 }
966 m_xResultSetOrigin->refreshRow();
967}
968
969//virtual
971{
973
974 if( !m_xResultSetOrigin.is() )
975 {
976 OSL_FAIL( "broadcaster was disposed already" );
977 throw RuntimeException();
978 }
979 return m_xResultSetOrigin->rowUpdated();
980}
981
982//virtual
984{
986
987 if( !m_xResultSetOrigin.is() )
988 {
989 OSL_FAIL( "broadcaster was disposed already" );
990 throw RuntimeException();
991 }
992 return m_xResultSetOrigin->rowInserted();
993}
994
995//virtual
997{
999
1000 if( !m_xResultSetOrigin.is() )
1001 {
1002 OSL_FAIL( "broadcaster was disposed already" );
1003 throw RuntimeException();
1004 }
1005 return m_xResultSetOrigin->rowDeleted();
1006}
1007
1008//virtual
1010{
1012 //@todo ?return anything
1013 return Reference< XInterface >();
1014}
1015
1016
1017// XRow methods.
1018
1019
1021{
1024 if( !m_xRowOrigin.is() )
1025 {
1026 OSL_FAIL( "broadcaster was disposed already" );
1027 throw RuntimeException();
1028 }
1029}
1030
1031//virtual
1033{
1036 if( !m_xRowOrigin.is() )
1037 {
1038 OSL_FAIL( "broadcaster was disposed already" );
1039 throw RuntimeException();
1040 }
1041 return m_xRowOrigin->wasNull();
1042}
1043
1044//virtual
1045OUString SAL_CALL ContentResultSetWrapper::getString( sal_Int32 columnIndex )
1046{
1047 verifyGet();
1048 return m_xRowOrigin->getString( columnIndex );
1049}
1050
1051//virtual
1052sal_Bool SAL_CALL ContentResultSetWrapper::getBoolean( sal_Int32 columnIndex )
1053{
1054 verifyGet();
1055 return m_xRowOrigin->getBoolean( columnIndex );
1056}
1057
1058//virtual
1059sal_Int8 SAL_CALL ContentResultSetWrapper::getByte( sal_Int32 columnIndex )
1060{
1061 verifyGet();
1062 return m_xRowOrigin->getByte( columnIndex );
1063}
1064
1065//virtual
1066sal_Int16 SAL_CALL ContentResultSetWrapper::getShort( sal_Int32 columnIndex )
1067{
1068 verifyGet();
1069 return m_xRowOrigin->getShort( columnIndex );
1070}
1071
1072//virtual
1073sal_Int32 SAL_CALL ContentResultSetWrapper::getInt( sal_Int32 columnIndex )
1074{
1075 verifyGet();
1076 return m_xRowOrigin->getInt( columnIndex );
1077}
1078
1079//virtual
1080sal_Int64 SAL_CALL ContentResultSetWrapper::getLong( sal_Int32 columnIndex )
1081{
1082 verifyGet();
1083 return m_xRowOrigin->getLong( columnIndex );
1084}
1085
1086//virtual
1087float SAL_CALL ContentResultSetWrapper::getFloat( sal_Int32 columnIndex )
1088{
1089 verifyGet();
1090 return m_xRowOrigin->getFloat( columnIndex );
1091}
1092
1093//virtual
1094double SAL_CALL ContentResultSetWrapper::getDouble( sal_Int32 columnIndex )
1095{
1096 verifyGet();
1097 return m_xRowOrigin->getDouble( columnIndex );
1098}
1099
1100//virtual
1102{
1103 verifyGet();
1104 return m_xRowOrigin->getBytes( columnIndex );
1105}
1106
1107//virtual
1108Date SAL_CALL ContentResultSetWrapper::getDate( sal_Int32 columnIndex )
1109{
1110 verifyGet();
1111 return m_xRowOrigin->getDate( columnIndex );
1112}
1113
1114//virtual
1115Time SAL_CALL ContentResultSetWrapper::getTime( sal_Int32 columnIndex )
1116{
1117 verifyGet();
1118 return m_xRowOrigin->getTime( columnIndex );
1119}
1120
1121//virtual
1122DateTime SAL_CALL ContentResultSetWrapper::getTimestamp( sal_Int32 columnIndex )
1123{
1124 verifyGet();
1125 return m_xRowOrigin->getTimestamp( columnIndex );
1126}
1127
1128//virtual
1130{
1131 verifyGet();
1132 return m_xRowOrigin->getBinaryStream( columnIndex );
1133}
1134
1135//virtual
1137{
1138 verifyGet();
1139 return m_xRowOrigin->getCharacterStream( columnIndex );
1140}
1141
1142//virtual
1144{
1145 //if you change this macro please pay attention to
1146 //define XROW_GETXXX, where this is similar implemented
1147
1150 if( !m_xRowOrigin.is() )
1151 {
1152 OSL_FAIL( "broadcaster was disposed already" );
1153 throw RuntimeException();
1154 }
1155 return m_xRowOrigin->getObject( columnIndex, typeMap );
1156}
1157
1158//virtual
1160{
1161 verifyGet();
1162 return m_xRowOrigin->getRef( columnIndex );
1163}
1164
1165//virtual
1167{
1168 verifyGet();
1169 return m_xRowOrigin->getBlob( columnIndex );
1170}
1171
1172//virtual
1174{
1175 verifyGet();
1176 return m_xRowOrigin->getClob( columnIndex );
1177}
1178
1179//virtual
1181{
1182 verifyGet();
1183 return m_xRowOrigin->getArray( columnIndex );
1184}
1185
1186
1187
1188
1190 ContentResultSetWrapper* pOwner )
1191 : m_pOwner( pOwner )
1192{
1193}
1194
1196{
1197}
1198
1199
1200// XInterface methods.
1202 noexcept
1203{
1204 OWeakObject::acquire();
1205}
1206
1208 noexcept
1209{
1210 OWeakObject::release();
1211}
1212
1213css::uno::Any SAL_CALL ContentResultSetWrapperListener::queryInterface( const css::uno::Type & rType )
1214{
1215 //list all interfaces inclusive baseclasses of interfaces
1216 css::uno::Any aRet = cppu::queryInterface( rType,
1217 static_cast< XEventListener * >(
1218 static_cast< XPropertyChangeListener * >(this)),
1219 static_cast< XPropertyChangeListener* >(this),
1220 static_cast< XVetoableChangeListener* >(this)
1221 );
1222 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
1223}
1224
1225//XEventListener methods.
1226
1227
1228//virtual
1229void SAL_CALL ContentResultSetWrapperListener::disposing( const EventObject& rEventObject )
1230{
1231 if( m_pOwner )
1232 m_pOwner->impl_disposing( rEventObject );
1233}
1234
1235
1236//XPropertyChangeListener methods.
1237
1238
1239//virtual
1240void SAL_CALL ContentResultSetWrapperListener::propertyChange( const PropertyChangeEvent& rEvt )
1241{
1242 if( m_pOwner )
1244}
1245
1246
1247//XVetoableChangeListener methods.
1248
1249//virtual
1250void SAL_CALL ContentResultSetWrapperListener::vetoableChange( const PropertyChangeEvent& rEvt )
1251{
1252 if( m_pOwner )
1254}
1255
1257{
1258 m_pOwner = nullptr;
1259}
1260
1261/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ContentResultSetWrapperListener(ContentResultSetWrapper *pOwner)
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &evt) override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void SAL_CALL vetoableChange(const css::beans::PropertyChangeEvent &aEvent) override
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL release() noexcept override
virtual void impl_disposing(const css::lang::EventObject &Source)
virtual sal_Bool SAL_CALL first() override
virtual sal_Bool SAL_CALL isLast() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
ContentResultSetWrapper(css::uno::Reference< css::sdbc::XResultSet > const &xOrigin)
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray(sal_Int32 columnIndex) override
css::uno::Reference< css::sdbc::XResultSet > m_xResultSetOrigin
comphelper::OMultiTypeInterfaceContainerHelperVar3< css::beans::XVetoableChangeListener, OUString > VetoableChangeListenerContainer_Impl
virtual void SAL_CALL dispose() override
virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override
std::unique_ptr< PropertyChangeListenerContainer_Impl > m_pPropertyChangeListeners
std::unique_ptr< VetoableChangeListenerContainer_Impl > m_pVetoableChangeListeners
virtual void SAL_CALL afterLast() override
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual sal_Int16 SAL_CALL getShort(sal_Int32 columnIndex) override
css::uno::Reference< css::sdbc::XResultSetMetaData > m_xMetaDataFromOrigin
virtual sal_Int64 SAL_CALL getLong(sal_Int32 columnIndex) override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
void impl_notifyVetoableChangeListeners(const css::beans::PropertyChangeEvent &rEvt)
virtual sal_Bool SAL_CALL rowDeleted() override
virtual css::uno::Any SAL_CALL getObject(sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess > &typeMap) override
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent() override
css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo
! call impl_init_xPropertySetOrigin() bevor you access this member
virtual sal_Bool SAL_CALL rowInserted() override
virtual sal_Bool SAL_CALL getBoolean(sal_Int32 columnIndex) override
virtual ~ContentResultSetWrapper() override
virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override
virtual sal_Bool SAL_CALL isAfterLast() override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
comphelper::OMultiTypeInterfaceContainerHelperVar3< css::beans::XPropertyChangeListener, OUString > PropertyChangeListenerContainer_Impl
virtual void SAL_CALL addEventListener(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 SAL_CALL refreshRow() override
virtual sal_Bool SAL_CALL next() override
virtual sal_Bool SAL_CALL isBeforeFirst() override
rtl::Reference< ContentResultSetWrapperListener > m_xMyListenerImpl
osl::Mutex m_aContainerMutex
In dispose call.
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual OUString SAL_CALL getString(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL queryContentIdentifier() override
virtual sal_Bool SAL_CALL wasNull() override
virtual OUString SAL_CALL queryContentIdentifierString() override
virtual void impl_propertyChange(const css::beans::PropertyChangeEvent &evt)
css::uno::Reference< css::beans::XPropertySet > m_xPropertySetOrigin
! call impl_init_xContentAccessOrigin() bevor you access this member
virtual void SAL_CALL close() override
virtual css::util::Date SAL_CALL getDate(sal_Int32 columnIndex) override
css::uno::Reference< css::sdbc::XRow > m_xRowOrigin
virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef(sal_Int32 columnIndex) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 columnIndex) override
virtual css::util::DateTime SAL_CALL getTimestamp(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 columnIndex) override
virtual sal_Int8 SAL_CALL getByte(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL last() override
virtual sal_Bool SAL_CALL rowUpdated() override
std::unique_ptr< comphelper::OInterfaceContainerHelper3< css::lang::XEventListener > > m_pDisposeEventListeners
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream(sal_Int32 columnIndex) override
virtual css::util::Time SAL_CALL getTime(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob(sal_Int32 columnIndex) override
virtual sal_Int32 SAL_CALL getInt(sal_Int32 columnIndex) override
virtual void impl_vetoableChange(const css::beans::PropertyChangeEvent &aEvent)
css::uno::Reference< css::ucb::XContentAccess > m_xContentAccessOrigin
! call impl_init_xRowOrigin() bevor you access this member
virtual double SAL_CALL getDouble(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
virtual sal_Bool SAL_CALL previous() override
bool m_bInDispose
Dispose call ready.
virtual sal_Int32 SAL_CALL getRow() override
virtual sal_Bool SAL_CALL isFirst() override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override
void impl_notifyPropertyChangeListeners(const css::beans::PropertyChangeEvent &rEvt)
virtual void SAL_CALL beforeFirst() override
virtual float SAL_CALL getFloat(sal_Int32 columnIndex) override
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
bool m_bDisposed
SvLinkSource * pOwner
@ Exception
class SAL_NO_VTABLE XPropertySet
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
ContentProvider * m_pOwner
Definition: pkgprovider.cxx:58
unsigned char sal_Bool
signed char sal_Int8