forms/source/component/ListBox.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
New commits: commit d8eafdafe0a86c2fb83855852a12703366b3914e Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Sun Jun 23 17:32:20 2013 +0200 Data-aware ListBox: use entry for NULL if the *bound* value is NULL as opposed to when the display string is empty. Change-Id: I802955404d2d8d5c91b3fd1633e34be7ef4f0b82 diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index b3726f3..90decec 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -915,8 +915,13 @@ namespace frm aBoundValue = static_cast<sal_Int16>(xListCursor->getRow()-1); aValueList.push_back( aBoundValue ); - if ( bUseNULL && ( m_nNULLPos == -1 ) && aStr.isEmpty() ) + if ( bUseNULL && ( m_nNULLPos == -1 ) && aBoundValue.isNull() ) m_nNULLPos = sal_Int16( aDisplayList.size() - 1 ); + if ( bUseNULL && ( m_nNULLPos == -1 ) && aStr.isEmpty() ) + // There is already a non-NULL entry with empty display string; + // adding another one for NULL would make things confusing, + // so back off. + bUseNULL = false; } } break; commit 157a9da9340c5b03c598c29aa2a1fe5c709c66f3 Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Sun Jun 23 17:28:58 2013 +0200 Use unsigned values in m_a(Converted)BoundValues Values that come from the database are always signed (we inherit that from sdbc that inherits that from jdbc that inherits that from Java's type system that does not have unsigned values) So when using unsigned values, they always operator==-compare false! Change-Id: I604b04afa23ede835c1f3db1f8c1bdeafbfba7ea diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 2d09771..b3726f3 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -912,7 +912,7 @@ namespace frm 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); + aBoundValue = static_cast<sal_Int16>(xListCursor->getRow()-1); aValueList.push_back( aBoundValue ); if ( bUseNULL && ( m_nNULLPos == -1 ) && aStr.isEmpty() ) commit 2d432035a82731163ce4c2a72f228e2c98c9f8f2 Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Sun Jun 23 17:25:43 2013 +0200 enhance comment Change-Id: I897a59d10a903bfe303b1ac059f19b6dcc686616 diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 51f7516..2d09771 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -843,7 +843,7 @@ namespace frm ValueList aDisplayList, aValueList; sal_Bool bUseNULL = hasField() && !isRequired(); - // empty BoundColumn is treated as BoundColumn=0, + // empty BoundColumn is treated as BoundColumn==0, if(!aBoundColumn) aBoundColumn = 0; commit 2a2b900544cac3b2f2c915b76872bf3c1c050f84 Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Sun Jun 23 17:25:11 2013 +0200 avoid initialise-then-reset Directly construct as unitialised Change-Id: I66aa4f5a5f5ed2c1d5bf0cb8083e1968ef776bf7 diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index f99d4fe..51f7516 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -709,8 +709,7 @@ namespace frm return; } - ::boost::optional< sal_Int16 > aBoundColumn(0); - aBoundColumn.reset(); + ::boost::optional< sal_Int16 > aBoundColumn(boost::none); if ( m_aBoundColumn.getValueType().getTypeClass() == TypeClass_SHORT ) { sal_Int16 nBoundColumn( 0 ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits