diff options
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 6 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 13 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 9 |
3 files changed, 20 insertions, 8 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 8ae49e4524d4..44463bc9f3a5 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -66,6 +66,7 @@ const sal_uInt8 ImpSvNumberInputScan::nMatchedUsedAsReturn = 0x10; #define NF_RECOGNIZE_ISO8601_TIMEZONES 0 static const sal_Unicode cNoBreakSpace = 0xA0; +static const sal_Unicode cNarrowNoBreakSpace = 0x202F; ImpSvNumberInputScan::ImpSvNumberInputScan( SvNumberFormatter* pFormatterP ) : @@ -461,7 +462,7 @@ inline void ImpSvNumberInputScan::SkipBlanks( const OUString& rString, if ( nPos < rString.getLength() ) { const sal_Unicode* p = rString.getStr() + nPos; - while ( *p == ' ' || *p == cNoBreakSpace ) + while ( *p == ' ' || *p == cNoBreakSpace || *p == cNarrowNoBreakSpace ) { nPos++; p++; @@ -494,7 +495,8 @@ inline bool ImpSvNumberInputScan::GetThousandSep( const OUString& rString, { const OUString& rSep = pFormatter->GetNumThousandSep(); // Is it an ordinary space instead of a no-break space? - bool bSpaceBreak = rSep[0] == cNoBreakSpace && rString[0] == (sal_Unicode)0x20 && + bool bSpaceBreak = (rSep[0] == cNoBreakSpace || rSep[0] == cNarrowNoBreakSpace) && + rString[0] == (sal_Unicode)0x20 && rSep.getLength() == 1 && rString.getLength() == 1; if (!((rString == rSep || bSpaceBreak) && // nothing else nStringPos < nAnzStrings - 1 && // safety first! diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 05707355a300..893ff54ee16d 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -724,12 +724,17 @@ SvNumberformat::SvNumberformat(OUString& rString, // If the group (AKA thousand) separator is a No-Break Space (French) // replace all occurrences by a simple space. + // The same for Narrow No-Break Space just in case some locale uses it. // The tokens will be changed to the LocaleData separator again later on. - const sal_Unicode cNBSp = 0xA0; const OUString& rThSep = GetFormatter().GetNumThousandSep(); - if ( rThSep.getLength() == 1 && rThSep[0] == cNBSp ) - { - sBuff.replace( cNBSp, ' '); + if ( rThSep.getLength() == 1) + { + const sal_Unicode cNBSp = 0xA0; + const sal_Unicode cNNBSp = 0x202F; + if (rThSep[0] == cNBSp ) + sBuff.replace( cNBSp, ' '); + else if (rThSep[0] == cNNBSp ) + sBuff.replace( cNNBSp, ' '); } if (rScan.GetConvertMode()) diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 22a2a1c78a60..45ea7b835f41 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -37,6 +37,7 @@ using namespace svt; const sal_Unicode cNoBreakSpace = 0xA0; +const sal_Unicode cNarrowNoBreakSpace = 0x202F; namespace { @@ -1530,9 +1531,11 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) // If the group separator is a No-Break Space (French) continue with a // normal space instead so queries on space work correctly. + // The same for Narrow No-Break Space just in case some locale uses it. // The format string is adjusted to allow both. // For output of the format code string the LocaleData characters are used. - if ( sOldThousandSep[0] == cNoBreakSpace && sOldThousandSep.getLength() == 1 ) + if ( (sOldThousandSep[0] == cNoBreakSpace || sOldThousandSep[0] == cNarrowNoBreakSpace) && + sOldThousandSep.getLength() == 1 ) { sOldThousandSep = " "; } @@ -2712,7 +2715,9 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) if (((eScannedType & NUMBERFORMAT_DATE) == 0) && (StringEqualsChar( pFormatter->GetNumThousandSep(), c) || StringEqualsChar( pFormatter->GetNumDecimalSep(), c) || - (c == ' ' && StringEqualsChar( pFormatter->GetNumThousandSep(), cNoBreakSpace)))) + (c == ' ' && + (StringEqualsChar( pFormatter->GetNumThousandSep(), cNoBreakSpace) || + StringEqualsChar( pFormatter->GetNumThousandSep(), cNarrowNoBreakSpace))))) { rString += sStrArray[i]; } |