Avoid getTokenCount and use indexed getToken

Change-Id: Ib459f491927518266288aaf2d982279dd47ebd39
This commit is contained in:
Matteo Casalin 2018-08-12 19:10:14 +02:00
parent 68b3eb1372
commit 0e68209fe3

View file

@ -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;
}