summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-01-02 10:55:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-01-05 09:18:19 +0000
commitbacfd2dc4cea1a5d87658ed8592116acd931e000 (patch)
treed22172a33fdd13a440b6882a28c23ea2d639bbad /vcl
parent6281eb0e0792da0194c07da18296e94dd944b8e5 (diff)
add a comphelper::string::getTokenCount
suitable for conversion from [Byte]String::GetTokenCount converted low-hanging variants to rtl::O[UString]::getToken loops added unit test
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/ilstbox.hxx4
-rw-r--r--vcl/source/control/combobox.cxx2
-rw-r--r--vcl/source/control/ilstbox.cxx11
3 files changed, 9 insertions, 8 deletions
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index c27a9d49c742..c1355f033940 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -506,8 +506,8 @@ public:
sal_Bool IsSelectionChanged() const { return maLBWindow.IsSelectionChanged(); }
sal_uInt16 GetSelectModifier() const { return maLBWindow.GetSelectModifier(); }
- void SetMRUEntries( const XubString& rEntries, xub_Unicode cSep );
- XubString GetMRUEntries( xub_Unicode cSep ) const;
+ void SetMRUEntries( const rtl::OUString& rEntries, sal_Unicode cSep );
+ rtl::OUString GetMRUEntries( sal_Unicode cSep ) const;
void SetMaxMRUCount( sal_uInt16 n ) { maLBWindow.GetEntryList()->SetMaxMRUCount( n ); }
sal_uInt16 GetMaxMRUCount() const { return maLBWindow.GetEntryList()->GetMaxMRUCount(); }
sal_uInt16 GetDisplayLineCount() const
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 1333c1aaa45d..584e493bad84 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -54,7 +54,7 @@ inline sal_uLong ImplCreateKey( sal_uInt16 nPos )
static void lcl_GetSelectedEntries( Table& rSelectedPos, const XubString& rText, xub_Unicode cTokenSep, const ImplEntryList* pEntryList )
{
- for( xub_StrLen n = rText.GetTokenCount( cTokenSep ); n; )
+ for (xub_StrLen n = comphelper::string::getTokenCount(rText, cTokenSep); n;)
{
XubString aToken = rText.GetToken( --n, cTokenSep );
aToken = comphelper::string::strip(aToken, ' ');
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index b5396e2ff5b2..ec00069aeb3c 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -2703,7 +2703,7 @@ sal_Bool ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt )
// -----------------------------------------------------------------------
-void ImplListBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep )
+void ImplListBox::SetMRUEntries( const rtl::OUString& rEntries, xub_Unicode cSep )
{
sal_Bool bChanges = GetEntryList()->GetMRUCount() ? sal_True : sal_False;
@@ -2712,10 +2712,10 @@ void ImplListBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep )
maLBWindow.RemoveEntry( --n );
sal_uInt16 nMRUCount = 0;
- sal_uInt16 nEntries = rEntries.GetTokenCount( cSep );
- for ( sal_uInt16 nEntry = 0; nEntry < nEntries; nEntry++ )
+ sal_Int32 nIndex = 0;
+ do
{
- XubString aEntry = rEntries.GetToken( nEntry, cSep );
+ XubString aEntry = rEntries.getToken( 0, cSep, nIndex );
// Accept only existing entries
if ( GetEntryList()->FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND )
{
@@ -2724,6 +2724,7 @@ void ImplListBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep )
bChanges = sal_True;
}
}
+ while ( nIndex >= 0 );
if ( bChanges )
{
@@ -2735,7 +2736,7 @@ void ImplListBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep )
// -----------------------------------------------------------------------
-XubString ImplListBox::GetMRUEntries( xub_Unicode cSep ) const
+rtl::OUString ImplListBox::GetMRUEntries( sal_Unicode cSep ) const
{
String aEntries;
for ( sal_uInt16 n = 0; n < GetEntryList()->GetMRUCount(); n++ )