diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-06-11 13:15:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-06-11 14:46:46 +0100 |
commit | 8f5629fd5aafc85e509a4160a11a285b0a66e7c0 (patch) | |
tree | 143883c85467b5ce9f5c665338e0f8a25067a0cd /sw | |
parent | 2106d8e648449d34b195068eef5f672a14ea64a8 (diff) |
remove EraseLeadingChars and EraseTrailingChars
Change-Id: Ib9797fe97cd008cc6508ce8cec47dc5373416892
Diffstat (limited to 'sw')
30 files changed, 63 insertions, 81 deletions
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 9677a9b0f650..b19c2ccc1b9d 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -39,6 +39,7 @@ #include <editeng/langitem.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <unotools/localedatawrapper.hxx> #include <unotools/charclass.hxx> #include <editeng/unolingu.hxx> @@ -272,8 +273,7 @@ SwCalc::SwCalc( SwDoc& rD ) pLclData = new LocaleDataWrapper( xMSF, aLocale ); } - sCurrSym = pLclData->getCurrSymbol(); - sCurrSym.EraseLeadingChars().EraseTrailingChars(); + sCurrSym = comphelper::string::strip(pLclData->getCurrSymbol(), ' '); sCurrSym = pCharClass->lowercase( sCurrSym ); static sal_Char const diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 3d571ffe7132..ec77f94ead03 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -2107,7 +2107,7 @@ sal_Bool SwCrsrShell::SelectNxtPrvHyperlink( sal_Bool bNext ) *rAttr.GetEnd() - *rAttr.GetStart() ) ); sTxt = comphelper::string::remove(sTxt, 0x0a); - sTxt.EraseLeadingChars().EraseTrailingChars(); + sTxt = comphelper::string::strip(sTxt, ' '); if( sTxt.Len() ) aCmpPos = aPos; diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 4d0aa7235eb8..44b47a7a17fc 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -30,6 +30,7 @@ #include <string.h> #include <float.h> +#include <comphelper/string.hxx> #include <tools/datetime.hxx> #include <svl/svarray.hxx> #include <vcl/svapp.hxx> @@ -1014,8 +1015,7 @@ _HashStr::_HashStr( const String& rName, const String& rText, void LookString( SwHash** ppTbl, sal_uInt16 nSize, const String& rName, String& rRet, sal_uInt16* pPos ) { - rRet = rName; - rRet.EraseLeadingChars().EraseTrailingChars(); + rRet = comphelper::string::strip(rName, ' '); SwHash* pFnd = Find( rRet, ppTbl, nSize, pPos ); if( pFnd ) rRet = ((_HashStr*)pFnd)->aSetStr; diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index b5a4691bdb1f..0c154d910721 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -731,8 +731,7 @@ sal_Bool SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const String& rStr, s if( pCrsr->GetNext() == pCrsr ) { // einfach Selection -> Text ueberpruefen - String sTxt( GetSelTxt() ); - sTxt.EraseTrailingChars(); + String sTxt(comphelper::string::stripEnd(GetSelTxt(), ' ')); if( sTxt == rStr ) bDelTxt = bInsTxt = sal_False; } @@ -787,7 +786,7 @@ sal_uInt16 SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr ) *rAttr.GetEnd() - *rAttr.GetStart() ) ); sTxt = comphelper::string::remove(sTxt, 0x0a); - sTxt.EraseLeadingChars().EraseTrailingChars(); + sTxt = comphelper::string::strip(sTxt, ' '); if( sTxt.Len() ) { diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index ac17fd49d83f..7fd61afdf97b 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -104,6 +104,7 @@ #include <editeng/frmdiritem.hxx> #include <switerator.hxx> #include <comphelper/servicehelper.hxx> +#include <comphelper/string.hxx> using namespace ::com::sun::star; using ::rtl::OUString; @@ -915,8 +916,8 @@ void SwXCell::setFormula(const OUString& rFormula) throw( uno::RuntimeException sal_uInt32 nNdPos = pBox->IsValidNumTxtNd( sal_True ); if(USHRT_MAX == nNdPos) lcl_setString( *this, OUString(), sal_True ); - String sFml(rFormula); - if( sFml.EraseLeadingChars().Len() && '=' == sFml.GetChar( 0 ) ) + String sFml(comphelper::string::stripStart(rFormula, ' ')); + if( sFml.Len() && '=' == sFml.GetChar( 0 ) ) sFml.Erase( 0, 1 ); SwTblBoxFormula aFml( sFml ); SwDoc* pMyDoc = GetDoc(); diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index c440f955bd3c..116fca8c32a1 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -27,6 +27,7 @@ ************************************************************************/ #include "hintids.hxx" +#include <comphelper/string.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <svl/whiter.hxx> @@ -1217,7 +1218,7 @@ void SwHTMLWriter::PrepareFontList( const SvxFontItem& rFontItem, while( nStrPos != STRING_NOTFOUND ) { String aName = rName.GetToken( 0, ';', nStrPos ); - aName.EraseTrailingChars().EraseLeadingChars(); + aName = comphelper::string::strip(aName, ' '); if( !aName.Len() ) continue; diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index c72b588ae5af..389c75718e89 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -28,6 +28,7 @@ #include <hintids.hxx> #include <com/sun/star/i18n/ScriptType.hpp> +#include <comphelper/string.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <sfx2/sfx.hrc> @@ -3005,7 +3006,7 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, sal_Bool bO sRel = aURL.Copy( nPos+1 ); aURL.Erase( nPos ); } - aURL.EraseLeadingChars().EraseTrailingChars(); + aURL = comphelper::string::strip(aURL, ' '); sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_href).append("=\""); rWrt.Strm() << sOut.makeStringAndClear().getStr(); diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 1ee17bb73717..9dc4cefc6954 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -27,6 +27,7 @@ ************************************************************************/ #include <hintids.hxx> +#include <comphelper/string.hxx> #include <rtl/strbuf.hxx> #include <sfx2/sfx.hrc> #include <svl/svstdarr.hxx> @@ -203,7 +204,7 @@ void SwHTMLParser::AddScriptSource() { aBasicLib = aToken.Copy( nPos + sizeof(OOO_STRING_SVTOOLS_HTML_SB_library) - 1 ); - aBasicLib.EraseLeadingChars().EraseTrailingChars(); + aBasicLib = comphelper::string::strip(aBasicLib, ' '); } } @@ -214,7 +215,7 @@ void SwHTMLParser::AddScriptSource() { aBasicModule = aToken.Copy( nPos + sizeof(OOO_STRING_SVTOOLS_HTML_SB_module) - 1 ); - aBasicModule.EraseLeadingChars().EraseTrailingChars(); + aBasicModule = comphelper::string::strip(aBasicModule, ' '); } } diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 88f6df9b9337..a4fe67a21c45 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -27,6 +27,7 @@ ************************************************************************/ #include <com/sun/star/i18n/ScriptType.hpp> +#include <comphelper/string.hxx> #include <tools/string.hxx> #include <svtools/htmlkywd.hxx> #include <svtools/htmlout.hxx> @@ -447,8 +448,7 @@ Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt ) else if (pFldTyp->GetName() != "HTML_OFF") return rWrt; - String rTxt( pFld->GetPar2() ); - rTxt.EraseLeadingChars().EraseTrailingChars(); + String rTxt(comphelper::string::strip(pFld->GetPar2(), ' ')); rWrt.Strm() << '<'; if( !bOn ) rWrt.Strm() << '/'; @@ -485,8 +485,7 @@ Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt ) '>' == rComment.GetChar(rComment.Len()-1) && rComment.Copy(0,5).EqualsIgnoreCaseAscii("HTML:") ) { - String sComment( rComment.Copy(5) ); - sComment.EraseLeadingChars(); + String sComment(comphelper::string::stripStart(rComment.Copy(5), ' ')); if( '<' == sComment.GetChar(0) ) { sComment = convertLineEnd(sComment, GetSystemLineEnd()); diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 2a3dbf29905b..789292e460cd 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -634,7 +634,7 @@ IMAGE_SETEVENT: } // Image-Map setzen - aMap.EraseTrailingChars(); + aMap = comphelper::string::stripEnd(aMap, ' '); if( aMap.Len() ) { // Da wir nur lokale Image-Maps kennen nehmen wireinfach alles diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx index cf2adc6597b1..1bfcb6cd020f 100644 --- a/sw/source/filter/html/parcss1.cxx +++ b/sw/source/filter/html/parcss1.cxx @@ -1261,8 +1261,7 @@ sal_Bool CSS1Expression::GetURL( String& rURL ) const if( aValue.Len() > 5 ) { rURL = aValue.Copy( 4, aValue.Len()-5 ); - rURL.EraseTrailingChars(); - rURL.EraseLeadingChars(); + rURL = comphelper::string::strip(rURL, ' '); bRet = sal_True; } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 703cef0be78d..2f0819454571 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -1963,8 +1963,7 @@ void SwHTMLParser::NextToken( int nToken ) ' ' == aToken.GetChar( aToken.Len()-3 ) ) { String aComment( aToken.Copy( 3, aToken.Len()-5 ) ); - aComment.EraseLeadingChars().EraseTrailingChars(); - InsertComment( aComment ); + InsertComment(comphelper::string::strip(aComment, ' ')); } else { @@ -3709,7 +3708,7 @@ void SwHTMLParser::NewFontAttr( int nToken ) while( nStrPos!=STRING_NOTFOUND ) { String aFName = aFace.GetToken( 0, ',', nStrPos ); - aFName.EraseTrailingChars().EraseLeadingChars(); + aFName = comphelper::string::strip(aFName, ' '); if( aFName.Len() ) { if( !bFound && pFList ) diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx index 5886fcf1bf61..a22170c08a2b 100644 --- a/sw/source/filter/rtf/rtffld.cxx +++ b/sw/source/filter/rtf/rtffld.cxx @@ -136,8 +136,7 @@ static RTF_FLD_TYPES _WhichFld( String& rName, String& rNext ) if( !rName.Len() ) return RTFFLD_UNKNOWN; - String sNm( rName ); - sNm = sNm.EraseLeadingChars().GetToken(0, ' '); + String sNm(comphelper::string::stripStart(rName, ' ').getToken(0, ' ')); OSL_ENSURE( sNm.Len(), "Feldname hat keine Laenge!" ); if( !sNm.Len() ) return RTFFLD_UNKNOWN; @@ -208,9 +207,9 @@ public: }; RtfFieldSwitch::RtfFieldSwitch( const String& rParam ) - : sParam( rParam ), nCurPos( 0 ) + : nCurPos( 0 ) { - sParam.EraseTrailingChars().EraseLeadingChars(); + sParam = comphelper::string::strip(rParam, ' '); } sal_Unicode RtfFieldSwitch::GetSwitch( String& rParam ) @@ -239,7 +238,7 @@ sal_Unicode RtfFieldSwitch::GetSwitch( String& rParam ) sParam.Erase( 0, nCurPos + nOffset ); rParam = sParam.GetToken( 0, c ); - sParam.Erase( 0, rParam.Len() + nOffset ).EraseLeadingChars(); + sParam = comphelper::string::stripStart(sParam.Erase(0, rParam.Len() + nOffset), ' '); if( '\\' == c ) rParam = comphelper::string::stripEnd(rParam, ' '); nCurPos = 0; @@ -869,7 +868,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) default: { // keines von den bekannten Feldern, also eine neues UserField - aSaveStr.EraseLeadingChars().EraseTrailingChars(); + aSaveStr = comphelper::string::strip(aSaveStr, ' '); SwUserFieldType aTmp( pDoc, aSaveStr ); SwUserField aUFld( (SwUserFieldType*)pDoc->InsertFldType( aTmp )); aUFld.ChangeFormat( UF_STRING ); diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 780f1f081228..db1991f4a628 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -30,7 +30,7 @@ #undef SW_DLLIMPLEMENTATION #endif - +#include <comphelper/string.hxx> #include <tools/shl.hxx> #include <swtypes.hxx> #include <helpid.h> @@ -753,11 +753,7 @@ void SwCaptionOptPage::SaveEntry(SvLBoxEntry* pEntry) if(aName == sNone) pOpt->SetCategory(aEmptyStr); else - { - aName.EraseLeadingChars (' '); - aName.EraseTrailingChars(' '); - pOpt->SetCategory(aName); - } + pOpt->SetCategory(comphelper::string::strip(aName, ' ')); pOpt->SetNumType((sal_uInt16)(sal_uLong)aFormatBox.GetEntryData(aFormatBox.GetSelectEntryPos())); pOpt->SetCaption(aTextEdit.IsEnabled() ? aTextEdit.GetText() : aEmptyStr ); pOpt->SetPos(aPosBox.GetSelectEntryPos()); diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index eada5cc81b4d..6cb447382c3b 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -102,8 +102,9 @@ #include <com/sun/star/sdbc/ResultSetType.hpp> #include <com/sun/star/mail/MailAttachment.hpp> #include <comphelper/processfactory.hxx> -#include <comphelper/types.hxx> #include <comphelper/property.hxx> +#include <comphelper/string.hxx> +#include <comphelper/types.hxx> #include <mailmergehelper.hxx> #include <maildispatcher.hxx> #include <svtools/htmlcfg.hxx> @@ -1012,8 +1013,7 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, sLeading = aEntry.GetBase(); aEntry.removeSegment(); sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE ); - String sExt( pStoreToFilter->GetDefaultExtension() ); - sExt.EraseLeadingChars('*'); + String sExt(comphelper::string::stripStart(pStoreToFilter->GetDefaultExtension(), '*')); aTempFile = std::auto_ptr< utl::TempFile >( new utl::TempFile(sLeading,&sExt,&sPath )); if( bAsSingleFile ) diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 28bf2e75be43..d9734eefb0fc 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -1684,8 +1684,7 @@ String AddressMultiLineEdit::GetAddress() sal_uLong nParaCount = pTextEngine->GetParagraphCount(); for(sal_uLong nPara = nParaCount; nPara; --nPara) { - String sPara = pTextEngine->GetText( nPara - 1); - sPara.EraseTrailingChars(' '); + String sPara = comphelper::string::stripEnd(pTextEngine->GetText(nPara - 1), ' '); //don't add empty trailing paragraphs if(sRet.Len() || sPara.Len()) { diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index d9d96d92fbaf..2e3403e7afbb 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -35,6 +35,7 @@ #include <mmconfigitem.hxx> #include <mailmergehelper.hxx> #include <unotools.hxx> +#include <comphelper/string.hxx> #include <unotools/tempfile.hxx> #include <uitool.hxx> #include <svx/dlgutil.hxx> @@ -126,8 +127,7 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) : //temp file needs it's own block //creating with extension is not supported by a static method :-( String sLeading; - String sExt(pSfxFlt->GetDefaultExtension()); - sExt.EraseLeadingChars('*'); + String sExt(comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(), '*')); utl::TempFile aTempFile( sLeading, &sExt ); m_sExampleURL = aTempFile.GetURL(); aTempFile.EnableKillingFile(); diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx index 3d1bae935b81..71c2c7396e85 100644 --- a/sw/source/ui/fldui/fldmgr.cxx +++ b/sw/source/ui/fldui/fldmgr.cxx @@ -1315,8 +1315,8 @@ sal_Bool SwFldMgr::InsertFld( const SwInsertFld_Data& rData ) SfxItemSet aBoxSet( pCurShell->GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA ); - String sFml( rData.sPar2 ); - if( sFml.EraseLeadingChars().Len() && + String sFml(comphelper::string::stripStart(rData.sPar2, ' ')); + if( sFml.Len() && '=' == sFml.GetChar( 0 ) ) sFml.Erase( 0, 1 ); diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index 0a16423f06df..534297a48060 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -57,7 +57,7 @@ #include <com/sun/star/text/XTextEmbeddedObject.hpp> #include <com/sun/star/text/XTextFramesSupplier.hpp> #include <com/sun/star/text/XTextFrame.hpp> - +#include <comphelper/string.hxx> #include <frmui.hrc> #include <cption.hrc> #include <SwStyleNameMapper.hxx> @@ -296,11 +296,7 @@ void SwCaptionDialog::Apply() if ( aName == sNone ) aOpt.SetCategory( aEmptyStr ); else - { - aName.EraseLeadingChars( ' ' ); - aName.EraseTrailingChars( ' ' ); - aOpt.SetCategory( aName ); - } + aOpt.SetCategory(comphelper::string::strip(aName, ' ')); aOpt.SetNumType( (sal_uInt16)(sal_uIntPtr)aFormatBox.GetEntryData( aFormatBox.GetSelectEntryPos() ) ); aOpt.SetSeparator( aSepEdit.IsEnabled() ? aSepEdit.GetText() : String() ); aOpt.SetNumSeparator( aNumberingSeparatorED.GetText() ); diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 180c3d142b6b..fe056ee6f36e 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -198,9 +198,7 @@ sal_uInt16 BookmarkCombo::GetSelEntryPos(sal_uInt16 nPos) const for (; nPos < nCnt; nPos++) { - String sEntry(GetText().GetToken(nPos, cSep)); - sEntry.EraseLeadingChars(); - sEntry.EraseTrailingChars(); + String sEntry(comphelper::string::strip(GetText().GetToken(nPos, cSep), ' ')); if (GetEntryPos(sEntry) != COMBOBOX_ENTRY_NOTFOUND) return nPos; } @@ -235,10 +233,7 @@ sal_uInt16 BookmarkCombo::GetSelectEntryPos( sal_uInt16 nSelIndex ) const if (nSelIndex == nCnt) { sal_Unicode cSep = GetMultiSelectionSeparator(); - String sEntry(GetText().GetToken(nPos, cSep)); - sEntry.EraseLeadingChars(); - sEntry.EraseTrailingChars(); - + String sEntry(comphelper::string::strip(GetText().GetToken(nPos, cSep), ' ')); return GetEntryPos(sEntry); } nPos = GetNextSelEntryPos(nPos); diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx index f07fe52cc9f4..95e6f547bbb8 100644 --- a/sw/source/ui/misc/glosdoc.cxx +++ b/sw/source/ui/misc/glosdoc.cxx @@ -72,8 +72,7 @@ String lcl_CheckFileName( const String& rNewFilePath, sRet += cChar; } } - sRet.EraseLeadingChars(); - sRet.EraseTrailingChars(); + sRet = comphelper::string::strip(sRet, ' '); sal_Bool bOk = sal_False; if( sRet.Len() ) diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx index c6b0f220fb13..0693340291be 100644 --- a/sw/source/ui/ribbar/inputwin.cxx +++ b/sw/source/ui/ribbar/inputwin.cxx @@ -28,6 +28,7 @@ #include "sal/config.h" +#include <comphelper/string.hxx> #include <officecfg/Office/Common.hxx> #include <tools/gen.hxx> #include <sfx2/imgmgr.hxx> @@ -393,8 +394,7 @@ void SwInputWindow::ApplyFormula() // Formel soll immer mit einem "=" beginnen, hier // also wieder entfernen - String sEdit( aEdit.GetText() ); - sEdit.EraseLeadingChars().EraseTrailingChars(); + String sEdit(comphelper::string::strip(aEdit.GetText(), ' ')); if( sEdit.Len() && '=' == sEdit.GetChar( 0 ) ) sEdit.Erase( 0, 1 ); SfxStringItem aParam(FN_EDIT_FORMULA, sEdit); diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 431de8bda43e..5f9e7d3f9d9d 100644 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -124,7 +124,7 @@ #include <app.hrc> #include <comphelper/processfactory.hxx> - +#include <comphelper/string.hxx> #include <cppuhelper/bootstrap.hxx> #include <langhelper.hxx> @@ -966,8 +966,7 @@ void SwAnnotationShell::StateInsert(SfxItemSet &rSet) { String sSel(pOLV->GetSelected()); sSel.Erase(255); - sSel.EraseTrailingChars(); - aHLinkItem.SetName(sSel); + aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' ')); } sal_uInt16 nHtmlMode = ::GetHtmlMode(rView.GetDocShell()); diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index be020a989bb2..321ce0aec7e4 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <i18npool/mslangid.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> @@ -940,8 +941,7 @@ void SwDrawTextShell::StateInsert(SfxItemSet &rSet) { String sSel(pOLV->GetSelected()); sSel.Erase(255); - sSel.EraseTrailingChars(); - aHLinkItem.SetName(sSel); + aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' ')); } sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index 07b562214fdb..3ad1e1ff61cb 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -30,7 +30,7 @@ #define _SW_FRMVALID_HXX #include <hintids.hxx> - +#include <comphelper/string.hxx> #include <svl/globalnameitem.hxx> #include <svl/ownlist.hxx> #include <sfx2/frmdescr.hxx> @@ -850,8 +850,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) { String sReturn = rSh.GetSelTxt(); sReturn.Erase(255); - sReturn.EraseTrailingChars(); - aHLinkItem.SetName(sReturn); + aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' ')); } aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() | diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index 93e643a0c606..10d7fa98c22c 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -1582,7 +1582,7 @@ String SwView::GetSelectionTextParam( sal_Bool bCompleteWrds, GetWrtShell().GetSelectedText( sReturn ); if( bEraseTrail ) - sReturn.EraseTrailingChars(); + sReturn = comphelper::string::stripEnd(sReturn, ' '); return sReturn; } diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index ebcbb354846e..e224320bf23c 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -37,6 +37,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <vcl/timer.hxx> #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/text/MailMergeType.hpp> @@ -787,8 +788,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat( String::CreateFromAscii( FILTER_XML ), SwDocShell::Factory().GetFilterContainer() ); - String aExtension( pSfxFlt->GetDefaultExtension() ); - aExtension.EraseLeadingChars( '*' ); + String aExtension(comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(), '*')); TempFile aTempFile( C2U("SwMM"), &aExtension ); aTmpFileName = aTempFile.GetName(); diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index b90d3f78755d..a0497aa8ea3b 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -26,6 +26,7 @@ * ************************************************************************/ +#include <comphelper/string.hxx> #include <svl/svstdarr.hxx> #include <svl/urlbmk.hxx> #include <tools/urlobj.hxx> @@ -510,8 +511,8 @@ void SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibilityChanged) nMemberCount--; else { - String aEntry(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(i)); - aEntry.EraseLeadingChars(); + String aEntry(comphelper::string::stripStart( + pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(i), ' ')); SwNavigationPI::CleanEntry( aEntry ); SwOutlineContent* pCnt = new SwOutlineContent(this, aEntry, i, nLevel, pWrtShell->IsOutlineMovable( i ), nPos ); diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx index f53b4f77bdc1..827b47e79157 100644 --- a/sw/source/ui/utlui/navipi.cxx +++ b/sw/source/ui/utlui/navipi.cxx @@ -30,6 +30,7 @@ #define NAVIPI_CXX #include <string> +#include <comphelper/string.hxx> #include <svl/urlbmk.hxx> #include <svl/stritem.hxx> #include <svtools/filter.hxx> @@ -1238,7 +1239,7 @@ sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt ) && (!sContentFileName.Len() || sContentFileName != sFileName )) { nRet = rEvt.mnAction; - sFileName.EraseTrailingChars( char(0) ); + sFileName = comphelper::string::stripEnd(sFileName, 0); sContentFileName = sFileName; if(pxObjectShell) { diff --git a/sw/source/ui/vba/vbatemplate.cxx b/sw/source/ui/vba/vbatemplate.cxx index 2071ebdd223a..0ce1817911f3 100644 --- a/sw/source/ui/vba/vbatemplate.cxx +++ b/sw/source/ui/vba/vbatemplate.cxx @@ -29,10 +29,10 @@ #include <vbahelper/vbahelper.hxx> #include "wordvbahelper.hxx" #include "vbaautotextentry.hxx" -#include <comphelper/processfactory.hxx> #include <com/sun/star/text/XAutoTextContainer.hpp> -#include <tools/urlobj.hxx> +#include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> +#include <tools/urlobj.hxx> #include <osl/file.hxx> using namespace ::ooo::vba; @@ -51,9 +51,7 @@ String lcl_CheckGroupName( const String& rGroupName ) sRet += cChar; } } - sRet.EraseLeadingChars(); - sRet.EraseTrailingChars(); - return sRet; + return comphelper::string::strip(sRet, ' '); } |