summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2018-06-24 12:07:11 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2018-06-30 23:00:13 +0200
commit5b07f513cb758ec831e80f3e4dc1819445cdfb51 (patch)
tree206a22492e24a8dfdf2cb8e2645de1d0728db7e6 /sw
parent4db69a8343ae7a26a827ec43225922c01ac2b5ef (diff)
Avoid getTokenCount()
Change-Id: Ia878affbdcb9674675619f34a423ac6c9a90b16d
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index ec2030f55507..3671060f4d52 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1789,11 +1789,10 @@ void DocxAttributeOutput::CmdField_Impl( const SwTextNode* pNode, sal_Int32 nPos
DoWriteFieldRunProperties( pNode, nPos, bWriteCombChars );
}
- sal_Int32 nNbToken = comphelper::string::getTokenCount(rInfos.sCmd, '\t');
-
- for ( sal_Int32 i = 0; i < nNbToken; i++ )
+ sal_Int32 nIdx { rInfos.sCmd.isEmpty() ? -1 : 0 };
+ while ( nIdx >= 0 )
{
- OUString sToken = rInfos.sCmd.getToken( i, '\t' );
+ OUString sToken = rInfos.sCmd.getToken( 0, '\t', nIdx );
if ( rInfos.eType == ww::eCREATEDATE
|| rInfos.eType == ww::eSAVEDATE
|| rInfos.eType == ww::ePRINTDATE
@@ -1808,7 +1807,7 @@ void DocxAttributeOutput::CmdField_Impl( const SwTextNode* pNode, sal_Int32 nPos
DoWriteCmd( sToken );
// Replace tabs by </instrText><tab/><instrText>
- if ( i < ( nNbToken - 1 ) )
+ if ( nIdx > 0 ) // Is another token expected?
RunText( "\t" );
}