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 /sw | |
parent | e4ff699291ddab16d70aa9b11c717e34dfbe5414 (diff) |
remove [Byte]String::EraseAllChars
Diffstat (limited to 'sw')
32 files changed, 92 insertions, 64 deletions
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 281250494a4e..2c11ea3b74ba 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -31,6 +31,7 @@ #include <hintids.hxx> +#include <comphelper/string.hxx> #include <svl/itemiter.hxx> #include <editeng/lrspitem.hxx> #include <editeng/adjitem.hxx> @@ -2108,7 +2109,7 @@ sal_Bool SwCrsrShell::SelectNxtPrvHyperlink( sal_Bool bNext ) String sTxt( pTxtNd->GetExpandTxt( *rAttr.GetStart(), *rAttr.GetEnd() - *rAttr.GetStart() ) ); - sTxt.EraseAllChars( 0x0a ); + sTxt = comphelper::string::remove(sTxt, 0x0a); sTxt.EraseLeadingChars().EraseTrailingChars(); if( sTxt.Len() ) diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 9a86bac7ea84..8f772ef6a8b9 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -32,6 +32,8 @@ #include <com/sun/star/util/SearchOptions.hpp> #include <com/sun/star/util/SearchFlags.hpp> +#include <comphelper/string.hxx> + #include <vcl/svapp.hxx> #include <vcl/window.hxx> @@ -671,8 +673,8 @@ String *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam ) String aStr( pPam->GetTxt() ); String aSearchStr( rSearchOpt.searchString ); String aReplaceStr( rSearchOpt.replaceString ); - aStr.EraseAllChars( CH_TXTATR_BREAKWORD ); - aStr.EraseAllChars( CH_TXTATR_INWORD ); + aStr = comphelper::string::remove(aStr, CH_TXTATR_BREAKWORD); + aStr = comphelper::string::remove(aStr, CH_TXTATR_INWORD); xub_StrLen nStart = 0; String sX( 'x' ); if( pPam->Start()->nContent > 0 ) diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx index 3e9bc8d68ef1..063aeb6ef103 100644 --- a/sw/source/core/doc/acmplwrd.cxx +++ b/sw/source/core/doc/acmplwrd.cxx @@ -30,6 +30,7 @@ #include "precompiled_sw.hxx" +#include <comphelper/string.hxx> #include <tools/urlobj.hxx> #include <hintids.hxx> #include <hints.hxx> @@ -266,8 +267,8 @@ sal_Bool SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc ) } String aNewWord(rWord); - aNewWord.EraseAllChars( CH_TXTATR_INWORD ); - aNewWord.EraseAllChars( CH_TXTATR_BREAKWORD ); + aNewWord = comphelper::string::remove(aNewWord, CH_TXTATR_INWORD); + aNewWord = comphelper::string::remove(aNewWord, CH_TXTATR_BREAKWORD); pImpl->AddDocument(rDoc); sal_Bool bRet = sal_False; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index d4929bb853a8..0d1454e0089e 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <tools/urlobj.hxx> #include <tools/poly.hxx> #include <tools/multisel.hxx> @@ -1214,7 +1215,7 @@ static void lcl_FormatPostIt( aStr = pField->GetPar2(); #if defined( WNT ) // Throw out all CR in Windows - aStr.EraseAllChars( '\r' ); + aStr = comphelper::string::remove(aStr, '\r'); #endif pIDCO->InsertString( aPam, aStr ); } diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 85fd54e75272..1cf820539fa5 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -34,6 +34,7 @@ #include <vcl/cmdevt.hxx> #include <unotools/charclass.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <unotools/transliterationwrapper.hxx> #include <swwait.hxx> #include <fmtsrnd.hxx> @@ -789,7 +790,7 @@ sal_uInt16 SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr ) String sTxt( pTxtNd->GetExpandTxt( *rAttr.GetStart(), *rAttr.GetEnd() - *rAttr.GetStart() ) ); - sTxt.EraseAllChars( 0x0a ); + sTxt = comphelper::string::remove(sTxt, 0x0a); sTxt.EraseLeadingChars().EraseTrailingChars(); if( sTxt.Len() ) diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index 1c8baddcb83b..9b8518812c7b 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/linguistic2/XProofreader.hpp> #include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <com/sun/star/text/XFlatParagraph.hpp> +#include <comphelper/string.hxx> #include <unoflatpara.hxx> @@ -1012,7 +1013,8 @@ uno::Reference< XSpellAlternatives > { String aText( pNode->GetTxt().Copy( nBegin, nLen ) ); String aWord( aText ); - aWord.EraseAllChars( CH_TXTATR_BREAKWORD ).EraseAllChars( CH_TXTATR_INWORD ); + aWord = comphelper::string::remove(aWord, CH_TXTATR_BREAKWORD); + aWord = comphelper::string::remove(aWord, CH_TXTATR_INWORD); uno::Reference< XSpellChecker1 > xSpell( ::GetSpellChecker() ); if( xSpell.is() ) diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index d36b697fa793..bcf4e3e7f685 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -29,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - +#include <comphelper/string.hxx> #include <sfx2/linkmgr.hxx> #include <doc.hxx> #include <editsh.hxx> @@ -402,9 +402,8 @@ SwDDEField::~SwDDEField() String SwDDEField::Expand() const { xub_StrLen nPos; - String aStr( ((SwDDEFieldType*)GetTyp())->GetExpansion() ); + String aStr(comphelper::string::remove(((SwDDEFieldType*)GetTyp())->GetExpansion(), '\r')); - aStr.EraseAllChars( '\r' ); while( (nPos = aStr.Search( '\t' )) != STRING_NOTFOUND ) aStr.SetChar( nPos, ' ' ); while( (nPos = aStr.Search( '\n' )) != STRING_NOTFOUND ) diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index e520cdbda4f2..1b86c10a1db2 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -29,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - +#include <comphelper/string.hxx> #include <frmfmt.hxx> #include <doc.hxx> #include <index.hxx> @@ -124,8 +124,7 @@ void SwDDETable::ChangeContent() // zugriff auf den DDEFldType SwDDEFieldType* pDDEType = (SwDDEFieldType*)aDepend.GetRegisteredIn(); - String aExpand = pDDEType->GetExpansion(); - aExpand.EraseAllChars( '\r' ); + String aExpand = comphelper::string::remove(pDDEType->GetExpansion(), '\r'); for( sal_uInt16 n = 0; n < aLines.Count(); ++n ) { diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 3b5284965234..79cc783b5bcd 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -35,6 +35,7 @@ #include <unotools/localedatawrapper.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <editeng/unolingu.hxx> #include <doc.hxx> #include <pam.hxx> @@ -377,7 +378,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) // alle Sonderzeichen entfernen (durch Blanks ersetzen): if( sTxt.Len() ) { - sTxt.EraseAllChars( 0xad ); + sTxt = comphelper::string::remove(sTxt, 0xad); for( sal_Unicode* p = sTxt.GetBufferAccess(); *p; ++p ) { if( *p < 0x20 ) diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index ed7d495a06ec..57102e8f675e 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <comphelper/string.hxx> #include <tools/resid.hxx> #include <hintids.hxx> #include <swtypes.hxx> @@ -707,8 +708,7 @@ String SwFormToken::GetString() const if( sText.Len() ) { sRet += TOX_STYLE_DELIMITER; - String sTmp( sText ); - sTmp.EraseAllChars( TOX_STYLE_DELIMITER ); + String sTmp(comphelper::string::remove(sText, TOX_STYLE_DELIMITER)); sRet += sTmp; sRet += TOX_STYLE_DELIMITER; } diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index 9142689b1c87..35d5ea18f65d 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -30,6 +30,7 @@ #include "precompiled_sw.hxx" #include <hintids.hxx> #include <tools/stream.hxx> +#include <comphelper/string.hxx> #ifndef _SVSTDARR_HXX #define _SVSTDARR_USHORTS #include <svl/svstdarr.hxx> @@ -197,7 +198,7 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) { String aOutStr( aStr.Copy( nStrPos, nNextAttr - nStrPos ) ); if ( !bExportSoftHyphens ) - aOutStr.EraseAllChars( CHAR_SOFTHYPHEN ); + aOutStr = comphelper::string::remove(aOutStr, CHAR_SOFTHYPHEN); rWrt.Strm().WriteUnicodeOrByteText( aOutStr ); } diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx index b07e98f6d343..0830c1f8fd0f 100644 --- a/sw/source/filter/html/htmlfly.cxx +++ b/sw/source/filter/html/htmlfly.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/text/RelOrientation.hpp> +#include <comphelper/string.hxx> #include <svx/svxids.hrc> #include "hintids.hxx" #include <tools/string.hxx> @@ -1803,8 +1804,9 @@ void SwHTMLWriter::AddLinkTarget( const String& rURL ) String aURL( rURL.Copy( 1 ) ); - String sCmp( aURL.Copy( bEncoded ? nPos+2 : nPos ) ); // nPos-1+1/3 (-1 wg. Erase) - sCmp.EraseAllChars(); + // nPos-1+1/3 (-1 wg. Erase) + String sCmp(comphelper::string::remove(aURL.Copy(bEncoded ? nPos+2 : nPos), + ' ')); if( !sCmp.Len() ) return; diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 7fc91799d7a5..7f234e8fd577 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -31,6 +31,7 @@ #include <hintids.hxx> +#include <comphelper/string.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> @@ -1696,8 +1697,8 @@ void SwHTMLParser::InsertInput() // geloescht werden. if( !bKeepCRLFInValue ) { - sText.EraseAllChars( _CR ); - sText.EraseAllChars( _LF ); + sText = comphelper::string::remove(sText, _CR); + sText = comphelper::string::remove(sText, _LF); } const uno::Reference< XMultiServiceFactory > & rServiceFactory = diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 59759eced76b..7e6c1ff109fe 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -30,6 +30,7 @@ #include "precompiled_sw.hxx" #include "hintids.hxx" +#include <comphelper/string.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <svx/svxids.hrc> @@ -1134,8 +1135,7 @@ ANCHOR_SETEVENT: xub_StrLen nPos = sDecoded.SearchBackward( cMarkSeperator ); if( STRING_NOTFOUND != nPos ) { - String sCmp( sDecoded.Copy( nPos+1 ) ); - sCmp.EraseAllChars(); + String sCmp(comphelper::string::remove(sDecoded.Copy(nPos+1), ' ')); if( sCmp.Len() ) { sCmp.ToLowerAscii(); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 29a4da1f0c32..f22418d27bc1 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -29,10 +29,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/i18n/ScriptType.hpp> +#include <comphelper/string.hxx> #include <sfx2/sfx.hrc> #include <svx/svxids.hrc> #if OSL_DEBUG_LEVEL > 1 @@ -394,14 +394,19 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn, if( sJmpMark.Len() ) { eJumpTo = JUMPTO_MARK; - String sCmp; xub_StrLen nLastPos, nPos = 0; while( STRING_NOTFOUND != ( nLastPos = sJmpMark.Search( cMarkSeperator, nPos + 1 )) ) nPos = nLastPos; - if( nPos && ( sCmp = sJmpMark.Copy( nPos + 1 ) ). - EraseAllChars().Len() ) + String sCmp; + if (nPos) + { + sCmp = comphelper::string::remove( + sJmpMark.Copy(nPos + 1), ' '); + } + + if( sCmp.Len() ) { sCmp.ToLowerAscii(); if( sCmp.EqualsAscii( pMarkToRegion ) ) @@ -5346,8 +5351,8 @@ void SwHTMLParser::ParseMoreMetaOptions() aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_script_type ) ) return; - aContent.EraseAllChars( _CR ); - aContent.EraseAllChars( _LF ); + aContent = comphelper::string::remove(aContent, _CR); + aContent = comphelper::string::remove(aContent, _LF); if( aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_sdendnote ) ) { diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index d4d9f4e84d57..cfb651ac4507 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -32,6 +32,7 @@ #include <stdlib.h> #include <hintids.hxx> +#include <comphelper/string.hxx> #include <svl/urihelper.hxx> #include <rtl/tencinfo.h> #include <vcl/wrkwin.hxx> @@ -1092,8 +1093,7 @@ void SwHTMLWriter::OutHyperlinkHRefValue( const String& rURL ) xub_StrLen nPos = sURL.SearchBackward( cMarkSeperator ); if( STRING_NOTFOUND != nPos ) { - String sCmp( sURL.Copy( nPos+1 ) ); - sCmp.EraseAllChars(); + String sCmp(comphelper::string::remove(sURL.Copy(nPos+1), ' ')); if( sCmp.Len() ) { sCmp.ToLowerAscii(); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index e7088a4da9d5..43d7c0a3189d 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -41,6 +41,7 @@ #endif #include <hintids.hxx> +#include <comphelper/string.hxx> #include <tools/urlobj.hxx> #include <editeng/boxitem.hxx> #include <editeng/cmapitem.hxx> @@ -783,10 +784,9 @@ bool AttributeOutputBase::AnalyzeURL( const String& rUrl, const String& /*rTarge xub_StrLen nPos = sMark.SearchBackward( cMarkSeperator ); - String sRefType( sMark.Copy( nPos+1 ) ); - sRefType.EraseAllChars(); + String sRefType(comphelper::string::remove(sMark.Copy(nPos+1), ' ')); - // i21465 Only interested in outline references + // #i21465# Only interested in outline references if ( sRefType.EqualsAscii( pMarkToOutline ) ) { String sLink = sMark.Copy(0, nPos); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index f9286353d9cc..6c0b88d5fb8f 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -93,6 +93,7 @@ #include <fmtfsize.hxx> #include <comphelper/extract.hxx> #include <comphelper/stlunosequence.hxx> +#include <comphelper/string.hxx> #include <writerfilter/doctok/sprmids.hxx> #include "writerhelper.hxx" @@ -2730,8 +2731,7 @@ void MSWordExportBase::AddLinkTarget(const String& rURL) if( nPos < 2 ) return; - String sCmp( aURL.Copy( nPos+1 ) ); - sCmp.EraseAllChars(); + String sCmp(comphelper::string::remove(aURL.Copy(nPos+1), ' ')); if( !sCmp.Len() ) return; diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index c049b7be0f13..236ff87dc271 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <comphelper/string.hxx> #include <svl/urihelper.hxx> #include <hintids.hxx> #include <osl/endian.h> @@ -966,9 +967,9 @@ OutlinerParaObject* SwWW8ImplReader::ImportAsOutliner(String &rString, WW8_CP nS long nDummy(0); lcl_StripFields(rString, nDummy); //Strip out word's special characters for the simple string - rString.EraseAllChars(0x1); - rString.EraseAllChars(0x5); - rString.EraseAllChars(0x8); + rString = comphelper::string::remove(rString, 0x1); + rString = comphelper::string::remove(rString, 0x5); + rString = comphelper::string::remove(rString, 0x8); rString.SearchAndReplaceAllAscii("\007\007", String::CreateFromAscii("\007\012")); rString.SearchAndReplaceAll(0x7, ' '); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 9c87f1a5268d..6287d8ce3bd4 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -36,6 +36,7 @@ #include <tools/solar.h> #include <comphelper/storagehelper.hxx> +#include <comphelper/string.hxx> #include <sot/storinfo.hxx> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/embed/ElementModes.hpp> @@ -1112,7 +1113,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) // Thus, delete character 0x01, which stands for such a graphic. if (aF.nId==51) //#i56768# only do it for the MACROBUTTON field, since DropListFields need the 0x01. { - aStr.EraseAllChars( 0x01 ); + aStr = comphelper::string::remove(aStr, 0x01); } eF_ResT eRes = (this->*aWW8FieldTab[aF.nId])( &aF, aStr ); @@ -1620,7 +1621,8 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, String& rStr ) break; } } - aDocProperty.EraseAllChars('"'); + + aDocProperty = comphelper::string::remove(aDocProperty, '"'); /* There are up to 26 fields that may be meant by 'DocumentProperty'. diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 8b32b9906372..1d0d189336bb 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -48,6 +48,7 @@ #endif // dump #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <unotools/localedatawrapper.hxx> #include <i18npool/lang.h> #include <editeng/unolingu.hxx> @@ -6249,7 +6250,7 @@ void lcl_checkFontname( String& sString ) // if anything was found, remove \u0001 + leading/trailing ';' if( bFound ) { - sString.EraseAllChars( sal_Unicode( 1 ) ); + sString = comphelper::string::remove(sString, 1); sString.EraseLeadingAndTrailingChars( sal_Unicode( ';' ) ); } } diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx index c08bfb5bf6df..0fb63d5afeb3 100644 --- a/sw/source/ui/app/appenv.cxx +++ b/sw/source/ui/app/appenv.cxx @@ -33,6 +33,7 @@ #include <hintids.hxx> +#include <comphelper/string.hxx> #include <sfx2/request.hxx> #include <svx/svxids.hrc> @@ -88,9 +89,7 @@ String InsertLabEnvText( SwWrtShell& rSh, SwFldMgr& rFldMgr, const String& rText ) { String sRet; - String aText(rText); - aText.EraseAllChars( '\r' ); - + String aText(comphelper::string::remove(rText, '\r')); sal_uInt16 nTokenPos = 0; while( STRING_NOTFOUND != nTokenPos ) diff --git a/sw/source/ui/cctrl/actctrl.cxx b/sw/source/ui/cctrl/actctrl.cxx index 105691be41ce..fc6fbb347764 100644 --- a/sw/source/ui/cctrl/actctrl.cxx +++ b/sw/source/ui/cctrl/actctrl.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <comphelper/string.hxx> #include "actctrl.hxx" void NumEditAction::Action() @@ -88,7 +89,7 @@ void NoSpaceEdit::Modify() String sTemp = GetText(); for(sal_uInt16 i = 0; i < sForbiddenChars.Len(); i++) { - sTemp.EraseAllChars( sForbiddenChars.GetChar(i) ); + sTemp = comphelper::string::remove(sTemp, sForbiddenChars.GetChar(i)); } sal_uInt16 nDiff = GetText().Len() - sTemp.Len(); if(nDiff) diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 8dbd080f39c7..bcd1bbf2a4da 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdb/XColumn.hpp> +#include <comphelper/string.hxx> #include <vector> #include <boost/scoped_ptr.hpp> @@ -532,7 +533,7 @@ void SwRestrictedComboBox::Modify() String sTemp = GetText(); for(sal_uInt16 i = 0; i < sForbiddenChars.Len(); i++) { - sTemp.EraseAllChars( sForbiddenChars.GetChar(i) ); + sTemp = comphelper::string::remove(sTemp, sForbiddenChars.GetChar(i)); } sal_uInt16 nDiff = GetText().Len() - sTemp.Len(); if(nDiff) diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx index f4900be44a48..a49674d3936c 100644 --- a/sw/source/ui/docvw/edtwin2.cxx +++ b/sw/source/ui/docvw/edtwin2.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <comphelper/string.hxx> #include <tools/ref.hxx> #include <hintids.hxx> @@ -209,7 +210,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) if( sTxt.Len() ) { - sTxt.EraseAllChars( 0xad ); + sTxt = comphelper::string::remove(sTxt, 0xad); for( sal_Unicode* p = sTxt.GetBufferAccess(); *p; ++p ) { if( *p < 0x20 ) diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx index ed1b04bc45da..50f730a3a4d9 100644 --- a/sw/source/ui/fldui/inpdlg.cxx +++ b/sw/source/ui/fldui/inpdlg.cxx @@ -33,6 +33,7 @@ #undef SW_DLLIMPLEMENTATION #endif +#include <comphelper/string.hxx> #include <vcl/msgbox.hxx> #include <unotools/charclass.hxx> #include <editeng/unolingu.hxx> @@ -156,8 +157,7 @@ void SwFldInputDlg::StateChanged( StateChangedType nType ) void SwFldInputDlg::Apply() { - String aTmp( aEditED.GetText() ); - aTmp.EraseAllChars( '\r' ); + String aTmp(comphelper::string::remove(aEditED.GetText(), '\r')); rSh.StartAllAction(); sal_Bool bModified = sal_False; diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 4bbcda92318c..45e11c4af476 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -34,6 +34,7 @@ #endif +#include <comphelper/string.hxx> #include <sfx2/request.hxx> #include <svl/stritem.hxx> #include <vcl/msgbox.hxx> @@ -63,7 +64,7 @@ IMPL_LINK( SwInsertBookmarkDlg, ModifyHdl, BookmarkCombo *, pBox ) for(sal_uInt16 i = 0; i < BookmarkCombo::aForbiddenChars.Len(); i++) { sal_uInt16 nTmpLen = sTmp.Len(); - sTmp.EraseAllChars(BookmarkCombo::aForbiddenChars.GetChar(i)); + sTmp = comphelper::string::remove(sTmp, BookmarkCombo::aForbiddenChars.GetChar(i)); if(sTmp.Len() != nTmpLen) sMsg += BookmarkCombo::aForbiddenChars.GetChar(i); } @@ -125,8 +126,8 @@ void SwInsertBookmarkDlg::Apply() if ( nLen && (aBookmarkBox.GetEntryPos(aTmpEntry) == COMBOBOX_ENTRY_NOTFOUND) ) { - String sEntry(aBookmarkBox.GetText()); - sEntry.EraseAllChars(aBookmarkBox.GetMultiSelectionSeparator()); + String sEntry(comphelper::string::remove(aBookmarkBox.GetText(), + aBookmarkBox.GetMultiSelectionSeparator())); rSh.SetBookmark( KeyCode(), sEntry, aEmptyStr ); rReq.AppendItem( SfxStringItem( FN_INSERT_BOOKMARK, sEntry ) ); diff --git a/sw/source/ui/ribbar/workctrl.cxx b/sw/source/ui/ribbar/workctrl.cxx index 6cf63fe81ce5..7fc40b06f1ff 100644 --- a/sw/source/ui/ribbar/workctrl.cxx +++ b/sw/source/ui/ribbar/workctrl.cxx @@ -31,6 +31,7 @@ #include <string> +#include <comphelper/string.hxx> #include <svl/eitem.hxx> #include <svx/htmlmode.hxx> #include <sfx2/dispatch.hxx> @@ -685,8 +686,7 @@ void SwZoomBox_Impl::Select() { if ( !IsTravelSelect() ) { - String sEntry(GetText()); - sEntry.EraseAllChars( '%' ); + String sEntry(comphelper::string::remove(GetText(), '%')); sal_uInt16 nZoom = (sal_uInt16)sEntry.ToInt32(); if(nZoom < MINZOOM) nZoom = MINZOOM; diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index 9f8a711c4533..727fceb61242 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -33,7 +33,7 @@ #undef SW_DLLIMPLEMENTATION #endif - +#include <comphelper/string.hxx> #include <vcl/msgbox.hxx> #include "wrtsh.hxx" @@ -176,7 +176,7 @@ IMPL_LINK_INLINE_START( SwInsTableDlg, ModifyName, Edit *, pEdit ) String sTblName = pEdit->GetText(); if(sTblName.Search(' ') != STRING_NOTFOUND) { - sTblName.EraseAllChars( ); + sTblName = comphelper::string::remove(sTblName, ' '); pEdit->SetText(sTblName); } diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 8c04deb68c51..e986f69b7059 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -132,9 +132,10 @@ #include <PostItMgr.hxx> -#include <ndtxt.hxx> //#outline level,added by zhaojianwei +#include <ndtxt.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> @@ -1783,8 +1784,10 @@ sal_Bool SwView::JumpToSwMark( const String& rMark ) IDocumentMarkAccess::const_iterator_t ppMark; IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess(); - if( STRING_NOTFOUND != nPos && - ( sCmp = sMark.Copy( nPos + 1 ) ).EraseAllChars().Len() ) + if( STRING_NOTFOUND != nPos ) + sCmp = comphelper::string::remove(sMark.Copy(nPos + 1), ' '); + + if( sCmp.Len() ) { String sName( sMark.Copy( 0, nPos ) ); sCmp.ToLowerAscii(); diff --git a/sw/source/ui/utlui/swrenamexnameddlg.cxx b/sw/source/ui/utlui/swrenamexnameddlg.cxx index 86c2a00b10f4..143f3ca94789 100644 --- a/sw/source/ui/utlui/swrenamexnameddlg.cxx +++ b/sw/source/ui/utlui/swrenamexnameddlg.cxx @@ -54,6 +54,7 @@ #include <com/sun/star/view/XViewSettingsSupplier.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <sfx2/dispatch.hxx> #include <svl/stritem.hxx> #include <shellio.hxx> @@ -120,7 +121,7 @@ IMPL_LINK(SwRenameXNamedDlg, ModifyHdl, NoSpaceEdit*, pEdit) for(sal_uInt16 i = 0; i < pEdit->GetForbiddenChars().Len(); i++) { sal_uInt16 nTmpLen = sTmp.Len(); - sTmp.EraseAllChars(pEdit->GetForbiddenChars().GetChar(i)); + sTmp = comphelper::string::remove(sTmp, pEdit->GetForbiddenChars().GetChar(i)); if(sTmp.Len() != nTmpLen) sMsg += pEdit->GetForbiddenChars().GetChar(i); } diff --git a/sw/source/ui/vba/vbafield.cxx b/sw/source/ui/vba/vbafield.cxx index 27a682ebe762..d83f5705b926 100644 --- a/sw/source/ui/vba/vbafield.cxx +++ b/sw/source/ui/vba/vbafield.cxx @@ -31,10 +31,11 @@ #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/text/XTextFieldsSupplier.hpp> -#include <ooo/vba/word/WdFieldType.hpp> #include <com/sun/star/text/FilenameDisplayFormat.hpp> #include <com/sun/star/util/XRefreshable.hpp> #include <com/sun/star/util/XUpdatable.hpp> +#include <comphelper/string.hxx> +#include <ooo/vba/word/WdFieldType.hpp> #include <swtypes.hxx> using namespace ::ooo::vba; @@ -491,7 +492,7 @@ uno::Reference< text::XTextField > SwVbaFields::Create_Field_DocProperty( const break; } } - aDocProperty.EraseAllChars('"'); + aDocProperty = comphelper::string::remove(aDocProperty, '"'); OSL_TRACE("SwVbaFields::Create_Field_DocProperty, the document property name is %s ",rtl::OUStringToOString( aDocProperty, RTL_TEXTENCODING_UTF8 ).getStr() ); if( aDocProperty.Len() == 0 ) { |