[Libreoffice-commits] core.git: svl/source
Laurent Balland-Poirier
laurent.balland-poirier at laposte.net
Tue Mar 14 17:19:10 UTC 2017
svl/source/numbers/zformat.cxx | 3 ++-
svl/source/numbers/zforscan.cxx | 10 +++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
New commits:
commit 4e1448d43e08d3f0a6ff67e75346e9559ad2af09
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date: Sun Mar 12 23:33:24 2017 +0100
Following tdf#106190 Treat blank after fraction bar
To consider that denominator is found (bDenom=true)
there must be some digits found after fraction bar
Dummy format # ?/ ? can now work again (even with
blank as thousands delimiter).
However such format can not be saved (except in XLS)
Change-Id: I657e97e09a6ae4c08a29ad6d0b586c85a9968e3d
Reviewed-on: https://gerrit.libreoffice.org/35111
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Eike Rathke <erack at redhat.com>
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 4bd1a9e..2d1f874 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -2212,7 +2212,8 @@ OUString lcl_GetDenominatorString(const ImpSvNumberformatInfo &rInfo, sal_uInt16
{
if( rInfo.nTypeArray[i] == NF_SYMBOLTYPE_FRAC )
{
- for( i++; i < nAnz; i++ )
+ while ( ( ++i < nAnz ) && rInfo.nTypeArray[i] == NF_SYMBOLTYPE_STRING );
+ for( ; i < nAnz; i++ )
{
if( rInfo.nTypeArray[i] == NF_SYMBOLTYPE_FRAC_FDIV || rInfo.nTypeArray[i] == NF_SYMBOLTYPE_DIGIT )
aDenominatorString.append( rInfo.sStrArray[i] );
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 5644c2b..788cd42 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -1670,7 +1670,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
}
else if ( sStrArray[i][0] == ' ' )
nTypeArray[i] = NF_SYMBOLTYPE_FRACBLANK;
- else if ( bFrac )
+ else if ( bFrac && ( nCounter > 0 ) )
bDenomin = true; // following elements are no more part of denominator
}
else if (nTypeArray[i] == NF_KEY_THAI_T)
@@ -1714,7 +1714,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
}
else
{
- if ( bFrac )
+ if ( bFrac && ( nCounter > 0 ) )
bDenomin = true; // next content should be treated as outside denominator
nTypeArray[i] = NF_SYMBOLTYPE_STRING;
}
@@ -1834,7 +1834,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
else
{
nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- if ( bFrac )
+ if ( bFrac && (nCounter > 0) )
bDenomin = true; // end of denominator
}
}
@@ -2002,7 +2002,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
nCntPre = nCounter;
nCounter = 0;
}
- if ( bFrac )
+ if ( bFrac && (nCounter > 0) )
bDenomin = true; // next content is not part of denominator
nTypeArray[i] = NF_SYMBOLTYPE_STRING;
nPos = nPos + sStrArray[i].getLength();
@@ -2010,7 +2010,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
else
{
nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- if ( bFrac )
+ if ( bFrac && (nCounter > 0) )
bDenomin = true; // next content is not part of denominator
nPos = nPos + rStr.getLength();
i++;
More information about the Libreoffice-commits
mailing list