diff options
author | Noel Grandin <noel@peralex.com> | 2013-07-24 15:39:49 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-07-25 08:13:50 +0200 |
commit | d7cd7e89e36fc371b6a81d9065b3fa0b65eb822f (patch) | |
tree | dd3a9b919d89a8eeb5c18033b0cbe0c8ad6249ed /vcl | |
parent | d5af396843816b244b47c746d42f3a99afa1af01 (diff) |
convert vcl/ilistbox from XubString to OUString
Change-Id: Icfaea26c7bb82f449fc796dea80d12ffdf640a14
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/ilstbox.hxx | 4 | ||||
-rw-r--r-- | vcl/source/control/ilstbox.cxx | 22 |
2 files changed, 17 insertions, 9 deletions
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx index 89e2db0325fe..06f8d625e087 100644 --- a/vcl/inc/ilstbox.hxx +++ b/vcl/inc/ilstbox.hxx @@ -129,8 +129,8 @@ public: ImplEntryType* GetMutableEntryPtr( sal_uInt16 nPos ) const { return GetEntry( nPos ); } void Clear(); - sal_uInt16 FindMatchingEntry( const XubString& rStr, sal_uInt16 nStart = 0, sal_Bool bForward = sal_True, sal_Bool bLazy = sal_True ) const; - sal_uInt16 FindEntry( const XubString& rStr, sal_Bool bSearchMRUArea = sal_False ) const; + sal_uInt16 FindMatchingEntry( const OUString& rStr, sal_uInt16 nStart = 0, sal_Bool bForward = sal_True, sal_Bool bLazy = sal_True ) const; + sal_uInt16 FindEntry( const OUString& rStr, sal_Bool bSearchMRUArea = sal_False ) const; sal_uInt16 FindEntry( const void* pData ) const; /// helper: add up heights up to index nEndIndex. diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index ac7631950081..f406d285b16c 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -175,7 +175,7 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry { const comphelper::string::NaturalStringSorter &rSorter = theSorter::get(); - const XubString& rStr = pNewEntry->maStr; + const OUString& rStr = pNewEntry->maStr; sal_uLong nLow, nHigh, nMid; nHigh = maEntries.size(); @@ -268,7 +268,7 @@ void ImplEntryList::RemoveEntry( sal_uInt16 nPos ) // ----------------------------------------------------------------------- -sal_uInt16 ImplEntryList::FindEntry( const XubString& rString, sal_Bool bSearchMRUArea ) const +sal_uInt16 ImplEntryList::FindEntry( const OUString& rString, sal_Bool bSearchMRUArea ) const { sal_uInt16 nEntries = maEntries.size(); for ( sal_uInt16 n = bSearchMRUArea ? 0 : GetMRUCount(); n < nEntries; n++ ) @@ -282,7 +282,7 @@ sal_uInt16 ImplEntryList::FindEntry( const XubString& rString, sal_Bool bSearchM // ----------------------------------------------------------------------- -sal_uInt16 ImplEntryList::FindMatchingEntry( const XubString& rStr, sal_uInt16 nStart, sal_Bool bForward, sal_Bool bLazy ) const +sal_uInt16 ImplEntryList::FindMatchingEntry( const OUString& rStr, sal_uInt16 nStart, sal_Bool bForward, sal_Bool bLazy ) const { sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND; sal_uInt16 nEntryCount = GetEntryCount(); @@ -296,7 +296,15 @@ sal_uInt16 ImplEntryList::FindMatchingEntry( const XubString& rStr, sal_uInt16 n n--; ImplEntryType* pImplEntry = GetEntry( n ); - bool bMatch = bLazy ? rI18nHelper.MatchString( rStr, pImplEntry->maStr ) != 0 : ( rStr.Match( pImplEntry->maStr ) == STRING_MATCH ); + bool bMatch; + if ( bLazy ) + { + bMatch = rI18nHelper.MatchString( rStr, pImplEntry->maStr ) != 0; + } + else + { + bMatch = rStr.isEmpty() || (rStr == pImplEntry->maStr ); + } if ( bMatch ) { nPos = n; @@ -1878,8 +1886,8 @@ void ImplListBoxWindow::DrawEntry( sal_uInt16 nPos, sal_Bool bDrawImage, sal_Boo { MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; OUString* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; - XubString aStr( mpEntryList->GetEntryText( nPos ) ); - if ( aStr.Len() ) + OUString aStr( mpEntryList->GetEntryText( nPos ) ); + if ( !aStr.isEmpty() ) { long nMaxWidth = std::max( static_cast< long >( mnMaxWidth ), GetOutputSizePixel().Width() - 2*mnBorder ); @@ -2687,7 +2695,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep ) sal_Int32 nIndex = 0; do { - XubString aEntry = rEntries.getToken( 0, cSep, nIndex ); + OUString aEntry = rEntries.getToken( 0, cSep, nIndex ); // Accept only existing entries if ( GetEntryList()->FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND ) { |