fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucbhelper / source / provider / resultset.cxx
blob231585c92793899b846eec42e5faebb8d1c74055
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 /**************************************************************************
22 TODO
23 **************************************************************************
25 *************************************************************************/
26 #include <cppuhelper/interfacecontainer.hxx>
27 #include <com/sun/star/beans/PropertyAttribute.hpp>
28 #include <ucbhelper/getcomponentcontext.hxx>
29 #include <ucbhelper/resultset.hxx>
30 #include <ucbhelper/resultsetmetadata.hxx>
32 using namespace com::sun::star;
36 namespace ucbhelper_impl
39 struct PropertyInfo
41 const char* pName;
42 sal_Int32 nHandle;
43 sal_Int16 nAttributes;
44 const uno::Type& (*pGetCppuType)();
47 static const uno::Type& sal_Int32_getCppuType()
49 return cppu::UnoType<sal_Int32>::get();
52 static const uno::Type& sal_Bool_getCppuType()
54 return cppu::UnoType<bool>::get();
57 static const PropertyInfo aPropertyTable[] =
59 { "IsRowCountFinal",
60 1000,
61 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY,
62 &sal_Bool_getCppuType
64 { "RowCount",
65 1001,
66 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY,
67 &sal_Int32_getCppuType
69 { 0,
76 #define RESULTSET_PROPERTY_COUNT 2
80 // class PropertySetInfo
84 class PropertySetInfo :
85 public cppu::OWeakObject,
86 public lang::XTypeProvider,
87 public beans::XPropertySetInfo
89 uno::Sequence< beans::Property >* m_pProps;
91 private:
92 bool queryProperty(
93 const OUString& aName, beans::Property& rProp );
95 public:
96 PropertySetInfo(
97 const PropertyInfo* pProps,
98 sal_Int32 nProps );
99 virtual ~PropertySetInfo();
101 // XInterface
102 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
103 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
104 virtual void SAL_CALL acquire()
105 throw() SAL_OVERRIDE;
106 virtual void SAL_CALL release()
107 throw() SAL_OVERRIDE;
109 // XTypeProvider
110 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
111 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
112 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
113 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
115 // XPropertySetInfo
116 virtual uno::Sequence< beans::Property > SAL_CALL getProperties()
117 throw( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
118 virtual beans::Property SAL_CALL getPropertyByName(
119 const OUString& aName )
120 throw( beans::UnknownPropertyException, uno::RuntimeException, std::exception ) SAL_OVERRIDE;
121 virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name )
122 throw( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
125 typedef cppu::OMultiTypeInterfaceContainerHelperVar<OUString>
126 PropertyChangeListenerContainer;
128 class PropertyChangeListeners : public PropertyChangeListenerContainer
130 public:
131 PropertyChangeListeners( osl::Mutex& rMtx )
132 : PropertyChangeListenerContainer( rMtx ) {}
135 } // namespace ucbhelper_impl
137 using namespace ucbhelper_impl;
139 namespace ucbhelper
144 // struct ResultSet_Impl.
148 struct ResultSet_Impl
150 uno::Reference< uno::XComponentContext > m_xContext;
151 uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xEnv;
152 uno::Reference< beans::XPropertySetInfo > m_xPropSetInfo;
153 uno::Reference< sdbc::XResultSetMetaData > m_xMetaData;
154 uno::Sequence< beans::Property > m_aProperties;
155 rtl::Reference< ResultSetDataSupplier > m_xDataSupplier;
156 osl::Mutex m_aMutex;
157 cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
158 PropertyChangeListeners* m_pPropertyChangeListeners;
159 sal_Int32 m_nPos;
160 bool m_bWasNull;
161 bool m_bAfterLast;
163 inline ResultSet_Impl(
164 const uno::Reference< uno::XComponentContext >& rxContext,
165 const uno::Sequence< beans::Property >& rProperties,
166 const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
167 const uno::Reference< com::sun::star::ucb::XCommandEnvironment >&
168 rxEnv );
169 inline ~ResultSet_Impl();
172 inline ResultSet_Impl::ResultSet_Impl(
173 const uno::Reference< uno::XComponentContext >& rxContext,
174 const uno::Sequence< beans::Property >& rProperties,
175 const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
176 const uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rxEnv )
177 : m_xContext( rxContext ),
178 m_xEnv( rxEnv ),
179 m_aProperties( rProperties ),
180 m_xDataSupplier( rDataSupplier ),
181 m_pDisposeEventListeners( 0 ),
182 m_pPropertyChangeListeners( 0 ),
183 m_nPos( 0 ), // Position is one-based. Zero means: before first element.
184 m_bWasNull( false ),
185 m_bAfterLast( false )
190 inline ResultSet_Impl::~ResultSet_Impl()
192 delete m_pDisposeEventListeners;
193 delete m_pPropertyChangeListeners;
199 // ResultSet Implementation.
204 ResultSet::ResultSet(
205 const uno::Reference< uno::XComponentContext >& rxContext,
206 const uno::Sequence< beans::Property >& rProperties,
207 const rtl::Reference< ResultSetDataSupplier >& rDataSupplier )
208 : m_pImpl( new ResultSet_Impl(
209 rxContext,
210 rProperties,
211 rDataSupplier,
212 uno::Reference< com::sun::star::ucb::XCommandEnvironment >() ) )
214 rDataSupplier->m_pResultSet = this;
218 ResultSet::ResultSet(
219 const uno::Reference< uno::XComponentContext >& rxContext,
220 const uno::Sequence< beans::Property >& rProperties,
221 const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
222 const uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rxEnv )
223 : m_pImpl( new ResultSet_Impl( rxContext, rProperties, rDataSupplier, rxEnv ) )
225 rDataSupplier->m_pResultSet = this;
229 // virtual
230 ResultSet::~ResultSet()
232 delete m_pImpl;
237 // XInterface methods.
239 void SAL_CALL ResultSet::acquire()
240 throw()
242 OWeakObject::acquire();
245 void SAL_CALL ResultSet::release()
246 throw()
248 OWeakObject::release();
251 css::uno::Any SAL_CALL ResultSet::queryInterface( const css::uno::Type & rType )
252 throw( css::uno::RuntimeException, std::exception )
254 css::uno::Any aRet = cppu::queryInterface( rType,
255 (static_cast< lang::XTypeProvider* >(this)),
256 (static_cast< lang::XServiceInfo* >(this)),
257 (static_cast< lang::XComponent* >(this)),
258 (static_cast< css::ucb::XContentAccess* >(this)),
259 (static_cast< sdbc::XResultSet* >(this)),
260 (static_cast< sdbc::XResultSetMetaDataSupplier* >(this)),
261 (static_cast< sdbc::XRow* >(this)),
262 (static_cast< sdbc::XCloseable* >(this)),
263 (static_cast< beans::XPropertySet* >(this))
265 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
268 // XTypeProvider methods.
272 XTYPEPROVIDER_IMPL_9( ResultSet,
273 lang::XTypeProvider,
274 lang::XServiceInfo,
275 lang::XComponent,
276 com::sun::star::ucb::XContentAccess,
277 sdbc::XResultSet,
278 sdbc::XResultSetMetaDataSupplier,
279 sdbc::XRow,
280 sdbc::XCloseable,
281 beans::XPropertySet );
285 // XServiceInfo methods.
289 XSERVICEINFO_NOFACTORY_IMPL_1( ResultSet,
290 OUString("ResultSet"),
291 RESULTSET_SERVICE_NAME );
295 // XComponent methods.
299 // virtual
300 void SAL_CALL ResultSet::dispose()
301 throw( uno::RuntimeException, std::exception )
303 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
305 if ( m_pImpl->m_pDisposeEventListeners &&
306 m_pImpl->m_pDisposeEventListeners->getLength() )
308 lang::EventObject aEvt;
309 aEvt.Source = static_cast< lang::XComponent * >( this );
310 m_pImpl->m_pDisposeEventListeners->disposeAndClear( aEvt );
313 if ( m_pImpl->m_pPropertyChangeListeners )
315 lang::EventObject aEvt;
316 aEvt.Source = static_cast< beans::XPropertySet * >( this );
317 m_pImpl->m_pPropertyChangeListeners->disposeAndClear( aEvt );
320 m_pImpl->m_xDataSupplier->close();
324 // virtual
325 void SAL_CALL ResultSet::addEventListener(
326 const uno::Reference< lang::XEventListener >& Listener )
327 throw( uno::RuntimeException, std::exception )
329 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
331 if ( !m_pImpl->m_pDisposeEventListeners )
332 m_pImpl->m_pDisposeEventListeners =
333 new cppu::OInterfaceContainerHelper( m_pImpl->m_aMutex );
335 m_pImpl->m_pDisposeEventListeners->addInterface( Listener );
339 // virtual
340 void SAL_CALL ResultSet::removeEventListener(
341 const uno::Reference< lang::XEventListener >& Listener )
342 throw( uno::RuntimeException, std::exception )
344 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
346 if ( m_pImpl->m_pDisposeEventListeners )
347 m_pImpl->m_pDisposeEventListeners->removeInterface( Listener );
352 // XResultSetMetaDataSupplier methods.
356 // virtual
357 uno::Reference< sdbc::XResultSetMetaData > SAL_CALL ResultSet::getMetaData()
358 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
360 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
362 if ( !m_pImpl->m_xMetaData.is() )
363 m_pImpl->m_xMetaData = new ResultSetMetaData( m_pImpl->m_xContext,
364 m_pImpl->m_aProperties );
366 return m_pImpl->m_xMetaData;
371 // XResultSet methods.
375 // virtual
376 sal_Bool SAL_CALL ResultSet::next()
377 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
379 // Note: Cursor is initially positioned before the first row.
380 // First call to 'next()' moves it to first row.
382 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
384 if ( m_pImpl->m_bAfterLast )
386 m_pImpl->m_xDataSupplier->validate();
387 return sal_False;
390 // getResult works zero-based!
391 if ( !m_pImpl->m_xDataSupplier->getResult( m_pImpl->m_nPos ) )
393 m_pImpl->m_bAfterLast = true;
394 m_pImpl->m_xDataSupplier->validate();
395 return sal_False;
398 m_pImpl->m_nPos++;
399 m_pImpl->m_xDataSupplier->validate();
400 return sal_True;
404 // virtual
405 sal_Bool SAL_CALL ResultSet::isBeforeFirst()
406 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
408 if ( m_pImpl->m_bAfterLast )
410 m_pImpl->m_xDataSupplier->validate();
411 return sal_False;
414 // getResult works zero-based!
415 if ( !m_pImpl->m_xDataSupplier->getResult( 0 ) )
417 m_pImpl->m_xDataSupplier->validate();
418 return sal_False;
421 m_pImpl->m_xDataSupplier->validate();
422 return ( m_pImpl->m_nPos == 0 );
426 // virtual
427 sal_Bool SAL_CALL ResultSet::isAfterLast()
428 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
430 m_pImpl->m_xDataSupplier->validate();
431 return m_pImpl->m_bAfterLast;
435 // virtual
436 sal_Bool SAL_CALL ResultSet::isFirst()
437 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
439 if ( m_pImpl->m_bAfterLast )
441 m_pImpl->m_xDataSupplier->validate();
442 return sal_False;
445 m_pImpl->m_xDataSupplier->validate();
446 return ( m_pImpl->m_nPos == 1 );
450 // virtual
451 sal_Bool SAL_CALL ResultSet::isLast()
452 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
454 if ( m_pImpl->m_bAfterLast )
456 m_pImpl->m_xDataSupplier->validate();
457 return sal_False;
460 sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
461 if ( !nCount )
463 m_pImpl->m_xDataSupplier->validate();
464 return sal_False;
467 m_pImpl->m_xDataSupplier->validate();
468 return ( m_pImpl->m_nPos == nCount );
472 // virtual
473 void SAL_CALL ResultSet::beforeFirst()
474 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
476 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
477 m_pImpl->m_bAfterLast = false;
478 m_pImpl->m_nPos = 0;
479 m_pImpl->m_xDataSupplier->validate();
483 // virtual
484 void SAL_CALL ResultSet::afterLast()
485 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
487 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
488 m_pImpl->m_bAfterLast = true;
489 m_pImpl->m_xDataSupplier->validate();
493 // virtual
494 sal_Bool SAL_CALL ResultSet::first()
495 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
497 // getResult works zero-based!
498 if ( m_pImpl->m_xDataSupplier->getResult( 0 ) )
500 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
501 m_pImpl->m_bAfterLast = false;
502 m_pImpl->m_nPos = 1;
503 m_pImpl->m_xDataSupplier->validate();
504 return sal_True;
507 m_pImpl->m_xDataSupplier->validate();
508 return sal_False;
512 // virtual
513 sal_Bool SAL_CALL ResultSet::last()
514 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
516 sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
517 if ( nCount )
519 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
520 m_pImpl->m_bAfterLast = false;
521 m_pImpl->m_nPos = nCount;
522 m_pImpl->m_xDataSupplier->validate();
523 return sal_True;
526 m_pImpl->m_xDataSupplier->validate();
527 return sal_False;
531 // virtual
532 sal_Int32 SAL_CALL ResultSet::getRow()
533 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
535 if ( m_pImpl->m_bAfterLast )
537 m_pImpl->m_xDataSupplier->validate();
538 return 0;
541 m_pImpl->m_xDataSupplier->validate();
542 return m_pImpl->m_nPos;
546 // virtual
547 sal_Bool SAL_CALL ResultSet::absolute( sal_Int32 row )
548 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
551 If the row number is positive, the cursor moves to the given row number
552 with respect to the beginning of the result set. The first row is row 1,
553 the second is row 2, and so on.
555 If the given row number is negative, the cursor moves to an absolute row
556 position with respect to the end of the result set. For example, calling
557 absolaute( -1 ) positions the cursor on the last row, absolaute( -2 )
558 indicates the next-to-last row, and so on.
560 An attempt to position the cursor beyond the first/last row in the result
561 set leaves the cursor before/after the first/last row, respectively.
563 Calling absolute( 1 ) is the same as calling first().
565 Calling absolute( -1 ) is the same as calling last().
567 if ( row < 0 )
569 sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
571 if ( ( row * -1 ) > nCount )
573 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
574 m_pImpl->m_bAfterLast = false;
575 m_pImpl->m_nPos = 0;
576 m_pImpl->m_xDataSupplier->validate();
577 return sal_False;
579 else // |row| <= nCount
581 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
582 m_pImpl->m_bAfterLast = false;
583 m_pImpl->m_nPos = ( nCount + row + 1 );
584 m_pImpl->m_xDataSupplier->validate();
585 return sal_True;
588 else if ( row == 0 )
590 // @throws SQLException
591 // ... if row is 0 ...
592 throw sdbc::SQLException();
594 else // row > 0
596 sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
598 if ( row <= nCount )
600 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
601 m_pImpl->m_bAfterLast = false;
602 m_pImpl->m_nPos = row;
603 m_pImpl->m_xDataSupplier->validate();
604 return sal_True;
606 else // row > nCount
608 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
609 m_pImpl->m_bAfterLast = true;
610 m_pImpl->m_xDataSupplier->validate();
611 return sal_False;
615 // unreachable...
619 // virtual
620 sal_Bool SAL_CALL ResultSet::relative( sal_Int32 rows )
621 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
624 Attempting to move beyond the first/last row in the result set
625 positions the cursor before/after the first/last row.
627 Calling relative( 0 ) is valid, but does not change the cursor position.
629 Calling relative( 1 ) is different from calling next() because it makes
630 sense to call next() when there is no current row, for example, when
631 the cursor is positioned before the first row or after the last row of
632 the result set.
634 if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
636 // "No current row".
637 throw sdbc::SQLException();
640 if ( rows < 0 )
642 if ( ( m_pImpl->m_nPos + rows ) > 0 )
644 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
645 m_pImpl->m_bAfterLast = false;
646 m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
647 m_pImpl->m_xDataSupplier->validate();
648 return sal_True;
650 else
652 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
653 m_pImpl->m_bAfterLast = false;
654 m_pImpl->m_nPos = 0;
655 m_pImpl->m_xDataSupplier->validate();
656 return sal_False;
659 else if ( rows == 0 )
661 // nop.
662 m_pImpl->m_xDataSupplier->validate();
663 return sal_True;
665 else // rows > 0
667 sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
668 if ( ( m_pImpl->m_nPos + rows ) <= nCount )
670 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
671 m_pImpl->m_bAfterLast = false;
672 m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
673 m_pImpl->m_xDataSupplier->validate();
674 return sal_True;
676 else
678 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
679 m_pImpl->m_bAfterLast = true;
680 m_pImpl->m_xDataSupplier->validate();
681 return sal_False;
685 // unreachable...
689 // virtual
690 sal_Bool SAL_CALL ResultSet::previous()
691 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
694 previous() is not the same as relative( -1 ) because it makes sense
695 to call previous() when there is no current row.
697 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
699 if ( m_pImpl->m_bAfterLast )
701 m_pImpl->m_bAfterLast = false;
702 sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
703 m_pImpl->m_nPos = nCount;
705 else if ( m_pImpl->m_nPos )
706 m_pImpl->m_nPos--;
708 if ( m_pImpl->m_nPos )
710 m_pImpl->m_xDataSupplier->validate();
711 return sal_True;
714 m_pImpl->m_xDataSupplier->validate();
715 return sal_False;
719 // virtual
720 void SAL_CALL ResultSet::refreshRow()
721 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
723 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
724 if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
725 return;
727 m_pImpl->m_xDataSupplier->releasePropertyValues( m_pImpl->m_nPos );
728 m_pImpl->m_xDataSupplier->validate();
732 // virtual
733 sal_Bool SAL_CALL ResultSet::rowUpdated()
734 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
736 m_pImpl->m_xDataSupplier->validate();
737 return sal_False;
741 // virtual
742 sal_Bool SAL_CALL ResultSet::rowInserted()
743 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
745 m_pImpl->m_xDataSupplier->validate();
746 return sal_False;
750 // virtual
751 sal_Bool SAL_CALL ResultSet::rowDeleted()
752 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
754 m_pImpl->m_xDataSupplier->validate();
755 return sal_False;
759 // virtual
760 uno::Reference< uno::XInterface > SAL_CALL ResultSet::getStatement()
761 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
764 returns the Statement that produced this ResultSet object. If the
765 result set was generated some other way, ... this method returns null.
767 m_pImpl->m_xDataSupplier->validate();
768 return uno::Reference< uno::XInterface >();
773 // XRow methods.
777 // virtual
778 sal_Bool SAL_CALL ResultSet::wasNull()
779 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
781 // This method can not be implemented correctly!!! Imagine different
782 // threads doing a getXYZ - wasNull calling sequence on the same
783 // implementation object...
785 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
787 uno::Reference< sdbc::XRow > xValues
788 = m_pImpl->m_xDataSupplier->queryPropertyValues(
789 m_pImpl->m_nPos - 1 );
790 if ( xValues.is() )
792 m_pImpl->m_xDataSupplier->validate();
793 return xValues->wasNull();
797 m_pImpl->m_xDataSupplier->validate();
798 return m_pImpl->m_bWasNull;
802 // virtual
803 OUString SAL_CALL ResultSet::getString( sal_Int32 columnIndex )
804 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
806 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
808 uno::Reference< sdbc::XRow > xValues
809 = m_pImpl->m_xDataSupplier->queryPropertyValues(
810 m_pImpl->m_nPos - 1 );
811 if ( xValues.is() )
813 m_pImpl->m_bWasNull = false;
814 m_pImpl->m_xDataSupplier->validate();
815 return xValues->getString( columnIndex );
819 m_pImpl->m_bWasNull = true;
820 m_pImpl->m_xDataSupplier->validate();
821 return OUString();
825 // virtual
826 sal_Bool SAL_CALL ResultSet::getBoolean( sal_Int32 columnIndex )
827 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
829 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
831 uno::Reference< sdbc::XRow > xValues
832 = m_pImpl->m_xDataSupplier->queryPropertyValues(
833 m_pImpl->m_nPos - 1 );
834 if ( xValues.is() )
836 m_pImpl->m_bWasNull = false;
837 m_pImpl->m_xDataSupplier->validate();
838 return xValues->getBoolean( columnIndex );
842 m_pImpl->m_bWasNull = true;
843 m_pImpl->m_xDataSupplier->validate();
844 return sal_False;
848 // virtual
849 sal_Int8 SAL_CALL ResultSet::getByte( sal_Int32 columnIndex )
850 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
852 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
854 uno::Reference< sdbc::XRow > xValues
855 = m_pImpl->m_xDataSupplier->queryPropertyValues(
856 m_pImpl->m_nPos - 1 );
857 if ( xValues.is() )
859 m_pImpl->m_bWasNull = false;
860 m_pImpl->m_xDataSupplier->validate();
861 return xValues->getByte( columnIndex );
865 m_pImpl->m_bWasNull = true;
866 m_pImpl->m_xDataSupplier->validate();
867 return 0;
871 // virtual
872 sal_Int16 SAL_CALL ResultSet::getShort( sal_Int32 columnIndex )
873 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
875 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
877 uno::Reference< sdbc::XRow > xValues
878 = m_pImpl->m_xDataSupplier->queryPropertyValues(
879 m_pImpl->m_nPos - 1 );
880 if ( xValues.is() )
882 m_pImpl->m_bWasNull = false;
883 m_pImpl->m_xDataSupplier->validate();
884 return xValues->getShort( columnIndex );
888 m_pImpl->m_bWasNull = true;
889 m_pImpl->m_xDataSupplier->validate();
890 return 0;
894 // virtual
895 sal_Int32 SAL_CALL ResultSet::getInt( sal_Int32 columnIndex )
896 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
898 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
900 uno::Reference< sdbc::XRow > xValues
901 = m_pImpl->m_xDataSupplier->queryPropertyValues(
902 m_pImpl->m_nPos - 1 );
903 if ( xValues.is() )
905 m_pImpl->m_bWasNull = false;
906 m_pImpl->m_xDataSupplier->validate();
907 return xValues->getInt( columnIndex );
911 m_pImpl->m_bWasNull = true;
912 m_pImpl->m_xDataSupplier->validate();
913 return 0;
917 // virtual
918 sal_Int64 SAL_CALL ResultSet::getLong( sal_Int32 columnIndex )
919 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
921 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
923 uno::Reference< sdbc::XRow > xValues
924 = m_pImpl->m_xDataSupplier->queryPropertyValues(
925 m_pImpl->m_nPos - 1 );
926 if ( xValues.is() )
928 m_pImpl->m_bWasNull = false;
929 m_pImpl->m_xDataSupplier->validate();
930 return xValues->getLong( columnIndex );
934 m_pImpl->m_bWasNull = true;
935 m_pImpl->m_xDataSupplier->validate();
936 return 0;
940 // virtual
941 float SAL_CALL ResultSet::getFloat( sal_Int32 columnIndex )
942 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
944 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
946 uno::Reference< sdbc::XRow > xValues
947 = m_pImpl->m_xDataSupplier->queryPropertyValues(
948 m_pImpl->m_nPos - 1 );
949 if ( xValues.is() )
951 m_pImpl->m_bWasNull = false;
952 m_pImpl->m_xDataSupplier->validate();
953 return xValues->getFloat( columnIndex );
957 m_pImpl->m_bWasNull = true;
958 m_pImpl->m_xDataSupplier->validate();
959 return 0;
963 // virtual
964 double SAL_CALL ResultSet::getDouble( sal_Int32 columnIndex )
965 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
967 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
969 uno::Reference< sdbc::XRow > xValues
970 = m_pImpl->m_xDataSupplier->queryPropertyValues(
971 m_pImpl->m_nPos - 1 );
972 if ( xValues.is() )
974 m_pImpl->m_bWasNull = false;
975 m_pImpl->m_xDataSupplier->validate();
976 return xValues->getDouble( columnIndex );
980 m_pImpl->m_bWasNull = true;
981 m_pImpl->m_xDataSupplier->validate();
982 return 0;
986 // virtual
987 uno::Sequence< sal_Int8 > SAL_CALL
988 ResultSet::getBytes( sal_Int32 columnIndex )
989 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
991 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
993 uno::Reference< sdbc::XRow > xValues
994 = m_pImpl->m_xDataSupplier->queryPropertyValues(
995 m_pImpl->m_nPos - 1 );
996 if ( xValues.is() )
998 m_pImpl->m_bWasNull = false;
999 m_pImpl->m_xDataSupplier->validate();
1000 return xValues->getBytes( columnIndex );
1004 m_pImpl->m_bWasNull = true;
1005 m_pImpl->m_xDataSupplier->validate();
1006 return uno::Sequence< sal_Int8 >();
1010 // virtual
1011 util::Date SAL_CALL ResultSet::getDate( sal_Int32 columnIndex )
1012 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
1014 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1016 uno::Reference< sdbc::XRow > xValues
1017 = m_pImpl->m_xDataSupplier->queryPropertyValues(
1018 m_pImpl->m_nPos - 1 );
1019 if ( xValues.is() )
1021 m_pImpl->m_bWasNull = false;
1022 m_pImpl->m_xDataSupplier->validate();
1023 return xValues->getDate( columnIndex );
1027 m_pImpl->m_bWasNull = true;
1028 m_pImpl->m_xDataSupplier->validate();
1029 return util::Date();
1033 // virtual
1034 util::Time SAL_CALL ResultSet::getTime( sal_Int32 columnIndex )
1035 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
1037 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1039 uno::Reference< sdbc::XRow > xValues
1040 = m_pImpl->m_xDataSupplier->queryPropertyValues(
1041 m_pImpl->m_nPos - 1 );
1042 if ( xValues.is() )
1044 m_pImpl->m_bWasNull = false;
1045 m_pImpl->m_xDataSupplier->validate();
1046 return xValues->getTime( columnIndex );
1050 m_pImpl->m_bWasNull = true;
1051 m_pImpl->m_xDataSupplier->validate();
1052 return util::Time();
1056 // virtual
1057 util::DateTime SAL_CALL
1058 ResultSet::getTimestamp( sal_Int32 columnIndex )
1059 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
1061 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1063 uno::Reference< sdbc::XRow > xValues
1064 = m_pImpl->m_xDataSupplier->queryPropertyValues(
1065 m_pImpl->m_nPos - 1 );
1066 if ( xValues.is() )
1068 m_pImpl->m_bWasNull = false;
1069 m_pImpl->m_xDataSupplier->validate();
1070 return xValues->getTimestamp( columnIndex );
1074 m_pImpl->m_bWasNull = true;
1075 m_pImpl->m_xDataSupplier->validate();
1076 return util::DateTime();
1080 // virtual
1081 uno::Reference< io::XInputStream > SAL_CALL
1082 ResultSet::getBinaryStream( sal_Int32 columnIndex )
1083 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
1085 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1087 uno::Reference< sdbc::XRow > xValues
1088 = m_pImpl->m_xDataSupplier->queryPropertyValues(
1089 m_pImpl->m_nPos - 1 );
1090 if ( xValues.is() )
1092 m_pImpl->m_bWasNull = false;
1093 m_pImpl->m_xDataSupplier->validate();
1094 return xValues->getBinaryStream( columnIndex );
1098 m_pImpl->m_bWasNull = true;
1099 m_pImpl->m_xDataSupplier->validate();
1100 return uno::Reference< io::XInputStream >();
1104 // virtual
1105 uno::Reference< io::XInputStream > SAL_CALL
1106 ResultSet::getCharacterStream( sal_Int32 columnIndex )
1107 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
1109 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1111 uno::Reference< sdbc::XRow > xValues
1112 = m_pImpl->m_xDataSupplier->queryPropertyValues(
1113 m_pImpl->m_nPos - 1 );
1114 if ( xValues.is() )
1116 m_pImpl->m_bWasNull = false;
1117 m_pImpl->m_xDataSupplier->validate();
1118 return xValues->getCharacterStream( columnIndex );
1122 m_pImpl->m_bWasNull = true;
1123 m_pImpl->m_xDataSupplier->validate();
1124 return uno::Reference< io::XInputStream >();
1128 // virtual
1129 uno::Any SAL_CALL ResultSet::getObject(
1130 sal_Int32 columnIndex,
1131 const uno::Reference< container::XNameAccess >& typeMap )
1132 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
1134 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1136 uno::Reference< sdbc::XRow > xValues
1137 = m_pImpl->m_xDataSupplier->queryPropertyValues(
1138 m_pImpl->m_nPos - 1 );
1139 if ( xValues.is() )
1141 m_pImpl->m_bWasNull = false;
1142 m_pImpl->m_xDataSupplier->validate();
1143 return xValues->getObject( columnIndex, typeMap );
1147 m_pImpl->m_bWasNull = true;
1148 m_pImpl->m_xDataSupplier->validate();
1149 return uno::Any();
1153 // virtual
1154 uno::Reference< sdbc::XRef > SAL_CALL
1155 ResultSet::getRef( sal_Int32 columnIndex )
1156 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
1158 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1160 uno::Reference< sdbc::XRow > xValues
1161 = m_pImpl->m_xDataSupplier->queryPropertyValues(
1162 m_pImpl->m_nPos - 1 );
1163 if ( xValues.is() )
1165 m_pImpl->m_bWasNull = false;
1166 m_pImpl->m_xDataSupplier->validate();
1167 return xValues->getRef( columnIndex );
1171 m_pImpl->m_bWasNull = true;
1172 m_pImpl->m_xDataSupplier->validate();
1173 return uno::Reference< sdbc::XRef >();
1177 // virtual
1178 uno::Reference< sdbc::XBlob > SAL_CALL
1179 ResultSet::getBlob( sal_Int32 columnIndex )
1180 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
1182 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1184 uno::Reference< sdbc::XRow > xValues
1185 = m_pImpl->m_xDataSupplier->queryPropertyValues(
1186 m_pImpl->m_nPos - 1 );
1187 if ( xValues.is() )
1189 m_pImpl->m_bWasNull = false;
1190 m_pImpl->m_xDataSupplier->validate();
1191 return xValues->getBlob( columnIndex );
1195 m_pImpl->m_bWasNull = true;
1196 m_pImpl->m_xDataSupplier->validate();
1197 return uno::Reference< sdbc::XBlob >();
1201 // virtual
1202 uno::Reference< sdbc::XClob > SAL_CALL
1203 ResultSet::getClob( sal_Int32 columnIndex )
1204 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
1206 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1208 uno::Reference< sdbc::XRow > xValues
1209 = m_pImpl->m_xDataSupplier->queryPropertyValues(
1210 m_pImpl->m_nPos - 1 );
1211 if ( xValues.is() )
1213 m_pImpl->m_bWasNull = false;
1214 m_pImpl->m_xDataSupplier->validate();
1215 return xValues->getClob( columnIndex );
1219 m_pImpl->m_bWasNull = true;
1220 m_pImpl->m_xDataSupplier->validate();
1221 return uno::Reference< sdbc::XClob >();
1225 // virtual
1226 uno::Reference< sdbc::XArray > SAL_CALL
1227 ResultSet::getArray( sal_Int32 columnIndex )
1228 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
1230 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1232 uno::Reference< sdbc::XRow > xValues
1233 = m_pImpl->m_xDataSupplier->queryPropertyValues(
1234 m_pImpl->m_nPos - 1 );
1235 if ( xValues.is() )
1237 m_pImpl->m_bWasNull = false;
1238 m_pImpl->m_xDataSupplier->validate();
1239 return xValues->getArray( columnIndex );
1243 m_pImpl->m_bWasNull = true;
1244 m_pImpl->m_xDataSupplier->validate();
1245 return uno::Reference< sdbc::XArray >();
1250 // XCloseable methods.
1254 // virtual
1255 void SAL_CALL ResultSet::close()
1256 throw( sdbc::SQLException, uno::RuntimeException, std::exception )
1258 m_pImpl->m_xDataSupplier->close();
1259 m_pImpl->m_xDataSupplier->validate();
1264 // XContentAccess methods.
1268 // virtual
1269 OUString SAL_CALL ResultSet::queryContentIdentifierString()
1270 throw( uno::RuntimeException, std::exception )
1272 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1273 return m_pImpl->m_xDataSupplier->queryContentIdentifierString(
1274 m_pImpl->m_nPos - 1 );
1276 return OUString();
1280 // virtual
1281 uno::Reference< com::sun::star::ucb::XContentIdentifier > SAL_CALL
1282 ResultSet::queryContentIdentifier()
1283 throw( uno::RuntimeException, std::exception )
1285 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1286 return m_pImpl->m_xDataSupplier->queryContentIdentifier(
1287 m_pImpl->m_nPos - 1 );
1289 return uno::Reference< com::sun::star::ucb::XContentIdentifier >();
1293 // virtual
1294 uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
1295 ResultSet::queryContent()
1296 throw( uno::RuntimeException, std::exception )
1298 if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1299 return m_pImpl->m_xDataSupplier->queryContent( m_pImpl->m_nPos - 1 );
1301 return uno::Reference< com::sun::star::ucb::XContent >();
1306 // XPropertySet methods.
1310 // virtual
1311 uno::Reference< beans::XPropertySetInfo > SAL_CALL
1312 ResultSet::getPropertySetInfo()
1313 throw( uno::RuntimeException, std::exception )
1315 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
1317 if ( !m_pImpl->m_xPropSetInfo.is() )
1318 m_pImpl->m_xPropSetInfo
1319 = new PropertySetInfo( aPropertyTable,
1320 RESULTSET_PROPERTY_COUNT );
1321 return m_pImpl->m_xPropSetInfo;
1325 // virtual
1326 void SAL_CALL ResultSet::setPropertyValue( const OUString& aPropertyName,
1327 const uno::Any& )
1328 throw( beans::UnknownPropertyException,
1329 beans::PropertyVetoException,
1330 lang::IllegalArgumentException,
1331 lang::WrappedTargetException,
1332 uno::RuntimeException, std::exception )
1334 if ( aPropertyName.isEmpty() )
1335 throw beans::UnknownPropertyException();
1337 if ( aPropertyName == "RowCount" )
1339 // property is read-only.
1340 throw lang::IllegalArgumentException();
1342 else if ( aPropertyName == "IsRowCountFinal" )
1344 // property is read-only.
1345 throw lang::IllegalArgumentException();
1347 else
1349 throw beans::UnknownPropertyException();
1354 // virtual
1355 uno::Any SAL_CALL ResultSet::getPropertyValue(
1356 const OUString& PropertyName )
1357 throw( beans::UnknownPropertyException,
1358 lang::WrappedTargetException,
1359 uno::RuntimeException, std::exception )
1361 if ( PropertyName.isEmpty() )
1362 throw beans::UnknownPropertyException();
1364 uno::Any aValue;
1366 if ( PropertyName == "RowCount" )
1368 aValue <<= m_pImpl->m_xDataSupplier->currentCount();
1370 else if ( PropertyName == "IsRowCountFinal" )
1372 aValue <<= m_pImpl->m_xDataSupplier->isCountFinal();
1374 else
1376 throw beans::UnknownPropertyException();
1379 return aValue;
1383 // virtual
1384 void SAL_CALL ResultSet::addPropertyChangeListener(
1385 const OUString& aPropertyName,
1386 const uno::Reference< beans::XPropertyChangeListener >& xListener )
1387 throw( beans::UnknownPropertyException,
1388 lang::WrappedTargetException,
1389 uno::RuntimeException, std::exception )
1391 // Note: An empty property name means a listener for "all" properties.
1393 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
1395 if ( !aPropertyName.isEmpty() &&
1396 aPropertyName != "RowCount" &&
1397 aPropertyName != "IsRowCountFinal" )
1398 throw beans::UnknownPropertyException();
1400 if ( !m_pImpl->m_pPropertyChangeListeners )
1401 m_pImpl->m_pPropertyChangeListeners
1402 = new PropertyChangeListeners( m_pImpl->m_aMutex );
1404 m_pImpl->m_pPropertyChangeListeners->addInterface(
1405 aPropertyName, xListener );
1409 // virtual
1410 void SAL_CALL ResultSet::removePropertyChangeListener(
1411 const OUString& aPropertyName,
1412 const uno::Reference< beans::XPropertyChangeListener >& xListener )
1413 throw( beans::UnknownPropertyException,
1414 lang::WrappedTargetException,
1415 uno::RuntimeException, std::exception )
1417 osl::MutexGuard aGuard( m_pImpl->m_aMutex );
1419 if ( !aPropertyName.isEmpty() &&
1420 aPropertyName != "RowCount" &&
1421 aPropertyName != "IsRowCountFinal" )
1422 throw beans::UnknownPropertyException();
1424 if ( m_pImpl->m_pPropertyChangeListeners )
1425 m_pImpl->m_pPropertyChangeListeners->removeInterface(
1426 aPropertyName, xListener );
1431 // virtual
1432 void SAL_CALL ResultSet::addVetoableChangeListener(
1433 const OUString&,
1434 const uno::Reference< beans::XVetoableChangeListener >& )
1435 throw( beans::UnknownPropertyException,
1436 lang::WrappedTargetException,
1437 uno::RuntimeException, std::exception )
1439 // No constrained props, at the moment.
1443 // virtual
1444 void SAL_CALL ResultSet::removeVetoableChangeListener(
1445 const OUString&,
1446 const uno::Reference< beans::XVetoableChangeListener >& )
1447 throw( beans::UnknownPropertyException,
1448 lang::WrappedTargetException,
1449 uno::RuntimeException, std::exception )
1451 // No constrained props, at the moment.
1456 // Non-interface methods.
1460 void ResultSet::propertyChanged( const beans::PropertyChangeEvent& rEvt )
1462 if ( !m_pImpl->m_pPropertyChangeListeners )
1463 return;
1465 // Notify listeners interested especially in the changed property.
1466 cppu::OInterfaceContainerHelper* pPropsContainer
1467 = m_pImpl->m_pPropertyChangeListeners->getContainer(
1468 rEvt.PropertyName );
1469 if ( pPropsContainer )
1471 cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
1472 while ( aIter.hasMoreElements() )
1474 uno::Reference< beans::XPropertyChangeListener > xListener(
1475 aIter.next(), uno::UNO_QUERY );
1476 if ( xListener.is() )
1477 xListener->propertyChange( rEvt );
1481 // Notify listeners interested in all properties.
1482 pPropsContainer
1483 = m_pImpl->m_pPropertyChangeListeners->getContainer( OUString() );
1484 if ( pPropsContainer )
1486 cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
1487 while ( aIter.hasMoreElements() )
1489 uno::Reference< beans::XPropertyChangeListener > xListener(
1490 aIter.next(), uno::UNO_QUERY );
1491 if ( xListener.is() )
1492 xListener->propertyChange( rEvt );
1498 void ResultSet::rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew )
1500 OSL_ENSURE( nOld < nNew, "ResultSet::rowCountChanged - nOld >= nNew!" );
1502 if ( !m_pImpl->m_pPropertyChangeListeners )
1503 return;
1505 propertyChanged(
1506 beans::PropertyChangeEvent(
1507 static_cast< cppu::OWeakObject * >( this ),
1508 OUString("RowCount"),
1509 sal_False,
1510 1001,
1511 uno::makeAny( nOld ), // old value
1512 uno::makeAny( nNew ) ) ); // new value
1516 void ResultSet::rowCountFinal()
1518 if ( !m_pImpl->m_pPropertyChangeListeners )
1519 return;
1521 propertyChanged(
1522 beans::PropertyChangeEvent(
1523 static_cast< cppu::OWeakObject * >( this ),
1524 OUString("IsRowCountFinal"),
1525 sal_False,
1526 1000,
1527 uno:: makeAny( sal_False ), // old value
1528 uno::makeAny( sal_True ) ) ); // new value
1532 const uno::Sequence< beans::Property >& ResultSet::getProperties()
1534 return m_pImpl->m_aProperties;
1538 const uno::Reference< com::sun::star::ucb::XCommandEnvironment >&
1539 ResultSet::getEnvironment()
1541 return m_pImpl->m_xEnv;
1544 } // namespace ucbhelper
1546 namespace ucbhelper_impl {
1551 // PropertySetInfo Implementation.
1556 PropertySetInfo::PropertySetInfo(
1557 const PropertyInfo* pProps,
1558 sal_Int32 nProps )
1560 m_pProps = new uno::Sequence< beans::Property >( nProps );
1562 if ( nProps )
1564 const PropertyInfo* pEntry = pProps;
1565 beans::Property* pProperties = m_pProps->getArray();
1567 for ( sal_Int32 n = 0; n < nProps; ++n )
1569 beans::Property& rProp = pProperties[ n ];
1571 rProp.Name = OUString::createFromAscii( pEntry->pName );
1572 rProp.Handle = pEntry->nHandle;
1573 rProp.Type = pEntry->pGetCppuType();
1574 rProp.Attributes = pEntry->nAttributes;
1576 pEntry++;
1582 // virtual
1583 PropertySetInfo::~PropertySetInfo()
1585 delete m_pProps;
1590 // XInterface methods.
1591 void SAL_CALL PropertySetInfo::acquire()
1592 throw()
1594 OWeakObject::acquire();
1597 void SAL_CALL PropertySetInfo::release()
1598 throw()
1600 OWeakObject::release();
1603 css::uno::Any SAL_CALL PropertySetInfo::queryInterface(
1604 const css::uno::Type & rType )
1605 throw( css::uno::RuntimeException, std::exception )
1607 css::uno::Any aRet = cppu::queryInterface( rType,
1608 (static_cast< lang::XTypeProvider* >(this)),
1609 (static_cast< beans::XPropertySetInfo* >(this))
1611 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
1614 // XTypeProvider methods.
1618 XTYPEPROVIDER_IMPL_2( PropertySetInfo,
1619 lang::XTypeProvider,
1620 beans::XPropertySetInfo );
1624 // XPropertySetInfo methods.
1628 // virtual
1629 uno::Sequence< beans::Property > SAL_CALL PropertySetInfo::getProperties()
1630 throw( uno::RuntimeException, std::exception )
1632 return uno::Sequence< beans::Property >( *m_pProps );
1636 // virtual
1637 beans::Property SAL_CALL PropertySetInfo::getPropertyByName(
1638 const OUString& aName )
1639 throw( beans::UnknownPropertyException, uno::RuntimeException, std::exception )
1641 beans::Property aProp;
1642 if ( queryProperty( aName, aProp ) )
1643 return aProp;
1645 throw beans::UnknownPropertyException();
1649 // virtual
1650 sal_Bool SAL_CALL PropertySetInfo::hasPropertyByName(
1651 const OUString& Name )
1652 throw( uno::RuntimeException, std::exception )
1654 beans::Property aProp;
1655 return queryProperty( Name, aProp );
1659 bool PropertySetInfo::queryProperty(
1660 const OUString& aName, beans::Property& rProp )
1662 sal_Int32 nCount = m_pProps->getLength();
1663 const beans::Property* pProps = m_pProps->getConstArray();
1664 for ( sal_Int32 n = 0; n < nCount; ++n )
1666 const beans::Property& rCurr = pProps[ n ];
1667 if ( rCurr.Name == aName )
1669 rProp = rCurr;
1670 return true;
1674 return false;
1677 } // namespace ucbhelper_impl
1679 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */