summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-02-16 14:35:27 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-02-16 14:35:27 +0100
commitf73c4f6da28a0b9184959284eba60ca519062fab (patch)
treec1ef0d371d9d5e8dfc3cf6de2c2ab600e09e147f /forms
parent1978cca34f42246caf202e80dc2b82b224148d9b (diff)
dba34d: #i116215# de-select all items when the to-be-selected string is invalid or empty
Diffstat (limited to 'forms')
-rw-r--r--forms/source/component/Filter.cxx34
1 files changed, 27 insertions, 7 deletions
diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx
index a9a5e93ec..afa834577 100644
--- a/forms/source/component/Filter.cxx
+++ b/forms/source/component/Filter.cxx
@@ -631,19 +631,39 @@ namespace frm
if (xListBox.is())
{
m_aText = aText;
- xListBox->selectItem(m_aText, sal_True);
- if ( xListBox->getSelectedItemPos() >= 0 )
+ MapString2String::const_iterator itemPos = m_aDisplayItemToValueItem.find( m_aText );
+ if ( itemPos == m_aDisplayItemToValueItem.end() )
{
- const bool isQuoted = ( aText.getLength() > 0 )
- && ( aText[0] == '\'' )
- && ( aText[aText.getLength() - 1] == '\'' );
+ const bool isQuoted = ( m_aText.getLength() > 1 )
+ && ( m_aText[0] == '\'' )
+ && ( m_aText[ m_aText.getLength() - 1 ] == '\'' );
if ( isQuoted )
{
- xListBox->selectItem( aText.copy( 1, aText.getLength() - 2 ), sal_True );
+ m_aText = m_aText.copy( 1, m_aText.getLength() - 2 );
+ itemPos = m_aDisplayItemToValueItem.find( m_aText );
}
}
+
+ OSL_ENSURE( ( itemPos != m_aDisplayItemToValueItem.end() ) || ( m_aText.getLength() == 0 ),
+ "OFilterControl::setText: this text is not in my display list!" );
+ if ( itemPos == m_aDisplayItemToValueItem.end() )
+ m_aText = ::rtl::OUString();
+
+ if ( m_aText.getLength() == 0)
+ {
+ while ( xListBox->getSelectedItemPos() >= 0 )
+ {
+ xListBox->selectItemPos( xListBox->getSelectedItemPos(), sal_False );
+ }
+ }
+ else
+ {
+ xListBox->selectItem( m_aText, sal_True );
+ }
}
- } break;
+ }
+ break;
+
default:
{
Reference< XTextComponent > xText( getPeer(), UNO_QUERY );