Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _I18N_TEXTCONVERSION_KO_HXX_
20 : #define _I18N_TEXTCONVERSION_KO_HXX_
21 :
22 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
23 : #include <com/sun/star/lang/XServiceInfo.hpp>
24 : #include <com/sun/star/i18n/XExtendedTextConversion.hpp>
25 : #include <com/sun/star/linguistic2/XConversionDictionary.hpp>
26 : #include <com/sun/star/linguistic2/XConversionDictionaryList.hpp>
27 : #include <com/sun/star/uno/XComponentContext.hpp>
28 : #include <cppuhelper/implbase2.hxx> // helper for implementations
29 : #include <osl/module.h>
30 :
31 : namespace com { namespace sun { namespace star { namespace i18n {
32 :
33 : // ----------------------------------------------------
34 : // class TextConversion
35 : // ----------------------------------------------------
36 : class TextConversion: public cppu::WeakImplHelper2
37 : <
38 : com::sun::star::i18n::XExtendedTextConversion,
39 : com::sun::star::lang::XServiceInfo
40 : >
41 : {
42 : public:
43 : TextConversion();
44 : ~TextConversion();
45 : // Methods
46 : virtual com::sun::star::i18n::TextConversionResult SAL_CALL
47 : getConversions( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
48 : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
49 : sal_Int32 nTextConversionOptions )
50 : throw( com::sun::star::uno::RuntimeException,
51 : com::sun::star::lang::IllegalArgumentException,
52 : com::sun::star::lang::NoSupportException ) = 0;
53 : virtual OUString SAL_CALL
54 : getConversion( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
55 : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
56 : sal_Int32 nTextConversionOptions )
57 : throw( com::sun::star::uno::RuntimeException,
58 : com::sun::star::lang::IllegalArgumentException,
59 : com::sun::star::lang::NoSupportException ) = 0;
60 : virtual OUString SAL_CALL
61 : getConversionWithOffset( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
62 : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
63 : sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset )
64 : throw( com::sun::star::uno::RuntimeException,
65 : com::sun::star::lang::IllegalArgumentException,
66 : com::sun::star::lang::NoSupportException ) = 0;
67 : virtual sal_Bool SAL_CALL
68 : interactiveConversion(const ::com::sun::star::lang::Locale& aLocale,
69 : sal_Int16 nTextConversionType, sal_Int32 nTextConversionOptions )
70 : throw( com::sun::star::uno::RuntimeException,
71 : com::sun::star::lang::IllegalArgumentException,
72 : com::sun::star::lang::NoSupportException ) = 0;
73 :
74 : //XServiceInfo
75 : OUString SAL_CALL
76 : getImplementationName()
77 : throw( com::sun::star::uno::RuntimeException );
78 : sal_Bool SAL_CALL
79 : supportsService(const OUString& ServiceName)
80 : throw( com::sun::star::uno::RuntimeException );
81 : com::sun::star::uno::Sequence< OUString > SAL_CALL
82 : getSupportedServiceNames()
83 : throw( com::sun::star::uno::RuntimeException );
84 : protected :
85 : const sal_Char* implementationName;
86 : #ifndef DISABLE_DYNLOADING
87 : oslModule hModule;
88 : oslGenericFunction SAL_CALL getFunctionBySymbol(const sal_Char* func);
89 : #endif
90 : };
91 :
92 : // for Hangul2Hanja conversion
93 : typedef struct {
94 : sal_Unicode code;
95 : sal_Int16 address;
96 : sal_Int16 count;
97 : } Hangul_Index;
98 :
99 : // ----------------------------------------------------
100 : // class TextConversion_ko
101 : // ----------------------------------------------------
102 0 : class TextConversion_ko : public TextConversion
103 : {
104 : public:
105 : TextConversion_ko( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext );
106 :
107 : // Methods
108 : com::sun::star::i18n::TextConversionResult SAL_CALL
109 : getConversions( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
110 : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
111 : sal_Int32 nTextConversionOptions )
112 : throw( com::sun::star::uno::RuntimeException,
113 : com::sun::star::lang::IllegalArgumentException,
114 : com::sun::star::lang::NoSupportException );
115 : OUString SAL_CALL
116 : getConversion( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
117 : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
118 : sal_Int32 nTextConversionOptions )
119 : throw( com::sun::star::uno::RuntimeException,
120 : com::sun::star::lang::IllegalArgumentException,
121 : com::sun::star::lang::NoSupportException );
122 : OUString SAL_CALL
123 : getConversionWithOffset( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
124 : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
125 : sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset )
126 : throw( com::sun::star::uno::RuntimeException,
127 : com::sun::star::lang::IllegalArgumentException,
128 : com::sun::star::lang::NoSupportException );
129 : sal_Bool SAL_CALL
130 : interactiveConversion(const ::com::sun::star::lang::Locale& aLocale,
131 : sal_Int16 nTextConversionType,
132 : sal_Int32 nTextConversionOptions )
133 : throw( com::sun::star::uno::RuntimeException,
134 : com::sun::star::lang::IllegalArgumentException,
135 : com::sun::star::lang::NoSupportException );
136 :
137 : private :
138 : // Hangul/Hanja system dictionary
139 : com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionary > xCD;
140 : // Hangul/Hanja user defined dictionary list
141 : com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionaryList > xCDL;
142 : sal_Int32 maxLeftLength;
143 : sal_Int32 maxRightLength;
144 : com::sun::star::uno::Sequence< OUString > SAL_CALL
145 : getCharConversions(const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toHanja);
146 : };
147 :
148 : // ----------------------------------------------------
149 : // class TextConversion_zh
150 : // ----------------------------------------------------
151 :
152 : // for SChines/TChinese word conversion
153 : typedef struct {
154 : sal_uInt16 start;
155 : sal_Int16 count;
156 : } STC_WordIndex;
157 :
158 0 : class TextConversion_zh : public TextConversion
159 : {
160 : public:
161 : TextConversion_zh( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext );
162 :
163 : // Methods
164 : com::sun::star::i18n::TextConversionResult SAL_CALL
165 : getConversions( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
166 : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
167 : sal_Int32 nTextConversionOptions )
168 : throw( com::sun::star::uno::RuntimeException,
169 : com::sun::star::lang::IllegalArgumentException,
170 : com::sun::star::lang::NoSupportException );
171 : OUString SAL_CALL
172 : getConversion( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
173 : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
174 : sal_Int32 nTextConversionOptions )
175 : throw( com::sun::star::uno::RuntimeException,
176 : com::sun::star::lang::IllegalArgumentException,
177 : com::sun::star::lang::NoSupportException );
178 : OUString SAL_CALL
179 : getConversionWithOffset( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
180 : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
181 : sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset )
182 : throw( com::sun::star::uno::RuntimeException,
183 : com::sun::star::lang::IllegalArgumentException,
184 : com::sun::star::lang::NoSupportException );
185 : sal_Bool SAL_CALL
186 : interactiveConversion(const ::com::sun::star::lang::Locale& aLocale,
187 : sal_Int16 nTextConversionType,
188 : sal_Int32 nTextConversionOptions )
189 : throw( com::sun::star::uno::RuntimeException,
190 : com::sun::star::lang::IllegalArgumentException,
191 : com::sun::star::lang::NoSupportException );
192 : private :
193 : // user defined dictionary list
194 : com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionaryList > xCDL;
195 : OUString SAL_CALL getWordConversion(const OUString& aText,
196 : sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toSChinese, sal_Int32 nConversionOptions, com::sun::star::uno::Sequence <sal_Int32>& offset);
197 : rtl:: OUString SAL_CALL getCharConversion(const rtl:: OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toSChinese, sal_Int32 nConversionOptions);
198 : com::sun::star::lang::Locale aLocale;
199 : };
200 :
201 : } // i18n
202 : } // star
203 : } // sun
204 : } // com
205 :
206 : #endif
207 :
208 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|