View | Details | Raw Unified | Return to issue 81366
Collapse All | Expand All

(-)inc/transliteration_OneToOne.hxx (+12 lines)
Lines 95-100 Link Here
95
#if defined( TRANSLITERATION_halfwidthToFullwidth ) || defined( TRANSLITERATION_ALL )
95
#if defined( TRANSLITERATION_halfwidthToFullwidth ) || defined( TRANSLITERATION_ALL )
96
TRANSLITERATION_ONETOONE(halfwidthToFullwidth)
96
TRANSLITERATION_ONETOONE(halfwidthToFullwidth)
97
#endif
97
#endif
98
#if defined( TRANSLITERATION_fullwidthKatakanaToHalfwidthKatakana ) || defined( TRANSLITERATION_ALL )
99
TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana )
100
#endif
101
#if defined( TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana ) || defined( TRANSLITERATION_ALL )
102
TRANSLITERATION_ONETOONE(halfwidthKatakanaToFullwidthKatakana)
103
#endif
104
#if defined( TRANSLITERATION_fullwidthToHalfwidthLikeASC ) || defined( TRANSLITERATION_ALL )
105
TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC )
106
#endif
107
#if defined( TRANSLITERATION_halfwidthToFullwidthLikeJIS ) || defined( TRANSLITERATION_ALL )
108
TRANSLITERATION_ONETOONE( halfwidthToFullwidthLikeJIS )
109
#endif
98
#undef TRANSLITERATION_ONETOONE
110
#undef TRANSLITERATION_ONETOONE
99
111
100
#define TRANSLITERATION_ONETOONE( name ) \
112
#define TRANSLITERATION_ONETOONE( name ) \
(-)source/localedata/data/ja_JP.xml (+4 lines)
Lines 474-479 Link Here
474
    <Transliteration unoid="FULLWIDTH_HALFWIDTH"/>
474
    <Transliteration unoid="FULLWIDTH_HALFWIDTH"/>
475
    <Transliteration unoid="KATAKANA_HIRAGANA"/>
475
    <Transliteration unoid="KATAKANA_HIRAGANA"/>
476
    <Transliteration unoid="HIRAGANA_KATAKANA"/>
476
    <Transliteration unoid="HIRAGANA_KATAKANA"/>
477
    <Transliteration unoid="FULLWIDTHKATAKANA_HALFWIDTHKATAKANA"/>
478
    <Transliteration unoid="HALFWIDTHKATAKANA_FULLWIDTHKATAKANA"/>
479
    <Transliteration unoid="FULLWIDTH_HALFWIDTH_LIKE_ASC"/>
480
    <Transliteration unoid="HALFWIDTH_FULLWIDTH_LIKE_JIS"/>
477
    <Transliteration unoid="smallToLarge_ja_JP"/>
481
    <Transliteration unoid="smallToLarge_ja_JP"/>
478
    <Transliteration unoid="largeToSmall_ja_JP"/>
482
    <Transliteration unoid="largeToSmall_ja_JP"/>
479
    <Transliteration unoid="IGNORE_WIDTH"/>
483
    <Transliteration unoid="IGNORE_WIDTH"/>
(-)source/registerservices/registerservices.cxx (+17 lines)
Lines 296-301 Link Here
296
IMPL_CREATEINSTANCE( NumToTextTianGan_zh )
296
IMPL_CREATEINSTANCE( NumToTextTianGan_zh )
297
IMPL_CREATEINSTANCE( NumToTextDiZi_zh )
297
IMPL_CREATEINSTANCE( NumToTextDiZi_zh )
298
298
299
IMPL_CREATEINSTANCE( fullwidthKatakanaToHalfwidthKatakana )
300
IMPL_CREATEINSTANCE( halfwidthKatakanaToFullwidthKatakana )
301
IMPL_CREATEINSTANCE( fullwidthToHalfwidthLikeASC )
302
IMPL_CREATEINSTANCE( halfwidthToFullwidthLikeJIS )
303
299
IMPL_CREATEINSTANCE_MSF( OrdinalSuffix )
304
IMPL_CREATEINSTANCE_MSF( OrdinalSuffix )
300
305
301
static const struct InstancesArray {
306
static const struct InstancesArray {
Lines 557-562 Link Here
557
        "com.sun.star.i18n.OrdinalSuffix",
562
        "com.sun.star.i18n.OrdinalSuffix",
558
        & OrdinalSuffix_CreateInstance },
563
        & OrdinalSuffix_CreateInstance },
559
564
565
    {   TRLT_SERVICELNAME_L10N,
566
        TRLT_IMPLNAME_PREFIX  "FULLWIDTHKATAKANA_HALFWIDTHKATAKANA",
567
        &fullwidthKatakanaToHalfwidthKatakana_CreateInstance },
568
    {   TRLT_SERVICELNAME_L10N,
569
        TRLT_IMPLNAME_PREFIX  "HALFWIDTHKATAKANA_FULLWIDTHKATAKANA",
570
        &halfwidthKatakanaToFullwidthKatakana_CreateInstance },
571
    {   TRLT_SERVICELNAME_L10N,
572
        TRLT_IMPLNAME_PREFIX  "FULLWIDTH_HALFWIDTH_LIKE_ASC",
573
        &fullwidthToHalfwidthLikeASC_CreateInstance },
574
    {   TRLT_SERVICELNAME_L10N,
575
        TRLT_IMPLNAME_PREFIX  "HALFWIDTH_FULLWIDTH_LIKE_JIS",
576
        &halfwidthToFullwidthLikeJIS_CreateInstance },
560
// add here new services !!
577
// add here new services !!
561
    { 0, 0, 0 }
578
    { 0, 0, 0 }
562
};
579
};
(-)source/transliteration/fullwidthToHalfwidth.cxx (+74 lines)
Lines 41-46 Link Here
41
41
42
#include <i18nutil/widthfolding.hxx>
42
#include <i18nutil/widthfolding.hxx>
43
#define TRANSLITERATION_fullwidthToHalfwidth
43
#define TRANSLITERATION_fullwidthToHalfwidth
44
#define TRANSLITERATION_fullwidthKatakanaToHalfwidthKatakana
45
#define TRANSLITERATION_fullwidthToHalfwidthLikeASC
44
#include <transliteration_OneToOne.hxx>
46
#include <transliteration_OneToOne.hxx>
45
47
46
using namespace com::sun::star::uno;
48
using namespace com::sun::star::uno;
Lines 86-90 Link Here
86
    return transliteration_OneToOne::transliterateChar2Char(inChar);
88
    return transliteration_OneToOne::transliterateChar2Char(inChar);
87
}
89
}
88
90
91
92
fullwidthKatakanaToHalfwidthKatakana::fullwidthKatakanaToHalfwidthKatakana()
93
{
94
    func = (TransFunc) 0;
95
    table = &widthfolding::getfullKana2halfKanaTable();
96
    transliterationName = "fullwidthKatakanaToHalfwidthKatakana";
97
    implementationName = "com.sun.star.i18n.Transliteration.FULLWIDTHKATAKANA_HALFWIDTHKATAKANA";
98
}
99
100
/**
101
 * Transliterate fullwidth katakana to halfwidth katakana.
102
 */
103
OUString SAL_CALL 
104
fullwidthKatakanaToHalfwidthKatakana::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
105
  throw(RuntimeException)
106
{
107
    // Decomposition: GA --> KA + voice-mark
108
    const OUString& newStr = widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, offset, useOffset);
109
110
    // One to One mapping
111
    useOffset = sal_False;
112
    const OUString &tmp = transliteration_OneToOne::transliterate( newStr, 0, newStr.getLength(), offset);
113
    useOffset = sal_True;
114
    return tmp;
115
}
116
117
sal_Unicode SAL_CALL 
118
fullwidthKatakanaToHalfwidthKatakana::transliterateChar2Char( sal_Unicode inChar )
119
  throw(RuntimeException, MultipleCharsOutputException)
120
{
121
    sal_Unicode newChar = widthfolding::decompose_ja_voiced_sound_marksChar2Char (inChar);
122
    if (newChar == 0xFFFF)
123
        throw MultipleCharsOutputException();
124
    return transliteration_OneToOne::transliterateChar2Char(inChar);
125
}
126
127
fullwidthToHalfwidthLikeASC::fullwidthToHalfwidthLikeASC()
128
{
129
    func = (TransFunc) 0;
130
    table = &widthfolding::getfull2halfTableForASC();
131
    transliterationName = "fullwidthToHalfwidthLikeASC";
132
    implementationName = "com.sun.star.i18n.Transliteration.FULLWIDTH_HALFWIDTH_LIKE_ASC";
133
}
134
135
/**
136
 * Transliterate fullwidth to halfwidth like Excel's ASC function.
137
 */
138
OUString SAL_CALL 
139
fullwidthToHalfwidthLikeASC::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
140
  throw(RuntimeException)
141
{
142
    // Decomposition: GA --> KA + voice-mark
143
    const OUString& newStr = widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, offset, useOffset);
144
145
    // One to One mapping
146
    useOffset = sal_False;
147
    const OUString &tmp = transliteration_OneToOne::transliterate( newStr, 0, newStr.getLength(), offset);
148
    useOffset = sal_True;
149
150
    return tmp;
151
}
152
153
sal_Unicode SAL_CALL 
154
fullwidthToHalfwidthLikeASC::transliterateChar2Char( sal_Unicode inChar )
155
  throw(RuntimeException, MultipleCharsOutputException)
156
{
157
    sal_Unicode newChar = widthfolding::decompose_ja_voiced_sound_marksChar2Char (inChar);
158
    if (newChar == 0xFFFF)
159
        throw MultipleCharsOutputException();
160
    return transliteration_OneToOne::transliterateChar2Char(inChar);
161
}
162
89
} } } }
163
} } } }
90
164
(-)source/transliteration/halfwidthToFullwidth.cxx (+62 lines)
Lines 41-46 Link Here
41
41
42
#include <i18nutil/widthfolding.hxx>
42
#include <i18nutil/widthfolding.hxx>
43
#define TRANSLITERATION_halfwidthToFullwidth
43
#define TRANSLITERATION_halfwidthToFullwidth
44
#define TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana
45
#define TRANSLITERATION_halfwidthToFullwidthLikeJIS
44
#include <transliteration_OneToOne.hxx>
46
#include <transliteration_OneToOne.hxx>
45
47
46
using namespace com::sun::star::uno;
48
using namespace com::sun::star::uno;
Lines 78-81 Link Here
78
    return transliteration_OneToOne::transliterateChar2Char(inChar);
80
    return transliteration_OneToOne::transliterateChar2Char(inChar);
79
}
81
}
80
82
83
84
halfwidthKatakanaToFullwidthKatakana::halfwidthKatakanaToFullwidthKatakana()
85
{
86
    func = (TransFunc) 0;
87
    table = &widthfolding::gethalfKana2fullKanaTable();
88
    transliterationName = "halfwidthKatakanaToFullwidthKatakana";
89
    implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTHKATAKANA_FULLWIDTHKATAKANA";
90
}
91
92
OUString SAL_CALL 
93
halfwidthKatakanaToFullwidthKatakana::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
94
  throw(RuntimeException)
95
{
96
    sal_Bool _useOffset = useOffset;
97
    // One to One mapping
98
    useOffset = sal_False;
99
    const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
100
    useOffset = _useOffset;
101
102
    // Composition: KA + voice-mark --> GA
103
    return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset );
104
}
105
106
sal_Unicode SAL_CALL 
107
halfwidthKatakanaToFullwidthKatakana::transliterateChar2Char( sal_Unicode inChar)
108
  throw(RuntimeException, MultipleCharsOutputException)
109
{
110
    return transliteration_OneToOne::transliterateChar2Char(inChar);
111
}
112
113
114
halfwidthToFullwidthLikeJIS::halfwidthToFullwidthLikeJIS()
115
{
116
    func = (TransFunc) 0;
117
    table = &widthfolding::gethalf2fullTableForJIS();
118
    transliterationName = "halfwidthToFullwidthLikeJIS";
119
    implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH_LIKE_JIS";
120
}
121
122
OUString SAL_CALL 
123
halfwidthToFullwidthLikeJIS::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
124
  throw(RuntimeException)
125
{
126
    sal_Bool _useOffset = useOffset;
127
    // One to One mapping
128
    useOffset = sal_False;
129
    const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
130
    useOffset = _useOffset;
131
132
    // Composition: KA + voice-mark --> GA
133
    return widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset, WIDTHFOLDNIG_DONT_USE_COMBINED_VU );
134
}
135
136
sal_Unicode SAL_CALL 
137
halfwidthToFullwidthLikeJIS::transliterateChar2Char( sal_Unicode inChar)
138
  throw(RuntimeException, MultipleCharsOutputException)
139
{
140
    return transliteration_OneToOne::transliterateChar2Char(inChar);
141
}
142
81
} } } }
143
} } } }

Return to issue 81366