[Libreoffice-commits] core.git: 5 commits - sc/source svl/source
Eike Rathke
erack at redhat.com
Fri Mar 28 09:50:04 PDT 2014
sc/source/core/tool/cellkeytranslator.cxx | 16 ++++++++++++++++
svl/source/numbers/zforfind.cxx | 10 ++++++----
svl/source/numbers/zformat.cxx | 15 ++++++++++-----
svl/source/numbers/zforscan.cxx | 15 ++++++++++-----
4 files changed, 42 insertions(+), 14 deletions(-)
New commits:
commit 413a134b34a57ff8d5e5d63fb189338d4b84b5aa
Author: Eike Rathke <erack at redhat.com>
Date: Fri Mar 28 17:48:42 2014 +0100
and restore the intention of the original patch
Change-Id: I8187d425a12f8a96d9e29df244084f7045f448ea
diff --git a/sc/source/core/tool/cellkeytranslator.cxx b/sc/source/core/tool/cellkeytranslator.cxx
index af13cbe..fb2e383 100644
--- a/sc/source/core/tool/cellkeytranslator.cxx
+++ b/sc/source/core/tool/cellkeytranslator.cxx
@@ -137,7 +137,7 @@ static void lclMatchKeyword(OUString& rName, const ScCellKeywordHashMap& aMap,
return;
}
}
- else if ( !eOpCode && pLocale )
+ else if ( pLocale )
{
LocaleMatch eLevel = lclLocaleCompare(itrList->mrLocale, aLanguageTag);
if ( eLevel == LOCALE_MATCH_ALL )
commit b4bc7aabce9bc5057b39f71cc7624c9345193caf
Author: Eike Rathke <erack at redhat.com>
Date: Fri Mar 28 17:46:19 2014 +0100
Revert "coverity#1038286 Logically dead code"
This reverts commit f5adf08aa3a9a176bd2ed5acd638148eb8da7c85.
diff --git a/sc/source/core/tool/cellkeytranslator.cxx b/sc/source/core/tool/cellkeytranslator.cxx
index e2f3dfb..af13cbe 100644
--- a/sc/source/core/tool/cellkeytranslator.cxx
+++ b/sc/source/core/tool/cellkeytranslator.cxx
@@ -137,6 +137,22 @@ static void lclMatchKeyword(OUString& rName, const ScCellKeywordHashMap& aMap,
return;
}
}
+ else if ( !eOpCode && pLocale )
+ {
+ LocaleMatch eLevel = lclLocaleCompare(itrList->mrLocale, aLanguageTag);
+ if ( eLevel == LOCALE_MATCH_ALL )
+ {
+ // Name with matching locale preferred.
+ rName = OUString::createFromAscii( itrList->mpName );
+ return;
+ }
+ else if ( eLevel > eLocaleMatchLevel )
+ {
+ // Name with a better matching locale.
+ eLocaleMatchLevel = eLevel;
+ aBestMatchName = itrList->mpName;
+ }
+ }
}
// No preferred strings found. Return the best matching name.
commit 49836e6f672fdde87bed7921ace5eed6039f5135
Author: Eike Rathke <erack at redhat.com>
Date: Fri Mar 28 17:19:04 2014 +0100
handle Narrow No-Break Space the same as No-Break Space, just in case
Change-Id: I08683ea7dc48f5ac91d56ee4de6c4e52d1c6f058
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 8ae49e4..44463bc 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 0570735..893ff54 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 22a2a1c..45ea7b8 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];
}
commit 06b4ca896f508586c0b2378c6308877c487559dd
Author: Eike Rathke <erack at redhat.com>
Date: Fri Mar 28 15:46:38 2014 +0100
name things what they are
Change-Id: I13d0cb525f3ca22b1b9158b2ac20b8b59d645463
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index e18c50d..8ae49e4 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -65,7 +65,7 @@ const sal_uInt8 ImpSvNumberInputScan::nMatchedUsedAsReturn = 0x10;
* would work, together with the nTimezonePos handling in GetTimeRef(). */
#define NF_RECOGNIZE_ISO8601_TIMEZONES 0
-static const sal_Unicode cNonBreakingSpace = 0xA0;
+static const sal_Unicode cNoBreakSpace = 0xA0;
ImpSvNumberInputScan::ImpSvNumberInputScan( SvNumberFormatter* pFormatterP )
:
@@ -461,7 +461,7 @@ inline void ImpSvNumberInputScan::SkipBlanks( const OUString& rString,
if ( nPos < rString.getLength() )
{
const sal_Unicode* p = rString.getStr() + nPos;
- while ( *p == ' ' || *p == cNonBreakingSpace )
+ while ( *p == ' ' || *p == cNoBreakSpace )
{
nPos++;
p++;
@@ -493,8 +493,8 @@ inline bool ImpSvNumberInputScan::GetThousandSep( const OUString& rString,
sal_uInt16 nStringPos )
{
const OUString& rSep = pFormatter->GetNumThousandSep();
- // Is it an ordinary space instead of a non-breaking space?
- bool bSpaceBreak = rSep[0] == cNonBreakingSpace && rString[0] == (sal_Unicode)0x20 &&
+ // Is it an ordinary space instead of a no-break space?
+ bool bSpaceBreak = rSep[0] == cNoBreakSpace && 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 a34778e..0570735 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -722,7 +722,7 @@ SvNumberformat::SvNumberformat(OUString& rString,
{
OUStringBuffer sBuff(rString);
- // If the group (AKA thousand) separator is a Non-Breaking Space (French)
+ // If the group (AKA thousand) separator is a No-Break Space (French)
// replace all occurrences by a simple space.
// The tokens will be changed to the LocaleData separator again later on.
const sal_Unicode cNBSp = 0xA0;
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 4165b9f..22a2a1c 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -36,7 +36,7 @@
#include <svl/nfsymbol.hxx>
using namespace svt;
-const sal_Unicode cNonBreakingSpace = 0xA0;
+const sal_Unicode cNoBreakSpace = 0xA0;
namespace
{
@@ -1528,11 +1528,11 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
sal_Unicode cOldKeyMI = sKeyword[NF_KEY_MI][0];
sal_Unicode cOldKeyS = sKeyword[NF_KEY_S][0];
- // If the group separator is a Non-Breaking Space (French) continue with a
+ // If the group separator is a No-Break Space (French) continue with a
// normal space instead so queries on space work correctly.
// The format string is adjusted to allow both.
// For output of the format code string the LocaleData characters are used.
- if ( sOldThousandSep[0] == cNonBreakingSpace && sOldThousandSep.getLength() == 1 )
+ if ( sOldThousandSep[0] == cNoBreakSpace && sOldThousandSep.getLength() == 1 )
{
sOldThousandSep = " ";
}
@@ -1832,7 +1832,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
{
// strange, those French..
bool bFirst = true;
- // set a hard Non-Breaking Space or ConvertMode
+ // set a hard No-Break Space or ConvertMode
const OUString& rSepF = pFormatter->GetNumThousandSep();
while ( i < nAnzStrings &&
sStrArray[i] == sOldThousandSep &&
@@ -2712,7 +2712,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
if (((eScannedType & NUMBERFORMAT_DATE) == 0) &&
(StringEqualsChar( pFormatter->GetNumThousandSep(), c) ||
StringEqualsChar( pFormatter->GetNumDecimalSep(), c) ||
- (c == ' ' && StringEqualsChar( pFormatter->GetNumThousandSep(), cNonBreakingSpace))))
+ (c == ' ' && StringEqualsChar( pFormatter->GetNumThousandSep(), cNoBreakSpace))))
{
rString += sStrArray[i];
}
commit 2cf4763e3c1810af3278b4bf63f76cec9e94d28c
Author: Eike Rathke <erack at redhat.com>
Date: Fri Mar 28 15:38:04 2014 +0100
we have a constant, use it
Change-Id: I402f64fdab57508df20d4dffa7bdfdf9473d8b45
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 4bb4c18..e18c50d 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -494,7 +494,7 @@ inline bool ImpSvNumberInputScan::GetThousandSep( const OUString& rString,
{
const OUString& rSep = pFormatter->GetNumThousandSep();
// Is it an ordinary space instead of a non-breaking space?
- bool bSpaceBreak = rSep[0] == (sal_Unicode)0xa0 && rString[0] == (sal_Unicode)0x20 &&
+ bool bSpaceBreak = rSep[0] == cNonBreakingSpace && rString[0] == (sal_Unicode)0x20 &&
rSep.getLength() == 1 && rString.getLength() == 1;
if (!((rString == rSep || bSpaceBreak) && // nothing else
nStringPos < nAnzStrings - 1 && // safety first!
More information about the Libreoffice-commits
mailing list