1449ab281SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3449ab281SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4449ab281SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5449ab281SAndrew Rist  * distributed with this work for additional information
6449ab281SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7449ab281SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8449ab281SAndrew Rist  * "License"); you may not use this file except in compliance
9449ab281SAndrew Rist  * with the License.  You may obtain a copy of the License at
10449ab281SAndrew Rist  *
11449ab281SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12449ab281SAndrew Rist  *
13449ab281SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14449ab281SAndrew Rist  * software distributed under the License is distributed on an
15449ab281SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16449ab281SAndrew Rist  * KIND, either express or implied.  See the License for the
17449ab281SAndrew Rist  * specific language governing permissions and limitations
18449ab281SAndrew Rist  * under the License.
19449ab281SAndrew Rist  *
20449ab281SAndrew Rist  *************************************************************/
21449ab281SAndrew Rist 
22449ab281SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_i18npool.hxx"
26cdf0e10cSrcweir #include <assert.h>
27cdf0e10cSrcweir #include <textconversion.hxx>
28cdf0e10cSrcweir #include <com/sun/star/i18n/TextConversionType.hpp>
29cdf0e10cSrcweir #include <com/sun/star/i18n/TextConversionOption.hpp>
30cdf0e10cSrcweir #include <com/sun/star/linguistic2/ConversionDirection.hpp>
31cdf0e10cSrcweir #include <com/sun/star/linguistic2/ConversionDictionaryType.hpp>
32cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
33cdf0e10cSrcweir #include <i18nutil/x_rtl_ustring.h>
34cdf0e10cSrcweir #include <unicode/uchar.h>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir using namespace com::sun::star::lang;
37cdf0e10cSrcweir using namespace com::sun::star::i18n;
38cdf0e10cSrcweir using namespace com::sun::star::linguistic2;
39cdf0e10cSrcweir using namespace com::sun::star::uno;
40cdf0e10cSrcweir using namespace rtl;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace i18n {
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #define SCRIPT_OTHERS   0
45cdf0e10cSrcweir #define SCRIPT_HANJA    1
46cdf0e10cSrcweir #define SCRIPT_HANGUL   2
47cdf0e10cSrcweir 
TextConversion_ko(const Reference<XMultiServiceFactory> & xMSF)48cdf0e10cSrcweir TextConversion_ko::TextConversion_ko( const Reference < XMultiServiceFactory >& xMSF )
49cdf0e10cSrcweir {
50cdf0e10cSrcweir     Reference < XInterface > xI;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir     xI = xMSF->createInstance(
53cdf0e10cSrcweir         OUString::createFromAscii("com.sun.star.i18n.ConversionDictionary_ko"));
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     if ( xI.is() )
56cdf0e10cSrcweir         xI->queryInterface( getCppuType((const Reference< XConversionDictionary>*)0) ) >>= xCD;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     xI = xMSF->createInstance(
59cdf0e10cSrcweir         OUString::createFromAscii( "com.sun.star.linguistic2.ConversionDictionaryList" ));
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     if ( xI.is() )
62cdf0e10cSrcweir         xI->queryInterface( getCppuType((const Reference< XConversionDictionaryList>*)0) ) >>= xCDL;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     maxLeftLength = maxRightLength = 1;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     // get maximum length of word in dictionary
67cdf0e10cSrcweir     if (xCDL.is()) {
68cdf0e10cSrcweir         Locale loc(OUString::createFromAscii("ko"),
69cdf0e10cSrcweir                     OUString::createFromAscii("KR"),
70cdf0e10cSrcweir                     OUString());
71cdf0e10cSrcweir         maxLeftLength = xCDL->queryMaxCharCount(loc,
72cdf0e10cSrcweir                         ConversionDictionaryType::HANGUL_HANJA,
73cdf0e10cSrcweir                         ConversionDirection_FROM_LEFT);
74cdf0e10cSrcweir         maxRightLength = xCDL->queryMaxCharCount(loc,
75cdf0e10cSrcweir                         ConversionDictionaryType::HANGUL_HANJA,
76cdf0e10cSrcweir                         ConversionDirection_FROM_RIGHT);
77cdf0e10cSrcweir         if (xCD.is()) {
78cdf0e10cSrcweir             sal_Int32 tmp = xCD->getMaxCharCount(ConversionDirection_FROM_LEFT);
79cdf0e10cSrcweir             if (tmp > maxLeftLength)
80cdf0e10cSrcweir                 maxLeftLength = tmp;
81cdf0e10cSrcweir             tmp = xCD->getMaxCharCount(ConversionDirection_FROM_RIGHT);
82cdf0e10cSrcweir             if (tmp > maxRightLength)
83cdf0e10cSrcweir                 maxRightLength = tmp;
84cdf0e10cSrcweir         }
85cdf0e10cSrcweir     } else if (xCD.is()) {
86cdf0e10cSrcweir         maxLeftLength = xCD->getMaxCharCount(ConversionDirection_FROM_LEFT);
87cdf0e10cSrcweir         maxRightLength = xCD->getMaxCharCount(ConversionDirection_FROM_RIGHT);
88cdf0e10cSrcweir     }
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     implementationName = "com.sun.star.i18n.TextConversion_ko";
91cdf0e10cSrcweir }
92cdf0e10cSrcweir 
checkScriptType(sal_Unicode c)93cdf0e10cSrcweir sal_Int16 SAL_CALL checkScriptType(sal_Unicode c)
94cdf0e10cSrcweir {
95cdf0e10cSrcweir     typedef struct {
96cdf0e10cSrcweir         UBlockCode from;
97cdf0e10cSrcweir         UBlockCode to;
98cdf0e10cSrcweir         sal_Int16 script;
99cdf0e10cSrcweir     } UBlock2Script;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     static UBlock2Script scriptList[] = {
102cdf0e10cSrcweir         {UBLOCK_HANGUL_JAMO, UBLOCK_HANGUL_JAMO, SCRIPT_HANGUL},
103cdf0e10cSrcweir         {UBLOCK_CJK_RADICALS_SUPPLEMENT, UBLOCK_BOPOMOFO, SCRIPT_HANJA},
104cdf0e10cSrcweir         {UBLOCK_HANGUL_COMPATIBILITY_JAMO, UBLOCK_HANGUL_COMPATIBILITY_JAMO, SCRIPT_HANGUL},
105cdf0e10cSrcweir         {UBLOCK_KANBUN, UBLOCK_YI_RADICALS, SCRIPT_HANJA},
106cdf0e10cSrcweir         {UBLOCK_HANGUL_SYLLABLES, UBLOCK_HANGUL_SYLLABLES, SCRIPT_HANGUL},
107cdf0e10cSrcweir         {UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS, UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS, SCRIPT_HANJA},
108cdf0e10cSrcweir         {UBLOCK_COMBINING_HALF_MARKS, UBLOCK_SMALL_FORM_VARIANTS, SCRIPT_HANJA},
109cdf0e10cSrcweir         {UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS, UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS, SCRIPT_HANJA},
110cdf0e10cSrcweir     };
111cdf0e10cSrcweir 
112cdf0e10cSrcweir #define scriptListCount sizeof (scriptList) / sizeof (UBlock2Script)
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     UBlockCode block=ublock_getCode((sal_uInt32) c);
115cdf0e10cSrcweir     sal_uInt16 i;
116cdf0e10cSrcweir     for ( i = 0; i < scriptListCount; i++) {
117cdf0e10cSrcweir         if (block <= scriptList[i].to) break;
118cdf0e10cSrcweir     }
119cdf0e10cSrcweir     return (i < scriptListCount && block >= scriptList[i].from) ? scriptList[i].script : SCRIPT_OTHERS;
120cdf0e10cSrcweir }
121cdf0e10cSrcweir 
122cdf0e10cSrcweir Sequence< OUString > SAL_CALL
getCharConversions(const OUString & aText,sal_Int32 nStartPos,sal_Int32 nLength,sal_Bool toHanja)123cdf0e10cSrcweir TextConversion_ko::getCharConversions(const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toHanja)
124cdf0e10cSrcweir {
125cdf0e10cSrcweir     sal_Unicode ch;
126cdf0e10cSrcweir     Sequence< OUString > output;
127cdf0e10cSrcweir     const sal_Unicode* (*getHangul2HanjaData)() = (const sal_Unicode* (*)())getFunctionBySymbol("getHangul2HanjaData");
128cdf0e10cSrcweir     const Hangul_Index* (*getHangul2HanjaIndex)() = (const Hangul_Index* (*)()) getFunctionBySymbol("getHangul2HanjaIndex");
129cdf0e10cSrcweir     sal_Int16 (*getHangul2HanjaIndexCount)() = (sal_Int16 (*)()) getFunctionBySymbol("getHangul2HanjaIndexCount");
130cdf0e10cSrcweir     const sal_uInt16* (*getHanja2HangulIndex)() = (const sal_uInt16* (*)()) getFunctionBySymbol("getHanja2HangulIndex");
131cdf0e10cSrcweir     const sal_Unicode* (*getHanja2HangulData)() = (const sal_Unicode* (*)()) getFunctionBySymbol("getHanja2HangulData");
132cdf0e10cSrcweir     if (toHanja && getHangul2HanjaIndex && getHangul2HanjaIndexCount && getHangul2HanjaData) {
133cdf0e10cSrcweir         ch = aText[nStartPos];
134cdf0e10cSrcweir         const Hangul_Index *Hangul_ko = getHangul2HanjaIndex();
135cdf0e10cSrcweir 	    sal_Int16 top =  getHangul2HanjaIndexCount();
136cdf0e10cSrcweir         --top;
137cdf0e10cSrcweir 	    sal_Int16 bottom = 0;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	    while (bottom <= top) {
140cdf0e10cSrcweir             sal_Int16 current = (top + bottom) / 2;
141cdf0e10cSrcweir             sal_Unicode current_ch = Hangul_ko[current].code;
142cdf0e10cSrcweir             if (ch < current_ch)
143cdf0e10cSrcweir                 top = current - 1;
144cdf0e10cSrcweir             else if (ch > current_ch)
145cdf0e10cSrcweir                 bottom = current + 1;
146cdf0e10cSrcweir             else {
147cdf0e10cSrcweir                 const sal_Unicode *ptr = getHangul2HanjaData() + Hangul_ko[current].address;
148cdf0e10cSrcweir                 sal_Int16 count = Hangul_ko[current].count;
149cdf0e10cSrcweir                 output.realloc(count);
150cdf0e10cSrcweir                 for (sal_Int16 i = 0; i < count; i++)
151cdf0e10cSrcweir                     output[i] = OUString(ptr + i, 1);
152cdf0e10cSrcweir                 break;
153cdf0e10cSrcweir             }
154cdf0e10cSrcweir 	    }
155cdf0e10cSrcweir     } else if (! toHanja && getHanja2HangulIndex && getHanja2HangulData) {
156cdf0e10cSrcweir         rtl_uString * newStr = x_rtl_uString_new_WithLength( nLength ); // defined in x_rtl_ustring.h
157cdf0e10cSrcweir         sal_Int32 count = 0;
158*4674bdb9SOliver-Rainer Wittmann         while (count < nLength)
159*4674bdb9SOliver-Rainer Wittmann         {
160cdf0e10cSrcweir             ch = aText[nStartPos + count];
161cdf0e10cSrcweir             sal_Unicode address = getHanja2HangulIndex()[ch>>8];
162cdf0e10cSrcweir             if (address != 0xFFFF)
163cdf0e10cSrcweir                 address = getHanja2HangulData()[address + (ch & 0xFF)];
164cdf0e10cSrcweir 
165cdf0e10cSrcweir             if (address != 0xFFFF)
166cdf0e10cSrcweir                 newStr->buffer[count++] = address;
167cdf0e10cSrcweir             else
168cdf0e10cSrcweir                 break;
169cdf0e10cSrcweir         }
170*4674bdb9SOliver-Rainer Wittmann         if (count > 0)
171*4674bdb9SOliver-Rainer Wittmann         {
172cdf0e10cSrcweir             output.realloc(1);
173*4674bdb9SOliver-Rainer Wittmann             output[0] = OUString( newStr->buffer, count );
174cdf0e10cSrcweir         }
175*4674bdb9SOliver-Rainer Wittmann         x_rtl_uString_release( newStr );
176cdf0e10cSrcweir     }
177cdf0e10cSrcweir     return output;
178cdf0e10cSrcweir }
179cdf0e10cSrcweir 
operator +=(Sequence<OUString> & rSeq1,Sequence<OUString> & rSeq2)180cdf0e10cSrcweir static Sequence< OUString >& operator += (Sequence< OUString > &rSeq1, Sequence< OUString > &rSeq2 )
181cdf0e10cSrcweir {
182cdf0e10cSrcweir     if (! rSeq1.hasElements() && rSeq2.hasElements())
183cdf0e10cSrcweir         rSeq1 = rSeq2;
184cdf0e10cSrcweir     else if (rSeq2.hasElements()) {
185cdf0e10cSrcweir         sal_Int32 i, j, k, l;
186cdf0e10cSrcweir         k = l = rSeq1.getLength();
187cdf0e10cSrcweir         rSeq1.realloc(l + rSeq2.getLength());
188cdf0e10cSrcweir 
189cdf0e10cSrcweir         for (i = 0; i < rSeq2.getLength(); i++) {
190cdf0e10cSrcweir             for (j = 0; j < l; j++)
191cdf0e10cSrcweir                 if (rSeq1[j] == rSeq2[i])
192cdf0e10cSrcweir                     break;
193cdf0e10cSrcweir             if (j == l)
194cdf0e10cSrcweir                 rSeq1[k++] = rSeq2[i];
195cdf0e10cSrcweir         }
196cdf0e10cSrcweir         if (rSeq1.getLength() > k)
197cdf0e10cSrcweir             rSeq1.realloc(k);
198cdf0e10cSrcweir     }
199cdf0e10cSrcweir     return rSeq1;
200cdf0e10cSrcweir }
201cdf0e10cSrcweir 
202cdf0e10cSrcweir TextConversionResult SAL_CALL
getConversions(const OUString & aText,sal_Int32 nStartPos,sal_Int32 nLength,const Locale & aLocale,sal_Int16 nConversionType,sal_Int32 nConversionOptions)203cdf0e10cSrcweir TextConversion_ko::getConversions( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
204cdf0e10cSrcweir     const Locale& aLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions)
205cdf0e10cSrcweir     throw(  RuntimeException, IllegalArgumentException, NoSupportException )
206cdf0e10cSrcweir {
207cdf0e10cSrcweir     TextConversionResult result;
208cdf0e10cSrcweir     Sequence <OUString> candidates;
209cdf0e10cSrcweir     result.Boundary.startPos = result.Boundary.endPos = 0;
210cdf0e10cSrcweir 
211cdf0e10cSrcweir     // do conversion only when there are right conversion type and dictionary services.
212cdf0e10cSrcweir     if (nConversionType == TextConversionType::TO_HANGUL ||
213cdf0e10cSrcweir             nConversionType == TextConversionType::TO_HANJA) {
214cdf0e10cSrcweir         sal_Int32 start, end, length = aText.getLength() - nStartPos;
215cdf0e10cSrcweir 
216cdf0e10cSrcweir         if (length < 0 || nStartPos < 0)
217cdf0e10cSrcweir             length = 0;
218cdf0e10cSrcweir         else if (length > nLength)
219cdf0e10cSrcweir             length = nLength;
220cdf0e10cSrcweir 
221cdf0e10cSrcweir         sal_Int16 scriptType = SCRIPT_OTHERS;
222cdf0e10cSrcweir         sal_Int32 len = 1;
223cdf0e10cSrcweir         sal_Bool toHanja = (nConversionType == TextConversionType::TO_HANJA);
224cdf0e10cSrcweir         // FROM_LEFT:  Hangul -> Hanja
225cdf0e10cSrcweir         // FROM_RIGHT: Hanja  -> Hangul
226cdf0e10cSrcweir         ConversionDirection eDirection = toHanja ? ConversionDirection_FROM_LEFT : ConversionDirection_FROM_RIGHT;
227cdf0e10cSrcweir         sal_Int32 maxLength = toHanja ? maxLeftLength : maxRightLength;
228cdf0e10cSrcweir         if (maxLength == 0) maxLength = 1;
229cdf0e10cSrcweir 
230cdf0e10cSrcweir         // search for a max length of convertible text
231cdf0e10cSrcweir         for (start = 0, end = 0; start < length; start++) {
232cdf0e10cSrcweir             if (end <= start) {
233cdf0e10cSrcweir                 scriptType = checkScriptType(aText[nStartPos + start]);
234cdf0e10cSrcweir                 if (nConversionType == TextConversionType::TO_HANJA) {
235cdf0e10cSrcweir                     if (scriptType != SCRIPT_HANGUL) // skip non-Hangul characters
236cdf0e10cSrcweir                         continue;
237cdf0e10cSrcweir                 } else {
238cdf0e10cSrcweir                     if (scriptType != SCRIPT_HANJA) // skip non-Hanja characters
239cdf0e10cSrcweir                         continue;
240cdf0e10cSrcweir                 }
241cdf0e10cSrcweir                 end = start + 1;
242cdf0e10cSrcweir             }
243cdf0e10cSrcweir             if (nConversionOptions & TextConversionOption::CHARACTER_BY_CHARACTER) {
244cdf0e10cSrcweir                 result.Candidates = getCharConversions(aText, nStartPos + start, len, toHanja); // char2char conversion
245cdf0e10cSrcweir             } else {
246cdf0e10cSrcweir                 for (; end < length && end - start < maxLength; end++)
247cdf0e10cSrcweir                     if (checkScriptType(aText[nStartPos + end]) != scriptType)
248cdf0e10cSrcweir                         break;
249cdf0e10cSrcweir 
250cdf0e10cSrcweir                 for (len = end - start; len > 0; len--) {
251cdf0e10cSrcweir                     if (len > 1) {
252cdf0e10cSrcweir                         try {
253cdf0e10cSrcweir                             if (xCDL.is())
254cdf0e10cSrcweir                                 result.Candidates = xCDL->queryConversions(aText, start + nStartPos, len,
255cdf0e10cSrcweir                                     aLocale, ConversionDictionaryType::HANGUL_HANJA, eDirection, nConversionOptions); // user dictionary
256cdf0e10cSrcweir                         }
257cdf0e10cSrcweir                         catch ( NoSupportException & ) {
258cdf0e10cSrcweir                             // clear reference (when there is no user dictionary) in order
259cdf0e10cSrcweir                             // to not always have to catch this exception again
260cdf0e10cSrcweir                             // in further calls. (save time)
261cdf0e10cSrcweir                             xCDL = 0;
262cdf0e10cSrcweir                         }
263cdf0e10cSrcweir                         catch (...) {
264cdf0e10cSrcweir                             // catch all other exceptions to allow
265cdf0e10cSrcweir                             // querying the system dictionary in the next line
266cdf0e10cSrcweir                         }
267cdf0e10cSrcweir                         if (xCD.is() && toHanja) { // System dictionary would not do Hanja_to_Hangul conversion.
268cdf0e10cSrcweir                             candidates = xCD->getConversions(aText, start + nStartPos, len, eDirection, nConversionOptions);
269cdf0e10cSrcweir                             result.Candidates += candidates;
270cdf0e10cSrcweir                         }
271cdf0e10cSrcweir                     } else if (! toHanja) { // do whole word character 2 character conversion for Hanja to Hangul conversion
272cdf0e10cSrcweir                         result.Candidates = getCharConversions(aText, nStartPos + start, length - start, toHanja);
273cdf0e10cSrcweir                         if (result.Candidates.hasElements())
274cdf0e10cSrcweir                             len = result.Candidates[0].getLength();
275cdf0e10cSrcweir                     }
276cdf0e10cSrcweir                     if (result.Candidates.hasElements())
277cdf0e10cSrcweir                         break;
278cdf0e10cSrcweir                 }
279cdf0e10cSrcweir             }
280cdf0e10cSrcweir             // found match
281cdf0e10cSrcweir             if (result.Candidates.hasElements()) {
282cdf0e10cSrcweir                 result.Boundary.startPos = start + nStartPos;;
283cdf0e10cSrcweir                 result.Boundary.endPos = start + len + nStartPos;
284cdf0e10cSrcweir                 return result;
285cdf0e10cSrcweir             }
286cdf0e10cSrcweir         }
287cdf0e10cSrcweir     } else
288cdf0e10cSrcweir         throw NoSupportException(); // Conversion type is not supported in this service.
289cdf0e10cSrcweir     return result;
290cdf0e10cSrcweir }
291cdf0e10cSrcweir 
292cdf0e10cSrcweir OUString SAL_CALL
getConversion(const OUString & aText,sal_Int32 nStartPos,sal_Int32 nLength,const Locale & aLocale,sal_Int16 nConversionType,sal_Int32 nConversionOptions)293cdf0e10cSrcweir TextConversion_ko::getConversion( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
294cdf0e10cSrcweir     const Locale& aLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions)
295cdf0e10cSrcweir     throw(  RuntimeException, IllegalArgumentException, NoSupportException )
296cdf0e10cSrcweir {
297cdf0e10cSrcweir     sal_Int32 length = aText.getLength() - nStartPos;
298cdf0e10cSrcweir 
299cdf0e10cSrcweir     if (length <= 0 || nStartPos < 0)
300cdf0e10cSrcweir         return OUString();
301cdf0e10cSrcweir     else if (length > nLength)
302cdf0e10cSrcweir         length = nLength;
303cdf0e10cSrcweir 
304cdf0e10cSrcweir     OUStringBuffer aBuf(length + 1);
305cdf0e10cSrcweir     TextConversionResult result;
306cdf0e10cSrcweir     const sal_Unicode *str = aText.getStr();
307cdf0e10cSrcweir 
308cdf0e10cSrcweir     for (sal_Int32 start = nStartPos; length + nStartPos > start; start = result.Boundary.endPos) {
309cdf0e10cSrcweir 
310cdf0e10cSrcweir         result = getConversions(aText, start, length + nStartPos - start, aLocale, nConversionType, nConversionOptions);
311cdf0e10cSrcweir 
312cdf0e10cSrcweir         if (result.Boundary.endPos > 0) {
313cdf0e10cSrcweir             if (result.Boundary.startPos > start)
314cdf0e10cSrcweir                 aBuf.append(str + start, result.Boundary.startPos - start); // append skip portion
315cdf0e10cSrcweir             aBuf.append(result.Candidates[0]); // append converted portion
316cdf0e10cSrcweir         } else {
317cdf0e10cSrcweir             if (length + nStartPos > start)
318cdf0e10cSrcweir                 aBuf.append(str + start, length + nStartPos - start); // append last portion
319cdf0e10cSrcweir             break;
320cdf0e10cSrcweir         }
321cdf0e10cSrcweir     }
322cdf0e10cSrcweir 
323cdf0e10cSrcweir     return aBuf.makeStringAndClear();
324cdf0e10cSrcweir }
325cdf0e10cSrcweir 
326cdf0e10cSrcweir OUString SAL_CALL
getConversionWithOffset(const OUString & aText,sal_Int32 nStartPos,sal_Int32 nLength,const Locale & rLocale,sal_Int16 nConversionType,sal_Int32 nConversionOptions,Sequence<sal_Int32> & offset)327cdf0e10cSrcweir TextConversion_ko::getConversionWithOffset( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
328cdf0e10cSrcweir     const Locale& rLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions, Sequence<sal_Int32>& offset)
329cdf0e10cSrcweir     throw(  RuntimeException, IllegalArgumentException, NoSupportException )
330cdf0e10cSrcweir {
331cdf0e10cSrcweir     offset.realloc(0);
332cdf0e10cSrcweir     return getConversion(aText, nStartPos, nLength, rLocale, nConversionType, nConversionOptions);
333cdf0e10cSrcweir }
334cdf0e10cSrcweir 
335cdf0e10cSrcweir sal_Bool SAL_CALL
interactiveConversion(const Locale &,sal_Int16,sal_Int32)336cdf0e10cSrcweir TextConversion_ko::interactiveConversion( const Locale& /*rLocale*/, sal_Int16 /*nTextConversionType*/, sal_Int32 /*nTextConversionOptions*/ )
337cdf0e10cSrcweir     throw(  RuntimeException, IllegalArgumentException, NoSupportException )
338cdf0e10cSrcweir {
339cdf0e10cSrcweir     return sal_True;
340cdf0e10cSrcweir }
341cdf0e10cSrcweir 
342cdf0e10cSrcweir } } } }
343