summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-05-17 04:05:20 +0200
committerEike Rathke <erack@redhat.com>2014-05-17 04:09:12 +0200
commit3885b5d4b00ebb31adabc36c507abd642c03d0d4 (patch)
treeca09a22657a33113d9cd219a784364a9b5d0d5ae /svl
parent8e71f81f47c20320c4de7a7aadb7d524f0d8ea76 (diff)
resolved fdo#41166 match month and day name word instead of substring
Follow-up, check for ASCII first to avoid calls to i18n, and check the type flags instead of calls to CharClass methods that give unexpected results with their masks. Change-Id: I10e685998299dceb2dbcf1d87ae1de09680b8a99
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zforfind.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 0cf62fd68dd7..0e10138661cb 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -458,18 +458,23 @@ bool ImpSvNumberInputScan::StringContainsWord( const OUString& rWhat,
* how many languages do not separate the day and month names in some
* form? */
+ // Check simple ASCII first before invoking i18n or anything else.
+ if (rtl::isAsciiAlphanumeric( rString[nPos] ))
+ return false; // Alpha or numeric is not word gap.
+
sal_Int32 nIndex = nPos;
- sal_uInt32 c = rString.iterateCodePoints( &nIndex);
+ const sal_uInt32 c = rString.iterateCodePoints( &nIndex);
if (nPos+1 < nIndex)
return true; // Surrogate, assume these to be new words.
(void)c;
const sal_Int32 nType = pFormatter->GetCharClass()->getCharacterType( rString, nPos);
+ using namespace ::com::sun::star::i18n;
- if (CharClass::isAlphaNumericType( nType))
+ if ((nType & (KCharacterType::UPPER | KCharacterType::LOWER | KCharacterType::DIGIT)) != 0)
return false; // Alpha or numeric is not word gap.
- if (CharClass::isLetterType( nType))
+ if ((nType & (KCharacterType::LETTER)) != 0)
return true; // Letter other than alpha is new word. (Is it?)
return true; // Catch all remaining as gap until we know better.