Kaydet (Commit) 660fe83b authored tarafından Eike Rathke's avatar Eike Rathke

use sensible indentation

that always annoyed me

Change-Id: I0c439ddb00d78590b465cd47db6e60d1939bd9f7
üst 34af964c
...@@ -37,41 +37,41 @@ BreakIterator_CJK::BreakIterator_CJK() : ...@@ -37,41 +37,41 @@ BreakIterator_CJK::BreakIterator_CJK() :
dict( NULL ), dict( NULL ),
hangingCharacters() hangingCharacters()
{ {
cBreakIterator = "com.sun.star.i18n.BreakIterator_CJK"; cBreakIterator = "com.sun.star.i18n.BreakIterator_CJK";
} }
Boundary SAL_CALL Boundary SAL_CALL
BreakIterator_CJK::previousWord(const OUString& text, sal_Int32 anyPos, BreakIterator_CJK::previousWord(const OUString& text, sal_Int32 anyPos,
const lang::Locale& nLocale, sal_Int16 wordType) throw(RuntimeException) const lang::Locale& nLocale, sal_Int16 wordType) throw(RuntimeException)
{ {
if (dict) { if (dict) {
result = dict->previousWord(text, anyPos, wordType); result = dict->previousWord(text, anyPos, wordType);
// #109813# for non-CJK, single character word, fallback to ICU breakiterator. // #109813# for non-CJK, single character word, fallback to ICU breakiterator.
if (result.endPos - result.startPos != 1 || if (result.endPos - result.startPos != 1 ||
getScriptType(text, result.startPos) == ScriptType::ASIAN) getScriptType(text, result.startPos) == ScriptType::ASIAN)
return result; return result;
result = BreakIterator_Unicode::getWordBoundary(text, result.startPos, nLocale, wordType, true); result = BreakIterator_Unicode::getWordBoundary(text, result.startPos, nLocale, wordType, true);
if (result.endPos < anyPos) if (result.endPos < anyPos)
return result; return result;
} }
return BreakIterator_Unicode::previousWord(text, anyPos, nLocale, wordType); return BreakIterator_Unicode::previousWord(text, anyPos, nLocale, wordType);
} }
Boundary SAL_CALL Boundary SAL_CALL
BreakIterator_CJK::nextWord(const OUString& text, sal_Int32 anyPos, BreakIterator_CJK::nextWord(const OUString& text, sal_Int32 anyPos,
const lang::Locale& nLocale, sal_Int16 wordType) throw(RuntimeException) const lang::Locale& nLocale, sal_Int16 wordType) throw(RuntimeException)
{ {
if (dict) { if (dict) {
result = dict->nextWord(text, anyPos, wordType); result = dict->nextWord(text, anyPos, wordType);
// #109813# for non-CJK, single character word, fallback to ICU breakiterator. // #109813# for non-CJK, single character word, fallback to ICU breakiterator.
if (result.endPos - result.startPos != 1 || if (result.endPos - result.startPos != 1 ||
getScriptType(text, result.startPos) == ScriptType::ASIAN) getScriptType(text, result.startPos) == ScriptType::ASIAN)
return result; return result;
result = BreakIterator_Unicode::getWordBoundary(text, result.startPos, nLocale, wordType, true); result = BreakIterator_Unicode::getWordBoundary(text, result.startPos, nLocale, wordType, true);
if (result.startPos > anyPos) if (result.startPos > anyPos)
return result; return result;
} }
return BreakIterator_Unicode::nextWord(text, anyPos, nLocale, wordType); return BreakIterator_Unicode::nextWord(text, anyPos, nLocale, wordType);
} }
Boundary SAL_CALL Boundary SAL_CALL
...@@ -79,14 +79,14 @@ BreakIterator_CJK::getWordBoundary( const OUString& text, sal_Int32 anyPos, ...@@ -79,14 +79,14 @@ BreakIterator_CJK::getWordBoundary( const OUString& text, sal_Int32 anyPos,
const lang::Locale& nLocale, sal_Int16 wordType, sal_Bool bDirection ) const lang::Locale& nLocale, sal_Int16 wordType, sal_Bool bDirection )
throw(RuntimeException) throw(RuntimeException)
{ {
if (dict) { if (dict) {
result = dict->getWordBoundary(text, anyPos, wordType, bDirection); result = dict->getWordBoundary(text, anyPos, wordType, bDirection);
// #109813# for non-CJK, single character word, fallback to ICU breakiterator. // #109813# for non-CJK, single character word, fallback to ICU breakiterator.
if (result.endPos - result.startPos != 1 || if (result.endPos - result.startPos != 1 ||
getScriptType(text, result.startPos) == ScriptType::ASIAN) getScriptType(text, result.startPos) == ScriptType::ASIAN)
return result; return result;
} }
return BreakIterator_Unicode::getWordBoundary(text, anyPos, nLocale, wordType, bDirection); return BreakIterator_Unicode::getWordBoundary(text, anyPos, nLocale, wordType, bDirection);
} }
LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak( LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak(
...@@ -95,22 +95,22 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak( ...@@ -95,22 +95,22 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak(
const LineBreakHyphenationOptions& /*hOptions*/, const LineBreakHyphenationOptions& /*hOptions*/,
const LineBreakUserOptions& bOptions ) throw(RuntimeException) const LineBreakUserOptions& bOptions ) throw(RuntimeException)
{ {
LineBreakResults lbr; LineBreakResults lbr;
if (bOptions.allowPunctuationOutsideMargin && if (bOptions.allowPunctuationOutsideMargin &&
hangingCharacters.indexOf(Text[nStartPos]) != -1 && hangingCharacters.indexOf(Text[nStartPos]) != -1 &&
(Text.iterateCodePoints( &nStartPos, 1), nStartPos == Text.getLength())) { (Text.iterateCodePoints( &nStartPos, 1), nStartPos == Text.getLength())) {
; // do nothing ; // do nothing
} else if (bOptions.applyForbiddenRules && 0 < nStartPos && nStartPos < Text.getLength()) { } else if (bOptions.applyForbiddenRules && 0 < nStartPos && nStartPos < Text.getLength()) {
while (nStartPos > 0 && while (nStartPos > 0 &&
(bOptions.forbiddenBeginCharacters.indexOf(Text[nStartPos]) != -1 || (bOptions.forbiddenBeginCharacters.indexOf(Text[nStartPos]) != -1 ||
bOptions.forbiddenEndCharacters.indexOf(Text[nStartPos-1]) != -1)) bOptions.forbiddenEndCharacters.indexOf(Text[nStartPos-1]) != -1))
Text.iterateCodePoints( &nStartPos, -1); Text.iterateCodePoints( &nStartPos, -1);
} }
lbr.breakIndex = nStartPos; lbr.breakIndex = nStartPos;
lbr.breakType = BreakType::WORDBOUNDARY; lbr.breakType = BreakType::WORDBOUNDARY;
return lbr; return lbr;
} }
#define LOCALE(language, country) lang::Locale(OUString::createFromAscii(language), OUString::createFromAscii(country), OUString()) #define LOCALE(language, country) lang::Locale(OUString::createFromAscii(language), OUString::createFromAscii(country), OUString())
...@@ -119,14 +119,14 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak( ...@@ -119,14 +119,14 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak(
// ----------------------------------------------------; // ----------------------------------------------------;
BreakIterator_zh::BreakIterator_zh() BreakIterator_zh::BreakIterator_zh()
{ {
dict = new xdictionary("zh"); dict = new xdictionary("zh");
hangingCharacters = LocaleDataImpl().getHangingCharacters(LOCALE("zh", "CN")); hangingCharacters = LocaleDataImpl().getHangingCharacters(LOCALE("zh", "CN"));
cBreakIterator = "com.sun.star.i18n.BreakIterator_zh"; cBreakIterator = "com.sun.star.i18n.BreakIterator_zh";
} }
BreakIterator_zh::~BreakIterator_zh() BreakIterator_zh::~BreakIterator_zh()
{ {
delete dict; delete dict;
} }
// ---------------------------------------------------- // ----------------------------------------------------
...@@ -134,14 +134,14 @@ BreakIterator_zh::~BreakIterator_zh() ...@@ -134,14 +134,14 @@ BreakIterator_zh::~BreakIterator_zh()
// ----------------------------------------------------; // ----------------------------------------------------;
BreakIterator_zh_TW::BreakIterator_zh_TW() BreakIterator_zh_TW::BreakIterator_zh_TW()
{ {
dict = new xdictionary("zh"); dict = new xdictionary("zh");
hangingCharacters = LocaleDataImpl().getHangingCharacters(LOCALE("zh", "TW")); hangingCharacters = LocaleDataImpl().getHangingCharacters(LOCALE("zh", "TW"));
cBreakIterator = "com.sun.star.i18n.BreakIterator_zh_TW"; cBreakIterator = "com.sun.star.i18n.BreakIterator_zh_TW";
} }
BreakIterator_zh_TW::~BreakIterator_zh_TW() BreakIterator_zh_TW::~BreakIterator_zh_TW()
{ {
delete dict; delete dict;
} }
// ---------------------------------------------------- // ----------------------------------------------------
...@@ -149,15 +149,15 @@ BreakIterator_zh_TW::~BreakIterator_zh_TW() ...@@ -149,15 +149,15 @@ BreakIterator_zh_TW::~BreakIterator_zh_TW()
// ----------------------------------------------------; // ----------------------------------------------------;
BreakIterator_ja::BreakIterator_ja() BreakIterator_ja::BreakIterator_ja()
{ {
dict = new xdictionary("ja"); dict = new xdictionary("ja");
dict->setJapaneseWordBreak(); dict->setJapaneseWordBreak();
hangingCharacters = LocaleDataImpl().getHangingCharacters(LOCALE("ja", "JP")); hangingCharacters = LocaleDataImpl().getHangingCharacters(LOCALE("ja", "JP"));
cBreakIterator = "com.sun.star.i18n.BreakIterator_ja"; cBreakIterator = "com.sun.star.i18n.BreakIterator_ja";
} }
BreakIterator_ja::~BreakIterator_ja() BreakIterator_ja::~BreakIterator_ja()
{ {
delete dict; delete dict;
} }
// ---------------------------------------------------- // ----------------------------------------------------
...@@ -165,8 +165,8 @@ BreakIterator_ja::~BreakIterator_ja() ...@@ -165,8 +165,8 @@ BreakIterator_ja::~BreakIterator_ja()
// ----------------------------------------------------; // ----------------------------------------------------;
BreakIterator_ko::BreakIterator_ko() BreakIterator_ko::BreakIterator_ko()
{ {
hangingCharacters = LocaleDataImpl().getHangingCharacters(LOCALE("ko", "KR")); hangingCharacters = LocaleDataImpl().getHangingCharacters(LOCALE("ko", "KR"));
cBreakIterator = "com.sun.star.i18n.BreakIterator_ko"; cBreakIterator = "com.sun.star.i18n.BreakIterator_ko";
} }
BreakIterator_ko::~BreakIterator_ko() BreakIterator_ko::~BreakIterator_ko()
......
...@@ -83,61 +83,62 @@ xdictionary::xdictionary(const sal_Char *lang) : ...@@ -83,61 +83,62 @@ xdictionary::xdictionary(const sal_Char *lang) :
OUStringBuffer aBuf( strlen(lang) + 7 + 4 ); // mostly "*.dll" (with * == dict_zh) OUStringBuffer aBuf( strlen(lang) + 7 + 4 ); // mostly "*.dll" (with * == dict_zh)
#endif #endif
aBuf.appendAscii( "dict_" ).appendAscii( lang ).appendAscii( SAL_DLLEXTENSION ); aBuf.appendAscii( "dict_" ).appendAscii( lang ).appendAscii( SAL_DLLEXTENSION );
hModule = osl_loadModuleRelative( &thisModule, aBuf.makeStringAndClear().pData, SAL_LOADMODULE_DEFAULT ); hModule = osl_loadModuleRelative( &thisModule, aBuf.makeStringAndClear().pData, SAL_LOADMODULE_DEFAULT );
if( hModule ) { if( hModule ) {
sal_IntPtr (*func)(); sal_IntPtr (*func)();
func = (sal_IntPtr(*)()) osl_getFunctionSymbol( hModule, OUString("getExistMark").pData ); func = (sal_IntPtr(*)()) osl_getFunctionSymbol( hModule, OUString("getExistMark").pData );
existMark = (sal_uInt8*) (*func)(); existMark = (sal_uInt8*) (*func)();
func = (sal_IntPtr(*)()) osl_getFunctionSymbol( hModule, OUString("getIndex1").pData ); func = (sal_IntPtr(*)()) osl_getFunctionSymbol( hModule, OUString("getIndex1").pData );
index1 = (sal_Int16*) (*func)(); index1 = (sal_Int16*) (*func)();
func = (sal_IntPtr(*)()) osl_getFunctionSymbol( hModule, OUString("getIndex2").pData ); func = (sal_IntPtr(*)()) osl_getFunctionSymbol( hModule, OUString("getIndex2").pData );
index2 = (sal_Int32*) (*func)(); index2 = (sal_Int32*) (*func)();
func = (sal_IntPtr(*)()) osl_getFunctionSymbol( hModule, OUString("getLenArray").pData ); func = (sal_IntPtr(*)()) osl_getFunctionSymbol( hModule, OUString("getLenArray").pData );
lenArray = (sal_Int32*) (*func)(); lenArray = (sal_Int32*) (*func)();
func = (sal_IntPtr(*)()) osl_getFunctionSymbol( hModule, OUString("getDataArea").pData ); func = (sal_IntPtr(*)()) osl_getFunctionSymbol( hModule, OUString("getDataArea").pData );
dataArea = (sal_Unicode*) (*func)(); dataArea = (sal_Unicode*) (*func)();
} }
else else
{ {
existMark = NULL; existMark = NULL;
index1 = NULL; index1 = NULL;
index2 = NULL; index2 = NULL;
lenArray = NULL; lenArray = NULL;
dataArea = NULL; dataArea = NULL;
} }
#else #else
if( strcmp( lang, "ja" ) == 0 ) { if( strcmp( lang, "ja" ) == 0 ) {
existMark = getExistMark_ja(); existMark = getExistMark_ja();
index1 = getIndex1_ja(); index1 = getIndex1_ja();
index2 = getIndex2_ja(); index2 = getIndex2_ja();
lenArray = getLenArray_ja(); lenArray = getLenArray_ja();
dataArea = getDataArea_ja(); dataArea = getDataArea_ja();
} }
else if( strcmp( lang, "zh" ) == 0 ) { else if( strcmp( lang, "zh" ) == 0 ) {
existMark = getExistMark_zh(); existMark = getExistMark_zh();
index1 = getIndex1_zh(); index1 = getIndex1_zh();
index2 = getIndex2_zh(); index2 = getIndex2_zh();
lenArray = getLenArray_zh(); lenArray = getLenArray_zh();
dataArea = getDataArea_zh(); dataArea = getDataArea_zh();
} }
else else
{ {
existMark = NULL; existMark = NULL;
index1 = NULL; index1 = NULL;
index2 = NULL; index2 = NULL;
lenArray = NULL; lenArray = NULL;
dataArea = NULL; dataArea = NULL;
} }
#endif #endif
for (sal_Int32 i = 0; i < CACHE_MAX; i++) for (sal_Int32 i = 0; i < CACHE_MAX; i++)
cache[i].size = 0; cache[i].size = 0;
japaneseWordBreak = sal_False; japaneseWordBreak = sal_False;
} }
xdictionary::~xdictionary() { xdictionary::~xdictionary()
{
#ifndef DISABLE_DYNLOADING #ifndef DISABLE_DYNLOADING
osl_unloadModule(hModule); osl_unloadModule(hModule);
#endif #endif
...@@ -151,46 +152,48 @@ xdictionary::~xdictionary() { ...@@ -151,46 +152,48 @@ xdictionary::~xdictionary() {
void xdictionary::setJapaneseWordBreak() void xdictionary::setJapaneseWordBreak()
{ {
japaneseWordBreak = sal_True; japaneseWordBreak = sal_True;
} }
sal_Bool xdictionary::exists(const sal_uInt32 c) { sal_Bool xdictionary::exists(const sal_uInt32 c)
// 0x1FFF is the hardcoded limit in gendict for existMarks {
sal_Bool exist = (existMark && ((c>>3) < 0x1FFF)) ? sal::static_int_cast<sal_Bool>((existMark[c>>3] & (1<<(c&0x07))) != 0) : sal_False; // 0x1FFF is the hardcoded limit in gendict for existMarks
if (!exist && japaneseWordBreak) sal_Bool exist = (existMark && ((c>>3) < 0x1FFF)) ? sal::static_int_cast<sal_Bool>((existMark[c>>3] & (1<<(c&0x07))) != 0) : sal_False;
return BreakIteratorImpl::getScriptClass(c) == ScriptType::ASIAN; if (!exist && japaneseWordBreak)
else return BreakIteratorImpl::getScriptClass(c) == ScriptType::ASIAN;
return exist; else
return exist;
} }
sal_Int32 xdictionary::getLongestMatch(const sal_Unicode* str, sal_Int32 sLen) { sal_Int32 xdictionary::getLongestMatch(const sal_Unicode* str, sal_Int32 sLen)
{
if ( !index1 ) return 0; if ( !index1 ) return 0;
sal_Int16 idx = index1[str[0] >> 8]; sal_Int16 idx = index1[str[0] >> 8];
if (idx == 0xFF) return 0; if (idx == 0xFF) return 0;
idx = (idx<<8) | (str[0]&0xff); idx = (idx<<8) | (str[0]&0xff);
sal_uInt32 begin = index2[idx], end = index2[idx+1]; sal_uInt32 begin = index2[idx], end = index2[idx+1];
if (begin == 0) return 0; if (begin == 0) return 0;
str++; sLen--; // first character is not stored in the dictionary str++; sLen--; // first character is not stored in the dictionary
for (sal_uInt32 i = end; i > begin; i--) { for (sal_uInt32 i = end; i > begin; i--) {
sal_Int32 len = lenArray[i] - lenArray[i - 1]; sal_Int32 len = lenArray[i] - lenArray[i - 1];
if (sLen >= len) { if (sLen >= len) {
const sal_Unicode *dstr = dataArea + lenArray[i-1]; const sal_Unicode *dstr = dataArea + lenArray[i-1];
sal_Int32 pos = 0; sal_Int32 pos = 0;
while (pos < len && dstr[pos] == str[pos]) { pos++; } while (pos < len && dstr[pos] == str[pos]) { pos++; }
if (pos == len) if (pos == len)
return len + 1; return len + 1;
}
} }
return 0; }
return 0;
} }
...@@ -210,14 +213,15 @@ WordBreakCache::WordBreakCache() : ...@@ -210,14 +213,15 @@ WordBreakCache::WordBreakCache() :
* Compare two unicode string, * Compare two unicode string,
*/ */
sal_Bool WordBreakCache::equals(const sal_Unicode* str, Boundary& boundary) { sal_Bool WordBreakCache::equals(const sal_Unicode* str, Boundary& boundary)
// Different length, different string. {
if (length != boundary.endPos - boundary.startPos) return sal_False; // Different length, different string.
if (length != boundary.endPos - boundary.startPos) return sal_False;
for (sal_Int32 i = 0; i < length; i++) for (sal_Int32 i = 0; i < length; i++)
if (contents[i] != str[i + boundary.startPos]) return sal_False; if (contents[i] != str[i + boundary.startPos]) return sal_False;
return sal_True; return sal_True;
} }
......
...@@ -31,8 +31,8 @@ namespace com { namespace sun { namespace star { namespace i18n { ...@@ -31,8 +31,8 @@ namespace com { namespace sun { namespace star { namespace i18n {
CharacterClassificationImpl::CharacterClassificationImpl( CharacterClassificationImpl::CharacterClassificationImpl(
const Reference < uno::XComponentContext >& rxContext ) : m_xContext( rxContext ) const Reference < uno::XComponentContext >& rxContext ) : m_xContext( rxContext )
{ {
if (createLocaleSpecificCharacterClassification(OUString("Unicode"), Locale())) if (createLocaleSpecificCharacterClassification(OUString("Unicode"), Locale()))
xUCI = cachedItem->xCI; xUCI = cachedItem->xCI;
} }
CharacterClassificationImpl::~CharacterClassificationImpl() { CharacterClassificationImpl::~CharacterClassificationImpl() {
...@@ -47,62 +47,62 @@ OUString SAL_CALL ...@@ -47,62 +47,62 @@ OUString SAL_CALL
CharacterClassificationImpl::toUpper( const OUString& Text, sal_Int32 nPos, CharacterClassificationImpl::toUpper( const OUString& Text, sal_Int32 nPos,
sal_Int32 nCount, const Locale& rLocale ) throw(RuntimeException) sal_Int32 nCount, const Locale& rLocale ) throw(RuntimeException)
{ {
return getLocaleSpecificCharacterClassification(rLocale)->toUpper(Text, nPos, nCount, rLocale); return getLocaleSpecificCharacterClassification(rLocale)->toUpper(Text, nPos, nCount, rLocale);
} }
OUString SAL_CALL OUString SAL_CALL
CharacterClassificationImpl::toLower( const OUString& Text, sal_Int32 nPos, CharacterClassificationImpl::toLower( const OUString& Text, sal_Int32 nPos,
sal_Int32 nCount, const Locale& rLocale ) throw(RuntimeException) sal_Int32 nCount, const Locale& rLocale ) throw(RuntimeException)
{ {
return getLocaleSpecificCharacterClassification(rLocale)->toLower(Text, nPos, nCount, rLocale); return getLocaleSpecificCharacterClassification(rLocale)->toLower(Text, nPos, nCount, rLocale);
} }
OUString SAL_CALL OUString SAL_CALL
CharacterClassificationImpl::toTitle( const OUString& Text, sal_Int32 nPos, CharacterClassificationImpl::toTitle( const OUString& Text, sal_Int32 nPos,
sal_Int32 nCount, const Locale& rLocale ) throw(RuntimeException) sal_Int32 nCount, const Locale& rLocale ) throw(RuntimeException)
{ {
return getLocaleSpecificCharacterClassification(rLocale)->toTitle(Text, nPos, nCount, rLocale); return getLocaleSpecificCharacterClassification(rLocale)->toTitle(Text, nPos, nCount, rLocale);
} }
sal_Int16 SAL_CALL sal_Int16 SAL_CALL
CharacterClassificationImpl::getType( const OUString& Text, sal_Int32 nPos ) CharacterClassificationImpl::getType( const OUString& Text, sal_Int32 nPos )
throw(RuntimeException) throw(RuntimeException)
{ {
if (xUCI.is()) if (xUCI.is())
return xUCI->getType(Text, nPos); return xUCI->getType(Text, nPos);
throw RuntimeException(); throw RuntimeException();
} }
sal_Int16 SAL_CALL sal_Int16 SAL_CALL
CharacterClassificationImpl::getCharacterDirection( const OUString& Text, sal_Int32 nPos ) CharacterClassificationImpl::getCharacterDirection( const OUString& Text, sal_Int32 nPos )
throw(RuntimeException) throw(RuntimeException)
{ {
if (xUCI.is()) if (xUCI.is())
return xUCI->getCharacterDirection(Text, nPos); return xUCI->getCharacterDirection(Text, nPos);
throw RuntimeException(); throw RuntimeException();
} }
sal_Int16 SAL_CALL sal_Int16 SAL_CALL
CharacterClassificationImpl::getScript( const OUString& Text, sal_Int32 nPos ) CharacterClassificationImpl::getScript( const OUString& Text, sal_Int32 nPos )
throw(RuntimeException) throw(RuntimeException)
{ {
if (xUCI.is()) if (xUCI.is())
return xUCI->getScript(Text, nPos); return xUCI->getScript(Text, nPos);
throw RuntimeException(); throw RuntimeException();
} }
sal_Int32 SAL_CALL sal_Int32 SAL_CALL
CharacterClassificationImpl::getCharacterType( const OUString& Text, sal_Int32 nPos, CharacterClassificationImpl::getCharacterType( const OUString& Text, sal_Int32 nPos,
const Locale& rLocale ) throw(RuntimeException) const Locale& rLocale ) throw(RuntimeException)
{ {
return getLocaleSpecificCharacterClassification(rLocale)->getCharacterType(Text, nPos, rLocale); return getLocaleSpecificCharacterClassification(rLocale)->getCharacterType(Text, nPos, rLocale);
} }
sal_Int32 SAL_CALL sal_Int32 SAL_CALL
CharacterClassificationImpl::getStringType( const OUString& Text, sal_Int32 nPos, CharacterClassificationImpl::getStringType( const OUString& Text, sal_Int32 nPos,
sal_Int32 nCount, const Locale& rLocale ) throw(RuntimeException) sal_Int32 nCount, const Locale& rLocale ) throw(RuntimeException)
{ {
return getLocaleSpecificCharacterClassification(rLocale)->getStringType(Text, nPos, nCount, rLocale); return getLocaleSpecificCharacterClassification(rLocale)->getStringType(Text, nPos, nCount, rLocale);
} }
ParseResult SAL_CALL CharacterClassificationImpl::parseAnyToken( ParseResult SAL_CALL CharacterClassificationImpl::parseAnyToken(
...@@ -111,9 +111,9 @@ ParseResult SAL_CALL CharacterClassificationImpl::parseAnyToken( ...@@ -111,9 +111,9 @@ ParseResult SAL_CALL CharacterClassificationImpl::parseAnyToken(
sal_Int32 contCharTokenType, const OUString& userDefinedCharactersCont ) sal_Int32 contCharTokenType, const OUString& userDefinedCharactersCont )
throw(RuntimeException) throw(RuntimeException)
{ {
return getLocaleSpecificCharacterClassification(rLocale)->parseAnyToken(Text, nPos, rLocale, return getLocaleSpecificCharacterClassification(rLocale)->parseAnyToken(Text, nPos, rLocale,
startCharTokenType,userDefinedCharactersStart, startCharTokenType,userDefinedCharactersStart,
contCharTokenType, userDefinedCharactersCont); contCharTokenType, userDefinedCharactersCont);
} }
...@@ -123,73 +123,73 @@ ParseResult SAL_CALL CharacterClassificationImpl::parsePredefinedToken( ...@@ -123,73 +123,73 @@ ParseResult SAL_CALL CharacterClassificationImpl::parsePredefinedToken(
const OUString& userDefinedCharactersStart, sal_Int32 contCharTokenType, const OUString& userDefinedCharactersStart, sal_Int32 contCharTokenType,
const OUString& userDefinedCharactersCont ) throw(RuntimeException) const OUString& userDefinedCharactersCont ) throw(RuntimeException)
{ {
return getLocaleSpecificCharacterClassification(rLocale)->parsePredefinedToken( return getLocaleSpecificCharacterClassification(rLocale)->parsePredefinedToken(
nTokenType, Text, nPos, rLocale, startCharTokenType, userDefinedCharactersStart, nTokenType, Text, nPos, rLocale, startCharTokenType, userDefinedCharactersStart,
contCharTokenType, userDefinedCharactersCont); contCharTokenType, userDefinedCharactersCont);
} }
sal_Bool SAL_CALL CharacterClassificationImpl::createLocaleSpecificCharacterClassification(const OUString& serviceName, const Locale& rLocale) sal_Bool SAL_CALL CharacterClassificationImpl::createLocaleSpecificCharacterClassification(const OUString& serviceName, const Locale& rLocale)
{ {
// to share service between same Language but different Country code, like zh_CN and zh_SG // to share service between same Language but different Country code, like zh_CN and zh_SG
for (size_t l = 0; l < lookupTable.size(); l++) { for (size_t l = 0; l < lookupTable.size(); l++) {
cachedItem = lookupTable[l]; cachedItem = lookupTable[l];
if (serviceName == cachedItem->aName) { if (serviceName == cachedItem->aName) {
lookupTable.push_back( cachedItem = new lookupTableItem(rLocale, serviceName, cachedItem->xCI) ); lookupTable.push_back( cachedItem = new lookupTableItem(rLocale, serviceName, cachedItem->xCI) );
return sal_True; return sal_True;
}
} }
}
Reference < XInterface > xI = m_xContext->getServiceManager()->createInstanceWithContext( Reference < XInterface > xI = m_xContext->getServiceManager()->createInstanceWithContext(
OUString("com.sun.star.i18n.CharacterClassification_") + serviceName, m_xContext); OUString("com.sun.star.i18n.CharacterClassification_") + serviceName, m_xContext);
Reference < XCharacterClassification > xCI; Reference < XCharacterClassification > xCI;
if ( xI.is() ) { if ( xI.is() ) {
xCI.set( xI, UNO_QUERY ); xCI.set( xI, UNO_QUERY );
if (xCI.is()) { if (xCI.is()) {
lookupTable.push_back( cachedItem = new lookupTableItem(rLocale, serviceName, xCI) ); lookupTable.push_back( cachedItem = new lookupTableItem(rLocale, serviceName, xCI) );
return sal_True; return sal_True;
}
} }
return sal_False; }
return sal_False;
} }
Reference < XCharacterClassification > SAL_CALL Reference < XCharacterClassification > SAL_CALL
CharacterClassificationImpl::getLocaleSpecificCharacterClassification(const Locale& rLocale) CharacterClassificationImpl::getLocaleSpecificCharacterClassification(const Locale& rLocale)
throw(RuntimeException) throw(RuntimeException)
{ {
// reuse instance if locale didn't change // reuse instance if locale didn't change
if (cachedItem && cachedItem->equals(rLocale)) if (cachedItem && cachedItem->equals(rLocale))
return cachedItem->xCI; return cachedItem->xCI;
else { else {
for (size_t i = 0; i < lookupTable.size(); i++) { for (size_t i = 0; i < lookupTable.size(); i++) {
cachedItem = lookupTable[i]; cachedItem = lookupTable[i];
if (cachedItem->equals(rLocale)) if (cachedItem->equals(rLocale))
return cachedItem->xCI;
}
// Load service with name <base>_<lang>_<country> or
// <base>_<bcp47> and fallbacks.
bool bLoaded = createLocaleSpecificCharacterClassification(
LocaleDataImpl::getFirstLocaleServiceName( rLocale), rLocale);
if (!bLoaded)
{
::std::vector< OUString > aFallbacks( LocaleDataImpl::getFallbackLocaleServiceNames( rLocale));
for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it)
{
bLoaded = createLocaleSpecificCharacterClassification( *it, rLocale);
if (bLoaded)
break;
}
}
if (bLoaded)
return cachedItem->xCI; return cachedItem->xCI;
else if (xUCI.is()) }
// Load service with name <base>_<lang>_<country> or
// <base>_<bcp47> and fallbacks.
bool bLoaded = createLocaleSpecificCharacterClassification(
LocaleDataImpl::getFirstLocaleServiceName( rLocale), rLocale);
if (!bLoaded)
{
::std::vector< OUString > aFallbacks( LocaleDataImpl::getFallbackLocaleServiceNames( rLocale));
for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it)
{ {
lookupTable.push_back( cachedItem = new lookupTableItem( rLocale, OUString("Unicode"), xUCI)); bLoaded = createLocaleSpecificCharacterClassification( *it, rLocale);
return cachedItem->xCI; if (bLoaded)
break;
} }
} }
throw RuntimeException(); if (bLoaded)
return cachedItem->xCI;
else if (xUCI.is())
{
lookupTable.push_back( cachedItem = new lookupTableItem( rLocale, OUString("Unicode"), xUCI));
return cachedItem->xCI;
}
}
throw RuntimeException();
} }
const sal_Char cClass[] = "com.sun.star.i18n.CharacterClassification"; const sal_Char cClass[] = "com.sun.star.i18n.CharacterClassification";
......
...@@ -267,7 +267,7 @@ DefaultNumberingProvider::DefaultNumberingProvider( const Reference < XComponent ...@@ -267,7 +267,7 @@ DefaultNumberingProvider::DefaultNumberingProvider( const Reference < XComponent
DefaultNumberingProvider::~DefaultNumberingProvider() DefaultNumberingProvider::~DefaultNumberingProvider()
{ {
delete translit; delete translit;
} }
void DefaultNumberingProvider::impl_loadTranslit() void DefaultNumberingProvider::impl_loadTranslit()
...@@ -293,42 +293,42 @@ OUString toRoman( sal_Int32 n ) ...@@ -293,42 +293,42 @@ OUString toRoman( sal_Int32 n )
// i, ii, iii, iv, v, vi, vii, vii, viii, ix // i, ii, iii, iv, v, vi, vii, vii, viii, ix
// (Dummy),1000,500,100,50,10,5,1 // (Dummy),1000,500,100,50,10,5,1
static const sal_Char coRomanArr[] = "MDCLXVI--"; // +2 Dummy entries !! static const sal_Char coRomanArr[] = "MDCLXVI--"; // +2 Dummy entries !!
const sal_Char* cRomanStr = coRomanArr; const sal_Char* cRomanStr = coRomanArr;
sal_uInt16 nMask = 1000; sal_uInt16 nMask = 1000;
sal_uInt32 nOver1000 = n / nMask; sal_uInt32 nOver1000 = n / nMask;
n -= ( nOver1000 * nMask ); n -= ( nOver1000 * nMask );
OUStringBuffer sTmp; OUStringBuffer sTmp;
while(nOver1000--) while(nOver1000--)
sTmp.append(sal_Unicode(*coRomanArr)); sTmp.append(sal_Unicode(*coRomanArr));
while( nMask ) while( nMask )
{
sal_uInt8 nZahl = sal_uInt8( n / nMask );
sal_uInt8 nDiff = 1;
n %= nMask;
if( 5 < nZahl )
{
if( nZahl < 9 )
sTmp.append(sal_Unicode(*(cRomanStr-1)));
++nDiff;
nZahl -= 5;
}
switch( nZahl )
{ {
sal_uInt8 nZahl = sal_uInt8( n / nMask ); case 3: sTmp.append(sal_Unicode(*cRomanStr)); //no break!
sal_uInt8 nDiff = 1; case 2: sTmp.append(sal_Unicode(*cRomanStr)); //no break!
n %= nMask; case 1: sTmp.append(sal_Unicode(*cRomanStr)); break;
case 4: sTmp.append(sal_Unicode(*cRomanStr)).append(sal_Unicode(*(cRomanStr-nDiff))); break;
if( 5 < nZahl ) case 5: sTmp.append(sal_Unicode(*(cRomanStr-nDiff))); break;
{
if( nZahl < 9 )
sTmp.append(sal_Unicode(*(cRomanStr-1)));
++nDiff;
nZahl -= 5;
}
switch( nZahl )
{
case 3: sTmp.append(sal_Unicode(*cRomanStr)); //no break!
case 2: sTmp.append(sal_Unicode(*cRomanStr)); //no break!
case 1: sTmp.append(sal_Unicode(*cRomanStr)); break;
case 4: sTmp.append(sal_Unicode(*cRomanStr)).append(sal_Unicode(*(cRomanStr-nDiff))); break;
case 5: sTmp.append(sal_Unicode(*(cRomanStr-nDiff))); break;
}
nMask /= 10; // to the next decade
cRomanStr += 2;
} }
return sTmp.makeStringAndClear();
nMask /= 10; // to the next decade
cRomanStr += 2;
}
return sTmp.makeStringAndClear();
} }
// not used: // not used:
...@@ -943,24 +943,24 @@ static const sal_Int32 nSupported_NumberingTypes = sizeof(aSupportedTypes) / siz ...@@ -943,24 +943,24 @@ static const sal_Int32 nSupported_NumberingTypes = sizeof(aSupportedTypes) / siz
OUString DefaultNumberingProvider::makeNumberingIdentifier(sal_Int16 index) OUString DefaultNumberingProvider::makeNumberingIdentifier(sal_Int16 index)
throw(RuntimeException) throw(RuntimeException)
{ {
if (aSupportedTypes[index].cSymbol) if (aSupportedTypes[index].cSymbol)
return OUString(aSupportedTypes[index].cSymbol, strlen(aSupportedTypes[index].cSymbol), RTL_TEXTENCODING_UTF8); return OUString(aSupportedTypes[index].cSymbol, strlen(aSupportedTypes[index].cSymbol), RTL_TEXTENCODING_UTF8);
// return OUString::createFromAscii(aSupportedTypes[index].cSymbol); // return OUString::createFromAscii(aSupportedTypes[index].cSymbol);
else { else {
OUString result; OUString result;
Locale aLocale(OUString("en"), OUString(), OUString()); Locale aLocale(OUString("en"), OUString(), OUString());
Sequence<beans::PropertyValue> aProperties(2); Sequence<beans::PropertyValue> aProperties(2);
aProperties[0].Name = OUString("NumberingType"); aProperties[0].Name = OUString("NumberingType");
aProperties[0].Value <<= aSupportedTypes[index].nType; aProperties[0].Value <<= aSupportedTypes[index].nType;
aProperties[1].Name = OUString("Value"); aProperties[1].Name = OUString("Value");
for (sal_Int32 j = 1; j <= 3; j++) { for (sal_Int32 j = 1; j <= 3; j++) {
aProperties[1].Value <<= j; aProperties[1].Value <<= j;
result += makeNumberingString( aProperties, aLocale ); result += makeNumberingString( aProperties, aLocale );
result += ", "; result += ", ";
}
result += "...";
return result;
} }
result += "...";
return result;
}
} }
sal_Bool SAL_CALL sal_Bool SAL_CALL
...@@ -1000,46 +1000,46 @@ DefaultNumberingProvider::isScriptFlagEnabled(const OUString& aName) throw(Runti ...@@ -1000,46 +1000,46 @@ DefaultNumberingProvider::isScriptFlagEnabled(const OUString& aName) throw(Runti
Sequence< sal_Int16 > DefaultNumberingProvider::getSupportedNumberingTypes( ) Sequence< sal_Int16 > DefaultNumberingProvider::getSupportedNumberingTypes( )
throw(RuntimeException) throw(RuntimeException)
{ {
Sequence< sal_Int16 > aRet(nSupported_NumberingTypes ); Sequence< sal_Int16 > aRet(nSupported_NumberingTypes );
sal_Int16* pArray = aRet.getArray(); sal_Int16* pArray = aRet.getArray();
sal_Bool cjkEnabled = isScriptFlagEnabled(OUString("CJK/CJKFont")); sal_Bool cjkEnabled = isScriptFlagEnabled(OUString("CJK/CJKFont"));
sal_Bool ctlEnabled = isScriptFlagEnabled(OUString("CTL/CTLFont")); sal_Bool ctlEnabled = isScriptFlagEnabled(OUString("CTL/CTLFont"));
for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++) { for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++) {
if ( (aSupportedTypes[i].langOption & LANG_ALL) || if ( (aSupportedTypes[i].langOption & LANG_ALL) ||
((aSupportedTypes[i].langOption & LANG_CJK) && cjkEnabled) || ((aSupportedTypes[i].langOption & LANG_CJK) && cjkEnabled) ||
((aSupportedTypes[i].langOption & LANG_CTL) && ctlEnabled) ) ((aSupportedTypes[i].langOption & LANG_CTL) && ctlEnabled) )
pArray[i] = aSupportedTypes[i].nType; pArray[i] = aSupportedTypes[i].nType;
} }
return aRet; return aRet;
} }
sal_Int16 DefaultNumberingProvider::getNumberingType( const OUString& rNumberingIdentifier ) sal_Int16 DefaultNumberingProvider::getNumberingType( const OUString& rNumberingIdentifier )
throw(RuntimeException) throw(RuntimeException)
{ {
for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++) for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++)
if(rNumberingIdentifier.equals(makeNumberingIdentifier(i))) if(rNumberingIdentifier.equals(makeNumberingIdentifier(i)))
return aSupportedTypes[i].nType; return aSupportedTypes[i].nType;
throw RuntimeException(); throw RuntimeException();
} }
sal_Bool DefaultNumberingProvider::hasNumberingType( const OUString& rNumberingIdentifier ) sal_Bool DefaultNumberingProvider::hasNumberingType( const OUString& rNumberingIdentifier )
throw(RuntimeException) throw(RuntimeException)
{ {
for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++) for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++)
if(rNumberingIdentifier.equals(makeNumberingIdentifier(i))) if(rNumberingIdentifier.equals(makeNumberingIdentifier(i)))
return sal_True; return sal_True;
return sal_False; return sal_False;
} }
OUString DefaultNumberingProvider::getNumberingIdentifier( sal_Int16 nNumberingType ) OUString DefaultNumberingProvider::getNumberingIdentifier( sal_Int16 nNumberingType )
throw(RuntimeException) throw(RuntimeException)
{ {
for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++) for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++)
if(nNumberingType == aSupportedTypes[i].nType) if(nNumberingType == aSupportedTypes[i].nType)
return makeNumberingIdentifier(i); return makeNumberingIdentifier(i);
return OUString(); return OUString();
} }
static const sal_Char cDefaultNumberingProvider[] = "com.sun.star.text.DefaultNumberingProvider"; static const sal_Char cDefaultNumberingProvider[] = "com.sun.star.text.DefaultNumberingProvider";
......
...@@ -32,8 +32,8 @@ namespace com { namespace sun { namespace star { namespace i18n { ...@@ -32,8 +32,8 @@ namespace com { namespace sun { namespace star { namespace i18n {
InputSequenceCheckerImpl::InputSequenceCheckerImpl( const Reference < XComponentContext >& rxContext ) : m_xContext( rxContext ) InputSequenceCheckerImpl::InputSequenceCheckerImpl( const Reference < XComponentContext >& rxContext ) : m_xContext( rxContext )
{ {
serviceName = "com.sun.star.i18n.InputSequenceCheckerImpl"; serviceName = "com.sun.star.i18n.InputSequenceCheckerImpl";
cachedItem = NULL; cachedItem = NULL;
} }
InputSequenceCheckerImpl::InputSequenceCheckerImpl() InputSequenceCheckerImpl::InputSequenceCheckerImpl()
...@@ -42,49 +42,49 @@ InputSequenceCheckerImpl::InputSequenceCheckerImpl() ...@@ -42,49 +42,49 @@ InputSequenceCheckerImpl::InputSequenceCheckerImpl()
InputSequenceCheckerImpl::~InputSequenceCheckerImpl() InputSequenceCheckerImpl::~InputSequenceCheckerImpl()
{ {
// Clear lookuptable // Clear lookuptable
for (size_t l = 0; l < lookupTable.size(); l++) for (size_t l = 0; l < lookupTable.size(); l++)
delete lookupTable[l]; delete lookupTable[l];
lookupTable.clear(); lookupTable.clear();
} }
sal_Bool SAL_CALL sal_Bool SAL_CALL
InputSequenceCheckerImpl::checkInputSequence(const OUString& Text, sal_Int32 nStartPos, InputSequenceCheckerImpl::checkInputSequence(const OUString& Text, sal_Int32 nStartPos,
sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(RuntimeException) sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(RuntimeException)
{ {
if (inputCheckMode == InputSequenceCheckMode::PASSTHROUGH) if (inputCheckMode == InputSequenceCheckMode::PASSTHROUGH)
return sal_True; return sal_True;
sal_Char* language = getLanguageByScripType(Text[nStartPos], inputChar); sal_Char* language = getLanguageByScripType(Text[nStartPos], inputChar);
if (language) if (language)
return getInputSequenceChecker(language)->checkInputSequence(Text, nStartPos, inputChar, inputCheckMode); return getInputSequenceChecker(language)->checkInputSequence(Text, nStartPos, inputChar, inputCheckMode);
else else
return sal_True; // not a checkable languages. return sal_True; // not a checkable languages.
} }
sal_Int32 SAL_CALL sal_Int32 SAL_CALL
InputSequenceCheckerImpl::correctInputSequence(OUString& Text, sal_Int32 nStartPos, InputSequenceCheckerImpl::correctInputSequence(OUString& Text, sal_Int32 nStartPos,
sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(RuntimeException) sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(RuntimeException)
{ {
if (inputCheckMode != InputSequenceCheckMode::PASSTHROUGH) { if (inputCheckMode != InputSequenceCheckMode::PASSTHROUGH) {
sal_Char* language = getLanguageByScripType(Text[nStartPos], inputChar); sal_Char* language = getLanguageByScripType(Text[nStartPos], inputChar);
if (language) if (language)
return getInputSequenceChecker(language)->correctInputSequence(Text, nStartPos, inputChar, inputCheckMode); return getInputSequenceChecker(language)->correctInputSequence(Text, nStartPos, inputChar, inputCheckMode);
} }
Text = Text.replaceAt(++nStartPos, 0, OUString(inputChar)); Text = Text.replaceAt(++nStartPos, 0, OUString(inputChar));
return nStartPos; return nStartPos;
} }
static ScriptTypeList typeList[] = { static ScriptTypeList typeList[] = {
//{ UnicodeScript_kHebrew, UnicodeScript_kHebrew }, // 10, //{ UnicodeScript_kHebrew, UnicodeScript_kHebrew }, // 10,
//{ UnicodeScript_kArabic, UnicodeScript_kArabic }, // 11, //{ UnicodeScript_kArabic, UnicodeScript_kArabic }, // 11,
{ UnicodeScript_kDevanagari,UnicodeScript_kDevanagari, UnicodeScript_kDevanagari }, // 14, { UnicodeScript_kDevanagari,UnicodeScript_kDevanagari, UnicodeScript_kDevanagari }, // 14,
{ UnicodeScript_kThai, UnicodeScript_kThai, UnicodeScript_kThai }, // 24, { UnicodeScript_kThai, UnicodeScript_kThai, UnicodeScript_kThai }, // 24,
{ UnicodeScript_kScriptCount, UnicodeScript_kScriptCount, UnicodeScript_kScriptCount } // 88 { UnicodeScript_kScriptCount, UnicodeScript_kScriptCount, UnicodeScript_kScriptCount } // 88
}; };
sal_Char* SAL_CALL sal_Char* SAL_CALL
...@@ -96,8 +96,8 @@ InputSequenceCheckerImpl::getLanguageByScripType(sal_Unicode cChar, sal_Unicode ...@@ -96,8 +96,8 @@ InputSequenceCheckerImpl::getLanguageByScripType(sal_Unicode cChar, sal_Unicode
type == unicode::getUnicodeScriptType( nChar, typeList, UnicodeScript_kScriptCount )) { type == unicode::getUnicodeScriptType( nChar, typeList, UnicodeScript_kScriptCount )) {
switch(type) { switch(type) {
case UnicodeScript_kThai: return (sal_Char*)"th"; case UnicodeScript_kThai: return (sal_Char*)"th";
//case UnicodeScript_kArabic: return (sal_Char*)"ar"; //case UnicodeScript_kArabic: return (sal_Char*)"ar";
//case UnicodeScript_kHebrew: return (sal_Char*)"he"; //case UnicodeScript_kHebrew: return (sal_Char*)"he";
case UnicodeScript_kDevanagari: return (sal_Char*)"hi"; case UnicodeScript_kDevanagari: return (sal_Char*)"hi";
} }
} }
...@@ -107,50 +107,50 @@ InputSequenceCheckerImpl::getLanguageByScripType(sal_Unicode cChar, sal_Unicode ...@@ -107,50 +107,50 @@ InputSequenceCheckerImpl::getLanguageByScripType(sal_Unicode cChar, sal_Unicode
Reference< XExtendedInputSequenceChecker >& SAL_CALL Reference< XExtendedInputSequenceChecker >& SAL_CALL
InputSequenceCheckerImpl::getInputSequenceChecker(sal_Char* rLanguage) throw (RuntimeException) InputSequenceCheckerImpl::getInputSequenceChecker(sal_Char* rLanguage) throw (RuntimeException)
{ {
if (cachedItem && cachedItem->aLanguage == rLanguage) { if (cachedItem && cachedItem->aLanguage == rLanguage) {
return cachedItem->xISC; return cachedItem->xISC;
}
else {
for (size_t l = 0; l < lookupTable.size(); l++) {
cachedItem = lookupTable[l];
if (cachedItem->aLanguage == rLanguage)
return cachedItem->xISC;
} }
else {
for (size_t l = 0; l < lookupTable.size(); l++) {
cachedItem = lookupTable[l];
if (cachedItem->aLanguage == rLanguage)
return cachedItem->xISC;
}
Reference < uno::XInterface > xI = m_xContext->getServiceManager()->createInstanceWithContext( Reference < uno::XInterface > xI = m_xContext->getServiceManager()->createInstanceWithContext(
OUString("com.sun.star.i18n.InputSequenceChecker_") + OUString("com.sun.star.i18n.InputSequenceChecker_") +
OUString::createFromAscii(rLanguage), OUString::createFromAscii(rLanguage),
m_xContext); m_xContext);
if ( xI.is() ) { if ( xI.is() ) {
Reference< XExtendedInputSequenceChecker > xISC( xI, uno::UNO_QUERY ); Reference< XExtendedInputSequenceChecker > xISC( xI, uno::UNO_QUERY );
if (xISC.is()) { if (xISC.is()) {
lookupTable.push_back(cachedItem = new lookupTableItem(rLanguage, xISC)); lookupTable.push_back(cachedItem = new lookupTableItem(rLanguage, xISC));
return cachedItem->xISC; return cachedItem->xISC;
}
} }
} }
throw RuntimeException(); }
throw RuntimeException();
} }
OUString SAL_CALL OUString SAL_CALL
InputSequenceCheckerImpl::getImplementationName(void) throw( RuntimeException ) InputSequenceCheckerImpl::getImplementationName(void) throw( RuntimeException )
{ {
return OUString::createFromAscii(serviceName); return OUString::createFromAscii(serviceName);
} }
sal_Bool SAL_CALL sal_Bool SAL_CALL
InputSequenceCheckerImpl::supportsService(const OUString& rServiceName) throw( RuntimeException ) InputSequenceCheckerImpl::supportsService(const OUString& rServiceName) throw( RuntimeException )
{ {
return !rServiceName.compareToAscii(serviceName); return !rServiceName.compareToAscii(serviceName);
} }
Sequence< OUString > SAL_CALL Sequence< OUString > SAL_CALL
InputSequenceCheckerImpl::getSupportedServiceNames(void) throw( RuntimeException ) InputSequenceCheckerImpl::getSupportedServiceNames(void) throw( RuntimeException )
{ {
Sequence< OUString > aRet(1); Sequence< OUString > aRet(1);
aRet[0] = OUString::createFromAscii(serviceName); aRet[0] = OUString::createFromAscii(serviceName);
return aRet; return aRet;
} }
} } } } } } } }
......
...@@ -32,19 +32,19 @@ namespace com { namespace sun { namespace star { namespace i18n { ...@@ -32,19 +32,19 @@ namespace com { namespace sun { namespace star { namespace i18n {
// see http://charts.unicode.org/Web/U3040.html Hiragana (U+3040..U+309F) // see http://charts.unicode.org/Web/U3040.html Hiragana (U+3040..U+309F)
// see http://charts.unicode.org/Web/U30A0.html Katakana (U+30A0..U+30FF) // see http://charts.unicode.org/Web/U30A0.html Katakana (U+30A0..U+30FF)
static sal_Unicode toKatakana (const sal_Unicode c) { static sal_Unicode toKatakana (const sal_Unicode c) {
if ( (0x3041 <= c && c <= 0x3096) || (0x309d <= c && c <= 0x309f) ) { // 3040 - 309F HIRAGANA LETTER if ( (0x3041 <= c && c <= 0x3096) || (0x309d <= c && c <= 0x309f) ) { // 3040 - 309F HIRAGANA LETTER
// shift code point by 0x0060 // shift code point by 0x0060
return c + (0x30a0 - 0x3040); return c + (0x30a0 - 0x3040);
} }
return c; return c;
} }
hiraganaToKatakana::hiraganaToKatakana() hiraganaToKatakana::hiraganaToKatakana()
{ {
func = toKatakana; func = toKatakana;
table = 0; table = 0;
transliterationName = "hiraganaToKatakana"; transliterationName = "hiraganaToKatakana";
implementationName = "com.sun.star.i18n.Transliteration.HIRAGANA_KATAKANA"; implementationName = "com.sun.star.i18n.Transliteration.HIRAGANA_KATAKANA";
} }
} } } } } } } }
......
...@@ -29,20 +29,20 @@ using namespace com::sun::star::uno; ...@@ -29,20 +29,20 @@ using namespace com::sun::star::uno;
namespace com { namespace sun { namespace star { namespace i18n { namespace com { namespace sun { namespace star { namespace i18n {
static const Mapping BaFa[] = { static const Mapping BaFa[] = {
{ 0x30F4, 0x30A1, 0x30D0, sal_True }, { 0x30F4, 0x30A1, 0x30D0, sal_True },
{ 0x3094, 0x3041, 0x3070, sal_True }, { 0x3094, 0x3041, 0x3070, sal_True },
{ 0x30D5, 0x30A1, 0x30CF, sal_True }, { 0x30D5, 0x30A1, 0x30CF, sal_True },
{ 0x3075, 0x3041, 0x306F, sal_True }, { 0x3075, 0x3041, 0x306F, sal_True },
{ 0, 0, 0, sal_True } { 0, 0, 0, sal_True }
}; };
ignoreBaFa_ja_JP::ignoreBaFa_ja_JP() ignoreBaFa_ja_JP::ignoreBaFa_ja_JP()
{ {
func = (TransFunc) 0; func = (TransFunc) 0;
table = 0; table = 0;
map = BaFa; map = BaFa;
transliterationName = "ignoreBaFa_ja_JP"; transliterationName = "ignoreBaFa_ja_JP";
implementationName = "com.sun.star.i18n.Transliteration.ignoreBaFa_ja_JP"; implementationName = "com.sun.star.i18n.Transliteration.ignoreBaFa_ja_JP";
} }
} } } } } } } }
......
...@@ -30,20 +30,20 @@ using namespace com::sun::star::lang; ...@@ -30,20 +30,20 @@ using namespace com::sun::star::lang;
namespace com { namespace sun { namespace star { namespace i18n { namespace com { namespace sun { namespace star { namespace i18n {
static const Mapping HyuByu[] = { static const Mapping HyuByu[] = {
{ 0x30D5, 0x30E5, 0x30D2, sal_False }, { 0x30D5, 0x30E5, 0x30D2, sal_False },
{ 0x3075, 0x3085, 0x3072, sal_False }, { 0x3075, 0x3085, 0x3072, sal_False },
{ 0x30F4, 0x30E5, 0x30D3, sal_False }, { 0x30F4, 0x30E5, 0x30D3, sal_False },
{ 0x3094, 0x3085, 0x3073, sal_False }, { 0x3094, 0x3085, 0x3073, sal_False },
{ 0, 0, 0, sal_False } { 0, 0, 0, sal_False }
}; };
ignoreHyuByu_ja_JP::ignoreHyuByu_ja_JP() ignoreHyuByu_ja_JP::ignoreHyuByu_ja_JP()
{ {
func = (TransFunc) 0; func = (TransFunc) 0;
table = 0; table = 0;
map = HyuByu; map = HyuByu;
transliterationName = "ignoreHyuByu_ja_JP"; transliterationName = "ignoreHyuByu_ja_JP";
implementationName = "com.sun.star.i18n.Transliteration.ignoreHyuByu_ja_JP"; implementationName = "com.sun.star.i18n.Transliteration.ignoreHyuByu_ja_JP";
} }
} } } } } } } }
......
...@@ -40,11 +40,11 @@ ignoreMiddleDot_ja_JP_translator (const sal_Unicode c) ...@@ -40,11 +40,11 @@ ignoreMiddleDot_ja_JP_translator (const sal_Unicode c)
ignoreMiddleDot_ja_JP::ignoreMiddleDot_ja_JP() ignoreMiddleDot_ja_JP::ignoreMiddleDot_ja_JP()
{ {
func = ignoreMiddleDot_ja_JP_translator; func = ignoreMiddleDot_ja_JP_translator;
table = 0; table = 0;
map = 0; map = 0;
transliterationName = "ignoreMiddleDot_ja_JP"; transliterationName = "ignoreMiddleDot_ja_JP";
implementationName = "com.sun.star.i18n.Transliteration.ignoreMiddleDot_ja_JP"; implementationName = "com.sun.star.i18n.Transliteration.ignoreMiddleDot_ja_JP";
} }
} } } } } } } }
......
...@@ -47,11 +47,11 @@ ignoreMinusSign_ja_JP_translator (const sal_Unicode c) ...@@ -47,11 +47,11 @@ ignoreMinusSign_ja_JP_translator (const sal_Unicode c)
ignoreMinusSign_ja_JP::ignoreMinusSign_ja_JP() ignoreMinusSign_ja_JP::ignoreMinusSign_ja_JP()
{ {
func = ignoreMinusSign_ja_JP_translator; func = ignoreMinusSign_ja_JP_translator;
table = 0; table = 0;
map = 0; map = 0;
transliterationName = "ignoreMinusSign_ja_JP"; transliterationName = "ignoreMinusSign_ja_JP";
implementationName = "com.sun.star.i18n.Transliteration.ignoreMinusSign_ja_JP"; implementationName = "com.sun.star.i18n.Transliteration.ignoreMinusSign_ja_JP";
} }
} } } } } } } }
......
...@@ -30,25 +30,25 @@ using namespace com::sun::star::lang; ...@@ -30,25 +30,25 @@ using namespace com::sun::star::lang;
namespace com { namespace sun { namespace star { namespace i18n { namespace com { namespace sun { namespace star { namespace i18n {
static const Mapping SeZe[] = { static const Mapping SeZe[] = {
// SI + E --> SE // SI + E --> SE
{ 0x30B7, 0x30A7, 0x30BB, sal_True }, { 0x30B7, 0x30A7, 0x30BB, sal_True },
// SI + E --> SE // SI + E --> SE
{ 0x3057, 0x3047, 0x305B, sal_True }, { 0x3057, 0x3047, 0x305B, sal_True },
// ZI + E --> ZE // ZI + E --> ZE
{ 0x30B8, 0x30A7, 0x30BC, sal_True }, { 0x30B8, 0x30A7, 0x30BC, sal_True },
// ZI + E --> ZE // ZI + E --> ZE
{ 0x3058, 0x3047, 0x305C, sal_True }, { 0x3058, 0x3047, 0x305C, sal_True },
{ 0, 0, 0, sal_True } { 0, 0, 0, sal_True }
}; };
ignoreSeZe_ja_JP::ignoreSeZe_ja_JP() ignoreSeZe_ja_JP::ignoreSeZe_ja_JP()
{ {
func = (TransFunc) 0; func = (TransFunc) 0;
table = 0; table = 0;
map = SeZe; map = SeZe;
transliterationName = "ignoreSeZe_ja_JP"; transliterationName = "ignoreSeZe_ja_JP";
implementationName = "com.sun.star.i18n.Transliteration.ignoreSeZe_ja_JP"; implementationName = "com.sun.star.i18n.Transliteration.ignoreSeZe_ja_JP";
} }
} } } } } } } }
......
...@@ -104,12 +104,12 @@ OneToOneMappingTable_t ignoreSeparatorTable[] = { ...@@ -104,12 +104,12 @@ OneToOneMappingTable_t ignoreSeparatorTable[] = {
ignoreSeparator_ja_JP::ignoreSeparator_ja_JP() ignoreSeparator_ja_JP::ignoreSeparator_ja_JP()
{ {
static oneToOneMapping _table(ignoreSeparatorTable, sizeof(ignoreSeparatorTable)); static oneToOneMapping _table(ignoreSeparatorTable, sizeof(ignoreSeparatorTable));
func = (TransFunc) 0; func = (TransFunc) 0;
table = &_table; table = &_table;
map = 0; map = 0;
transliterationName = "ignoreSeparator_ja_JP"; transliterationName = "ignoreSeparator_ja_JP";
implementationName = "com.sun.star.i18n.Transliteration.ignoreSeparator_ja_JP"; implementationName = "com.sun.star.i18n.Transliteration.ignoreSeparator_ja_JP";
} }
} } } } } } } }
......
...@@ -47,11 +47,11 @@ OneToOneMappingTable_t ignoreSpace_ja_JP_mappingTable[] = { ...@@ -47,11 +47,11 @@ OneToOneMappingTable_t ignoreSpace_ja_JP_mappingTable[] = {
ignoreSpace_ja_JP::ignoreSpace_ja_JP() ignoreSpace_ja_JP::ignoreSpace_ja_JP()
{ {
func = (TransFunc)0; func = (TransFunc)0;
table = new oneToOneMapping(ignoreSpace_ja_JP_mappingTable, sizeof(ignoreSpace_ja_JP_mappingTable)); table = new oneToOneMapping(ignoreSpace_ja_JP_mappingTable, sizeof(ignoreSpace_ja_JP_mappingTable));
map = 0; map = 0;
transliterationName = "ignoreSpace_ja_JP"; transliterationName = "ignoreSpace_ja_JP";
implementationName = "com.sun.star.i18n.Transliteration.ignoreSpace_ja_JP"; implementationName = "com.sun.star.i18n.Transliteration.ignoreSpace_ja_JP";
} }
} } } } } } } }
......
...@@ -31,29 +31,29 @@ namespace com { namespace sun { namespace star { namespace i18n { ...@@ -31,29 +31,29 @@ namespace com { namespace sun { namespace star { namespace i18n {
static const Mapping TiJi[] = { static const Mapping TiJi[] = {
// TU + I --> TI // TU + I --> TI
{ 0x30C4, 0x30A3, 0x30C1, sal_True }, { 0x30C4, 0x30A3, 0x30C1, sal_True },
// TE + I --> TI // TE + I --> TI
{ 0x30C6, 0x30A3, 0x30C1, sal_True }, { 0x30C6, 0x30A3, 0x30C1, sal_True },
// TU + I --> TI // TU + I --> TI
{ 0x3064, 0x3043, 0x3061, sal_True }, { 0x3064, 0x3043, 0x3061, sal_True },
// TE + I --> TI // TE + I --> TI
{ 0x3066, 0x3043, 0x3061, sal_True }, { 0x3066, 0x3043, 0x3061, sal_True },
// DE + I --> ZI // DE + I --> ZI
{ 0x30C7, 0x30A3, 0x30B8, sal_True }, { 0x30C7, 0x30A3, 0x30B8, sal_True },
// DE + I --> ZI // DE + I --> ZI
{ 0x3067, 0x3043, 0x3058, sal_True }, { 0x3067, 0x3043, 0x3058, sal_True },
{ 0, 0, 0, sal_True } { 0, 0, 0, sal_True }
}; };
ignoreTiJi_ja_JP::ignoreTiJi_ja_JP() ignoreTiJi_ja_JP::ignoreTiJi_ja_JP()
{ {
func = (TransFunc) 0; func = (TransFunc) 0;
table = 0; table = 0;
map = TiJi; map = TiJi;
transliterationName = "ignoreTiJi_ja_JP"; transliterationName = "ignoreTiJi_ja_JP";
implementationName = "com.sun.star.i18n.Transliteration.ignoreTiJi_ja_JP"; implementationName = "com.sun.star.i18n.Transliteration.ignoreTiJi_ja_JP";
} }
} } } } } } } }
......
...@@ -48,11 +48,11 @@ ignoreTraditionalKana_ja_JP_translator (const sal_Unicode c) ...@@ -48,11 +48,11 @@ ignoreTraditionalKana_ja_JP_translator (const sal_Unicode c)
ignoreTraditionalKana_ja_JP::ignoreTraditionalKana_ja_JP() ignoreTraditionalKana_ja_JP::ignoreTraditionalKana_ja_JP()
{ {
func = ignoreTraditionalKana_ja_JP_translator; func = ignoreTraditionalKana_ja_JP_translator;
table = 0; table = 0;
map = 0; map = 0;
transliterationName = "ignoreTraditionalKana_ja_JP"; transliterationName = "ignoreTraditionalKana_ja_JP";
implementationName = "com.sun.star.i18n.Transliteration.ignoreTraditionalKana_ja_JP"; implementationName = "com.sun.star.i18n.Transliteration.ignoreTraditionalKana_ja_JP";
} }
} } } } } } } }
......
...@@ -726,12 +726,12 @@ OneToOneMappingTable_t traditionalKanji2updateKanji[] = { ...@@ -726,12 +726,12 @@ OneToOneMappingTable_t traditionalKanji2updateKanji[] = {
ignoreTraditionalKanji_ja_JP::ignoreTraditionalKanji_ja_JP() ignoreTraditionalKanji_ja_JP::ignoreTraditionalKanji_ja_JP()
{ {
static oneToOneMapping _table(traditionalKanji2updateKanji, sizeof(traditionalKanji2updateKanji)); static oneToOneMapping _table(traditionalKanji2updateKanji, sizeof(traditionalKanji2updateKanji));
func = (TransFunc)0; func = (TransFunc)0;
table = &_table; table = &_table;
map = 0; map = 0;
transliterationName = "ignoreTraditionalKanji_ja_JP"; transliterationName = "ignoreTraditionalKanji_ja_JP";
implementationName = "com.sun.star.i18n.Transliteration.ignoreTraditionalKanji_ja_JP"; implementationName = "com.sun.star.i18n.Transliteration.ignoreTraditionalKanji_ja_JP";
} }
} } } } } } } }
......
...@@ -48,11 +48,11 @@ ignoreZiZu_ja_JP_translator (const sal_Unicode c) ...@@ -48,11 +48,11 @@ ignoreZiZu_ja_JP_translator (const sal_Unicode c)
ignoreZiZu_ja_JP::ignoreZiZu_ja_JP() ignoreZiZu_ja_JP::ignoreZiZu_ja_JP()
{ {
func = ignoreZiZu_ja_JP_translator; func = ignoreZiZu_ja_JP_translator;
table = 0; table = 0;
map = 0; map = 0;
transliterationName = "ignoreZiZu_ja_JP"; transliterationName = "ignoreZiZu_ja_JP";
implementationName = "com.sun.star.i18n.Transliteration.ignoreZiZu_ja_JP"; implementationName = "com.sun.star.i18n.Transliteration.ignoreZiZu_ja_JP";
} }
} } } } } } } }
......
...@@ -32,53 +32,53 @@ sal_Bool SAL_CALL ...@@ -32,53 +32,53 @@ sal_Bool SAL_CALL
transliteration_Ignore::equals(const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, transliteration_Ignore::equals(const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1,
const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) throw(RuntimeException) const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) throw(RuntimeException)
{ {
Sequence< sal_Int32 > offset1; Sequence< sal_Int32 > offset1;
Sequence< sal_Int32 > offset2; Sequence< sal_Int32 > offset2;
// The method folding is defined in a sub class. // The method folding is defined in a sub class.
OUString s1 = this->folding( str1, pos1, nCount1, offset1); OUString s1 = this->folding( str1, pos1, nCount1, offset1);
OUString s2 = this->folding( str2, pos2, nCount2, offset2); OUString s2 = this->folding( str2, pos2, nCount2, offset2);
const sal_Unicode * p1 = s1.getStr(); const sal_Unicode * p1 = s1.getStr();
const sal_Unicode * p2 = s2.getStr(); const sal_Unicode * p2 = s2.getStr();
sal_Int32 length = Min(s1.getLength(), s2.getLength()); sal_Int32 length = Min(s1.getLength(), s2.getLength());
sal_Int32 nmatch; sal_Int32 nmatch;
for ( nmatch = 0; nmatch < length; nmatch++) for ( nmatch = 0; nmatch < length; nmatch++)
if (*p1++ != *p2++) if (*p1++ != *p2++)
break; break;
if (nmatch > 0) { if (nmatch > 0) {
nMatch1 = offset1[ nmatch - 1 ] + 1; // Subtract 1 from nmatch because the index starts from zero. nMatch1 = offset1[ nmatch - 1 ] + 1; // Subtract 1 from nmatch because the index starts from zero.
nMatch2 = offset2[ nmatch - 1 ] + 1; // And then, add 1 to position because it means the number of character matched. nMatch2 = offset2[ nmatch - 1 ] + 1; // And then, add 1 to position because it means the number of character matched.
} }
else { else {
nMatch1 = 0; // No character was matched. nMatch1 = 0; // No character was matched.
nMatch2 = 0; nMatch2 = 0;
} }
return (nmatch == s1.getLength()) && (nmatch == s2.getLength()); return (nmatch == s1.getLength()) && (nmatch == s2.getLength());
} }
Sequence< OUString > SAL_CALL Sequence< OUString > SAL_CALL
transliteration_Ignore::transliterateRange( const OUString& str1, const OUString& str2 ) throw(RuntimeException) transliteration_Ignore::transliterateRange( const OUString& str1, const OUString& str2 ) throw(RuntimeException)
{ {
if (str1.isEmpty() || str2.isEmpty()) if (str1.isEmpty() || str2.isEmpty())
throw RuntimeException(); throw RuntimeException();
Sequence< OUString > r(2); Sequence< OUString > r(2);
r[0] = str1.copy(0, 1); r[0] = str1.copy(0, 1);
r[1] = str2.copy(0, 1); r[1] = str2.copy(0, 1);
return r; return r;
} }
sal_Int16 SAL_CALL sal_Int16 SAL_CALL
transliteration_Ignore::getType() throw(RuntimeException) transliteration_Ignore::getType() throw(RuntimeException)
{ {
// The type is also defined in com/sun/star/util/TransliterationType.hdl // The type is also defined in com/sun/star/util/TransliterationType.hdl
return TransliterationType::IGNORE; return TransliterationType::IGNORE;
} }
...@@ -86,36 +86,36 @@ OUString SAL_CALL ...@@ -86,36 +86,36 @@ OUString SAL_CALL
transliteration_Ignore::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, transliteration_Ignore::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
Sequence< sal_Int32 >& offset ) throw(RuntimeException) Sequence< sal_Int32 >& offset ) throw(RuntimeException)
{ {
// The method folding is defined in a sub class. // The method folding is defined in a sub class.
return this->folding( inStr, startPos, nCount, offset); return this->folding( inStr, startPos, nCount, offset);
} }
Sequence< OUString > SAL_CALL Sequence< OUString > SAL_CALL
transliteration_Ignore::transliterateRange( const OUString& str1, const OUString& str2, transliteration_Ignore::transliterateRange( const OUString& str1, const OUString& str2,
XTransliteration& t1, XTransliteration& t2 ) throw(RuntimeException) XTransliteration& t1, XTransliteration& t2 ) throw(RuntimeException)
{ {
if (str1.isEmpty() || str2.isEmpty()) if (str1.isEmpty() || str2.isEmpty())
throw RuntimeException(); throw RuntimeException();
Sequence< sal_Int32 > offset; Sequence< sal_Int32 > offset;
OUString s11 = t1.transliterate( str1, 0, 1, offset ); OUString s11 = t1.transliterate( str1, 0, 1, offset );
OUString s12 = t1.transliterate( str2, 0, 1, offset ); OUString s12 = t1.transliterate( str2, 0, 1, offset );
OUString s21 = t2.transliterate( str1, 0, 1, offset ); OUString s21 = t2.transliterate( str1, 0, 1, offset );
OUString s22 = t2.transliterate( str2, 0, 1, offset ); OUString s22 = t2.transliterate( str2, 0, 1, offset );
if ( (s11 == s21) && (s12 == s22) ) {
Sequence< OUString > r(2);
r[0] = s11;
r[1] = s12;
return r;
}
Sequence< OUString > r(4); if ( (s11 == s21) && (s12 == s22) ) {
Sequence< OUString > r(2);
r[0] = s11; r[0] = s11;
r[1] = s12; r[1] = s12;
r[2] = s21;
r[3] = s22;
return r; return r;
}
Sequence< OUString > r(4);
r[0] = s11;
r[1] = s12;
r[2] = s21;
r[3] = s22;
return r;
} }
OUString SAL_CALL OUString SAL_CALL
......
...@@ -183,25 +183,25 @@ Transliteration_body::transliterate( ...@@ -183,25 +183,25 @@ Transliteration_body::transliterate(
OUString SAL_CALL OUString SAL_CALL
Transliteration_body::transliterateChar2String( sal_Unicode inChar ) throw(RuntimeException) Transliteration_body::transliterateChar2String( sal_Unicode inChar ) throw(RuntimeException)
{ {
const Mapping &map = casefolding::getValue(&inChar, 0, 1, aLocale, nMappingType); const Mapping &map = casefolding::getValue(&inChar, 0, 1, aLocale, nMappingType);
rtl_uString* pStr = rtl_uString_alloc(map.nmap); rtl_uString* pStr = rtl_uString_alloc(map.nmap);
sal_Unicode* out = pStr->buffer; sal_Unicode* out = pStr->buffer;
sal_Int32 i; sal_Int32 i;
for (i = 0; i < map.nmap; i++) for (i = 0; i < map.nmap; i++)
out[i] = map.map[i]; out[i] = map.map[i];
out[i] = 0; out[i] = 0;
return OUString( pStr, SAL_NO_ACQUIRE ); return OUString( pStr, SAL_NO_ACQUIRE );
} }
sal_Unicode SAL_CALL sal_Unicode SAL_CALL
Transliteration_body::transliterateChar2Char( sal_Unicode inChar ) throw(MultipleCharsOutputException, RuntimeException) Transliteration_body::transliterateChar2Char( sal_Unicode inChar ) throw(MultipleCharsOutputException, RuntimeException)
{ {
const Mapping &map = casefolding::getValue(&inChar, 0, 1, aLocale, nMappingType); const Mapping &map = casefolding::getValue(&inChar, 0, 1, aLocale, nMappingType);
if (map.nmap > 1) if (map.nmap > 1)
throw MultipleCharsOutputException(); throw MultipleCharsOutputException();
return map.map[0]; return map.map[0];
} }
OUString SAL_CALL OUString SAL_CALL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment