diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-08-12 19:10:14 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-09-09 21:07:48 +0200 |
commit | 0e68209fe3e6dec0d6f5ecf919ceecd91d962129 (patch) | |
tree | 3e02f7636680b3158aace43b66b71a9db84d86da /sc | |
parent | 68b3eb1372aa9728673d3c334880d70a75e42b21 (diff) |
Avoid getTokenCount and use indexed getToken
Change-Id: Ib459f491927518266288aaf2d982279dd47ebd39
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/miscdlgs/anyrefdg.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 4ff02b2c1754..9825eeb4bab8 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -154,16 +154,20 @@ void ScFormulaReferenceHelper::ShowSimpleReference(const OUString& rStr) bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, const OUString& rStr, const ScDocument* pDoc ) { - bool bError = false; rRanges.RemoveAll(); + if (rStr.isEmpty()) + return true; + ScAddress::Details aDetails(pDoc->GetAddressConvention(), 0, 0); ScRangeUtil aRangeUtil; - sal_Int32 nTokenCnt = comphelper::string::getTokenCount(rStr, ';'); - for( sal_Int32 nToken = 0; nToken < nTokenCnt; ++nToken ) + + bool bError = false; + sal_Int32 nIdx {0}; + do { ScRange aRange; - OUString aRangeStr( rStr.getToken( nToken, ';' ) ); + OUString aRangeStr( rStr.getToken( 0, ';', nIdx ) ); ScRefFlags nFlags = aRange.ParseAny( aRangeStr, pDoc, aDetails ); if ( nFlags & ScRefFlags::VALID ) @@ -179,6 +183,7 @@ bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, const OUStr else bError = true; } + while (nIdx>0); return !bError; } |