1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_i18npool.hxx"
30*cdf0e10cSrcweir #include <assert.h>
31*cdf0e10cSrcweir #include <textconversion.hxx>
32*cdf0e10cSrcweir #include <com/sun/star/i18n/TextConversionType.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/i18n/TextConversionOption.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/linguistic2/ConversionDirection.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/linguistic2/ConversionDictionaryType.hpp>
36*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
37*cdf0e10cSrcweir #include <i18nutil/x_rtl_ustring.h>
38*cdf0e10cSrcweir #include <unicode/uchar.h>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir using namespace com::sun::star::lang;
41*cdf0e10cSrcweir using namespace com::sun::star::i18n;
42*cdf0e10cSrcweir using namespace com::sun::star::linguistic2;
43*cdf0e10cSrcweir using namespace com::sun::star::uno;
44*cdf0e10cSrcweir using namespace rtl;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace i18n {
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #define SCRIPT_OTHERS   0
49*cdf0e10cSrcweir #define SCRIPT_HANJA    1
50*cdf0e10cSrcweir #define SCRIPT_HANGUL   2
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir TextConversion_ko::TextConversion_ko( const Reference < XMultiServiceFactory >& xMSF )
53*cdf0e10cSrcweir {
54*cdf0e10cSrcweir     Reference < XInterface > xI;
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir     xI = xMSF->createInstance(
57*cdf0e10cSrcweir         OUString::createFromAscii("com.sun.star.i18n.ConversionDictionary_ko"));
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir     if ( xI.is() )
60*cdf0e10cSrcweir         xI->queryInterface( getCppuType((const Reference< XConversionDictionary>*)0) ) >>= xCD;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir     xI = xMSF->createInstance(
63*cdf0e10cSrcweir         OUString::createFromAscii( "com.sun.star.linguistic2.ConversionDictionaryList" ));
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir     if ( xI.is() )
66*cdf0e10cSrcweir         xI->queryInterface( getCppuType((const Reference< XConversionDictionaryList>*)0) ) >>= xCDL;
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir     maxLeftLength = maxRightLength = 1;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir     // get maximum length of word in dictionary
71*cdf0e10cSrcweir     if (xCDL.is()) {
72*cdf0e10cSrcweir         Locale loc(OUString::createFromAscii("ko"),
73*cdf0e10cSrcweir                     OUString::createFromAscii("KR"),
74*cdf0e10cSrcweir                     OUString());
75*cdf0e10cSrcweir         maxLeftLength = xCDL->queryMaxCharCount(loc,
76*cdf0e10cSrcweir                         ConversionDictionaryType::HANGUL_HANJA,
77*cdf0e10cSrcweir                         ConversionDirection_FROM_LEFT);
78*cdf0e10cSrcweir         maxRightLength = xCDL->queryMaxCharCount(loc,
79*cdf0e10cSrcweir                         ConversionDictionaryType::HANGUL_HANJA,
80*cdf0e10cSrcweir                         ConversionDirection_FROM_RIGHT);
81*cdf0e10cSrcweir         if (xCD.is()) {
82*cdf0e10cSrcweir             sal_Int32 tmp = xCD->getMaxCharCount(ConversionDirection_FROM_LEFT);
83*cdf0e10cSrcweir             if (tmp > maxLeftLength)
84*cdf0e10cSrcweir                 maxLeftLength = tmp;
85*cdf0e10cSrcweir             tmp = xCD->getMaxCharCount(ConversionDirection_FROM_RIGHT);
86*cdf0e10cSrcweir             if (tmp > maxRightLength)
87*cdf0e10cSrcweir                 maxRightLength = tmp;
88*cdf0e10cSrcweir         }
89*cdf0e10cSrcweir     } else if (xCD.is()) {
90*cdf0e10cSrcweir         maxLeftLength = xCD->getMaxCharCount(ConversionDirection_FROM_LEFT);
91*cdf0e10cSrcweir         maxRightLength = xCD->getMaxCharCount(ConversionDirection_FROM_RIGHT);
92*cdf0e10cSrcweir     }
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir     implementationName = "com.sun.star.i18n.TextConversion_ko";
95*cdf0e10cSrcweir }
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir sal_Int16 SAL_CALL checkScriptType(sal_Unicode c)
98*cdf0e10cSrcweir {
99*cdf0e10cSrcweir     typedef struct {
100*cdf0e10cSrcweir         UBlockCode from;
101*cdf0e10cSrcweir         UBlockCode to;
102*cdf0e10cSrcweir         sal_Int16 script;
103*cdf0e10cSrcweir     } UBlock2Script;
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir     static UBlock2Script scriptList[] = {
106*cdf0e10cSrcweir         {UBLOCK_HANGUL_JAMO, UBLOCK_HANGUL_JAMO, SCRIPT_HANGUL},
107*cdf0e10cSrcweir         {UBLOCK_CJK_RADICALS_SUPPLEMENT, UBLOCK_BOPOMOFO, SCRIPT_HANJA},
108*cdf0e10cSrcweir         {UBLOCK_HANGUL_COMPATIBILITY_JAMO, UBLOCK_HANGUL_COMPATIBILITY_JAMO, SCRIPT_HANGUL},
109*cdf0e10cSrcweir         {UBLOCK_KANBUN, UBLOCK_YI_RADICALS, SCRIPT_HANJA},
110*cdf0e10cSrcweir         {UBLOCK_HANGUL_SYLLABLES, UBLOCK_HANGUL_SYLLABLES, SCRIPT_HANGUL},
111*cdf0e10cSrcweir         {UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS, UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS, SCRIPT_HANJA},
112*cdf0e10cSrcweir         {UBLOCK_COMBINING_HALF_MARKS, UBLOCK_SMALL_FORM_VARIANTS, SCRIPT_HANJA},
113*cdf0e10cSrcweir         {UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS, UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS, SCRIPT_HANJA},
114*cdf0e10cSrcweir     };
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir #define scriptListCount sizeof (scriptList) / sizeof (UBlock2Script)
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir     UBlockCode block=ublock_getCode((sal_uInt32) c);
119*cdf0e10cSrcweir     sal_uInt16 i;
120*cdf0e10cSrcweir     for ( i = 0; i < scriptListCount; i++) {
121*cdf0e10cSrcweir         if (block <= scriptList[i].to) break;
122*cdf0e10cSrcweir     }
123*cdf0e10cSrcweir     return (i < scriptListCount && block >= scriptList[i].from) ? scriptList[i].script : SCRIPT_OTHERS;
124*cdf0e10cSrcweir }
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir Sequence< OUString > SAL_CALL
127*cdf0e10cSrcweir TextConversion_ko::getCharConversions(const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toHanja)
128*cdf0e10cSrcweir {
129*cdf0e10cSrcweir     sal_Unicode ch;
130*cdf0e10cSrcweir     Sequence< OUString > output;
131*cdf0e10cSrcweir     const sal_Unicode* (*getHangul2HanjaData)() = (const sal_Unicode* (*)())getFunctionBySymbol("getHangul2HanjaData");
132*cdf0e10cSrcweir     const Hangul_Index* (*getHangul2HanjaIndex)() = (const Hangul_Index* (*)()) getFunctionBySymbol("getHangul2HanjaIndex");
133*cdf0e10cSrcweir     sal_Int16 (*getHangul2HanjaIndexCount)() = (sal_Int16 (*)()) getFunctionBySymbol("getHangul2HanjaIndexCount");
134*cdf0e10cSrcweir     const sal_uInt16* (*getHanja2HangulIndex)() = (const sal_uInt16* (*)()) getFunctionBySymbol("getHanja2HangulIndex");
135*cdf0e10cSrcweir     const sal_Unicode* (*getHanja2HangulData)() = (const sal_Unicode* (*)()) getFunctionBySymbol("getHanja2HangulData");
136*cdf0e10cSrcweir     if (toHanja && getHangul2HanjaIndex && getHangul2HanjaIndexCount && getHangul2HanjaData) {
137*cdf0e10cSrcweir         ch = aText[nStartPos];
138*cdf0e10cSrcweir         const Hangul_Index *Hangul_ko = getHangul2HanjaIndex();
139*cdf0e10cSrcweir 	    sal_Int16 top =  getHangul2HanjaIndexCount();
140*cdf0e10cSrcweir         --top;
141*cdf0e10cSrcweir 	    sal_Int16 bottom = 0;
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 	    while (bottom <= top) {
144*cdf0e10cSrcweir             sal_Int16 current = (top + bottom) / 2;
145*cdf0e10cSrcweir             sal_Unicode current_ch = Hangul_ko[current].code;
146*cdf0e10cSrcweir             if (ch < current_ch)
147*cdf0e10cSrcweir                 top = current - 1;
148*cdf0e10cSrcweir             else if (ch > current_ch)
149*cdf0e10cSrcweir                 bottom = current + 1;
150*cdf0e10cSrcweir             else {
151*cdf0e10cSrcweir                 const sal_Unicode *ptr = getHangul2HanjaData() + Hangul_ko[current].address;
152*cdf0e10cSrcweir                 sal_Int16 count = Hangul_ko[current].count;
153*cdf0e10cSrcweir                 output.realloc(count);
154*cdf0e10cSrcweir                 for (sal_Int16 i = 0; i < count; i++)
155*cdf0e10cSrcweir                     output[i] = OUString(ptr + i, 1);
156*cdf0e10cSrcweir                 break;
157*cdf0e10cSrcweir             }
158*cdf0e10cSrcweir 	    }
159*cdf0e10cSrcweir     } else if (! toHanja && getHanja2HangulIndex && getHanja2HangulData) {
160*cdf0e10cSrcweir         rtl_uString * newStr = x_rtl_uString_new_WithLength( nLength ); // defined in x_rtl_ustring.h
161*cdf0e10cSrcweir         sal_Int32 count = 0;
162*cdf0e10cSrcweir         while (count < nLength) {
163*cdf0e10cSrcweir             ch = aText[nStartPos + count];
164*cdf0e10cSrcweir             sal_Unicode address = getHanja2HangulIndex()[ch>>8];
165*cdf0e10cSrcweir             if (address != 0xFFFF)
166*cdf0e10cSrcweir                 address = getHanja2HangulData()[address + (ch & 0xFF)];
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir             if (address != 0xFFFF)
169*cdf0e10cSrcweir                 newStr->buffer[count++] = address;
170*cdf0e10cSrcweir             else
171*cdf0e10cSrcweir                 break;
172*cdf0e10cSrcweir         }
173*cdf0e10cSrcweir         if (count > 0) {
174*cdf0e10cSrcweir             output.realloc(1);
175*cdf0e10cSrcweir             output[0] = OUString( newStr->buffer, count);
176*cdf0e10cSrcweir         }
177*cdf0e10cSrcweir     }
178*cdf0e10cSrcweir     return output;
179*cdf0e10cSrcweir }
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir static Sequence< OUString >& operator += (Sequence< OUString > &rSeq1, Sequence< OUString > &rSeq2 )
182*cdf0e10cSrcweir {
183*cdf0e10cSrcweir     if (! rSeq1.hasElements() && rSeq2.hasElements())
184*cdf0e10cSrcweir         rSeq1 = rSeq2;
185*cdf0e10cSrcweir     else if (rSeq2.hasElements()) {
186*cdf0e10cSrcweir         sal_Int32 i, j, k, l;
187*cdf0e10cSrcweir         k = l = rSeq1.getLength();
188*cdf0e10cSrcweir         rSeq1.realloc(l + rSeq2.getLength());
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir         for (i = 0; i < rSeq2.getLength(); i++) {
191*cdf0e10cSrcweir             for (j = 0; j < l; j++)
192*cdf0e10cSrcweir                 if (rSeq1[j] == rSeq2[i])
193*cdf0e10cSrcweir                     break;
194*cdf0e10cSrcweir             if (j == l)
195*cdf0e10cSrcweir                 rSeq1[k++] = rSeq2[i];
196*cdf0e10cSrcweir         }
197*cdf0e10cSrcweir         if (rSeq1.getLength() > k)
198*cdf0e10cSrcweir             rSeq1.realloc(k);
199*cdf0e10cSrcweir     }
200*cdf0e10cSrcweir     return rSeq1;
201*cdf0e10cSrcweir }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir TextConversionResult SAL_CALL
204*cdf0e10cSrcweir TextConversion_ko::getConversions( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
205*cdf0e10cSrcweir     const Locale& aLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions)
206*cdf0e10cSrcweir     throw(  RuntimeException, IllegalArgumentException, NoSupportException )
207*cdf0e10cSrcweir {
208*cdf0e10cSrcweir     TextConversionResult result;
209*cdf0e10cSrcweir     Sequence <OUString> candidates;
210*cdf0e10cSrcweir     result.Boundary.startPos = result.Boundary.endPos = 0;
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir     // do conversion only when there are right conversion type and dictionary services.
213*cdf0e10cSrcweir     if (nConversionType == TextConversionType::TO_HANGUL ||
214*cdf0e10cSrcweir             nConversionType == TextConversionType::TO_HANJA) {
215*cdf0e10cSrcweir         sal_Int32 start, end, length = aText.getLength() - nStartPos;
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir         if (length < 0 || nStartPos < 0)
218*cdf0e10cSrcweir             length = 0;
219*cdf0e10cSrcweir         else if (length > nLength)
220*cdf0e10cSrcweir             length = nLength;
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir         sal_Int16 scriptType = SCRIPT_OTHERS;
223*cdf0e10cSrcweir         sal_Int32 len = 1;
224*cdf0e10cSrcweir         sal_Bool toHanja = (nConversionType == TextConversionType::TO_HANJA);
225*cdf0e10cSrcweir         // FROM_LEFT:  Hangul -> Hanja
226*cdf0e10cSrcweir         // FROM_RIGHT: Hanja  -> Hangul
227*cdf0e10cSrcweir         ConversionDirection eDirection = toHanja ? ConversionDirection_FROM_LEFT : ConversionDirection_FROM_RIGHT;
228*cdf0e10cSrcweir         sal_Int32 maxLength = toHanja ? maxLeftLength : maxRightLength;
229*cdf0e10cSrcweir         if (maxLength == 0) maxLength = 1;
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir         // search for a max length of convertible text
232*cdf0e10cSrcweir         for (start = 0, end = 0; start < length; start++) {
233*cdf0e10cSrcweir             if (end <= start) {
234*cdf0e10cSrcweir                 scriptType = checkScriptType(aText[nStartPos + start]);
235*cdf0e10cSrcweir                 if (nConversionType == TextConversionType::TO_HANJA) {
236*cdf0e10cSrcweir                     if (scriptType != SCRIPT_HANGUL) // skip non-Hangul characters
237*cdf0e10cSrcweir                         continue;
238*cdf0e10cSrcweir                 } else {
239*cdf0e10cSrcweir                     if (scriptType != SCRIPT_HANJA) // skip non-Hanja characters
240*cdf0e10cSrcweir                         continue;
241*cdf0e10cSrcweir                 }
242*cdf0e10cSrcweir                 end = start + 1;
243*cdf0e10cSrcweir             }
244*cdf0e10cSrcweir             if (nConversionOptions & TextConversionOption::CHARACTER_BY_CHARACTER) {
245*cdf0e10cSrcweir                 result.Candidates = getCharConversions(aText, nStartPos + start, len, toHanja); // char2char conversion
246*cdf0e10cSrcweir             } else {
247*cdf0e10cSrcweir                 for (; end < length && end - start < maxLength; end++)
248*cdf0e10cSrcweir                     if (checkScriptType(aText[nStartPos + end]) != scriptType)
249*cdf0e10cSrcweir                         break;
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir                 for (len = end - start; len > 0; len--) {
252*cdf0e10cSrcweir                     if (len > 1) {
253*cdf0e10cSrcweir                         try {
254*cdf0e10cSrcweir                             if (xCDL.is())
255*cdf0e10cSrcweir                                 result.Candidates = xCDL->queryConversions(aText, start + nStartPos, len,
256*cdf0e10cSrcweir                                     aLocale, ConversionDictionaryType::HANGUL_HANJA, eDirection, nConversionOptions); // user dictionary
257*cdf0e10cSrcweir                         }
258*cdf0e10cSrcweir                         catch ( NoSupportException & ) {
259*cdf0e10cSrcweir                             // clear reference (when there is no user dictionary) in order
260*cdf0e10cSrcweir                             // to not always have to catch this exception again
261*cdf0e10cSrcweir                             // in further calls. (save time)
262*cdf0e10cSrcweir                             xCDL = 0;
263*cdf0e10cSrcweir                         }
264*cdf0e10cSrcweir                         catch (...) {
265*cdf0e10cSrcweir                             // catch all other exceptions to allow
266*cdf0e10cSrcweir                             // querying the system dictionary in the next line
267*cdf0e10cSrcweir                         }
268*cdf0e10cSrcweir                         if (xCD.is() && toHanja) { // System dictionary would not do Hanja_to_Hangul conversion.
269*cdf0e10cSrcweir                             candidates = xCD->getConversions(aText, start + nStartPos, len, eDirection, nConversionOptions);
270*cdf0e10cSrcweir                             result.Candidates += candidates;
271*cdf0e10cSrcweir                         }
272*cdf0e10cSrcweir                     } else if (! toHanja) { // do whole word character 2 character conversion for Hanja to Hangul conversion
273*cdf0e10cSrcweir                         result.Candidates = getCharConversions(aText, nStartPos + start, length - start, toHanja);
274*cdf0e10cSrcweir                         if (result.Candidates.hasElements())
275*cdf0e10cSrcweir                             len = result.Candidates[0].getLength();
276*cdf0e10cSrcweir                     }
277*cdf0e10cSrcweir                     if (result.Candidates.hasElements())
278*cdf0e10cSrcweir                         break;
279*cdf0e10cSrcweir                 }
280*cdf0e10cSrcweir             }
281*cdf0e10cSrcweir             // found match
282*cdf0e10cSrcweir             if (result.Candidates.hasElements()) {
283*cdf0e10cSrcweir                 result.Boundary.startPos = start + nStartPos;;
284*cdf0e10cSrcweir                 result.Boundary.endPos = start + len + nStartPos;
285*cdf0e10cSrcweir                 return result;
286*cdf0e10cSrcweir             }
287*cdf0e10cSrcweir         }
288*cdf0e10cSrcweir     } else
289*cdf0e10cSrcweir         throw NoSupportException(); // Conversion type is not supported in this service.
290*cdf0e10cSrcweir     return result;
291*cdf0e10cSrcweir }
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir OUString SAL_CALL
294*cdf0e10cSrcweir TextConversion_ko::getConversion( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
295*cdf0e10cSrcweir     const Locale& aLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions)
296*cdf0e10cSrcweir     throw(  RuntimeException, IllegalArgumentException, NoSupportException )
297*cdf0e10cSrcweir {
298*cdf0e10cSrcweir     sal_Int32 length = aText.getLength() - nStartPos;
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir     if (length <= 0 || nStartPos < 0)
301*cdf0e10cSrcweir         return OUString();
302*cdf0e10cSrcweir     else if (length > nLength)
303*cdf0e10cSrcweir         length = nLength;
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir     OUStringBuffer aBuf(length + 1);
306*cdf0e10cSrcweir     TextConversionResult result;
307*cdf0e10cSrcweir     const sal_Unicode *str = aText.getStr();
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir     for (sal_Int32 start = nStartPos; length + nStartPos > start; start = result.Boundary.endPos) {
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir         result = getConversions(aText, start, length + nStartPos - start, aLocale, nConversionType, nConversionOptions);
312*cdf0e10cSrcweir 
313*cdf0e10cSrcweir         if (result.Boundary.endPos > 0) {
314*cdf0e10cSrcweir             if (result.Boundary.startPos > start)
315*cdf0e10cSrcweir                 aBuf.append(str + start, result.Boundary.startPos - start); // append skip portion
316*cdf0e10cSrcweir             aBuf.append(result.Candidates[0]); // append converted portion
317*cdf0e10cSrcweir         } else {
318*cdf0e10cSrcweir             if (length + nStartPos > start)
319*cdf0e10cSrcweir                 aBuf.append(str + start, length + nStartPos - start); // append last portion
320*cdf0e10cSrcweir             break;
321*cdf0e10cSrcweir         }
322*cdf0e10cSrcweir     }
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir     return aBuf.makeStringAndClear();
325*cdf0e10cSrcweir }
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir OUString SAL_CALL
328*cdf0e10cSrcweir TextConversion_ko::getConversionWithOffset( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
329*cdf0e10cSrcweir     const Locale& rLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions, Sequence<sal_Int32>& offset)
330*cdf0e10cSrcweir     throw(  RuntimeException, IllegalArgumentException, NoSupportException )
331*cdf0e10cSrcweir {
332*cdf0e10cSrcweir     offset.realloc(0);
333*cdf0e10cSrcweir     return getConversion(aText, nStartPos, nLength, rLocale, nConversionType, nConversionOptions);
334*cdf0e10cSrcweir }
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir sal_Bool SAL_CALL
337*cdf0e10cSrcweir TextConversion_ko::interactiveConversion( const Locale& /*rLocale*/, sal_Int16 /*nTextConversionType*/, sal_Int32 /*nTextConversionOptions*/ )
338*cdf0e10cSrcweir     throw(  RuntimeException, IllegalArgumentException, NoSupportException )
339*cdf0e10cSrcweir {
340*cdf0e10cSrcweir     return sal_True;
341*cdf0e10cSrcweir }
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir } } } }
344