[Libreoffice-commits] core.git: cui/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Jan 3 15:14:34 UTC 2019
cui/source/customize/cfgutil.cxx | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
New commits:
commit d824ddbdd15f642c828da8417fb12a70946098f8
Author: Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Fri Dec 21 18:56:58 2018 +0100
Commit: Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Thu Jan 3 16:14:13 2019 +0100
Avoid getTokenCount
Change-Id: Ib5fb26de4d51a348ed44987bac0131d18eaed921
Reviewed-on: https://gerrit.libreoffice.org/65675
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>
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);
More information about the Libreoffice-commits
mailing list