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