summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-01-02 10:55:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-01-05 09:18:19 +0000
commitbacfd2dc4cea1a5d87658ed8592116acd931e000 (patch)
treed22172a33fdd13a440b6882a28c23ea2d639bbad /sw
parent6281eb0e0792da0194c07da18296e94dd944b8e5 (diff)
add a comphelper::string::getTokenCount
suitable for conversion from [Byte]String::GetTokenCount converted low-hanging variants to rtl::O[UString]::getToken loops added unit test
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/doctxm.cxx4
-rw-r--r--sw/source/core/fields/cellfml.cxx5
-rw-r--r--sw/source/core/fields/ddefld.cxx2
-rw-r--r--sw/source/core/fields/docufld.cxx2
-rw-r--r--sw/source/core/unocore/unochart.cxx7
-rw-r--r--sw/source/core/unocore/unofield.cxx5
-rw-r--r--sw/source/core/unocore/unoidx.cxx3
-rw-r--r--sw/source/core/unocore/unosect.cxx3
-rw-r--r--sw/source/filter/html/htmlforw.cxx3
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx3
-rw-r--r--sw/source/ui/app/appenv.cxx2
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.cxx5
-rw-r--r--sw/source/ui/dbui/mailmergechildwindow.cxx5
-rw-r--r--sw/source/ui/dbui/mailmergehelper.cxx7
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx6
-rwxr-xr-xsw/source/ui/dochdl/swdtflvr.cxx13
-rw-r--r--sw/source/ui/envelp/envimg.cxx3
-rw-r--r--sw/source/ui/envelp/labelcfg.cxx3
-rw-r--r--sw/source/ui/fldui/fldmgr.cxx5
-rw-r--r--sw/source/ui/index/cntex.cxx3
-rw-r--r--sw/source/ui/index/cnttab.cxx4
-rw-r--r--sw/source/ui/misc/bookmark.cxx2
-rw-r--r--sw/source/ui/misc/glosdoc.cxx2
-rw-r--r--sw/source/ui/misc/glossary.cxx3
-rw-r--r--sw/source/ui/uiview/view.cxx3
-rw-r--r--sw/source/ui/vba/vbaselection.cxx3
26 files changed, 62 insertions, 44 deletions
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 <limits.h>
#include <hintids.hxx>
-
+#include <comphelper/string.hxx>
#define _SVSTDARR_STRINGSSORT
#include <svl/svstdarr.hxx>
#include <editeng/langitem.hxx>
@@ -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 <flddat.hxx>
#include <cellatr.hxx>
#include <ndindex.hxx>
+#include <comphelper/string.hxx>
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 <unocore.hrc>
#include <docary.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
#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 <docstat.hxx>
#include <editsh.hxx>
#include <viewsh.hxx>
-#include <comphelper/types.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
+#include <comphelper/types.hxx>
#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/util/DateTimeRange.hpp>
#include <com/sun/star/util/DateTime.hpp>
@@ -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 <SwStyleNameMapper.hxx>
#include <unoevtlstnr.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
using namespace ::com::sun::star;
@@ -2663,7 +2664,7 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
const String& rStyles =
rTOXBase.GetStyleNames(static_cast<sal_uInt16>(nIndex));
- const sal_uInt16 nStyles = rStyles.GetTokenCount(TOX_STYLE_DELIMITER);
+ const sal_uInt16 nStyles = comphelper::string::getTokenCount(rStyles, TOX_STYLE_DELIMITER);
uno::Sequence<OUString> 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 <fmtcntnt.hxx>
#include <editeng/lrspitem.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
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 <com/sun/star/form/XForm.hpp>
#include <com/sun/star/form/FormComponentType.hpp>
#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+#include <comphelper/string.hxx>
#include <hintids.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
@@ -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 <comphelper/string.hxx>
#include <oox/token/tokens.hxx>
#include <oox/export/drawingml.hxx>
#include <oox/export/utils.hxx>
@@ -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 <createaddresslistdialog.hxx>
#include <customizeaddresslistdialog.hxx>
#include <mmconfigitem.hxx>
+#include <comphelper/string.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/msgbox.hxx>
#include <svtools/controldims.hrc>
@@ -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<OUString> 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 <mmoutputpage.hxx>
#include <mmconfigitem.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
#include "com/sun/star/mail/XSmtpService.hpp"
#include "com/sun/star/mail/MailServiceType.hpp"
#include <rtl/ref.hxx>
@@ -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 <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
#include <vcl/msgbox.hxx>
#include <sfx2/passwd.hxx>
@@ -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 <svtools/embedtransfer.hxx>
#include <svtools/insdlg.hxx>
#include <unotools/tempfile.hxx>
-#include <comphelper/storagehelper.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <comphelper/string.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <sot/filelist.hxx>
#include <svx/svxdlg.hxx>
@@ -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 <hintids.hxx>
+#include <comphelper/string.hxx>
#include <tools/stream.hxx>
#include <tools/resid.hxx>
#include <sfx2/app.hxx>
@@ -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 <swtypes.hxx>
#include <labelcfg.hxx>
#include <labimp.hxx>
+#include <comphelper/string.hxx>
#include <unotools/configpathes.hxx>
#include <unomid.h>
@@ -89,7 +90,7 @@ SwLabRec* lcl_CreateSwLabRec(Sequence<Any>& 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 <com/sun/star/uri/XUriReferenceFactory.hpp>
#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
#include <editeng/unolingu.hxx>
#include <unotools/localedatawrapper.hxx>
#include <sfx2/dispatch.hxx>
@@ -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<OUString> 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<OUString> 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 <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <comphelper/string.hxx>
#include <wrtsh.hxx>
#include <view.hxx>
#include <cnttab.hxx>
@@ -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<OUString> 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 <comphelper/string.hxx>
#include <rsc/rscsfx.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/help.hxx>
@@ -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<String*> 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 <unocrsr.hxx>
#include <unotools.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
#include <ucbhelper/content.hxx>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
@@ -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 <string>
#include <stdlib.h>
#include <hintids.hxx>
+#include <comphelper/string.hxx>
#include <rtl/logfile.hxx>
#include <vcl/graph.hxx>
#include <vcl/inputctx.hxx>
@@ -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 <com/sun/star/text/XTextTableCursor.hpp>
#include <com/sun/star/text/ControlCharacter.hpp>
#include <com/sun/star/table/XCell.hpp>
+#include <comphelper/string.hxx>
#include <ooo/vba/word/WdUnits.hpp>
#include <ooo/vba/word/WdMovementType.hpp>
#include <ooo/vba/word/WdGoToItem.hpp>
@@ -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, ':');