1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _I18N_TEXTCONVERSION_KO_HXX_
20 #define _I18N_TEXTCONVERSION_KO_HXX_
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>
31 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
33 // ----------------------------------------------------
34 // class TextConversion
35 // ----------------------------------------------------
36 class TextConversion
: public cppu::WeakImplHelper2
38 com::sun::star::i18n::XExtendedTextConversion
,
39 com::sun::star::lang::XServiceInfo
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;
76 getImplementationName()
77 throw( com::sun::star::uno::RuntimeException
);
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
);
85 const sal_Char
* implementationName
;
86 #ifndef DISABLE_DYNLOADING
88 oslGenericFunction SAL_CALL
getFunctionBySymbol(const sal_Char
* func
);
92 // for Hangul2Hanja conversion
99 // ----------------------------------------------------
100 // class TextConversion_ko
101 // ----------------------------------------------------
102 class TextConversion_ko
: public TextConversion
105 TextConversion_ko( const com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>& rxContext
);
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
);
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
);
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
);
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
);
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
);
148 // ----------------------------------------------------
149 // class TextConversion_zh
150 // ----------------------------------------------------
152 // for SChines/TChinese word conversion
158 class TextConversion_zh
: public TextConversion
161 TextConversion_zh( const com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>& rxContext
);
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
);
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
);
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
);
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
);
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
;
208 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */