summaryrefslogtreecommitdiff
path: root/i18npool/source
diff options
context:
space:
mode:
Diffstat (limited to 'i18npool/source')
-rw-r--r--i18npool/source/breakiterator/gendict.cxx26
-rw-r--r--i18npool/source/breakiterator/xdictionary.cxx52
-rw-r--r--i18npool/source/collator/collator_unicode.cxx111
-rw-r--r--i18npool/source/collator/gencoll_rule.cxx7
-rw-r--r--i18npool/source/indexentry/indexentrysupplier_asian.cxx123
-rw-r--r--i18npool/source/localedata/localedata.cxx57
-rw-r--r--i18npool/source/textconversion/textconversion.cxx12
-rw-r--r--i18npool/source/textconversion/textconversion_ko.cxx16
-rw-r--r--i18npool/source/textconversion/textconversion_zh.cxx55
-rw-r--r--i18npool/source/transliteration/textToPronounce_zh.cxx39
10 files changed, 447 insertions, 51 deletions
diff --git a/i18npool/source/breakiterator/gendict.cxx b/i18npool/source/breakiterator/gendict.cxx
index ce9137d54179..960dae63a763 100644
--- a/i18npool/source/breakiterator/gendict.cxx
+++ b/i18npool/source/breakiterator/gendict.cxx
@@ -73,13 +73,21 @@ static inline void printIncludes(FILE* source_fp)
fputs("#include <sal/types.h>\n\n", source_fp);
}
-static inline void printFunctions(FILE* source_fp)
+static inline void printFunctions(FILE* source_fp, const char *lang)
{
- fputs ("\tconst sal_uInt8* getExistMark() { return existMark; }\n", source_fp);
- fputs ("\tconst sal_Int16* getIndex1() { return index1; }\n", source_fp);
- fputs ("\tconst sal_Int32* getIndex2() { return index2; }\n", source_fp);
- fputs ("\tconst sal_Int32* getLenArray() { return lenArray; }\n", source_fp);
- fputs ("\tconst sal_Unicode* getDataArea() { return dataArea; }\n", source_fp);
+ fputs ("#ifndef DISABLE_DYNLOADING\n", source_fp);
+ fputs ("SAL_DLLPUBLIC_EXPORT const sal_uInt8* getExistMark() { return existMark; }\n", source_fp);
+ fputs ("SAL_DLLPUBLIC_EXPORT const sal_Int16* getIndex1() { return index1; }\n", source_fp);
+ fputs ("SAL_DLLPUBLIC_EXPORT const sal_Int32* getIndex2() { return index2; }\n", source_fp);
+ fputs ("SAL_DLLPUBLIC_EXPORT const sal_Int32* getLenArray() { return lenArray; }\n", source_fp);
+ fputs ("SAL_DLLPUBLIC_EXPORT const sal_Unicode* getDataArea() { return dataArea; }\n", source_fp);
+ fputs ("#else\n", source_fp);
+ fprintf (source_fp, "SAL_DLLPUBLIC_EXPORT const sal_uInt8* getExistMark_%s() { return existMark; }\n", lang);
+ fprintf (source_fp, "SAL_DLLPUBLIC_EXPORT const sal_Int16* getIndex1_%s() { return index1; }\n", lang);
+ fprintf (source_fp, "SAL_DLLPUBLIC_EXPORT const sal_Int32* getIndex2_%s() { return index2; }\n", lang);
+ fprintf (source_fp, "SAL_DLLPUBLIC_EXPORT const sal_Int32* getLenArray_%s() { return lenArray; }\n", lang);
+ fprintf (source_fp, "SAL_DLLPUBLIC_EXPORT const sal_Unicode* getDataArea_%s() { return dataArea; }\n", lang);
+ fputs ("#endif\n", source_fp);
}
static inline void printDataArea(FILE *dictionary_fp, FILE *source_fp, vector<sal_uInt32>& lenArray)
@@ -199,9 +207,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
{
FILE *dictionary_fp, *source_fp;
- if (argc == 1 || argc > 3)
+ if (argc == 1 || argc > 4)
{
- fputs("2 arguments required: dictionary_file_name source_file_name", stderr);
+ fputs("3 arguments required: dictionary_file_name source_file_name language_code", stderr);
exit(-1);
}
@@ -235,7 +243,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
printIndex1(source_fp, set);
printIndex2(source_fp, set);
printExistsMask(source_fp);
- printFunctions(source_fp);
+ printFunctions(source_fp, argv[3]);
fputs("}\n", source_fp);
fclose(dictionary_fp);
diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx
index 955cff4a043d..540bce8b3a91 100644
--- a/i18npool/source/breakiterator/xdictionary.cxx
+++ b/i18npool/source/breakiterator/xdictionary.cxx
@@ -49,19 +49,44 @@ using ::rtl::OUStringBuffer;
namespace com { namespace sun { namespace star { namespace i18n {
+#ifndef DISABLE_DYNLOADING
+
extern "C" { static void SAL_CALL thisModule() {} }
+#else
+
+extern "C" {
+
+sal_uInt8* getExistMark_ja();
+sal_Int16* getIndex1_ja();
+sal_Int32* getIndex2_ja();
+sal_Int32* getLenArray_ja();
+sal_Unicode* getDataArea_ja();
+
+sal_uInt8* getExistMark_zh();
+sal_Int16* getIndex1_zh();
+sal_Int32* getIndex2_zh();
+sal_Int32* getLenArray_zh();
+sal_Unicode* getDataArea_zh();
+
+}
+
+#endif
+
xdictionary::xdictionary(const sal_Char *lang) :
existMark( NULL ),
index1( NULL ),
index2( NULL ),
lenArray( NULL ),
dataArea( NULL ),
+#ifndef DISABLE_DYNLOADING
hModule( NULL ),
+#endif
boundary(),
japaneseWordBreak( sal_False )
{
index1 = 0;
+#ifndef DISABLE_DYNLOADING
#ifdef SAL_DLLPREFIX
OUStringBuffer aBuf( strlen(lang) + 7 + 6 ); // mostly "lib*.so" (with * == dict_zh)
aBuf.appendAscii( SAL_DLLPREFIX );
@@ -92,6 +117,31 @@ xdictionary::xdictionary(const sal_Char *lang) :
dataArea = NULL;
}
+#else
+ if( strcmp( lang, "ja" ) == 0 ) {
+ existMark = getExistMark_ja();
+ index1 = getIndex1_ja();
+ index2 = getIndex2_ja();
+ lenArray = getLenArray_ja();
+ dataArea = getDataArea_ja();
+ }
+ else if( strcmp( lang, "zh" ) == 0 ) {
+ existMark = getExistMark_zh();
+ index1 = getIndex1_zh();
+ index2 = getIndex2_zh();
+ lenArray = getLenArray_zh();
+ dataArea = getDataArea_zh();
+ }
+ else
+ {
+ existMark = NULL;
+ index1 = NULL;
+ index2 = NULL;
+ lenArray = NULL;
+ dataArea = NULL;
+ }
+#endif
+
for (sal_Int32 i = 0; i < CACHE_MAX; i++)
cache[i].size = 0;
@@ -99,7 +149,9 @@ xdictionary::xdictionary(const sal_Char *lang) :
}
xdictionary::~xdictionary() {
+#ifndef DISABLE_DYNLOADING
osl_unloadModule(hModule);
+#endif
for (sal_Int32 i = 0; i < CACHE_MAX; i++) {
if (cache[i].size > 0) {
delete [] cache[i].contents;
diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx
index f574cdfd430c..7cbb59833e70 100644
--- a/i18npool/source/collator/collator_unicode.cxx
+++ b/i18npool/source/collator/collator_unicode.cxx
@@ -47,16 +47,53 @@ Collator_Unicode::Collator_Unicode()
implementationName = "com.sun.star.i18n.Collator_Unicode";
collator = NULL;
uca_base = NULL;
+#ifndef DISABLE_DYNLOADING
hModule = NULL;
+#endif
}
Collator_Unicode::~Collator_Unicode()
{
if (collator) delete collator;
if (uca_base) delete uca_base;
+#ifndef DISABLE_DYNLOADING
if (hModule) osl_unloadModule(hModule);
+#endif
}
+#ifdef DISABLE_DYNLOADING
+
+extern "C" {
+
+// For DISABLE_DYNLOADING the generated functions have names that
+// start with get_collator_data_ to avoid clashing with a few
+// functions in the generated libindex_data that are called just
+// get_zh_pinyin for instance.
+
+const sal_uInt8* get_collator_data_ca_charset();
+const sal_uInt8* get_collator_data_dz_charset();
+const sal_uInt8* get_collator_data_hu_charset();
+const sal_uInt8* get_collator_data_ja_charset();
+const sal_uInt8* get_collator_data_ja_phonetic_alphanumeric_first();
+const sal_uInt8* get_collator_data_ja_phonetic_alphanumeric_last();
+const sal_uInt8* get_collator_data_ko_charset();
+const sal_uInt8* get_collator_data_ku_alphanumeric();
+const sal_uInt8* get_collator_data_ln_charset();
+const sal_uInt8* get_collator_data_my_dictionary();
+const sal_uInt8* get_collator_data_ne_charset();
+const sal_uInt8* get_collator_data_zh_TW_charset();
+const sal_uInt8* get_collator_data_zh_TW_radical();
+const sal_uInt8* get_collator_data_zh_TW_stroke();
+const sal_uInt8* get_collator_data_zh_charset();
+const sal_uInt8* get_collator_data_zh_pinyin();
+const sal_uInt8* get_collator_data_zh_radical();
+const sal_uInt8* get_collator_data_zh_stroke();
+const sal_uInt8* get_collator_data_zh_zhuyin();
+
+}
+
+#endif
+
sal_Int32 SAL_CALL
Collator_Unicode::compareSubstring( const OUString& str1, sal_Int32 off1, sal_Int32 len1,
const OUString& str2, sal_Int32 off2, sal_Int32 len2) throw(RuntimeException)
@@ -70,8 +107,12 @@ Collator_Unicode::compareString( const OUString& str1, const OUString& str2) thr
return collator->compare(reinterpret_cast<const UChar *>(str1.getStr()), reinterpret_cast<const UChar *>(str2.getStr())); // UChar != sal_Unicode in MinGW
}
+#ifndef DISABLE_DYNLOADING
+
extern "C" { static void SAL_CALL thisModule() {} }
+#endif
+
sal_Int32 SAL_CALL
Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::Locale& rLocale, sal_Int32 options)
throw(RuntimeException)
@@ -84,6 +125,9 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
if (! U_SUCCESS(status)) throw RuntimeException();
}
if (!collator && OUString::createFromAscii(LOCAL_RULE_LANGS).indexOf(rLocale.Language) >= 0) {
+ const sal_uInt8* (*func)() = NULL;
+
+#ifndef DISABLE_DYNLOADING
OUStringBuffer aBuf;
#ifdef SAL_DLLPREFIX
aBuf.appendAscii(SAL_DLLPREFIX);
@@ -91,7 +135,6 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
aBuf.appendAscii( "collator_data" ).appendAscii( SAL_DLLEXTENSION );
hModule = osl_loadModuleRelative( &thisModule, aBuf.makeStringAndClear().pData, SAL_LOADMODULE_DEFAULT );
if (hModule) {
- const sal_uInt8* (*func)() = NULL;
aBuf.appendAscii("get_").append(rLocale.Language).appendAscii("_");
if ( rLocale.Language == "zh" ) {
OUString func_base = aBuf.makeStringAndClear();
@@ -114,13 +157,65 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
}
func=(const sal_uInt8* (*)()) osl_getFunctionSymbol(hModule, aBuf.makeStringAndClear().pData);
}
- if (func) {
- const sal_uInt8* ruleImage=func();
- uca_base = new RuleBasedCollator(static_cast<UChar*>(NULL), status);
- if (! U_SUCCESS(status)) throw RuntimeException();
- collator = new RuleBasedCollator(reinterpret_cast<const uint8_t*>(ruleImage), -1, uca_base, status);
- if (! U_SUCCESS(status)) throw RuntimeException();
- }
+ }
+#else
+ if ( rLocale.Language == "ca" ) {
+ if ( rAlgorithm == "charset" )
+ func = get_collator_data_ca_charset;
+ } else if ( rLocale.Language == "dz" ) {
+ if ( rAlgorithm == "charset" )
+ func = get_collator_data_dz_charset;
+ } else if ( rLocale.Language == "hu" ) {
+ if ( rAlgorithm == "charset" )
+ func = get_collator_data_hu_charset;
+ } else if ( rLocale.Language == "ja" ) {
+ if ( rAlgorithm == "charset" )
+ func = get_collator_data_hu_charset;
+ else if ( rAlgorithm == "phonetic (alphanumeric first)" )
+ func = get_collator_data_ja_phonetic_alphanumeric_first;
+ else if ( rAlgorithm == "phonetic (alphanumeric last)" )
+ func = get_collator_data_ja_phonetic_alphanumeric_last;
+ } else if ( rLocale.Language == "ko" ) {
+ if ( rAlgorithm == "charset" )
+ func = get_collator_data_ko_charset;
+ } else if ( rLocale.Language == "ku" ) {
+ if ( rAlgorithm == "alphanumeric" )
+ func = get_collator_data_ku_alphanumeric;
+ } else if ( rLocale.Language == "ln" ) {
+ if ( rAlgorithm == "charset" )
+ func = get_collator_data_ln_charset;
+ } else if ( rLocale.Language == "my" ) {
+ if ( rAlgorithm == "dictionary" )
+ func = get_collator_data_my_dictionary;
+ } else if ( rLocale.Language == "ne" ) {
+ if ( rAlgorithm == "charset" )
+ func = get_collator_data_ne_charset;
+ } else if ( rLocale.Language == "zh" && (rLocale.Country == "TW" || rLocale.Country == "HK" || rLocale.Country == "MO") ) {
+ if ( rAlgorithm == "charset" )
+ func = get_collator_data_zh_TW_charset;
+ else if ( rAlgorithm == "radical" )
+ func = get_collator_data_zh_TW_radical;
+ else if ( rAlgorithm == "stroke" )
+ func = get_collator_data_zh_TW_stroke;
+ } else if ( rLocale.Language == "zh" ) {
+ if ( rAlgorithm == "charset" )
+ func = get_collator_data_zh_charset;
+ else if ( rAlgorithm == "pinyin" )
+ func = get_collator_data_zh_pinyin;
+ else if ( rAlgorithm == "radical" )
+ func = get_collator_data_zh_radical;
+ else if ( rAlgorithm == "stroke" )
+ func = get_collator_data_zh_stroke;
+ else if ( rAlgorithm == "zhuyin" )
+ func = get_collator_data_zh_zhuyin;
+ }
+#endif
+ if (func) {
+ const sal_uInt8* ruleImage=func();
+ uca_base = new RuleBasedCollator(static_cast<UChar*>(NULL), status);
+ if (! U_SUCCESS(status)) throw RuntimeException();
+ collator = new RuleBasedCollator(reinterpret_cast<const uint8_t*>(ruleImage), -1, uca_base, status);
+ if (! U_SUCCESS(status)) throw RuntimeException();
}
}
if (!collator) {
diff --git a/i18npool/source/collator/gencoll_rule.cxx b/i18npool/source/collator/gencoll_rule.cxx
index 61911f7ac327..921eade92673 100644
--- a/i18npool/source/collator/gencoll_rule.cxx
+++ b/i18npool/source/collator/gencoll_rule.cxx
@@ -72,7 +72,12 @@ void data_write(char* file, char* name, sal_uInt8 *data, sal_Int32 len)
}
fprintf(fp, "\n};\n\n");
- fprintf(fp, "const sal_uInt8* get_%s() { return %s; }\n\n", name, name);
+ fprintf(fp, "#ifndef DISABLE_DYNLOADING\n");
+ fprintf(fp, "SAL_DLLPUBLIC_EXPORT const sal_uInt8* get_%s() { return %s; }\n", name, name);
+ fprintf(fp, "#else\n");
+ fprintf(fp, "SAL_DLLPUBLIC_EXPORT const sal_uInt8* get_collator_data_%s() { return %s; }\n", name, name);
+ fprintf(fp, "#endif\n");
+ fprintf(fp, "\n");
fprintf (fp, "}\n");
fclose(fp);
diff --git a/i18npool/source/indexentry/indexentrysupplier_asian.cxx b/i18npool/source/indexentry/indexentrysupplier_asian.cxx
index ae8c32bc7915..f661fbb9c766 100644
--- a/i18npool/source/indexentry/indexentrysupplier_asian.cxx
+++ b/i18npool/source/indexentry/indexentrysupplier_asian.cxx
@@ -37,12 +37,17 @@ using namespace ::rtl;
namespace com { namespace sun { namespace star { namespace i18n {
+#ifndef DISABLE_DYNLOADING
+
extern "C" { static void SAL_CALL thisModule() {} }
+#endif
+
IndexEntrySupplier_asian::IndexEntrySupplier_asian(
const Reference < XMultiServiceFactory >& rxMSF ) : IndexEntrySupplier_Common(rxMSF)
{
implementationName = "com.sun.star.i18n.IndexEntrySupplier_asian";
+#ifndef DISABLE_DYNLOADING
#ifdef SAL_DLLPREFIX
OUString lib(RTL_CONSTASCII_USTRINGPARAM(SAL_DLLPREFIX"index_data" SAL_DLLEXTENSION));
#else
@@ -50,38 +55,86 @@ IndexEntrySupplier_asian::IndexEntrySupplier_asian(
#endif
hModule = osl_loadModuleRelative(
&thisModule, lib.pData, SAL_LOADMODULE_DEFAULT );
+#endif
}
IndexEntrySupplier_asian::~IndexEntrySupplier_asian()
{
+#ifndef DISABLE_DYNLOADING
if (hModule) osl_unloadModule(hModule);
+#endif
}
+#ifdef DISABLE_DYNLOADING
+
+extern "C" {
+
+sal_uInt16** get_indexdata_ko_dict(sal_Int16*);
+sal_uInt16** get_indexdata_zh_TW_radical(sal_Int16*);
+sal_uInt16** get_indexdata_zh_TW_stroke(sal_Int16*);
+sal_uInt16** get_indexdata_zh_pinyin(sal_Int16*);
+sal_uInt16** get_indexdata_zh_radical(sal_Int16*);
+sal_uInt16** get_indexdata_zh_stroke(sal_Int16*);
+sal_uInt16** get_indexdata_zh_zhuyin(sal_Int16*);
+
+sal_uInt16** get_ko_phonetic(sal_Int16*);
+sal_uInt16** get_zh_pinyin(sal_Int16*);
+sal_uInt16** get_zh_zhuyin(sal_Int16*);
+
+}
+
+#endif
+
OUString SAL_CALL
IndexEntrySupplier_asian::getIndexCharacter( const OUString& rIndexEntry,
const Locale& rLocale, const OUString& rAlgorithm ) throw (RuntimeException)
{
sal_Int32 i=0;
sal_uInt32 ch = rIndexEntry.iterateCodePoints(&i, 0);
+
+ sal_uInt16** (*func)(sal_Int16*)=NULL;
+#ifndef DISABLE_DYNLOADING
if (hModule) {
OUString get(RTL_CONSTASCII_USTRINGPARAM("get_indexdata_"));
- sal_uInt16** (*func)(sal_Int16*)=NULL;
if ( rLocale.Language == "zh" && OUString( "TW HK MO" ).indexOf(rLocale.Country) >= 0 )
func=(sal_uInt16** (*)(sal_Int16*))osl_getFunctionSymbol(hModule, (get+rLocale.Language+OUString(RTL_CONSTASCII_USTRINGPARAM("_TW_"))+rAlgorithm).pData);
if (!func)
func=(sal_uInt16** (*)(sal_Int16*))osl_getFunctionSymbol(hModule, (get+rLocale.Language+OUString('_')+rAlgorithm).pData);
- if (func) {
- sal_Int16 max_index;
- sal_uInt16** idx=func(&max_index);
- if (((sal_Int16)(ch >> 8)) <= max_index) {
- sal_uInt16 address=idx[0][ch >> 8];
- if (address != 0xFFFF) {
- address=idx[1][address+(ch & 0xFF)];
- return idx[2] ? OUString(&idx[2][address]) : OUString(address);
- }
+ }
+#else
+ if ( rLocale.Language == "zh" && OUString( "TW HK MO" ).indexOf(rLocale.Country) >= 0 ) {
+ if ( rAlgorithm == "radical" )
+ func = get_indexdata_zh_TW_radical;
+ else if ( rAlgorithm == "stroke" )
+ func = get_indexdata_zh_TW_stroke;
+ }
+ if (!func) {
+ if ( rLocale.Language == "ko" ) {
+ if ( rAlgorithm == "dict" )
+ func = get_indexdata_ko_dict;
+ } else if ( rLocale.Language == "zh" )
+ if ( rAlgorithm == "pinyin" )
+ func = get_indexdata_zh_pinyin;
+ else if ( rAlgorithm == "radical" )
+ func = get_indexdata_zh_radical;
+ else if ( rAlgorithm == "stroke" )
+ func = get_indexdata_zh_stroke;
+ else if ( rAlgorithm == "zhuyin" )
+ func = get_indexdata_zh_zhuyin;
+ }
+#endif
+ if (func) {
+ sal_Int16 max_index;
+ sal_uInt16** idx=func(&max_index);
+ if (((sal_Int16)(ch >> 8)) <= max_index) {
+ sal_uInt16 address=idx[0][ch >> 8];
+ if (address != 0xFFFF) {
+ address=idx[1][address+(ch & 0xFF)];
+ return idx[2] ? OUString(&idx[2][address]) : OUString(address);
}
}
}
+
// using alphanumeric index for non-define stirng
return OUString(&idxStr[(ch & 0xFFFFFF00) ? 0 : ch], 1);
}
@@ -115,8 +168,9 @@ OUString SAL_CALL
IndexEntrySupplier_asian::getPhoneticCandidate( const OUString& rIndexEntry,
const Locale& rLocale ) throw (RuntimeException)
{
+ sal_uInt16 **(*func)(sal_Int16*)=NULL;
+#ifndef DISABLE_DYNLOADING
if (hModule) {
- sal_uInt16 **(*func)(sal_Int16*)=NULL;
const sal_Char *func_name=NULL;
if ( rLocale.Language == "zh" )
func_name=(OUString(RTL_CONSTASCII_USTRINGPARAM("TW HK MO")).indexOf(rLocale.Country) >= 0) ? "get_zh_zhuyin" : "get_zh_pinyin";
@@ -124,29 +178,36 @@ IndexEntrySupplier_asian::getPhoneticCandidate( const OUString& rIndexEntry,
func_name="get_ko_phonetic";
if (func_name)
func=(sal_uInt16 **(*)(sal_Int16*))osl_getFunctionSymbol(hModule, OUString::createFromAscii(func_name).pData);
- if (func) {
- OUStringBuffer candidate;
- sal_Int16 max_index;
- sal_uInt16** idx=func(&max_index);
- OUString aIndexEntry=rIndexEntry;
- for (sal_Int32 i=0,j=0; i < rIndexEntry.getLength(); i=j) {
- sal_uInt32 ch = rIndexEntry.iterateCodePoints(&j, 1);
- if (((sal_Int16)(ch>>8)) <= max_index) {
- sal_uInt16 address = idx[0][ch>>8];
- if (address != 0xFFFF) {
- address = idx[1][address + (ch & 0xFF)];
- if ( i > 0 && rLocale.Language == "zh" )
- candidate.appendAscii(" ");
- if (idx[2])
- candidate.append(&idx[2][address]);
- else
- candidate.append(address);
- } else
+ }
+#else
+ if ( rLocale.Language == "zh" )
+ func = (OUString(RTL_CONSTASCII_USTRINGPARAM("TW HK MO")).indexOf(rLocale.Country) >= 0) ? get_zh_zhuyin : get_zh_pinyin;
+ else if ( rLocale.Language == "ko" )
+ func = get_ko_phonetic;
+
+#endif
+ if (func) {
+ OUStringBuffer candidate;
+ sal_Int16 max_index;
+ sal_uInt16** idx=func(&max_index);
+ OUString aIndexEntry=rIndexEntry;
+ for (sal_Int32 i=0,j=0; i < rIndexEntry.getLength(); i=j) {
+ sal_uInt32 ch = rIndexEntry.iterateCodePoints(&j, 1);
+ if (((sal_Int16)(ch>>8)) <= max_index) {
+ sal_uInt16 address = idx[0][ch>>8];
+ if (address != 0xFFFF) {
+ address = idx[1][address + (ch & 0xFF)];
+ if ( i > 0 && rLocale.Language == "zh" )
candidate.appendAscii(" ");
- }
+ if (idx[2])
+ candidate.append(&idx[2][address]);
+ else
+ candidate.append(address);
+ } else
+ candidate.appendAscii(" ");
}
- return candidate.makeStringAndClear();
}
+ return candidate.makeStringAndClear();
}
return OUString();
}
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index a7d76fd430e0..f2d7aaf0a4b4 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -50,11 +50,17 @@ typedef sal_Unicode*** (SAL_CALL * MyFunc_Type2)( sal_Int16&, sal_Int16& );
typedef sal_Unicode**** (SAL_CALL * MyFunc_Type3)( sal_Int16&, sal_Int16&, sal_Int16& );
typedef sal_Unicode const * const * (SAL_CALL * MyFunc_FormatCode)( sal_Int16&, sal_Unicode const *&, sal_Unicode const *& );
+#ifndef DISABLE_DYNLOADING
+
static const char *lcl_DATA_EN = "localedata_en";
static const char *lcl_DATA_ES = "localedata_es";
static const char *lcl_DATA_EURO = "localedata_euro";
static const char *lcl_DATA_OTHERS = "localedata_others";
+#endif
+
+#ifndef DISABLE_DYNLOADING
+
static const struct {
const char* pLocale;
const char* pLib;
@@ -261,6 +267,12 @@ static const struct {
{ "pjt_AU", lcl_DATA_OTHERS }
};
+#else
+
+#include "localedata_static.hxx"
+
+#endif
+
static const sal_Unicode under = sal_Unicode('_');
static const sal_Int16 nbOfLocales = SAL_N_ELEMENTS(aLibTable);
@@ -358,8 +370,12 @@ LocaleData::getLocaleItem( const Locale& rLocale ) throw(RuntimeException)
}
}
+#ifndef DISABLE_DYNLOADING
+
extern "C" { static void SAL_CALL thisModule() {} }
+#endif
+
namespace
{
@@ -432,6 +448,7 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName(
if (localeName.equalsAscii(aLibTable[i].pLocale) ||
(bFallback && localeName == aFallback))
{
+#ifndef DISABLE_DYNLOADING
LocaleDataLookupTableItem* pCurrent = 0;
OUStringBuffer aBuf(strlen(aLibTable[i].pLocale) + 1 + strlen(pFunction));
{
@@ -482,6 +499,46 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName(
}
else
delete module;
+#else
+ (void) pOutCachedItem;
+
+ if( strcmp(pFunction, "getAllCalendars") == 0 )
+ return aLibTable[i].getAllCalendars;
+ else if( strcmp(pFunction, "getAllCurrencies") == 0 )
+ return aLibTable[i].getAllCurrencies;
+ else if( strcmp(pFunction, "getAllFormats0") == 0 )
+ return aLibTable[i].getAllFormats0;
+ else if( strcmp(pFunction, "getBreakIteratorRules") == 0 )
+ return aLibTable[i].getBreakIteratorRules;
+ else if( strcmp(pFunction, "getCollationOptions") == 0 )
+ return aLibTable[i].getCollationOptions;
+ else if( strcmp(pFunction, "getCollatorImplementation") == 0 )
+ return aLibTable[i].getCollatorImplementation;
+ else if( strcmp(pFunction, "getContinuousNumberingLevels") == 0 )
+ return aLibTable[i].getContinuousNumberingLevels;
+ else if( strcmp(pFunction, "getDateAcceptancePatterns") == 0 )
+ return aLibTable[i].getDateAcceptancePatterns;
+ else if( strcmp(pFunction, "getFollowPageWords") == 0 )
+ return aLibTable[i].getFollowPageWords;
+ else if( strcmp(pFunction, "getForbiddenCharacters") == 0 )
+ return aLibTable[i].getForbiddenCharacters;
+ else if( strcmp(pFunction, "getIndexAlgorithm") == 0 )
+ return aLibTable[i].getIndexAlgorithm;
+ else if( strcmp(pFunction, "getLCInfo") == 0 )
+ return aLibTable[i].getLCInfo;
+ else if( strcmp(pFunction, "getLocaleItem") == 0 )
+ return aLibTable[i].getLocaleItem;
+ else if( strcmp(pFunction, "getOutlineNumberingLevels") == 0 )
+ return aLibTable[i].getOutlineNumberingLevels;
+ else if( strcmp(pFunction, "getReservedWords") == 0 )
+ return aLibTable[i].getReservedWords;
+ else if( strcmp(pFunction, "getSearchOptions") == 0 )
+ return aLibTable[i].getSearchOptions;
+ else if( strcmp(pFunction, "getTransliterations") == 0 )
+ return aLibTable[i].getTransliterations;
+ else if( strcmp(pFunction, "getUnicodeScripts") == 0 )
+ return aLibTable[i].getUnicodeScripts;
+#endif
}
}
return NULL;
diff --git a/i18npool/source/textconversion/textconversion.cxx b/i18npool/source/textconversion/textconversion.cxx
index a737ec7d7aa5..30b7fefc0892 100644
--- a/i18npool/source/textconversion/textconversion.cxx
+++ b/i18npool/source/textconversion/textconversion.cxx
@@ -36,10 +36,15 @@ using ::rtl::OUString;
namespace com { namespace sun { namespace star { namespace i18n {
+#ifndef DISABLE_DYNLOADING
+
extern "C" { static void SAL_CALL thisModule() {} }
+#endif
+
TextConversion::TextConversion()
{
+#ifndef DISABLE_DYNLOADING
#ifdef SAL_DLLPREFIX
OUString lib(RTL_CONSTASCII_USTRINGPARAM(SAL_DLLPREFIX"textconv_dict" SAL_DLLEXTENSION));
#else
@@ -47,13 +52,18 @@ TextConversion::TextConversion()
#endif
hModule = osl_loadModuleRelative(
&thisModule, lib.pData, SAL_LOADMODULE_DEFAULT );
+#endif
}
TextConversion::~TextConversion()
{
+#ifndef DISABLE_DYNLOADING
if (hModule) osl_unloadModule(hModule);
+#endif
}
+#ifndef DISABLE_DYNLOADING
+
static void* nullFunc()
{
return NULL;
@@ -68,6 +78,8 @@ TextConversion::getFunctionBySymbol(const sal_Char* func)
return reinterpret_cast< oslGenericFunction >(nullFunc);
}
+#endif
+
OUString SAL_CALL
TextConversion::getImplementationName() throw( RuntimeException )
{
diff --git a/i18npool/source/textconversion/textconversion_ko.cxx b/i18npool/source/textconversion/textconversion_ko.cxx
index e6bd90e8546d..2d12354d1814 100644
--- a/i18npool/source/textconversion/textconversion_ko.cxx
+++ b/i18npool/source/textconversion/textconversion_ko.cxx
@@ -123,16 +123,32 @@ sal_Int16 SAL_CALL checkScriptType(sal_Unicode c)
return (i < scriptListCount && block >= scriptList[i].from) ? scriptList[i].script : SCRIPT_OTHERS;
}
+#ifdef DISABLE_DYNLOADING
+
+extern "C" {
+
+const sal_Unicode* getHangul2HanjaData();
+const Hangul_Index* getHangul2HanjaIndex();
+sal_Int16 getHangul2HanjaIndexCount();
+const sal_uInt16* getHanja2HangulIndex();
+const sal_Unicode* getHanja2HangulData();
+
+}
+
+#endif
+
Sequence< OUString > SAL_CALL
TextConversion_ko::getCharConversions(const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toHanja)
{
sal_Unicode ch;
Sequence< OUString > output;
+#ifndef DISABLE_DYNLOADING
const sal_Unicode* (*getHangul2HanjaData)() = (const sal_Unicode* (*)())getFunctionBySymbol("getHangul2HanjaData");
const Hangul_Index* (*getHangul2HanjaIndex)() = (const Hangul_Index* (*)()) getFunctionBySymbol("getHangul2HanjaIndex");
sal_Int16 (*getHangul2HanjaIndexCount)() = (sal_Int16 (*)()) getFunctionBySymbol("getHangul2HanjaIndexCount");
const sal_uInt16* (*getHanja2HangulIndex)() = (const sal_uInt16* (*)()) getFunctionBySymbol("getHanja2HangulIndex");
const sal_Unicode* (*getHanja2HangulData)() = (const sal_Unicode* (*)()) getFunctionBySymbol("getHanja2HangulData");
+#endif
if (toHanja && getHangul2HanjaIndex && getHangul2HanjaIndexCount && getHangul2HanjaData) {
ch = aText[nStartPos];
const Hangul_Index *Hangul_ko = getHangul2HanjaIndex();
diff --git a/i18npool/source/textconversion/textconversion_zh.cxx b/i18npool/source/textconversion/textconversion_zh.cxx
index 2d72b8017960..0438558f5cc3 100644
--- a/i18npool/source/textconversion/textconversion_zh.cxx
+++ b/i18npool/source/textconversion/textconversion_zh.cxx
@@ -67,12 +67,35 @@ sal_Unicode SAL_CALL getOneCharConversion(sal_Unicode ch, const sal_Unicode* Dat
}
}
+#ifdef DISABLE_DYNLOADING
+
+extern "C" {
+
+const sal_Unicode* getSTC_CharData_T2S();
+const sal_uInt16* getSTC_CharIndex_T2S();
+const sal_Unicode* getSTC_CharData_S2V();
+const sal_uInt16* getSTC_CharIndex_S2V();
+const sal_Unicode* getSTC_CharData_S2T();
+const sal_uInt16* getSTC_CharIndex_S2T();
+
+const sal_Unicode *getSTC_WordData(sal_Int32&);
+
+const sal_uInt16 *getSTC_WordIndex_T2S(sal_Int32&);
+const sal_uInt16 *getSTC_WordEntry_T2S();
+const sal_uInt16 *getSTC_WordIndex_S2T(sal_Int32&);
+const sal_uInt16 *getSTC_WordEntry_S2T();
+
+}
+
+#endif
+
OUString SAL_CALL
TextConversion_zh::getCharConversion(const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toSChinese, sal_Int32 nConversionOptions)
{
const sal_Unicode *Data;
const sal_uInt16 *Index;
+#ifndef DISABLE_DYNLOADING
if (toSChinese) {
Data = ((const sal_Unicode* (*)())getFunctionBySymbol("getSTC_CharData_T2S"))();
Index = ((const sal_uInt16* (*)())getFunctionBySymbol("getSTC_CharIndex_T2S"))();
@@ -83,6 +106,18 @@ TextConversion_zh::getCharConversion(const OUString& aText, sal_Int32 nStartPos,
Data = ((const sal_Unicode* (*)())getFunctionBySymbol("getSTC_CharData_S2T"))();
Index = ((const sal_uInt16* (*)())getFunctionBySymbol("getSTC_CharIndex_S2T"))();
}
+#else
+ if (toSChinese) {
+ Data = getSTC_CharData_T2S();
+ Index = getSTC_CharIndex_T2S();
+ } else if (nConversionOptions & TextConversionOption::USE_CHARACTER_VARIANTS) {
+ Data = getSTC_CharData_S2V();
+ Index = getSTC_CharIndex_S2V();
+ } else {
+ Data = getSTC_CharData_S2T();
+ Index = getSTC_CharIndex_S2T();
+ }
+#endif
rtl_uString * newStr = comphelper::string::rtl_uString_alloc(nLength);
for (sal_Int32 i = 0; i < nLength; i++)
@@ -102,6 +137,7 @@ TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos,
const sal_uInt16 *charIndex;
sal_Bool one2one=sal_True;
+#ifndef DISABLE_DYNLOADING
const sal_Unicode *wordData = ((const sal_Unicode* (*)(sal_Int32&)) getFunctionBySymbol("getSTC_WordData"))(dictLen);
if (toSChinese) {
index = ((const sal_uInt16* (*)(sal_Int32&)) getFunctionBySymbol("getSTC_WordIndex_T2S"))(maxLen);
@@ -119,6 +155,25 @@ TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos,
charIndex = ((const sal_uInt16* (*)()) getFunctionBySymbol("getSTC_CharIndex_S2T"))();
}
}
+#else
+ const sal_Unicode *wordData = getSTC_WordData(dictLen);
+ if (toSChinese) {
+ index = getSTC_WordIndex_T2S(maxLen);
+ entry = getSTC_WordEntry_T2S();
+ charData = getSTC_CharData_T2S();
+ charIndex = getSTC_CharIndex_T2S();
+ } else {
+ index = getSTC_WordIndex_S2T(maxLen);
+ entry = getSTC_WordEntry_S2T();
+ if (nConversionOptions & TextConversionOption::USE_CHARACTER_VARIANTS) {
+ charData = getSTC_CharData_S2V();
+ charIndex = getSTC_CharIndex_S2V();
+ } else {
+ charData = getSTC_CharData_S2T();
+ charIndex = getSTC_CharIndex_S2T();
+ }
+ }
+#endif
if ((!wordData || !index || !entry) && !xCDL.is()) // no word mapping defined, do char2char conversion.
return getCharConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions);
diff --git a/i18npool/source/transliteration/textToPronounce_zh.cxx b/i18npool/source/transliteration/textToPronounce_zh.cxx
index e05f7535ffe6..7e94b07a084c 100644
--- a/i18npool/source/transliteration/textToPronounce_zh.cxx
+++ b/i18npool/source/transliteration/textToPronounce_zh.cxx
@@ -132,18 +132,41 @@ TextToPronounce_zh::equals( const OUString & str1, sal_Int32 pos1, sal_Int32 nCo
return (nCount1 == nCount2);
}
-TextToPinyin_zh_CN::TextToPinyin_zh_CN() : TextToPronounce_zh("get_zh_pinyin")
+#ifdef DISABLE_DYNLOADING
+
+extern "C" {
+
+sal_uInt16** get_zh_zhuyin();
+sal_uInt16** get_zh_pinyin();
+
+}
+
+#endif
+
+TextToPinyin_zh_CN::TextToPinyin_zh_CN() :
+#ifndef DISABLE_DYNLOADING
+ TextToPronounce_zh("get_zh_pinyin")
+#else
+ TextToPronounce_zh(get_zh_pinyin)
+#endif
{
transliterationName = "ChineseCharacterToPinyin";
implementationName = "com.sun.star.i18n.Transliteration.TextToPinyin_zh_CN";
}
-TextToChuyin_zh_TW::TextToChuyin_zh_TW() : TextToPronounce_zh("get_zh_zhuyin")
+TextToChuyin_zh_TW::TextToChuyin_zh_TW() :
+#ifndef DISABLE_DYNLOADING
+ TextToPronounce_zh("get_zh_zhuyin")
+#else
+ TextToPronounce_zh(get_zh_zhuyin)
+#endif
{
transliterationName = "ChineseCharacterToChuyin";
implementationName = "com.sun.star.i18n.Transliteration.TextToChuyin_zh_TW";
}
+#ifndef DISABLE_DYNLOADING
+
extern "C" { static void SAL_CALL thisModule() {} }
TextToPronounce_zh::TextToPronounce_zh(const sal_Char* func_name)
@@ -162,9 +185,21 @@ TextToPronounce_zh::TextToPronounce_zh(const sal_Char* func_name)
idx=function();
}
}
+
+#else
+
+TextToPronounce_zh::TextToPronounce_zh(sal_uInt16 ** (*function)())
+{
+ idx = function();
+}
+
+#endif
+
TextToPronounce_zh::~TextToPronounce_zh()
{
+#ifndef DISABLE_DYNLOADING
if (hModule) osl_unloadModule(hModule);
+#endif
}
} } } }