1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_i18npool.hxx" 30 31 // prevent internal compiler error with MSVC6SP3 32 #include <utility> 33 34 #include <i18nutil/widthfolding.hxx> 35 #define TRANSLITERATION_halfwidthToFullwidth 36 #define TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana 37 #define TRANSLITERATION_halfwidthToFullwidthLikeJIS 38 #include <transliteration_OneToOne.hxx> 39 40 using namespace com::sun::star::uno; 41 using namespace com::sun::star::lang; 42 using namespace rtl; 43 44 namespace com { namespace sun { namespace star { namespace i18n { 45 46 halfwidthToFullwidth::halfwidthToFullwidth() 47 { 48 func = (TransFunc) 0; 49 table = &widthfolding::gethalf2fullTable(); 50 transliterationName = "halfwidthToFullwidth"; 51 implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH"; 52 } 53 54 OUString SAL_CALL 55 halfwidthToFullwidth::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) 56 throw(RuntimeException) 57 { 58 sal_Bool _useOffset = useOffset; 59 // One to One mapping 60 useOffset = sal_False; 61 const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset); 62 useOffset = _useOffset; 63 64 // Composition: KA + voice-mark --> GA 65 return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset ); 66 } 67 68 sal_Unicode SAL_CALL 69 halfwidthToFullwidth::transliterateChar2Char( sal_Unicode inChar) 70 throw(RuntimeException, MultipleCharsOutputException) 71 { 72 return transliteration_OneToOne::transliterateChar2Char(inChar); 73 } 74 75 76 halfwidthKatakanaToFullwidthKatakana::halfwidthKatakanaToFullwidthKatakana() 77 { 78 func = (TransFunc) 0; 79 table = &widthfolding::gethalfKana2fullKanaTable(); 80 transliterationName = "halfwidthKatakanaToFullwidthKatakana"; 81 implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTHKATAKANA_FULLWIDTHKATAKANA"; 82 } 83 84 OUString SAL_CALL 85 halfwidthKatakanaToFullwidthKatakana::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) 86 throw(RuntimeException) 87 { 88 sal_Bool _useOffset = useOffset; 89 // One to One mapping 90 useOffset = sal_False; 91 const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset); 92 useOffset = _useOffset; 93 94 // Composition: KA + voice-mark --> GA 95 return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset ); 96 } 97 98 sal_Unicode SAL_CALL 99 halfwidthKatakanaToFullwidthKatakana::transliterateChar2Char( sal_Unicode inChar) 100 throw(RuntimeException, MultipleCharsOutputException) 101 { 102 return transliteration_OneToOne::transliterateChar2Char(inChar); 103 } 104 105 106 halfwidthToFullwidthLikeJIS::halfwidthToFullwidthLikeJIS() 107 { 108 func = (TransFunc) 0; 109 table = &widthfolding::gethalf2fullTableForJIS(); 110 transliterationName = "halfwidthToFullwidthLikeJIS"; 111 implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH_LIKE_JIS"; 112 } 113 114 OUString SAL_CALL 115 halfwidthToFullwidthLikeJIS::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) 116 throw(RuntimeException) 117 { 118 sal_Bool _useOffset = useOffset; 119 // One to One mapping 120 useOffset = sal_False; 121 const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset); 122 useOffset = _useOffset; 123 124 // Composition: KA + voice-mark --> GA 125 return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset, WIDTHFOLDNIG_DONT_USE_COMBINED_VU ); 126 } 127 128 sal_Unicode SAL_CALL 129 halfwidthToFullwidthLikeJIS::transliterateChar2Char( sal_Unicode inChar) 130 throw(RuntimeException, MultipleCharsOutputException) 131 { 132 return transliteration_OneToOne::transliterateChar2Char(inChar); 133 } 134 135 } } } } 136