summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx13
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;
}