diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-07-10 09:03:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-10 09:50:06 +0100 |
commit | 1970b28c5c1fec03374bc053ea51e1147d0b3f49 (patch) | |
tree | a8b55b58d4f219b677e0434b15be9ad7c545e7ac /cppcanvas/source | |
parent | 6a9dc1a045d9f18255c3cb8a7bdbefdf226d8a37 (diff) |
merge duplicated code
Change-Id: Ib13f17a0fe3173f4cd0ae7139f56badb39dcb6cb
Diffstat (limited to 'cppcanvas/source')
-rw-r--r-- | cppcanvas/source/mtfrenderer/implrenderer.cxx | 89 |
1 files changed, 3 insertions, 86 deletions
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index b26c0fb01522..8f1dd8dfd671 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -224,99 +224,16 @@ namespace return BitmapEx( aSolid, aMask ); } - /** Shameless rip from vcl/source/gdi/outdev3.cxx - - Should consolidate, into something like basetxt... - */ - sal_Unicode getLocalizedChar( sal_Unicode nChar, LanguageType eLang ) - { - // currently only conversion from ASCII digits is interesting - if( (nChar < '0') || ('9' < nChar) ) - return nChar; - - sal_Unicode nOffset(0); - // eLang & LANGUAGE_MASK_PRIMARY catches language independent of region. - // CAVEAT! To some like Mongolian MS assigned the same primary language - // although the script type is different! - switch( eLang & LANGUAGE_MASK_PRIMARY ) - { - default: - break; - - case LANGUAGE_ARABIC_SAUDI_ARABIA & LANGUAGE_MASK_PRIMARY: - case LANGUAGE_URDU & LANGUAGE_MASK_PRIMARY: - case LANGUAGE_PUNJABI & LANGUAGE_MASK_PRIMARY: //??? - nOffset = 0x0660 - '0'; // arabic/persian/urdu - break; - case LANGUAGE_BENGALI & LANGUAGE_MASK_PRIMARY: - nOffset = 0x09E6 - '0'; // bengali - break; - case LANGUAGE_BURMESE & LANGUAGE_MASK_PRIMARY: - nOffset = 0x1040 - '0'; // burmese - break; - case LANGUAGE_HINDI & LANGUAGE_MASK_PRIMARY: - nOffset = 0x0966 - '0'; // devanagari - break; - case LANGUAGE_GUJARATI & LANGUAGE_MASK_PRIMARY: - nOffset = 0x0AE6 - '0'; // gujarati - break; - case LANGUAGE_KANNADA & LANGUAGE_MASK_PRIMARY: - nOffset = 0x0CE6 - '0'; // kannada - break; - case LANGUAGE_KHMER & LANGUAGE_MASK_PRIMARY: - nOffset = 0x17E0 - '0'; // khmer - break; - case LANGUAGE_LAO & LANGUAGE_MASK_PRIMARY: - nOffset = 0x0ED0 - '0'; // lao - break; - case LANGUAGE_MALAYALAM & LANGUAGE_MASK_PRIMARY: - nOffset = 0x0D66 - '0'; // malayalam - break; - case LANGUAGE_MONGOLIAN & LANGUAGE_MASK_PRIMARY: - if (eLang == LANGUAGE_MONGOLIAN_MONGOLIAN) - nOffset = 0x1810 - '0'; // mongolian - else - nOffset = 0; // mongolian cyrillic - break; - case LANGUAGE_ORIYA & LANGUAGE_MASK_PRIMARY: - nOffset = 0x0B66 - '0'; // oriya - break; - case LANGUAGE_TAMIL & LANGUAGE_MASK_PRIMARY: - nOffset = 0x0BE7 - '0'; // tamil - break; - case LANGUAGE_TELUGU & LANGUAGE_MASK_PRIMARY: - nOffset = 0x0C66 - '0'; // telugu - break; - case LANGUAGE_THAI & LANGUAGE_MASK_PRIMARY: - nOffset = 0x0E50 - '0'; // thai - break; - case LANGUAGE_TIBETAN & LANGUAGE_MASK_PRIMARY: - nOffset = 0x0F20 - '0'; // tibetan - break; - } - - nChar = sal::static_int_cast<sal_Unicode>(nChar + nOffset); - return nChar; - } - OUString convertToLocalizedNumerals(const OUString& rStr, LanguageType eTextLanguage) { OUStringBuffer aBuf(rStr); - for (sal_Int32 i = 0; i < aBuf.getLength(); ++i) { - // TODO: are there non-digit localizations? - sal_Unicode nOrigChar = aBuf[i]; - if( (nOrigChar >= '0') && (nOrigChar <= '9') ) - { - // translate characters to local preference - sal_Unicode cChar = getLocalizedChar(nOrigChar, eTextLanguage); - if (cChar != nOrigChar) - aBuf[i] = cChar; - } + sal_Unicode nChar = aBuf[i]; + if (nChar >= '0' && nChar <= '9') + aBuf[i] = GetLocalizedChar(nChar, eTextLanguage); } - return aBuf.makeStringAndClear(); } } |