summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorLaurent Balland-Poirier <laurent.balland-poirier@laposte.net>2017-03-12 23:33:24 +0100
committerAndras Timar <andras.timar@collabora.com>2017-03-16 14:44:00 +0100
commit2f8b1a85a9803b94b57b5671beb70d8252f5c532 (patch)
tree37d3f010df5e124945c16ca4ad2049979e90eeba /svl
parent2c80184a77d9043bc6f33b13a3df76de710a7eff (diff)
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@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 4e1448d43e08d3f0a6ff67e75346e9559ad2af09) Reviewed-on: https://gerrit.libreoffice.org/35196 (cherry picked from commit f1a108f4dfd3d82dd39a9606f54a25a076ac516d)
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zformat.cxx3
-rw-r--r--svl/source/numbers/zforscan.cxx10
2 files changed, 7 insertions, 6 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index be19e338d2a1..ac622bf4cc45 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 1cceda79d3ad..363a6219137e 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++;