summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-04-21 19:40:39 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2013-04-22 17:55:14 +0200
commitbfc0bf6a164f25c6e2af86fb0298ecb0f88c9df9 (patch)
treebfdd455d9f9dbb124e5caf7cbcfc855e88133171
parentd645a6a17cd03d0f875e1246652664860d91c0c5 (diff)
Data-aware ListBox: BoundValue==-1 to store index in list
Change-Id: I248cd5ec62574f47a27f8b37e1e90333b8748af2
-rw-r--r--forms/source/component/ListBox.cxx5
-rw-r--r--offapi/com/sun/star/form/component/DatabaseListBox.idl16
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