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