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