summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-04-22 17:37:17 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2013-04-22 17:56:00 +0200
commit567a4fcf02bee6e989ddefcff81ad186b1a02eea (patch)
tree1c020ffa8700f902d7704b61c54ccdf38497c3c6
parenta2c54dc208278afca127c049f069b48b2a35710e (diff)
Data-aware bindable ListBox new feature: bind *value*
As opposed to index in list or *display* string Change-Id: I5fa74c80b28db843d45ee68523a4349ba44d229b
-rw-r--r--forms/source/component/ListBox.cxx34
-rw-r--r--offapi/com/sun/star/form/binding/BindableDatabaseListBox.idl21
2 files changed, 48 insertions, 7 deletions
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index 2ea90a99dacf..8771869e50ae 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -1246,8 +1246,10 @@ namespace frm
{
eIndexList, /// as list of indexes of selected entries
eIndex, /// as index of the selected entry
- eEntryList, /// as list of string representations of selected entries
- eEntry /// as string representation of the selected entry
+ eEntryList, /// as list of string representations of selected *display* entries
+ eEntry, /// as string representation of the selected *display* entry
+ eValueList, /// as list of string representations of selected values
+ eValue /// as string representation of the selected value
};
//--------------------------------------------------------------------
@@ -1255,6 +1257,8 @@ namespace frm
{
switch ( _rExchangeType.getTypeClass() )
{
+ case TypeClass_ANY:
+ return eValue;
case TypeClass_STRING:
return eEntry;
case TypeClass_LONG:
@@ -1264,6 +1268,8 @@ namespace frm
Type aElementType = ::comphelper::getSequenceElementType( _rExchangeType );
switch ( aElementType.getTypeClass() )
{
+ case TypeClass_ANY:
+ return eValueList;
case TypeClass_STRING:
return eEntryList;
case TypeClass_LONG:
@@ -1287,6 +1293,22 @@ namespace frm
switch ( lcl_getCurrentExchangeType( getExternalValueType() ) )
{
+ case eValueList:
+ {
+ Sequence< const Any > aExternalValues;
+ OSL_VERIFY( _rExternalValue >>= aExternalValues );
+ aSelectIndexes = translateBindingValuesToControlValue( aExternalValues );
+ }
+ break;
+
+ case eValue:
+ {
+ ORowSetValue v;
+ v.fill(_rExternalValue);
+ aSelectIndexes = translateDbValueToControlValue(v);
+ }
+ break;
+
case eIndexList:
{
// unfortunately, our select sequence is a sequence<short>, while the external binding
@@ -1475,6 +1497,14 @@ namespace frm
Any aReturn;
switch ( lcl_getCurrentExchangeType( getExternalValueType() ) )
{
+ case eValueList:
+ aReturn = getCurrentMultiValue();
+ break;
+
+ case eValue:
+ aReturn = getCurrentSingleValue();
+ break;
+
case eIndexList:
{
// unfortunately, the select sequence is a sequence<short>, but our binding
diff --git a/offapi/com/sun/star/form/binding/BindableDatabaseListBox.idl b/offapi/com/sun/star/form/binding/BindableDatabaseListBox.idl
index 64acb45c4d04..4540dde132a4 100644
--- a/offapi/com/sun/star/form/binding/BindableDatabaseListBox.idl
+++ b/offapi/com/sun/star/form/binding/BindableDatabaseListBox.idl
@@ -26,17 +26,28 @@
module com { module sun { module star { module form { module binding {
-
/** This service specifies a list box model which is data-aware and thus can be bound to a
database field, and additionally supports binding to arbitrary external values.
- <p>There are four possible ways how a <type>BindableDatabaseListBox</type> exchanges
- values with an external binding, the following lists explains all of them. If a new binding
+ <p>There are six possible ways that a <type>BindableDatabaseListBox</type> exchanges
+ values with an external binding. If a new binding
is set at a <type>BindableDatabaseListBox</type>, the types from the following list are
tried in descending order: The first type supported by the binding is used for data exchange.
- <ol><li><em>sequences of integers</em>: When used, the integers in the sequence will represent
+ <ol>
+ <li><em>sequences of <atom>any</atom>s</em>:
+ The elements in the sequence will represent
+ the values the selected entries of the list box
+ (taken from ValueList or read from BoundColumn).
+ In other words, the SelectedValues property.</li>
+ <li><em><atom>any</atom> value</em>:
+ The value will represent the value of the selected entry
+ (taken from ValueList or read from BoundColumn).
+ If more than one entry is selected,
+ <NULL/> will be transfered.
+ In other words, the SelectedValue property.</li>
+ <li><em>sequences of long integers</em>: When used, the integers in the sequence will represent
the indexes of the selected entries of the list box.</li>
- <li><em>integer values</em>: When used, the value will represent the index of the selected entry.
+ <li><em>long integer value</em>: When used, the value will represent the index of the selected entry.
If no entry is selected, -1 will be transfered. If more than one entry is selected, <NULL/>
will be transfered.</li>
<li><em>sequences of strings</em>: When used, the strings in the sequence present the texts