diff options
-rw-r--r-- | forms/source/component/ListBox.cxx | 5 | ||||
-rw-r--r-- | offapi/com/sun/star/form/component/DatabaseListBox.idl | 16 |
2 files changed, 14 insertions, 7 deletions
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 9cfdc70300fb..4941918b6bed 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -858,6 +858,8 @@ namespace frm DBG_UNHANDLED_EXCEPTION(); } } + else if ( *aBoundColumn == -1) + m_nBoundColumnType = DataType::SMALLINT; // If the LB is bound to a field and empty entries are valid, we remember the position // for an empty entry @@ -873,6 +875,9 @@ namespace frm if(*aBoundColumn >= 0) aBoundValue.fill( *aBoundColumn + 1, m_nBoundColumnType, xCursorRow ); + else + // -1 because getRow() is 1-indexed, but ListBox positions are 0-indexed + aBoundValue = static_cast<sal_uInt16>(xListCursor->getRow()-1); aValueList.push_back( aBoundValue ); if ( bUseNULL && ( m_nNULLPos == -1 ) && aStr.isEmpty() ) diff --git a/offapi/com/sun/star/form/component/DatabaseListBox.idl b/offapi/com/sun/star/form/component/DatabaseListBox.idl index aa27e8d75986..e77ee25184ca 100644 --- a/offapi/com/sun/star/form/component/DatabaseListBox.idl +++ b/offapi/com/sun/star/form/component/DatabaseListBox.idl @@ -72,13 +72,15 @@ published service DatabaseListBox <member scope="com::sun::star::form">DataAwareControlModel::DataField</member>. <dl> - <dt>0</dt> - <dd>The selected (displayed) list box string is stored in - the current database field.</dd> - - <dt>1 or greater</dt> - <dd>The column value of the result set at the position is - stored in the current database field.</dd> + <dt>-1</dt> + <dd>The index (starting at 0) of the selected list box entry + is stored in the current database field.</dd> + + <dt>0 or greater</dt> + <dd>The column value of the result set at the position + (0-indexed) is stored in the current database field. + In particular, for value 0, the selected (displayed) + list box string is stored.</dd> </dl></p> <p>The bound column property is only used if a list source is defined |