diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-04-22 17:37:17 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-04-22 17:56:00 +0200 |
commit | 567a4fcf02bee6e989ddefcff81ad186b1a02eea (patch) | |
tree | 1c020ffa8700f902d7704b61c54ccdf38497c3c6 /forms | |
parent | ListBox: take care of validation (use binding value when appropriate) (diff) | |
download | core-567a4fcf02bee6e989ddefcff81ad186b1a02eea.tar.gz core-567a4fcf02bee6e989ddefcff81ad186b1a02eea.zip |
Data-aware bindable ListBox new feature: bind *value*
As opposed to index in list or *display* string
Change-Id: I5fa74c80b28db843d45ee68523a4349ba44d229b
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/component/ListBox.cxx | 34 |
1 files changed, 32 insertions, 2 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 |