diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-11-18 21:03:31 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-11-19 21:11:02 +0000 |
commit | ca02d728082a86780d68ede7b9d565128dbc0434 (patch) | |
tree | 8c0a857ad73f89d592295f99e5f72a0c96e55e57 /basic | |
parent | e4ff699291ddab16d70aa9b11c717e34dfbe5414 (diff) |
remove [Byte]String::EraseAllChars
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/app/app.cxx | 7 | ||||
-rw-r--r-- | basic/source/app/status.cxx | 3 | ||||
-rw-r--r-- | basic/source/runtime/methods.cxx | 23 |
3 files changed, 25 insertions, 8 deletions
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<sal_Int32>(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 <comphelper/string.hxx> #include <vcl/decoview.hxx> 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 <tools/wldcrd.hxx> #include <i18npool/lang.h> #include <rtl/string.hxx> +#include <rtl/strbuf.hxx> #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 <comphelper/string.hxx> + #include "stdobj.hxx" #include <basic/sbstdobj.hxx> #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 ) |