From 6485417ddb43981ebc67ed22c0b585a8841ae1ab Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 17 Sep 2009 07:31:47 +0000 Subject: #i1601# Sentence case, Title case, and Toggle case transliteration added --- i18npool/source/localedata/data/ak_GH.xml | 3 + i18npool/source/localedata/data/bs_BA.xml | 9 +- i18npool/source/localedata/data/ee_GH.xml | 3 + i18npool/source/localedata/data/en_GH.xml | 6 +- i18npool/source/localedata/data/en_US.xml | 3 + i18npool/source/localedata/data/eo.xml | 3 + i18npool/source/localedata/data/eu.xml | 5 +- i18npool/source/localedata/data/fur_IT.xml | 3 + i18npool/source/localedata/data/fy_NL.xml | 3 + i18npool/source/localedata/data/gsc_FR.xml | 11 +- i18npool/source/localedata/data/gug_PY.xml | 3 + i18npool/source/localedata/data/ha_GH.xml | 3 + i18npool/source/localedata/data/hil_PH.xml | 3 + i18npool/source/localedata/data/hr_HR.xml | 9 +- i18npool/source/localedata/data/hy_AM.xml | 3 + i18npool/source/localedata/data/is_IS.xml | 5 +- i18npool/source/localedata/data/ka_GE.xml | 3 + i18npool/source/localedata/data/kk_KZ.xml | 3 + i18npool/source/localedata/data/km_KH.xml | 3 + i18npool/source/localedata/data/ko_KR.xml | 5 +- i18npool/source/localedata/data/ku_TR.xml | 3 + i18npool/source/localedata/data/lg_UG.xml | 7 +- i18npool/source/localedata/data/ln_CD.xml | 3 + i18npool/source/localedata/data/lt_LT.xml | 5 +- i18npool/source/localedata/data/lv_LV.xml | 9 +- i18npool/source/localedata/data/mk_MK.xml | 3 + i18npool/source/localedata/data/mt_MT.xml | 3 + i18npool/source/localedata/data/my_MM.xml | 3 + i18npool/source/localedata/data/ne_NP.xml | 3 + i18npool/source/localedata/data/oc_FR.xml | 3 + i18npool/source/localedata/data/or_IN.xml | 3 + i18npool/source/localedata/data/sg_CF.xml | 3 + i18npool/source/localedata/data/sh_RS.xml | 3 + i18npool/source/localedata/data/shs_CA.xml | 3 + i18npool/source/localedata/data/sk_SK.xml | 5 +- i18npool/source/localedata/data/sl_SI.xml | 3 + i18npool/source/localedata/data/so_SO.xml | 3 + i18npool/source/localedata/data/sr_RS.xml | 3 + i18npool/source/localedata/data/sw_TZ.xml | 3 + i18npool/source/localedata/data/tk_TM.xml | 3 + i18npool/source/localedata/data/tpi_PG.xml | 3 + i18npool/source/localedata/data/uk_UA.xml | 9 +- i18npool/source/localedata/data/vi_VN.xml | 3 + i18npool/source/localedata/data/zh_CN.xml | 23 +-- i18npool/source/localedata/data/zh_TW.xml | 25 +-- .../source/registerservices/registerservices.cxx | 13 ++ i18npool/source/transliteration/makefile.mk | 1 + .../transliteration/transliteration_body.cxx | 15 ++ .../transliteration_sentencecase.cxx | 190 +++++++++++++++++++++ 49 files changed, 396 insertions(+), 49 deletions(-) create mode 100644 i18npool/source/transliteration/transliteration_sentencecase.cxx (limited to 'i18npool/source') 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 @@ + + + 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 @@ - - - + + + + + + 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 @@ + + + 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 @@ 2 - - - - - + True 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 @@ + + + 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 @@ + + + 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 @@ + + + + - 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 @@ + + + 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 @@ + + + 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 @@ - - - + + + + + + @@ -355,4 +358,4 @@ - \ No newline at end of file + 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 @@ + + + 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 @@ + + + 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 @@ + + + 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 @@ - - - + + + + + + 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 @@ + + + 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 @@ + + + + - 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 @@ + + + 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 @@ + + + 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 @@ + + + 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 @@ - + + + + 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 @@ + + + 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 @@ - - + + + + + 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 @@ + + + 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 @@ + + + + - diff --git a/i18npool/source/localedata/data/lv_LV.xml b/i18npool/source/localedata/data/lv_LV.xml index e29a06eaf274..884980762a0e 100644 --- a/i18npool/source/localedata/data/lv_LV.xml +++ b/i18npool/source/localedata/data/lv_LV.xml @@ -371,9 +371,12 @@ - - - + + + + + + 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 @@ + + + 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 @@ + + + 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 @@ + + + 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 @@ + + + diff --git a/i18npool/source/localedata/data/oc_FR.xml b/i18npool/source/localedata/data/oc_FR.xml index 236f1c8dbb09..bb7e7ef02da1 100644 --- a/i18npool/source/localedata/data/oc_FR.xml +++ b/i18npool/source/localedata/data/oc_FR.xml @@ -323,8 +323,11 @@ + + + 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 @@ + + + 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 @@ + + + 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 @@ + + + diff --git a/i18npool/source/localedata/data/shs_CA.xml b/i18npool/source/localedata/data/shs_CA.xml index 4060d002bbe2..505771c81eda 100644 --- a/i18npool/source/localedata/data/shs_CA.xml +++ b/i18npool/source/localedata/data/shs_CA.xml @@ -323,8 +323,11 @@ + + + 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 @@ + + + + - 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 @@ + + + diff --git a/i18npool/source/localedata/data/so_SO.xml b/i18npool/source/localedata/data/so_SO.xml index f5d666ec7e5a..4b8fb2e266ff 100644 --- a/i18npool/source/localedata/data/so_SO.xml +++ b/i18npool/source/localedata/data/so_SO.xml @@ -323,8 +323,11 @@ + + + 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 @@ + + + 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 @@ + + + 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 @@ + + + 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 @@ + + + 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 @@ - - - + + + + + + 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 @@ + + + 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 @@ - - - - - - - - - - + + + + + + + + + + + + + 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 @@ - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 870c49939648..697d3594e8d8 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -173,6 +174,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 ) @@ -422,6 +426,15 @@ static const struct InstancesArray { { TRLT_SERVICELNAME_L10N, 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 }, diff --git a/i18npool/source/transliteration/makefile.mk b/i18npool/source/transliteration/makefile.mk index daf3068d4d20..5ad615c64dbe 100644 --- a/i18npool/source/transliteration/makefile.mk +++ b/i18npool/source/transliteration/makefile.mk @@ -50,6 +50,7 @@ SLOFILES= \ $(SLO)$/transliteration_OneToOne.obj \ $(SLO)$/transliteration_Ignore.obj \ $(SLO)$/transliteration_Numeric.obj \ + $(SLO)$/transliteration_sentencecase.obj \ $(SLO)$/hiraganaToKatakana.obj \ $(SLO)$/katakanaToHiragana.obj \ $(SLO)$/ignoreKana.obj \ diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index 0bea721a0c9d..d75eede13bf9 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -261,4 +261,19 @@ Transliteration_l2u::Transliteration_l2u() implementationName = "com.sun.star.i18n.Transliteration.Transliteration_l2u"; } +Transliteration_titlecase::Transliteration_titlecase() +{ + nMappingType = MappingTypeToTitle; + transliterationName = "title(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase"; +} + +Transliteration_togglecase::Transliteration_togglecase() +{ + nMappingType = MappingTypeLowerToUpper | MappingTypeUpperToLower; + transliterationName = "toggle(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_togglecase"; +} + + } } } } diff --git a/i18npool/source/transliteration/transliteration_sentencecase.cxx b/i18npool/source/transliteration/transliteration_sentencecase.cxx new file mode 100644 index 000000000000..35f9a69abb4d --- /dev/null +++ b/i18npool/source/transliteration/transliteration_sentencecase.cxx @@ -0,0 +1,190 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: halfwidthToFullwidth.cxx,v $ + * $Revision: 1.12 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_i18npool.hxx" + +// prevent internal compiler error with MSVC6SP3 +#include + +#include +#include +#define TRANSLITERATION_sentencecase +#include +#include +#include +#include +#include +#include + +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace rtl; + +namespace com { namespace sun { namespace star { namespace i18n { + + +Transliteration_sentencecase::Transliteration_sentencecase() +{ + transliterationName = "sentenceCase"; + implementationName = "com.sun.star.i18n.Transliteration.SENTENCE_CASE"; +} + +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; + + 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); + } + bPoint = false; + + 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; + } + } + } + else + { + result.append( c ); + pArr[j++] = i + startPos; + } + } + return result.makeStringAndClear(); +} + +sal_Unicode SAL_CALL +Transliteration_sentencecase::transliterateChar2Char( sal_Unicode inChar) + throw(RuntimeException, MultipleCharsOutputException) +{ + return inChar; +} + +sal_Int16 SAL_CALL Transliteration_sentencecase::getType() throw(RuntimeException) +{ + return TransliterationType::IGNORE; +} + +OUString SAL_CALL +Transliteration_sentencecase::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset) throw(RuntimeException) +{ + return this->transliterate(inStr, startPos, nCount, offset); +} + +sal_Bool SAL_CALL Transliteration_sentencecase::equals( + const OUString& /*str1*/, sal_Int32 /*pos1*/, sal_Int32 /*nCount1*/, sal_Int32& /*nMatch1*/, + const OUString& /*str2*/, sal_Int32 /*pos2*/, sal_Int32 /*nCount2*/, sal_Int32& /*nMatch2*/) + throw(RuntimeException) +{ + throw RuntimeException(); +} + +Sequence< OUString > SAL_CALL +Transliteration_sentencecase::transliterateRange( const OUString& str1, const OUString& str2 ) + throw( RuntimeException) +{ + Sequence< OUString > ostr(2); + ostr[0] = str1; + ostr[1] = str2; + return ostr; +} + +} } } } + -- cgit From 892a6935027c6817ddf45720109273bb4fd282c6 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 23 Sep 2009 12:29:56 +0000 Subject: #i1601# transliteration for sentence case, title case and toggle case --- .../source/registerservices/registerservices.cxx | 1 - i18npool/source/transliteration/makefile.mk | 1 - .../transliteration/transliteration_body.cxx | 256 ++++++++++++++++++++- .../transliteration_sentencecase.cxx | 190 --------------- 4 files changed, 247 insertions(+), 201 deletions(-) delete mode 100644 i18npool/source/transliteration/transliteration_sentencecase.cxx (limited to 'i18npool/source') diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 697d3594e8d8..642e6b0f5736 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include diff --git a/i18npool/source/transliteration/makefile.mk b/i18npool/source/transliteration/makefile.mk index 5ad615c64dbe..daf3068d4d20 100644 --- a/i18npool/source/transliteration/makefile.mk +++ b/i18npool/source/transliteration/makefile.mk @@ -50,7 +50,6 @@ SLOFILES= \ $(SLO)$/transliteration_OneToOne.obj \ $(SLO)$/transliteration_Ignore.obj \ $(SLO)$/transliteration_Numeric.obj \ - $(SLO)$/transliteration_sentencecase.obj \ $(SLO)$/hiraganaToKatakana.obj \ $(SLO)$/katakanaToHiragana.obj \ $(SLO)$/ignoreKana.obj \ diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index d75eede13bf9..0426f89b604d 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -31,7 +31,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_i18npool.hxx" +#include #include +#include + +#include +#include + + +#include "CharacterClassificationImpl.hxx" +#include "breakiteratorImpl.hxx" + #define TRANSLITERATION_ALL #include "transliteration_body.hxx" @@ -39,8 +49,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; @@ -71,9 +84,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 + { + DBG_ASSERT( 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: @@ -142,7 +181,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 @@ -155,7 +199,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; @@ -187,7 +236,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]; @@ -261,6 +315,17 @@ 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; @@ -268,12 +333,185 @@ Transliteration_titlecase::Transliteration_titlecase() implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase"; } -Transliteration_togglecase::Transliteration_togglecase() +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 = MappingTypeLowerToUpper | MappingTypeUpperToLower; - transliterationName = "toggle(generic)"; - implementationName = "com.sun.star.i18n.Transliteration.Transliteration_togglecase"; + 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/source/transliteration/transliteration_sentencecase.cxx b/i18npool/source/transliteration/transliteration_sentencecase.cxx deleted file mode 100644 index 35f9a69abb4d..000000000000 --- a/i18npool/source/transliteration/transliteration_sentencecase.cxx +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: halfwidthToFullwidth.cxx,v $ - * $Revision: 1.12 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_i18npool.hxx" - -// prevent internal compiler error with MSVC6SP3 -#include - -#include -#include -#define TRANSLITERATION_sentencecase -#include -#include -#include -#include -#include -#include - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace rtl; - -namespace com { namespace sun { namespace star { namespace i18n { - - -Transliteration_sentencecase::Transliteration_sentencecase() -{ - transliterationName = "sentenceCase"; - implementationName = "com.sun.star.i18n.Transliteration.SENTENCE_CASE"; -} - -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; - - 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); - } - bPoint = false; - - 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; - } - } - } - else - { - result.append( c ); - pArr[j++] = i + startPos; - } - } - return result.makeStringAndClear(); -} - -sal_Unicode SAL_CALL -Transliteration_sentencecase::transliterateChar2Char( sal_Unicode inChar) - throw(RuntimeException, MultipleCharsOutputException) -{ - return inChar; -} - -sal_Int16 SAL_CALL Transliteration_sentencecase::getType() throw(RuntimeException) -{ - return TransliterationType::IGNORE; -} - -OUString SAL_CALL -Transliteration_sentencecase::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset) throw(RuntimeException) -{ - return this->transliterate(inStr, startPos, nCount, offset); -} - -sal_Bool SAL_CALL Transliteration_sentencecase::equals( - const OUString& /*str1*/, sal_Int32 /*pos1*/, sal_Int32 /*nCount1*/, sal_Int32& /*nMatch1*/, - const OUString& /*str2*/, sal_Int32 /*pos2*/, sal_Int32 /*nCount2*/, sal_Int32& /*nMatch2*/) - throw(RuntimeException) -{ - throw RuntimeException(); -} - -Sequence< OUString > SAL_CALL -Transliteration_sentencecase::transliterateRange( const OUString& str1, const OUString& str2 ) - throw( RuntimeException) -{ - Sequence< OUString > ostr(2); - ostr[0] = str1; - ostr[1] = str2; - return ostr; -} - -} } } } - -- cgit From b9af4e970fa589f901fb12366e6714054f77cdd2 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 11 Jan 2010 11:29:14 +0100 Subject: cws tl74: case error in include statement fixed --- .../transliteration/transliteration_body.cxx | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'i18npool/source') diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index 0426f89b604d..d041a1d8f915 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -39,7 +39,7 @@ #include -#include "CharacterClassificationImpl.hxx" +#include "characterclassificationImpl.hxx" #include "breakiteratorImpl.hxx" #define TRANSLITERATION_ALL @@ -333,18 +333,18 @@ Transliteration_titlecase::Transliteration_titlecase() implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase"; } -rtl::OUString SAL_CALL Transliteration_titlecase::transliterate( +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; -} +{ + 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() { @@ -459,16 +459,16 @@ rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( // 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( +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(); + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); BreakIteratorImpl brk( xMSF ); sal_Int32 nSentenceStart = -1, nOldSentenceStart = -1; @@ -476,8 +476,8 @@ rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( 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; + // 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 @@ -510,8 +510,8 @@ rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( --nPos; } } - return aRes; -} + return aRes; +} #endif } } } } -- cgit From 594ffd1d561d75217d1bfcb1cb9aeca5cf31c676 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 12 Feb 2010 12:45:29 +0100 Subject: cws tl74: switching from DBG_ASSERT to OSL_ENSURE (don't use 'tools') --- i18npool/source/transliteration/transliteration_body.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'i18npool/source') diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index d041a1d8f915..07ca4a781a25 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -36,7 +36,7 @@ #include #include -#include +#include #include "characterclassificationImpl.hxx" @@ -99,7 +99,7 @@ static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Un nRes = MappingTypeLowerToUpper; else { - DBG_ASSERT( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); + OSL_ENSURE( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); nRes = MappingTypeUpperToLower; } } -- cgit From 64f1d786dd49626cec33d231292ce4ecb28b9c1f Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 12 Feb 2010 15:52:52 +0100 Subject: cws tl74: merge --- i18npool/source/transliteration/transliteration_body.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 i18npool/source/transliteration/transliteration_body.cxx (limited to 'i18npool/source') diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx old mode 100644 new mode 100755 index d041a1d8f915..807a09b65e39 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -36,7 +36,7 @@ #include #include -#include +#include #include "characterclassificationImpl.hxx" @@ -99,7 +99,7 @@ static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Un nRes = MappingTypeLowerToUpper; else { - DBG_ASSERT( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); + OSL_ENSURE( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); nRes = MappingTypeUpperToLower; } } -- cgit