Kaydet (Commit) d7cd7e89 authored tarafından Noel Grandin's avatar Noel Grandin

convert vcl/ilistbox from XubString to OUString

Change-Id: Icfaea26c7bb82f449fc796dea80d12ffdf640a14
üst d5af3968
...@@ -129,8 +129,8 @@ public: ...@@ -129,8 +129,8 @@ public:
ImplEntryType* GetMutableEntryPtr( sal_uInt16 nPos ) const { return GetEntry( nPos ); } ImplEntryType* GetMutableEntryPtr( sal_uInt16 nPos ) const { return GetEntry( nPos ); }
void Clear(); 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 FindMatchingEntry( const OUString& 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 FindEntry( const OUString& rStr, sal_Bool bSearchMRUArea = sal_False ) const;
sal_uInt16 FindEntry( const void* pData ) const; sal_uInt16 FindEntry( const void* pData ) const;
/// helper: add up heights up to index nEndIndex. /// helper: add up heights up to index nEndIndex.
......
...@@ -175,7 +175,7 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry ...@@ -175,7 +175,7 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry
{ {
const comphelper::string::NaturalStringSorter &rSorter = theSorter::get(); const comphelper::string::NaturalStringSorter &rSorter = theSorter::get();
const XubString& rStr = pNewEntry->maStr; const OUString& rStr = pNewEntry->maStr;
sal_uLong nLow, nHigh, nMid; sal_uLong nLow, nHigh, nMid;
nHigh = maEntries.size(); nHigh = maEntries.size();
...@@ -268,7 +268,7 @@ void ImplEntryList::RemoveEntry( sal_uInt16 nPos ) ...@@ -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(); sal_uInt16 nEntries = maEntries.size();
for ( sal_uInt16 n = bSearchMRUArea ? 0 : GetMRUCount(); n < nEntries; n++ ) for ( sal_uInt16 n = bSearchMRUArea ? 0 : GetMRUCount(); n < nEntries; n++ )
...@@ -282,7 +282,7 @@ sal_uInt16 ImplEntryList::FindEntry( const XubString& rString, sal_Bool bSearchM ...@@ -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 nPos = LISTBOX_ENTRY_NOTFOUND;
sal_uInt16 nEntryCount = GetEntryCount(); sal_uInt16 nEntryCount = GetEntryCount();
...@@ -296,7 +296,15 @@ sal_uInt16 ImplEntryList::FindMatchingEntry( const XubString& rStr, sal_uInt16 n ...@@ -296,7 +296,15 @@ sal_uInt16 ImplEntryList::FindMatchingEntry( const XubString& rStr, sal_uInt16 n
n--; n--;
ImplEntryType* pImplEntry = GetEntry( 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 ) if ( bMatch )
{ {
nPos = n; nPos = n;
...@@ -1878,8 +1886,8 @@ void ImplListBoxWindow::DrawEntry( sal_uInt16 nPos, sal_Bool bDrawImage, sal_Boo ...@@ -1878,8 +1886,8 @@ void ImplListBoxWindow::DrawEntry( sal_uInt16 nPos, sal_Bool bDrawImage, sal_Boo
{ {
MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL;
OUString* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; OUString* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL;
XubString aStr( mpEntryList->GetEntryText( nPos ) ); OUString aStr( mpEntryList->GetEntryText( nPos ) );
if ( aStr.Len() ) if ( !aStr.isEmpty() )
{ {
long nMaxWidth = std::max( static_cast< long >( mnMaxWidth ), long nMaxWidth = std::max( static_cast< long >( mnMaxWidth ),
GetOutputSizePixel().Width() - 2*mnBorder ); GetOutputSizePixel().Width() - 2*mnBorder );
...@@ -2687,7 +2695,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep ) ...@@ -2687,7 +2695,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
sal_Int32 nIndex = 0; sal_Int32 nIndex = 0;
do do
{ {
XubString aEntry = rEntries.getToken( 0, cSep, nIndex ); OUString aEntry = rEntries.getToken( 0, cSep, nIndex );
// Accept only existing entries // Accept only existing entries
if ( GetEntryList()->FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND ) if ( GetEntryList()->FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment