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 .
20 #include <i18nutil/widthfolding.hxx>
22 #include <transliteration_OneToOne.hxx>
24 using namespace com::sun::star::uno
;
25 using namespace com::sun::star::lang
;
28 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
30 halfwidthToFullwidth::halfwidthToFullwidth()
33 table
= &widthfolding::gethalf2fullTable();
34 transliterationName
= "halfwidthToFullwidth";
35 implementationName
= "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH";
39 halfwidthToFullwidth::transliterate( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, Sequence
< sal_Int32
>& offset
)
40 throw(RuntimeException
, std::exception
)
42 bool _useOffset
= useOffset
;
45 const OUString
& newStr
= transliteration_OneToOne::transliterate( inStr
, startPos
, nCount
, offset
);
46 useOffset
= _useOffset
;
48 // Composition: KA + voice-mark --> GA
49 return widthfolding::compose_ja_voiced_sound_marks ( newStr
, 0, newStr
.getLength(), offset
, _useOffset
);
53 halfwidthToFullwidth::transliterateChar2Char( sal_Unicode inChar
)
54 throw(RuntimeException
, MultipleCharsOutputException
, std::exception
)
56 return transliteration_OneToOne::transliterateChar2Char(inChar
);
60 halfwidthKatakanaToFullwidthKatakana::halfwidthKatakanaToFullwidthKatakana()
63 table
= &widthfolding::gethalfKana2fullKanaTable();
64 transliterationName
= "halfwidthKatakanaToFullwidthKatakana";
65 implementationName
= "com.sun.star.i18n.Transliteration.HALFWIDTHKATAKANA_FULLWIDTHKATAKANA";
69 halfwidthKatakanaToFullwidthKatakana::transliterate( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, Sequence
< sal_Int32
>& offset
)
70 throw(RuntimeException
, std::exception
)
72 bool _useOffset
= useOffset
;
75 const OUString
& newStr
= transliteration_OneToOne::transliterate( inStr
, startPos
, nCount
, offset
);
76 useOffset
= _useOffset
;
78 // Composition: KA + voice-mark --> GA
79 return widthfolding::compose_ja_voiced_sound_marks ( newStr
, 0, newStr
.getLength(), offset
, _useOffset
);
83 halfwidthKatakanaToFullwidthKatakana::transliterateChar2Char( sal_Unicode inChar
)
84 throw(RuntimeException
, MultipleCharsOutputException
, std::exception
)
86 return transliteration_OneToOne::transliterateChar2Char(inChar
);
90 halfwidthToFullwidthLikeJIS::halfwidthToFullwidthLikeJIS()
93 table
= &widthfolding::gethalf2fullTableForJIS();
94 transliterationName
= "halfwidthToFullwidthLikeJIS";
95 implementationName
= "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH_LIKE_JIS";
99 halfwidthToFullwidthLikeJIS::transliterate( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, Sequence
< sal_Int32
>& offset
)
100 throw(RuntimeException
, std::exception
)
102 bool _useOffset
= useOffset
;
103 // One to One mapping
105 const OUString
& newStr
= transliteration_OneToOne::transliterate( inStr
, startPos
, nCount
, offset
);
106 useOffset
= _useOffset
;
108 // Composition: KA + voice-mark --> GA
109 return widthfolding::compose_ja_voiced_sound_marks ( newStr
, 0, newStr
.getLength(), offset
, _useOffset
, WIDTHFOLDNIG_DONT_USE_COMBINED_VU
);
113 halfwidthToFullwidthLikeJIS::transliterateChar2Char( sal_Unicode inChar
)
114 throw(RuntimeException
, MultipleCharsOutputException
, std::exception
)
116 return transliteration_OneToOne::transliterateChar2Char(inChar
);
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */