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 INCLUDED_I18NPOOL_INC_TEXTCONVERSION_HXX
20 #define INCLUDED_I18NPOOL_INC_TEXTCONVERSION_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>
29 #include <osl/module.h>
31 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
34 // class TextConversionService
36 class TextConversionService
: public cppu::WeakImplHelper2
38 com::sun::star::i18n::XExtendedTextConversion
,
39 com::sun::star::lang::XServiceInfo
43 TextConversionService(const char* pImplName
);
44 virtual ~TextConversionService();
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
, std::exception
) SAL_OVERRIDE
= 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
, std::exception
) SAL_OVERRIDE
= 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
, std::exception
) SAL_OVERRIDE
= 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
, std::exception
) SAL_OVERRIDE
= 0;
76 getImplementationName()
77 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
79 supportsService(const OUString
& ServiceName
)
80 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
81 com::sun::star::uno::Sequence
< OUString
> SAL_CALL
82 getSupportedServiceNames()
83 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
85 const sal_Char
* implementationName
;
87 #ifndef DISABLE_DYNLOADING
89 oslGenericFunction SAL_CALL
getFunctionBySymbol(const sal_Char
* func
);
93 // for Hangul2Hanja conversion
101 // class TextConversion_ko
103 class TextConversion_ko
: public TextConversionService
106 TextConversion_ko( const com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>& rxContext
);
109 com::sun::star::i18n::TextConversionResult SAL_CALL
110 getConversions( const OUString
& aText
, sal_Int32 nStartPos
, sal_Int32 nLength
,
111 const ::com::sun::star::lang::Locale
& aLocale
, sal_Int16 nTextConversionType
,
112 sal_Int32 nTextConversionOptions
)
113 throw( com::sun::star::uno::RuntimeException
,
114 com::sun::star::lang::IllegalArgumentException
,
115 com::sun::star::lang::NoSupportException
, std::exception
) SAL_OVERRIDE
;
117 getConversion( const 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
, std::exception
) SAL_OVERRIDE
;
124 getConversionWithOffset( const OUString
& aText
, sal_Int32 nStartPos
, sal_Int32 nLength
,
125 const ::com::sun::star::lang::Locale
& aLocale
, sal_Int16 nTextConversionType
,
126 sal_Int32 nTextConversionOptions
, com::sun::star::uno::Sequence
< sal_Int32
>& offset
)
127 throw( com::sun::star::uno::RuntimeException
,
128 com::sun::star::lang::IllegalArgumentException
,
129 com::sun::star::lang::NoSupportException
, std::exception
) SAL_OVERRIDE
;
131 interactiveConversion(const ::com::sun::star::lang::Locale
& aLocale
,
132 sal_Int16 nTextConversionType
,
133 sal_Int32 nTextConversionOptions
)
134 throw( com::sun::star::uno::RuntimeException
,
135 com::sun::star::lang::IllegalArgumentException
,
136 com::sun::star::lang::NoSupportException
, std::exception
) SAL_OVERRIDE
;
139 // Hangul/Hanja system dictionary
140 com::sun::star::uno::Reference
< com::sun::star::linguistic2::XConversionDictionary
> xCD
;
141 // Hangul/Hanja user defined dictionary list
142 com::sun::star::uno::Reference
< com::sun::star::linguistic2::XConversionDictionaryList
> xCDL
;
143 sal_Int32 maxLeftLength
;
144 sal_Int32 maxRightLength
;
145 com::sun::star::uno::Sequence
< OUString
> SAL_CALL
146 getCharConversions(const OUString
& aText
, sal_Int32 nStartPos
, sal_Int32 nLength
, bool toHanja
);
150 // class TextConversion_zh
153 // for SChines/TChinese word conversion
159 class TextConversion_zh
: public TextConversionService
162 TextConversion_zh( const com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>& rxContext
);
165 com::sun::star::i18n::TextConversionResult SAL_CALL
166 getConversions( const OUString
& aText
, sal_Int32 nStartPos
, sal_Int32 nLength
,
167 const ::com::sun::star::lang::Locale
& aLocale
, sal_Int16 nTextConversionType
,
168 sal_Int32 nTextConversionOptions
)
169 throw( com::sun::star::uno::RuntimeException
,
170 com::sun::star::lang::IllegalArgumentException
,
171 com::sun::star::lang::NoSupportException
, std::exception
) SAL_OVERRIDE
;
173 getConversion( const 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
, std::exception
) SAL_OVERRIDE
;
180 getConversionWithOffset( const OUString
& aText
, sal_Int32 nStartPos
, sal_Int32 nLength
,
181 const ::com::sun::star::lang::Locale
& aLocale
, sal_Int16 nTextConversionType
,
182 sal_Int32 nTextConversionOptions
, com::sun::star::uno::Sequence
< sal_Int32
>& offset
)
183 throw( com::sun::star::uno::RuntimeException
,
184 com::sun::star::lang::IllegalArgumentException
,
185 com::sun::star::lang::NoSupportException
, std::exception
) SAL_OVERRIDE
;
187 interactiveConversion(const ::com::sun::star::lang::Locale
& aLocale
,
188 sal_Int16 nTextConversionType
,
189 sal_Int32 nTextConversionOptions
)
190 throw( com::sun::star::uno::RuntimeException
,
191 com::sun::star::lang::IllegalArgumentException
,
192 com::sun::star::lang::NoSupportException
, std::exception
) SAL_OVERRIDE
;
194 // user defined dictionary list
195 com::sun::star::uno::Reference
< com::sun::star::linguistic2::XConversionDictionaryList
> xCDL
;
196 OUString SAL_CALL
getWordConversion(const OUString
& aText
,
197 sal_Int32 nStartPos
, sal_Int32 nLength
, bool toSChinese
, sal_Int32 nConversionOptions
, com::sun::star::uno::Sequence
<sal_Int32
>& offset
);
198 rtl:: OUString SAL_CALL
getCharConversion(const rtl:: OUString
& aText
, sal_Int32 nStartPos
, sal_Int32 nLength
, bool toSChinese
, sal_Int32 nConversionOptions
);
199 com::sun::star::lang::Locale aLocale
;
209 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */