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