summaryrefslogtreecommitdiff
path: root/forms/source/component/Filter.cxx
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
commit4c47c0802599e0d24c192ed0cb73b5d64fbfc421 (patch)
treefdb86f846a6e5bc2421527b109456ca81749cec7 /forms/source/component/Filter.cxx
parent87784da170cc31da2f4cf3fbf474295361afef76 (diff)
dba34d: #i116215# de-select all items when the to-be-selected string is invalid or empty
Diffstat (limited to 'forms/source/component/Filter.cxx')
-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 f9f17524756f..a5159679c9de 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 );