diff options
Diffstat (limited to 'forms')
-rw-r--r-- | forms/qa/integration/forms/FormLayer.java | 22 | ||||
-rw-r--r-- | forms/qa/integration/forms/FormPropertyBags.java | 2 | ||||
-rw-r--r-- | forms/source/component/FormComponent.cxx | 9 |
3 files changed, 30 insertions, 3 deletions
diff --git a/forms/qa/integration/forms/FormLayer.java b/forms/qa/integration/forms/FormLayer.java index d67e28bcf412..032ca5e7331a 100644 --- a/forms/qa/integration/forms/FormLayer.java +++ b/forms/qa/integration/forms/FormLayer.java @@ -310,7 +310,27 @@ public class FormLayer } /* ------------------------------------------------------------------ */ - /** retrieves a control model with a given access path + /** retrieves a control model with a given (integer) access path + */ + public XPropertySet getControlModel( int[] _accessPath ) throws com.sun.star.uno.Exception + { + XIndexAccess indexAcc = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class, + m_document.getFormComponentTreeRoot() ); + XPropertySet controlModel = null; + int i=0; + while ( ( indexAcc != null ) && ( i < _accessPath.length ) ) + { + controlModel = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, + indexAcc.getByIndex( _accessPath[i] ) ); + indexAcc = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class, + controlModel ); + ++i; + } + return controlModel; + } + + /* ------------------------------------------------------------------ */ + /** retrieves a control model with a given (string) access path */ public XPropertySet getControlModel( String[] _accessPath ) throws com.sun.star.uno.Exception { diff --git a/forms/qa/integration/forms/FormPropertyBags.java b/forms/qa/integration/forms/FormPropertyBags.java index 92aa2b8b6236..4adb04796030 100644 --- a/forms/qa/integration/forms/FormPropertyBags.java +++ b/forms/qa/integration/forms/FormPropertyBags.java @@ -180,7 +180,7 @@ public class FormPropertyBags extends complexlib.ComplexTestCase implements XPro m_document = DocumentHelper.loadDocument( m_orb, documentURL ); m_formLayer = new FormLayer( m_document ); - XPropertySet textFieldModel = m_formLayer.getControlModel( new String[] { "Standard", "TextBox" } ); + XPropertySet textFieldModel = m_formLayer.getControlModel( new int[] { 0, 0 } ); // all persistent properties should have the expected values assure( "persistent properties did not survive reload (1)!", ((String)textFieldModel.getPropertyValue( "SomeBoundText" )).equals( "ChangedBoundText" ) ); diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 23c05be9f89f..3b6a6afaf5de 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -1977,7 +1977,6 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co //------------------------------------------------------------------------------ void SAL_CALL OBoundControlModel::propertyChange( const PropertyChangeEvent& evt ) throw(RuntimeException) { - // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::setFastPropertyValue_NoBroadcast" ); // if the DBColumn value changed, transfer it to the control if ( evt.PropertyName.equals( PROPERTY_VALUE ) ) { @@ -2267,6 +2266,14 @@ void OBoundControlModel::impl_connectDatabaseColumn_noNotify( bool _bFromReload m_bLoaded = sal_True; onConnectedDbColumn( xRowSet ); + // Some derived classes decide to cache the "current" (resp. "last known") control value, so operations like + // commitControlValueToDbColumn can be made a no-op when nothing actually changed. + // Normally, this cache is kept in sync with the column value, but during a reload, this synchronization is + // temporarily disable. To allow the derived classes to update their cache from the current column value, + // we call translateDbColumnToControlValue. + if ( _bFromReload && hasField() ) + translateDbColumnToControlValue(); + // initially transfer the db column value to the control, if we successfully connected to a database column if ( hasField() ) initFromField( xRowSet ); |