Kaydet (Commit) 5391bd1e authored tarafından Eike Rathke's avatar Eike Rathke

resolved fdo#55369 accept fraction input if preset

Accept fraction input without integer portion if the format was preset
as fraction, e.g. 1/5 instead of  0 1/5  and don't force to date.

Change-Id: I188593c57e5779aae029a1aa2ebd2c18de441804
üst 677ca1d5
...@@ -2014,14 +2014,24 @@ bool ImpSvNumberInputScan::ScanMidString( const String& rString, ...@@ -2014,14 +2014,24 @@ bool ImpSvNumberInputScan::ScanMidString( const String& rString,
{ {
if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type
&& eScannedType != NUMBERFORMAT_DATE) // except date && eScannedType != NUMBERFORMAT_DATE) // except date
return MatchedReturn(); // => jan/31/1994 return MatchedReturn(); // => jan/31/1994
else if ( eScannedType != NUMBERFORMAT_DATE // analyzed date until now else if (eScannedType != NUMBERFORMAT_DATE // analyzed no date until now
&& ( eSetType == NUMBERFORMAT_FRACTION // and preset was fraction && ( eSetType == NUMBERFORMAT_FRACTION // and preset was fraction
|| (nAnzNums == 3 // or 3 numbers || (nAnzNums == 3 // or 3 numbers
&& nStringPos > 2) ) ) // and what ??? && (nStringPos == 3 // and 3rd string particle
|| (nStringPos == 4 // or 4th
&& nSign))))) // if signed
{ {
SkipBlanks(rString, nPos); SkipBlanks(rString, nPos);
eScannedType = NUMBERFORMAT_FRACTION; // !!! it IS a fraction if (nPos == rString.Len())
{
eScannedType = NUMBERFORMAT_FRACTION; // !!! it IS a fraction (so far)
if (eSetType == NUMBERFORMAT_FRACTION
&& nAnzNums == 2
&& (nStringPos == 1 // for 4/5
|| (nStringPos == 2 && nSign))) // or signed -4/5
return true; // don't fall into date trap
}
} }
else else
nPos--; // put '/' back nPos--; // put '/' back
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment