1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 // prevent internal compiler error with MSVC6SP3
24 #include <i18nutil/widthfolding.hxx>
25 #define TRANSLITERATION_halfwidthToFullwidth
26 #define TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana
27 #define TRANSLITERATION_halfwidthToFullwidthLikeJIS
28 #include <transliteration_OneToOne.hxx>
30 using namespace com::sun::star::uno
;
31 using namespace com::sun::star::lang
;
34 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
36 halfwidthToFullwidth::halfwidthToFullwidth()
39 table
= &widthfolding::gethalf2fullTable();
40 transliterationName
= "halfwidthToFullwidth";
41 implementationName
= "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH";
45 halfwidthToFullwidth::transliterate( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, Sequence
< sal_Int32
>& offset
)
46 throw(RuntimeException
)
48 sal_Bool _useOffset
= useOffset
;
50 useOffset
= sal_False
;
51 const OUString
& newStr
= transliteration_OneToOne::transliterate( inStr
, startPos
, nCount
, offset
);
52 useOffset
= _useOffset
;
54 // Composition: KA + voice-mark --> GA
55 return widthfolding::compose_ja_voiced_sound_marks ( newStr
, 0, newStr
.getLength(), offset
, _useOffset
);
59 halfwidthToFullwidth::transliterateChar2Char( sal_Unicode inChar
)
60 throw(RuntimeException
, MultipleCharsOutputException
)
62 return transliteration_OneToOne::transliterateChar2Char(inChar
);
66 halfwidthKatakanaToFullwidthKatakana::halfwidthKatakanaToFullwidthKatakana()
69 table
= &widthfolding::gethalfKana2fullKanaTable();
70 transliterationName
= "halfwidthKatakanaToFullwidthKatakana";
71 implementationName
= "com.sun.star.i18n.Transliteration.HALFWIDTHKATAKANA_FULLWIDTHKATAKANA";
75 halfwidthKatakanaToFullwidthKatakana::transliterate( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, Sequence
< sal_Int32
>& offset
)
76 throw(RuntimeException
)
78 sal_Bool _useOffset
= useOffset
;
80 useOffset
= sal_False
;
81 const OUString
& newStr
= transliteration_OneToOne::transliterate( inStr
, startPos
, nCount
, offset
);
82 useOffset
= _useOffset
;
84 // Composition: KA + voice-mark --> GA
85 return widthfolding::compose_ja_voiced_sound_marks ( newStr
, 0, newStr
.getLength(), offset
, _useOffset
);
89 halfwidthKatakanaToFullwidthKatakana::transliterateChar2Char( sal_Unicode inChar
)
90 throw(RuntimeException
, MultipleCharsOutputException
)
92 return transliteration_OneToOne::transliterateChar2Char(inChar
);
96 halfwidthToFullwidthLikeJIS::halfwidthToFullwidthLikeJIS()
99 table
= &widthfolding::gethalf2fullTableForJIS();
100 transliterationName
= "halfwidthToFullwidthLikeJIS";
101 implementationName
= "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH_LIKE_JIS";
105 halfwidthToFullwidthLikeJIS::transliterate( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, Sequence
< sal_Int32
>& offset
)
106 throw(RuntimeException
)
108 sal_Bool _useOffset
= useOffset
;
109 // One to One mapping
110 useOffset
= sal_False
;
111 const OUString
& newStr
= transliteration_OneToOne::transliterate( inStr
, startPos
, nCount
, offset
);
112 useOffset
= _useOffset
;
114 // Composition: KA + voice-mark --> GA
115 return widthfolding::compose_ja_voiced_sound_marks ( newStr
, 0, newStr
.getLength(), offset
, _useOffset
, WIDTHFOLDNIG_DONT_USE_COMBINED_VU
);
119 halfwidthToFullwidthLikeJIS::transliterateChar2Char( sal_Unicode inChar
)
120 throw(RuntimeException
, MultipleCharsOutputException
)
122 return transliteration_OneToOne::transliterateChar2Char(inChar
);
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */