Branch data 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 <cppuhelper/implbase2.hxx> // helper for implementations
28 : : #include <osl/module.h>
29 : :
30 : : namespace com { namespace sun { namespace star { namespace i18n {
31 : :
32 : : // ----------------------------------------------------
33 : : // class TextConversion
34 : : // ----------------------------------------------------
35 : : class TextConversion: public cppu::WeakImplHelper2
36 : : <
37 : : com::sun::star::i18n::XExtendedTextConversion,
38 : : com::sun::star::lang::XServiceInfo
39 : : >
40 : : {
41 : : public:
42 : : TextConversion();
43 : : ~TextConversion();
44 : : // Methods
45 : : virtual com::sun::star::i18n::TextConversionResult SAL_CALL
46 : : getConversions( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
47 : : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
48 : : sal_Int32 nTextConversionOptions )
49 : : throw( com::sun::star::uno::RuntimeException,
50 : : com::sun::star::lang::IllegalArgumentException,
51 : : com::sun::star::lang::NoSupportException ) = 0;
52 : : virtual rtl::OUString SAL_CALL
53 : : getConversion( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
54 : : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
55 : : sal_Int32 nTextConversionOptions )
56 : : throw( com::sun::star::uno::RuntimeException,
57 : : com::sun::star::lang::IllegalArgumentException,
58 : : com::sun::star::lang::NoSupportException ) = 0;
59 : : virtual rtl::OUString SAL_CALL
60 : : getConversionWithOffset( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
61 : : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
62 : : sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset )
63 : : throw( com::sun::star::uno::RuntimeException,
64 : : com::sun::star::lang::IllegalArgumentException,
65 : : com::sun::star::lang::NoSupportException ) = 0;
66 : : virtual sal_Bool SAL_CALL
67 : : interactiveConversion(const ::com::sun::star::lang::Locale& aLocale,
68 : : sal_Int16 nTextConversionType, sal_Int32 nTextConversionOptions )
69 : : throw( com::sun::star::uno::RuntimeException,
70 : : com::sun::star::lang::IllegalArgumentException,
71 : : com::sun::star::lang::NoSupportException ) = 0;
72 : :
73 : : //XServiceInfo
74 : : rtl::OUString SAL_CALL
75 : : getImplementationName()
76 : : throw( com::sun::star::uno::RuntimeException );
77 : : sal_Bool SAL_CALL
78 : : supportsService(const rtl::OUString& ServiceName)
79 : : throw( com::sun::star::uno::RuntimeException );
80 : : com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
81 : : getSupportedServiceNames()
82 : : throw( com::sun::star::uno::RuntimeException );
83 : : protected :
84 : : const sal_Char* implementationName;
85 : : oslModule hModule;
86 : : oslGenericFunction SAL_CALL getFunctionBySymbol(const sal_Char* func);
87 : : };
88 : :
89 : : // for Hangul2Hanja conversion
90 : : typedef struct {
91 : : sal_Unicode code;
92 : : sal_Int16 address;
93 : : sal_Int16 count;
94 : : } Hangul_Index;
95 : :
96 : : // ----------------------------------------------------
97 : : // class TextConversion_ko
98 : : // ----------------------------------------------------
99 [ # # ]: 0 : class TextConversion_ko : public TextConversion
100 : : {
101 : : public:
102 : : TextConversion_ko( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
103 : :
104 : : // Methods
105 : : com::sun::star::i18n::TextConversionResult SAL_CALL
106 : : getConversions( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
107 : : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
108 : : sal_Int32 nTextConversionOptions )
109 : : throw( com::sun::star::uno::RuntimeException,
110 : : com::sun::star::lang::IllegalArgumentException,
111 : : com::sun::star::lang::NoSupportException );
112 : : rtl::OUString SAL_CALL
113 : : getConversion( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
114 : : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
115 : : sal_Int32 nTextConversionOptions )
116 : : throw( com::sun::star::uno::RuntimeException,
117 : : com::sun::star::lang::IllegalArgumentException,
118 : : com::sun::star::lang::NoSupportException );
119 : : rtl::OUString SAL_CALL
120 : : getConversionWithOffset( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
121 : : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
122 : : sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset )
123 : : throw( com::sun::star::uno::RuntimeException,
124 : : com::sun::star::lang::IllegalArgumentException,
125 : : com::sun::star::lang::NoSupportException );
126 : : sal_Bool SAL_CALL
127 : : interactiveConversion(const ::com::sun::star::lang::Locale& aLocale,
128 : : sal_Int16 nTextConversionType,
129 : : sal_Int32 nTextConversionOptions )
130 : : throw( com::sun::star::uno::RuntimeException,
131 : : com::sun::star::lang::IllegalArgumentException,
132 : : com::sun::star::lang::NoSupportException );
133 : :
134 : : private :
135 : : // Hangul/Hanja system dictionary
136 : : com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionary > xCD;
137 : : // Hangul/Hanja user defined dictionary list
138 : : com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionaryList > xCDL;
139 : : sal_Int32 maxLeftLength;
140 : : sal_Int32 maxRightLength;
141 : : com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
142 : : getCharConversions(const rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toHanja);
143 : : };
144 : :
145 : : // ----------------------------------------------------
146 : : // class TextConversion_zh
147 : : // ----------------------------------------------------
148 : :
149 : : // for SChines/TChinese word conversion
150 : : typedef struct {
151 : : sal_uInt16 start;
152 : : sal_Int16 count;
153 : : } STC_WordIndex;
154 : :
155 [ # # ]: 0 : class TextConversion_zh : public TextConversion
156 : : {
157 : : public:
158 : : TextConversion_zh( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
159 : :
160 : : // Methods
161 : : com::sun::star::i18n::TextConversionResult SAL_CALL
162 : : getConversions( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
163 : : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
164 : : sal_Int32 nTextConversionOptions )
165 : : throw( com::sun::star::uno::RuntimeException,
166 : : com::sun::star::lang::IllegalArgumentException,
167 : : com::sun::star::lang::NoSupportException );
168 : : rtl::OUString SAL_CALL
169 : : getConversion( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
170 : : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
171 : : sal_Int32 nTextConversionOptions )
172 : : throw( com::sun::star::uno::RuntimeException,
173 : : com::sun::star::lang::IllegalArgumentException,
174 : : com::sun::star::lang::NoSupportException );
175 : : rtl::OUString SAL_CALL
176 : : getConversionWithOffset( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
177 : : const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
178 : : sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset )
179 : : throw( com::sun::star::uno::RuntimeException,
180 : : com::sun::star::lang::IllegalArgumentException,
181 : : com::sun::star::lang::NoSupportException );
182 : : sal_Bool SAL_CALL
183 : : interactiveConversion(const ::com::sun::star::lang::Locale& aLocale,
184 : : sal_Int16 nTextConversionType,
185 : : sal_Int32 nTextConversionOptions )
186 : : throw( com::sun::star::uno::RuntimeException,
187 : : com::sun::star::lang::IllegalArgumentException,
188 : : com::sun::star::lang::NoSupportException );
189 : : private :
190 : : // user defined dictionary list
191 : : com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionaryList > xCDL;
192 : : rtl::OUString SAL_CALL getWordConversion(const ::rtl::OUString& aText,
193 : : sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toSChinese, sal_Int32 nConversionOptions, com::sun::star::uno::Sequence <sal_Int32>& offset);
194 : : rtl:: OUString SAL_CALL getCharConversion(const rtl:: OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toSChinese, sal_Int32 nConversionOptions);
195 : : com::sun::star::lang::Locale aLocale;
196 : : };
197 : :
198 : : } // i18n
199 : : } // star
200 : : } // sun
201 : : } // com
202 : :
203 : : #endif
204 : :
205 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|