1449ab281SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3449ab281SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4449ab281SAndrew Rist * or more contributor license agreements. See the NOTICE file 5449ab281SAndrew Rist * distributed with this work for additional information 6449ab281SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7449ab281SAndrew Rist * to you under the Apache License, Version 2.0 (the 8449ab281SAndrew Rist * "License"); you may not use this file except in compliance 9449ab281SAndrew Rist * with the License. You may obtain a copy of the License at 10449ab281SAndrew Rist * 11449ab281SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12449ab281SAndrew Rist * 13449ab281SAndrew Rist * Unless required by applicable law or agreed to in writing, 14449ab281SAndrew Rist * software distributed under the License is distributed on an 15449ab281SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16449ab281SAndrew Rist * KIND, either express or implied. See the License for the 17449ab281SAndrew Rist * specific language governing permissions and limitations 18449ab281SAndrew Rist * under the License. 19449ab281SAndrew Rist * 20449ab281SAndrew Rist *************************************************************/ 21449ab281SAndrew Rist 22449ab281SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_i18npool.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <localedata.hxx> 28cdf0e10cSrcweir #include <i18npool/mslangid.hxx> 29cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 30cdf0e10cSrcweir #include <string.h> 31cdf0e10cSrcweir #include <stdio.h> 32cdf0e10cSrcweir #include "rtl/instance.hxx" 33cdf0e10cSrcweir 34cdf0e10cSrcweir using namespace com::sun::star::i18n; 35cdf0e10cSrcweir using namespace com::sun::star::uno; 36cdf0e10cSrcweir using namespace com::sun::star::lang; 37cdf0e10cSrcweir using namespace com::sun::star; 38cdf0e10cSrcweir using namespace rtl; 39cdf0e10cSrcweir 40cdf0e10cSrcweir static const sal_Char clocaledata[] = "com.sun.star.i18n.LocaleData"; 41cdf0e10cSrcweir 42cdf0e10cSrcweir typedef sal_Unicode** (SAL_CALL * MyFunc_Type)( sal_Int16&); 43cdf0e10cSrcweir typedef sal_Unicode*** (SAL_CALL * MyFunc_Type2)( sal_Int16&, sal_Int16& ); 44cdf0e10cSrcweir typedef sal_Unicode**** (SAL_CALL * MyFunc_Type3)( sal_Int16&, sal_Int16&, sal_Int16& ); 45cdf0e10cSrcweir typedef sal_Unicode const * const * (SAL_CALL * MyFunc_FormatCode)( sal_Int16&, sal_Unicode const *&, sal_Unicode const *& ); 46cdf0e10cSrcweir 47cdf0e10cSrcweir #ifdef OS2 // YD 8.3!! 48cdf0e10cSrcweir static const char *lcl_DATA_EN = "ld_en"; 49cdf0e10cSrcweir static const char *lcl_DATA_ES = "ld_es"; 50cdf0e10cSrcweir static const char *lcl_DATA_EURO = "ld_eur"; 51cdf0e10cSrcweir static const char *lcl_DATA_OTHERS = "ld_oth"; 52cdf0e10cSrcweir #else 53cdf0e10cSrcweir static const char *lcl_DATA_EN = "localedata_en"; 54cdf0e10cSrcweir static const char *lcl_DATA_ES = "localedata_es"; 55cdf0e10cSrcweir static const char *lcl_DATA_EURO = "localedata_euro"; 56cdf0e10cSrcweir static const char *lcl_DATA_OTHERS = "localedata_others"; 57cdf0e10cSrcweir #endif 58cdf0e10cSrcweir 59cdf0e10cSrcweir static const struct { 60cdf0e10cSrcweir const char* pLocale; 61cdf0e10cSrcweir const char* pLib; 62cdf0e10cSrcweir } aLibTable[] = { 63cdf0e10cSrcweir { "en_US", lcl_DATA_EN }, 64cdf0e10cSrcweir { "en_AU", lcl_DATA_EN }, 65cdf0e10cSrcweir { "en_BZ", lcl_DATA_EN }, 66cdf0e10cSrcweir { "en_CA", lcl_DATA_EN }, 67cdf0e10cSrcweir { "en_GB", lcl_DATA_EN }, 68cdf0e10cSrcweir { "en_IE", lcl_DATA_EN }, 69cdf0e10cSrcweir { "en_JM", lcl_DATA_EN }, 70cdf0e10cSrcweir { "en_NZ", lcl_DATA_EN }, 71cdf0e10cSrcweir { "en_PH", lcl_DATA_EN }, 72cdf0e10cSrcweir { "en_TT", lcl_DATA_EN }, 73cdf0e10cSrcweir { "en_ZA", lcl_DATA_EN }, 74cdf0e10cSrcweir { "en_ZW", lcl_DATA_EN }, 75cdf0e10cSrcweir { "en_NA", lcl_DATA_EN }, 76cdf0e10cSrcweir { "en_GH", lcl_DATA_EN }, 77cdf0e10cSrcweir 78cdf0e10cSrcweir { "es_ES", lcl_DATA_ES }, 79cdf0e10cSrcweir { "es_AR", lcl_DATA_ES }, 80cdf0e10cSrcweir { "es_BO", lcl_DATA_ES }, 81cdf0e10cSrcweir { "es_CL", lcl_DATA_ES }, 82cdf0e10cSrcweir { "es_CO", lcl_DATA_ES }, 83cdf0e10cSrcweir { "es_CR", lcl_DATA_ES }, 84cdf0e10cSrcweir { "es_DO", lcl_DATA_ES }, 85cdf0e10cSrcweir { "es_EC", lcl_DATA_ES }, 86cdf0e10cSrcweir { "es_GT", lcl_DATA_ES }, 87cdf0e10cSrcweir { "es_HN", lcl_DATA_ES }, 88cdf0e10cSrcweir { "es_MX", lcl_DATA_ES }, 89cdf0e10cSrcweir { "es_NI", lcl_DATA_ES }, 90cdf0e10cSrcweir { "es_PA", lcl_DATA_ES }, 91cdf0e10cSrcweir { "es_PE", lcl_DATA_ES }, 92cdf0e10cSrcweir { "es_PR", lcl_DATA_ES }, 93cdf0e10cSrcweir { "es_PY", lcl_DATA_ES }, 94cdf0e10cSrcweir { "es_SV", lcl_DATA_ES }, 95cdf0e10cSrcweir { "es_UY", lcl_DATA_ES }, 96cdf0e10cSrcweir { "es_VE", lcl_DATA_ES }, 97cdf0e10cSrcweir { "gl_ES", lcl_DATA_ES }, 98cdf0e10cSrcweir 99cdf0e10cSrcweir { "de_DE", lcl_DATA_EURO }, 100cdf0e10cSrcweir { "de_AT", lcl_DATA_EURO }, 101cdf0e10cSrcweir { "de_CH", lcl_DATA_EURO }, 102cdf0e10cSrcweir { "de_LI", lcl_DATA_EURO }, 103cdf0e10cSrcweir { "de_LU", lcl_DATA_EURO }, 104cdf0e10cSrcweir { "fr_FR", lcl_DATA_EURO }, 105cdf0e10cSrcweir { "fr_BE", lcl_DATA_EURO }, 106cdf0e10cSrcweir { "fr_CA", lcl_DATA_EURO }, 107cdf0e10cSrcweir { "fr_CH", lcl_DATA_EURO }, 108cdf0e10cSrcweir { "fr_LU", lcl_DATA_EURO }, 109cdf0e10cSrcweir { "fr_MC", lcl_DATA_EURO }, 110cdf0e10cSrcweir { "it_IT", lcl_DATA_EURO }, 111cdf0e10cSrcweir { "it_CH", lcl_DATA_EURO }, 112cdf0e10cSrcweir { "sl_SI", lcl_DATA_EURO }, 113cdf0e10cSrcweir { "sv_SE", lcl_DATA_EURO }, 114cdf0e10cSrcweir { "sv_FI", lcl_DATA_EURO }, 115cdf0e10cSrcweir { "ca_ES", lcl_DATA_EURO }, 116cdf0e10cSrcweir { "cs_CZ", lcl_DATA_EURO }, 117cdf0e10cSrcweir { "sk_SK", lcl_DATA_EURO }, 118cdf0e10cSrcweir { "da_DK", lcl_DATA_EURO }, 119cdf0e10cSrcweir { "el_GR", lcl_DATA_EURO }, 120cdf0e10cSrcweir { "fi_FI", lcl_DATA_EURO }, 121cdf0e10cSrcweir { "is_IS", lcl_DATA_EURO }, 122cdf0e10cSrcweir { "nl_BE", lcl_DATA_EURO }, 123cdf0e10cSrcweir { "nl_NL", lcl_DATA_EURO }, 124cdf0e10cSrcweir { "no_NO", lcl_DATA_EURO }, 125cdf0e10cSrcweir { "nn_NO", lcl_DATA_EURO }, 126cdf0e10cSrcweir { "nb_NO", lcl_DATA_EURO }, 1271e1a2d0aSAriel Constenla-Haile { "nds_DE", lcl_DATA_EURO }, 128cdf0e10cSrcweir { "pl_PL", lcl_DATA_EURO }, 129cdf0e10cSrcweir { "pt_BR", lcl_DATA_EURO }, 130cdf0e10cSrcweir { "pt_PT", lcl_DATA_EURO }, 131cdf0e10cSrcweir { "ru_RU", lcl_DATA_EURO }, 132cdf0e10cSrcweir { "tr_TR", lcl_DATA_EURO }, 13366bcbdd8SAriel Constenla-Haile { "tt_RU", lcl_DATA_EURO }, 134cdf0e10cSrcweir { "et_EE", lcl_DATA_EURO }, 135cdf0e10cSrcweir { "lb_LU", lcl_DATA_EURO }, 136cdf0e10cSrcweir { "lt_LT", lcl_DATA_EURO }, 137cdf0e10cSrcweir { "lv_LV", lcl_DATA_EURO }, 138cdf0e10cSrcweir { "uk_UA", lcl_DATA_EURO }, 139cdf0e10cSrcweir { "ro_RO", lcl_DATA_EURO }, 140cdf0e10cSrcweir { "cy_GB", lcl_DATA_EURO }, 141cdf0e10cSrcweir { "bg_BG", lcl_DATA_EURO }, 142cdf0e10cSrcweir { "sh_ME", lcl_DATA_EURO }, 143cdf0e10cSrcweir { "sh_RS", lcl_DATA_EURO }, 144cdf0e10cSrcweir { "sh_YU", lcl_DATA_EURO }, 145cdf0e10cSrcweir { "sr_ME", lcl_DATA_EURO }, 146cdf0e10cSrcweir { "sr_RS", lcl_DATA_EURO }, 147cdf0e10cSrcweir { "sr_YU", lcl_DATA_EURO }, 148cdf0e10cSrcweir { "hr_HR", lcl_DATA_EURO }, 149cdf0e10cSrcweir { "bs_BA", lcl_DATA_EURO }, 150cdf0e10cSrcweir { "eu", lcl_DATA_EURO }, 151cdf0e10cSrcweir { "fo_FO", lcl_DATA_EURO }, 152cdf0e10cSrcweir { "ga_IE", lcl_DATA_EURO }, 15353c3ed26SAriel Constenla-Haile { "gd_GB", lcl_DATA_EURO }, 154cdf0e10cSrcweir { "ka_GE", lcl_DATA_EURO }, 155cdf0e10cSrcweir { "be_BY", lcl_DATA_EURO }, 156cdf0e10cSrcweir { "kl_GL", lcl_DATA_EURO }, 157cdf0e10cSrcweir { "mk_MK", lcl_DATA_EURO }, 158cdf0e10cSrcweir { "br_FR", lcl_DATA_EURO }, 159cdf0e10cSrcweir { "la_VA", lcl_DATA_EURO }, 160cdf0e10cSrcweir { "cv_RU", lcl_DATA_EURO }, 161cdf0e10cSrcweir { "wa_BE", lcl_DATA_EURO }, 162cdf0e10cSrcweir { "fur_IT", lcl_DATA_EURO }, 163cdf0e10cSrcweir { "gsc_FR", lcl_DATA_EURO }, 164cdf0e10cSrcweir { "fy_NL", lcl_DATA_EURO }, 165cdf0e10cSrcweir { "oc_FR", lcl_DATA_EURO }, 166cdf0e10cSrcweir { "mt_MT", lcl_DATA_EURO }, 167cdf0e10cSrcweir { "sc_IT", lcl_DATA_EURO }, 168cdf0e10cSrcweir { "ast_ES", lcl_DATA_EURO }, 169cdf0e10cSrcweir { "ltg_LV", lcl_DATA_EURO }, 170cdf0e10cSrcweir { "hsb_DE", lcl_DATA_EURO }, 171cdf0e10cSrcweir { "dsb_DE", lcl_DATA_EURO }, 172cdf0e10cSrcweir { "rue_SK", lcl_DATA_EURO }, 173cdf0e10cSrcweir 174cdf0e10cSrcweir { "ja_JP", lcl_DATA_OTHERS }, 175cdf0e10cSrcweir { "ko_KR", lcl_DATA_OTHERS }, 176cdf0e10cSrcweir { "zh_CN", lcl_DATA_OTHERS }, 177cdf0e10cSrcweir { "zh_HK", lcl_DATA_OTHERS }, 178cdf0e10cSrcweir { "zh_SG", lcl_DATA_OTHERS }, 179cdf0e10cSrcweir { "zh_TW", lcl_DATA_OTHERS }, 180cdf0e10cSrcweir { "zh_MO", lcl_DATA_OTHERS }, 181cdf0e10cSrcweir 182cdf0e10cSrcweir { "ar_EG", lcl_DATA_OTHERS }, 183cdf0e10cSrcweir { "ar_DZ", lcl_DATA_OTHERS }, 184cdf0e10cSrcweir { "ar_LB", lcl_DATA_OTHERS }, 185cdf0e10cSrcweir { "ar_SA", lcl_DATA_OTHERS }, 186cdf0e10cSrcweir { "ar_TN", lcl_DATA_OTHERS }, 187cdf0e10cSrcweir { "he_IL", lcl_DATA_OTHERS }, 188cdf0e10cSrcweir { "hi_IN", lcl_DATA_OTHERS }, 189cdf0e10cSrcweir { "kn_IN", lcl_DATA_OTHERS }, 190cdf0e10cSrcweir { "ta_IN", lcl_DATA_OTHERS }, 191cdf0e10cSrcweir { "te_IN", lcl_DATA_OTHERS }, 192cdf0e10cSrcweir { "gu_IN", lcl_DATA_OTHERS }, 193cdf0e10cSrcweir { "mr_IN", lcl_DATA_OTHERS }, 194cdf0e10cSrcweir { "pa_IN", lcl_DATA_OTHERS }, 195cdf0e10cSrcweir { "bn_IN", lcl_DATA_OTHERS }, 196cdf0e10cSrcweir { "or_IN", lcl_DATA_OTHERS }, 197cdf0e10cSrcweir { "en_IN", lcl_DATA_OTHERS }, 198cdf0e10cSrcweir { "ml_IN", lcl_DATA_OTHERS }, 199cdf0e10cSrcweir { "bn_BD", lcl_DATA_OTHERS }, 200cdf0e10cSrcweir { "th_TH", lcl_DATA_OTHERS }, 201cdf0e10cSrcweir 202cdf0e10cSrcweir { "af_ZA", lcl_DATA_OTHERS }, 203cdf0e10cSrcweir { "hu_HU", lcl_DATA_OTHERS }, 204cdf0e10cSrcweir { "id_ID", lcl_DATA_OTHERS }, 205cdf0e10cSrcweir { "ms_MY", lcl_DATA_OTHERS }, 206cdf0e10cSrcweir { "ia", lcl_DATA_OTHERS }, 207cdf0e10cSrcweir { "mn_MN", lcl_DATA_OTHERS }, 208cdf0e10cSrcweir { "az_AZ", lcl_DATA_OTHERS }, 209cdf0e10cSrcweir { "sw_TZ", lcl_DATA_OTHERS }, 210cdf0e10cSrcweir { "km_KH", lcl_DATA_OTHERS }, 211cdf0e10cSrcweir { "lo_LA", lcl_DATA_OTHERS }, 212cdf0e10cSrcweir { "rw_RW", lcl_DATA_OTHERS }, 213cdf0e10cSrcweir { "eo", lcl_DATA_OTHERS }, 214cdf0e10cSrcweir { "dz_BT", lcl_DATA_OTHERS }, 215cdf0e10cSrcweir { "ne_NP", lcl_DATA_OTHERS }, 216cdf0e10cSrcweir { "zu_ZA", lcl_DATA_OTHERS }, 217cdf0e10cSrcweir { "nso_ZA", lcl_DATA_OTHERS }, 218cdf0e10cSrcweir { "vi_VN", lcl_DATA_OTHERS }, 219cdf0e10cSrcweir { "tn_ZA", lcl_DATA_OTHERS }, 220cdf0e10cSrcweir { "xh_ZA", lcl_DATA_OTHERS }, 221cdf0e10cSrcweir { "st_ZA", lcl_DATA_OTHERS }, 222cdf0e10cSrcweir { "ss_ZA", lcl_DATA_OTHERS }, 223cdf0e10cSrcweir { "ve_ZA", lcl_DATA_OTHERS }, 224cdf0e10cSrcweir { "nr_ZA", lcl_DATA_OTHERS }, 225cdf0e10cSrcweir { "ts_ZA", lcl_DATA_OTHERS }, 226cdf0e10cSrcweir { "ku_TR", lcl_DATA_OTHERS }, 227cdf0e10cSrcweir { "ak_GH", lcl_DATA_OTHERS }, 228cdf0e10cSrcweir { "af_NA", lcl_DATA_OTHERS }, 229cdf0e10cSrcweir { "am_ET", lcl_DATA_OTHERS }, 230cdf0e10cSrcweir { "ti_ER", lcl_DATA_OTHERS }, 231cdf0e10cSrcweir { "tg_TJ", lcl_DATA_OTHERS }, 232cdf0e10cSrcweir { "ky_KG", lcl_DATA_OTHERS }, 233cdf0e10cSrcweir { "kk_KZ", lcl_DATA_OTHERS }, 234cdf0e10cSrcweir { "fa_IR", lcl_DATA_OTHERS }, 235cdf0e10cSrcweir { "ha_GH", lcl_DATA_OTHERS }, 236cdf0e10cSrcweir { "ee_GH", lcl_DATA_OTHERS }, 237cdf0e10cSrcweir { "sg_CF", lcl_DATA_OTHERS }, 238cdf0e10cSrcweir { "lg_UG", lcl_DATA_OTHERS }, 239cdf0e10cSrcweir { "uz_UZ", lcl_DATA_OTHERS }, 240cdf0e10cSrcweir { "ln_CD", lcl_DATA_OTHERS }, 241cdf0e10cSrcweir { "hy_AM", lcl_DATA_OTHERS }, 242cdf0e10cSrcweir { "hil_PH", lcl_DATA_OTHERS }, 243cdf0e10cSrcweir { "so_SO", lcl_DATA_OTHERS }, 244cdf0e10cSrcweir { "gug_PY", lcl_DATA_OTHERS }, 245cdf0e10cSrcweir { "tk_TM", lcl_DATA_OTHERS }, 246cdf0e10cSrcweir { "my_MM", lcl_DATA_OTHERS }, 247cdf0e10cSrcweir { "shs_CA", lcl_DATA_OTHERS }, 248cdf0e10cSrcweir { "tpi_PG", lcl_DATA_OTHERS }, 249cdf0e10cSrcweir { "ar_OM", lcl_DATA_OTHERS }, 250cdf0e10cSrcweir { "ug_CN", lcl_DATA_OTHERS }, 251cdf0e10cSrcweir { "om_ET", lcl_DATA_OTHERS }, 252cdf0e10cSrcweir { "plt_MG", lcl_DATA_OTHERS }, 253cdf0e10cSrcweir { "mai_IN", lcl_DATA_OTHERS }, 254cdf0e10cSrcweir { "yi_US", lcl_DATA_OTHERS }, 255cdf0e10cSrcweir { "haw_US", lcl_DATA_OTHERS }, 256cdf0e10cSrcweir { "lif_NP", lcl_DATA_OTHERS }, 257cdf0e10cSrcweir { "ur_PK", lcl_DATA_OTHERS }, 258cdf0e10cSrcweir { "ht_HT", lcl_DATA_OTHERS }, 259cdf0e10cSrcweir { "jbo", lcl_DATA_OTHERS } 260cdf0e10cSrcweir }; 261cdf0e10cSrcweir 262cdf0e10cSrcweir static const sal_Unicode under = sal_Unicode('_'); 263cdf0e10cSrcweir 264cdf0e10cSrcweir static const sal_Int16 nbOfLocales = sizeof(aLibTable) / sizeof(aLibTable[0]); 265cdf0e10cSrcweir 266cdf0e10cSrcweir struct LocaleDataLookupTableItem 267cdf0e10cSrcweir { 268cdf0e10cSrcweir LocaleDataLookupTableItem(const sal_Char *name, osl::Module* m, const sal_Char* lname) : dllName(name), module(m), localeName(lname) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir } 271cdf0e10cSrcweir const sal_Char* dllName; 272cdf0e10cSrcweir osl::Module *module; 273cdf0e10cSrcweir const sal_Char* localeName; 274cdf0e10cSrcweir 275cdf0e10cSrcweir com::sun::star::lang::Locale aLocale; 276cdf0e10cSrcweir sal_Bool equals(const com::sun::star::lang::Locale& rLocale) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir return (rLocale == aLocale); 279cdf0e10cSrcweir } 280cdf0e10cSrcweir }; 281cdf0e10cSrcweir 282cdf0e10cSrcweir LocaleData::LocaleData() 283cdf0e10cSrcweir { 284cdf0e10cSrcweir } 285cdf0e10cSrcweir LocaleData::~LocaleData() 286cdf0e10cSrcweir { 287cdf0e10cSrcweir } 288cdf0e10cSrcweir 289cdf0e10cSrcweir 290cdf0e10cSrcweir LocaleDataItem SAL_CALL 291cdf0e10cSrcweir LocaleData::getLocaleItem( const Locale& rLocale ) throw(RuntimeException) 292cdf0e10cSrcweir { 293cdf0e10cSrcweir sal_Int16 dataItemCount = 0; 294cdf0e10cSrcweir sal_Unicode **dataItem = NULL; 295cdf0e10cSrcweir 296cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getLocaleItem" ); 297cdf0e10cSrcweir 298cdf0e10cSrcweir if ( func ) { 299cdf0e10cSrcweir dataItem = func(dataItemCount); 300cdf0e10cSrcweir 301cdf0e10cSrcweir LocaleDataItem item( 302cdf0e10cSrcweir dataItem[0], 303cdf0e10cSrcweir dataItem[1], 304cdf0e10cSrcweir dataItem[2], 305cdf0e10cSrcweir dataItem[3], 306cdf0e10cSrcweir dataItem[4], 307cdf0e10cSrcweir dataItem[5], 308cdf0e10cSrcweir dataItem[6], 309cdf0e10cSrcweir dataItem[7], 310cdf0e10cSrcweir dataItem[8], 311cdf0e10cSrcweir dataItem[9], 312cdf0e10cSrcweir dataItem[10], 313cdf0e10cSrcweir dataItem[11], 314cdf0e10cSrcweir dataItem[12], 315cdf0e10cSrcweir dataItem[13], 316cdf0e10cSrcweir dataItem[14], 317cdf0e10cSrcweir dataItem[15], 318cdf0e10cSrcweir dataItem[16], 319cdf0e10cSrcweir dataItem[17] 320cdf0e10cSrcweir ); 321cdf0e10cSrcweir return item; 322cdf0e10cSrcweir } 323cdf0e10cSrcweir else { 324cdf0e10cSrcweir LocaleDataItem item1; 325cdf0e10cSrcweir return item1; 326cdf0e10cSrcweir } 327cdf0e10cSrcweir } 328cdf0e10cSrcweir 329cdf0e10cSrcweir extern "C" { static void SAL_CALL thisModule() {} } 330cdf0e10cSrcweir 331cdf0e10cSrcweir namespace 332cdf0e10cSrcweir { 333cdf0e10cSrcweir 334cdf0e10cSrcweir // implement the lookup table as a safe static object 335cdf0e10cSrcweir class lcl_LookupTableHelper 336cdf0e10cSrcweir { 337cdf0e10cSrcweir public: 338cdf0e10cSrcweir lcl_LookupTableHelper(); 339cdf0e10cSrcweir ~lcl_LookupTableHelper(); 340cdf0e10cSrcweir 341cdf0e10cSrcweir oslGenericFunction SAL_CALL getFunctionSymbolByName( 342cdf0e10cSrcweir const OUString& localeName, const sal_Char* pFunction, 343cdf0e10cSrcweir LocaleDataLookupTableItem** pOutCachedItem ); 344cdf0e10cSrcweir 345cdf0e10cSrcweir private: 346cdf0e10cSrcweir ::osl::Mutex maMutex; 347cdf0e10cSrcweir ::std::vector< LocaleDataLookupTableItem* > maLookupTable; 348cdf0e10cSrcweir }; 349cdf0e10cSrcweir 350cdf0e10cSrcweir // from instance.hxx: Helper base class for a late-initialized 351cdf0e10cSrcweir // (default-constructed) static variable, implementing the double-checked 352cdf0e10cSrcweir // locking pattern correctly. 353cdf0e10cSrcweir // usage: lcl_LookupTableHelper & rLookupTable = lcl_LookupTableStatic::get(); 354cdf0e10cSrcweir // retrieves the singleton lookup table instance 355cdf0e10cSrcweir struct lcl_LookupTableStatic : public ::rtl::Static< lcl_LookupTableHelper, lcl_LookupTableStatic > 356cdf0e10cSrcweir {}; 357cdf0e10cSrcweir 358cdf0e10cSrcweir lcl_LookupTableHelper::lcl_LookupTableHelper() 359cdf0e10cSrcweir { 360cdf0e10cSrcweir } 361cdf0e10cSrcweir 362cdf0e10cSrcweir lcl_LookupTableHelper::~lcl_LookupTableHelper() 363cdf0e10cSrcweir { 364cdf0e10cSrcweir LocaleDataLookupTableItem* pItem = 0; 365cdf0e10cSrcweir 366cdf0e10cSrcweir std::vector<LocaleDataLookupTableItem*>::const_iterator aEnd(maLookupTable.end()); 367cdf0e10cSrcweir std::vector<LocaleDataLookupTableItem*>::iterator aIter(maLookupTable.begin()); 368cdf0e10cSrcweir 369cdf0e10cSrcweir for ( ; aIter != aEnd; ++aIter ) { 370cdf0e10cSrcweir pItem = *aIter; 371cdf0e10cSrcweir delete pItem->module; 372cdf0e10cSrcweir delete pItem; 373cdf0e10cSrcweir } 374cdf0e10cSrcweir maLookupTable.clear(); 375cdf0e10cSrcweir } 376cdf0e10cSrcweir 377cdf0e10cSrcweir oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName( 378cdf0e10cSrcweir const OUString& localeName, const sal_Char* pFunction, 379cdf0e10cSrcweir LocaleDataLookupTableItem** pOutCachedItem ) 380cdf0e10cSrcweir { 381cdf0e10cSrcweir OUString aFallback; 382cdf0e10cSrcweir bool bFallback = (localeName.indexOf( under) < 0); 383cdf0e10cSrcweir if (bFallback) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir Locale aLocale; 386cdf0e10cSrcweir aLocale.Language = localeName; 387cdf0e10cSrcweir Locale aFbLocale = MsLangId::getFallbackLocale( aLocale); 388cdf0e10cSrcweir if (aFbLocale == aLocale) 389cdf0e10cSrcweir bFallback = false; // may be a "language-only-locale" like Interlingua (ia) 390cdf0e10cSrcweir else if (aFbLocale.Country.getLength()) { 391cdf0e10cSrcweir OUStringBuffer aBuf(5); 392cdf0e10cSrcweir aFallback = aBuf.append(aFbLocale.Language).append( under).append(aFbLocale.Country).makeStringAndClear(); 393cdf0e10cSrcweir } 394cdf0e10cSrcweir else 395cdf0e10cSrcweir aFallback = aFbLocale.Language; 396cdf0e10cSrcweir } 397cdf0e10cSrcweir 398cdf0e10cSrcweir for ( sal_Int16 i = 0; i < nbOfLocales; i++) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir if (localeName.equalsAscii(aLibTable[i].pLocale) || 401cdf0e10cSrcweir (bFallback && localeName == aFallback)) 402cdf0e10cSrcweir { 403cdf0e10cSrcweir LocaleDataLookupTableItem* pCurrent = 0; 404cdf0e10cSrcweir OUStringBuffer aBuf(strlen(aLibTable[i].pLocale) + 1 + strlen(pFunction)); 405cdf0e10cSrcweir { 406cdf0e10cSrcweir ::osl::MutexGuard aGuard( maMutex ); 407cdf0e10cSrcweir for (size_t l = 0; l < maLookupTable.size(); l++) 408cdf0e10cSrcweir { 409cdf0e10cSrcweir pCurrent = maLookupTable[l]; 410cdf0e10cSrcweir if (pCurrent->dllName == aLibTable[i].pLib) 411cdf0e10cSrcweir { 412cdf0e10cSrcweir OSL_ASSERT( pOutCachedItem ); 413cdf0e10cSrcweir if( pOutCachedItem ) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir (*pOutCachedItem) = new LocaleDataLookupTableItem( *pCurrent ); 416cdf0e10cSrcweir (*pOutCachedItem)->localeName = aLibTable[i].pLocale; 417cdf0e10cSrcweir return (*pOutCachedItem)->module->getFunctionSymbol( 418cdf0e10cSrcweir aBuf.appendAscii( pFunction).append( under). 419cdf0e10cSrcweir appendAscii( (*pOutCachedItem)->localeName).makeStringAndClear()); 420cdf0e10cSrcweir } 421cdf0e10cSrcweir else 422cdf0e10cSrcweir return NULL; 423cdf0e10cSrcweir } 424cdf0e10cSrcweir } 425cdf0e10cSrcweir } 426cdf0e10cSrcweir // Library not loaded, load it and add it to the list. 427cdf0e10cSrcweir #ifdef SAL_DLLPREFIX 428cdf0e10cSrcweir aBuf.ensureCapacity(strlen(aLibTable[i].pLib) + 6); // mostly "lib*.so" 429cdf0e10cSrcweir aBuf.appendAscii( SAL_DLLPREFIX ).appendAscii(aLibTable[i].pLib).appendAscii( SAL_DLLEXTENSION ); 430cdf0e10cSrcweir #else 431cdf0e10cSrcweir aBuf.ensureCapacity(strlen(aLibTable[i].pLib) + 4); // mostly "*.dll" 432cdf0e10cSrcweir aBuf.appendAscii(aLibTable[i].pLib).appendAscii( SAL_DLLEXTENSION ); 433cdf0e10cSrcweir #endif 434cdf0e10cSrcweir osl::Module *module = new osl::Module(); 435cdf0e10cSrcweir if ( module->loadRelative(&thisModule, aBuf.makeStringAndClear()) ) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir ::osl::MutexGuard aGuard( maMutex ); 438cdf0e10cSrcweir LocaleDataLookupTableItem* pNewItem = 0; 439cdf0e10cSrcweir maLookupTable.push_back(pNewItem = new LocaleDataLookupTableItem(aLibTable[i].pLib, module, aLibTable[i].pLocale )); 440cdf0e10cSrcweir OSL_ASSERT( pOutCachedItem ); 441cdf0e10cSrcweir if( pOutCachedItem ) 442cdf0e10cSrcweir { 443cdf0e10cSrcweir (*pOutCachedItem) = new LocaleDataLookupTableItem( *pNewItem ); 444cdf0e10cSrcweir return module->getFunctionSymbol( 445cdf0e10cSrcweir aBuf.appendAscii(pFunction).append(under). 446cdf0e10cSrcweir appendAscii((*pOutCachedItem)->localeName).makeStringAndClear()); 447cdf0e10cSrcweir } 448cdf0e10cSrcweir else 449cdf0e10cSrcweir return NULL; 450cdf0e10cSrcweir } 451cdf0e10cSrcweir else 452cdf0e10cSrcweir delete module; 453cdf0e10cSrcweir } 454cdf0e10cSrcweir } 455cdf0e10cSrcweir return NULL; 456cdf0e10cSrcweir } 457cdf0e10cSrcweir 458cdf0e10cSrcweir } // anonymous namespace 459cdf0e10cSrcweir 460cdf0e10cSrcweir #define REF_DAYS 0 461cdf0e10cSrcweir #define REF_MONTHS 1 462cdf0e10cSrcweir #define REF_ERAS 2 463cdf0e10cSrcweir 464cdf0e10cSrcweir Sequence< CalendarItem > &LocaleData::getCalendarItemByName(const OUString& name, 465cdf0e10cSrcweir const Locale& rLocale, const Sequence< Calendar >& calendarsSeq, sal_Int16 len, sal_Int16 item) 466cdf0e10cSrcweir throw(RuntimeException) 467cdf0e10cSrcweir { 468cdf0e10cSrcweir if (!ref_name.equals(name)) { 469cdf0e10cSrcweir sal_Int32 index = 0; 470cdf0e10cSrcweir OUString language = name.getToken(0, under, index); 471cdf0e10cSrcweir OUString country = name.getToken(0, under, index); 472cdf0e10cSrcweir Locale loc(language, country, OUString()); 473cdf0e10cSrcweir Sequence < Calendar > cals; 474cdf0e10cSrcweir if (loc == rLocale) { 475cdf0e10cSrcweir cals = calendarsSeq; 476cdf0e10cSrcweir } else { 477cdf0e10cSrcweir cals = getAllCalendars(loc); 478cdf0e10cSrcweir len = sal::static_int_cast<sal_Int16>( cals.getLength() ); 479cdf0e10cSrcweir } 480cdf0e10cSrcweir const OUString& id = name.getToken(0, under, index); 481cdf0e10cSrcweir for (index = 0; index < cals.getLength(); index++) { 482cdf0e10cSrcweir if (id.equals(cals[index].Name)) { 483cdf0e10cSrcweir ref_cal = cals[index]; 484cdf0e10cSrcweir break; 485cdf0e10cSrcweir } 486cdf0e10cSrcweir } 487*30acf5e8Spfg // Referred locale does not found, return name for en_US locale. 488cdf0e10cSrcweir if (index == cals.getLength()) { 489cdf0e10cSrcweir cals = getAllCalendars( 490cdf0e10cSrcweir Locale(OUString::createFromAscii("en"), OUString::createFromAscii("US"), OUString())); 491cdf0e10cSrcweir if (cals.getLength() > 0) 492cdf0e10cSrcweir ref_cal = cals[0]; 493cdf0e10cSrcweir else 494cdf0e10cSrcweir throw RuntimeException(); 495cdf0e10cSrcweir } 496cdf0e10cSrcweir ref_name = name; 497cdf0e10cSrcweir } 498cdf0e10cSrcweir return item == REF_DAYS ? ref_cal.Days : item == REF_MONTHS ? ref_cal.Months : ref_cal.Eras; 499cdf0e10cSrcweir } 500cdf0e10cSrcweir 501cdf0e10cSrcweir 502cdf0e10cSrcweir Sequence< Calendar > SAL_CALL 503cdf0e10cSrcweir LocaleData::getAllCalendars( const Locale& rLocale ) throw(RuntimeException) 504cdf0e10cSrcweir { 505cdf0e10cSrcweir 506cdf0e10cSrcweir sal_Int16 calendarsCount = 0; 507cdf0e10cSrcweir sal_Unicode **allCalendars = NULL; 508cdf0e10cSrcweir 509cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getAllCalendars" ); 510cdf0e10cSrcweir 511cdf0e10cSrcweir if ( func ) { 512cdf0e10cSrcweir allCalendars = func(calendarsCount); 513cdf0e10cSrcweir 514cdf0e10cSrcweir Sequence< Calendar > calendarsSeq(calendarsCount); 515cdf0e10cSrcweir sal_Int16 offset = 3; 516cdf0e10cSrcweir sal_Int16 i, j; 517cdf0e10cSrcweir for(i = 0; i < calendarsCount; i++) { 518cdf0e10cSrcweir Sequence< CalendarItem > days(allCalendars[0][i]); 519cdf0e10cSrcweir Sequence< CalendarItem > months(allCalendars[1][i]); 520cdf0e10cSrcweir Sequence< CalendarItem > eras(allCalendars[2][i]); 521cdf0e10cSrcweir OUString calendarID(allCalendars[offset]); 522cdf0e10cSrcweir offset++; 523cdf0e10cSrcweir sal_Bool defaultCalendar = sal::static_int_cast<sal_Bool>( allCalendars[offset][0] ); 524cdf0e10cSrcweir offset++; 525cdf0e10cSrcweir if (OUString(allCalendars[offset]).equalsAscii("ref")) { 526cdf0e10cSrcweir days = getCalendarItemByName(OUString(allCalendars[offset+1]), rLocale, calendarsSeq, i, REF_DAYS); 527cdf0e10cSrcweir offset += 2; 528cdf0e10cSrcweir } else { 529cdf0e10cSrcweir for(j = 0; j < allCalendars[0][i]; j++) { 530cdf0e10cSrcweir CalendarItem day(allCalendars[offset], 531cdf0e10cSrcweir allCalendars[offset+1], allCalendars[offset+2]); 532cdf0e10cSrcweir days[j] = day; 533cdf0e10cSrcweir offset += 3; 534cdf0e10cSrcweir } 535cdf0e10cSrcweir } 536cdf0e10cSrcweir if (OUString(allCalendars[offset]).equalsAscii("ref")) { 537cdf0e10cSrcweir months = getCalendarItemByName(OUString(allCalendars[offset+1]), rLocale, calendarsSeq, i, REF_MONTHS); 538cdf0e10cSrcweir offset += 2; 539cdf0e10cSrcweir } else { 540cdf0e10cSrcweir for(j = 0; j < allCalendars[1][i]; j++) { 541cdf0e10cSrcweir CalendarItem month(allCalendars[offset], 542cdf0e10cSrcweir allCalendars[offset+1], allCalendars[offset+2]); 543cdf0e10cSrcweir months[j] = month; 544cdf0e10cSrcweir offset += 3; 545cdf0e10cSrcweir } 546cdf0e10cSrcweir } 547cdf0e10cSrcweir if (OUString(allCalendars[offset]).equalsAscii("ref")) { 548cdf0e10cSrcweir eras = getCalendarItemByName(OUString(allCalendars[offset+1]), rLocale, calendarsSeq, i, REF_ERAS); 549cdf0e10cSrcweir offset += 2; 550cdf0e10cSrcweir } else { 551cdf0e10cSrcweir for(j = 0; j < allCalendars[2][i]; j++) { 552cdf0e10cSrcweir CalendarItem era(allCalendars[offset], 553cdf0e10cSrcweir allCalendars[offset+1], allCalendars[offset+2]); 554cdf0e10cSrcweir eras[j] = era; 555cdf0e10cSrcweir offset += 3; 556cdf0e10cSrcweir } 557cdf0e10cSrcweir } 558cdf0e10cSrcweir OUString startOfWeekDay(allCalendars[offset]); 559cdf0e10cSrcweir offset++; 560cdf0e10cSrcweir sal_Int16 minimalDaysInFirstWeek = allCalendars[offset][0]; 561cdf0e10cSrcweir offset++; 562cdf0e10cSrcweir Calendar aCalendar(days, months, eras, startOfWeekDay, 563cdf0e10cSrcweir minimalDaysInFirstWeek, defaultCalendar, calendarID); 564cdf0e10cSrcweir calendarsSeq[i] = aCalendar; 565cdf0e10cSrcweir } 566cdf0e10cSrcweir return calendarsSeq; 567cdf0e10cSrcweir } 568cdf0e10cSrcweir else { 569cdf0e10cSrcweir Sequence< Calendar > seq1(0); 570cdf0e10cSrcweir return seq1; 571cdf0e10cSrcweir } 572cdf0e10cSrcweir } 573cdf0e10cSrcweir 574cdf0e10cSrcweir 575cdf0e10cSrcweir Sequence< Currency2 > SAL_CALL 576cdf0e10cSrcweir LocaleData::getAllCurrencies2( const Locale& rLocale ) throw(RuntimeException) 577cdf0e10cSrcweir { 578cdf0e10cSrcweir 579cdf0e10cSrcweir sal_Int16 currencyCount = 0; 580cdf0e10cSrcweir sal_Unicode **allCurrencies = NULL; 581cdf0e10cSrcweir 582cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getAllCurrencies" ); 583cdf0e10cSrcweir 584cdf0e10cSrcweir if ( func ) { 585cdf0e10cSrcweir allCurrencies = func(currencyCount); 586cdf0e10cSrcweir 587cdf0e10cSrcweir Sequence< Currency2 > seq(currencyCount); 588cdf0e10cSrcweir for(int i = 0, nOff = 0; i < currencyCount; i++, nOff += 8 ) { 589cdf0e10cSrcweir Currency2 cur( 590cdf0e10cSrcweir allCurrencies[nOff], // string ID 591cdf0e10cSrcweir allCurrencies[nOff+1], // string Symbol 592cdf0e10cSrcweir allCurrencies[nOff+2], // string BankSymbol 593cdf0e10cSrcweir allCurrencies[nOff+3], // string Name 594cdf0e10cSrcweir allCurrencies[nOff+4][0] != 0, // boolean Default 595cdf0e10cSrcweir allCurrencies[nOff+5][0] != 0, // boolean UsedInCompatibleFormatCodes 596cdf0e10cSrcweir allCurrencies[nOff+6][0], // short DecimalPlaces 597cdf0e10cSrcweir allCurrencies[nOff+7][0] != 0 // boolean LegacyOnly 598cdf0e10cSrcweir ); 599cdf0e10cSrcweir seq[i] = cur; 600cdf0e10cSrcweir } 601cdf0e10cSrcweir return seq; 602cdf0e10cSrcweir } 603cdf0e10cSrcweir else { 604cdf0e10cSrcweir Sequence< Currency2 > seq1(0); 605cdf0e10cSrcweir return seq1; 606cdf0e10cSrcweir } 607cdf0e10cSrcweir } 608cdf0e10cSrcweir 609cdf0e10cSrcweir 610cdf0e10cSrcweir Sequence< Currency > SAL_CALL 611cdf0e10cSrcweir LocaleData::getAllCurrencies( const Locale& rLocale ) throw(RuntimeException) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir Sequence< Currency2 > aCur2( getAllCurrencies2( rLocale)); 614cdf0e10cSrcweir sal_Int32 nLen = aCur2.getLength(); 615cdf0e10cSrcweir Sequence< Currency > aCur1( nLen); 616cdf0e10cSrcweir const Currency2* p2 = aCur2.getArray(); 617cdf0e10cSrcweir Currency* p1 = aCur1.getArray(); 618cdf0e10cSrcweir for (sal_Int32 i=0; i < nLen; ++i, ++p1, ++p2) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir *p1 = *p2; 621cdf0e10cSrcweir } 622cdf0e10cSrcweir return aCur1; 623cdf0e10cSrcweir } 624cdf0e10cSrcweir 625cdf0e10cSrcweir 626cdf0e10cSrcweir // return a static (!) string resulting from replacing all occurrences of 627cdf0e10cSrcweir // 'oldStr' string in 'formatCode' string with 'newStr' string 628cdf0e10cSrcweir static const sal_Unicode * replace( sal_Unicode const * const formatCode, sal_Unicode const * const oldStr, sal_Unicode const * const newStr) 629cdf0e10cSrcweir { 630cdf0e10cSrcweir // make reasonable assumption of maximum length of formatCode. 631cdf0e10cSrcweir #define MAX_FORMATCODE_LENTH 512 632cdf0e10cSrcweir static sal_Unicode str[MAX_FORMATCODE_LENTH]; 633cdf0e10cSrcweir 634cdf0e10cSrcweir if (oldStr[0] == 0) // no replacement requires 635cdf0e10cSrcweir return formatCode; 636cdf0e10cSrcweir 637cdf0e10cSrcweir sal_Int32 i = 0, k = 0; 638cdf0e10cSrcweir while (formatCode[i] > 0 && k < MAX_FORMATCODE_LENTH) { 639cdf0e10cSrcweir sal_Int32 j = 0, last = k; 640cdf0e10cSrcweir // search oldStr in formatCode 641cdf0e10cSrcweir while (formatCode[i] > 0 && oldStr[j] > 0 && k < MAX_FORMATCODE_LENTH) { 642cdf0e10cSrcweir str[k++] = formatCode[i]; 643cdf0e10cSrcweir if (formatCode[i++] != oldStr[j++]) 644cdf0e10cSrcweir break; 645cdf0e10cSrcweir } 646cdf0e10cSrcweir if (oldStr[j] == 0) { 647cdf0e10cSrcweir // matched string found, do replacement 648cdf0e10cSrcweir k = last; j = 0; 649cdf0e10cSrcweir while (newStr[j] > 0 && k < MAX_FORMATCODE_LENTH) 650cdf0e10cSrcweir str[k++] = newStr[j++]; 651cdf0e10cSrcweir } 652cdf0e10cSrcweir } 653cdf0e10cSrcweir if (k >= MAX_FORMATCODE_LENTH) // could not complete replacement, return original formatCode 654cdf0e10cSrcweir return formatCode; 655cdf0e10cSrcweir 656cdf0e10cSrcweir str[k] = 0; 657cdf0e10cSrcweir return str; 658cdf0e10cSrcweir } 659cdf0e10cSrcweir 660cdf0e10cSrcweir Sequence< FormatElement > SAL_CALL 661cdf0e10cSrcweir LocaleData::getAllFormats( const Locale& rLocale ) throw(RuntimeException) 662cdf0e10cSrcweir { 663cdf0e10cSrcweir const int SECTIONS = 2; 664cdf0e10cSrcweir struct FormatSection 665cdf0e10cSrcweir { 666cdf0e10cSrcweir MyFunc_FormatCode func; 667cdf0e10cSrcweir sal_Unicode const *from; 668cdf0e10cSrcweir sal_Unicode const *to; 669cdf0e10cSrcweir sal_Unicode const *const *formatArray; 670cdf0e10cSrcweir sal_Int16 formatCount; 671cdf0e10cSrcweir 672cdf0e10cSrcweir FormatSection() : func(0), from(0), to(0), formatArray(0), formatCount(0) {} 673cdf0e10cSrcweir sal_Int16 getFunc( LocaleData& rLocaleData, const Locale& rL, const char* pName ) 674cdf0e10cSrcweir { 675cdf0e10cSrcweir func = reinterpret_cast<MyFunc_FormatCode>( rLocaleData.getFunctionSymbol( rL, pName)); 676cdf0e10cSrcweir if (func) 677cdf0e10cSrcweir formatArray = func( formatCount, from, to); 678cdf0e10cSrcweir return formatCount; 679cdf0e10cSrcweir } 680cdf0e10cSrcweir } section[SECTIONS]; 681cdf0e10cSrcweir 682cdf0e10cSrcweir #if 0 683cdf0e10cSrcweir // #i79398# wntmsci10 MSVC doesn't get this right with optimization. 684cdf0e10cSrcweir const sal_Int32 formatCount = section[0].getFunc( *this, rLocale, "getAllFormats0") 685cdf0e10cSrcweir + section[1].getFunc( *this, rLocale, "getAllFormats1"); 686cdf0e10cSrcweir #else 687cdf0e10cSrcweir sal_Int32 formatCount = section[0].getFunc( *this, rLocale, "getAllFormats0"); 688cdf0e10cSrcweir formatCount += section[1].getFunc( *this, rLocale, "getAllFormats1"); 689cdf0e10cSrcweir #endif 690cdf0e10cSrcweir Sequence< FormatElement > seq(formatCount); 691cdf0e10cSrcweir sal_Int32 f = 0; 692cdf0e10cSrcweir for (int s = 0; s < SECTIONS; ++s) 693cdf0e10cSrcweir { 694cdf0e10cSrcweir sal_Unicode const * const * const formatArray = section[s].formatArray; 695cdf0e10cSrcweir if ( formatArray ) 696cdf0e10cSrcweir { 697cdf0e10cSrcweir for (int i = 0, nOff = 0; i < section[s].formatCount; ++i, nOff += 7, ++f) 698cdf0e10cSrcweir { 699cdf0e10cSrcweir FormatElement elem( 700cdf0e10cSrcweir replace( formatArray[nOff], section[s].from, section[s].to), 701cdf0e10cSrcweir formatArray[nOff + 1], 702cdf0e10cSrcweir formatArray[nOff + 2], 703cdf0e10cSrcweir formatArray[nOff + 3], 704cdf0e10cSrcweir formatArray[nOff + 4], 705cdf0e10cSrcweir formatArray[nOff + 5][0], 706cdf0e10cSrcweir sal::static_int_cast<sal_Bool>(formatArray[nOff + 6][0])); 707cdf0e10cSrcweir seq[f] = elem; 708cdf0e10cSrcweir } 709cdf0e10cSrcweir } 710cdf0e10cSrcweir } 711cdf0e10cSrcweir return seq; 712cdf0e10cSrcweir } 713cdf0e10cSrcweir 714cdf0e10cSrcweir #define COLLATOR_OFFSET_ALGO 0 715cdf0e10cSrcweir #define COLLATOR_OFFSET_DEFAULT 1 716cdf0e10cSrcweir #define COLLATOR_OFFSET_RULE 2 717cdf0e10cSrcweir #define COLLATOR_ELEMENTS 3 718cdf0e10cSrcweir 719cdf0e10cSrcweir OUString SAL_CALL 720cdf0e10cSrcweir LocaleData::getCollatorRuleByAlgorithm( const Locale& rLocale, const OUString& algorithm ) throw(RuntimeException) 721cdf0e10cSrcweir { 722cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getCollatorImplementation" ); 723cdf0e10cSrcweir if ( func ) { 724cdf0e10cSrcweir sal_Int16 collatorCount = 0; 725cdf0e10cSrcweir sal_Unicode **collatorArray = func(collatorCount); 726cdf0e10cSrcweir for(sal_Int16 i = 0; i < collatorCount; i++) 727cdf0e10cSrcweir if (algorithm.equals(collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_ALGO])) 728cdf0e10cSrcweir return OUString(collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_RULE]); 729cdf0e10cSrcweir } 730cdf0e10cSrcweir return OUString(); 731cdf0e10cSrcweir } 732cdf0e10cSrcweir 733cdf0e10cSrcweir 734cdf0e10cSrcweir Sequence< Implementation > SAL_CALL 735cdf0e10cSrcweir LocaleData::getCollatorImplementations( const Locale& rLocale ) throw(RuntimeException) 736cdf0e10cSrcweir { 737cdf0e10cSrcweir sal_Int16 collatorCount = 0; 738cdf0e10cSrcweir sal_Unicode **collatorArray = NULL; 739cdf0e10cSrcweir 740cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getCollatorImplementation" ); 741cdf0e10cSrcweir 742cdf0e10cSrcweir if ( func ) { 743cdf0e10cSrcweir collatorArray = func(collatorCount); 744cdf0e10cSrcweir Sequence< Implementation > seq(collatorCount); 745cdf0e10cSrcweir for(sal_Int16 i = 0; i < collatorCount; i++) { 746cdf0e10cSrcweir Implementation impl(collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_ALGO], 747cdf0e10cSrcweir sal::static_int_cast<sal_Bool>( 748cdf0e10cSrcweir collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_DEFAULT][0])); 749cdf0e10cSrcweir seq[i] = impl; 750cdf0e10cSrcweir } 751cdf0e10cSrcweir return seq; 752cdf0e10cSrcweir } 753cdf0e10cSrcweir else { 754cdf0e10cSrcweir Sequence< Implementation > seq1(0); 755cdf0e10cSrcweir return seq1; 756cdf0e10cSrcweir } 757cdf0e10cSrcweir } 758cdf0e10cSrcweir 759cdf0e10cSrcweir Sequence< OUString > SAL_CALL 760cdf0e10cSrcweir LocaleData::getCollationOptions( const Locale& rLocale ) throw(RuntimeException) 761cdf0e10cSrcweir { 762cdf0e10cSrcweir sal_Int16 optionsCount = 0; 763cdf0e10cSrcweir sal_Unicode **optionsArray = NULL; 764cdf0e10cSrcweir 765cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getCollationOptions" ); 766cdf0e10cSrcweir 767cdf0e10cSrcweir if ( func ) { 768cdf0e10cSrcweir optionsArray = func(optionsCount); 769cdf0e10cSrcweir Sequence< OUString > seq(optionsCount); 770cdf0e10cSrcweir for(sal_Int16 i = 0; i < optionsCount; i++) { 771cdf0e10cSrcweir seq[i] = OUString( optionsArray[i] ); 772cdf0e10cSrcweir } 773cdf0e10cSrcweir return seq; 774cdf0e10cSrcweir } 775cdf0e10cSrcweir else { 776cdf0e10cSrcweir Sequence< OUString > seq1(0); 777cdf0e10cSrcweir return seq1; 778cdf0e10cSrcweir } 779cdf0e10cSrcweir } 780cdf0e10cSrcweir 781cdf0e10cSrcweir Sequence< OUString > SAL_CALL 782cdf0e10cSrcweir LocaleData::getSearchOptions( const Locale& rLocale ) throw(RuntimeException) 783cdf0e10cSrcweir { 784cdf0e10cSrcweir sal_Int16 optionsCount = 0; 785cdf0e10cSrcweir sal_Unicode **optionsArray = NULL; 786cdf0e10cSrcweir 787cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getSearchOptions" ); 788cdf0e10cSrcweir 789cdf0e10cSrcweir if ( func ) { 790cdf0e10cSrcweir optionsArray = func(optionsCount); 791cdf0e10cSrcweir Sequence< OUString > seq(optionsCount); 792cdf0e10cSrcweir for(sal_Int16 i = 0; i < optionsCount; i++) { 793cdf0e10cSrcweir seq[i] = OUString( optionsArray[i] ); 794cdf0e10cSrcweir } 795cdf0e10cSrcweir return seq; 796cdf0e10cSrcweir } 797cdf0e10cSrcweir else { 798cdf0e10cSrcweir Sequence< OUString > seq1(0); 799cdf0e10cSrcweir return seq1; 800cdf0e10cSrcweir } 801cdf0e10cSrcweir } 802cdf0e10cSrcweir 803cdf0e10cSrcweir sal_Unicode ** SAL_CALL 804cdf0e10cSrcweir LocaleData::getIndexArray(const Locale& rLocale, sal_Int16& indexCount) 805cdf0e10cSrcweir { 806cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getIndexAlgorithm" ); 807cdf0e10cSrcweir 808cdf0e10cSrcweir if (func) 809cdf0e10cSrcweir return func(indexCount); 810cdf0e10cSrcweir return NULL; 811cdf0e10cSrcweir } 812cdf0e10cSrcweir 813cdf0e10cSrcweir Sequence< OUString > SAL_CALL 814cdf0e10cSrcweir LocaleData::getIndexAlgorithm( const Locale& rLocale ) throw(RuntimeException) 815cdf0e10cSrcweir { 816cdf0e10cSrcweir sal_Int16 indexCount = 0; 817cdf0e10cSrcweir sal_Unicode **indexArray = getIndexArray(rLocale, indexCount); 818cdf0e10cSrcweir 819cdf0e10cSrcweir if ( indexArray ) { 820cdf0e10cSrcweir Sequence< OUString > seq(indexCount); 821cdf0e10cSrcweir for(sal_Int16 i = 0; i < indexCount; i++) { 822cdf0e10cSrcweir seq[i] = indexArray[i*5]; 823cdf0e10cSrcweir } 824cdf0e10cSrcweir return seq; 825cdf0e10cSrcweir } 826cdf0e10cSrcweir else { 827cdf0e10cSrcweir Sequence< OUString > seq1(0); 828cdf0e10cSrcweir return seq1; 829cdf0e10cSrcweir } 830cdf0e10cSrcweir } 831cdf0e10cSrcweir 832cdf0e10cSrcweir OUString SAL_CALL 833cdf0e10cSrcweir LocaleData::getDefaultIndexAlgorithm( const Locale& rLocale ) throw(RuntimeException) 834cdf0e10cSrcweir { 835cdf0e10cSrcweir sal_Int16 indexCount = 0; 836cdf0e10cSrcweir sal_Unicode **indexArray = getIndexArray(rLocale, indexCount); 837cdf0e10cSrcweir 838cdf0e10cSrcweir if ( indexArray ) { 839cdf0e10cSrcweir for(sal_Int16 i = 0; i < indexCount; i++) { 840cdf0e10cSrcweir if (indexArray[i*5 + 3][0]) 841cdf0e10cSrcweir return OUString(indexArray[i*5]); 842cdf0e10cSrcweir } 843cdf0e10cSrcweir } 844cdf0e10cSrcweir return OUString(); 845cdf0e10cSrcweir } 846cdf0e10cSrcweir 847cdf0e10cSrcweir sal_Bool SAL_CALL 848cdf0e10cSrcweir LocaleData::hasPhonetic( const Locale& rLocale ) throw(RuntimeException) 849cdf0e10cSrcweir { 850cdf0e10cSrcweir sal_Int16 indexCount = 0; 851cdf0e10cSrcweir sal_Unicode **indexArray = getIndexArray(rLocale, indexCount); 852cdf0e10cSrcweir 853cdf0e10cSrcweir if ( indexArray ) { 854cdf0e10cSrcweir for(sal_Int16 i = 0; i < indexCount; i++) { 855cdf0e10cSrcweir if (indexArray[i*5 + 4][0]) 856cdf0e10cSrcweir return sal_True; 857cdf0e10cSrcweir } 858cdf0e10cSrcweir } 859cdf0e10cSrcweir return sal_False; 860cdf0e10cSrcweir } 861cdf0e10cSrcweir 862cdf0e10cSrcweir sal_Unicode ** SAL_CALL 863cdf0e10cSrcweir LocaleData::getIndexArrayForAlgorithm(const Locale& rLocale, const OUString& algorithm) 864cdf0e10cSrcweir { 865cdf0e10cSrcweir sal_Int16 indexCount = 0; 866cdf0e10cSrcweir sal_Unicode **indexArray = getIndexArray(rLocale, indexCount); 867cdf0e10cSrcweir if ( indexArray ) { 868cdf0e10cSrcweir for(sal_Int16 i = 0; i < indexCount; i++) { 869cdf0e10cSrcweir if (algorithm.equals(indexArray[i*5])) 870cdf0e10cSrcweir return indexArray+i*5; 871cdf0e10cSrcweir } 872cdf0e10cSrcweir } 873cdf0e10cSrcweir return NULL; 874cdf0e10cSrcweir } 875cdf0e10cSrcweir 876cdf0e10cSrcweir sal_Bool SAL_CALL 877cdf0e10cSrcweir LocaleData::isPhonetic( const Locale& rLocale, const OUString& algorithm ) throw(RuntimeException) 878cdf0e10cSrcweir { 879cdf0e10cSrcweir sal_Unicode **indexArray = getIndexArrayForAlgorithm(rLocale, algorithm); 880cdf0e10cSrcweir return (indexArray && indexArray[4][0]) ? sal_True : sal_False; 881cdf0e10cSrcweir } 882cdf0e10cSrcweir 883cdf0e10cSrcweir OUString SAL_CALL 884cdf0e10cSrcweir LocaleData::getIndexKeysByAlgorithm( const Locale& rLocale, const OUString& algorithm ) throw(RuntimeException) 885cdf0e10cSrcweir { 886cdf0e10cSrcweir sal_Unicode **indexArray = getIndexArrayForAlgorithm(rLocale, algorithm); 887cdf0e10cSrcweir return indexArray ? OUString::createFromAscii("0-9")+OUString(indexArray[2]) : OUString(); 888cdf0e10cSrcweir } 889cdf0e10cSrcweir 890cdf0e10cSrcweir OUString SAL_CALL 891cdf0e10cSrcweir LocaleData::getIndexModuleByAlgorithm( const Locale& rLocale, const OUString& algorithm ) throw(RuntimeException) 892cdf0e10cSrcweir { 893cdf0e10cSrcweir sal_Unicode **indexArray = getIndexArrayForAlgorithm(rLocale, algorithm); 894cdf0e10cSrcweir return indexArray ? OUString(indexArray[1]) : OUString(); 895cdf0e10cSrcweir } 896cdf0e10cSrcweir 897cdf0e10cSrcweir Sequence< UnicodeScript > SAL_CALL 898cdf0e10cSrcweir LocaleData::getUnicodeScripts( const Locale& rLocale ) throw(RuntimeException) 899cdf0e10cSrcweir { 900cdf0e10cSrcweir sal_Int16 scriptCount = 0; 901cdf0e10cSrcweir sal_Unicode **scriptArray = NULL; 902cdf0e10cSrcweir 903cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getUnicodeScripts" ); 904cdf0e10cSrcweir 905cdf0e10cSrcweir if ( func ) { 906cdf0e10cSrcweir scriptArray = func(scriptCount); 907cdf0e10cSrcweir Sequence< UnicodeScript > seq(scriptCount); 908cdf0e10cSrcweir for(sal_Int16 i = 0; i < scriptCount; i++) { 909cdf0e10cSrcweir seq[i] = UnicodeScript( OUString(scriptArray[i]).toInt32() ); 910cdf0e10cSrcweir } 911cdf0e10cSrcweir return seq; 912cdf0e10cSrcweir } 913cdf0e10cSrcweir else { 914cdf0e10cSrcweir Sequence< UnicodeScript > seq1(0); 915cdf0e10cSrcweir return seq1; 916cdf0e10cSrcweir } 917cdf0e10cSrcweir } 918cdf0e10cSrcweir 919cdf0e10cSrcweir Sequence< OUString > SAL_CALL 920cdf0e10cSrcweir LocaleData::getFollowPageWords( const Locale& rLocale ) throw(RuntimeException) 921cdf0e10cSrcweir { 922cdf0e10cSrcweir sal_Int16 wordCount = 0; 923cdf0e10cSrcweir sal_Unicode **wordArray = NULL; 924cdf0e10cSrcweir 925cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getFollowPageWords" ); 926cdf0e10cSrcweir 927cdf0e10cSrcweir if ( func ) { 928cdf0e10cSrcweir wordArray = func(wordCount); 929cdf0e10cSrcweir Sequence< OUString > seq(wordCount); 930cdf0e10cSrcweir for(sal_Int16 i = 0; i < wordCount; i++) { 931cdf0e10cSrcweir seq[i] = OUString(wordArray[i]); 932cdf0e10cSrcweir } 933cdf0e10cSrcweir return seq; 934cdf0e10cSrcweir } 935cdf0e10cSrcweir else { 936cdf0e10cSrcweir Sequence< OUString > seq1(0); 937cdf0e10cSrcweir return seq1; 938cdf0e10cSrcweir } 939cdf0e10cSrcweir } 940cdf0e10cSrcweir 941cdf0e10cSrcweir Sequence< OUString > SAL_CALL 942cdf0e10cSrcweir LocaleData::getTransliterations( const Locale& rLocale ) throw(RuntimeException) 943cdf0e10cSrcweir { 944cdf0e10cSrcweir 945cdf0e10cSrcweir sal_Int16 transliterationsCount = 0; 946cdf0e10cSrcweir sal_Unicode **transliterationsArray = NULL; 947cdf0e10cSrcweir 948cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getTransliterations" ); 949cdf0e10cSrcweir 950cdf0e10cSrcweir if ( func ) { 951cdf0e10cSrcweir transliterationsArray = func(transliterationsCount); 952cdf0e10cSrcweir 953cdf0e10cSrcweir Sequence< OUString > seq(transliterationsCount); 954cdf0e10cSrcweir for(int i = 0; i < transliterationsCount; i++) { 955cdf0e10cSrcweir OUString elem(transliterationsArray[i]); 956cdf0e10cSrcweir seq[i] = elem; 957cdf0e10cSrcweir } 958cdf0e10cSrcweir return seq; 959cdf0e10cSrcweir } 960cdf0e10cSrcweir else { 961cdf0e10cSrcweir Sequence< OUString > seq1(0); 962cdf0e10cSrcweir return seq1; 963cdf0e10cSrcweir } 964cdf0e10cSrcweir 965cdf0e10cSrcweir 966cdf0e10cSrcweir } 967cdf0e10cSrcweir 968cdf0e10cSrcweir 969cdf0e10cSrcweir LanguageCountryInfo SAL_CALL 970cdf0e10cSrcweir LocaleData::getLanguageCountryInfo( const Locale& rLocale ) throw(RuntimeException) 971cdf0e10cSrcweir { 972cdf0e10cSrcweir sal_Int16 LCInfoCount = 0; 973cdf0e10cSrcweir sal_Unicode **LCInfoArray = NULL; 974cdf0e10cSrcweir 975cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getLCInfo" ); 976cdf0e10cSrcweir 977cdf0e10cSrcweir if ( func ) { 978cdf0e10cSrcweir LCInfoArray = func(LCInfoCount); 979cdf0e10cSrcweir LanguageCountryInfo info(LCInfoArray[0], 980cdf0e10cSrcweir LCInfoArray[1], 981cdf0e10cSrcweir LCInfoArray[2], 982cdf0e10cSrcweir LCInfoArray[3], 983cdf0e10cSrcweir LCInfoArray[4]); 984cdf0e10cSrcweir return info; 985cdf0e10cSrcweir } 986cdf0e10cSrcweir else { 987cdf0e10cSrcweir LanguageCountryInfo info1; 988cdf0e10cSrcweir return info1; 989cdf0e10cSrcweir } 990cdf0e10cSrcweir 991cdf0e10cSrcweir } 992cdf0e10cSrcweir 993cdf0e10cSrcweir 994cdf0e10cSrcweir ForbiddenCharacters SAL_CALL 995cdf0e10cSrcweir LocaleData::getForbiddenCharacters( const Locale& rLocale ) throw(RuntimeException) 996cdf0e10cSrcweir { 997cdf0e10cSrcweir sal_Int16 LCForbiddenCharactersCount = 0; 998cdf0e10cSrcweir sal_Unicode **LCForbiddenCharactersArray = NULL; 999cdf0e10cSrcweir 1000cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getForbiddenCharacters" ); 1001cdf0e10cSrcweir 1002cdf0e10cSrcweir if ( func ) { 1003cdf0e10cSrcweir LCForbiddenCharactersArray = func(LCForbiddenCharactersCount); 1004cdf0e10cSrcweir ForbiddenCharacters chars(LCForbiddenCharactersArray[0], LCForbiddenCharactersArray[1]); 1005cdf0e10cSrcweir return chars; 1006cdf0e10cSrcweir } 1007cdf0e10cSrcweir else { 1008cdf0e10cSrcweir ForbiddenCharacters chars1; 1009cdf0e10cSrcweir return chars1; 1010cdf0e10cSrcweir } 1011cdf0e10cSrcweir } 1012cdf0e10cSrcweir 1013cdf0e10cSrcweir OUString SAL_CALL 1014cdf0e10cSrcweir LocaleData::getHangingCharacters( const Locale& rLocale ) throw(RuntimeException) 1015cdf0e10cSrcweir { 1016cdf0e10cSrcweir sal_Int16 LCForbiddenCharactersCount = 0; 1017cdf0e10cSrcweir sal_Unicode **LCForbiddenCharactersArray = NULL; 1018cdf0e10cSrcweir 1019cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getForbiddenCharacters" ); 1020cdf0e10cSrcweir 1021cdf0e10cSrcweir if ( func ) { 1022cdf0e10cSrcweir LCForbiddenCharactersArray = func(LCForbiddenCharactersCount); 1023cdf0e10cSrcweir return OUString(LCForbiddenCharactersArray[2]); 1024cdf0e10cSrcweir } 1025cdf0e10cSrcweir 1026cdf0e10cSrcweir return OUString(); 1027cdf0e10cSrcweir } 1028cdf0e10cSrcweir 1029cdf0e10cSrcweir Sequence< OUString > SAL_CALL 1030cdf0e10cSrcweir LocaleData::getBreakIteratorRules( const Locale& rLocale ) throw(RuntimeException) 1031cdf0e10cSrcweir { 1032cdf0e10cSrcweir sal_Int16 LCBreakIteratorRuleCount = 0; 1033cdf0e10cSrcweir sal_Unicode **LCBreakIteratorRulesArray = NULL; 1034cdf0e10cSrcweir 1035cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getBreakIteratorRules" ); 1036cdf0e10cSrcweir 1037cdf0e10cSrcweir if ( func ) { 1038cdf0e10cSrcweir LCBreakIteratorRulesArray = func(LCBreakIteratorRuleCount); 1039cdf0e10cSrcweir Sequence< OUString > seq(LCBreakIteratorRuleCount); 1040cdf0e10cSrcweir for(int i = 0; i < (LCBreakIteratorRuleCount); i++) { 1041cdf0e10cSrcweir OUString elem(LCBreakIteratorRulesArray[i]); 1042cdf0e10cSrcweir seq[i] = elem; 1043cdf0e10cSrcweir } 1044cdf0e10cSrcweir return seq; 1045cdf0e10cSrcweir } 1046cdf0e10cSrcweir else { 1047cdf0e10cSrcweir Sequence< OUString > seq1(0); 1048cdf0e10cSrcweir return seq1; 1049cdf0e10cSrcweir } 1050cdf0e10cSrcweir } 1051cdf0e10cSrcweir 1052cdf0e10cSrcweir 1053cdf0e10cSrcweir Sequence< OUString > SAL_CALL 1054cdf0e10cSrcweir LocaleData::getReservedWord( const Locale& rLocale ) throw(RuntimeException) 1055cdf0e10cSrcweir { 1056cdf0e10cSrcweir sal_Int16 LCReservedWordsCount = 0; 1057cdf0e10cSrcweir sal_Unicode **LCReservedWordsArray = NULL; 1058cdf0e10cSrcweir 1059cdf0e10cSrcweir MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getReservedWords" ); 1060cdf0e10cSrcweir 1061cdf0e10cSrcweir if ( func ) { 1062cdf0e10cSrcweir LCReservedWordsArray = func(LCReservedWordsCount); 1063cdf0e10cSrcweir Sequence< OUString > seq(LCReservedWordsCount); 1064cdf0e10cSrcweir for(int i = 0; i < (LCReservedWordsCount); i++) { 1065cdf0e10cSrcweir OUString elem(LCReservedWordsArray[i]); 1066cdf0e10cSrcweir seq[i] = elem; 1067cdf0e10cSrcweir } 1068cdf0e10cSrcweir return seq; 1069cdf0e10cSrcweir } 1070cdf0e10cSrcweir else { 1071cdf0e10cSrcweir Sequence< OUString > seq1(0); 1072cdf0e10cSrcweir return seq1; 1073cdf0e10cSrcweir } 1074cdf0e10cSrcweir } 1075cdf0e10cSrcweir 1076cdf0e10cSrcweir 1077cdf0e10cSrcweir inline 1078cdf0e10cSrcweir OUString C2U( const char* s ) 1079cdf0e10cSrcweir { 1080cdf0e10cSrcweir return OUString::createFromAscii( s ); 1081cdf0e10cSrcweir } 1082cdf0e10cSrcweir 1083cdf0e10cSrcweir Sequence< Sequence<beans::PropertyValue> > SAL_CALL 1084cdf0e10cSrcweir LocaleData::getContinuousNumberingLevels( const lang::Locale& rLocale ) throw(RuntimeException) 1085cdf0e10cSrcweir { 1086cdf0e10cSrcweir int i; 1087cdf0e10cSrcweir 1088cdf0e10cSrcweir // load symbol 1089cdf0e10cSrcweir MyFunc_Type2 func = (MyFunc_Type2) getFunctionSymbol( rLocale, "getContinuousNumberingLevels" ); 1090cdf0e10cSrcweir 1091cdf0e10cSrcweir if ( func ) 1092cdf0e10cSrcweir { 1093cdf0e10cSrcweir // invoke function 1094cdf0e10cSrcweir sal_Int16 nStyles; 1095cdf0e10cSrcweir sal_Int16 nAttributes; 1096cdf0e10cSrcweir sal_Unicode*** p0 = func( nStyles, nAttributes ); 1097cdf0e10cSrcweir 1098cdf0e10cSrcweir // allocate memory for nAttributes attributes for each of the nStyles styles. 1099cdf0e10cSrcweir Sequence< Sequence<beans::PropertyValue> > pv( nStyles ); 1100cdf0e10cSrcweir for( i=0; i<pv.getLength(); i++ ) { 1101cdf0e10cSrcweir pv[i] = Sequence<beans::PropertyValue>( nAttributes ); 1102cdf0e10cSrcweir } 1103cdf0e10cSrcweir 1104cdf0e10cSrcweir sal_Unicode*** pStyle = p0; 1105cdf0e10cSrcweir for( i=0; i<nStyles; i++ ) { 1106cdf0e10cSrcweir sal_Unicode** pAttribute = pStyle[i]; 1107cdf0e10cSrcweir for( int j=0; j<nAttributes; j++ ) { // prefix, numberingtype, ... 1108cdf0e10cSrcweir sal_Unicode* pString = pAttribute[j]; 1109cdf0e10cSrcweir beans::PropertyValue& rVal = pv[i][j]; 1110cdf0e10cSrcweir OUString sVal; 1111cdf0e10cSrcweir if( pString ) { 1112cdf0e10cSrcweir if( 0 != j && 2 != j ) 1113cdf0e10cSrcweir sVal = pString; 1114cdf0e10cSrcweir else if( *pString ) 1115cdf0e10cSrcweir sVal = OUString( pString, 1 ); 1116cdf0e10cSrcweir } 1117cdf0e10cSrcweir 1118cdf0e10cSrcweir switch( j ) 1119cdf0e10cSrcweir { 1120cdf0e10cSrcweir case 0: 1121cdf0e10cSrcweir rVal.Name = C2U("Prefix"); 1122cdf0e10cSrcweir rVal.Value <<= sVal; 1123cdf0e10cSrcweir break; 1124cdf0e10cSrcweir case 1: 1125cdf0e10cSrcweir rVal.Name = C2U("NumberingType"); 1126cdf0e10cSrcweir rVal.Value <<= (sal_Int16) sVal.toInt32(); 1127cdf0e10cSrcweir break; 1128cdf0e10cSrcweir case 2: 1129cdf0e10cSrcweir rVal.Name = C2U("Suffix"); 1130cdf0e10cSrcweir rVal.Value <<= sVal; 1131cdf0e10cSrcweir break; 1132cdf0e10cSrcweir case 3: 1133cdf0e10cSrcweir rVal.Name = C2U("Transliteration"); 1134cdf0e10cSrcweir rVal.Value <<= sVal; 1135cdf0e10cSrcweir break; 1136cdf0e10cSrcweir case 4: 1137cdf0e10cSrcweir rVal.Name = C2U("NatNum"); 1138cdf0e10cSrcweir rVal.Value <<= (sal_Int16) sVal.toInt32(); 1139cdf0e10cSrcweir break; 1140cdf0e10cSrcweir default: 1141cdf0e10cSrcweir OSL_ASSERT(0); 1142cdf0e10cSrcweir } 1143cdf0e10cSrcweir } 1144cdf0e10cSrcweir } 1145cdf0e10cSrcweir return pv; 1146cdf0e10cSrcweir } 1147cdf0e10cSrcweir 1148cdf0e10cSrcweir Sequence< Sequence<beans::PropertyValue> > seq1(0); 1149cdf0e10cSrcweir return seq1; 1150cdf0e10cSrcweir } 1151cdf0e10cSrcweir 1152cdf0e10cSrcweir // ============================================================================ 1153cdf0e10cSrcweir // \/ OutlineNumbering helper class \/ 1154cdf0e10cSrcweir // 1155cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp> 1156cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 1157cdf0e10cSrcweir 1158cdf0e10cSrcweir namespace com{ namespace sun{ namespace star{ namespace lang { 1159cdf0e10cSrcweir struct Locale; 1160cdf0e10cSrcweir }}}} 1161cdf0e10cSrcweir //----------------------------------------------------------------------------- 1162cdf0e10cSrcweir struct OutlineNumberingLevel_Impl 1163cdf0e10cSrcweir { 1164cdf0e10cSrcweir OUString sPrefix; 1165cdf0e10cSrcweir sal_Int16 nNumType; //com::sun::star::style::NumberingType 1166cdf0e10cSrcweir OUString sSuffix; 1167cdf0e10cSrcweir sal_Unicode cBulletChar; 1168cdf0e10cSrcweir const sal_Char* sBulletFontName; 1169cdf0e10cSrcweir sal_Int16 nParentNumbering; 1170cdf0e10cSrcweir sal_Int32 nLeftMargin; 1171cdf0e10cSrcweir sal_Int32 nSymbolTextDistance; 1172cdf0e10cSrcweir sal_Int32 nFirstLineOffset; 1173cdf0e10cSrcweir OUString sTransliteration; 1174cdf0e10cSrcweir sal_Int32 nNatNum; 1175cdf0e10cSrcweir }; 1176cdf0e10cSrcweir //----------------------------------------------------------------------------- 1177cdf0e10cSrcweir class OutlineNumbering : public cppu::WeakImplHelper1 < container::XIndexAccess > 1178cdf0e10cSrcweir { 1179cdf0e10cSrcweir const OutlineNumberingLevel_Impl* m_pOutlineLevels; 1180cdf0e10cSrcweir sal_Int16 m_nCount; 1181cdf0e10cSrcweir public: 1182cdf0e10cSrcweir // OutlineNumbering(const OutlineNumberingLevel_Impl* pOutlineLevels); 1183cdf0e10cSrcweir OutlineNumbering(const OutlineNumberingLevel_Impl* pOutlineLevels, int nLevels); 1184cdf0e10cSrcweir ~OutlineNumbering(); 1185cdf0e10cSrcweir 1186cdf0e10cSrcweir //XIndexAccess 1187cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCount( ) throw(RuntimeException); 1188cdf0e10cSrcweir virtual Any SAL_CALL getByIndex( sal_Int32 Index ) 1189cdf0e10cSrcweir throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException); 1190cdf0e10cSrcweir 1191cdf0e10cSrcweir //XElementAccess 1192cdf0e10cSrcweir virtual Type SAL_CALL getElementType( ) throw(RuntimeException); 1193cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements( ) throw(RuntimeException); 1194cdf0e10cSrcweir }; 1195cdf0e10cSrcweir 1196cdf0e10cSrcweir // 1197cdf0e10cSrcweir // OutlineNumbering helper class 1198cdf0e10cSrcweir // ============================================================================ 1199cdf0e10cSrcweir 1200cdf0e10cSrcweir static 1201cdf0e10cSrcweir sal_Char* U2C( OUString str ) 1202cdf0e10cSrcweir { 1203cdf0e10cSrcweir sal_Char* s = new sal_Char[ str.getLength()+1 ]; 1204cdf0e10cSrcweir int i; 1205cdf0e10cSrcweir for( i = 0; i < str.getLength(); i++) 1206cdf0e10cSrcweir s[i] = sal::static_int_cast<sal_Char>( str[i] ); 1207cdf0e10cSrcweir s[i]='\0'; 1208cdf0e10cSrcweir return s; 1209cdf0e10cSrcweir } 1210cdf0e10cSrcweir 1211cdf0e10cSrcweir 1212cdf0e10cSrcweir Sequence< Reference<container::XIndexAccess> > SAL_CALL 1213cdf0e10cSrcweir LocaleData::getOutlineNumberingLevels( const lang::Locale& rLocale ) throw(RuntimeException) 1214cdf0e10cSrcweir { 1215cdf0e10cSrcweir int i; 1216cdf0e10cSrcweir 1217cdf0e10cSrcweir // load symbol 1218cdf0e10cSrcweir MyFunc_Type3 func = (MyFunc_Type3) getFunctionSymbol( rLocale, "getOutlineNumberingLevels" ); 1219cdf0e10cSrcweir 1220cdf0e10cSrcweir if ( func ) 1221cdf0e10cSrcweir { 1222cdf0e10cSrcweir // invoke function 1223cdf0e10cSrcweir sal_Int16 nStyles; 1224cdf0e10cSrcweir sal_Int16 nLevels; 1225cdf0e10cSrcweir sal_Int16 nAttributes; 1226cdf0e10cSrcweir sal_Unicode**** p0 = func( nStyles, nLevels, nAttributes ); 1227cdf0e10cSrcweir 1228cdf0e10cSrcweir Sequence< Reference<container::XIndexAccess> > aRet( nStyles ); 1229cdf0e10cSrcweir 1230cdf0e10cSrcweir OUString aEmptyStr; 1231cdf0e10cSrcweir 1232cdf0e10cSrcweir sal_Unicode**** pStyle = p0; 1233cdf0e10cSrcweir for( i=0; i<nStyles; i++ ) 1234cdf0e10cSrcweir { 1235cdf0e10cSrcweir int j; 1236cdf0e10cSrcweir 1237cdf0e10cSrcweir OutlineNumberingLevel_Impl* level = new OutlineNumberingLevel_Impl[ nLevels+1 ]; 1238cdf0e10cSrcweir sal_Unicode*** pLevel = pStyle[i]; 1239cdf0e10cSrcweir for( j = 0; j < nLevels; j++ ) 1240cdf0e10cSrcweir { 1241cdf0e10cSrcweir sal_Unicode** pAttribute = pLevel[j]; 1242cdf0e10cSrcweir for( int k=0; k<nAttributes; k++ ) 1243cdf0e10cSrcweir { 1244cdf0e10cSrcweir OUString tmp( pAttribute[k] ); 1245cdf0e10cSrcweir switch( k ) 1246cdf0e10cSrcweir { 1247cdf0e10cSrcweir case 0: level[j].sPrefix = tmp; break; 1248cdf0e10cSrcweir case 1: level[j].nNumType = sal::static_int_cast<sal_Int16>(tmp.toInt32()); break; 1249cdf0e10cSrcweir case 2: level[j].sSuffix = tmp; break; 1250cdf0e10cSrcweir //case 3: level[j].cBulletChar = tmp.toChar(); break; 1251cdf0e10cSrcweir case 3: level[j].cBulletChar = sal::static_int_cast<sal_Unicode>(tmp.toInt32(16)); break; // base 16 1252cdf0e10cSrcweir case 4: level[j].sBulletFontName = U2C( tmp ); break; 1253cdf0e10cSrcweir case 5: level[j].nParentNumbering = sal::static_int_cast<sal_Int16>(tmp.toInt32()); break; 1254cdf0e10cSrcweir case 6: level[j].nLeftMargin = tmp.toInt32(); break; 1255cdf0e10cSrcweir case 7: level[j].nSymbolTextDistance = tmp.toInt32(); break; 1256cdf0e10cSrcweir case 8: level[j].nFirstLineOffset = tmp.toInt32(); break; 1257cdf0e10cSrcweir case 9: // Adjust 1258cdf0e10cSrcweir // these values seem to be hard-coded elsewhere: 1259cdf0e10cSrcweir // level[j].Value <<= (sal_Int16) text::HoriOrientation::LEFT; 1260cdf0e10cSrcweir // level[j].Value <<= (sal_Int16) style::HorizontalAlignment::LEFT; 1261cdf0e10cSrcweir break; 1262cdf0e10cSrcweir case 10: level[j].sTransliteration = tmp; break; 1263cdf0e10cSrcweir case 11: level[j].nNatNum = tmp.toInt32(); break; 1264cdf0e10cSrcweir default: 1265cdf0e10cSrcweir OSL_ASSERT(0); 1266cdf0e10cSrcweir } 1267cdf0e10cSrcweir } 1268cdf0e10cSrcweir } 1269cdf0e10cSrcweir level[j].sPrefix = aEmptyStr; 1270cdf0e10cSrcweir level[j].nNumType = 0; 1271cdf0e10cSrcweir level[j].sSuffix = aEmptyStr; 1272cdf0e10cSrcweir level[j].cBulletChar = 0; 1273cdf0e10cSrcweir level[j].sBulletFontName = 0; 1274cdf0e10cSrcweir level[j].nParentNumbering = 0; 1275cdf0e10cSrcweir level[j].nLeftMargin = 0; 1276cdf0e10cSrcweir level[j].nSymbolTextDistance = 0; 1277cdf0e10cSrcweir level[j].nFirstLineOffset = 0; 1278cdf0e10cSrcweir level[j].sTransliteration = aEmptyStr; 1279cdf0e10cSrcweir level[j].nNatNum = 0; 1280cdf0e10cSrcweir aRet[i] = new OutlineNumbering( level, nLevels ); 1281cdf0e10cSrcweir } 1282cdf0e10cSrcweir return aRet; 1283cdf0e10cSrcweir } 1284cdf0e10cSrcweir else { 1285cdf0e10cSrcweir Sequence< Reference<container::XIndexAccess> > seq1(0); 1286cdf0e10cSrcweir return seq1; 1287cdf0e10cSrcweir } 1288cdf0e10cSrcweir } 1289cdf0e10cSrcweir 1290cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////////////////////// 1291cdf0e10cSrcweir //////////////////////////////////helper functions/////////////////////////////////////////// 1292cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////////////////////// 1293cdf0e10cSrcweir 1294cdf0e10cSrcweir oslGenericFunction SAL_CALL LocaleData::getFunctionSymbol( const Locale& rLocale, const sal_Char* pFunction ) 1295cdf0e10cSrcweir throw(RuntimeException) 1296cdf0e10cSrcweir { 1297cdf0e10cSrcweir lcl_LookupTableHelper & rLookupTable = lcl_LookupTableStatic::get(); 1298cdf0e10cSrcweir 1299cdf0e10cSrcweir OUStringBuffer aBuf(1); 1300cdf0e10cSrcweir if (cachedItem.get() && cachedItem->equals(rLocale)) { 1301cdf0e10cSrcweir aBuf.ensureCapacity(strlen(pFunction) + 1 + strlen(cachedItem->localeName)); 1302cdf0e10cSrcweir return cachedItem->module->getFunctionSymbol(aBuf.appendAscii(pFunction).append(under). 1303cdf0e10cSrcweir appendAscii(cachedItem->localeName).makeStringAndClear()); 1304cdf0e10cSrcweir } 1305cdf0e10cSrcweir 1306cdf0e10cSrcweir oslGenericFunction pSymbol = 0; 1307cdf0e10cSrcweir static OUString tw(OUString::createFromAscii("TW")); 1308cdf0e10cSrcweir static OUString en_US(OUString::createFromAscii("en_US")); 1309cdf0e10cSrcweir 1310cdf0e10cSrcweir sal_Int32 l = rLocale.Language.getLength(); 1311cdf0e10cSrcweir sal_Int32 c = rLocale.Country.getLength(); 1312cdf0e10cSrcweir sal_Int32 v = rLocale.Variant.getLength(); 1313cdf0e10cSrcweir aBuf.ensureCapacity(l+c+v+3); 1314cdf0e10cSrcweir 1315cdf0e10cSrcweir LocaleDataLookupTableItem *pCachedItem = 0; 1316cdf0e10cSrcweir 1317cdf0e10cSrcweir if ((l > 0 && c > 0 && v > 0 && 1318cdf0e10cSrcweir // load function with name <func>_<lang>_<country>_<varian> 1319cdf0e10cSrcweir (pSymbol = rLookupTable.getFunctionSymbolByName(aBuf.append(rLocale.Language).append(under).append( 1320cdf0e10cSrcweir rLocale.Country).append(under).append(rLocale.Variant).makeStringAndClear(), pFunction, &pCachedItem)) != 0) || 1321cdf0e10cSrcweir (l > 0 && c > 0 && 1322cdf0e10cSrcweir // load function with name <ase>_<lang>_<country> 1323cdf0e10cSrcweir (pSymbol = rLookupTable.getFunctionSymbolByName(aBuf.append(rLocale.Language).append(under).append( 1324cdf0e10cSrcweir rLocale.Country).makeStringAndClear(), pFunction, &pCachedItem)) != 0) || 1325cdf0e10cSrcweir (l > 0 && c > 0 && rLocale.Language.equalsAscii("zh") && 1326cdf0e10cSrcweir (rLocale.Country.equalsAscii("HK") || 1327cdf0e10cSrcweir rLocale.Country.equalsAscii("MO")) && 1328cdf0e10cSrcweir // if the country code is HK or MO, one more step to try TW. 1329cdf0e10cSrcweir (pSymbol = rLookupTable.getFunctionSymbolByName(aBuf.append(rLocale.Language).append(under).append(tw).makeStringAndClear(), 1330cdf0e10cSrcweir pFunction, &pCachedItem)) != 0) || 1331cdf0e10cSrcweir (l > 0 && 1332cdf0e10cSrcweir // load function with name <func>_<lang> 1333cdf0e10cSrcweir (pSymbol = rLookupTable.getFunctionSymbolByName(rLocale.Language, pFunction, &pCachedItem)) != 0) || 1334cdf0e10cSrcweir // load default function with name <func>_en_US 1335cdf0e10cSrcweir (pSymbol = rLookupTable.getFunctionSymbolByName(en_US, pFunction, &pCachedItem)) != 0) 1336cdf0e10cSrcweir { 1337cdf0e10cSrcweir if( pCachedItem ) 1338cdf0e10cSrcweir cachedItem.reset( pCachedItem ); 1339cdf0e10cSrcweir if( cachedItem.get()) 1340cdf0e10cSrcweir cachedItem->aLocale = rLocale; 1341cdf0e10cSrcweir return pSymbol; 1342cdf0e10cSrcweir } 1343cdf0e10cSrcweir throw RuntimeException(); 1344cdf0e10cSrcweir } 1345cdf0e10cSrcweir 1346cdf0e10cSrcweir Sequence< Locale > SAL_CALL 1347cdf0e10cSrcweir LocaleData::getAllInstalledLocaleNames() throw(RuntimeException) 1348cdf0e10cSrcweir { 1349cdf0e10cSrcweir Sequence< lang::Locale > seq( nbOfLocales ); 1350cdf0e10cSrcweir OUString empStr; 1351cdf0e10cSrcweir sal_Int16 nInstalled = 0; 1352cdf0e10cSrcweir 1353cdf0e10cSrcweir for( sal_Int16 i=0; i<nbOfLocales; i++ ) { 1354cdf0e10cSrcweir OUString name = OUString::createFromAscii( aLibTable[i].pLocale ); 1355cdf0e10cSrcweir 1356cdf0e10cSrcweir // Check if the locale is really available and not just in the table, 1357cdf0e10cSrcweir // don't allow fall backs. 1358cdf0e10cSrcweir LocaleDataLookupTableItem *pCachedItem = 0; 1359cdf0e10cSrcweir if (lcl_LookupTableStatic::get().getFunctionSymbolByName( name, "getLocaleItem", &pCachedItem )) { 1360cdf0e10cSrcweir if( pCachedItem ) 1361cdf0e10cSrcweir cachedItem.reset( pCachedItem ); 1362cdf0e10cSrcweir sal_Int32 index = 0; 1363cdf0e10cSrcweir lang::Locale tmpLocale(name.getToken(0, under, index), empStr, empStr); 1364cdf0e10cSrcweir if (index >= 0) { 1365cdf0e10cSrcweir tmpLocale.Country = name.getToken(0, under, index); 1366cdf0e10cSrcweir if (index >= 0) 1367cdf0e10cSrcweir tmpLocale.Variant = name.getToken(0, under, index); 1368cdf0e10cSrcweir } 1369cdf0e10cSrcweir seq[nInstalled++] = tmpLocale; 1370cdf0e10cSrcweir } 1371cdf0e10cSrcweir } 1372cdf0e10cSrcweir if ( nInstalled < nbOfLocales ) 1373cdf0e10cSrcweir seq.realloc( nInstalled ); // reflect reality 1374cdf0e10cSrcweir 1375cdf0e10cSrcweir return seq; 1376cdf0e10cSrcweir } 1377cdf0e10cSrcweir 1378cdf0e10cSrcweir // ============================================================================ 1379cdf0e10cSrcweir 1380cdf0e10cSrcweir using namespace ::com::sun::star::container; 1381cdf0e10cSrcweir using namespace ::com::sun::star::beans; 1382cdf0e10cSrcweir using namespace ::com::sun::star::style; 1383cdf0e10cSrcweir using namespace ::com::sun::star::text; 1384cdf0e10cSrcweir 1385cdf0e10cSrcweir // // bad: can't have empty prefix ... 1386cdf0e10cSrcweir // OutlineNumbering::OutlineNumbering(const OutlineNumberingLevel_Impl* pOutlnLevels) : 1387cdf0e10cSrcweir // m_pOutlineLevels(pOutlnLevels), 1388cdf0e10cSrcweir // m_nCount(0) 1389cdf0e10cSrcweir // { 1390cdf0e10cSrcweir // const OutlineNumberingLevel_Impl* pTemp = m_pOutlineLevels; 1391cdf0e10cSrcweir // while((pTemp++)->sPrefix) 1392cdf0e10cSrcweir // m_nCount++; 1393cdf0e10cSrcweir // } 1394cdf0e10cSrcweir 1395cdf0e10cSrcweir OutlineNumbering::OutlineNumbering(const OutlineNumberingLevel_Impl* pOutlnLevels, int nLevels) : 1396cdf0e10cSrcweir m_pOutlineLevels(pOutlnLevels), 1397cdf0e10cSrcweir m_nCount(sal::static_int_cast<sal_Int16>(nLevels)) 1398cdf0e10cSrcweir { 1399cdf0e10cSrcweir } 1400cdf0e10cSrcweir 1401cdf0e10cSrcweir OutlineNumbering::~OutlineNumbering() 1402cdf0e10cSrcweir { 1403cdf0e10cSrcweir delete [] m_pOutlineLevels; 1404cdf0e10cSrcweir } 1405cdf0e10cSrcweir 1406cdf0e10cSrcweir sal_Int32 OutlineNumbering::getCount( ) throw(RuntimeException) 1407cdf0e10cSrcweir { 1408cdf0e10cSrcweir return m_nCount; 1409cdf0e10cSrcweir } 1410cdf0e10cSrcweir 1411cdf0e10cSrcweir Any OutlineNumbering::getByIndex( sal_Int32 nIndex ) 1412cdf0e10cSrcweir throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException) 1413cdf0e10cSrcweir { 1414cdf0e10cSrcweir if(nIndex < 0 || nIndex >= m_nCount) 1415cdf0e10cSrcweir throw IndexOutOfBoundsException(); 1416cdf0e10cSrcweir const OutlineNumberingLevel_Impl* pTemp = m_pOutlineLevels; 1417cdf0e10cSrcweir pTemp += nIndex; 1418cdf0e10cSrcweir Any aRet; 1419cdf0e10cSrcweir 1420cdf0e10cSrcweir Sequence<PropertyValue> aOutlineNumbering(12); 1421cdf0e10cSrcweir PropertyValue* pValues = aOutlineNumbering.getArray(); 1422cdf0e10cSrcweir pValues[0].Name = C2U( "Prefix"); 1423cdf0e10cSrcweir pValues[0].Value <<= pTemp->sPrefix; 1424cdf0e10cSrcweir pValues[1].Name = C2U("NumberingType"); 1425cdf0e10cSrcweir pValues[1].Value <<= pTemp->nNumType; 1426cdf0e10cSrcweir pValues[2].Name = C2U("Suffix"); 1427cdf0e10cSrcweir pValues[2].Value <<= pTemp->sSuffix; 1428cdf0e10cSrcweir pValues[3].Name = C2U("BulletChar"); 1429cdf0e10cSrcweir pValues[3].Value <<= OUString(&pTemp->cBulletChar, 1); 1430cdf0e10cSrcweir pValues[4].Name = C2U("BulletFontName"); 1431cdf0e10cSrcweir pValues[4].Value <<= C2U(pTemp->sBulletFontName); 1432cdf0e10cSrcweir pValues[5].Name = C2U("ParentNumbering"); 1433cdf0e10cSrcweir pValues[5].Value <<= pTemp->nParentNumbering; 1434cdf0e10cSrcweir pValues[6].Name = C2U("LeftMargin"); 1435cdf0e10cSrcweir pValues[6].Value <<= pTemp->nLeftMargin; 1436cdf0e10cSrcweir pValues[7].Name = C2U("SymbolTextDistance"); 1437cdf0e10cSrcweir pValues[7].Value <<= pTemp->nSymbolTextDistance; 1438cdf0e10cSrcweir pValues[8].Name = C2U("FirstLineOffset"); 1439cdf0e10cSrcweir pValues[8].Value <<= pTemp->nFirstLineOffset; 1440cdf0e10cSrcweir pValues[9].Name = C2U("Adjust"); 1441cdf0e10cSrcweir pValues[9].Value <<= (sal_Int16)HoriOrientation::LEFT; 1442cdf0e10cSrcweir pValues[10].Name = C2U("Transliteration"); 1443cdf0e10cSrcweir pValues[10].Value <<= pTemp->sTransliteration; 1444cdf0e10cSrcweir pValues[11].Name = C2U("NatNum"); 1445cdf0e10cSrcweir pValues[11].Value <<= pTemp->nNatNum; 1446cdf0e10cSrcweir aRet <<= aOutlineNumbering; 1447cdf0e10cSrcweir return aRet; 1448cdf0e10cSrcweir } 1449cdf0e10cSrcweir 1450cdf0e10cSrcweir Type OutlineNumbering::getElementType( ) throw(RuntimeException) 1451cdf0e10cSrcweir { 1452cdf0e10cSrcweir return ::getCppuType((Sequence<PropertyValue>*)0); 1453cdf0e10cSrcweir } 1454cdf0e10cSrcweir 1455cdf0e10cSrcweir sal_Bool OutlineNumbering::hasElements( ) throw(RuntimeException) 1456cdf0e10cSrcweir { 1457cdf0e10cSrcweir return m_nCount > 0; 1458cdf0e10cSrcweir } 1459cdf0e10cSrcweir 1460cdf0e10cSrcweir OUString SAL_CALL 1461cdf0e10cSrcweir LocaleData::getImplementationName() throw( RuntimeException ) 1462cdf0e10cSrcweir { 1463cdf0e10cSrcweir return OUString::createFromAscii(clocaledata); 1464cdf0e10cSrcweir } 1465cdf0e10cSrcweir 1466cdf0e10cSrcweir sal_Bool SAL_CALL 1467cdf0e10cSrcweir LocaleData::supportsService(const OUString& rServiceName) 1468cdf0e10cSrcweir throw( RuntimeException ) 1469cdf0e10cSrcweir { 1470cdf0e10cSrcweir return !rServiceName.compareToAscii(clocaledata); 1471cdf0e10cSrcweir } 1472cdf0e10cSrcweir 1473cdf0e10cSrcweir Sequence< OUString > SAL_CALL 1474cdf0e10cSrcweir LocaleData::getSupportedServiceNames() throw( RuntimeException ) 1475cdf0e10cSrcweir { 1476cdf0e10cSrcweir Sequence< OUString > aRet(1); 1477cdf0e10cSrcweir aRet[0] = OUString::createFromAscii(clocaledata); 1478cdf0e10cSrcweir return aRet; 1479cdf0e10cSrcweir } 1480