diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-13 14:33:09 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-14 22:40:30 +0200 |
commit | aef2aa22180be4b99b0a4e28b3bc13f82ad436c5 (patch) | |
tree | 5eb0b60eba3c75b2e4952a8039e4a8b8bbc74eff /cui | |
parent | 57c0ca2e575813626d0c2c994e0a4b52253f42b1 (diff) |
Avoid getTokenCount in StandardHdl_Impl link (3)
Change-Id: Ib68b48fd14cbfae234d03a2963991a1c8581423b
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/optpath.cxx | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 0a97795aab8e..98999d9c6e34 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -444,16 +444,23 @@ IMPL_LINK_NOARG_TYPED(SvxPathTabPage, StandardHdl_Impl, Button*, void) while ( nOldPos >= 0 ); OUString sUserPath, sWritablePath; - sal_uInt16 nOldCount = comphelper::string::getTokenCount(sTemp, MULTIPATH_DELIMITER); - sal_uInt16 i; - for ( i = 0; nOldCount > 0 && i < nOldCount - 1; ++i ) + if ( !sTemp.isEmpty() ) { - if ( !sUserPath.isEmpty() ) - sUserPath += OUStringLiteral1<MULTIPATH_DELIMITER>(); - sUserPath += sTemp.getToken( i, MULTIPATH_DELIMITER ); + sal_Int32 nNextPos = 0; + for (;;) + { + const OUString sToken = sTemp.getToken( 0, MULTIPATH_DELIMITER, nNextPos ); + if ( nNextPos<0 ) + { + // Last token need a different handling + sWritablePath = sToken; + break; + } + if ( !sUserPath.isEmpty() ) + sUserPath += OUStringLiteral1<MULTIPATH_DELIMITER>(); + sUserPath += sToken; + } } - sWritablePath = sTemp.getToken( nOldCount - 1, MULTIPATH_DELIMITER ); - pPathBox->SetEntryText( Convert_Impl( sTemp ), pEntry, 1 ); pPathImpl->eState = SfxItemState::SET; pPathImpl->sUserPath = sUserPath; |