summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2018-12-21 18:56:58 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2019-01-03 16:14:13 +0100
commitd824ddbdd15f642c828da8417fb12a70946098f8 (patch)
tree40af8cd366b43d2292b02a8eec53d607c7a32ad7 /cui
parentb39ee3f45db25fb689574a17210daa16cc511f6b (diff)
Avoid getTokenCount
Change-Id: Ib5fb26de4d51a348ed44987bac0131d18eaed921 Reviewed-on: https://gerrit.libreoffice.org/65675 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/customize/cfgutil.cxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index c4dcf0deb7f7..4969c2740cca 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -51,7 +51,6 @@
#include <comphelper/documentinfo.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequenceashashmap.hxx>
-#include <comphelper/string.hxx>
#include <svtools/imagemgr.hxx>
#include <vcl/treelistentry.hxx>
#include <rtl/ustrbuf.hxx>
@@ -1138,14 +1137,20 @@ void SfxConfigGroupListBox::SelectMacro( const OUString& rBasic,
const OUString& rMacro )
{
const OUString aBasicName(rBasic + " " + xImp->m_sMacros);
- const sal_Int32 nCount = comphelper::string::getTokenCount(rMacro, '.');
- const OUString aMethod( rMacro.copy(rMacro.lastIndexOf('.')+1) );
+ sal_Int32 nIdx {rMacro.lastIndexOf('.')};
+ const OUString aMethod( rMacro.copy(nIdx+1) );
OUString aLib;
OUString aModule;
- if ( nCount > 2 )
+ if ( nIdx>0 )
{
- aLib = rMacro.getToken( 0, '.' );
- aModule = rMacro.getToken( nCount-2, '.' );
+ // string contains at least 2 tokens
+ nIdx = rMacro.lastIndexOf('.', nIdx);
+ if (nIdx>=0)
+ {
+ // string contains at least 3 tokens
+ aLib = rMacro.getToken( 0, '.' );
+ aModule = rMacro.getToken( 0, '.', ++nIdx );
+ }
}
SvTreeListEntry *pEntry = FirstChild(nullptr);