tdf#100834 Treat string between integer and fraction as delimiter

In fraction number format, strings located between integer and fraction
should be treated as blank delimiter

Change-Id: I83e78fb0fe08178ee194fc2a213ee260ce15c639
Reviewed-on: https://gerrit.libreoffice.org/27128
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
This commit is contained in:
Laurent Balland-Poirier
2016-07-10 19:37:52 +02:00
committed by Eike Rathke
parent d32dab699f
commit b719a57d5f
2 changed files with 15 additions and 7 deletions

View File

@@ -4707,10 +4707,12 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
case NF_SYMBOLTYPE_TIME100SECSEP : case NF_SYMBOLTYPE_TIME100SECSEP :
aStr.append( rLocWrp.getTime100SecSep() ); aStr.append( rLocWrp.getTime100SecSep() );
break; break;
case NF_SYMBOLTYPE_FRACBLANK :
case NF_SYMBOLTYPE_STRING : case NF_SYMBOLTYPE_STRING :
if ( pStr[j].getLength() == 1 ) if ( pStr[j].getLength() == 1 )
{ {
aStr.append( '\\' ); if ( pType[j] == NF_SYMBOLTYPE_STRING )
aStr.append( '\\' );
aStr.append( pStr[j] ); aStr.append( pStr[j] );
} }
else else

View File

@@ -1651,7 +1651,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
nTypeArray[i] = NF_SYMBOLTYPE_EXP; nTypeArray[i] = NF_SYMBOLTYPE_EXP;
} }
else if (eScannedType == css::util::NumberFormat::FRACTION && else if (eScannedType == css::util::NumberFormat::FRACTION &&
sStrArray[i][0] == ' ') (sStrArray[i][0] == ' ' || ( nTypeArray[i] == NF_SYMBOLTYPE_STRING && (sStrArray[i][0] < '0' || sStrArray[i][0] > '9') ) ) )
{ {
if (!bBlank && !bFrac) // Not double or after a / if (!bBlank && !bFrac) // Not double or after a /
{ {
@@ -1659,12 +1659,17 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
{ {
return nPos; // Error return nPos; // Error
} }
bBlank = true; if (sStrArray[i][0] == ' ' || nCounter > 0 ) // treat string as integer/fraction delimiter only if there is integer
nBlankPos = i; {
nCntPre = nCounter; bBlank = true;
nCounter = 0; nBlankPos = i;
nCntPre = nCounter;
nCounter = 0;
nTypeArray[i] = NF_SYMBOLTYPE_FRACBLANK;
}
} }
nTypeArray[i] = NF_SYMBOLTYPE_FRACBLANK; else if ( sStrArray[i][0] == ' ' )
nTypeArray[i] = NF_SYMBOLTYPE_FRACBLANK;
} }
else if (nTypeArray[i] == NF_KEY_THAI_T) else if (nTypeArray[i] == NF_KEY_THAI_T)
{ {
@@ -2691,6 +2696,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
switch ( nTypeArray[i] ) switch ( nTypeArray[i] )
{ {
case NF_SYMBOLTYPE_STRING : case NF_SYMBOLTYPE_STRING :
case NF_SYMBOLTYPE_FRACBLANK :
nStringPos = rString.getLength(); nStringPos = rString.getLength();
do do
{ {