[Libreoffice-commits] core.git: vcl/source
Laszlo Kis-Adam
dfighter1985 at gmail.com
Thu Mar 19 04:08:51 PDT 2015
vcl/source/control/field.cxx | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
New commits:
commit 591e34f868cc3a3f3ce7927480d224f137bfd83c
Author: Laszlo Kis-Adam <dfighter1985 at gmail.com>
Date: Thu Mar 12 17:44:01 2015 +0100
Support "a/b" style of fractions, not just "a b/c" style. Also fixes a crash.
Change-Id: I67f57fc09be512b8827ce2b62ba8828e23f544bc
Reviewed-on: https://gerrit.libreoffice.org/14842
Tested-by: Jenkins <ci at libreoffice.org>
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index fc83af0..cab79f5 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -115,9 +115,21 @@ static bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue,
{
bFrac = true;
nFracNumPos = aStr.lastIndexOf(' ', nFracDivPos);
- aStr1.append(aStr.getStr(), nFracNumPos);
- aStrNum.append(aStr.getStr()+nFracNumPos+1, nFracDivPos-nFracNumPos-1);
- aStrDenom.append(aStr.getStr()+nFracDivPos+1);
+
+ // If in "a b/c" format.
+ if(nFracNumPos != -1 )
+ {
+ aStr1.append(aStr.getStr(), nFracNumPos);
+ aStrNum.append(aStr.getStr()+nFracNumPos+1, nFracDivPos-nFracNumPos-1);
+ aStrDenom.append(aStr.getStr()+nFracDivPos+1);
+ }
+ // "a/b" format, or not a fraction at all
+ else
+ {
+ aStrNum.append(aStr.getStr(), nFracDivPos);
+ aStrDenom.append(aStr.getStr()+nFracDivPos+1);
+ }
+
}
// parse decimal strings
else if ( nDecPos >= 0)
More information about the Libreoffice-commits
mailing list