1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: halfwidthToFullwidth.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_i18npool.hxx"
34 // prevent internal compiler error with MSVC6SP3
37 #include <i18nutil/widthfolding.hxx>
38 #define TRANSLITERATION_halfwidthToFullwidth
39 #define TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana
40 #define TRANSLITERATION_halfwidthToFullwidthLikeJIS
41 #include <transliteration_OneToOne.hxx>
43 using namespace com::sun::star::uno
;
44 using namespace com::sun::star::lang
;
47 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
49 halfwidthToFullwidth::halfwidthToFullwidth()
52 table
= &widthfolding::gethalf2fullTable();
53 transliterationName
= "halfwidthToFullwidth";
54 implementationName
= "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH";
58 halfwidthToFullwidth::transliterate( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, Sequence
< sal_Int32
>& offset
)
59 throw(RuntimeException
)
61 sal_Bool _useOffset
= useOffset
;
63 useOffset
= sal_False
;
64 const OUString
& newStr
= transliteration_OneToOne::transliterate( inStr
, startPos
, nCount
, offset
);
65 useOffset
= _useOffset
;
67 // Composition: KA + voice-mark --> GA
68 return widthfolding::compose_ja_voiced_sound_marks ( newStr
, 0, newStr
.getLength(), offset
, _useOffset
);
72 halfwidthToFullwidth::transliterateChar2Char( sal_Unicode inChar
)
73 throw(RuntimeException
, MultipleCharsOutputException
)
75 return transliteration_OneToOne::transliterateChar2Char(inChar
);
79 halfwidthKatakanaToFullwidthKatakana::halfwidthKatakanaToFullwidthKatakana()
82 table
= &widthfolding::gethalfKana2fullKanaTable();
83 transliterationName
= "halfwidthKatakanaToFullwidthKatakana";
84 implementationName
= "com.sun.star.i18n.Transliteration.HALFWIDTHKATAKANA_FULLWIDTHKATAKANA";
88 halfwidthKatakanaToFullwidthKatakana::transliterate( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, Sequence
< sal_Int32
>& offset
)
89 throw(RuntimeException
)
91 sal_Bool _useOffset
= useOffset
;
93 useOffset
= sal_False
;
94 const OUString
& newStr
= transliteration_OneToOne::transliterate( inStr
, startPos
, nCount
, offset
);
95 useOffset
= _useOffset
;
97 // Composition: KA + voice-mark --> GA
98 return widthfolding::compose_ja_voiced_sound_marks ( newStr
, 0, newStr
.getLength(), offset
, _useOffset
);
102 halfwidthKatakanaToFullwidthKatakana::transliterateChar2Char( sal_Unicode inChar
)
103 throw(RuntimeException
, MultipleCharsOutputException
)
105 return transliteration_OneToOne::transliterateChar2Char(inChar
);
109 halfwidthToFullwidthLikeJIS::halfwidthToFullwidthLikeJIS()
111 func
= (TransFunc
) 0;
112 table
= &widthfolding::gethalf2fullTableForJIS();
113 transliterationName
= "halfwidthToFullwidthLikeJIS";
114 implementationName
= "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH_LIKE_JIS";
118 halfwidthToFullwidthLikeJIS::transliterate( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, Sequence
< sal_Int32
>& offset
)
119 throw(RuntimeException
)
121 sal_Bool _useOffset
= useOffset
;
122 // One to One mapping
123 useOffset
= sal_False
;
124 const OUString
& newStr
= transliteration_OneToOne::transliterate( inStr
, startPos
, nCount
, offset
);
125 useOffset
= _useOffset
;
127 // Composition: KA + voice-mark --> GA
128 return widthfolding::compose_ja_voiced_sound_marks ( newStr
, 0, newStr
.getLength(), offset
, _useOffset
, WIDTHFOLDNIG_DONT_USE_COMBINED_VU
);
132 halfwidthToFullwidthLikeJIS::transliterateChar2Char( sal_Unicode inChar
)
133 throw(RuntimeException
, MultipleCharsOutputException
)
135 return transliteration_OneToOne::transliterateChar2Char(inChar
);