1 diff --git sc/source/core/data/table4.cxx sc/source/core/data/table4.cxx
2 index 2d43cbe..9ca13d2 100644
3 --- sc/source/core/data/table4.cxx
4 +++ sc/source/core/data/table4.cxx
5 @@ -94,48 +94,74 @@ extern USHORT nScFillModeMouseModifier; // global.cxx
7 short lcl_DecompValueString( String& aValue, sal_Int32& nVal, USHORT* pMinDigits = NULL )
10 + xub_StrLen nLen = aValue.Len();
16 const sal_Unicode* p = aValue.GetBuffer();
17 - xub_StrLen nNeg = 0;
18 - xub_StrLen nNum = 0;
19 - if ( p[nNum] == '-' )
21 - while ( p[nNum] && CharClass::isAsciiNumeric( p[nNum] ) )
24 - { // number at the beginning
25 - nVal = aValue.Copy( 0, nNum ).ToInt32();
26 - // #60893# any number with a leading zero sets the minimum number of digits
27 - if ( p[nNeg] == '0' && pMinDigits && ( nNum - nNeg > *pMinDigits ) )
28 - *pMinDigits = nNum - nNeg;
29 - aValue.Erase( 0, nNum );
35 - xub_StrLen nEnd = nNum = aValue.Len() - 1;
36 - while ( nNum && CharClass::isAsciiNumeric( p[nNum] ) )
38 - if ( p[nNum] == '-' )
43 - if ( nNum < nEnd - nNeg )
44 - { // number at the end
45 - nVal = aValue.Copy( nNum + 1 ).ToInt32();
46 - // #60893# any number with a leading zero sets the minimum number of digits
47 - if ( p[nNum+1+nNeg] == '0' && pMinDigits && ( nEnd - nNum - nNeg > *pMinDigits ) )
48 - *pMinDigits = nEnd - nNum - nNeg;
49 - aValue.Erase( nNum + 1 );
53 + xub_StrLen nSign = (p[0] == '+' || p[0] == '-') ? 1 : 0;
54 + xub_StrLen nDot = nLen, nFirst = nLen;
56 + bool bLeadingNum = true;
57 + for (xub_StrLen i = nSign; i < nLen; ++i)
59 + sal_Unicode c = p[i];
60 + if (CharClass::isAsciiNumeric(c) && c != '+' && c != '-')
68 + bLeadingNum = false;
78 + // if it's a dot, erase the buffer and keep going.
83 + else if (aBuf.Len())
88 + // If a dot has been previously encountered, then use the
89 + // first numerical segment.
91 + aBuf = aValue.Copy(0, nFirst);
94 + nVal = aBuf.ToInt32();
95 + if (nSign && p[0] == '-')
99 + *pMinDigits = i - nSign;
105 + // trailing number.
106 + xub_StrLen nBufLen = aBuf.Len();
107 + nVal = aBuf.ToInt32();
108 + aValue.Erase(nLen - nBufLen);
110 + *pMinDigits = nBufLen;