diff options
author | Caolán McNamara <cmc@openoffice.org> | 2010-06-11 20:07:01 +0100 |
---|---|---|
committer | Caolán McNamara <cmc@openoffice.org> | 2010-06-11 20:07:01 +0100 |
commit | dc1186ae43d714fd130c1f243fd790858f946d38 (patch) | |
tree | 53bc2885b8240e3df99261d56f899f9612e55673 /i18npool | |
parent | 7e546b3d8f6f2dffd66b3270050a8b809209df4b (diff) | |
parent | 1184876fc2d6662101facfc1db7464a0d01e2428 (diff) |
cmcfixes75: merge with DEV300 m81
Diffstat (limited to 'i18npool')
49 files changed, 469 insertions, 51 deletions
diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx index a03b61a90194..3d474a0a53dc 100644 --- a/i18npool/inc/transliteration_body.hxx +++ b/i18npool/inc/transliteration_body.hxx @@ -90,6 +90,31 @@ public: }; #endif + +#if defined( TRANSLITERATION_ALL ) +class Transliteration_togglecase : public Transliteration_body +{ +public: + Transliteration_togglecase(); +}; + +class Transliteration_titlecase : public Transliteration_body +{ +public: + Transliteration_titlecase(); + + virtual rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException); +}; + +class Transliteration_sentencecase : public Transliteration_body +{ +public: + Transliteration_sentencecase(); + + virtual rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException); +}; +#endif + } } } } #endif diff --git a/i18npool/source/localedata/data/ak_GH.xml b/i18npool/source/localedata/data/ak_GH.xml index 95ac2069db31..afdbf1c2b227 100644 --- a/i18npool/source/localedata/data/ak_GH.xml +++ b/i18npool/source/localedata/data/ak_GH.xml @@ -337,8 +337,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/bs_BA.xml b/i18npool/source/localedata/data/bs_BA.xml index 1a6eeb82ff44..0dea5e435ec5 100644 --- a/i18npool/source/localedata/data/bs_BA.xml +++ b/i18npool/source/localedata/data/bs_BA.xml @@ -366,9 +366,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> -<Transliteration unoid="LOWERCASE_UPPERCASE"/> -<Transliteration unoid="UPPERCASE_LOWERCASE"/> -<Transliteration unoid="IGNORE_CASE"/> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/ee_GH.xml b/i18npool/source/localedata/data/ee_GH.xml index eb19dec770da..2d4807774a8b 100644 --- a/i18npool/source/localedata/data/ee_GH.xml +++ b/i18npool/source/localedata/data/ee_GH.xml @@ -331,8 +331,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/en_GH.xml b/i18npool/source/localedata/data/en_GH.xml index 660cd759944b..37437468a651 100644 --- a/i18npool/source/localedata/data/en_GH.xml +++ b/i18npool/source/localedata/data/en_GH.xml @@ -329,11 +329,7 @@ <DecimalPlaces>2</DecimalPlaces> </Currency> </LC_CURRENCY> - <LC_TRANSLITERATION> - <Transliteration unoid="LOWERCASE_UPPERCASE" /> - <Transliteration unoid="UPPERCASE_LOWERCASE" /> - <Transliteration unoid="IGNORE_CASE" /> - </LC_TRANSLITERATION> +<LC_TRANSLITERATION ref="en_US"/> <LC_MISC> <ReservedWords> <trueWord>True</trueWord> diff --git a/i18npool/source/localedata/data/en_US.xml b/i18npool/source/localedata/data/en_US.xml index 2a99dcd0fb14..7029b7cc5b30 100644 --- a/i18npool/source/localedata/data/en_US.xml +++ b/i18npool/source/localedata/data/en_US.xml @@ -475,8 +475,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/eo.xml b/i18npool/source/localedata/data/eo.xml index 62098fdf75ef..33a42a8fd675 100644 --- a/i18npool/source/localedata/data/eo.xml +++ b/i18npool/source/localedata/data/eo.xml @@ -321,8 +321,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/eu.xml b/i18npool/source/localedata/data/eu.xml index 5f0119b1285d..64184d0125f0 100644 --- a/i18npool/source/localedata/data/eu.xml +++ b/i18npool/source/localedata/data/eu.xml @@ -328,9 +328,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> - <Transliteration unoid="LOWERCASE_UPPERCASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/fur_IT.xml b/i18npool/source/localedata/data/fur_IT.xml index cfec124d68b6..5aee7cbfdf15 100644 --- a/i18npool/source/localedata/data/fur_IT.xml +++ b/i18npool/source/localedata/data/fur_IT.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/fy_NL.xml b/i18npool/source/localedata/data/fy_NL.xml index 651d13417842..a4a7cc48f2da 100644 --- a/i18npool/source/localedata/data/fy_NL.xml +++ b/i18npool/source/localedata/data/fy_NL.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/gsc_FR.xml b/i18npool/source/localedata/data/gsc_FR.xml index 0a13281f9d7b..01242e586e7a 100644 --- a/i18npool/source/localedata/data/gsc_FR.xml +++ b/i18npool/source/localedata/data/gsc_FR.xml @@ -323,9 +323,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> -<Transliteration unoid="LOWERCASE_UPPERCASE"/> -<Transliteration unoid="UPPERCASE_LOWERCASE"/> -<Transliteration unoid="IGNORE_CASE"/> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> @@ -355,4 +358,4 @@ </LC_NumberingLevel> <LC_OutLineNumberingLevel ref="en_US"/> </Locale> -<!--Version 1.0 -->
\ No newline at end of file +<!--Version 1.0 --> diff --git a/i18npool/source/localedata/data/gug_PY.xml b/i18npool/source/localedata/data/gug_PY.xml index c21104c3d13e..60230ae64dac 100644 --- a/i18npool/source/localedata/data/gug_PY.xml +++ b/i18npool/source/localedata/data/gug_PY.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/ha_GH.xml b/i18npool/source/localedata/data/ha_GH.xml index 1794447c0e4d..6d56b80cc580 100644 --- a/i18npool/source/localedata/data/ha_GH.xml +++ b/i18npool/source/localedata/data/ha_GH.xml @@ -334,8 +334,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/hil_PH.xml b/i18npool/source/localedata/data/hil_PH.xml index 6396ff261c90..1bd10219d366 100644 --- a/i18npool/source/localedata/data/hil_PH.xml +++ b/i18npool/source/localedata/data/hil_PH.xml @@ -324,8 +324,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/hr_HR.xml b/i18npool/source/localedata/data/hr_HR.xml index 4c3786539b38..484efdcb9ba0 100644 --- a/i18npool/source/localedata/data/hr_HR.xml +++ b/i18npool/source/localedata/data/hr_HR.xml @@ -318,9 +318,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> -<Transliteration unoid="LOWERCASE_UPPERCASE"/> -<Transliteration unoid="UPPERCASE_LOWERCASE"/> -<Transliteration unoid="IGNORE_CASE"/> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/hy_AM.xml b/i18npool/source/localedata/data/hy_AM.xml index 92913732a090..47c2e35d6e7b 100644 --- a/i18npool/source/localedata/data/hy_AM.xml +++ b/i18npool/source/localedata/data/hy_AM.xml @@ -320,8 +320,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/is_IS.xml b/i18npool/source/localedata/data/is_IS.xml index 7e77c1d2cdad..3b16c6e4bca5 100644 --- a/i18npool/source/localedata/data/is_IS.xml +++ b/i18npool/source/localedata/data/is_IS.xml @@ -314,9 +314,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> - <Transliteration unoid="LOWERCASE_UPPERCASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/ka_GE.xml b/i18npool/source/localedata/data/ka_GE.xml index d0a9a20369e1..ada35b465543 100644 --- a/i18npool/source/localedata/data/ka_GE.xml +++ b/i18npool/source/localedata/data/ka_GE.xml @@ -320,8 +320,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/kk_KZ.xml b/i18npool/source/localedata/data/kk_KZ.xml index e5c8cc95d2fe..a9147655cdec 100644 --- a/i18npool/source/localedata/data/kk_KZ.xml +++ b/i18npool/source/localedata/data/kk_KZ.xml @@ -322,8 +322,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/km_KH.xml b/i18npool/source/localedata/data/km_KH.xml index dff43def273b..bddd0e91791e 100644 --- a/i18npool/source/localedata/data/km_KH.xml +++ b/i18npool/source/localedata/data/km_KH.xml @@ -346,8 +346,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/ko_KR.xml b/i18npool/source/localedata/data/ko_KR.xml index bbd5b0ded2be..3a3fbb0fb9a9 100644 --- a/i18npool/source/localedata/data/ko_KR.xml +++ b/i18npool/source/localedata/data/ko_KR.xml @@ -564,8 +564,11 @@ <Transliteration unoid="IGNORE_WIDTH"/> <Transliteration unoid="FULLWIDTH_HALFWIDTH"/> <Transliteration unoid="HALFWIDTH_FULLWIDTH"/> - <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="NumToTextFormalHangul_ko"/> <Transliteration unoid="NumToTextFormalLower_ko"/> <Transliteration unoid="NumToTextFormalUpper_ko"/> diff --git a/i18npool/source/localedata/data/ku_TR.xml b/i18npool/source/localedata/data/ku_TR.xml index 4af9e2cd28d2..0413353b8486 100644 --- a/i18npool/source/localedata/data/ku_TR.xml +++ b/i18npool/source/localedata/data/ku_TR.xml @@ -330,8 +330,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/lg_UG.xml b/i18npool/source/localedata/data/lg_UG.xml index c6b3b740b10d..5fc78c71cec2 100644 --- a/i18npool/source/localedata/data/lg_UG.xml +++ b/i18npool/source/localedata/data/lg_UG.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> - <Transliteration unoid="LOWERCASE_UPPERCASE" /> - <Transliteration unoid="UPPERCASE_LOWERCASE" /> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE" /> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/ln_CD.xml b/i18npool/source/localedata/data/ln_CD.xml index 602b19fb8fd8..daf7376c9df5 100644 --- a/i18npool/source/localedata/data/ln_CD.xml +++ b/i18npool/source/localedata/data/ln_CD.xml @@ -327,8 +327,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/lt_LT.xml b/i18npool/source/localedata/data/lt_LT.xml index c23f542d6b5d..cd4cb0aca929 100644 --- a/i18npool/source/localedata/data/lt_LT.xml +++ b/i18npool/source/localedata/data/lt_LT.xml @@ -346,9 +346,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> - <Transliteration unoid="LOWERCASE_UPPERCASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/lv_LV.xml b/i18npool/source/localedata/data/lv_LV.xml index 27bb0f13e409..ab76b4930bc6 100644 --- a/i18npool/source/localedata/data/lv_LV.xml +++ b/i18npool/source/localedata/data/lv_LV.xml @@ -325,6 +325,8 @@ </LC_CURRENCY> <LC_TRANSLITERATION> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE" /> </LC_TRANSLITERATION> diff --git a/i18npool/source/localedata/data/mk_MK.xml b/i18npool/source/localedata/data/mk_MK.xml index b9862478513e..10e488e3cac1 100644 --- a/i18npool/source/localedata/data/mk_MK.xml +++ b/i18npool/source/localedata/data/mk_MK.xml @@ -322,8 +322,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/mt_MT.xml b/i18npool/source/localedata/data/mt_MT.xml index 790bd97303e0..bcc5869932b4 100644 --- a/i18npool/source/localedata/data/mt_MT.xml +++ b/i18npool/source/localedata/data/mt_MT.xml @@ -324,8 +324,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/my_MM.xml b/i18npool/source/localedata/data/my_MM.xml index dada8a5402d9..6c12c8986c8f 100644 --- a/i18npool/source/localedata/data/my_MM.xml +++ b/i18npool/source/localedata/data/my_MM.xml @@ -395,8 +395,11 @@ </LC_CURRENCY> <LC_TRANSLITERATION> <!-- There is often English mixed with Myanmar, so leave these in for now --> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/ne_NP.xml b/i18npool/source/localedata/data/ne_NP.xml index cca8be996a70..558027ac0e1c 100644 --- a/i18npool/source/localedata/data/ne_NP.xml +++ b/i18npool/source/localedata/data/ne_NP.xml @@ -322,8 +322,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/oc_FR.xml b/i18npool/source/localedata/data/oc_FR.xml index ef3dd47c0dc6..c64fe872c6e8 100644 --- a/i18npool/source/localedata/data/oc_FR.xml +++ b/i18npool/source/localedata/data/oc_FR.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/or_IN.xml b/i18npool/source/localedata/data/or_IN.xml index 168b542f1894..22333451f6ea 100644 --- a/i18npool/source/localedata/data/or_IN.xml +++ b/i18npool/source/localedata/data/or_IN.xml @@ -322,8 +322,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/sg_CF.xml b/i18npool/source/localedata/data/sg_CF.xml index 075b1a43ae18..61ee40b8081e 100644 --- a/i18npool/source/localedata/data/sg_CF.xml +++ b/i18npool/source/localedata/data/sg_CF.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/sh_RS.xml b/i18npool/source/localedata/data/sh_RS.xml index 4b744bdd5913..01faa188c9e2 100644 --- a/i18npool/source/localedata/data/sh_RS.xml +++ b/i18npool/source/localedata/data/sh_RS.xml @@ -211,8 +211,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/shs_CA.xml b/i18npool/source/localedata/data/shs_CA.xml index c7e46fa3453d..cfd01f31ac0d 100644 --- a/i18npool/source/localedata/data/shs_CA.xml +++ b/i18npool/source/localedata/data/shs_CA.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/sk_SK.xml b/i18npool/source/localedata/data/sk_SK.xml index 7820ef290a46..b233f3981284 100644 --- a/i18npool/source/localedata/data/sk_SK.xml +++ b/i18npool/source/localedata/data/sk_SK.xml @@ -369,9 +369,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> - <Transliteration unoid="LOWERCASE_UPPERCASE" /> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/sl_SI.xml b/i18npool/source/localedata/data/sl_SI.xml index b4de5c4a184b..19139d5e0cc0 100644 --- a/i18npool/source/localedata/data/sl_SI.xml +++ b/i18npool/source/localedata/data/sl_SI.xml @@ -331,8 +331,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/so_SO.xml b/i18npool/source/localedata/data/so_SO.xml index 981cb54aff3e..e332e2b07d52 100644 --- a/i18npool/source/localedata/data/so_SO.xml +++ b/i18npool/source/localedata/data/so_SO.xml @@ -330,8 +330,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/sr_RS.xml b/i18npool/source/localedata/data/sr_RS.xml index 4023c2d4afeb..13133333f37e 100644 --- a/i18npool/source/localedata/data/sr_RS.xml +++ b/i18npool/source/localedata/data/sr_RS.xml @@ -350,8 +350,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/sw_TZ.xml b/i18npool/source/localedata/data/sw_TZ.xml index 22bf61807a54..3a92d8eb3593 100644 --- a/i18npool/source/localedata/data/sw_TZ.xml +++ b/i18npool/source/localedata/data/sw_TZ.xml @@ -322,8 +322,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/tk_TM.xml b/i18npool/source/localedata/data/tk_TM.xml index cfd09c63c4ab..c30d1f782811 100644 --- a/i18npool/source/localedata/data/tk_TM.xml +++ b/i18npool/source/localedata/data/tk_TM.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/tpi_PG.xml b/i18npool/source/localedata/data/tpi_PG.xml index 0017a1081233..51cc3500cc57 100644 --- a/i18npool/source/localedata/data/tpi_PG.xml +++ b/i18npool/source/localedata/data/tpi_PG.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/uk_UA.xml b/i18npool/source/localedata/data/uk_UA.xml index 981c24f7c94f..1025096c7a6a 100644 --- a/i18npool/source/localedata/data/uk_UA.xml +++ b/i18npool/source/localedata/data/uk_UA.xml @@ -369,9 +369,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> -<Transliteration unoid="UPPERCASE_LOWERCASE"/> -<Transliteration unoid="IGNORE_CASE"/> -<Transliteration unoid="LOWERCASE_UPPERCASE" /> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/vi_VN.xml b/i18npool/source/localedata/data/vi_VN.xml index 4b9bfb266051..93fc1ee3adc4 100644 --- a/i18npool/source/localedata/data/vi_VN.xml +++ b/i18npool/source/localedata/data/vi_VN.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/zh_CN.xml b/i18npool/source/localedata/data/zh_CN.xml index 0fadbf5d9075..c9d1371cb753 100644 --- a/i18npool/source/localedata/data/zh_CN.xml +++ b/i18npool/source/localedata/data/zh_CN.xml @@ -415,16 +415,19 @@ <!--more currency should be put here --> </LC_CURRENCY> <LC_TRANSLITERATION> -<Transliteration unoid="UPPERCASE_LOWERCASE"/> -<Transliteration unoid="LOWERCASE_UPPERCASE"/> -<Transliteration unoid="HALFWIDTH_FULLWIDTH"/> -<Transliteration unoid="FULLWIDTH_HALFWIDTH"/> -<Transliteration unoid="NumToTextLower_zh_CN"/> -<Transliteration unoid="NumToTextUpper_zh_CN"/> -<Transliteration unoid="NumToCharLower_zh_CN"/> -<Transliteration unoid="NumToCharUpper_zh_CN"/> -<Transliteration unoid="IGNORE_CASE"/> -<Transliteration unoid="IGNORE_WIDTH"/> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="NumToTextLower_zh_CN"/> + <Transliteration unoid="NumToTextUpper_zh_CN"/> + <Transliteration unoid="NumToCharLower_zh_CN"/> + <Transliteration unoid="NumToCharUpper_zh_CN"/> + <Transliteration unoid="HALFWIDTH_FULLWIDTH"/> + <Transliteration unoid="FULLWIDTH_HALFWIDTH"/> + <Transliteration unoid="IGNORE_CASE"/> + <Transliteration unoid="IGNORE_WIDTH"/> </LC_TRANSLITERATION> <LC_MISC> <ForbiddenCharacters> diff --git a/i18npool/source/localedata/data/zh_TW.xml b/i18npool/source/localedata/data/zh_TW.xml index 1d1e476b7771..aa53647057f8 100644 --- a/i18npool/source/localedata/data/zh_TW.xml +++ b/i18npool/source/localedata/data/zh_TW.xml @@ -343,17 +343,20 @@ <!--more currency should be put here --> </LC_CURRENCY> <LC_TRANSLITERATION> -<Transliteration unoid="NumToTextLower_zh_TW" /> -<Transliteration unoid="NumToTextUpper_zh_TW" /> -<Transliteration unoid="NumToCharLower_zh_TW" /> -<Transliteration unoid="NumToCharUpper_zh_TW" /> -<Transliteration unoid="TextToChuyin_zh_TW" /> -<Transliteration unoid="IGNORE_CASE" /> -<Transliteration unoid="UPPERCASE_LOWERCASE" /> -<Transliteration unoid="LOWERCASE_UPPERCASE" /> -<Transliteration unoid="IGNORE_WIDTH" /> -<Transliteration unoid="HALFWIDTH_FULLWIDTH"/> -<Transliteration unoid="HALFWIDTH_FULLWIDTH"/> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="NumToTextLower_zh_TW" /> + <Transliteration unoid="NumToTextUpper_zh_TW" /> + <Transliteration unoid="NumToCharLower_zh_TW" /> + <Transliteration unoid="NumToCharUpper_zh_TW" /> + <Transliteration unoid="TextToChuyin_zh_TW" /> + <Transliteration unoid="HALFWIDTH_FULLWIDTH"/> + <Transliteration unoid="FULLWIDTH_HALFWIDTH"/> + <Transliteration unoid="IGNORE_CASE" /> + <Transliteration unoid="IGNORE_WIDTH" /> </LC_TRANSLITERATION> <LC_MISC> <ForbiddenCharacters> diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 2274aa5b714d..280e12dfe4f7 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -170,6 +170,9 @@ IMPL_CREATEINSTANCE_MSF( TextConversion_zh ) IMPL_CREATEINSTANCE( Transliteration_u2l ) IMPL_CREATEINSTANCE( Transliteration_l2u ) +IMPL_CREATEINSTANCE( Transliteration_sentencecase ) +IMPL_CREATEINSTANCE( Transliteration_titlecase ) +IMPL_CREATEINSTANCE( Transliteration_togglecase ) IMPL_CREATEINSTANCE( Transliteration_caseignore ) IMPL_CREATEINSTANCE( hiraganaToKatakana ) IMPL_CREATEINSTANCE( katakanaToHiragana ) @@ -421,6 +424,15 @@ static const struct InstancesArray { TRLT_IMPLNAME_PREFIX "LOWERCASE_UPPERCASE", &Transliteration_l2u_CreateInstance }, { TRLT_SERVICELNAME_L10N, + TRLT_IMPLNAME_PREFIX "SENTENCE_CASE", + &Transliteration_sentencecase_CreateInstance }, + { TRLT_SERVICELNAME_L10N, + TRLT_IMPLNAME_PREFIX "TITLE_CASE", + &Transliteration_titlecase_CreateInstance }, + { TRLT_SERVICELNAME_L10N, + TRLT_IMPLNAME_PREFIX "TOGGLE_CASE", + &Transliteration_togglecase_CreateInstance }, + { TRLT_SERVICELNAME_L10N, TRLT_IMPLNAME_PREFIX "IGNORE_CASE", &Transliteration_caseignore_CreateInstance }, { TRLT_SERVICELNAME_L10N, diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index a869f6713b99..b58347826470 100644..100755 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -28,7 +28,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_i18npool.hxx" +#include <rtl/ustrbuf.hxx> #include <i18nutil/casefolding.hxx> +#include <i18nutil/unicode.hxx> + +#include <comphelper/processfactory.hxx> +#include <osl/diagnose.h> + + +#include "characterclassificationImpl.hxx" +#include "breakiteratorImpl.hxx" + #define TRANSLITERATION_ALL #include "transliteration_body.hxx" @@ -36,8 +46,11 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::rtl; +#define A2OU(x) OUString::createFromAscii(x) + namespace com { namespace sun { namespace star { namespace i18n { + Transliteration_body::Transliteration_body() { nMappingType = 0; @@ -68,9 +81,35 @@ Transliteration_body::transliterateRange( const OUString& str1, const OUString& return ostr; } + +static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Unicode cChar ) +{ + sal_uInt8 nRes = nMappingType; + + // take care of TOGGLE_CASE transliteration: + // nMappingType should not be a combination of flags, thuse we decide now + // which one to use. + if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) + { + const sal_Int16 nType = unicode::getUnicodeType( cChar ); + if (nType & 0x02 /* lower case*/) + nRes = MappingTypeLowerToUpper; + else + { + OSL_ENSURE( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); + nRes = MappingTypeUpperToLower; + } + } + + return nRes; +} + + OUString SAL_CALL -Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset) throw(RuntimeException) +Transliteration_body::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset) + throw(RuntimeException) { #if 0 /* Performance optimization: @@ -139,7 +178,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nOffCount = 0, i; for (i = 0; i < nCount; i++) { - const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType); + // take care of TOGGLE_CASE transliteration: + sal_uInt8 nTmpMappingType = nMappingType; + if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) + nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] ); + + const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType ); nOffCount += map.nmap; } rtl_uString* pStr = x_rtl_uString_new_WithLength( nOffCount, 1 ); // our x_rtl_ustring.h @@ -152,7 +196,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 * pArr = offset.getArray(); for (i = 0; i < nCount; i++) { - const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType); + // take care of TOGGLE_CASE transliteration: + sal_uInt8 nTmpMappingType = nMappingType; + if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) + nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] ); + + const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType ); for (sal_Int32 k = 0; k < map.nmap; k++) { pArr[j] = i + startPos; @@ -184,7 +233,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 j = 0; for ( sal_Int32 i = 0; i < nCount; i++) { - const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType); + // take care of TOGGLE_CASE transliteration: + sal_uInt8 nTmpMappingType = nMappingType; + if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) + nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] ); + + const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType ); for (sal_Int32 k = 0; k < map.nmap; k++) { out[j++] = map.map[k]; @@ -258,4 +312,203 @@ Transliteration_l2u::Transliteration_l2u() implementationName = "com.sun.star.i18n.Transliteration.Transliteration_l2u"; } +Transliteration_togglecase::Transliteration_togglecase() +{ + // usually nMappingType must NOT be a combiantion of different flages here, + // but we take care of that problem in Transliteration_body::transliterate above + // before that value is used. There we will decide which of both is to be used on + // a per character basis. + nMappingType = MappingTypeLowerToUpper | MappingTypeUpperToLower; + transliterationName = "toggle(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_togglecase"; +} + +Transliteration_titlecase::Transliteration_titlecase() +{ + nMappingType = MappingTypeToTitle; + transliterationName = "title(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase"; +} + +rtl::OUString SAL_CALL Transliteration_titlecase::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& /*offset*/ ) + throw(RuntimeException) +{ + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + CharacterClassificationImpl aCharClassImpl( xMSF ); + + // possible problem: the locale is not exactly specific for each word in the text... + OUString aRes( aCharClassImpl.toTitle( inStr, startPos, nCount, aLocale ) ); + return aRes; +} + +Transliteration_sentencecase::Transliteration_sentencecase() +{ + nMappingType = MappingTypeToTitle; // though only to be applied to the first word... + transliterationName = "sentence(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_sentencecase"; +} + +rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset ) + throw(RuntimeException) +{ + // inspired from Transliteration_body::transliterate + sal_Int32 nOffCount = 0, i; + bool bPoint = true; + if (useOffset) + { + for( i = 0; i < nCount; ++i ) { + sal_Unicode c = inStr.getStr()[ i + startPos ]; + if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { + bPoint = true; + nOffCount++; + } + else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) + { + const Mapping* map = 0; + if( bPoint && unicode::isLower( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); + bPoint = false; + } + else if (!bPoint && unicode::isUpper( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower); + } + + if(map == 0) + { + nOffCount++; + } + else + { + nOffCount += map->nmap; + } + } + else + { + nOffCount++; + } + } + } + + bPoint = true; + rtl::OUStringBuffer result; + + if (useOffset) + { + result.ensureCapacity(nOffCount); + if ( nOffCount != offset.getLength() ) + offset.realloc( nOffCount ); + } + + + sal_Int32 j = 0; + sal_Int32 * pArr = offset.getArray(); + for( i = 0; i < nCount; ++i ) { + sal_Unicode c = inStr.getStr()[ i + startPos ]; + if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { + bPoint = true; + result.append(c); + pArr[j++] = i + startPos; + } + else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) + { + const Mapping* map = 0; + if( bPoint && unicode::isLower( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); + } + else if (!bPoint && unicode::isUpper( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower); + } + + if(map == 0) + { + result.append( c ); + pArr[j++] = i + startPos; + } + else + { + for (sal_Int32 k = 0; k < map->nmap; k++) + { + result.append( map->map[k] ); + pArr[j++] = i + startPos; + } + } + bPoint = false; + } + else + { + result.append( c ); + pArr[j++] = i + startPos; + } + } + return result.makeStringAndClear(); +} + +#if 0 +// TL: alternative implemntation try. But breakiterator has its problem too since +// beginOfSentence does not work as expected with '.'. See comment below. +// For the time being I will leave this code here as a from-scratch sample if the +// breakiterator works better at some point... +rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( + const OUString& inStr, sal_Int32 nStartPos, sal_Int32 nCount, + Sequence< sal_Int32 >& /*offset*/ ) + throw(RuntimeException) +{ + OUString aRes( inStr.copy( nStartPos, nCount ) ); + + if (nStartPos >= 0 && nStartPos < inStr.getLength() && nCount > 0) + { + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + BreakIteratorImpl brk( xMSF ); + + sal_Int32 nSentenceStart = -1, nOldSentenceStart = -1; + sal_Int32 nPos = nStartPos + nCount - 1; + while (nPos >= nStartPos && nPos != -1) + { + // possible problem: the locale is not exactly specific for each sentence in the text, + // but it is the only one we have... + nOldSentenceStart = nSentenceStart; + nSentenceStart = brk.beginOfSentence( inStr, nPos, aLocale ); + + // since the breakiterator completely ignores '.' characvters as end-of-sentence when + // the next word is lower case we need to take care of that ourself. The drawback: + // la mid-sentence abbreviation like e.g. will now be identified as end-of-sentence. :-( + // Well, at least the other product does it in the same way... + sal_Int32 nFullStopPos = inStr.lastIndexOf( (sal_Unicode)'.', nPos ); + nPos = nSentenceStart; + if (nFullStopPos > 0 && nFullStopPos > nSentenceStart) + { + Boundary aBd2 = brk.nextWord( inStr, nFullStopPos, aLocale, WordType::DICTIONARY_WORD ); + nSentenceStart = aBd2.startPos; + nPos = nFullStopPos; + } + + if (nSentenceStart < nOldSentenceStart || nOldSentenceStart == -1) + { + // the sentence start might be a quotation mark or some kind of bracket, thus + // we need the first dictionary word starting or following this position + // Boundary aBd1 = brk.nextWord( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD ); + Boundary aBd2 = brk.getWordBoundary( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD, true ); + // OUString aWord1( inStr.copy( aBd1.startPos, aBd1.endPos - aBd1.startPos + 1 ) ); + OUString aWord2( inStr.copy( aBd2.startPos, aBd2.endPos - aBd2.startPos + 1 ) ); + } + else + break; // prevent endless loop + + // continue with previous sentence + if (nPos != -1) + --nPos; + } + } + return aRes; +} +#endif + } } } } diff --git a/i18npool/util/makefile.mk b/i18npool/util/makefile.mk index d9b87d19e6ca..57f802be62fe 100644 --- a/i18npool/util/makefile.mk +++ b/i18npool/util/makefile.mk @@ -68,6 +68,7 @@ SHL1LIBS=$(LIB1TARGET) SHL1STDLIBS= \ $(I18NUTILLIB) \ $(I18NISOLANGLIB) \ + $(COMPHELPERLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(SALLIB) \ |