1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_i18npool.hxx" 26 27 // prevent internal compiler error with MSVC6SP3 28 #include <utility> 29 30 #include <i18nutil/widthfolding.hxx> 31 #define TRANSLITERATION_halfwidthToFullwidth 32 #define TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana 33 #define TRANSLITERATION_halfwidthToFullwidthLikeJIS 34 #include <transliteration_OneToOne.hxx> 35 36 using namespace com::sun::star::uno; 37 using namespace com::sun::star::lang; 38 using namespace rtl; 39 40 namespace com { namespace sun { namespace star { namespace i18n { 41 42 halfwidthToFullwidth::halfwidthToFullwidth() 43 { 44 func = (TransFunc) 0; 45 table = &widthfolding::gethalf2fullTable(); 46 transliterationName = "halfwidthToFullwidth"; 47 implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH"; 48 } 49 50 OUString SAL_CALL 51 halfwidthToFullwidth::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) 52 throw(RuntimeException) 53 { 54 sal_Bool _useOffset = useOffset; 55 // One to One mapping 56 useOffset = sal_False; 57 const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset); 58 useOffset = _useOffset; 59 60 // Composition: KA + voice-mark --> GA 61 return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset ); 62 } 63 64 sal_Unicode SAL_CALL 65 halfwidthToFullwidth::transliterateChar2Char( sal_Unicode inChar) 66 throw(RuntimeException, MultipleCharsOutputException) 67 { 68 return transliteration_OneToOne::transliterateChar2Char(inChar); 69 } 70 71 72 halfwidthKatakanaToFullwidthKatakana::halfwidthKatakanaToFullwidthKatakana() 73 { 74 func = (TransFunc) 0; 75 table = &widthfolding::gethalfKana2fullKanaTable(); 76 transliterationName = "halfwidthKatakanaToFullwidthKatakana"; 77 implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTHKATAKANA_FULLWIDTHKATAKANA"; 78 } 79 80 OUString SAL_CALL 81 halfwidthKatakanaToFullwidthKatakana::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) 82 throw(RuntimeException) 83 { 84 sal_Bool _useOffset = useOffset; 85 // One to One mapping 86 useOffset = sal_False; 87 const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset); 88 useOffset = _useOffset; 89 90 // Composition: KA + voice-mark --> GA 91 return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset ); 92 } 93 94 sal_Unicode SAL_CALL 95 halfwidthKatakanaToFullwidthKatakana::transliterateChar2Char( sal_Unicode inChar) 96 throw(RuntimeException, MultipleCharsOutputException) 97 { 98 return transliteration_OneToOne::transliterateChar2Char(inChar); 99 } 100 101 102 halfwidthToFullwidthLikeJIS::halfwidthToFullwidthLikeJIS() 103 { 104 func = (TransFunc) 0; 105 table = &widthfolding::gethalf2fullTableForJIS(); 106 transliterationName = "halfwidthToFullwidthLikeJIS"; 107 implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH_LIKE_JIS"; 108 } 109 110 OUString SAL_CALL 111 halfwidthToFullwidthLikeJIS::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) 112 throw(RuntimeException) 113 { 114 sal_Bool _useOffset = useOffset; 115 // One to One mapping 116 useOffset = sal_False; 117 const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset); 118 useOffset = _useOffset; 119 120 // Composition: KA + voice-mark --> GA 121 return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset, WIDTHFOLDNIG_DONT_USE_COMBINED_VU ); 122 } 123 124 sal_Unicode SAL_CALL 125 halfwidthToFullwidthLikeJIS::transliterateChar2Char( sal_Unicode inChar) 126 throw(RuntimeException, MultipleCharsOutputException) 127 { 128 return transliteration_OneToOne::transliterateChar2Char(inChar); 129 } 130 131 } } } } 132