[Libreoffice-commits] core.git: svl/source
Laurent Balland-Poirier
laurent.balland-poirier at laposte.net
Mon May 30 22:47:44 UTC 2016
svl/source/numbers/zformat.cxx | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
New commits:
commit a3471916370c53c6627ba4010489f539c174bdf9
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date: Sun May 29 16:48:38 2016 +0200
tdf#100122 Correctly treat fraction without integer part
If there is no integer part (with format such as ?/?):
- sStr should be skiped
- SFrac should be completed with the right number of ?,
j==0 must also be treated in ImpNumberFill
Change-Id: I57448eb3b0c68e10779d7fa565379e2604f7f63b
Reviewed-on: https://gerrit.libreoffice.org/25612
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 172f8021..a80fc53 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -2718,16 +2718,14 @@ bool SvNumberformat::ImpGetFractionOutput(double fNumber,
else
{
bRes |= ImpNumberFill(sFrac, fNumber, k, j, nIx, NF_SYMBOLTYPE_FRACBLANK);
+ bCont = false; // there is no main number?
if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_FRACBLANK)
{
sFrac.insert(0, rInfo.sStrArray[j]);
if ( j )
{
j--;
- }
- else
- {
- bCont = false;
+ bCont = true; // Yes, there is a main number
}
}
}
@@ -4318,6 +4316,7 @@ bool SvNumberformat::ImpNumberFill( OUStringBuffer& sBuff, // number string
short eSymbolType ) // type of stop condition
{
bool bRes = false;
+ bool bStop = false;
const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
// no normal thousands separators if number divided by thousands
bool bDoThousands = (rInfo.nThousand == 0);
@@ -4325,7 +4324,7 @@ bool SvNumberformat::ImpNumberFill( OUStringBuffer& sBuff, // number string
k = sBuff.getLength(); // behind last digit
- while (j > 0 && (nType = rInfo.nTypeArray[j]) != eSymbolType ) // Backwards
+ while (!bStop && (nType = rInfo.nTypeArray[j]) != eSymbolType ) // Backwards
{
switch ( nType )
{
@@ -4400,7 +4399,10 @@ bool SvNumberformat::ImpNumberFill( OUStringBuffer& sBuff, // number string
sBuff.insert(k, rInfo.sStrArray[j]);
break;
} // of switch
- j--; // Next String
+ if ( j )
+ j--; // Next String
+ else
+ bStop = true;
} // of while
return bRes;
}
More information about the Libreoffice-commits
mailing list