diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-01-02 10:55:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-01-05 09:18:19 +0000 |
commit | bacfd2dc4cea1a5d87658ed8592116acd931e000 (patch) | |
tree | d22172a33fdd13a440b6882a28c23ea2d639bbad /sc | |
parent | 6281eb0e0792da0194c07da18296e94dd944b8e5 (diff) |
add a comphelper::string::getTokenCount
suitable for conversion from [Byte]String::GetTokenCount
converted low-hanging variants to rtl::O[UString]::getToken loops
added unit test
Diffstat (limited to 'sc')
27 files changed, 69 insertions, 48 deletions
diff --git a/sc/source/core/data/globalx.cxx b/sc/source/core/data/globalx.cxx index 08447a4a5670..bc71c678a28a 100644 --- a/sc/source/core/data/globalx.cxx +++ b/sc/source/core/data/globalx.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/i18n/XOrdinalSuffix.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <unotools/localedatawrapper.hxx> @@ -60,7 +61,7 @@ void ScGlobal::InitAddIns() String aMultiPath = aPathOpt.GetAddinPath(); if ( aMultiPath.Len() > 0 ) { - xub_StrLen nTokens = aMultiPath.GetTokenCount( ';' ); + xub_StrLen nTokens = comphelper::string::getTokenCount(aMultiPath, ';'); xub_StrLen nIndex = 0; for ( xub_StrLen j=0; j<nTokens; j++ ) { diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 66d807f86f70..a0fef93d3863 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -44,8 +44,8 @@ #include <com/sun/star/sheet/FormulaLanguage.hpp> #include <com/sun/star/sheet/FormulaMapGroup.hpp> #include <comphelper/processfactory.hxx> -#include <unotools/transliterationwrapper.hxx> #include <comphelper/string.hxx> +#include <unotools/transliterationwrapper.hxx> #include <tools/urlobj.hxx> #include <rtl/math.hxx> #include <ctype.h> @@ -3369,7 +3369,7 @@ void ScCompiler::AutoCorrectParsedSymbol() && (GetCharTableFlags( c2, c2p ) & SC_COMPILER_C_CHAR_VALUE) ) { xub_StrLen nXcount; - if ( (nXcount = aCorrectedSymbol.GetTokenCount( cx )) > 1 ) + if ( (nXcount = comphelper::string::getTokenCount(aCorrectedSymbol, cx)) > 1 ) { // x => * xub_StrLen nIndex = 0; sal_Unicode c = mxSymbols->getSymbol(ocMul).GetChar(0); @@ -3378,7 +3378,7 @@ void ScCompiler::AutoCorrectParsedSymbol() nIndex++; bCorrected = true; } - if ( (nXcount = aCorrectedSymbol.GetTokenCount( cX )) > 1 ) + if ( (nXcount = comphelper::string::getTokenCount(aCorrectedSymbol, cX)) > 1 ) { // X => * xub_StrLen nIndex = 0; sal_Unicode c = mxSymbols->getSymbol(ocMul).GetChar(0); @@ -3399,7 +3399,7 @@ void ScCompiler::AutoCorrectParsedSymbol() aDoc = aSymbol.Copy( 0, nPosition + 2 ); aSymbol.Erase( 0, nPosition + 2 ); } - xub_StrLen nRefs = aSymbol.GetTokenCount( ':' ); + xub_StrLen nRefs = comphelper::string::getTokenCount(aSymbol, ':'); bool bColons; if ( nRefs > 2 ) { // duplicated or too many ':'? B:2::C10 => B2:C10 diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx index ca956813697b..ce67bb7cda4b 100644 --- a/sc/source/core/tool/ddelink.cxx +++ b/sc/source/core/tool/ddelink.cxx @@ -27,6 +27,7 @@ ************************************************************************/ +#include <comphelper/string.hxx> #include <sfx2/linkmgr.hxx> #include <sfx2/bindings.hxx> #include <svl/zforlist.hxx> @@ -152,10 +153,10 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged( SCSIZE nRows = 1; if (aLinkStr.Len()) { - nRows = static_cast<SCSIZE>(aLinkStr.GetTokenCount( '\n' )); + nRows = static_cast<SCSIZE>(comphelper::string::getTokenCount(aLinkStr, '\n')); aLine = aLinkStr.GetToken( 0, '\n' ); if (aLine.Len()) - nCols = static_cast<SCSIZE>(aLine.GetTokenCount( '\t' )); + nCols = static_cast<SCSIZE>(comphelper::string::getTokenCount(aLine, '\t')); } if (!nRows || !nCols) // keine Daten diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 74d67dd6f5d0..16f9eca9c4c9 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -33,6 +33,7 @@ #define SC_RANGELST_CXX //fuer ICC #include <stdlib.h> // qsort +#include <comphelper/string.hxx> #include <unotools/collatorwrapper.hxx> #include "rangelst.hxx" @@ -179,7 +180,7 @@ sal_uInt16 ScRangeList::Parse( const String& rStr, ScDocument* pDoc, sal_uInt16 } else nTab = 0; - sal_uInt16 nTCount = rStr.GetTokenCount( cDelimiter ); + sal_uInt16 nTCount = comphelper::string::getTokenCount(rStr, cDelimiter); for ( sal_uInt16 i=0; i<nTCount; i++ ) { aOne = rStr.GetToken( i, cDelimiter ); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index f9f4e49751c0..3e8878de2aa7 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/sheet/XAreaLinks.hpp> #include <com/sun/star/sheet/XAreaLink.hpp> +#include <comphelper/string.hxx> #include <sfx2/objsh.hxx> #include <tools/urlobj.hxx> #include <svl/itemset.hxx> @@ -1046,7 +1047,7 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : Data validity is BIFF8 only (important for the XclExpString object). Excel uses the NUL character as string list separator. */ mxString1.reset( new XclExpString( EXC_STR_8BITLENGTH ) ); - xub_StrLen nTokenCnt = aString.GetTokenCount( '\n' ); + xub_StrLen nTokenCnt = comphelper::string::getTokenCount(aString, '\n'); xub_StrLen nStringIx = 0; for( xub_StrLen nToken = 0; nToken < nTokenCnt; ++nToken ) { @@ -1282,7 +1283,7 @@ XclExpWebQuery::XclExpWebQuery( mbEntireDoc( false ) { // comma separated list of HTML table names or indexes - xub_StrLen nTokenCnt = rSource.GetTokenCount( ';' ); + xub_StrLen nTokenCnt = comphelper::string::getTokenCount(rSource, ';'); String aNewTables, aAppendTable; xub_StrLen nStringIx = 0; bool bExitLoop = false; diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index 04f21053a93d..02154ba9eb5c 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -36,6 +36,8 @@ #include "xistream.hxx" #include "xlroot.hxx" +#include <comphelper/string.hxx> + using namespace ::formula; // Function data ============================================================== @@ -680,7 +682,7 @@ void XclTokenArrayHelper::ConvertStringToList( ScTokenArray& rScTokArr, sal_Unic if( GetString( aString, rScTokArr ) ) { rScTokArr.Clear(); - xub_StrLen nTokenCnt = aString.GetTokenCount( cStringSep ); + xub_StrLen nTokenCnt = comphelper::string::getTokenCount(aString, cStringSep); xub_StrLen nStringIx = 0; for( xub_StrLen nToken = 0; nToken < nTokenCnt; ++nToken ) { diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 0c27b450f5e3..1d2a9791f4a9 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -32,6 +32,7 @@ // INCLUDE --------------------------------------------------------------- #include "scitems.hxx" +#include <comphelper/string.hxx> #include <editeng/eeitem.hxx> #include <rtl/tencinfo.h> @@ -396,7 +397,7 @@ void ScHTMLExport::WriteHeader() << OOO_STRING_SVTOOLS_HTML_thead << "," << OOO_STRING_SVTOOLS_HTML_tbody << "," << OOO_STRING_SVTOOLS_HTML_tfoot << "," << OOO_STRING_SVTOOLS_HTML_tablerow << "," << OOO_STRING_SVTOOLS_HTML_tableheader << "," << OOO_STRING_SVTOOLS_HTML_tabledata << "," << OOO_STRING_SVTOOLS_HTML_parabreak << " { " << sFontFamily; - xub_StrLen nFonts = aHTMLStyle.aFontFamilyName.GetTokenCount( ';' ); + xub_StrLen nFonts = comphelper::string::getTokenCount(aHTMLStyle.aFontFamilyName, ';'); if ( nFonts == 1 ) { rStrm << '\"'; @@ -1127,7 +1128,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab ) { aStr.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_face). append(RTL_CONSTASCII_STRINGPARAM("=\"")); - xub_StrLen nFonts = rFontItem.GetFamilyName().GetTokenCount( ';' ); + xub_StrLen nFonts = comphelper::string::getTokenCount(rFontItem.GetFamilyName(), ';'); if ( nFonts == 1 ) { rtl::OString aTmpStr = HTMLOutFuncs::ConvertStringToHTML( diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index 29333d8d801b..b060be8df861 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -32,6 +32,7 @@ //------------------------------------------------------------------------ #include "scitems.hxx" +#include <comphelper/string.hxx> #include <editeng/eeitem.hxx> #include <editeng/lrspitem.hxx> @@ -224,7 +225,7 @@ String ScHTMLImport::GetHTMLRangeNameList( ScDocument* pDoc, const String& rOrig String aNewName; ScRangeName* pRangeNames = pDoc->GetRangeName(); ScRangeList aRangeList; - xub_StrLen nTokenCnt = rOrigName.GetTokenCount( ';' ); + xub_StrLen nTokenCnt = comphelper::string::getTokenCount(rOrigName, ';'); xub_StrLen nStringIx = 0; for( xub_StrLen nToken = 0; nToken < nTokenCnt; nToken++ ) { diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index c0e3cc669843..68b08dea5a9f 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -801,8 +801,8 @@ void ScInputHandler::ShowTipCursor() } if( bFlag ) { - sal_uInt16 nCountSemicolon = aNew.GetTokenCount(cSep)-1; - sal_uInt16 nCountDot = aNew.GetTokenCount(cSheetSep)-1; + sal_uInt16 nCountSemicolon = comphelper::string::getTokenCount(aNew, cSep) - 1; + sal_uInt16 nCountDot = comphelper::string::getTokenCount(aNew, cSheetSep) - 1; sal_uInt16 nStartPosition = 0; sal_uInt16 nEndPosition = 0; @@ -1045,8 +1045,8 @@ void ScInputHandler::UseFormulaData() } if( bFlag ) { - sal_uInt16 nCountSemicolon = aNew.GetTokenCount(cSep)-1; - sal_uInt16 nCountDot = aNew.GetTokenCount(cSheetSep)-1; + sal_uInt16 nCountSemicolon = comphelper::string::getTokenCount(aNew, cSep) - 1; + sal_uInt16 nCountDot = comphelper::string::getTokenCount(aNew, cSheetSep) - 1; sal_uInt16 nStartPosition = 0; sal_uInt16 nEndPosition = 0; diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx index 3ad363828c72..60e0db4c185a 100644 --- a/sc/source/ui/dbgui/asciiopt.cxx +++ b/sc/source/ui/dbgui/asciiopt.cxx @@ -34,6 +34,7 @@ #include "impex.hxx" #include "asciiopt.hxx" #include "asciiopt.hrc" +#include <comphelper/string.hxx> #include <rtl/tencinfo.h> #include <unotools/transliterationwrapper.hxx> // ause @@ -198,7 +199,7 @@ sal_Bool ScAsciiOptions::operator==( const ScAsciiOptions& rCmp ) const void ScAsciiOptions::ReadFromString( const String& rString ) { - xub_StrLen nCount = rString.GetTokenCount(','); + xub_StrLen nCount = comphelper::string::getTokenCount(rString, ','); String aToken; xub_StrLen nSub; xub_StrLen i; @@ -215,7 +216,7 @@ void ScAsciiOptions::ReadFromString( const String& rString ) aToken = rString.GetToken(0,','); if ( aToken.EqualsAscii(pStrFix) ) bFixedLen = sal_True; - nSub = aToken.GetTokenCount('/'); + nSub = comphelper::string::getTokenCount(aToken, '/'); for ( i=0; i<nSub; i++ ) { String aCode = aToken.GetToken( i, '/' ); @@ -271,7 +272,7 @@ void ScAsciiOptions::ReadFromString( const String& rString ) delete[] pColFormat; aToken = rString.GetToken(4,','); - nSub = aToken.GetTokenCount('/'); + nSub = comphelper::string::getTokenCount(aToken, '/'); nInfoCount = nSub / 2; if (nInfoCount) { diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index e66309015e4f..83cbad623b6d 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -34,6 +34,7 @@ #include <algorithm> #include <memory> +#include <comphelper/string.hxx> #include <svtools/colorcfg.hxx> #include <svl/smplhint.hxx> #include <sal/macros.h> @@ -1079,7 +1080,7 @@ void ScCsvGrid::ImplDrawCellText( const Point& rPos, const String& rText ) /* #i60296# If string contains mixed script types, the space character U+0020 may be drawn with a wrong width (from non-fixed-width Asian or Complex font). Now we draw every non-space portion separately. */ - xub_StrLen nTokenCount = aPlainText.GetTokenCount( ' ' ); + xub_StrLen nTokenCount = comphelper::string::getTokenCount(aPlainText, ' '); xub_StrLen nCharIx = 0; for( xub_StrLen nToken = 0; nToken < nTokenCount; ++nToken ) { diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx index 1b2dc4c1fbfd..53e77d61e988 100644 --- a/sc/source/ui/dbgui/csvruler.cxx +++ b/sc/source/ui/dbgui/csvruler.cxx @@ -36,6 +36,7 @@ #include <optutil.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <comphelper/string.hxx> #include "miscuno.hxx" using namespace com::sun::star::uno; @@ -74,7 +75,7 @@ static void load_FixedWidthList(ScCsvSplits &aSplits) sSplits = String( sFixedWidthLists ); // String ends with a semi-colon so there is no 'int' after the last one. - xub_StrLen n = sSplits.GetTokenCount() - 1; + xub_StrLen n = comphelper::string::getTokenCount(sSplits, ';') - 1; for (xub_StrLen i = 0; i < n; ++i) aSplits.Insert( sSplits.GetToken(i).ToInt32() ); } diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx index eaf75357dc54..dc438f3bb4b9 100644 --- a/sc/source/ui/dbgui/fieldwnd.cxx +++ b/sc/source/ui/dbgui/fieldwnd.cxx @@ -27,6 +27,7 @@ ************************************************************************/ +#include <comphelper/string.hxx> #include <vcl/virdev.hxx> #include <vcl/decoview.hxx> #include <vcl/svapp.hxx> @@ -503,7 +504,7 @@ void ScDPFieldControlBase::DrawBackground( OutputDevice& rDev ) support hard line breaks here. This part will draw each line of the text for itself. */ - xub_StrLen nTokenCnt = GetText().GetTokenCount('\n'); + xub_StrLen nTokenCnt = comphelper::string::getTokenCount(GetText(), '\n'); long nY = (aSize.Height() - nTokenCnt * rDev.GetTextHeight()) / 2; for( xub_StrLen nToken = 0, nStringIx = 0; nToken < nTokenCnt; ++nToken ) { diff --git a/sc/source/ui/dbgui/imoptdlg.cxx b/sc/source/ui/dbgui/imoptdlg.cxx index f54663b656d1..250768ecdbbf 100644 --- a/sc/source/ui/dbgui/imoptdlg.cxx +++ b/sc/source/ui/dbgui/imoptdlg.cxx @@ -32,6 +32,7 @@ #include "imoptdlg.hxx" #include "scresid.hxx" #include "imoptdlg.hrc" +#include <comphelper/string.hxx> #include <rtl/tencinfo.h> static const sal_Char pStrFix[] = "FIX"; @@ -53,7 +54,7 @@ ScImportOptions::ScImportOptions( const String& rStr ) eCharSet = RTL_TEXTENCODING_DONTKNOW; bSaveAsShown = sal_True; // "true" if not in string (after CSV import) bQuoteAllText = false; - xub_StrLen nTokenCount = rStr.GetTokenCount(','); + xub_StrLen nTokenCount = comphelper::string::getTokenCount(rStr, ','); if ( nTokenCount >= 3 ) { // first 3 tokens: common diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 2d7fded3b6a9..fdb1fa88121e 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -34,9 +34,9 @@ #include "impex.hxx" #include "scuiasciiopt.hxx" #include "asciiopt.hrc" +#include <comphelper/string.hxx> #include <rtl/tencinfo.h> #include <unotools/transliterationwrapper.hxx> -// ause #include "editutil.hxx" #include <optutil.hxx> @@ -69,7 +69,7 @@ using ::rtl::OUString; void lcl_FillCombo( ComboBox& rCombo, const String& rList, sal_Unicode cSelect ) { xub_StrLen i; - xub_StrLen nCount = rList.GetTokenCount('\t'); + xub_StrLen nCount = comphelper::string::getTokenCount(rList, '\t'); for ( i=0; i<nCount; i+=2 ) rCombo.InsertEntry( rList.GetToken(i,'\t') ); @@ -92,7 +92,7 @@ sal_Unicode lcl_CharFromCombo( ComboBox& rCombo, const String& rList ) String aStr = rCombo.GetText(); if ( aStr.Len() ) { - xub_StrLen nCount = rList.GetTokenCount('\t'); + xub_StrLen nCount = comphelper::string::getTokenCount(rList, '\t'); for ( xub_StrLen i=0; i<nCount; i+=2 ) { if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rList.GetToken(i,'\t') ) ) @@ -405,7 +405,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, aLbCustomLang.SelectLanguage(static_cast<LanguageType>(nLanguage), true); // *** column type ListBox *** - xub_StrLen nCount = aColumnUser.GetTokenCount(); + xub_StrLen nCount = comphelper::string::getTokenCount(aColumnUser, ';'); for (xub_StrLen i=0; i<nCount; i++) aLbType.InsertEntry( aColumnUser.GetToken( i ) ); diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx index 5935aae74fcc..bdee0dfba1e3 100644 --- a/sc/source/ui/dbgui/scuiimoptdlg.cxx +++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx @@ -34,7 +34,9 @@ #include "scuiimoptdlg.hxx" #include "scresid.hxx" #include "imoptdlg.hrc" +#include <comphelper/string.hxx> #include <rtl/tencinfo.h> + //======================================================================== // ScDelimiterTable //======================================================================== @@ -45,7 +47,7 @@ public: ScDelimiterTable( const String& rDelTab ) : theDelTab ( rDelTab ), cSep ( '\t' ), - nCount ( rDelTab.GetTokenCount('\t') ), + nCount ( comphelper::string::getTokenCount(rDelTab, '\t') ), nIter ( 0 ) {} diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index a3ccd2e319c4..e1fb2384bc49 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -263,7 +263,7 @@ ScConditionMode lclGetCondModeFromPos( sal_uInt16 nLbPos ) void lclGetFormulaFromStringList( String& rFmlaStr, const String& rStringList, sal_Unicode cFmlaSep ) { rFmlaStr.Erase(); - xub_StrLen nTokenCnt = rStringList.GetTokenCount( '\n' ); + xub_StrLen nTokenCnt = comphelper::string::getTokenCount(rStringList, '\n'); for( xub_StrLen nToken = 0, nStringIx = 0; nToken < nTokenCnt; ++nToken ) { String aToken( rStringList.GetToken( 0, '\n', nStringIx ) ); diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index 5d5e21b7bcda..554e61152117 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -31,6 +31,7 @@ // INCLUDE --------------------------------------------------------- +#include <comphelper/string.hxx> #include <sfx2/app.hxx> #include <sfx2/docfile.hxx> #include <sfx2/fcontnr.hxx> @@ -300,7 +301,7 @@ sal_Bool ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter, // find total size of source area SCCOL nWidth = 0; SCROW nHeight = 0; - xub_StrLen nTokenCnt = aTempArea.GetTokenCount( ';' ); + xub_StrLen nTokenCnt = comphelper::string::getTokenCount(aTempArea, ';'); xub_StrLen nStringIx = 0; xub_StrLen nToken; diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 6de83648577a..bf409456766a 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -531,7 +531,7 @@ void lcl_GetColumnTypes( ScDocShell& rDocShell, { pDoc->GetString( nCol, nFirstRow, nTab, aString ); aString.ToUpperAscii(); - xub_StrLen nToken = aString.GetTokenCount( ',' ); + xub_StrLen nToken = comphelper::string::getTokenCount(aString, ','); if ( nToken > 1 ) { aFieldName = aString.GetToken( 0, ',' ); diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 7b02de3cd7f2..e3484e243281 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -32,6 +32,7 @@ //---------------------------------------------------------------------------- #include "rangelst.hxx" +#include <comphelper/string.hxx> #include <sfx2/app.hxx> #include <sfx2/viewsh.hxx> #include <vcl/wrkwin.hxx> @@ -163,7 +164,7 @@ bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, const Strin ScAddress::Details aDetails(pDoc->GetAddressConvention(), 0, 0); ScRangeUtil aRangeUtil; - xub_StrLen nTokenCnt = rStr.GetTokenCount(); + xub_StrLen nTokenCnt = comphelper::string::getTokenCount(rStr, ';'); for( xub_StrLen nToken = 0; nToken < nTokenCnt; ++nToken ) { ScRange aRange; diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx index 9607d4c47a37..f8ed5a89e830 100644 --- a/sc/source/ui/miscdlgs/linkarea.cxx +++ b/sc/source/ui/miscdlgs/linkarea.cxx @@ -31,8 +31,7 @@ -//------------------------------------------------------------------ - +#include <comphelper/string.hxx> #include <sfx2/app.hxx> #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> @@ -196,7 +195,7 @@ void ScLinkedAreaDlg::InitFromOldLink( const String& rFile, const String& rFilte UpdateSourceRanges(); - xub_StrLen nRangeCount = rSource.GetTokenCount(); + xub_StrLen nRangeCount = comphelper::string::getTokenCount(rSource, ';'); for ( xub_StrLen i=0; i<nRangeCount; i++ ) { String aRange = rSource.GetToken(i); diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index 46b9037d6d74..099d9f9165a0 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -29,7 +29,7 @@ #undef SC_DLLIMPLEMENTATION -//------------------------------------------------------------------ +#include <comphelper/string.hxx> #include <vcl/msgbox.hxx> #include "global.hxx" @@ -327,7 +327,7 @@ void ScTpUserLists::MakeListStr( String& rListStr ) aInputStr.ConvertLineEnd( LINEEND_LF ); - xub_StrLen nToken=rListStr.GetTokenCount(LF); + xub_StrLen nToken = comphelper::string::getTokenCount(rListStr, LF); for(xub_StrLen i=0;i<nToken;i++) { diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index a16f99843d29..f4de499da793 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -32,6 +32,7 @@ //---------------------------------------------------------------------------- #include <rangelst.hxx> +#include <comphelper/string.hxx> #include <sfx2/dispatch.hxx> #include <svl/stritem.hxx> #include <vcl/msgbox.hxx> @@ -397,7 +398,7 @@ sal_Bool ScPrintAreasDlg::Impl_CheckRefStrings() ScAddress aAddr; ScRange aRange; - xub_StrLen nSepCount = aStrPrintArea.GetTokenCount(sep); + xub_StrLen nSepCount = comphelper::string::getTokenCount(aStrPrintArea, sep); for ( xub_StrLen i = 0; i < nSepCount && bPrintAreaOk; ++i ) { String aOne = aStrPrintArea.GetToken(i, sep); diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index ef995ba5e29d..d76622a23ffb 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -32,6 +32,7 @@ // INCLUDE --------------------------------------------------------------- #include "scitems.hxx" +#include <comphelper/string.hxx> #include <editeng/eeitem.hxx> #include <sfx2/app.hxx> @@ -870,7 +871,7 @@ void ScPreviewShell::WriteUserData(String& rData, sal_Bool /* bBrowse */) void ScPreviewShell::ReadUserData(const String& rData, sal_Bool /* bBrowse */) { - xub_StrLen nCount = rData.GetTokenCount(); + xub_StrLen nCount = comphelper::string::getTokenCount(rData, ';'); if (nCount) { xub_StrLen nIndex = 0; diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 691b65132a29..176a8497d259 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -69,6 +69,7 @@ #include "ViewSettingsSequenceDefines.hxx" #include <rtl/ustrbuf.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <com/sun/star/container/XNameContainer.hpp> using namespace com::sun::star; @@ -2251,7 +2252,7 @@ void ScViewData::ReadUserData(const String& rData) if (!rData.Len()) // Leerer String kommt bei "neu Laden" return; // dann auch ohne Assertion beenden - xub_StrLen nCount = rData.GetTokenCount(';'); + xub_StrLen nCount = comphelper::string::getTokenCount(rData, ';'); if ( nCount <= 2 ) { // beim Reload in der Seitenansicht sind evtl. die Preview-UserData @@ -2307,10 +2308,10 @@ void ScViewData::ReadUserData(const String& rData) maTabData[nPos] = new ScViewDataTable; sal_Unicode cTabSep = 0; - if (aTabOpt.GetTokenCount(SC_OLD_TABSEP) >= 11) + if (comphelper::string::getTokenCount(aTabOpt, SC_OLD_TABSEP) >= 11) cTabSep = SC_OLD_TABSEP; #ifndef SC_LIMIT_ROWS - else if (aTabOpt.GetTokenCount(SC_NEW_TABSEP) >= 11) + else if (comphelper::string::getTokenCount(aTabOpt, SC_NEW_TABSEP) >= 11) cTabSep = SC_NEW_TABSEP; // '+' ist nur erlaubt, wenn wir mit Zeilen > 8192 umgehen koennen #endif diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 400d1cbdd9e4..77a26016f519 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -30,6 +30,7 @@ // INCLUDE --------------------------------------------------------------- #include "scitems.hxx" +#include <comphelper/string.hxx> #include <editeng/eeitem.hxx> #include <sfx2/app.hxx> @@ -977,7 +978,7 @@ void ScViewFunc::SetPrintRanges( sal_Bool bEntireSheet, const String* pPrint, if ( pPrint->Len() ) { const sal_Unicode sep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0); - sal_uInt16 nTCount = pPrint->GetTokenCount(sep); + sal_uInt16 nTCount = comphelper::string::getTokenCount(*pPrint, sep); for (sal_uInt16 i=0; i<nTCount; i++) { String aToken = pPrint->GetToken(i, sep); diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index eae13290a649..1b18f51bf270 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -55,8 +55,9 @@ #include <svtools/transfer.hxx> #include <vcl/graph.hxx> -#include <comphelper/storagehelper.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/storagehelper.hxx> +#include <comphelper/string.hxx> #include <sot/formats.hxx> #define SOT_FORMATSTR_ID_STARCALC_CURRENT SOT_FORMATSTR_ID_STARCALC_50 @@ -656,10 +657,10 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r if (aDataStr.Len()) { - nRows = aDataStr.GetTokenCount( '\n' ); + nRows = comphelper::string::getTokenCount(aDataStr, '\n'); String aLine = aDataStr.GetToken( 0, '\n' ); if (aLine.Len()) - nCols = aLine.GetTokenCount( '\t' ); + nCols = comphelper::string::getTokenCount(aLine, '\t'); } } } |