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
halfwidthToFullwidth()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
transliterate(const OUString & inStr,sal_Int32 startPos,sal_Int32 nCount,Sequence<sal_Int32> & offset)51 halfwidthToFullwidth::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
52 {
53 sal_Bool _useOffset = useOffset;
54 // One to One mapping
55 useOffset = sal_False;
56 const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
57 useOffset = _useOffset;
58
59 // Composition: KA + voice-mark --> GA
60 return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset );
61 }
62
63 sal_Unicode SAL_CALL
transliterateChar2Char(sal_Unicode inChar)64 halfwidthToFullwidth::transliterateChar2Char( sal_Unicode inChar)
65 {
66 return transliteration_OneToOne::transliterateChar2Char(inChar);
67 }
68
69
halfwidthKatakanaToFullwidthKatakana()70 halfwidthKatakanaToFullwidthKatakana::halfwidthKatakanaToFullwidthKatakana()
71 {
72 func = (TransFunc) 0;
73 table = &widthfolding::gethalfKana2fullKanaTable();
74 transliterationName = "halfwidthKatakanaToFullwidthKatakana";
75 implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTHKATAKANA_FULLWIDTHKATAKANA";
76 }
77
78 OUString SAL_CALL
transliterate(const OUString & inStr,sal_Int32 startPos,sal_Int32 nCount,Sequence<sal_Int32> & offset)79 halfwidthKatakanaToFullwidthKatakana::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
80 {
81 sal_Bool _useOffset = useOffset;
82 // One to One mapping
83 useOffset = sal_False;
84 const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
85 useOffset = _useOffset;
86
87 // Composition: KA + voice-mark --> GA
88 return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset );
89 }
90
91 sal_Unicode SAL_CALL
transliterateChar2Char(sal_Unicode inChar)92 halfwidthKatakanaToFullwidthKatakana::transliterateChar2Char( sal_Unicode inChar)
93 {
94 return transliteration_OneToOne::transliterateChar2Char(inChar);
95 }
96
97
halfwidthToFullwidthLikeJIS()98 halfwidthToFullwidthLikeJIS::halfwidthToFullwidthLikeJIS()
99 {
100 func = (TransFunc) 0;
101 table = &widthfolding::gethalf2fullTableForJIS();
102 transliterationName = "halfwidthToFullwidthLikeJIS";
103 implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH_LIKE_JIS";
104 }
105
106 OUString SAL_CALL
transliterate(const OUString & inStr,sal_Int32 startPos,sal_Int32 nCount,Sequence<sal_Int32> & offset)107 halfwidthToFullwidthLikeJIS::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
108 {
109 sal_Bool _useOffset = useOffset;
110 // One to One mapping
111 useOffset = sal_False;
112 const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
113 useOffset = _useOffset;
114
115 // Composition: KA + voice-mark --> GA
116 return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset, WIDTHFOLDNIG_DONT_USE_COMBINED_VU );
117 }
118
119 sal_Unicode SAL_CALL
transliterateChar2Char(sal_Unicode inChar)120 halfwidthToFullwidthLikeJIS::transliterateChar2Char( sal_Unicode inChar)
121 {
122 return transliteration_OneToOne::transliterateChar2Char(inChar);
123 }
124
125 } } } }
126