Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : // prevent internal compiler error with MSVC6SP3
22 : #include <utility>
23 :
24 : #include <i18nutil/widthfolding.hxx>
25 : #define TRANSLITERATION_halfwidthToFullwidth
26 : #define TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana
27 : #define TRANSLITERATION_halfwidthToFullwidthLikeJIS
28 : #include <transliteration_OneToOne.hxx>
29 :
30 : using namespace com::sun::star::uno;
31 : using namespace com::sun::star::lang;
32 :
33 : using ::rtl::OUString;
34 :
35 : namespace com { namespace sun { namespace star { namespace i18n {
36 :
37 0 : halfwidthToFullwidth::halfwidthToFullwidth()
38 : {
39 0 : func = (TransFunc) 0;
40 0 : table = &widthfolding::gethalf2fullTable();
41 0 : transliterationName = "halfwidthToFullwidth";
42 0 : implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH";
43 0 : }
44 :
45 : OUString SAL_CALL
46 0 : halfwidthToFullwidth::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
47 : throw(RuntimeException)
48 : {
49 0 : sal_Bool _useOffset = useOffset;
50 : // One to One mapping
51 0 : useOffset = sal_False;
52 0 : const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
53 0 : useOffset = _useOffset;
54 :
55 : // Composition: KA + voice-mark --> GA
56 0 : return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset );
57 : }
58 :
59 : sal_Unicode SAL_CALL
60 0 : halfwidthToFullwidth::transliterateChar2Char( sal_Unicode inChar)
61 : throw(RuntimeException, MultipleCharsOutputException)
62 : {
63 0 : return transliteration_OneToOne::transliterateChar2Char(inChar);
64 : }
65 :
66 :
67 0 : halfwidthKatakanaToFullwidthKatakana::halfwidthKatakanaToFullwidthKatakana()
68 : {
69 0 : func = (TransFunc) 0;
70 0 : table = &widthfolding::gethalfKana2fullKanaTable();
71 0 : transliterationName = "halfwidthKatakanaToFullwidthKatakana";
72 0 : implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTHKATAKANA_FULLWIDTHKATAKANA";
73 0 : }
74 :
75 : OUString SAL_CALL
76 0 : halfwidthKatakanaToFullwidthKatakana::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
77 : throw(RuntimeException)
78 : {
79 0 : sal_Bool _useOffset = useOffset;
80 : // One to One mapping
81 0 : useOffset = sal_False;
82 0 : const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
83 0 : useOffset = _useOffset;
84 :
85 : // Composition: KA + voice-mark --> GA
86 0 : return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset );
87 : }
88 :
89 : sal_Unicode SAL_CALL
90 0 : halfwidthKatakanaToFullwidthKatakana::transliterateChar2Char( sal_Unicode inChar)
91 : throw(RuntimeException, MultipleCharsOutputException)
92 : {
93 0 : return transliteration_OneToOne::transliterateChar2Char(inChar);
94 : }
95 :
96 :
97 0 : halfwidthToFullwidthLikeJIS::halfwidthToFullwidthLikeJIS()
98 : {
99 0 : func = (TransFunc) 0;
100 0 : table = &widthfolding::gethalf2fullTableForJIS();
101 0 : transliterationName = "halfwidthToFullwidthLikeJIS";
102 0 : implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH_LIKE_JIS";
103 0 : }
104 :
105 : OUString SAL_CALL
106 0 : halfwidthToFullwidthLikeJIS::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
107 : throw(RuntimeException)
108 : {
109 0 : sal_Bool _useOffset = useOffset;
110 : // One to One mapping
111 0 : useOffset = sal_False;
112 0 : const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
113 0 : useOffset = _useOffset;
114 :
115 : // Composition: KA + voice-mark --> GA
116 0 : 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
120 0 : halfwidthToFullwidthLikeJIS::transliterateChar2Char( sal_Unicode inChar)
121 : throw(RuntimeException, MultipleCharsOutputException)
122 : {
123 0 : return transliteration_OneToOne::transliterateChar2Char(inChar);
124 : }
125 :
126 : } } } }
127 :
128 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|