INTEGRATION: CWS i18n39 (1.10.108); FILE MERGED

2007/12/12 22:48:34 khong 1.10.108.1: #i81366# add new Japanese transliterations
This commit is contained in:
Vladimir Glazounov 2008-01-28 14:37:42 +00:00
parent f70be0b342
commit 0e532488c1
2 changed files with 139 additions and 4 deletions

View file

@ -4,9 +4,9 @@
*
* $RCSfile: fullwidthToHalfwidth.cxx,v $
*
* $Revision: 1.10 $
* $Revision: 1.11 $
*
* last change: $Author: obo $ $Date: 2006-09-17 09:24:57 $
* last change: $Author: vg $ $Date: 2008-01-28 15:37:28 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@ -41,6 +41,8 @@
#include <i18nutil/widthfolding.hxx>
#define TRANSLITERATION_fullwidthToHalfwidth
#define TRANSLITERATION_fullwidthKatakanaToHalfwidthKatakana
#define TRANSLITERATION_fullwidthToHalfwidthLikeASC
#include <transliteration_OneToOne.hxx>
using namespace com::sun::star::uno;
@ -86,5 +88,76 @@ fullwidthToHalfwidth::transliterateChar2Char( sal_Unicode inChar)
return transliteration_OneToOne::transliterateChar2Char(inChar);
}
fullwidthKatakanaToHalfwidthKatakana::fullwidthKatakanaToHalfwidthKatakana()
{
func = (TransFunc) 0;
table = &widthfolding::getfullKana2halfKanaTable();
transliterationName = "fullwidthKatakanaToHalfwidthKatakana";
implementationName = "com.sun.star.i18n.Transliteration.FULLWIDTHKATAKANA_HALFWIDTHKATAKANA";
}
/**
* Transliterate fullwidth katakana to halfwidth katakana.
*/
OUString SAL_CALL
fullwidthKatakanaToHalfwidthKatakana::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
throw(RuntimeException)
{
// Decomposition: GA --> KA + voice-mark
const OUString& newStr = widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, offset, useOffset);
// One to One mapping
useOffset = sal_False;
const OUString &tmp = transliteration_OneToOne::transliterate( newStr, 0, newStr.getLength(), offset);
useOffset = sal_True;
return tmp;
}
sal_Unicode SAL_CALL
fullwidthKatakanaToHalfwidthKatakana::transliterateChar2Char( sal_Unicode inChar )
throw(RuntimeException, MultipleCharsOutputException)
{
sal_Unicode newChar = widthfolding::decompose_ja_voiced_sound_marksChar2Char (inChar);
if (newChar == 0xFFFF)
throw MultipleCharsOutputException();
return transliteration_OneToOne::transliterateChar2Char(inChar);
}
fullwidthToHalfwidthLikeASC::fullwidthToHalfwidthLikeASC()
{
func = (TransFunc) 0;
table = &widthfolding::getfull2halfTableForASC();
transliterationName = "fullwidthToHalfwidthLikeASC";
implementationName = "com.sun.star.i18n.Transliteration.FULLWIDTH_HALFWIDTH_LIKE_ASC";
}
/**
* Transliterate fullwidth to halfwidth like Excel's ASC function.
*/
OUString SAL_CALL
fullwidthToHalfwidthLikeASC::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
throw(RuntimeException)
{
// Decomposition: GA --> KA + voice-mark
const OUString& newStr = widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, offset, useOffset);
// One to One mapping
useOffset = sal_False;
const OUString &tmp = transliteration_OneToOne::transliterate( newStr, 0, newStr.getLength(), offset);
useOffset = sal_True;
return tmp;
}
sal_Unicode SAL_CALL
fullwidthToHalfwidthLikeASC::transliterateChar2Char( sal_Unicode inChar )
throw(RuntimeException, MultipleCharsOutputException)
{
sal_Unicode newChar = widthfolding::decompose_ja_voiced_sound_marksChar2Char (inChar);
if (newChar == 0xFFFF)
throw MultipleCharsOutputException();
return transliteration_OneToOne::transliterateChar2Char(inChar);
}
} } } }

View file

@ -4,9 +4,9 @@
*
* $RCSfile: halfwidthToFullwidth.cxx,v $
*
* $Revision: 1.10 $
* $Revision: 1.11 $
*
* last change: $Author: obo $ $Date: 2006-09-17 09:25:11 $
* last change: $Author: vg $ $Date: 2008-01-28 15:37:42 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@ -41,6 +41,8 @@
#include <i18nutil/widthfolding.hxx>
#define TRANSLITERATION_halfwidthToFullwidth
#define TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana
#define TRANSLITERATION_halfwidthToFullwidthLikeJIS
#include <transliteration_OneToOne.hxx>
using namespace com::sun::star::uno;
@ -78,4 +80,64 @@ halfwidthToFullwidth::transliterateChar2Char( sal_Unicode inChar)
return transliteration_OneToOne::transliterateChar2Char(inChar);
}
halfwidthKatakanaToFullwidthKatakana::halfwidthKatakanaToFullwidthKatakana()
{
func = (TransFunc) 0;
table = &widthfolding::gethalfKana2fullKanaTable();
transliterationName = "halfwidthKatakanaToFullwidthKatakana";
implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTHKATAKANA_FULLWIDTHKATAKANA";
}
OUString SAL_CALL
halfwidthKatakanaToFullwidthKatakana::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
throw(RuntimeException)
{
sal_Bool _useOffset = useOffset;
// One to One mapping
useOffset = sal_False;
const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
useOffset = _useOffset;
// Composition: KA + voice-mark --> GA
return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset );
}
sal_Unicode SAL_CALL
halfwidthKatakanaToFullwidthKatakana::transliterateChar2Char( sal_Unicode inChar)
throw(RuntimeException, MultipleCharsOutputException)
{
return transliteration_OneToOne::transliterateChar2Char(inChar);
}
halfwidthToFullwidthLikeJIS::halfwidthToFullwidthLikeJIS()
{
func = (TransFunc) 0;
table = &widthfolding::gethalf2fullTableForJIS();
transliterationName = "halfwidthToFullwidthLikeJIS";
implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH_LIKE_JIS";
}
OUString SAL_CALL
halfwidthToFullwidthLikeJIS::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
throw(RuntimeException)
{
sal_Bool _useOffset = useOffset;
// One to One mapping
useOffset = sal_False;
const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
useOffset = _useOffset;
// Composition: KA + voice-mark --> GA
return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset, WIDTHFOLDNIG_DONT_USE_COMBINED_VU );
}
sal_Unicode SAL_CALL
halfwidthToFullwidthLikeJIS::transliterateChar2Char( sal_Unicode inChar)
throw(RuntimeException, MultipleCharsOutputException)
{
return transliteration_OneToOne::transliterateChar2Char(inChar);
}
} } } }