update dev300-m58
[ooovba.git] / i18npool / inc / textconversion.hxx
blobcdcc37a235c7aab54e714b219a41daac0e625a93
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: textconversion.hxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _I18N_TEXTCONVERSION_KO_HXX_
31 #define _I18N_TEXTCONVERSION_KO_HXX_
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/i18n/XExtendedTextConversion.hpp>
36 #include <com/sun/star/linguistic2/XConversionDictionary.hpp>
37 #include <com/sun/star/linguistic2/XConversionDictionaryList.hpp>
38 #include <cppuhelper/implbase2.hxx> // helper for implementations
39 #include <osl/module.h>
41 namespace com { namespace sun { namespace star { namespace i18n {
43 // ----------------------------------------------------
44 // class TextConversion
45 // ----------------------------------------------------
46 class TextConversion: public cppu::WeakImplHelper2
48 com::sun::star::i18n::XExtendedTextConversion,
49 com::sun::star::lang::XServiceInfo
52 public:
53 TextConversion();
54 ~TextConversion();
55 // Methods
56 virtual com::sun::star::i18n::TextConversionResult SAL_CALL
57 getConversions( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
58 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
59 sal_Int32 nTextConversionOptions )
60 throw( com::sun::star::uno::RuntimeException,
61 com::sun::star::lang::IllegalArgumentException,
62 com::sun::star::lang::NoSupportException ) = 0;
63 virtual rtl::OUString SAL_CALL
64 getConversion( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
65 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
66 sal_Int32 nTextConversionOptions )
67 throw( com::sun::star::uno::RuntimeException,
68 com::sun::star::lang::IllegalArgumentException,
69 com::sun::star::lang::NoSupportException ) = 0;
70 virtual rtl::OUString SAL_CALL
71 getConversionWithOffset( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
72 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
73 sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset )
74 throw( com::sun::star::uno::RuntimeException,
75 com::sun::star::lang::IllegalArgumentException,
76 com::sun::star::lang::NoSupportException ) = 0;
77 virtual sal_Bool SAL_CALL
78 interactiveConversion(const ::com::sun::star::lang::Locale& aLocale,
79 sal_Int16 nTextConversionType, sal_Int32 nTextConversionOptions )
80 throw( com::sun::star::uno::RuntimeException,
81 com::sun::star::lang::IllegalArgumentException,
82 com::sun::star::lang::NoSupportException ) = 0;
84 //XServiceInfo
85 rtl::OUString SAL_CALL
86 getImplementationName()
87 throw( com::sun::star::uno::RuntimeException );
88 sal_Bool SAL_CALL
89 supportsService(const rtl::OUString& ServiceName)
90 throw( com::sun::star::uno::RuntimeException );
91 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
92 getSupportedServiceNames()
93 throw( com::sun::star::uno::RuntimeException );
94 protected :
95 const sal_Char* implementationName;
96 oslModule hModule;
97 oslGenericFunction SAL_CALL getFunctionBySymbol(const sal_Char* func);
100 // for Hangul2Hanja conversion
101 typedef struct {
102 sal_Unicode code;
103 sal_Int16 address;
104 sal_Int16 count;
105 } Hangul_Index;
107 // ----------------------------------------------------
108 // class TextConversion_ko
109 // ----------------------------------------------------
110 class TextConversion_ko : public TextConversion
112 public:
113 TextConversion_ko( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
115 // Methods
116 com::sun::star::i18n::TextConversionResult SAL_CALL
117 getConversions( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
118 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
119 sal_Int32 nTextConversionOptions )
120 throw( com::sun::star::uno::RuntimeException,
121 com::sun::star::lang::IllegalArgumentException,
122 com::sun::star::lang::NoSupportException );
123 rtl::OUString SAL_CALL
124 getConversion( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
125 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
126 sal_Int32 nTextConversionOptions )
127 throw( com::sun::star::uno::RuntimeException,
128 com::sun::star::lang::IllegalArgumentException,
129 com::sun::star::lang::NoSupportException );
130 rtl::OUString SAL_CALL
131 getConversionWithOffset( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
132 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
133 sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset )
134 throw( com::sun::star::uno::RuntimeException,
135 com::sun::star::lang::IllegalArgumentException,
136 com::sun::star::lang::NoSupportException );
137 sal_Bool SAL_CALL
138 interactiveConversion(const ::com::sun::star::lang::Locale& aLocale,
139 sal_Int16 nTextConversionType,
140 sal_Int32 nTextConversionOptions )
141 throw( com::sun::star::uno::RuntimeException,
142 com::sun::star::lang::IllegalArgumentException,
143 com::sun::star::lang::NoSupportException );
145 private :
146 // Hangul/Hanja system dictionary
147 com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionary > xCD;
148 // Hangul/Hanja user defined dictionary list
149 com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionaryList > xCDL;
150 sal_Int32 maxLeftLength;
151 sal_Int32 maxRightLength;
152 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
153 getCharConversions(const rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toHanja);
156 // ----------------------------------------------------
157 // class TextConversion_zh
158 // ----------------------------------------------------
160 // for SChines/TChinese word conversion
161 typedef struct {
162 sal_uInt16 start;
163 sal_Int16 count;
164 } STC_WordIndex;
166 class TextConversion_zh : public TextConversion
168 public:
169 TextConversion_zh( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
171 // Methods
172 com::sun::star::i18n::TextConversionResult SAL_CALL
173 getConversions( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
174 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
175 sal_Int32 nTextConversionOptions )
176 throw( com::sun::star::uno::RuntimeException,
177 com::sun::star::lang::IllegalArgumentException,
178 com::sun::star::lang::NoSupportException );
179 rtl::OUString SAL_CALL
180 getConversion( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
181 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
182 sal_Int32 nTextConversionOptions )
183 throw( com::sun::star::uno::RuntimeException,
184 com::sun::star::lang::IllegalArgumentException,
185 com::sun::star::lang::NoSupportException );
186 rtl::OUString SAL_CALL
187 getConversionWithOffset( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
188 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
189 sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset )
190 throw( com::sun::star::uno::RuntimeException,
191 com::sun::star::lang::IllegalArgumentException,
192 com::sun::star::lang::NoSupportException );
193 sal_Bool SAL_CALL
194 interactiveConversion(const ::com::sun::star::lang::Locale& aLocale,
195 sal_Int16 nTextConversionType,
196 sal_Int32 nTextConversionOptions )
197 throw( com::sun::star::uno::RuntimeException,
198 com::sun::star::lang::IllegalArgumentException,
199 com::sun::star::lang::NoSupportException );
200 private :
201 // user defined dictionary list
202 com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionaryList > xCDL;
203 rtl::OUString SAL_CALL getWordConversion(const ::rtl::OUString& aText,
204 sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toSChinese, sal_Int32 nConversionOptions, com::sun::star::uno::Sequence <sal_Int32>& offset);
205 rtl:: OUString SAL_CALL getCharConversion(const rtl:: OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toSChinese, sal_Int32 nConversionOptions);
206 com::sun::star::lang::Locale aLocale;
209 } // i18n
210 } // star
211 } // sun
212 } // com
214 #endif