From 3e1a0c9b2f83a44f5e7ff154d6e09d4f7b26a5e5 Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Sun, 21 Apr 2013 15:41:20 +0200 Subject: Data-aware ListBox: populate ValueList even without bound field Change-Id: I8742285778962b5be10f3aa300236efd525bdeb9 --- forms/source/component/ListBox.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'forms') diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index b4df74660a93..b4152bbbe841 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -808,6 +808,10 @@ namespace frm ValueList aDisplayList, aValueList; sal_Bool bUseNULL = hasField() && !isRequired(); + // empty BoundColumn is treated as BoundColumn=0, + if(!aBoundColumn) + aBoundColumn = 0; + try { OSL_ENSURE( xListCursor.is() || ( ListSourceType_TABLEFIELDS == m_eListSourceType ), @@ -842,8 +846,8 @@ namespace frm // Get the field of BoundColumn of the ResultSet m_nBoundColumnType = DataType::SQLNULL; - if ( !!aBoundColumn && ( *aBoundColumn >= 0 ) && m_xColumn.is() ) - { // don't look for a bound column if we're not connected to a field + if ( *aBoundColumn >= 0 ) + { try { Reference< XPropertySet > xBoundField( xColumns->getByIndex( *aBoundColumn ), UNO_QUERY_THROW ); @@ -867,11 +871,9 @@ namespace frm aStr = aValueFormatter.getFormattedValue(); aDisplayList.push_back( aStr ); - if ( impl_hasBoundComponent() ) - { + if(*aBoundColumn >= 0) aBoundValue.fill( *aBoundColumn + 1, m_nBoundColumnType, xCursorRow ); - aValueList.push_back( aBoundValue ); - } + aValueList.push_back( aBoundValue ); if ( bUseNULL && ( m_nNULLPos == -1 ) && aStr.isEmpty() ) m_nNULLPos = sal_Int16( aDisplayList.size() - 1 ); @@ -914,8 +916,7 @@ namespace frm // Add NULL entry if (bUseNULL && m_nNULLPos == -1) { - if ( impl_hasBoundComponent() ) - aValueList.insert( aValueList.begin(), ORowSetValue() ); + aValueList.insert( aValueList.begin(), ORowSetValue() ); aDisplayList.insert( aDisplayList.begin(), ORowSetValue( OUString() ) ); m_nNULLPos = 0; -- cgit v1.2.3