From 178b8a986d3c5e0fc4d0894f52764179ade1e988 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Lankenau Date: Mon, 28 Jun 2004 16:09:28 +0000 Subject: INTEGRATION: CWS dba12 (1.29.2); FILE MERGED 2004/06/14 21:00:03 fs 1.29.2.4: RESYNC: (1.29-1.31); FILE MERGED 2004/05/14 14:58:35 fs 1.29.2.3: #i24495# reset: on the insertion row, also do a full reset (not just a simple reset) 2004/04/28 08:09:31 fs 1.29.2.2: #i27816# OBoundControl::queryAggregation: properly handle XTypeProvider request 2004/04/28 06:51:50 fs 1.29.2.1: #i25306# proper defaults for the OBoundControlModel's properties --- forms/source/component/FormComponent.cxx | 58 +++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 12 deletions(-) (limited to 'forms') diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 9f2c7a21a920..ee1cd7f4385a 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FormComponent.cxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.32 $ * - * last change: $Author: hr $ $Date: 2004-05-10 13:39:35 $ + * last change: $Author: hjs $ $Date: 2004-06-28 17:09:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -431,9 +431,16 @@ Sequence< Type> OBoundControl::_getTypes() //------------------------------------------------------------------ Any SAL_CALL OBoundControl::queryAggregation(const Type& _rType) throw(RuntimeException) { + Any aReturn; + + // XTypeProvider first - don't ask the OBoundControl_BASE, it would deliver incomplete types + if ( _rType.equals( ::getCppuType( static_cast< Reference< XTypeProvider >* >( NULL ) ) ) ) + aReturn = OControl::queryAggregation( _rType ); + // ask our own interfaces - // (do this first - we want to "overwrite" XPropertiesChangeListener) - Any aReturn( OBoundControl_BASE::queryInterface(_rType) ); + // (do this first (except XTypeProvider ) - we want to "overwrite" XPropertiesChangeListener) + if ( !aReturn.hasValue() ) + aReturn = OBoundControl_BASE::queryInterface( _rType ); // ask the base class if ( !aReturn.hasValue() ) @@ -1868,6 +1875,23 @@ sal_Bool OBoundControlModel::convertFastPropertyValue( return bModified; } +//------------------------------------------------------------------------------ +Any OBoundControlModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const +{ + Any aDefault; + switch ( _nHandle ) + { + case PROPERTY_ID_CONTROLSOURCE: + aDefault <<= ::rtl::OUString(); + break; + + case PROPERTY_ID_CONTROLLABEL: + aDefault <<= Reference< XPropertySet >(); + break; + } + return aDefault; +} + //------------------------------------------------------------------------------ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception) { @@ -2378,12 +2402,27 @@ void OBoundControlModel::reset() throw (RuntimeException) ::osl::ClearableMutexGuard aGuard( m_aMutex ); + // on a new record? + sal_Bool bIsNewRecord = sal_False; + Reference xSet( m_xCursor, UNO_QUERY ); + if ( xSet.is() ) + xSet->getPropertyValue( PROPERTY_ISNEW ) >>= bIsNewRecord; + + // cursor on an invalid row? + sal_Bool bInvalidCursorPosition = m_xCursor.is() + && ( m_xCursor->isAfterLast() + || m_xCursor->isBeforeFirst() + ) + && !bIsNewRecord; + // don't count the insert row as "invalid" + // @since #i24495# + // @date 2004-05-14 + // @author fs@openoffice.org + sal_Bool bSimpleReset = ( !m_xColumn.is() // no connection to a database column || ( m_xCursor.is() // OR we have an improperly positioned cursor - && ( m_xCursor->isAfterLast() - || m_xCursor->isBeforeFirst() - ) + && bInvalidCursorPosition ) || hasExternalValueBinding() // OR we have an external value binding ); @@ -2428,11 +2467,6 @@ void OBoundControlModel::reset() throw (RuntimeException) if ( bIsNull ) { - sal_Bool bIsNewRecord = sal_False; - Reference xSet( m_xCursor, UNO_QUERY ); - if ( xSet.is() ) - xSet->getPropertyValue( PROPERTY_ISNEW ) >>= bIsNewRecord; - if ( bIsNewRecord ) { // reset the control to it's default -- cgit v1.2.3