summaryrefslogtreecommitdiffstats
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/docpool.cxx8
-rw-r--r--sc/source/core/data/dpobject.cxx8
-rw-r--r--sc/source/core/tool/compiler.cxx4
-rw-r--r--sc/source/core/tool/interpr1.cxx8
-rw-r--r--sc/source/core/tool/rangeseq.cxx4
-rw-r--r--sc/source/filter/excel/xlformula.cxx2
-rw-r--r--sc/source/filter/html/htmlpars.cxx5
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx6
-rw-r--r--sc/source/ui/dbgui/scendlg.cxx5
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx5
-rw-r--r--sc/source/ui/optdlg/tpusrlst.cxx7
-rw-r--r--sc/source/ui/view/editsh.cxx5
-rw-r--r--sc/source/ui/view/tabvwshe.cxx3
13 files changed, 32 insertions, 38 deletions
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index 9d7daec7b04c..9fa6bca232c2 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -28,6 +28,7 @@
#include "scitems.hxx"
+#include <comphelper/string.hxx>
#include <tools/shl.hxx>
#include <vcl/outdev.hxx>
#include <svl/aeitem.hxx>
@@ -776,10 +777,9 @@ SfxItemPresentation lcl_HFPresentation
pItem = aIter.NextItem();
}
- rText.EraseTrailingChars();
- rText.EraseTrailingChars( '+' );
- rText.EraseTrailingChars();
-
+ rText = comphelper::string::stripEnd(rText, ' ');
+ rText = comphelper::string::stripEnd(rText, '+');
+ rText = comphelper::string::stripEnd(rText, ' ');
return ePresentation;
}
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index c7c6070f82ef..5a3264372542 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1316,7 +1316,8 @@ bool lcl_IsAtStart( const String& rList, const String& rSearch, sal_Int32& rMatc
}
aDequoted = rList.Copy( nStartPos, nNameEnd - nStartPos );
- aDequoted.EraseTrailingChars( ' ' ); // spaces before the closing bracket or semicolon
+ // spaces before the closing bracket or semicolon
+ aDequoted = comphelper::string::stripEnd(aDequoted, ' ');
nQuoteEnd = nClosePos + 1;
bParsed = true;
}
@@ -1488,7 +1489,7 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
{
aSpecField = aFieldNames[nField];
aRemaining.Erase( 0, sal::static_int_cast<xub_StrLen>(nMatched) );
- aRemaining.EraseLeadingChars( ' ' );
+ aRemaining = comphelper::string::stripStart(aRemaining, ' ');
// field name has to be followed by item name in brackets
if ( aRemaining.GetChar(0) == '[' )
@@ -1561,7 +1562,8 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
if ( !bUsed )
bError = true;
- aRemaining.EraseLeadingChars( ' ' ); // remove any number of spaces between entries
+ // remove any number of spaces between entries
+ aRemaining = comphelper::string::stripStart(aRemaining, ' ');
}
if ( !bError && !bHasData && aDataNames.size() == 1 )
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index c59f05bcfffc..a1bc598cda48 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3743,10 +3743,8 @@ ScTokenArray* ScCompiler::CompileString( const String& rFormula )
ScTokenArray aArr;
pArr = &aArr;
- aFormula = rFormula;
+ aFormula = comphelper::string::strip(rFormula, ' ');
- aFormula.EraseLeadingChars();
- aFormula.EraseTrailingChars();
nSrcPos = 0;
bCorrected = false;
if ( bAutoCorrect )
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index c193a38d7495..3d62b5140ba0 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -55,6 +55,7 @@
#include "jumpmatrix.hxx"
#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
#include <stdlib.h>
#include <string.h>
@@ -2887,10 +2888,9 @@ void ScInterpreter::ScN()
}
void ScInterpreter::ScTrim()
-{ // Doesn't only trim but writes out twice!
- String aVal( GetString() );
- aVal.EraseLeadingChars();
- aVal.EraseTrailingChars();
+{
+ // Doesn't only trim but writes out twice!
+ String aVal = comphelper::string::strip(GetString(), ' ');
String aStr;
register const sal_Unicode* p = aVal.GetBuffer();
register const sal_Unicode* const pEnd = p + aVal.Len();
diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx
index 737db1e3398c..928505110a58 100644
--- a/sc/source/core/tool/rangeseq.cxx
+++ b/sc/source/core/tool/rangeseq.cxx
@@ -31,7 +31,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-
+#include <comphelper/string.hxx>
#include "rangeseq.hxx"
#include "document.hxx"
#include "dociter.hxx"
@@ -474,7 +474,7 @@ sal_Bool ScByteSequenceToString::GetString( String& rString, const uno::Any& rAn
{
rString = String( (const sal_Char*)aSeq.getConstArray(),
(xub_StrLen)aSeq.getLength(), nEncoding );
- rString.EraseTrailingChars( (sal_Unicode) 0 );
+ rString = comphelper::string::stripEnd(rString, 0);
return sal_True;
}
return false;
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index 29c0bb136f2d..4af76f08c08c 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -677,7 +677,7 @@ void XclTokenArrayHelper::ConvertStringToList( ScTokenArray& rScTokArr, sal_Unic
{
String aToken( aString.GetToken( 0, cStringSep, nStringIx ) );
if( bTrimLeadingSpaces )
- aToken.EraseLeadingChars( ' ' );
+ aToken = comphelper::string::stripStart(aToken, ' ');
if( nToken > 0 )
rScTokArr.AddOpCode( ocSep );
rScTokArr.AddString( aToken );
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 019d057448e5..f7ee76821fc1 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1572,9 +1572,10 @@ void ScHTMLLayoutParser::FontOn( ImportInfo* pInfo )
String aFontName;
xub_StrLen nPos = 0;
while( nPos != STRING_NOTFOUND )
- { // Fontliste, VCL: Semikolon als Separator, HTML: Komma
+ {
+ // Fontliste, VCL: Semikolon als Separator, HTML: Komma
String aFName = rFace.GetToken( 0, ',', nPos );
- aFName.EraseTrailingChars().EraseLeadingChars();
+ aFName = comphelper::string::strip(aFName, ' ');
if( aFontName.Len() )
aFontName += ';';
aFontName += aFName;
diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index a261ff64c4a1..d380c591ca5d 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -26,6 +26,7 @@
*
************************************************************************/
+#include <comphelper/string.hxx>
#include <vcl/msgbox.hxx>
#include "reffact.hxx"
@@ -454,12 +455,9 @@ IMPL_LINK_NOARG_INLINE_END(ScDbNameDlg, CancelBtnHdl)
IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl)
{
- String aNewName = aEdName.GetText();
+ String aNewName = comphelper::string::strip(aEdName.GetText(), ' ');
String aNewArea = aEdAssign.GetText();
- aNewName.EraseLeadingChars( ' ' );
- aNewName.EraseTrailingChars( ' ' );
-
if ( aNewName.Len() > 0 && aNewArea.Len() > 0 )
{
if ( ScRangeData::IsNameValid( aNewName, pDoc ) && !aNewName.EqualsAscii(STR_DB_LOCAL_NONAME) )
diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx
index d8465839057b..b9c29649e5c1 100644
--- a/sc/source/ui/dbgui/scendlg.cxx
+++ b/sc/source/ui/dbgui/scendlg.cxx
@@ -32,6 +32,7 @@
#include "scitems.hxx"
+#include <comphelper/string.hxx>
#include <svx/drawitem.hxx>
#include <svx/xtable.hxx>
#include <sfx2/objsh.hxx>
@@ -209,12 +210,10 @@ void ScNewScenarioDlg::SetScenarioData( const rtl::OUString& rName, const rtl::O
IMPL_LINK_NOARG(ScNewScenarioDlg, OkHdl)
{
- String aName ( aEdName.GetText() );
+ String aName = comphelper::string::strip(aEdName.GetText(), ' ');
ScDocument* pDoc = ((ScTabViewShell*)SfxViewShell::Current())->
GetViewData()->GetDocument();
- aName.EraseLeadingChars( ' ' );
- aName.EraseTrailingChars( ' ' );
aEdName.SetText( aName );
if ( !pDoc->ValidTabName( aName ) )
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 08245a58b91d..9029b5c7d646 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -28,7 +28,7 @@
#include <com/sun/star/linguistic2/XThesaurus.hpp>
#include <com/sun/star/lang/Locale.hpp>
-
+#include <comphelper/string.hxx>
#include "scitems.hxx"
#include <editeng/adjitem.hxx>
@@ -409,8 +409,7 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet )
// use selected text as name for urls
String sReturn = pOutView->GetSelected();
sReturn.Erase(255);
- sReturn.EraseTrailingChars();
- aHLinkItem.SetName(sReturn);
+ aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
}
}
rSet.Put(aHLinkItem);
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index 3eee0085bb0e..a4f7428a836d 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -324,15 +324,12 @@ void ScTpUserLists::MakeListStr( String& rListStr )
for(xub_StrLen i=0;i<nToken;i++)
{
- String aString=rListStr.GetToken(i,LF);
- aString.EraseLeadingChars(' ');
- aString.EraseTrailingChars(' ');
+ rtl::OUString aString = comphelper::string::strip(rListStr.GetToken(i, LF), ' ');
aStr+=aString;
aStr+=cDelimiter;
}
- aStr.EraseLeadingChars( cDelimiter );
- aStr.EraseTrailingChars( cDelimiter );
+ aStr = comphelper::string::strip(aStr, cDelimiter);
xub_StrLen nLen = aStr.Len();
rListStr.Erase();
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index ef0308f6cd6c..e5e03c1393d4 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -27,7 +27,7 @@
************************************************************************/
#include <com/sun/star/linguistic2/XThesaurus.hpp>
-
+#include <comphelper/string.hxx>
#include "scitems.hxx"
#include <editeng/eeitem.hxx>
@@ -692,8 +692,7 @@ void ScEditShell::GetState( SfxItemSet& rSet )
// use selected text as name for urls
String sReturn = pActiveView->GetSelected();
sReturn.Erase(255);
- sReturn.EraseTrailingChars();
- aHLinkItem.SetName(sReturn);
+ aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
}
rSet.Put(aHLinkItem);
}
diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx
index 08195cb4b0f7..f3c678f3ce16 100644
--- a/sc/source/ui/view/tabvwshe.cxx
+++ b/sc/source/ui/view/tabvwshe.cxx
@@ -26,6 +26,7 @@
*
************************************************************************/
+#include <comphelper/string.hxx>
#include <editeng/eeitem.hxx>
#include "scitems.hxx"
@@ -122,7 +123,7 @@ String ScTabViewShell::GetSelectionText( sal_Bool bWholeWord )
while ( (nAt = aStrSelection.Search( '\t' )) != STRING_NOTFOUND )
aStrSelection.SetChar( nAt, ' ' );
- aStrSelection.EraseTrailingChars( ' ' );
+ aStrSelection = comphelper::string::stripEnd(aStrSelection, ' ');
}
}
}