From ca02d728082a86780d68ede7b9d565128dbc0434 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 18 Nov 2011 21:03:31 +0000 Subject: remove [Byte]String::EraseAllChars --- basic/source/app/app.cxx | 7 ++++--- basic/source/app/status.cxx | 3 ++- basic/source/runtime/methods.cxx | 23 +++++++++++++++++++---- 3 files changed, 25 insertions(+), 8 deletions(-) (limited to 'basic') diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx index 9eb83c8b503d..72f3ab0cd5e3 100644 --- a/basic/source/app/app.cxx +++ b/basic/source/app/app.cxx @@ -1028,11 +1028,13 @@ sal_Bool BasicFrame::CompileAll() } // Setup menu -#define MENU2FILENAME( Name ) Name.Copy( Name.SearchAscii(" ") +1).EraseAllChars( '~' ) +#define MENU2FILENAME( Name ) comphelper::string::remove(Name.Copy(Name.SearchAscii(" ")+1), '~') + #define LRUNr( nNr ) \ rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("LRU")) \ .append(static_cast(nNr)) \ .makeStringAndClear() + String FILENAME2MENU( sal_uInt16 nNr, String aName ) { String aRet; @@ -1536,8 +1538,7 @@ long BasicFrame::Command( short nID, sal_Bool bChecked ) { MenuBar* pMenu = GetMenuBar(); PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); - String aName = pWinMenu->GetItemText( nID ); - aName.EraseAllChars( L'~' ); + rtl::OUString aName = comphelper::string::remove(pWinMenu->GetItemText(nID), '~'); AppWin* pWin = FindWin( aName ); if ( pWin ) pWin->ToTop(); diff --git a/basic/source/app/status.cxx b/basic/source/app/status.cxx index b50aeee5b117..7cfde2d51fcb 100644 --- a/basic/source/app/status.cxx +++ b/basic/source/app/status.cxx @@ -34,6 +34,7 @@ #include "appwin.hxx" #include "status.hxx" +#include #include StatusLine::StatusLine( BasicFrame* p ) @@ -82,7 +83,7 @@ IMPL_LINK( StatusLine, ActivateTask, TaskToolBox*, pTTB ) nFirstWinPos += pTTB->GetItemPos( pTTB->GetCurItemId() ) / 2; - AppWin* pWin = pFrame->FindWin( pWinMenu->GetItemText( pWinMenu->GetItemId( nFirstWinPos ) ).EraseAllChars( L'~' ) ); + AppWin* pWin = pFrame->FindWin(comphelper::string::remove(pWinMenu->GetItemText(pWinMenu->GetItemId(nFirstWinPos)), '~')); if ( pWin ) { pWin->Minimize( sal_False ); diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 2123d940fd34..c67638839588 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #include "runtime.hxx" #include "sbunoobj.hxx" @@ -81,6 +82,8 @@ using namespace com::sun::star::io; using namespace com::sun::star::script; using namespace com::sun::star::frame; +#include + #include "stdobj.hxx" #include #include "rtlproto.hxx" @@ -124,10 +127,22 @@ Reference< XModel > getDocumentModel( StarBASIC* ); static void FilterWhiteSpace( String& rStr ) { - rStr.EraseAllChars( ' ' ); - rStr.EraseAllChars( '\t' ); - rStr.EraseAllChars( '\n' ); - rStr.EraseAllChars( '\r' ); + if (!rStr.Len()) + return; + + rtl::OUStringBuffer aRet(rStr); + + for (xub_StrLen i = 0; i < rStr.Len(); ++i) + { + sal_Unicode cChar = rStr.GetChar(i); + if ((cChar != ' ') && (cChar != '\t') && + (cChar != '\n') && (cChar != '\r')) + { + aRet.append(cChar); + } + } + + rStr = aRet.makeStringAndClear(); } static long GetDayDiff( const Date& rDate ) -- cgit