From bacfd2dc4cea1a5d87658ed8592116acd931e000 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 2 Jan 2012 10:55:27 +0000 Subject: 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 --- basic/source/basmgr/basmgr.cxx | 15 +++---- basic/source/classes/eventatt.cxx | 4 +- comphelper/inc/comphelper/string.hxx | 22 +++++++++- comphelper/qa/string/test_string.cxx | 17 ++++++++ comphelper/source/misc/string.cxx | 29 +++++++++++++ connectivity/source/drivers/flat/ETable.cxx | 2 +- cui/source/customize/cfgutil.cxx | 7 ++-- cui/source/dialogs/cuicharmap.cxx | 8 ++-- cui/source/dialogs/cuifmsearch.cxx | 21 ++++++---- cui/source/dialogs/multipat.cxx | 3 +- cui/source/dialogs/plfilter.cxx | 3 +- cui/source/options/optjava.cxx | 3 +- cui/source/options/optpath.cxx | 15 +++---- cui/source/tabpages/labdlg.cxx | 6 +-- cui/source/tabpages/macroass.cxx | 3 +- dbaccess/source/core/misc/dsntypes.cxx | 17 ++++---- dbaccess/source/ext/adabas/AdabasNewDb.cxx | 3 +- dbaccess/source/ui/dlg/DbAdminImpl.cxx | 5 ++- dbaccess/source/ui/dlg/TextConnectionHelper.cxx | 7 ++-- dbaccess/source/ui/dlg/queryfilter.cxx | 7 ++-- dbaccess/source/ui/misc/TokenWriter.cxx | 4 +- dbaccess/source/ui/querydesign/QueryDesignView.cxx | 7 ++-- .../source/ui/querydesign/SelectionBrowseBox.cxx | 27 ++++++------ desktop/source/app/cmdlinehelp.cxx | 2 +- editeng/source/outliner/outliner.cxx | 3 +- extensions/source/plugin/base/manager.cxx | 6 ++- extensions/source/plugin/util/makefile.mk | 1 + extensions/source/propctrlr/standardcontrol.cxx | 5 ++- filter/source/msfilter/escherex.cxx | 3 +- filter/source/msfilter/msdffimp.cxx | 3 +- fpicker/source/office/iodlg.cxx | 49 +++++++++++----------- l10ntools/source/export.cxx | 18 ++++---- l10ntools/source/gsicheck.cxx | 9 ++-- l10ntools/source/helpmerge.cxx | 2 +- l10ntools/source/lngmerge.cxx | 3 +- l10ntools/source/localize.cxx | 5 ++- l10ntools/source/merge.cxx | 3 +- oox/source/ole/axcontrol.cxx | 5 ++- padmin/source/helper.cxx | 3 +- rsc/source/rsc/rsc.cxx | 3 +- sc/source/core/data/globalx.cxx | 3 +- sc/source/core/tool/compiler.cxx | 8 ++-- sc/source/core/tool/ddelink.cxx | 5 ++- sc/source/core/tool/rangelst.cxx | 3 +- sc/source/filter/excel/xecontent.cxx | 5 ++- sc/source/filter/excel/xlformula.cxx | 4 +- sc/source/filter/html/htmlexp.cxx | 5 ++- sc/source/filter/html/htmlimp.cxx | 3 +- sc/source/ui/app/inputhdl.cxx | 8 ++-- sc/source/ui/dbgui/asciiopt.cxx | 7 ++-- sc/source/ui/dbgui/csvgrid.cxx | 3 +- sc/source/ui/dbgui/csvruler.cxx | 3 +- sc/source/ui/dbgui/fieldwnd.cxx | 3 +- sc/source/ui/dbgui/imoptdlg.cxx | 3 +- sc/source/ui/dbgui/scuiasciiopt.cxx | 8 ++-- sc/source/ui/dbgui/scuiimoptdlg.cxx | 4 +- sc/source/ui/dbgui/validate.cxx | 2 +- sc/source/ui/docshell/arealink.cxx | 3 +- sc/source/ui/docshell/docsh8.cxx | 2 +- sc/source/ui/miscdlgs/anyrefdg.cxx | 3 +- sc/source/ui/miscdlgs/linkarea.cxx | 5 +-- sc/source/ui/optdlg/tpusrlst.cxx | 4 +- sc/source/ui/pagedlg/areasdlg.cxx | 3 +- sc/source/ui/view/prevwsh.cxx | 3 +- sc/source/ui/view/viewdata.cxx | 7 ++-- sc/source/ui/view/viewfun2.cxx | 3 +- sc/source/ui/view/viewfun5.cxx | 7 ++-- sd/source/core/CustomAnimationPreset.cxx | 5 ++- sd/source/filter/ppt/pptin.cxx | 4 +- sd/source/ui/annotations/annotationmanager.cxx | 3 +- sd/source/ui/dlg/copydlg.cxx | 3 +- sd/source/ui/dlg/tpaction.cxx | 5 ++- sd/source/ui/dlg/tpoption.cxx | 2 +- sfx2/source/appl/appopen.cxx | 10 ++--- sfx2/source/appl/childwin.cxx | 5 ++- sfx2/source/appl/newhelp.cxx | 8 ++-- sfx2/source/bastyp/sfxhtml.cxx | 3 +- sfx2/source/dialog/filedlghelper.cxx | 2 +- sfx2/source/dialog/filtergrouping.cxx | 2 +- sfx2/source/dialog/srchdlg.cxx | 3 +- sfx2/source/doc/doctemplates.cxx | 7 ++-- sfx2/source/doc/new.cxx | 3 +- starmath/source/view.cxx | 8 ++-- svl/source/misc/folderrestriction.cxx | 45 ++++++++++---------- svl/source/misc/restrictedpaths.cxx | 43 +++++++++---------- svl/source/numbers/zformat.cxx | 4 +- svtools/bmpmaker/bmpsum.cxx | 4 +- svtools/inc/svtools/filter.hxx | 4 +- svtools/source/config/printoptions.cxx | 11 ++--- svtools/source/contnr/fileview.cxx | 5 +-- svtools/source/dialogs/addresstemplate.cxx | 23 ++++++---- svtools/source/filter/FilterConfigItem.cxx | 28 +++++++------ svtools/source/filter/filter.cxx | 15 ++++--- svtools/source/filter/ixbm/xbmread.cxx | 6 +-- svtools/source/filter/sgvtext.cxx | 9 ++-- svtools/source/misc/imap2.cxx | 6 ++- svtools/source/misc/templatefoldercache.cxx | 10 ++--- svtools/source/svhtml/parhtml.cxx | 2 +- svx/inc/svx/gallery1.hxx | 4 +- svx/inc/svx/simptabl.hxx | 2 +- svx/source/dialog/simptabl.cxx | 16 +++---- svx/source/form/fmobj.cxx | 11 +++-- svx/source/form/fmshimp.cxx | 7 ++-- svx/source/form/fmsrcimp.cxx | 9 ++-- svx/source/gallery2/galbrws2.cxx | 4 +- svx/source/gallery2/gallery1.cxx | 13 +++--- svx/source/gallery2/galmisc.cxx | 5 ++- svx/source/gallery2/galobj.cxx | 3 +- svx/source/xml/xmlgrhlp.cxx | 5 ++- sw/source/core/doc/doctxm.cxx | 4 +- sw/source/core/fields/cellfml.cxx | 5 ++- sw/source/core/fields/ddefld.cxx | 2 +- sw/source/core/fields/docufld.cxx | 2 +- sw/source/core/unocore/unochart.cxx | 7 ++-- sw/source/core/unocore/unofield.cxx | 5 ++- sw/source/core/unocore/unoidx.cxx | 3 +- sw/source/core/unocore/unosect.cxx | 3 +- sw/source/filter/html/htmlforw.cxx | 3 +- sw/source/filter/ww8/docxattributeoutput.cxx | 3 +- sw/source/ui/app/appenv.cxx | 2 +- sw/source/ui/dbui/createaddresslistdialog.cxx | 5 ++- sw/source/ui/dbui/mailmergechildwindow.cxx | 5 ++- sw/source/ui/dbui/mailmergehelper.cxx | 7 ++-- sw/source/ui/dbui/mmoutputpage.cxx | 6 +-- sw/source/ui/dochdl/swdtflvr.cxx | 13 +++--- sw/source/ui/envelp/envimg.cxx | 3 +- sw/source/ui/envelp/labelcfg.cxx | 3 +- sw/source/ui/fldui/fldmgr.cxx | 5 ++- sw/source/ui/index/cntex.cxx | 3 +- sw/source/ui/index/cnttab.cxx | 4 +- sw/source/ui/misc/bookmark.cxx | 2 +- sw/source/ui/misc/glosdoc.cxx | 2 +- sw/source/ui/misc/glossary.cxx | 3 +- sw/source/ui/uiview/view.cxx | 3 +- sw/source/ui/vba/vbaselection.cxx | 3 +- tools/source/inet/inetstrm.cxx | 2 +- unotools/source/config/pathoptions.cxx | 33 ++++++++++----- vcl/inc/ilstbox.hxx | 4 +- vcl/source/control/combobox.cxx | 2 +- vcl/source/control/ilstbox.cxx | 11 ++--- 140 files changed, 589 insertions(+), 411 deletions(-) diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 9052458e84db..f452adc54d7c 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -1049,12 +1050,12 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) { String aCurStorageName( aStorName ); INetURLObject aCurStorage( aCurStorageName, INET_PROT_FILE ); - sal_uInt16 nLibs = aLibs.GetTokenCount( LIB_SEP ); - for ( sal_uInt16 nLib = 0; nLib < nLibs; nLib++ ) + sal_Int32 nLibs = comphelper::string::getTokenCount(aLibs, LIB_SEP); + for ( sal_Int32 nLib = 0; nLib < nLibs; nLib++ ) { - String aLibInfo( aLibs.GetToken( nLib, LIB_SEP ) ); + String aLibInfo(comphelper::string::getToken(aLibs, nLib, LIB_SEP)); // TODO: Remove == 2 - DBG_ASSERT( ( aLibInfo.GetTokenCount( LIBINFO_SEP ) == 2 ) || ( aLibInfo.GetTokenCount( LIBINFO_SEP ) == 3 ), "Ungueltige Lib-Info!" ); + DBG_ASSERT( ( comphelper::string::getTokenCount(aLibInfo, LIBINFO_SEP) == 2 ) || ( comphelper::string::getTokenCount(aLibInfo, LIBINFO_SEP) == 3 ), "Ungueltige Lib-Info!" ); String aLibName( aLibInfo.GetToken( 0, LIBINFO_SEP ) ); String aLibAbsStorageName( aLibInfo.GetToken( 1, LIBINFO_SEP ) ); String aLibRelStorageName( aLibInfo.GetToken( 2, LIBINFO_SEP ) ); @@ -1895,11 +1896,11 @@ ErrCode BasicManager::ExecuteMacro( String const& i_fullyQualifiedName, String c sQuotedArgs = '('; - sal_uInt16 nCount = sArgs.GetTokenCount(','); - for ( sal_uInt16 n=0; n #include - +#include #include #include @@ -218,7 +218,7 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any String aMacro( aScriptEvent.ScriptCode ); String aLibName; String aLocation; - if( aMacro.GetTokenCount( '.' ) == 3 ) + if( comphelper::string::getTokenCount(aMacro, '.') == 3 ) { sal_uInt16 nLast = 0; ::rtl::OUString aFullLibName = aMacro.GetToken( 0, '.', nLast ); diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx index 037c947d4953..1b8e18d9db74 100644 --- a/comphelper/inc/comphelper/string.hxx +++ b/comphelper/inc/comphelper/string.hxx @@ -280,8 +280,9 @@ COMPHELPER_DLLPUBLIC rtl::OString strip(const rtl::OString &rIn, COMPHELPER_DLLPUBLIC rtl::OUString strip(const rtl::OUString &rIn, sal_Unicode c); -/** Returns a token in the OString +/** Returns a token in an OString + @param rIn the input OString @param token the number of the token to return @param cTok the character which seperate the tokens. @return the token if token is negative or doesn't exist an empty token @@ -294,8 +295,9 @@ COMPHELPER_DLLPUBLIC inline rtl::OString getToken(const rtl::OString &rIn, return rIn.getToken(nToken, cTok, nIndex); } -/** Returns a token in the OUString +/** Returns a token in an OUString + @param rIn the input OUString @param token the number of the token to return @param cTok the character which seperate the tokens. @return the token if token is negative or doesn't exist an empty token @@ -308,6 +310,22 @@ COMPHELPER_DLLPUBLIC inline rtl::OUString getToken(const rtl::OUString &rIn, return rIn.getToken(nToken, cTok, nIndex); } +/** Returns number of tokens in an OUString + + @param rIn the input OString + @param cTok the character which seperate the tokens. + @return the number of tokens +*/ +COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const rtl::OString &rIn, sal_Char cTok); + +/** Returns number of tokens in an OUString + + @param rIn the input OUString + @param cTok the character which seperate the tokens. + @return the number of tokens +*/ +COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const rtl::OUString &rIn, sal_Unicode cTok); + /** Match against a substring appearing in another string. diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index ae1fc58ef397..1fb892217740 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -52,6 +52,7 @@ public: void testStripEnd(); void testStrip(); void testToken(); + void testTokenCount(); void testDecimalStringToNumber(); void testIsdigitAsciiString(); void testIsalnumAsciiString(); @@ -68,6 +69,7 @@ public: CPPUNIT_TEST(testStripEnd); CPPUNIT_TEST(testStrip); CPPUNIT_TEST(testToken); + CPPUNIT_TEST(testTokenCount); CPPUNIT_TEST(testDecimalStringToNumber); CPPUNIT_TEST(testIsdigitAsciiString); CPPUNIT_TEST(testIsalnumAsciiString); @@ -516,6 +518,21 @@ void TestString::testToken() CPPUNIT_ASSERT(aOut.isEmpty()); } +void TestString::testTokenCount() +{ + ::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("10.11.12")); + sal_Int32 nOut; + + nOut = ::comphelper::string::getTokenCount(aIn, '.'); + CPPUNIT_ASSERT(nOut == 3); + + nOut = ::comphelper::string::getTokenCount(aIn, 'X'); + CPPUNIT_ASSERT(nOut == 1); + + nOut = ::comphelper::string::getTokenCount(rtl::OString(), 'X'); + CPPUNIT_ASSERT(nOut == 0); +} + CPPUNIT_TEST_SUITE_REGISTRATION(TestString); } diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index bc3f89048aaf..13a1236ea55e 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -240,6 +240,35 @@ rtl::OUString strip(const rtl::OUString &rIn, sal_Unicode c) return stripEnd(stripStart(rIn, c), c); } +namespace +{ + template sal_Int32 tmpl_getTokenCount(const T &rIn, + C cTok) + { + // Empty String: TokenCount by Definition is 0 + if (rIn.isEmpty()) + return 0; + + sal_Int32 nTokCount = 1; + for (sal_Int32 i = 0; i < rIn.getLength(); ++i) + { + if (rIn[i] == cTok) + ++nTokCount; + } + return nTokCount; + } +} + +sal_Int32 getTokenCount(const rtl::OString &rIn, sal_Char cTok) +{ + return tmpl_getTokenCount(rIn, cTok); +} + +sal_Int32 getTokenCount(const rtl::OUString &rIn, sal_Unicode cTok) +{ + return tmpl_getTokenCount(rIn, cTok); +} + sal_uInt32 decimalStringToNumber( ::rtl::OUString const & str ) { diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 1e49f01523d6..a02759d39108 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -907,7 +907,7 @@ sal_Bool OFlatTable::readLine(sal_Int32& _rnCurrentPos) return sal_False; QuotedTokenizedString sLine = m_aCurrentLine; // check if the string continues on next line - while( (sLine.GetString().GetTokenCount(m_cStringDelimiter) % 2) != 1 ) + while( (comphelper::string::getTokenCount(sLine.GetString(), m_cStringDelimiter) % 2) != 1 ) { m_pFileStream->ReadByteStringLine(sLine,nEncoding); if ( !m_pFileStream->IsEof() ) diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index 123088b82a2e..0c45efb1941a 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -58,11 +58,12 @@ #include "cuires.hrc" #include #include -#include #include +#include +#include +#include #include #include -#include #include #include "dialmgr.hxx" #include @@ -1204,7 +1205,7 @@ void SfxConfigGroupListBox_Impl::SelectMacro( const String& rBasic, aBasicName += ' '; aBasicName += pImp->m_sMacros; String aLib, aModule, aMethod; - sal_uInt16 nCount = rMacro.GetTokenCount('.'); + sal_uInt16 nCount = comphelper::string::getTokenCount(rMacro, '.'); aMethod = rMacro.GetToken( nCount-1, '.' ); if ( nCount > 2 ) { diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx index 777851cce643..21b3836807e2 100644 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -292,7 +292,7 @@ SvxCharMapData::SvxCharMapData( SfxModalDialog* pDialog, sal_Bool bOne_, ResMgr* aDeleteBtn.Hide(); } - String aDefStr( aFont.GetName() ); + rtl::OUString aDefStr( aFont.GetName() ); String aLastName; int nCount = mpDialog->GetDevFontCount(); for ( int i = 0; i < nCount; i++ ) @@ -311,9 +311,10 @@ SvxCharMapData::SvxCharMapData( SfxModalDialog* pDialog, sal_Bool bOne_, ResMgr* bool bFound = (aFontLB.GetEntryPos( aDefStr ) == LISTBOX_ENTRY_NOTFOUND ); if( !bFound ) { - for ( xub_StrLen i = 0; i < aDefStr.GetTokenCount(); ++i ) + sal_Int32 nIndex = 0; + do { - String aToken = aDefStr.GetToken(i); + rtl::OUString aToken = aDefStr.getToken(0, ';', nIndex); if ( aFontLB.GetEntryPos( aToken ) != LISTBOX_ENTRY_NOTFOUND ) { aDefStr = aToken; @@ -321,6 +322,7 @@ SvxCharMapData::SvxCharMapData( SfxModalDialog* pDialog, sal_Bool bOne_, ResMgr* break; } } + while ( nIndex >= 0 ); } if ( bFound ) diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx index b4556cccdf3e..ac5fd9e824c3 100644 --- a/cui/source/dialogs/cuifmsearch.cxx +++ b/cui/source/dialogs/cuifmsearch.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -139,7 +140,7 @@ FmSearchDialog::FmSearchDialog(Window* pParent, const UniString& sInitialText, c fmscInitial.nContext = nInitialContext; m_lnkContextSupplier.Call(&fmscInitial); DBG_ASSERT(fmscInitial.xCursor.is(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplier !"); - DBG_ASSERT(fmscInitial.strUsedFields.GetTokenCount(';') == (xub_StrLen)fmscInitial.arrFields.size(), + DBG_ASSERT(comphelper::string::getTokenCount(fmscInitial.strUsedFields, ';') == (xub_StrLen)fmscInitial.arrFields.size(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplied !"); #if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL for (sal_Int32 i=0; i<(sal_Int32)fmscInitial.arrFields.size(); ++i) @@ -189,7 +190,7 @@ FmSearchDialog::FmSearchDialog(Window* pParent, const UniString& sInitialText, c if (fmscInitial.sFieldDisplayNames.Len() != 0) { // use the display names if supplied - DBG_ASSERT(fmscInitial.sFieldDisplayNames.GetTokenCount() == fmscInitial.strUsedFields.GetTokenCount(), + DBG_ASSERT(comphelper::string::getTokenCount(fmscInitial.sFieldDisplayNames, ';') == comphelper::string::getTokenCount(fmscInitial.strUsedFields, ';'), "FmSearchDialog::FmSearchDialog : invalid initial context description !"); Init(fmscInitial.sFieldDisplayNames, sInitialText); } @@ -278,8 +279,8 @@ void FmSearchDialog::Init(const UniString& strVisibleFields, const UniString& sI m_lbPosition.SelectEntryPos(MATCHING_ANYWHERE); // the field listbox - for (sal_uInt16 i=0; i #include +#include #include #include #include @@ -283,7 +284,7 @@ String SvxMultiPathDialog::GetPath() const void SvxMultiPathDialog::SetPath( const String& rPath ) { sal_Unicode cDelim = pImpl->bIsClassPathMode ? CLASSPATH_DELIMITER : SVT_SEARCHPATH_DELIMITER; - sal_uInt16 nPos, nCount = rPath.GetTokenCount( cDelim ); + sal_uInt16 nPos, nCount = comphelper::string::getTokenCount(rPath, cDelim); for ( sal_uInt16 i = 0; i < nCount; ++i ) { diff --git a/cui/source/dialogs/plfilter.cxx b/cui/source/dialogs/plfilter.cxx index f1bd7f744377..bc4c4804a4c3 100644 --- a/cui/source/dialogs/plfilter.cxx +++ b/cui/source/dialogs/plfilter.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -76,7 +77,7 @@ void fillNetscapePluginFilters( Sequence< rtl::OUString >& rPluginNames, Sequenc StrSet& rTypes = aMap[ rDescr.Description ]; String aExtension( rDescr.Extension ); - for ( sal_uInt16 nCnt = aExtension.GetTokenCount( ';' ); nCnt--; ) + for ( sal_uInt16 nCnt = comphelper::string::getTokenCount(aExtension, ';'); nCnt--; ) { // no default plugins anymore String aExt( aExtension.GetToken( nCnt, ';' ) ); diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 733d9eea6310..a32869e42652 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -1061,7 +1062,7 @@ void SvxJavaClassPathDlg::SetClassPath( const String& _rPath ) m_sOldPath = _rPath; m_aPathList.Clear(); xub_StrLen i, nIdx = 0; - xub_StrLen nCount = _rPath.GetTokenCount( CLASSPATH_DELIMITER ); + xub_StrLen nCount = comphelper::string::getTokenCount(_rPath, CLASSPATH_DELIMITER); for ( i = 0; i < nCount; ++i ) { String sToken = _rPath.GetToken( 0, CLASSPATH_DELIMITER, nIdx ); diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index c6b87d000bcd..58a37b106a8b 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -51,8 +51,9 @@ #include "optpath.hrc" #include #include "helpid.hrc" -#include #include +#include +#include #include #include #include @@ -158,7 +159,7 @@ static String getCfgName_Impl( sal_uInt16 _nHandle ) String Convert_Impl( const String& rValue ) { char cDelim = MULTIPATH_DELIMITER; - sal_uInt16 nCount = rValue.GetTokenCount( cDelim ); + sal_uInt16 nCount = comphelper::string::getTokenCount(rValue, cDelim); String aReturn; for ( sal_uInt16 i=0; inRealId, sInternal, sUser, sWritable, bReadOnly ); sal_uInt16 i; - sal_uInt16 nOldCount = aOldPath.GetTokenCount( MULTIPATH_DELIMITER ); - sal_uInt16 nIntCount = sInternal.GetTokenCount( MULTIPATH_DELIMITER ); + sal_uInt16 nOldCount = comphelper::string::getTokenCount(aOldPath, MULTIPATH_DELIMITER); + sal_uInt16 nIntCount = comphelper::string::getTokenCount(sInternal, MULTIPATH_DELIMITER); for ( i = 0; i < nOldCount; ++i ) { bool bFound = false; @@ -457,7 +458,7 @@ IMPL_LINK( SvxPathTabPage, StandardHdl_Impl, PushButton *, EMPTYARG ) } String sUserPath, sWritablePath; - nOldCount = sTemp.GetTokenCount( MULTIPATH_DELIMITER ); + nOldCount = comphelper::string::getTokenCount(sTemp, MULTIPATH_DELIMITER); for ( i = 0; nOldCount > 0 && i < nOldCount - 1; ++i ) { if ( sUserPath.Len() > 0 ) @@ -590,7 +591,7 @@ IMPL_LINK( SvxPathTabPage, PathHdl_Impl, PushButton *, EMPTYARG ) String sFullPath; String sNewPath = pMultiDlg->GetPath(); char cDelim = MULTIPATH_DELIMITER; - sal_uInt16 nCount = sNewPath.GetTokenCount( cDelim ); + sal_uInt16 nCount = comphelper::string::getTokenCount(sNewPath, cDelim); if ( nCount > 0 ) { sal_uInt16 i = 0; @@ -824,7 +825,7 @@ void SvxPathTabPage::SetPathList( { // save user paths char cDelim = MULTIPATH_DELIMITER; - sal_uInt16 nCount = _rUserPath.GetTokenCount( cDelim ); + sal_uInt16 nCount = comphelper::string::getTokenCount(_rUserPath, cDelim); Sequence< ::rtl::OUString > aPathSeq( nCount ); ::rtl::OUString* pArray = aPathSeq.getArray(); for ( sal_uInt16 i = 0; i < nCount; ++i ) diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx index 7177dcfb716d..b56d494fdcd8 100644 --- a/cui/source/tabpages/labdlg.cxx +++ b/cui/source/tabpages/labdlg.cxx @@ -26,7 +26,7 @@ * ************************************************************************/ -// include --------------------------------------------------------------- +#include #include #include #include @@ -424,7 +424,7 @@ void SvxCaptionTabPage::SetupAnsatz_Impl( sal_uInt16 nType ) case AZ_HORIZONTAL: aLB_ANSATZ_REL.Clear(); - nCnt = aStrHorzList.GetTokenCount(); + nCnt = comphelper::string::getTokenCount(aStrHorzList, ';'); for( nIdx=0 ; nIdx +#include #include #include #define _SVSTDARR_STRINGSDTOR @@ -134,7 +135,7 @@ String ConvertToUIName_Impl( SvxMacro *pMacro ) String aEntry; if ( ! pMacro->GetLanguage().EqualsAscii("JavaScript") ) { - sal_uInt16 nCount = aName.GetTokenCount('.'); + sal_uInt16 nCount = comphelper::string::getTokenCount(aName, '.'); aEntry = aName.GetToken( nCount-1, '.' ); if ( nCount > 2 ) { diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index a17214b471ee..e54d0db86b81 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -40,6 +40,7 @@ #include "core_resource.hxx" #include "core_resource.hrc" #include +#include //......................................................................... namespace dbaccess @@ -55,7 +56,7 @@ namespace dbaccess { void lcl_extractHostAndPort(const String& _sUrl,String& _sHostname,sal_Int32& _nPortNumber) { - if ( _sUrl.GetTokenCount(':') >= 2 ) + if ( comphelper::string::getTokenCount(_sUrl, ':') >= 2 ) { _sHostname = _sUrl.GetToken(0,':'); _nPortNumber = _sUrl.GetToken(1,':').ToInt32(); @@ -229,14 +230,14 @@ void ODsnTypeCollection::extractHostNamePort(const ::rtl::OUString& _rDsn,String if ( _rDsn.matchIgnoreAsciiCaseAsciiL("jdbc:oracle:thin:",sizeof("jdbc:oracle:thin:")-1) ) { lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber); - if ( !_rsHostname.Len() && sUrl.GetTokenCount(':') == 2 ) + if ( !_rsHostname.Len() && comphelper::string::getTokenCount(sUrl, ':') == 2 ) { _nPortNumber = -1; _rsHostname = sUrl.GetToken(0,':'); } if ( _rsHostname.Len() ) - _rsHostname = _rsHostname.GetToken(_rsHostname.GetTokenCount('@') - 1,'@'); - _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount(':') - 1,':'); + _rsHostname = _rsHostname.GetToken(comphelper::string::getTokenCount(_rsHostname, '@') - 1, '@'); + _sDatabaseName = sUrl.GetToken(comphelper::string::getTokenCount(sUrl, ':') - 1, ':'); } else if ( _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:address:ldap:",sizeof("sdbc:address:ldap:")-1) ) { @@ -244,17 +245,17 @@ void ODsnTypeCollection::extractHostNamePort(const ::rtl::OUString& _rDsn,String } else if ( _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:adabas:",sizeof("sdbc:adabas:")-1) ) { - if ( sUrl.GetTokenCount(':') == 2 ) + if ( comphelper::string::getTokenCount(sUrl, ':') == 2 ) _rsHostname = sUrl.GetToken(0,':'); - _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount(':') - 1,':'); + _sDatabaseName = sUrl.GetToken(comphelper::string::getTokenCount(sUrl, ':') - 1, ':'); } else if ( _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:mysql:mysqlc:",sizeof("sdbc:mysql:mysqlc:")-1) || _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:mysql:jdbc:",sizeof("sdbc:mysql:jdbc:")-1) ) { lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber); - if ( _nPortNumber == -1 && !_rsHostname.Len() && sUrl.GetTokenCount('/') == 2 ) + if ( _nPortNumber == -1 && !_rsHostname.Len() && comphelper::string::getTokenCount(sUrl, '/') == 2 ) _rsHostname = sUrl.GetToken(0,'/'); - _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount('/') - 1,'/'); + _sDatabaseName = sUrl.GetToken(comphelper::string::getTokenCount(sUrl, '/') - 1, '/'); } else if ( _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=",sizeof("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=")-1) || _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=",sizeof("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=")-1)) diff --git a/dbaccess/source/ext/adabas/AdabasNewDb.cxx b/dbaccess/source/ext/adabas/AdabasNewDb.cxx index 4c31eff2989e..897f88978414 100644 --- a/dbaccess/source/ext/adabas/AdabasNewDb.cxx +++ b/dbaccess/source/ext/adabas/AdabasNewDb.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -652,7 +653,7 @@ IMPL_LINK( OAdabasNewDbDlg, PwdClickHdl, Button *, pButton ) { String sPwd = aDlg.GetPassword().ToUpperAscii(); // no space in password allowed - if ( sPwd.GetTokenCount(' ') == 1 ) + if ( comphelper::string::getTokenCount(sPwd, ' ') == 1 ) { if(pButton == &m_PB_CONPWD) { diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index a38c26eeeaf9..238418e5c871 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -60,10 +60,11 @@ #include /** === end UNO includes === **/ +#include #include #include #include -#include +#include #include #include #include @@ -525,7 +526,7 @@ String ODbDataSourceAdministrationHelper::getConnectionURL() const SFX_ITEMSET_GET(*m_pItemSetHelper->getOutputSet(), pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True); sNewUrl = lcl_createHostWithPort(pHostName,NULL); String sUrl = pCollection->cutPrefix(pUrlItem->GetValue()); - if ( sUrl.GetTokenCount(':') == 1 ) + if ( comphelper::string::getTokenCount(sUrl, ':') == 1 ) sNewUrl += String::CreateFromAscii(":"); sNewUrl += sUrl; diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 91c3a364f8ca..d8ce26f8d3ef 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -50,6 +50,7 @@ #include #include "DriverSettings.hxx" #include "dbadmin.hxx" +#include #include #include @@ -110,13 +111,13 @@ DBG_NAME(OTextConnectionHelper) { DBG_CTOR(OTextConnectionHelper,NULL); - xub_StrLen nCnt = m_aFieldSeparatorList.GetTokenCount( '\t' ); + xub_StrLen nCnt = comphelper::string::getTokenCount(m_aFieldSeparatorList, '\t'); xub_StrLen i; for( i = 0 ; i < nCnt ; i += 2 ) m_aFieldSeparator.InsertEntry( m_aFieldSeparatorList.GetToken( i, '\t' ) ); - nCnt = m_aTextSeparatorList.GetTokenCount( '\t' ); + nCnt = comphelper::string::getTokenCount(m_aTextSeparatorList, '\t'); for( i=0 ; i #include #include +#include #include #include #include "moduledbu.hxx" @@ -225,7 +226,7 @@ DlgFilterCrit::~DlgFilterCrit() sal_Int32 DlgFilterCrit::GetOSQLPredicateType( const String& _rSelectedPredicate ) const { sal_Int32 nPredicateIndex = -1; - for ( xub_StrLen i=0; iInsertEntry(aSTR_COMPARE_OPERATORS.GetToken(i)); } else if(eColumnSearch == ColumnSearch::CHAR) @@ -746,7 +747,7 @@ IMPL_LINK( DlgFilterCrit, ListSelectHdl, ListBox *, pListBox ) xub_StrLen i; for( i = 0; i < 6; i++ ) pComp->InsertEntry(aSTR_COMPARE_OPERATORS.GetToken(i)); - for(i=8;iInsertEntry(aSTR_COMPARE_OPERATORS.GetToken(i)); } else diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index ef1ec82a91c0..c43da50d568d 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -119,7 +119,7 @@ ODatabaseImportExport::ODatabaseImportExport(const ::svx::ODataAccessDescriptor& osl_incrementInterlockedCount( &m_refCount ); impl_initFromDescriptor( _aDataDescriptor, false ); - xub_StrLen nCount = rExchange.GetTokenCount(char(11)); + xub_StrLen nCount = comphelper::string::getTokenCount(rExchange, char(11)); if( nCount > SBA_FORMAT_SELECTION_COUNT && rExchange.GetToken(4).Len()) { m_pRowMarker = new sal_Int32[nCount-SBA_FORMAT_SELECTION_COUNT]; @@ -421,7 +421,7 @@ sal_Bool ORTFImportExport::Write() ByteString aFontNr; (*m_pStream) << "{\\fonttbl"; - xub_StrLen nTokenCount = aFonts.GetTokenCount(); + xub_StrLen nTokenCount = comphelper::string::getTokenCount(aFonts, ';'); for(sal_uInt32 j=0;j +#include +#include #include #include #include @@ -56,7 +58,6 @@ #include "ConnectionLineData.hxx" #include "QTableConnectionData.hxx" #include "dbustrings.hrc" -#include #include "UITools.hxx" #include "querycontainerwindow.hxx" #include "QueryTableView.hxx" @@ -966,7 +967,7 @@ namespace { const sal_Int32 nMaxOrder = xMetaData->getMaxColumnsInOrderBy(); String sToken(aWorkStr); - if ( nMaxOrder && nMaxOrder < sToken.GetTokenCount(',') ) + if ( nMaxOrder && nMaxOrder < comphelper::string::getTokenCount(sToken, ',') ) eErrorCode = eStatementTooLong; else { @@ -3056,7 +3057,7 @@ OSQLParseNode* OQueryDesignView::getPredicateTreeFromEntry(OTableFieldDescRef pE if ( !sFunction.Len() ) sFunction = pEntry->GetField(); - if(sFunction.GetTokenCount('(') > 1) + if (comphelper::string::getTokenCount(sFunction, '(') > 1) sFunction = sFunction.GetToken(0,'('); // this should be the name of the function sal_Int32 nType = ::connectivity::OSQLParser::getFunctionReturnType(sFunction,&rParser.getContext()); diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 8aefc3d402f8..f3140b08f1be 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -33,6 +33,9 @@ #include "querycontroller.hxx" #include "QueryTableView.hxx" #include "browserids.hxx" +#include +#include +#include #include #include "TableFieldInfo.hxx" #include "dbu_qry.hrc" @@ -44,8 +47,6 @@ #include #include "QueryDesignFieldUndoAct.hxx" #include -#include -#include #include "sqlmessage.hxx" #include "UITools.hxx" #include @@ -78,7 +79,7 @@ namespace if ( !bAsterix ) { String sName = _sFieldName; - xub_StrLen nTokenCount = sName.GetTokenCount('.'); + xub_StrLen nTokenCount = comphelper::string::getTokenCount(sName, '.'); if ( (nTokenCount == 2 && sName.GetToken(1,'.').GetChar(0) == '*' ) || (nTokenCount == 3 && sName.GetToken(2,'.').GetChar(0) == '*' ) ) { @@ -150,7 +151,7 @@ OSelectionBrowseBox::OSelectionBrowseBox( Window* pParent ) SetTitleFont(aTitleFont); String aTxt(ModuleRes(STR_QUERY_SORTTEXT)); - xub_StrLen nCount = aTxt.GetTokenCount(); + xub_StrLen nCount = comphelper::string::getTokenCount(aTxt, ';'); xub_StrLen nIdx = 0; for (; nIdx < nCount; nIdx++) m_pOrderCell->InsertEntry(aTxt.GetToken(nIdx)); @@ -198,7 +199,7 @@ void OSelectionBrowseBox::initialize() ,IParseContext::KEY_INTERSECTION }; - String sGroup = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount() - 1); + String sGroup = m_aFunctionStrings.GetToken(comphelper::string::getTokenCount(m_aFunctionStrings, ';') - 1); m_aFunctionStrings = m_aFunctionStrings.GetToken(0); for (size_t i = 0; i < SAL_N_ELEMENTS(eFunctions); ++i) @@ -213,7 +214,7 @@ void OSelectionBrowseBox::initialize() // Diese Funktionen stehen nur unter CORE zur Verf�gung if ( lcl_SupportsCoreSQLGrammar(xConnection) ) { - xub_StrLen nCount = m_aFunctionStrings.GetTokenCount(); + xub_StrLen nCount = comphelper::string::getTokenCount(m_aFunctionStrings, ';'); for (xub_StrLen nIdx = 0; nIdx < nCount; nIdx++) m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(nIdx)); } @@ -829,7 +830,7 @@ sal_Bool OSelectionBrowseBox::saveField(const String& _sFieldName,OTableFieldDes aSelEntry->SetField(sParameters); if ( aSelEntry->IsGroupBy() ) { - sOldLocalizedFunctionName = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount()-1); + sOldLocalizedFunctionName = m_aFunctionStrings.GetToken(comphelper::string::getTokenCount(m_aFunctionStrings, ';')-1); aSelEntry->SetGroupBy(sal_False); } @@ -957,7 +958,7 @@ sal_Bool OSelectionBrowseBox::SaveModified() sal_uInt16 nPos = m_pFieldCell->GetEntryPos(aFieldName); String aAliasName = pEntry->GetAlias(); - if ( nPos != COMBOBOX_ENTRY_NOTFOUND && !aAliasName.Len() && aFieldName.GetTokenCount('.') > 1 ) + if ( nPos != COMBOBOX_ENTRY_NOTFOUND && !aAliasName.Len() && comphelper::string::getTokenCount(aFieldName, '.') > 1 ) { // special case, we have a table field so we must cut the table name String sTableAlias = aFieldName.GetToken(0,'.'); pEntry->SetAlias(sTableAlias); @@ -1051,7 +1052,7 @@ sal_Bool OSelectionBrowseBox::SaveModified() sal_uInt16 nPos = m_pFunctionCell->GetSelectEntryPos(); // Diese Funktionen stehen nur unter CORE zur Verf�gung String sFunctionName = m_pFunctionCell->GetEntry(nPos); - String sGroupFunctionName = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount()-1); + String sGroupFunctionName = m_aFunctionStrings.GetToken(comphelper::string::getTokenCount(m_aFunctionStrings, ';')-1); sal_Bool bGroupBy = sal_False; if ( sGroupFunctionName.Equals(sFunctionName) ) // check if the function name is GROUP { @@ -2229,7 +2230,7 @@ String OSelectionBrowseBox::GetCellText(long nRow, sal_uInt16 nColId) const case BROW_FUNCTION_ROW: // we always show the group function at first if ( pEntry->IsGroupBy() ) - aText = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount()-1); + aText = m_aFunctionStrings.GetToken(comphelper::string::getTokenCount(m_aFunctionStrings, ';')-1); else if ( pEntry->isNumericOrAggreateFunction() ) aText = pEntry->GetFunction(); break; @@ -2293,7 +2294,7 @@ sal_Bool OSelectionBrowseBox::GetFunctionName(sal_uInt32 _nFunctionTokenId,Strin break; default: { - xub_StrLen nCount = m_aFunctionStrings.GetTokenCount(); + xub_StrLen nCount = comphelper::string::getTokenCount(m_aFunctionStrings, ';'); xub_StrLen i; for ( i = 0; i < nCount-1; i++) // Gruppierung wird nicht mit gez"ahlt { @@ -2372,7 +2373,7 @@ void OSelectionBrowseBox::SetCellContents(sal_Int32 nRow, sal_uInt16 nColId, con case BROW_FUNCTION_ROW: { String sOldFunctionName = pEntry->GetFunction(); - String sGroupFunctionName = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount()-1); + String sGroupFunctionName = m_aFunctionStrings.GetToken(comphelper::string::getTokenCount(m_aFunctionStrings, ';')-1); pEntry->SetFunction(strNewText); // first reset this two member sal_Int32 nFunctionType = pEntry->GetFunctionType(); @@ -2745,7 +2746,7 @@ void OSelectionBrowseBox::setFunctionCell(OTableFieldDescRef& _pEntry) m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(2)); // 2 -> COUNT else { - xub_StrLen nCount = m_aFunctionStrings.GetTokenCount(); + xub_StrLen nCount = comphelper::string::getTokenCount(m_aFunctionStrings, ';'); if ( _pEntry->isNumeric() ) --nCount; for (xub_StrLen nIdx = 1; nIdx < nCount; nIdx++) diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx index b67a010b2d1f..f7e4660cc485 100644 --- a/desktop/source/app/cmdlinehelp.cxx +++ b/desktop/source/app/cmdlinehelp.cxx @@ -153,7 +153,7 @@ namespace desktop rtl::OUStringToOString(aHelpMessage_version, RTL_TEXTENCODING_ASCII_US).getStr(), rtl::OUStringToOString(aHelpMessage_head, RTL_TEXTENCODING_ASCII_US).getStr()); // merge left and right column - sal_Int32 n = aHelpMessage_left.GetTokenCount ('\n'); + sal_Int32 n = comphelper::string::getTokenCount(aHelpMessage_left, '\n'); rtl::OString bsLeft(rtl::OUStringToOString(aHelpMessage_left, RTL_TEXTENCODING_ASCII_US)); ByteString bsRight(rtl::OUStringToOString(aHelpMessage_right, diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 77e6e85c1317..37a569e5948d 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -27,6 +27,7 @@ ************************************************************************/ +#include #include #include #include @@ -410,7 +411,7 @@ void Outliner::SetText( const XubString& rText, Paragraph* pPara ) if( aText.GetChar( aText.Len()-1 ) == '\x0A' ) aText.Erase( aText.Len()-1, 1 ); // Delete the last break - sal_uInt16 nCount = aText.GetTokenCount( '\x0A' ); + sal_uInt16 nCount = comphelper::string::getTokenCount(aText, '\x0A'); sal_uInt16 nPos = 0; sal_uInt16 nInsPos = nPara+1; while( nCount > nPos ) diff --git a/extensions/source/plugin/base/manager.cxx b/extensions/source/plugin/base/manager.cxx index ce330feea025..9d1b8fbc1258 100644 --- a/extensions/source/plugin/base/manager.cxx +++ b/extensions/source/plugin/base/manager.cxx @@ -41,6 +41,8 @@ #include +#include + #include "plugin/impl.hxx" #include "osl/mutex.hxx" @@ -85,10 +87,10 @@ const Sequence< ::rtl::OUString >& PluginManager::getAdditionalSearchPaths() String aPluginPath( aOptions.GetPluginPath() ); if( aPluginPath.Len() ) { - sal_uInt16 nPaths = aPluginPath.GetTokenCount( ';' ); + sal_Int32 nPaths = comphelper::string::getTokenCount(aPluginPath, ';'); aPaths.realloc( nPaths ); for( sal_uInt16 i = 0; i < nPaths; i++ ) - aPaths.getArray()[i] = aPluginPath.GetToken( i, ';' ); + aPaths.getArray()[i] = comphelper::string::getToken(aPluginPath, i, ';'); } } diff --git a/extensions/source/plugin/util/makefile.mk b/extensions/source/plugin/util/makefile.mk index 7b7d047a1779..1e6dda1e5ca0 100644 --- a/extensions/source/plugin/util/makefile.mk +++ b/extensions/source/plugin/util/makefile.mk @@ -80,6 +80,7 @@ SHL1STDLIBS+= \ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ $(UCBHELPERLIB) \ + $(COMPHELPERLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(SALLIB) \ diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index e87599c1ceb5..9fe02ca543a9 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -37,6 +37,7 @@ #include #include /** === end UNO includes === **/ +#include #include #include @@ -1172,7 +1173,7 @@ namespace pcr //.............................................................. StlSyntaxSequence< ::rtl::OUString > lcl_convertMultiLineToList( const String& _rCompsedTextWithLineBreaks ) { - xub_StrLen nLines( _rCompsedTextWithLineBreaks.GetTokenCount( '\n' ) ); + xub_StrLen nLines( comphelper::string::getTokenCount(_rCompsedTextWithLineBreaks, '\n') ); StlSyntaxSequence< ::rtl::OUString > aStrings( nLines ); StlSyntaxSequence< ::rtl::OUString >::iterator stringItem = aStrings.begin(); for ( xub_StrLen token = 0; token < nLines; ++token, ++stringItem ) @@ -1271,7 +1272,7 @@ namespace pcr if (aStr.Len()>0) { long nDiff=0; - sal_Int32 nCount = aStr.GetTokenCount('\n'); + sal_Int32 nCount = comphelper::string::getTokenCount(aStr, '\n'); String aInput = aStr.GetToken(0,'\n' ); diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index b8d64f794097..5aac23ddbdd5 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -89,6 +89,7 @@ #include #include #include +#include #include #include #include @@ -781,7 +782,7 @@ sal_Bool EscherPropertyContainer::GetLineArrow( const sal_Bool bLineStart, else if ( aApiName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Arrow" ) ) ) reLineEnd = ESCHER_LineArrowEnd; } - else if ( aArrowStartName.GetTokenCount( ' ' ) == 2 ) + else if ( comphelper::string::getTokenCount(aArrowStartName, ' ') == 2 ) { sal_Bool b = sal_True; String aArrowName( aArrowStartName.GetToken( 0, ' ' ) ); diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 038dcbe0b12f..86d5b4f064d8 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -3973,7 +3974,7 @@ bool SvxMSDffManager::ReadObjText(SvStream& rSt, SdrObject* pObj) rOutliner.SetText( aText, rOutliner.GetParagraph( 0 ) ); // SHIFT-Ret ersetzen im Outliner - if(aText.GetTokenCount(0x0B) > 1) + if (comphelper::string::getTokenCount(aText, 0x0B) > 1) { sal_uInt32 nParaCount = rOutliner.GetParagraphCount(); for(sal_uInt16 a=0;a #include +#include #include +#include + #include #include @@ -88,7 +91,6 @@ #include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp" #include "fpinteraction.hxx" #include -#include #include #include @@ -324,41 +326,38 @@ namespace } //--------------------------------------------------------------------- - void convertStringListToUrls( const String& _rColonSeparatedList, ::std::vector< String >& _rTokens, bool _bFinalSlash ) + void convertStringListToUrls( const rtl::OUString& _rColonSeparatedList, ::std::vector< String >& _rTokens ) { - const sal_Unicode s_cSeparator = + const sal_Unicode cSeparator = #if defined(WNT) ';' #else ':' #endif ; - xub_StrLen nTokens = _rColonSeparatedList.GetTokenCount( s_cSeparator ); - _rTokens.resize( 0 ); _rTokens.reserve( nTokens ); - for ( xub_StrLen i=0; i= 0 ); } //--------------------------------------------------------------------- @@ -2234,7 +2233,7 @@ void SvtFileDialog::implInitializeSpecialURLLists( ) { ::rtl::OUString sFavouritesList; if ( getEnvironmentValue( "PathFavourites", sFavouritesList ) ) - convertStringListToUrls( sFavouritesList, aFavourites, false ); + convertStringListToUrls( sFavouritesList, aFavourites ); } DBG_ASSERT( _pImp->_pBtnStandard, "SvtFileDialog::implInitializeSpecialURLLists: how this?" ); @@ -3305,7 +3304,7 @@ void SvtFileDialog::appendDefaultExtension(String& _rFileName, if ( ! aType.EqualsAscii(FILEDIALOG_FILTER_ALL) ) { - sal_uInt16 nWildCard = aType.GetTokenCount( FILEDIALOG_DEF_EXTSEP ); + sal_uInt16 nWildCard = comphelper::string::getTokenCount(aType, FILEDIALOG_DEF_EXTSEP); sal_uInt16 nIndex, nPos = 0; for ( nIndex = 0; nIndex < nWildCard; nIndex++ ) diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx index bd1fbfb55509..041b57d34b7a 100644 --- a/l10ntools/source/export.cxx +++ b/l10ntools/source/export.cxx @@ -37,6 +37,7 @@ #include using comphelper::string::getToken; +using comphelper::string::getTokenCount; extern "C" { int yyerror( const char * ); } extern "C" { int YYWarning( const char * ); } @@ -791,8 +792,8 @@ int Export::Execute( int nToken, const char * pToken ) nListIndex = 0; nListLevel = 0; } - if (( sToken.Search( "{" ) != STRING_NOTFOUND ) && - ( sToken.GetTokenCount( '{' ) > sToken.GetTokenCount( '}' ))) + if ( (sToken.Search( "{" ) != STRING_NOTFOUND) && + ( getTokenCount(sToken, '{') > getTokenCount(sToken, '}') )) { Parse( LEVELUP, "" ); } @@ -888,7 +889,7 @@ int Export::Execute( int nToken, const char * pToken ) if ( nList ) { SetChildWithText(); ByteString sEntry(getToken(sToken, 1, '\"')); - if ( sToken.GetTokenCount( '\"' ) > 3 ) + if ( getTokenCount(sToken, '\"') > 3 ) sEntry += "\""; if ( sEntry == "\\\"" ) sEntry = "\""; @@ -1527,13 +1528,13 @@ ByteString Export::GetText( const ByteString &rSource, int nToken ) sTmp = comphelper::string::remove(sTmp, '\r'); while ( sTmp.SearchAndReplace( "\\\\\"", "-=<[BSlashBSlashHKom]>=-\"" ) - != STRING_NOTFOUND ) {}; + != STRING_NOTFOUND ) {} while ( sTmp.SearchAndReplace( "\\\"", "-=<[Hochkomma]>=-" ) - != STRING_NOTFOUND ) {}; + != STRING_NOTFOUND ) {} while ( sTmp.SearchAndReplace( "\\", "-=<[0x7F]>=-" ) - != STRING_NOTFOUND ) {}; + != STRING_NOTFOUND ) {} while ( sTmp.SearchAndReplace( "\\0x7F", "-=<[0x7F]>=-" ) - != STRING_NOTFOUND ) {}; + != STRING_NOTFOUND ) {} sal_uInt16 nStart = 0; sal_uInt16 nState = TXT_STATE_MACRO; @@ -1542,7 +1543,8 @@ ByteString Export::GetText( const ByteString &rSource, int nToken ) nStart = 1; - for ( sal_uInt16 i = nStart; i < sTmp.GetTokenCount( '\"' ); i++ ) { + for ( sal_uInt16 i = nStart; i < getTokenCount(sTmp, '\"'); ++i ) + { ByteString sToken = getToken(sTmp, i, '\"'); if ( sToken.Len()) { if ( nState == TXT_STATE_TEXT ) { diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx index 56708290d9ad..f8ee2e0a1726 100644 --- a/l10ntools/source/gsicheck.cxx +++ b/l10ntools/source/gsicheck.cxx @@ -36,6 +36,7 @@ #include "gsicheck.hxx" using comphelper::string::getToken; +using comphelper::string::getTokenCount; #define MAX_GID_LID_LEN 250 @@ -74,9 +75,9 @@ sal_Bool LanguageOK( ByteString aLang ) if (isdigitAsciiString(aLang)) return sal_True; - if ( aLang.GetTokenCount( '-' ) == 1 ) + if ( getTokenCount(aLang, '-') == 1 ) return islowerAsciiString(aLang); - else if ( aLang.GetTokenCount( '-' ) == 2 ) + else if ( getTokenCount(aLang, '-') == 2 ) { ByteString aTok0( getToken(aLang, 0, '-') ); ByteString aTok1( getToken(aLang, 1, '-') ); @@ -145,7 +146,7 @@ GSILine::GSILine( const ByteString &rLine, sal_uLong nLine ) , bOK( sal_True ) , bFixed ( sal_False ) { - if ( rLine.GetTokenCount( '\t' ) == 15 ) + if ( getTokenCount(rLine, '\t') == 15 ) { aFormat = FORMAT_SDF; aUniqId = getToken(rLine, 0, '\t'); @@ -465,7 +466,7 @@ sal_Bool GSIBlock::IsUTF8( const ByteString &aTestee, sal_Bool bFixTags, sal_uIn nAfterID += 7; nAfterID = nAfterID + aDelimiter.getLength(); } - else if ( aID.GetTokenCount( '.' ) > 1 ) + else if ( getTokenCount(aID, '.') > 1 ) { // test for old KeyIDs 5 to 6 digits followed by a dot '44373.' bNewId = sal_False; nErrorPos = 1; diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index f08310c26d28..6ff89316772e 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -523,7 +523,7 @@ void HelpParser::MakeDir( const ByteString& sPath ) ByteString sTPath( sPath ); rtl::OString sDelimiter(rtl::OUStringToOString(DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US)); sTPath.SearchAndReplaceAll( sDelimiter , rtl::OString('/') ); - sal_uInt16 cnt = sTPath.GetTokenCount( '/' ); + sal_uInt16 cnt = comphelper::string::getTokenCount(sTPath, '/'); rtl::OStringBuffer sCreateDir; for (sal_uInt16 i = 0; i < cnt; ++i) { diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx index e61b36db73aa..eaa0b39588d3 100644 --- a/l10ntools/source/lngmerge.cxx +++ b/l10ntools/source/lngmerge.cxx @@ -34,6 +34,7 @@ using namespace std; using comphelper::string::getToken; +using comphelper::string::getTokenCount; // // class LngParser @@ -256,7 +257,7 @@ sal_Bool LngParser::Merge( nPos ++; sLanguagesDone = ""; } - else if ( sLine.GetTokenCount( '=' ) > 1 ) + else if ( getTokenCount(sLine, '=') > 1 ) { ByteString sLang = getToken(sLine, 0, '='); sLang = comphelper::string::stripStart(sLang, ' '); diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index a857a65c0b85..b29d08e00fec 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -276,10 +276,11 @@ const ByteString SourceTreeLocalizer::GetProjectRootRel() sCur.SearchAndReplaceAll( sDelimiter, "/" ); sCur = comphelper::string::stripStart(sCur, '/'); - sal_uLong nCount = sCur.GetTokenCount( '/' ); + sal_Int32 nCount = comphelper::string::getTokenCount(sCur, '/'); ByteString sProjectRootRel; - for ( sal_uLong i = 0; i < nCount; i++ ) { + for (sal_Int32 i = 0; i < nCount; ++i) + { if ( sProjectRootRel.Len()) sProjectRootRel += sDelimiter; sProjectRootRel += ".."; diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 5141b9bdd259..fb397582a9a7 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -34,6 +34,7 @@ using namespace std; using comphelper::string::getToken; +using comphelper::string::getTokenCount; namespace { @@ -200,7 +201,7 @@ MergeDataFile::MergeDataFile( { xub_StrLen nToks; aInputStream.ReadLine( sLine ); - nToks = sLine.GetTokenCount( '\t' ); + nToks = getTokenCount(sLine, '\t'); if ( nToks == 15 ) { // Skip all wrong filenames diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index d6a0c620407e..791920d52119 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include #include "oox/helper/attributelist.hxx" #include "oox/helper/binaryinputstream.hxx" @@ -2519,7 +2520,7 @@ HtmlSelectModel::importBinaryModel( BinaryInputStream& rInStrm ) std::vector< sal_Int16 > selectedIndices; // Ultra hacky parser for the info - sal_Int32 nTokenCount = data.GetTokenCount( '\n' ); + sal_Int32 nTokenCount = comphelper::string::getTokenCount(data, '\n'); for ( sal_Int32 nToken = 0; nToken < nTokenCount; ++nToken ) { @@ -2532,7 +2533,7 @@ HtmlSelectModel::importBinaryModel( BinaryInputStream& rInStrm ) // skip first and last lines, no data there else if ( nToken < nTokenCount - 1) { - if ( sLine.GetTokenCount( '>' ) ) + if ( comphelper::string::getTokenCount(sLine, '>') ) { String displayValue = sLine.GetToken( 1, '>' ); if ( displayValue.Len() ) diff --git a/padmin/source/helper.cxx b/padmin/source/helper.cxx index 0a1cee5e557f..4ceee33f4d37 100644 --- a/padmin/source/helper.cxx +++ b/padmin/source/helper.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -117,7 +118,7 @@ void padmin::FindFiles( const String& rDirectory, ::std::list< String >& rResult aStatus.getFileType() == FileStatus::Link ) { String aFileName = aStatus.getFileName(); - int nToken = rSuffixes.GetTokenCount( ';' ); + int nToken = comphelper::string::getTokenCount(rSuffixes, ';'); while( nToken-- ) { String aSuffix = rSuffixes.GetToken( nToken, ';' ); diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx index 93dc64e823a8..fc80beac2444 100644 --- a/rsc/source/rsc/rsc.cxx +++ b/rsc/source/rsc/rsc.cxx @@ -74,6 +74,7 @@ using ::rtl::OString; using ::rtl::OStringBuffer; using ::rtl::OStringToOUString; using comphelper::string::getToken; +using comphelper::string::getTokenCount; /*************** F o r w a r d s *****************************************/ /*************** G l o b a l e V a r i a b l e n **********************/ @@ -1154,7 +1155,7 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, while( aIStm.ReadLine( aLine ) ) { - if( ( aLine.GetTokenCount( '=' ) == 2 ) && + if( ( getTokenCount(aLine, '=') == 2 ) && ( getToken(aLine, 0, '=').indexOf("File") != -1 ) ) { rtl::OString aBaseFileName( getToken(getToken(aLine, 1, '"'), 0, '.') ); 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 #include #include +#include #include @@ -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 #include #include -#include #include +#include #include #include #include @@ -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 #include #include #include @@ -152,10 +153,10 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged( SCSIZE nRows = 1; if (aLinkStr.Len()) { - nRows = static_cast(aLinkStr.GetTokenCount( '\n' )); + nRows = static_cast(comphelper::string::getTokenCount(aLinkStr, '\n')); aLine = aLinkStr.GetToken( 0, '\n' ); if (aLine.Len()) - nCols = static_cast(aLine.GetTokenCount( '\t' )); + nCols = static_cast(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 // qsort +#include #include #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 #include #include +#include #include #include #include @@ -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 + 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 #include #include @@ -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 #include #include @@ -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 #include #include // 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 #include +#include #include #include #include @@ -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 #include #include +#include #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 #include #include #include @@ -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 #include 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 #include #include -// ause #include "editutil.hxx" #include @@ -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; iisEqual( aStr, rList.GetToken(i,'\t') ) ) @@ -405,7 +405,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, aLbCustomLang.SelectLanguage(static_cast(nLanguage), true); // *** column type ListBox *** - xub_StrLen nCount = aColumnUser.GetTokenCount(); + xub_StrLen nCount = comphelper::string::getTokenCount(aColumnUser, ';'); for (xub_StrLen i=0; i #include + //======================================================================== // 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 #include #include #include @@ -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 #include #include #include @@ -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 #include #include #include @@ -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 #include #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 +#include #include #include #include @@ -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 #include #include @@ -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 #include +#include #include 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 #include #include @@ -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; iGetToken(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 #include -#include #include +#include +#include #include #define SOT_FORMATSTR_ID_STARCALC_CURRENT SOT_FORMATSTR_ID_STARCALC_50 @@ -656,10 +657,10 @@ bool ScViewFunc::PasteLink( const uno::Reference& 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'); } } } diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx index feab1338853c..f26fa686964c 100644 --- a/sd/source/core/CustomAnimationPreset.cxx +++ b/sd/source/core/CustomAnimationPreset.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -214,7 +215,7 @@ Reference< XAnimationNode > CustomAnimationPreset::create( const rtl::OUString& UStringList CustomAnimationPreset::getProperties() const { String aProperties( maProperty ); - sal_uInt16 nTokens = aProperties.GetTokenCount(); + sal_uInt16 nTokens = comphelper::string::getTokenCount(aProperties, ';'); sal_uInt16 nToken; UStringList aPropertyList; for( nToken = 0; nToken < nTokens; nToken++ ) @@ -228,7 +229,7 @@ bool CustomAnimationPreset::hasProperty( const OUString& rProperty )const { String aProperties( maProperty ); String aProperty( rProperty ); - sal_uInt16 nTokens = aProperties.GetTokenCount(); + sal_uInt16 nTokens = comphelper::string::getTokenCount(aProperties, ';'); sal_uInt16 nToken; for( nToken = 0; nToken < nTokens; nToken++ ) { diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 3c7469aea7cb..2e8493dbd6e2 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -433,7 +433,7 @@ sal_Bool ImplSdPPTImport::Import() sal_uInt32 nPageNumber = 0; String aString( pHyperlink->aSubAdress ); rtl::OString aStringAry[ 3 ]; - sal_uInt16 nTokenCount = aString.GetTokenCount( ',' ); + sal_uInt16 nTokenCount = comphelper::string::getTokenCount(aString, ','); if ( nTokenCount > 3 ) nTokenCount = 3; sal_uInt16 nToken; @@ -1943,7 +1943,7 @@ String ImplSdPPTImport::ReadSound(sal_uInt32 nSoundRef) const if ( SeekToRec( rStCtrl, PPT_PST_SoundData, nStrLen, &aSoundDataRecHd, 0 ) ) { String aGalleryDir( SvtPathOptions().GetGalleryPath() ); - INetURLObject aGalleryUserSound( aGalleryDir.GetToken( aGalleryDir.GetTokenCount( ';' ) - 1 ) ); + INetURLObject aGalleryUserSound( aGalleryDir.GetToken( comphelper::string::getTokenCount(aGalleryDir, ';') - 1 ) ); aGalleryUserSound.Append( aRetval ); sal_uInt32 nSoundDataLen = aSoundDataRecHd.nRecLen; diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index 87bac6d035b8..fac02eb1c0f3 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -488,7 +489,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest& rReq ) aStr.Append( sQuote ); aStr.Append( String(RTL_CONSTASCII_USTRINGPARAM("\"\n") ) ); - sal_uInt16 nParaCount = aStr.GetTokenCount( '\n' ); + sal_uInt16 nParaCount = comphelper::string::getTokenCount(aStr, '\n'); for( sal_uInt16 nPara = 0; nPara < nParaCount; nPara++ ) pOutliner->Insert( aStr.GetToken( nPara, '\n' ), LIST_APPEND, -1 ); diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index 1fed4c2fcd3f..0b20b058304d 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -32,6 +32,7 @@ #endif #include "copydlg.hxx" +#include #include #include #include @@ -167,7 +168,7 @@ IMPL_LINK( CopyDlg, Reset, void*, EMPTYARG ) const SfxPoolItem* pPoolItem = NULL; String aStr( GetExtraData() ); - if( aStr.GetTokenCount( TOKEN ) < 8 ) + if (comphelper::string::getTokenCount(aStr, TOKEN) < 8) { if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_NUMBER, sal_True, &pPoolItem ) ) maNumFldCopies.SetValue( ( ( const SfxUInt16Item* ) pPoolItem )->GetValue() ); diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index 4e6db4f6ae9f..4608f0d4e52e 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -368,7 +369,7 @@ void SdTPAction::Reset( const SfxItemSet& rAttrs ) case presentation::ClickAction_DOCUMENT: { - if( aFileName.GetTokenCount( DOCUMENT_TOKEN ) == 2 ) + if( comphelper::string::getTokenCount(aFileName, DOCUMENT_TOKEN) == 2 ) aLbTreeDocument.SelectEntry( aFileName.GetToken( 1, DOCUMENT_TOKEN ) ); } break; @@ -778,7 +779,7 @@ void SdTPAction::SetEditText( String const & rStr ) switch( eCA ) { case presentation::ClickAction_DOCUMENT: - if( rStr.GetTokenCount( DOCUMENT_TOKEN ) == 2 ) + if( comphelper::string::getTokenCount(rStr, DOCUMENT_TOKEN) == 2 ) aText = rStr.GetToken( 0, DOCUMENT_TOKEN ); // fallthrough inteded diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index c006ee7ae8d3..970289fac1d3 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -690,7 +690,7 @@ String SdTpOptionsMisc::GetScale( sal_Int32 nX, sal_Int32 nY ) sal_Bool SdTpOptionsMisc::SetScale( const String& aScale, sal_Int32& rX, sal_Int32& rY ) { - if( aScale.GetTokenCount( TOKEN ) != 2 ) + if( comphelper::string::getTokenCount(aScale, TOKEN) != 2 ) return( sal_False ); rtl::OUString aTmp(aScale.GetToken( 0, TOKEN )); diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 54b9b26e526a..ebb97496004c 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -50,15 +50,15 @@ #include #include #include -#include #include #include - -#include -#include #include +#include #include +#include +#include +#include #include #include @@ -733,7 +733,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) else if ( nSID == SID_OPENTEMPLATE ) { aPath = SvtPathOptions().GetTemplatePath(); - sal_Int32 nTokenCount = aPath.GetTokenCount( ';' ); + sal_Int32 nTokenCount = comphelper::string::getTokenCount(aPath, ';'); aPath = aPath.GetToken( sal::static_int_cast< xub_StrLen >( nTokenCount ? ( nTokenCount - 1 ) : 0 ), diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 99c5e3a44f59..8a555d557e96 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -111,7 +112,7 @@ class DisposeListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang:: sal_Bool GetPosSizeFromString( const String& rStr, Point& rPos, Size& rSize ) { - if ( rStr.GetTokenCount('/') != 4 ) + if ( comphelper::string::getTokenCount(rStr, '/') != 4 ) return sal_False; xub_StrLen nIdx = 0; @@ -134,7 +135,7 @@ sal_Bool GetSplitSizeFromString( const String& rStr, Size& rSize ) { String aStr = rStr.Copy( nIndex+1 ); - sal_Int32 nCount = aStr.GetTokenCount(';'); + sal_Int32 nCount = comphelper::string::getTokenCount(aStr, ';'); if ( nCount != 2 ) return sal_False; diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index e435e123b848..8bcfb94106db 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -1005,9 +1005,9 @@ SearchTabPage_Impl::SearchTabPage_Impl( Window* pParent, SfxHelpIndexWindow_Impl bChecked = ( 1 == aUserData.GetToken(1).ToInt32() ) ? sal_True : sal_False; aScopeCB.Check( bChecked ); - for ( sal_uInt16 i = 2; i < aUserData.GetTokenCount(); ++i ) + for ( sal_uInt16 i = 2; i < comphelper::string::getTokenCount(aUserData, ';'); ++i ) { - String aToken = aUserData.GetToken(i); + String aToken = aUserData.GetToken(i, ';'); aSearchED.InsertEntry( INetURLObject::decode( aToken, '%', INetURLObject::DECODE_WITH_CHARSET ) ); } @@ -2967,7 +2967,7 @@ void SfxHelpWindow_Impl::LoadConfig() if ( aUserItem >>= aTemp ) { aUserData = String( aTemp ); - DBG_ASSERT( aUserData.GetTokenCount() == 6, "invalid user data" ); + DBG_ASSERT( comphelper::string::getTokenCount(aUserData, ';') == 6, "invalid user data" ); sal_uInt16 nIdx = 0; nIndexSize = aUserData.GetToken( 0, ';', nIdx ).ToInt32(); nTextSize = aUserData.GetToken( 0, ';', nIdx ).ToInt32(); @@ -3068,7 +3068,7 @@ IMPL_LINK( SfxHelpWindow_Impl, OpenHdl, SfxHelpIndexWindow_Impl* , EMPTYARG ) { String aId; String aAnchor = String('#'); - if ( aEntry.GetTokenCount( '#' ) == 2 ) + if ( comphelper::string::getTokenCount(aEntry, '#') == 2 ) { aId = aEntry.GetToken( 0, '#' ); aAnchor += aEntry.GetToken( 1, '#' ); diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index acf69186d2ac..40758e224de9 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -47,6 +47,7 @@ #include #include +#include #include @@ -357,7 +358,7 @@ double SfxHTMLParser::GetTableDataOptionsValNum( sal_uInt32& nNumForm, rFormatter.GetFormatForLanguageIfBuiltIn( 0, eParseLang ); double fVal; rFormatter.IsNumberFormat( aValStr, nParseForm, fVal ); - if ( aNumStr.GetTokenCount( ';' ) > 2 ) + if ( comphelper::string::getTokenCount(aNumStr, ';') > 2 ) { eNumLang = (LanguageType)aNumStr.GetToken( 1, ';' ).ToInt32(); xub_StrLen nPos = aNumStr.Search( ';' ); diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 141b389504d3..25a07e3ea4b6 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1984,7 +1984,7 @@ void FileDialogHelper_Impl::saveConfig() aValue = xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_SELECTION, 0 ); sal_Bool bSelection = sal_True; aValue >>= bSelection; - if ( aUserData.GetTokenCount(' ') < 3 ) + if ( comphelper::string::getTokenCount(aUserData, ' ') < 3 ) aUserData.Append(' '); aUserData.SetToken( 2, ' ', String::CreateFromInt32( (sal_Int32) bSelection ) ); bWriteConfig = sal_True; diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index 98e5836fd58a..faaca46166ba 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -489,7 +489,7 @@ namespace sfx2 DBG_ASSERT( _rWildCard.GetBuffer()[0] != s_cWildcardSeparator, "AppendWildcardToDescriptor::AppendWildcardToDescriptor: wildcard already separated!" ); - aWildCards.reserve( _rWildCard.GetTokenCount( s_cWildcardSeparator ) ); + aWildCards.reserve( comphelper::string::getTokenCount(_rWildCard, s_cWildcardSeparator) ); const sal_Unicode* pTokenLoop = _rWildCard.GetBuffer(); const sal_Unicode* pTokenLoopEnd = pTokenLoop + _rWildCard.Len(); diff --git a/sfx2/source/dialog/srchdlg.cxx b/sfx2/source/dialog/srchdlg.cxx index fe48b4554fad..5ea75dd7f385 100644 --- a/sfx2/source/dialog/srchdlg.cxx +++ b/sfx2/source/dialog/srchdlg.cxx @@ -28,6 +28,7 @@ #include "srchdlg.hxx" +#include #include "sfx2/sfxresid.hxx" #include @@ -97,7 +98,7 @@ void SearchDialog::LoadConfig() if ( aUserItem >>= aTemp ) { String sUserData( aTemp ); - DBG_ASSERT( sUserData.GetTokenCount() == 5, "invalid config data" ); + DBG_ASSERT( comphelper::string::getTokenCount(sUserData, ';') == 5, "invalid config data" ); xub_StrLen nIdx = 0; String sSearchText = sUserData.GetToken( 0, ';', nIdx ); m_aWholeWordsBox.Check( sUserData.GetToken( 0, ';', nIdx ).ToInt32() == 1 ); diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 5eb55b5640ed..7dd7338dfe66 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -37,10 +37,11 @@ #include #include #include -#include #include -#include #include +#include +#include +#include #include #include #include @@ -585,7 +586,7 @@ void SfxDocTplService_Impl::getDirList() // TODO/LATER: let use service, register listener INetURLObject aURL; String aDirs = SvtPathOptions().GetTemplatePath(); - sal_uInt16 nCount = aDirs.GetTokenCount( C_DELIM ); + sal_uInt16 nCount = comphelper::string::getTokenCount(aDirs, C_DELIM); maTemplateDirs = Sequence< OUString >( nCount ); diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index d09978c482e4..94e6326ff54b 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -26,6 +26,7 @@ * ************************************************************************/ +#include #include #include #include @@ -550,7 +551,7 @@ SfxNewFileDialog_Impl::SfxNewFileDialog_Impl( } String &rExtra = pAntiImplP->GetExtraData(); - sal_uInt16 nTokCount = rExtra.GetTokenCount( '|' ); + sal_Int32 nTokCount = comphelper::string::getTokenCount(rExtra, '|'); if( nTokCount > 0 && nFlags ) MORE_BTN(SetState( rExtra.GetToken( 0, '|' ) == 'Y' )); if( nTokCount > 1 && nFlags ) diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 4dbc8a8897ad..d75b78b7e37e 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1072,7 +1072,7 @@ Size SmViewShell::GetTextLineSize(OutputDevice& rDevice, const String& rLine) String aText; Size aSize(rDevice.GetTextWidth(rLine), rDevice.GetTextHeight()); - sal_uInt16 nTabs = rLine.GetTokenCount('\t'); + sal_uInt16 nTabs = comphelper::string::getTokenCount(rLine, '\t'); if (nTabs > 0) { @@ -1104,7 +1104,7 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const String& rText, long M String aLine; Size TextSize; String aText; - sal_uInt16 nLines = rText.GetTokenCount('\n'); + sal_uInt16 nLines = comphelper::string::getTokenCount(rText, '\n'); for (sal_uInt16 i = 0; i < nLines; i++) { @@ -1164,7 +1164,7 @@ void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, co String aText; Point aPoint (rPosition); - sal_uInt16 nTabs = rLine.GetTokenCount('\t'); + sal_uInt16 nTabs = comphelper::string::getTokenCount(rLine, '\t'); if (nTabs > 0) { @@ -1191,7 +1191,7 @@ void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::DrawText" ); - sal_uInt16 nLines = rText.GetTokenCount('\n'); + sal_uInt16 nLines = comphelper::string::getTokenCount(rText, '\n'); Point aPoint (rPosition); Size aSize; String aLine; diff --git a/svl/source/misc/folderrestriction.cxx b/svl/source/misc/folderrestriction.cxx index e423be90a812..c03999ad4a1b 100644 --- a/svl/source/misc/folderrestriction.cxx +++ b/svl/source/misc/folderrestriction.cxx @@ -35,41 +35,42 @@ //----------------------------------------------------------------------------- static void convertStringListToUrls ( - const String& _rColonSeparatedList, ::std::vector< String >& _rTokens, bool _bFinalSlash ) + const rtl::OUString& _rColonSeparatedList, ::std::vector< String >& _rTokens, bool _bFinalSlash ) { - const sal_Unicode s_cSeparator = + const sal_Unicode cSeparator = #if defined(WNT) ';' #else ':' #endif ; - xub_StrLen nTokens = _rColonSeparatedList.GetTokenCount( s_cSeparator ); - _rTokens.resize( 0 ); _rTokens.reserve( nTokens ); - for ( xub_StrLen i=0; i= 0 ); } /** retrieves the value of an environment variable diff --git a/svl/source/misc/restrictedpaths.cxx b/svl/source/misc/restrictedpaths.cxx index 41f9067965aa..d743247e94fe 100644 --- a/svl/source/misc/restrictedpaths.cxx +++ b/svl/source/misc/restrictedpaths.cxx @@ -51,41 +51,38 @@ namespace svt } //----------------------------------------------------------------- - void lcl_convertStringListToUrls( const String& _rColonSeparatedList, ::std::vector< String >& _rTokens, bool _bFinalSlash ) + void lcl_convertStringListToUrls( const rtl::OUString& _rColonSeparatedList, ::std::vector< String >& _rTokens ) { - const sal_Unicode s_cSeparator = + const sal_Unicode cSeparator = #if defined(WNT) ';' #else ':' #endif ; - xub_StrLen nTokens = _rColonSeparatedList.GetTokenCount( s_cSeparator ); - _rTokens.resize( 0 ); _rTokens.reserve( nTokens ); - for ( xub_StrLen i=0; i= 0 ); } } @@ -175,7 +172,7 @@ namespace svt // append a final slash. This ensures that when we later on check // for unrestricted paths, we don't allow paths like "/home/user35" just because // "/home/user3" is allowed - with the final slash, we make it "/home/user3/". - lcl_convertStringListToUrls( sRestrictedPathList, m_aUnrestrictedURLs, true ); + lcl_convertStringListToUrls( sRestrictedPathList, m_aUnrestrictedURLs ); } RestrictedPaths::~RestrictedPaths() {} diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 9252df0c27bd..8457f5b58c27 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1988,7 +1988,7 @@ void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, String& rOutStr rtl_math_StringFormat_F, nPrecision /*2*/, GetFormatter().GetNumDecimalSep().GetChar(0), true ); if (rOutString.GetChar(0) == '-' && - rOutString.GetTokenCount('0') == rOutString.Len()) + comphelper::string::getTokenCount(rOutString, '0') == rOutString.Len()) rOutString.EraseLeadingChars('-'); // nicht -0 ImpTransliterate( rOutString, NumFor[0].GetNatNum() ); @@ -3856,7 +3856,7 @@ bool SvNumberformat::ImpGetNumberOutput(double fNumber, sStr.Erase( nPoint, 1 ); // . herausnehmen } if (bSign && - (sStr.Len() == 0 || sStr.GetTokenCount('0') == sStr.Len()+1)) // nur 00000 + (sStr.Len() == 0 || comphelper::string::getTokenCount(sStr, '0') == sStr.Len()+1)) // nur 00000 bSign = false; // nicht -0.00 } // End of != FLAG_STANDARD_IN_FORMAT diff --git a/svtools/bmpmaker/bmpsum.cxx b/svtools/bmpmaker/bmpsum.cxx index 72ddfde089d1..ead4930b4f09 100644 --- a/svtools/bmpmaker/bmpsum.cxx +++ b/svtools/bmpmaker/bmpsum.cxx @@ -428,10 +428,10 @@ void BmpSum::ProcessFileList( const String& rInFileList, aFileName.SearchAndReplaceAll( '\\', '/' ); - sal_uInt16 nTokenCount = aFileName.GetTokenCount( '/' ); + sal_Int32 nTokenCount = comphelper::string::getTokenCount(aFileName, '/'); DirEntry aNewDir( aBaseDir ); - for( sal_uInt16 n = 0; ( n < nTokenCount - 1 ); n++ ) + for (sal_Int32 n = 0; ( n < nTokenCount - 1 ); ++n) { aNewDir += DirEntry( comphelper::string::getToken(aFileName, n, '/') ); aNewDir.MakeDir(); diff --git a/svtools/inc/svtools/filter.hxx b/svtools/inc/svtools/filter.hxx index 7defa39b48a5..ce530b5d5ac6 100644 --- a/svtools/inc/svtools/filter.hxx +++ b/svtools/inc/svtools/filter.hxx @@ -269,7 +269,7 @@ private: protected: - String aFilterPath; + rtl::OUString aFilterPath; FilterConfigCache* pConfig; FilterErrorEx* pErrorEx; sal_Bool bAbort; @@ -288,7 +288,7 @@ public: GraphicFilter( sal_Bool bUseConfig = sal_True ); ~GraphicFilter(); - void SetFilterPath( const String& rFilterPath ) { aFilterPath = rFilterPath; }; + void SetFilterPath( const rtl::OUString& rFilterPath ) { aFilterPath = rFilterPath; }; sal_uInt16 GetImportFormatCount(); sal_uInt16 GetImportFormatNumber( const String& rFormatName ); diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx index 6090c865724c..fc553edd5113 100644 --- a/svtools/source/config/printoptions.cxx +++ b/svtools/source/config/printoptions.cxx @@ -48,8 +48,8 @@ #include #include - #include +#include #include @@ -178,10 +178,11 @@ SvtPrintOptions_Impl::SvtPrintOptions_Impl(const OUString& rConfigRoot) if (m_xCfg.is()) { - UniString sTmp = UniString(rConfigRoot); - xub_StrLen nTokenCount = sTmp.GetTokenCount('/'); - sTmp = sTmp.GetToken(nTokenCount - 1, '/'); - m_xCfg->getByName(OUString(sTmp.GetBuffer())) >>= m_xNode; + using comphelper::string::getTokenCount; + using comphelper::string::getToken; + sal_Int32 nTokenCount = getTokenCount(rConfigRoot, '/'); + rtl::OUString sTok = getToken(rConfigRoot, nTokenCount - 1, '/'); + m_xCfg->getByName(sTok) >>= m_xNode; } } catch (const css::uno::Exception& ex) diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index f726a091e0de..7717d467059c 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -145,9 +145,8 @@ namespace void FilterMatch::createWildCardFilterList(const String& _rFilterList,::std::vector< WildCard >& _rFilters) { if( _rFilterList.Len() ) - {// filter is given - xub_StrLen nCount = _rFilterList.GetTokenCount(); - _rFilters.reserve( nCount ); + { + // filter is given xub_StrLen nIndex = 0; OUString sToken; do diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index 3e61787e046c..fa322a79979f 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -34,14 +34,15 @@ #include #include #include +#include +#include #include #include +#include #include #include #include #include -#include -#include #include #include #include @@ -180,10 +181,14 @@ public: // first collect all known programmatic names StringBag aKnownNames; - String sLogicalFieldNames( SvtResId( STR_LOCAGICAL_FIELD_NAMES ) ); - sal_Int32 nTokenCount = sLogicalFieldNames.GetTokenCount(';'); - for (sal_Int32 i = 0; i= 0); // loop throuzh the given names const AliasProgrammaticPair* pFields = _rFields.getConstArray(); @@ -685,13 +690,13 @@ void AssignmentPersistentData::Commit() implScrollFields(0, sal_False, sal_False); // the logical names - String sLogicalFieldNames(SvtResId(STR_LOCAGICAL_FIELD_NAMES)); - sal_Int32 nAdjustedTokenCount = sLogicalFieldNames.GetTokenCount(';') + (m_pImpl->bOddFieldNumber ? 1 : 0); + rtl::OUString sLogicalFieldNames(ResId::toString(SvtResId(STR_LOCAGICAL_FIELD_NAMES))); + sal_Int32 nAdjustedTokenCount = comphelper::string::getTokenCount(sLogicalFieldNames, ';') + (m_pImpl->bOddFieldNumber ? 1 : 0); DBG_ASSERT(nAdjustedTokenCount == (sal_Int32)m_pImpl->aFieldLabels.size(), "AddressBookSourceDialog::AddressBookSourceDialog: inconsistence between logical and UI field names!"); m_pImpl->aLogicalFieldNames.reserve(nAdjustedTokenCount); for (sal_Int32 i = 0; iaLogicalFieldNames.push_back(sLogicalFieldNames.GetToken((sal_uInt16)i, ';')); + m_pImpl->aLogicalFieldNames.push_back(comphelper::string::getToken(sLogicalFieldNames, i, ';')); PostUserEvent(LINK(this, AddressBookSourceDialog, OnDelayedInitialize)); // so the dialog will at least show up before we do the loading of the diff --git a/svtools/source/filter/FilterConfigItem.cxx b/svtools/source/filter/FilterConfigItem.cxx index 831947f649ed..d97bfc059e1e 100644 --- a/svtools/source/filter/FilterConfigItem.cxx +++ b/svtools/source/filter/FilterConfigItem.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -47,21 +48,24 @@ using namespace ::com::sun::star::awt ; // Size using namespace ::com::sun::star::container ; // using namespace ::com::sun::star::task ; // XStatusIndicator -static sal_Bool ImpIsTreeAvailable( Reference< XMultiServiceFactory >& rXCfgProv, const String& rTree ) +static sal_Bool ImpIsTreeAvailable( Reference< XMultiServiceFactory >& rXCfgProv, const rtl::OUString& rTree ) { - sal_Bool bAvailable = rTree.Len() != 0; + sal_Bool bAvailable = !rTree.isEmpty(); if ( bAvailable ) { - xub_StrLen nTokenCount = rTree.GetTokenCount( (sal_Unicode)'/' ); - xub_StrLen i = 0; + using comphelper::string::getTokenCount; + using comphelper::string::getToken; - if ( rTree.GetChar( 0 ) == (sal_Unicode)'/' ) - i++; - if ( rTree.GetChar( rTree.Len() - 1 ) == (sal_Unicode)'/' ) - nTokenCount--; + sal_Int32 nTokenCount = getTokenCount(rTree, '/'); + sal_Int32 i = 0; + + if ( rTree[0] == '/' ) + ++i; + if ( rTree[rTree.getLength() - 1] == '/' ) + --nTokenCount; Any aAny; - aAny <<= (OUString)rTree.GetToken( i++, (sal_Unicode)'/' ); + aAny <<= getToken(rTree, i++, '/'); // creation arguments: nodepath PropertyValue aPathArgument; @@ -78,7 +82,7 @@ static sal_Bool ImpIsTreeAvailable( Reference< XMultiServiceFactory >& rXCfgProv OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" ) ), aArguments ); } - catch ( ::com::sun::star::uno::Exception& ) + catch (const ::com::sun::star::uno::Exception&) { bAvailable = sal_False; } @@ -93,7 +97,7 @@ static sal_Bool ImpIsTreeAvailable( Reference< XMultiServiceFactory >& rXCfgProv bAvailable = sal_False; else { - String aNode( rTree.GetToken( i, (sal_Unicode)'/' ) ); + rtl::OUString aNode( getToken(rTree, i, '/') ); if ( !xHierarchicalNameAccess->hasByHierarchicalName( aNode ) ) bAvailable = sal_False; else @@ -131,7 +135,7 @@ void FilterConfigItem::ImpInitTree( const String& rSubTree ) OUString sTree( OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.")) + rSubTree); - if ( ImpIsTreeAvailable( xCfgProv, String( sTree ) ) ) + if ( ImpIsTreeAvailable(xCfgProv, sTree) ) { Any aAny; // creation arguments: nodepath diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx index 8047b7b74e00..89dd2dba4bc0 100644 --- a/svtools/source/filter/filter.cxx +++ b/svtools/source/filter/filter.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -66,7 +67,6 @@ #include #include #include -#include #include #include #include @@ -87,6 +87,9 @@ using namespace ::rtl; using namespace ::com::sun::star; +using comphelper::string::getTokenCount; +using comphelper::string::getToken; + typedef ::std::vector< GraphicFilter* > FilterList_impl; static FilterList_impl* pFilterHdlList = NULL; @@ -1634,11 +1637,11 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, { ImpFilterLibCacheEntry* pFilter = NULL; - // find first filter in filter pathes - xub_StrLen i, nTokenCount = aFilterPath.GetTokenCount( ';' ); + // find first filter in filter paths + sal_Int32 i, nTokenCount = getTokenCount(aFilterPath, ';'); ImpFilterLibCache &rCache = Cache::get(); for( i = 0; ( i < nTokenCount ) && ( pFilter == NULL ); i++ ) - pFilter = rCache.GetFilter( aFilterPath.GetToken(i), aFilterName ); + pFilter = rCache.GetFilter( getToken(aFilterPath, i, ';'), aFilterName ); if( !pFilter ) nStatus = GRFILTER_FILTERERROR; else @@ -2055,10 +2058,10 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& } else { - xub_StrLen i, nTokenCount = aFilterPath.GetTokenCount( ';' ); + sal_Int32 i, nTokenCount = getTokenCount(aFilterPath, ';'); for ( i = 0; i < nTokenCount; i++ ) { - String aPhysicalName( ImpCreateFullFilterPath( aFilterPath.GetToken( i ), aFilterName ) ); + String aPhysicalName( ImpCreateFullFilterPath( getToken(aFilterPath, i, ';'), aFilterName ) ); osl::Module aLibrary( aPhysicalName ); PFilterCall pFunc = (PFilterCall) aLibrary.getFunctionSymbol( UniString::CreateFromAscii( EXPORT_FUNCTION_NAME ) ); diff --git a/svtools/source/filter/ixbm/xbmread.cxx b/svtools/source/filter/ixbm/xbmread.cxx index ff21e59f3728..559f12190375 100644 --- a/svtools/source/filter/ixbm/xbmread.cxx +++ b/svtools/source/filter/ixbm/xbmread.cxx @@ -227,13 +227,13 @@ sal_Bool XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XB if( aLine.Len() ) { - const sal_uInt16 nCount = aLine.GetTokenCount( ',' ); + const sal_Int32 nCount = comphelper::string::getTokenCount(aLine, ','); - for( sal_uInt16 i = 0; ( i < nCount ) && ( nRow < nHeight ); i++ ) + for( sal_Int32 i = 0; ( i < nCount ) && ( nRow < nHeight ); ++i ) { const rtl::OString aToken(comphelper::string::getToken(aLine,i, ',')); const sal_Int32 nLen = aToken.getLength(); - sal_Bool bProcessed = sal_False; + sal_Bool bProcessed = sal_False; nBit = nDigits = nValue = 0; diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx index 171d141a4e88..8848c1f0bd48 100644 --- a/svtools/source/filter/sgvtext.cxx +++ b/svtools/source/filter/sgvtext.cxx @@ -1162,8 +1162,7 @@ SgfFontOne::SgfFontOne() void SgfFontOne::ReadOne( const rtl::OString& rID, ByteString& Dsc ) { - sal_uInt16 i,j,n; - rtl::OString s; + sal_uInt16 i,j; if ( Dsc.Len() < 4 || ( Dsc.GetChar( 0 ) != '(' ) ) return; @@ -1185,10 +1184,10 @@ void SgfFontOne::ReadOne( const rtl::OString& rID, ByteString& Dsc ) Dsc.Erase(i,j); IFID = (sal_uInt32)rID.toInt32(); - n=Dsc.GetTokenCount(' '); - for (i=0;i= 0 ); // normalize the array (which basically means "sort it") normalize( m_aCurrentState ); diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index d77e36de3ac8..c8e8ab253757 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -2178,7 +2178,7 @@ bool HTMLParser::ParseMetaOptionsImpl( case HTML_META_CREATED: case HTML_META_CHANGED: if ( i_xDocProps.is() && aContent.Len() && - aContent.GetTokenCount() == 2 ) + comphelper::string::getTokenCount(aContent, ';') == 2 ) { Date aDate( (sal_uLong)aContent.GetToken(0).ToInt32() ); Time aTime( (sal_uLong)aContent.GetToken(1).ToInt32() ); diff --git a/svx/inc/svx/gallery1.hxx b/svx/inc/svx/gallery1.hxx index de6ebc684a32..aad41fa28341 100644 --- a/svx/inc/svx/gallery1.hxx +++ b/svx/inc/svx/gallery1.hxx @@ -139,7 +139,7 @@ private: sal_uIntPtr nLastFileNumber; sal_Bool bMultiPath; - void ImplLoad( const String& rMultiPath ); + void ImplLoad( const rtl::OUString& rMultiPath ); void ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbIsReadOnly ); void ImplLoadImports(); void ImplWriteImportList(); @@ -151,7 +151,7 @@ private: GalleryTheme* ImplGetCachedTheme( const GalleryThemeEntry* pThemeEntry ); void ImplDeleteCachedTheme( GalleryTheme* pTheme ); - SVX_DLLPUBLIC Gallery( const String& rMultiPath ); + SVX_DLLPUBLIC Gallery( const rtl::OUString& rMultiPath ); SVX_DLLPUBLIC ~Gallery(); public: diff --git a/svx/inc/svx/simptabl.hxx b/svx/inc/svx/simptabl.hxx index 9867707a80ed..c192458be2c8 100644 --- a/svx/inc/svx/simptabl.hxx +++ b/svx/inc/svx/simptabl.hxx @@ -106,7 +106,7 @@ public: void UpdateViewSize(); - void InsertHeaderEntry(const XubString& rText, + void InsertHeaderEntry(const rtl::OUString& rText, sal_uInt16 nCol=HEADERBAR_APPEND, HeaderBarItemBits nBits = HIB_STDSTYLE); diff --git a/svx/source/dialog/simptabl.cxx b/svx/source/dialog/simptabl.cxx index 7acf8cb2eef8..c9fae16aca3a 100644 --- a/svx/source/dialog/simptabl.cxx +++ b/svx/source/dialog/simptabl.cxx @@ -229,23 +229,23 @@ void SvxSimpleTable::Paint( const Rectangle& rRect ) } bPaintFlag=sal_True; } -void SvxSimpleTable::InsertHeaderEntry(const XubString& rText,sal_uInt16 nCol, - HeaderBarItemBits nBits) +void SvxSimpleTable::InsertHeaderEntry(const rtl::OUString& rText, + sal_uInt16 nCol, HeaderBarItemBits nBits) { - xub_StrLen nEnd = rText.Search( sal_Unicode( '\t' ) ); - if( nEnd == STRING_NOTFOUND ) + sal_Int32 nEnd = rText.indexOf( sal_Unicode( '\t' ) ); + if( nEnd == -1 ) { aHeaderBar.InsertItem(nHeaderItemId++, rText, 0, nBits, nCol); } else { - xub_StrLen nCount = rText.GetTokenCount( sal_Unicode( '\t' ) ); - - for( xub_StrLen i=0; i= 0 ); } SetTabs(); } diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 206deda01fd1..c185be6ec6f2 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -432,7 +432,7 @@ FmFormObj& FmFormObj::operator= (const FmFormObj& rObj) //------------------------------------------------------------------ namespace { - String lcl_getFormComponentAccessPath(const Reference< XInterface >& _xElement, Reference< XInterface >& _rTopLevelElement) + rtl::OUString lcl_getFormComponentAccessPath(const Reference< XInterface >& _xElement, Reference< XInterface >& _rTopLevelElement) { Reference< ::com::sun::star::form::XFormComponent> xChild(_xElement, UNO_QUERY); Reference< ::com::sun::star::container::XIndexAccess> xParent; @@ -471,7 +471,7 @@ namespace Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > & _rSourceContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > _rTopLevelDestContainer) { Reference< XInterface > xTopLevelSouce; - String sAccessPath = lcl_getFormComponentAccessPath(_rSourceContainer, xTopLevelSouce); + rtl::OUString sAccessPath = lcl_getFormComponentAccessPath(_rSourceContainer, xTopLevelSouce); if (!xTopLevelSouce.is()) // somthing went wrong, maybe _rSourceContainer isn't part of a valid forms hierarchy return Reference< XInterface > (); @@ -480,9 +480,11 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > Reference< XIndexContainer > xSourceContainer(xTopLevelSouce, UNO_QUERY); DBG_ASSERT(xSourceContainer.is(), "FmFormObj::ensureModelEnv : the top level source is invalid !"); - for (xub_StrLen i=0; igetCount(), "FmFormObj::ensureModelEnv : invalid access path !"); @@ -604,6 +606,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > xSourceContainer = Reference< XIndexContainer > (xSourceForm, UNO_QUERY); DBG_ASSERT(xDestContainer.is() && xSourceContainer.is(), "FmFormObj::ensureModelEnv : invalid container !"); } + while ( nTokIndex >= 0 ); return Reference< XInterface > (xDestContainer, UNO_QUERY); } diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 04751bb2d40d..9c6d3a5767b2 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -93,6 +93,7 @@ #include #include #include +#include #include #include #include @@ -424,10 +425,10 @@ namespace const Type* pCurrentListeners = pCurrentArray->getConstArray(); for (j=0; jgetLength(); ++j, ++pCurrentListeners) { - UniString aListener = (*pCurrentListeners).getTypeName(); - xub_StrLen nTokens = aListener.GetTokenCount('.'); + rtl::OUString aListener = (*pCurrentListeners).getTypeName(); + sal_Int32 nTokens = comphelper::string::getTokenCount(aListener, '.'); if (nTokens) - aListener = aListener.GetToken(nTokens - 1, '.'); + aListener = comphelper::string::getToken(aListener, nTokens - 1, '.'); if (aListener == pCurrent->ListenerType.getStr()) // the current ScriptEventDescriptor doesn't match the current listeners class diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx index b4df4ed97cdb..419f419606d2 100644 --- a/svx/source/form/fmsrcimp.cxx +++ b/svx/source/form/fmsrcimp.cxx @@ -886,11 +886,11 @@ void FmSearchEngine::Init(const ::rtl::OUString& sVisibleFields) ::rtl::OUString sCurrentField; - UniString sVis(sVisibleFields.getStr()); - xub_StrLen nLen = sVis.GetTokenCount(); - for (xub_StrLen i=0; i= 0 ); } catch (const Exception&) { diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index d1a554ba9e72..46311b3ea560 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -27,7 +27,7 @@ ************************************************************************/ - +#include #include #include #include @@ -1123,7 +1123,7 @@ String GalleryBrowser2::GetItemText( const GalleryTheme& rTheme, const SgaObject if( !aTitle.Len() ) { aTitle = aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ); - aTitle = aTitle.GetToken( aTitle.GetTokenCount( '/' ) - 1, '/' ); + aTitle = aTitle.GetToken( comphelper::string::getTokenCount(aTitle, '/') - 1, '/' ); } aRet += aTitle; diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index 2170c1f218f1..7a26e0dee8c5 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -27,6 +27,7 @@ ************************************************************************/ +#include #include #include #include @@ -178,7 +179,7 @@ public: // - Gallery - // ----------- -Gallery::Gallery( const String& rMultiPath ) +Gallery::Gallery( const rtl::OUString& rMultiPath ) : nReadTextEncoding ( osl_getThreadTextEncoding() ) , nLastFileNumber ( 0 ) , bMultiPath ( sal_False ) @@ -221,9 +222,9 @@ Gallery* Gallery::GetGalleryInstance() // ------------------------------------------------------------------------ -void Gallery::ImplLoad( const String& rMultiPath ) +void Gallery::ImplLoad( const rtl::OUString& rMultiPath ) { - const sal_uInt16 nTokenCount = rMultiPath.GetTokenCount( ';' ); + const sal_Int32 nTokenCount = comphelper::string::getTokenCount(rMultiPath, ';'); sal_Bool bIsReadOnlyDir; bMultiPath = ( nTokenCount > 0 ); @@ -236,11 +237,11 @@ void Gallery::ImplLoad( const String& rMultiPath ) if( bMultiPath ) { - aRelURL = INetURLObject( rMultiPath.GetToken( 0, ';' ) ); + aRelURL = INetURLObject( comphelper::string::getToken(rMultiPath, 0, ';') ); - for( sal_uInt16 i = 0UL; i < nTokenCount; i++ ) + for( sal_Int32 i = 0; i < nTokenCount; ++i ) { - aCurURL = INetURLObject(rMultiPath.GetToken( i, ';' )); + aCurURL = INetURLObject(comphelper::string::getToken(rMultiPath, i, ';')); ImplLoadSubDirs( aCurURL, bIsReadOnlyDir ); diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index 79602e003265..aa4c1ee74629 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -232,7 +233,7 @@ String GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen ) { String aReduced( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ); - aReduced = aReduced.GetToken( aReduced.GetTokenCount( '/' ) - 1, '/' ); + aReduced = aReduced.GetToken( comphelper::string::getTokenCount(aReduced, '/') - 1, '/' ); if( INET_PROT_PRIV_SOFFICE != rURL.GetProtocol() ) { @@ -261,7 +262,7 @@ String GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL ) String aRet; if( rSvDrawObjURL.GetProtocol() == INET_PROT_PRIV_SOFFICE && - String(rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE )).GetTokenCount( '/' ) == 3 ) + comphelper::string::getTokenCount(rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE ), '/') == 3 ) { aRet = String(rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE )).GetToken( 2, '/' ); } diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index 9bfa16ba489a..f0db928d3824 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -196,7 +197,7 @@ const String SgaObject::GetTitle() const String aReturnValue( aTitle ); if ( !getenv( "GALLERY_SHOW_PRIVATE_TITLE" ) ) { - if ( aReturnValue.GetTokenCount( ':' ) == 3 ) + if ( comphelper::string::getTokenCount(aReturnValue, ':') == 3 ) { String aPrivateInd ( aReturnValue.GetToken( 0, ':' ) ); String aResourceName( aReturnValue.GetToken( 1, ':' ) ); diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 3d615199d431..0a3d332fbda6 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -26,6 +26,7 @@ * ************************************************************************/ +#include #include #include #include @@ -431,8 +432,8 @@ sal_Bool SvXMLGraphicHelper::ImplGetStreamNames( const ::rtl::OUString& rURLStr, if( aURLStr.Len() ) { - aURLStr = aURLStr.GetToken( aURLStr.GetTokenCount( ':' ) - 1, ':' ); - const sal_uInt32 nTokenCount = aURLStr.GetTokenCount( '/' ); + aURLStr = aURLStr.GetToken( comphelper::string::getTokenCount(aURLStr, ':') - 1, ':' ); + const sal_uInt32 nTokenCount = comphelper::string::getTokenCount(aURLStr, '/'); if( 1 == nTokenCount ) { diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index a0a40c0fac40..c8888530e5e1 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -30,7 +30,7 @@ #include #include - +#include #define _SVSTDARR_STRINGSSORT #include #include @@ -1266,7 +1266,7 @@ void SwTOXBaseSection::UpdateTemplate( const SwTxtNode* pOwnChapterNode ) for(sal_uInt16 i = 0; i < MAXLEVEL; i++) { String sTmpStyleNames = GetStyleNames(i); - sal_uInt16 nTokenCount = sTmpStyleNames.GetTokenCount(TOX_STYLE_DELIMITER); + sal_uInt16 nTokenCount = comphelper::string::getTokenCount(sTmpStyleNames, TOX_STYLE_DELIMITER); for( sal_uInt16 nStyle = 0; nStyle < nTokenCount; ++nStyle ) { SwTxtFmtColl* pColl = pDoc->FindTxtFmtCollByName( diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index 5d9241e169b1..33b953e0beb9 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -49,6 +49,7 @@ #include #include #include +#include const sal_Unicode cRelTrenner = ','; const sal_Unicode cRelKennung = ''; // CTRL-R @@ -647,7 +648,7 @@ String SwTableFormula::ScanString( FnScanFormel fnFormel, const SwTable& rTbl, // falls im Namen schon die Punkte enthalten sind, // treten diese immer paarig auf!!! (A1.1.1 !!) - if( (sTblNm.GetTokenCount( '.' ) - 1 ) & 1 ) + if( (comphelper::string::getTokenCount(sTblNm, '.') - 1) & 1 ) { sTblNm.Erase( nTrenner - nStt ); @@ -1065,7 +1066,7 @@ void SwTableFormula::_SplitMergeBoxNm( const SwTable& rTbl, String& rNewStr, if( STRING_NOTFOUND != nTrenner && // falls im Namen schon die Punkte enthalten sind, // treten diese immer paarig auf!!! (A1.1.1 !!) - (pTblNmBox->GetTokenCount( '.' ) - 1 ) & 1 ) + (comphelper::string::getTokenCount(*pTblNmBox, '.') - 1) & 1 ) { sTblNm = pTblNmBox->Copy( 0, nTrenner ); pTblNmBox->Erase( 0, nTrenner + 1);// den Punkt entfernen diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index 6cc3e9197741..cd654f5e3ef3 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -378,7 +378,7 @@ bool SwDDEFieldType::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId ) if( nPart ) { String sTmp, sCmd( GetCmd() ); - while(3 > sCmd.GetTokenCount(sfx2::cTokenSeperator)) + while(3 > comphelper::string::getTokenCount(sCmd, sfx2::cTokenSeperator)) sCmd += sfx2::cTokenSeperator; sCmd.SetToken( nPart-1, sfx2::cTokenSeperator, ::GetString( rVal, sTmp ) ); SetCmd( sCmd ); diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 74366eaf9b2d..ce8a06d18b93 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1418,7 +1418,7 @@ void SwHiddenTxtField::Evaluate(SwDoc* pDoc) bValid = sal_True; } else if(sTmpName.Search('\"') == STRING_NOTFOUND && - sTmpName.GetTokenCount('.') > 2) + comphelper::string::getTokenCount(sTmpName, '.') > 2) { ::ReplacePoint(sTmpName); if(sTmpName.GetChar(0) == '[' && sTmpName.GetChar(sTmpName.Len()-1) == ']') diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 6aa5247a8c29..0960456b2f7d 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #define SN_DATA_PROVIDER "com.sun.star.chart2.data.DataProvider" #define SN_DATA_SOURCE "com.sun.star.chart2.data.DataSource" @@ -475,7 +476,7 @@ static sal_Bool GetSubranges( const OUString &rRangeRepresentation, { sal_Bool bRes = sal_True; String aRangesStr( rRangeRepresentation ); - xub_StrLen nLen = aRangesStr.GetTokenCount( ';' ); + xub_StrLen nLen = comphelper::string::getTokenCount(aRangesStr, ';'); uno::Sequence< OUString > aRanges( nLen ); sal_Int32 nCnt = 0; @@ -1779,7 +1780,7 @@ rtl::OUString SAL_CALL SwChartDataProvider::convertRangeToXML( const rtl::OUStri // multiple ranges are delimeted by a ';' like in // "Table1.A1:A4;Table1.C2:C5" the same table must be used in all ranges! - xub_StrLen nNumRanges = aRangeRepresentation.GetTokenCount( ';' ); + xub_StrLen nNumRanges = comphelper::string::getTokenCount(aRangeRepresentation, ';'); SwTable* pFirstFoundTable = 0; // to check that only one table will be used for (sal_uInt16 i = 0; i < nNumRanges; ++i) { @@ -1847,7 +1848,7 @@ rtl::OUString SAL_CALL SwChartDataProvider::convertRangeFromXML( const rtl::OUSt // multiple ranges are delimeted by a ' ' like in // "Table1.$A$1:.$A$4 Table1.$C$2:.$C$5" the same table must be used in all ranges! - xub_StrLen nNumRanges = aXMLRange.GetTokenCount( ' ' ); + xub_StrLen nNumRanges = comphelper::string::getTokenCount(aXMLRange, ' '); rtl::OUString aFirstFoundTable; // to check that only one table will be used for (sal_uInt16 i = 0; i < nNumRanges; ++i) { diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 2e4785fbe7fc..113cbca373c7 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -44,9 +44,10 @@ #include #include #include -#include #include #include +#include +#include #include #include #include @@ -2444,7 +2445,7 @@ sal_uInt16 lcl_GetIdByName( String& rName, String& rTypeName ) else if(rTypeName.EqualsAscii("DataBase")) { rName.Erase( 0, RTL_CONSTASCII_LENGTH( "DataBase." )); - sal_uInt16 nDotCount = rName.GetTokenCount('.'); + sal_uInt16 nDotCount = comphelper::string::getTokenCount(rName, '.'); if( 2 <= nDotCount ) { // #i51815# diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 3ba05bd213a2..50e7f59e9cfb 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -64,6 +64,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -2663,7 +2664,7 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, const String& rStyles = rTOXBase.GetStyleNames(static_cast(nIndex)); - const sal_uInt16 nStyles = rStyles.GetTokenCount(TOX_STYLE_DELIMITER); + const sal_uInt16 nStyles = comphelper::string::getTokenCount(rStyles, TOX_STYLE_DELIMITER); uno::Sequence aStyles(nStyles); OUString* pStyles = aStyles.getArray(); String aString; diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 1524d8240ad6..916607fc9505 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -64,6 +64,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -734,7 +735,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, pSectionData->SetType(FILE_LINK_SECTION); } String sSectLink(pSectionData->GetLinkFileName()); - while (3 < sSectLink.GetTokenCount(sfx2::cTokenSeperator)) + while (3 < comphelper::string::getTokenCount(sSectLink, sfx2::cTokenSeperator)) { sSectLink += sfx2::cTokenSeperator; } diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 9f54c2e52c3f..e3f3c1c0c984 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -184,7 +185,7 @@ void lcl_html_outEvents( SvStream& rStrm, continue; String sListener( pDescs[i].ListenerType ); - xub_StrLen nTok = sListener.GetTokenCount( '.' ); + xub_StrLen nTok = comphelper::string::getTokenCount(sListener, '.'); if( nTok ) sListener = sListener.GetToken( nTok-1, '.' ); String sMethod( pDescs[i].EventMethod ); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index d9f33762d60a..b23bcc075e0f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -41,6 +41,7 @@ #include "charfmt.hxx" #include "breakit.hxx" +#include #include #include #include @@ -754,7 +755,7 @@ void DocxAttributeOutput::DoWriteCmd( String& rCmd ) void DocxAttributeOutput::CmdField_Impl( FieldInfos& rInfos ) { m_pSerializer->startElementNS( XML_w, XML_r, FSEND ); - xub_StrLen nNbToken = rInfos.sCmd.GetTokenCount( '\t' ); + xub_StrLen nNbToken = comphelper::string::getTokenCount(rInfos.sCmd, '\t'); for ( xub_StrLen i = 0; i < nNbToken; i++ ) { diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx index 14ddf487327e..3cf79b4077cf 100644 --- a/sw/source/ui/app/appenv.cxx +++ b/sw/source/ui/app/appenv.cxx @@ -119,7 +119,7 @@ String InsertLabEnvText( SwWrtShell& rSh, SwFldMgr& rFldMgr, const String& rText // Database fields must contain at least 3 points! String sDBName( sTmpText.Copy( 1, sTmpText.Len() - 2)); - sal_uInt16 nCnt = sDBName.GetTokenCount('.'); + sal_uInt16 nCnt = comphelper::string::getTokenCount(sDBName, '.'); if (nCnt >= 3) { ::ReplacePoint(sDBName, sal_True); diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 7c2a3eabf9b0..848b91eba95a 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -416,7 +417,7 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( if(bRead) { //header line - xub_StrLen nHeaders = sLine.GetTokenCount('\t'); + xub_StrLen nHeaders = comphelper::string::getTokenCount(sLine, '\t'); xub_StrLen nIndex = 0; for( xub_StrLen nToken = 0; nToken < nHeaders; ++nToken) { @@ -434,7 +435,7 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( { ::std::vector aNewData; //analyze data line - xub_StrLen nDataCount = sLine.GetTokenCount('\t'); + xub_StrLen nDataCount = comphelper::string::getTokenCount(sLine, '\t'); xub_StrLen nIndex = 0; for( xub_StrLen nToken = 0; nToken < nDataCount; ++nToken) { diff --git a/sw/source/ui/dbui/mailmergechildwindow.cxx b/sw/source/ui/dbui/mailmergechildwindow.cxx index 8ca13c0a97a0..f76e1dd7f831 100644 --- a/sw/source/ui/dbui/mailmergechildwindow.cxx +++ b/sw/source/ui/dbui/mailmergechildwindow.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include "com/sun/star/mail/XSmtpService.hpp" #include "com/sun/star/mail/MailServiceType.hpp" #include @@ -600,7 +601,7 @@ void SwSendMailDialog::IterateMails() if(pCurrentMailDescriptor->sCC.getLength()) { String sTokens( pCurrentMailDescriptor->sCC ); - sal_uInt16 nTokens = sTokens.GetTokenCount( ';' ); + sal_uInt16 nTokens = comphelper::string::getTokenCount(sTokens, ';'); xub_StrLen nPos = 0; for( sal_uInt16 nToken = 0; nToken < nTokens; ++nToken) { @@ -612,7 +613,7 @@ void SwSendMailDialog::IterateMails() if(pCurrentMailDescriptor->sBCC.getLength()) { String sTokens( pCurrentMailDescriptor->sBCC ); - sal_uInt16 nTokens = sTokens.GetTokenCount( ';' ); + sal_uInt16 nTokens = comphelper::string::getTokenCount(sTokens, ';'); xub_StrLen nPos = 0; for( sal_uInt16 nToken = 0; nToken < nTokens; ++nToken) { diff --git a/sw/source/ui/dbui/mailmergehelper.cxx b/sw/source/ui/dbui/mailmergehelper.cxx index 9f466898a315..13d7705a7181 100644 --- a/sw/source/ui/dbui/mailmergehelper.cxx +++ b/sw/source/ui/dbui/mailmergehelper.cxx @@ -43,6 +43,7 @@ #include "com/sun/star/mail/MailServiceProvider.hpp" #include "com/sun/star/mail/XSmtpService.hpp" #include +#include #include #include @@ -87,10 +88,10 @@ String CallSaveAsDialog(String& rFilter) bool CheckMailAddress( const ::rtl::OUString& rMailAddress ) { String sAddress(rMailAddress); - if(!(sAddress.GetTokenCount('@') == 2)) + if (!(comphelper::string::getTokenCount(sAddress, '@') == 2)) return false; sAddress = sAddress.GetToken(1, '@'); - if(sAddress.GetTokenCount('.') < 2) + if (comphelper::string::getTokenCount(sAddress, '.') < 2) return false; if(sAddress.GetToken( 0, '.').Len() < 2 || sAddress.GetToken( 1, '.').Len() < 2) return false; @@ -444,7 +445,7 @@ void SwAddressPreview::DrawText_Impl( } sal_Int32 nHeight = GetTextHeight(); String sAddress(rAddress); - sal_uInt16 nTokens = sAddress.GetTokenCount('\n'); + sal_uInt16 nTokens = comphelper::string::getTokenCount(sAddress, '\n'); Point aStart = rTopLeft; //put it away from the border aStart.Move( 2, 2); diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 04f7735e065c..ea332d3e4343 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -973,7 +973,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendTypeHdl_Impl, ListBox*, pBox) //do nothing if the user has removed the name - the warning will come early enough if(sAttach.Len()) { - xub_StrLen nTokenCount = sAttach.GetTokenCount( '.' ); + xub_StrLen nTokenCount = comphelper::string::getTokenCount(sAttach, '.'); if( 2 > nTokenCount) { sAttach += '.'; @@ -1123,7 +1123,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) if(RET_OK == aQuery.Execute()) { String sAttach(aQuery.GetValue()); - xub_StrLen nTokenCount = sAttach.GetTokenCount( '.' ); + xub_StrLen nTokenCount = comphelper::string::getTokenCount(sAttach, '.'); if( 2 > nTokenCount) { sAttach += '.'; @@ -1263,7 +1263,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) sBody = m_sBody; aDesc.sAttachmentURL = aName.GetValue(); String sAttachment(m_aAttachmentED.GetText()); - xub_StrLen nTokenCount = sAttachment.GetTokenCount( '.' ); + xub_StrLen nTokenCount = comphelper::string::getTokenCount(sAttachment, '.'); if( 2 > nTokenCount) { sAttachment += '.'; diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 422e090b06e9..190f3cdce8c7 100755 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -40,9 +40,10 @@ #include #include #include -#include #include #include +#include +#include #include #include #include @@ -2078,15 +2079,15 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData, if( ( rData.HasFormat( SOT_FORMATSTR_ID_SYLK ) || rData.HasFormat( SOT_FORMATSTR_ID_SYLK_BIGCAPS ) ) && aExpand.Len() && - ( 1 < aExpand.GetTokenCount( '\n' ) || - aExpand.GetTokenCount( '\t' )) ) + ( 1 < comphelper::string::getTokenCount(aExpand, '\n') || + comphelper::string::getTokenCount(aExpand, '\t') ) ) { String sTmp( aExpand ); - xub_StrLen nRows = sTmp.GetTokenCount( '\n' ); + xub_StrLen nRows = comphelper::string::getTokenCount(sTmp, '\n'); if( nRows ) --nRows; sTmp = sTmp.GetToken( 0, '\n' ); - xub_StrLen nCols = sTmp.GetTokenCount( '\t' ); + xub_StrLen nCols = comphelper::string::getTokenCount(sTmp, '\t'); // at least one column & row must be there if( !nRows || !nCols ) @@ -2101,7 +2102,7 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData, SwInsertTableOptions( tabopts::SPLIT_LAYOUT, 1 ), // TODO MULTIHEADER pDDETyp, nRows, nCols ); } - else if( 1 < aExpand.GetTokenCount( '\n' ) ) + else if( 1 < comphelper::string::getTokenCount(aExpand, '\n') ) { // multiple paragraphs -> insert a protected section if( rWrtShell.HasSelection() ) diff --git a/sw/source/ui/envelp/envimg.cxx b/sw/source/ui/envelp/envimg.cxx index 8b29a9c8795d..a93a84943eab 100644 --- a/sw/source/ui/envelp/envimg.cxx +++ b/sw/source/ui/envelp/envimg.cxx @@ -29,6 +29,7 @@ #include +#include #include #include #include @@ -65,7 +66,7 @@ SW_DLLPUBLIC String MakeSender() String sRet; String sSenderToken(SW_RES(STR_SENDER_TOKENS)); - xub_StrLen nSttPos = 0, nTokenCount = sSenderToken.GetTokenCount(';'); + xub_StrLen nSttPos = 0, nTokenCount = comphelper::string::getTokenCount(sSenderToken, ';'); sal_Bool bLastLength = sal_True; for( xub_StrLen i = 0; i < nTokenCount; i++ ) { diff --git a/sw/source/ui/envelp/labelcfg.cxx b/sw/source/ui/envelp/labelcfg.cxx index a2a8fb33134d..d8dc95333717 100644 --- a/sw/source/ui/envelp/labelcfg.cxx +++ b/sw/source/ui/envelp/labelcfg.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -89,7 +90,7 @@ SwLabRec* lcl_CreateSwLabRec(Sequence& rValues, const OUString& rManufactur //except for the continuous flag ('C'/'S') pValues[nProp] >>= sTmp; String sMeasure(sTmp); - sal_uInt16 nTokenCount = sMeasure.GetTokenCount(';'); + sal_uInt16 nTokenCount = comphelper::string::getTokenCount(sMeasure, ';'); for(sal_uInt16 i = 0; i < nTokenCount; i++) { String sToken(sMeasure.GetToken(i, ';' )); diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx index 426f36fe2873..789598b78b19 100644 --- a/sw/source/ui/fldui/fldmgr.cxx +++ b/sw/source/ui/fldui/fldmgr.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -1352,7 +1353,7 @@ sal_Bool SwFldMgr::InsertFld( const SwInsertFld_Data& rData ) case TYP_DROPDOWN : { pFld = new SwDropDownField(pCurShell->GetFldType( 0, RES_DROPDOWN )); - xub_StrLen nTokenCount = rData.sPar2.GetTokenCount(DB_DELIM); + xub_StrLen nTokenCount = comphelper::string::getTokenCount(rData.sPar2, DB_DELIM); Sequence aEntries(nTokenCount); OUString* pArray = aEntries.getArray(); for(xub_StrLen nToken = 0; nToken < nTokenCount; nToken++) @@ -1516,7 +1517,7 @@ void SwFldMgr::UpdateCurFld(sal_uLong nFormat, break; case TYP_DROPDOWN: { - xub_StrLen nTokenCount = sPar2.GetTokenCount(DB_DELIM); + xub_StrLen nTokenCount = comphelper::string::getTokenCount(sPar2, DB_DELIM); Sequence aEntries(nTokenCount); OUString* pArray = aEntries.getArray(); for(xub_StrLen nToken = 0; nToken < nTokenCount; nToken++) diff --git a/sw/source/ui/index/cntex.cxx b/sw/source/ui/index/cntex.cxx index 488a4bdbbae5..19a491d1e235 100644 --- a/sw/source/ui/index/cntex.cxx +++ b/sw/source/ui/index/cntex.cxx @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -263,7 +264,7 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample( String sLevel; if(bOn) sLevel = rDesc.GetStyleNames(i); - sal_uInt16 nStyles = sLevel.GetTokenCount(TOX_STYLE_DELIMITER); + sal_uInt16 nStyles = comphelper::string::getTokenCount(sLevel, TOX_STYLE_DELIMITER); uno::Sequence aStyles(nStyles); OUString* pArr = aStyles.getArray(); for(sal_uInt16 nStyle = 0; nStyle < nStyles; nStyle++) diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index c042edafb6e9..59382cb9ce67 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -30,7 +30,7 @@ #undef SW_DLLIMPLEMENTATION #endif - +#include #include #include #include @@ -759,7 +759,7 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(Window* pParent, for(i = 0; i < MAXLEVEL; ++i) { String sStyles(rStringArr[i]); - for(sal_uInt16 nToken = 0; nToken < sStyles.GetTokenCount(TOX_STYLE_DELIMITER); nToken++) + for(sal_uInt16 nToken = 0; nToken < comphelper::string::getTokenCount(sStyles, TOX_STYLE_DELIMITER); nToken++) { String sTmp(sStyles.GetToken(nToken, TOX_STYLE_DELIMITER)); SvLBoxEntry* pEntry = rTLB.InsertEntry(sTmp); diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 832c289eb846..075f741cf230 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -194,7 +194,7 @@ sal_uInt16 BookmarkCombo::GetSelEntryPos(sal_uInt16 nPos) const { sal_Unicode cSep = GetMultiSelectionSeparator(); - sal_uInt16 nCnt = GetText().GetTokenCount(cSep); + sal_uInt16 nCnt = comphelper::string::getTokenCount(GetText(), cSep); for (; nPos < nCnt; nPos++) { diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx index c012152a03ef..e84455dde29a 100644 --- a/sw/source/ui/misc/glosdoc.cxx +++ b/sw/source/ui/misc/glosdoc.cxx @@ -439,7 +439,7 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull) delete *it; m_aPathArr.clear(); - sal_uInt16 nTokenCount = m_aPath.GetTokenCount(SVT_SEARCHPATH_DELIMITER); + sal_uInt16 nTokenCount = comphelper::string::getTokenCount(m_aPath, SVT_SEARCHPATH_DELIMITER); std::vector aDirArr; for( sal_uInt16 i = 0; i < nTokenCount; i++ ) { diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 66c5bea0c9c7..9119645b29dd 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -667,7 +668,7 @@ IMPL_LINK( SwGlossaryDlg, BibHdl, Button *, EMPTYARG ) //check if at least one glossary path is write enabled SvtPathOptions aPathOpt; String sGlosPath( aPathOpt.GetAutoTextPath() ); - sal_uInt16 nPaths = sGlosPath.GetTokenCount(';'); + sal_uInt16 nPaths = comphelper::string::getTokenCount(sGlosPath, ';'); sal_Bool bIsWritable = sal_False; for(sal_uInt16 nPath = 0; nPath < nPaths; nPath++) { diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index b3bbf8755095..738758f9296d 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -1144,7 +1145,7 @@ bool lcl_IsOwnDocument( SwView& rView ) void SwView::ReadUserData( const String &rUserData, sal_Bool bBrowse ) { - if ( rUserData.GetTokenCount() > 1 && + if ( comphelper::string::getTokenCount(rUserData, ';') > 1 && //Fuer Dokumente ohne Layout nur im OnlineLayout oder beim //Forward/Backward (!pWrtShell->IsNewLayout() || pWrtShell->GetViewOptions()->getBrowseMode() || bBrowse) ) diff --git a/sw/source/ui/vba/vbaselection.cxx b/sw/source/ui/vba/vbaselection.cxx index 3b115ad4c7bd..51530eaca059 100644 --- a/sw/source/ui/vba/vbaselection.cxx +++ b/sw/source/ui/vba/vbaselection.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -1002,7 +1003,7 @@ void SwVbaSelection::GetSelectedCellRange( rtl::OUString& sTLName, rtl::OUString if( xTextTableCursor.is() ) { String sRange( xTextTableCursor->getRangeName() ); - if( sRange.GetTokenCount(':') > 0 ) + if( comphelper::string::getTokenCount(sRange, ':') > 0 ) { sTLName = sRange.GetToken(0, ':'); sBRName = sRange.GetToken(1, ':'); diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx index 557a32cc8865..aae2fe7cc945 100644 --- a/tools/source/inet/inetstrm.cxx +++ b/tools/source/inet/inetstrm.cxx @@ -1294,7 +1294,7 @@ INetMIMEMessageStream::GetMsgEncoding (const String& rContentType) { if (rContentType.CompareIgnoreCaseToAscii ("text/plain", 10) == 0) { - if (rContentType.GetTokenCount ('=') > 1) + if (comphelper::string::getTokenCount(rContentType, '=') > 1) { String aCharset (rContentType.GetToken (1, '=')); aCharset = comphelper::string::stripStart(aCharset, ' '); diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx index 1411d79d3f0c..463d90315045 100644 --- a/unotools/source/config/pathoptions.cxx +++ b/unotools/source/config/pathoptions.cxx @@ -877,7 +877,7 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) return sal_False; } - String aIniFile = pImp->SubstVar( rIniFile ); + rtl::OUString aIniFile = pImp->SubstVar( rIniFile ); sal_Bool bRet = sal_False; switch ( ePath ) @@ -887,9 +887,14 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) // path is a URL bRet = sal_True; INetURLObject aObj( GetUserConfigPath() ); - xub_StrLen i, nCount = aIniFile.GetTokenCount( '/' ); - for ( i = 0; i < nCount; ++i ) - aObj.insertName( aIniFile.GetToken( i, '/' ) ); + + sal_Int32 nIniIndex = 0; + do + { + rtl::OUString aToken = aIniFile.getToken( 0, '/', nIniIndex ); + aObj.insertName(aToken); + } + while ( nIniIndex >= 0 ); if ( !::utl::UCBContentHelper::Exists( aObj.GetMainURL( INetURLObject::NO_DECODE ) ) ) { @@ -906,7 +911,7 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) default: { - String aPath; + rtl::OUString aPath; switch ( ePath ) { case PATH_ADDIN: aPath = GetAddinPath(); break; @@ -936,11 +941,11 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) case PATH_COUNT: /*-Wall???*/ break; } - sal_uInt16 j, nIdx = 0, nTokenCount = aPath.GetTokenCount( SEARCHPATH_DELIMITER ); - for ( j = 0; j < nTokenCount; ++j ) + sal_Int32 nPathIndex = 0; + do { sal_Bool bIsURL = sal_True; - String aPathToken = aPath.GetToken( 0, SEARCHPATH_DELIMITER, nIdx ); + rtl::OUString aPathToken = aPath.getToken( 0, SEARCHPATH_DELIMITER, nPathIndex ); INetURLObject aObj( aPathToken ); if ( aObj.HasError() ) { @@ -961,9 +966,14 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) } } - xub_StrLen i, nCount = aIniFile.GetTokenCount( '/' ); - for ( i = 0; i < nCount; ++i ) - aObj.insertName( aIniFile.GetToken( i, '/' ) ); + sal_Int32 nIniIndex = 0; + do + { + rtl::OUString aToken = aIniFile.getToken( 0, '/', nIniIndex ); + aObj.insertName(aToken); + } + while ( nIniIndex >= 0 ); + bRet = ::utl::UCBContentHelper::Exists( aObj.GetMainURL( INetURLObject::NO_DECODE ) ); if ( bRet ) @@ -976,6 +986,7 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) break; } } + while ( nPathIndex >= 0 ); } } diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx index c27a9d49c742..c1355f033940 100644 --- a/vcl/inc/ilstbox.hxx +++ b/vcl/inc/ilstbox.hxx @@ -506,8 +506,8 @@ public: sal_Bool IsSelectionChanged() const { return maLBWindow.IsSelectionChanged(); } sal_uInt16 GetSelectModifier() const { return maLBWindow.GetSelectModifier(); } - void SetMRUEntries( const XubString& rEntries, xub_Unicode cSep ); - XubString GetMRUEntries( xub_Unicode cSep ) const; + void SetMRUEntries( const rtl::OUString& rEntries, sal_Unicode cSep ); + rtl::OUString GetMRUEntries( sal_Unicode cSep ) const; void SetMaxMRUCount( sal_uInt16 n ) { maLBWindow.GetEntryList()->SetMaxMRUCount( n ); } sal_uInt16 GetMaxMRUCount() const { return maLBWindow.GetEntryList()->GetMaxMRUCount(); } sal_uInt16 GetDisplayLineCount() const diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 1333c1aaa45d..584e493bad84 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -54,7 +54,7 @@ inline sal_uLong ImplCreateKey( sal_uInt16 nPos ) static void lcl_GetSelectedEntries( Table& rSelectedPos, const XubString& rText, xub_Unicode cTokenSep, const ImplEntryList* pEntryList ) { - for( xub_StrLen n = rText.GetTokenCount( cTokenSep ); n; ) + for (xub_StrLen n = comphelper::string::getTokenCount(rText, cTokenSep); n;) { XubString aToken = rText.GetToken( --n, cTokenSep ); aToken = comphelper::string::strip(aToken, ' '); diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index b5396e2ff5b2..ec00069aeb3c 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -2703,7 +2703,7 @@ sal_Bool ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt ) // ----------------------------------------------------------------------- -void ImplListBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep ) +void ImplListBox::SetMRUEntries( const rtl::OUString& rEntries, xub_Unicode cSep ) { sal_Bool bChanges = GetEntryList()->GetMRUCount() ? sal_True : sal_False; @@ -2712,10 +2712,10 @@ void ImplListBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep ) maLBWindow.RemoveEntry( --n ); sal_uInt16 nMRUCount = 0; - sal_uInt16 nEntries = rEntries.GetTokenCount( cSep ); - for ( sal_uInt16 nEntry = 0; nEntry < nEntries; nEntry++ ) + sal_Int32 nIndex = 0; + do { - XubString aEntry = rEntries.GetToken( nEntry, cSep ); + XubString aEntry = rEntries.getToken( 0, cSep, nIndex ); // Accept only existing entries if ( GetEntryList()->FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND ) { @@ -2724,6 +2724,7 @@ void ImplListBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep ) bChanges = sal_True; } } + while ( nIndex >= 0 ); if ( bChanges ) { @@ -2735,7 +2736,7 @@ void ImplListBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep ) // ----------------------------------------------------------------------- -XubString ImplListBox::GetMRUEntries( xub_Unicode cSep ) const +rtl::OUString ImplListBox::GetMRUEntries( sal_Unicode cSep ) const { String aEntries; for ( sal_uInt16 n = 0; n < GetEntryList()->GetMRUCount(); n++ ) -- cgit