1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24#ifndef __com_sun_star_linguistic2_XLanguageGuessing_idl__
25#define __com_sun_star_linguistic2_XLanguageGuessing_idl__
26
27#ifndef _COM_SUN_STAR_UNO_XINTERFACE_idl_
28#include <com/sun/star/uno/XInterface.idl>
29#endif
30#ifndef _COM_SUN_STAR_LANG_LOCALE_idl_
31#include <com/sun/star/lang/Locale.idl>
32#endif
33#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_IDL_
34#include <com/sun/star/lang/IllegalArgumentException.idl>
35#endif
36
37module com { module sun { module star { module linguistic2 {
38
39/** This interface allows to guess the language of a text
40
41    <p> The current set of supported languages is:
42    <ul>
43        <li>af : Afrikaans</li>
44        <li>am : Amharic</li>
45        <li>ar : Arabic</li>
46        <li>be : Belarus</li>
47        <li>br : Breton</li>
48        <li>bs : Bosnian</li>
49        <li>ca : Catalan</li>
50        <li>cs : Czech</li>
51        <li>cy : Welsh</li>
52        <li>da : Danish</li>
53        <li>de : German</li>
54        <li>drt : Drents</li>
55        <li>el : Greek</li>
56        <li>en : English</li>
57        <li>eo : Esperanto</li>
58        <li>es : Spanish</li>
59        <li>et : Estonian</li>
60        <li>eu : Basque</li>
61        <li>fa : Persian</li>
62        <li>fi : Finnish</li>
63        <li>fr : French</li>
64        <li>fy : Frisian</li>
65        <li>ga : Irish Gaelic</li>
66        <li>gd : Scots Gaelic</li>
67        <li>gv : Manx Gaelic</li>
68        <li>he : Hebrew</li>
69        <li>hi : Hindi</li>
70        <li>hr : Croatian</li>
71        <li>hu : Hungarian</li>
72        <li>hy : Armenian</li>
73        <li>id : Indonesian</li>
74        <li>is : Icelandic</li>
75        <li>it : Italian</li>
76        <li>ja : Japanese</li>
77        <li>ka : Georgian</li>
78        <li>ko : Korean</li>
79        <li>la : Latin</li>
80        <li>lb : Luxembourgish (added with OpenOffice 3.3)</li>
81        <li>lt : Lithuanian</li>
82        <li>lv : Latvian</li>
83        <li>mr : Marathi</li>
84        <li>ms : Malay</li>
85        <li>ne : Nepali</li>
86        <li>nl : Dutch</li>
87        <li>nb : Norwegian (Bokmal)</li>
88        <li>pl : Polish</li>
89        <li>pt-PT : Portuguese (Portugal)</li>
90        <li>qu : Quechua</li>
91        <li>rm : Romansh</li>
92        <li>ro : Romanian</li>
93        <li>ru : Russian</li>
94        <li>sa : Sanskrit</li>
95        <li>sco : Scots</li>
96        <li>sh : Serbian (written with latin characters)</li>
97        <li>sk-SK : Slovak (written with latin characters)</li>
98        <li>sl : Slovenian</li>
99        <li>sq : Albanian</li>
100        <li>sr : Serbian (written with cyrillic characters) (added with OpenOffice 3.4)</li>
101        <li>sv : Swedish</li>
102        <li>sw : Swahili</li>
103        <li>ta : Tamil</li>
104        <li>th : Thai</li>
105        <li>tl : Tagalog</li>
106        <li>tr : Turkish</li>
107        <li>uk : Ukrainian</li>
108        <li>vi : Vietnamese</li>
109        <li>yi : Yiddish</li>
110        <li>zh-CN : Chinese (simplified)</li>
111        <li>zh-TW : Chinese (traditional)</li>
112    </ul>
113
114    </p>
115
116    @since OpenOffice 2.2
117 */
118interface XLanguageGuessing
119{
120    //-------------------------------------------------------------------------
121    /** determines the single most probable language of a sub-string.
122
123        <p>Please note that because statistical analysis is part
124        of the algorithm the the likelihood to get the correct
125        result increases with the length of the sub-string.
126        A word is much less likely guessed correctly compared to
127        a sentence or even a whole paragraph.</p>
128
129        <p>Also note that some languages are that 'close' to each other
130        that it will be quite unlikely to find a difference in them,
131        e.g. English (UK), English (IE) and English (AUS) and
132        most liklely English (US) as well. And thus the result may
133        be arbitrary.</p>
134
135        @returns
136            the locale for the language identified.
137            If no language could be identified the locale will be empty.
138
139        @param  aText
140            all the text including the part that should checked.
141
142        @param nStartPos
143            specifies the starting index of the sub-string to be checked
144            The value must met 0 <= nStartPos < (length of text - 1).
145
146        @param nLen
147            specifies the length of the sub-string to be checked.
148            The value must met 0 <= nLen <= (length of text).
149
150        @see    <type scope="com::sun::star::lang">Locale</type>
151     */
152    com::sun::star::lang::Locale    guessPrimaryLanguage(
153            [in] string  aText,
154            [in] long    nStartPos,
155            [in] long    nLen )
156        raises( com::sun::star::lang::IllegalArgumentException );
157
158    //-------------------------------------------------------------------------
159    /** allows to explicitly discard some languages from the set of
160        languages possibly returned.
161
162        <p>By default all languages are enabled.</p>
163    */
164    void disableLanguages(
165            [in] sequence< com::sun::star::lang::Locale > aLanguages )
166        raises( com::sun::star::lang::IllegalArgumentException );
167
168    //-------------------------------------------------------------------------
169    /** allows to explicitly re-enable some languages that got previously
170        disabled.
171
172        <p>By default all languages are enabled.</p>
173    */
174    void enableLanguages(
175            [in] sequence< com::sun::star::lang::Locale > aLanguages )
176        raises( com::sun::star::lang::IllegalArgumentException );
177
178    //-------------------------------------------------------------------------
179    /** returns a list of all supported languages.
180
181        <p>This should be the same as the mathematical union of
182        all enabled and disabled languages.</p>
183    */
184    sequence< com::sun::star::lang::Locale > getAvailableLanguages();
185
186    //-------------------------------------------------------------------------
187    /** returns the list of all enabled languages
188    */
189    sequence< com::sun::star::lang::Locale > getEnabledLanguages();
190
191    //-------------------------------------------------------------------------
192    /** returns the list of all disabled languages
193    */
194    sequence< com::sun::star::lang::Locale > getDisabledLanguages();
195
196};
197
198}; }; }; };
199
200#endif
201
202