summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-03-28 17:19:04 +0100
committerEike Rathke <erack@redhat.com>2014-03-28 17:35:41 +0100
commit49836e6f672fdde87bed7921ace5eed6039f5135 (patch)
tree9892f8f11d07b162dc7f0382e41e41b6c99867f5 /svl
parent06b4ca896f508586c0b2378c6308877c487559dd (diff)
handle Narrow No-Break Space the same as No-Break Space, just in case
Change-Id: I08683ea7dc48f5ac91d56ee4de6c4e52d1c6f058
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zforfind.cxx6
-rw-r--r--svl/source/numbers/zformat.cxx13
-rw-r--r--svl/source/numbers/zforscan.cxx9
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];
}