[Libreoffice-commits] .: svl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 13 05:28:47 PST 2012
svl/source/numbers/zforfind.cxx | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
New commits:
commit 5391bd1e54157457abe1098b29f067d6e0059113
Author: Eike Rathke <erack at redhat.com>
Date: Tue Nov 13 14:23:01 2012 +0100
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
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 55d7fd7..4767f45 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -2014,14 +2014,24 @@ bool ImpSvNumberInputScan::ScanMidString( const String& rString,
{
if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type
&& eScannedType != NUMBERFORMAT_DATE) // except date
- return MatchedReturn(); // => jan/31/1994
- else if ( eScannedType != NUMBERFORMAT_DATE // analyzed date until now
- && ( eSetType == NUMBERFORMAT_FRACTION // and preset was fraction
- || (nAnzNums == 3 // or 3 numbers
- && nStringPos > 2) ) ) // and what ???
+ return MatchedReturn(); // => jan/31/1994
+ else if (eScannedType != NUMBERFORMAT_DATE // analyzed no date until now
+ && ( eSetType == NUMBERFORMAT_FRACTION // and preset was fraction
+ || (nAnzNums == 3 // or 3 numbers
+ && (nStringPos == 3 // and 3rd string particle
+ || (nStringPos == 4 // or 4th
+ && nSign))))) // if signed
{
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
nPos--; // put '/' back
More information about the Libreoffice-commits
mailing list