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#ifndef __com_sun_star_linguistic2_XConversionDictionary_idl__
28#define __com_sun_star_linguistic2_XConversionDictionary_idl__
29
30
31#ifndef __com_sun_star_uno_XInterface_idl__
32#include <com/sun/star/uno/XInterface.idl>
33#endif
34
35#ifndef __com_sun_star_lang_Locale_idl__
36#include <com/sun/star/lang/Locale.idl>
37#endif
38
39#ifndef __com_sun_star_linguistic2_ConversionDictionaryType_idl__
40#include <com/sun/star/linguistic2/ConversionDictionaryType.idl>
41#endif
42
43#ifndef __com_sun_star_linguistic2_ConversionDirection_idl__
44#include <com/sun/star/linguistic2/ConversionDirection.idl>
45#endif
46
47#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
48#include <com/sun/star/lang/IllegalArgumentException.idl>
49#endif
50
51#ifndef __com_sun_star_container_ElementExistException_idl__
52#include <com/sun/star/container/ElementExistException.idl>
53#endif
54
55#ifndef __com_sun_star_container_NoSuchElementException_idl__
56#include <com/sun/star/container/NoSuchElementException.idl>
57#endif
58
59
60//=============================================================================
61
62module com { module sun { module star { module linguistic2 {
63
64//=============================================================================
65/** Allows the user to access a conversion dictionary.
66
67    <p>The dictionary consists of entries (pairs) of the form
68    ( aLeftText, aRightText ).
69    Those pairs can be added and removed. Also it can be looked
70    for all entries where the left text or the right text matches
71    a given text. Thus it can be used for conversions in both
72    directions.</p>
73
74    <p>Restrictions to what has to be the left and right text are usually
75    given by specific services implementing this interface.</p>
76
77    @see com::sun::star::linguistic2::ConversionDictionary
78    @see com::sun::star::linguistic2::HangulHanjaConversionDictionary
79
80	 @since OOo 1.1.2
81*/
82published interface XConversionDictionary : com::sun::star::uno::XInterface
83{
84    //-------------------------------------------------------------------------
85    /**
86        @returns
87            the name of the dictionary.
88    */
89    string getName();
90
91    //-------------------------------------------------------------------------
92    /**
93        @returns
94            the language supported by the dictionary.
95
96        @see    com::sun::star::lang::Locale
97    */
98    com::sun::star::lang::Locale getLocale();
99
100    //-------------------------------------------------------------------------
101    /**
102        @returns
103            the conversion type supported by the dictionary.
104
105        @see    com::sun::star::linguistic2::ConversionDictionaryType
106    */
107    short getConversionType();
108
109    //-------------------------------------------------------------------------
110    /** specifies whether the dictionary should be used or not .
111
112        @param  bAcvtivate
113            <TRUE/> if the dictionary should be used, <FALSE/> otherwise.
114
115    */
116    void setActive( [in] boolean bActivate );
117
118    //-------------------------------------------------------------------------
119    /**
120        @returns
121            <TRUE/> if the dictionary is active, <FALSE/> otherwise.
122    */
123    boolean isActive();
124
125    //-------------------------------------------------------------------------
126    /** removes all entries from the dictionary.
127    */
128    void clear();
129
130    //-------------------------------------------------------------------------
131    /** searches for entries or conversions that match the given text.
132
133        <p>The exact string to be looked for is the substring from the
134        aText parameter that starts at position nStartPos and has the
135        length nLength.</p>
136
137        @returns
138            the list of conversions found for the supplied text.
139            If no nothing was found, it is empty.
140
141        @param  aText
142            the text where the substring to be looked for will be taken from.
143            Depending on the conversion direction parameter it specifies
144            either the left text or the right text to look for.
145        @param  nStartPos
146            the starting pos of the substring to be looked for.
147        @param  nLength
148            the length of the substring to be looked for.
149
150        @param eConversionDirection
151            specifies the direction of the conversion to look for.
152            It is one of
153            <type scope="com::sun::star::linguistic2">ConversionDirection</type>.
154
155        @param nTextConversionOptions
156            Combination of <type scope="com::sun::star::i18n">TextConversionOption</type>
157            values.
158
159        @throws com::sun::star::lang::IllegalArgumentException
160            if the locale is not supported by the dictionary or if
161            nTextConversionOptions is invalid for the given locale.
162    */
163    sequence< string > getConversions(
164            [in] string aText,
165            [in] long nStartPos,
166            [in] long nLength,
167            [in] com::sun::star::linguistic2::ConversionDirection eDirection,
168            [in] long nTextConversionOptions )
169        raises( com::sun::star::lang::IllegalArgumentException );
170
171    //-------------------------------------------------------------------------
172    /** is used to add a conversion pair to the dictionary.
173
174        @param  aLeftText
175            the left text of the pair to be added.
176
177        @param  aRightText
178            the right text of the pair to be added.
179
180        @throws com::sun::star::lang::IllegalArgumentException
181            if the arguments are invalid.
182            For example if the specifications defined by the service
183            implementing this object are not met.
184
185        @throws com::sun::star::container::ElementExistException
186            if such an entry already exists.
187    */
188    void addEntry(
189            [in] string     aLeftText,
190            [in] string     aRightText )
191        raises( com::sun::star::lang::IllegalArgumentException,
192                com::sun::star::container::ElementExistException);
193
194    //-------------------------------------------------------------------------
195    /** removes a conversion pair from the dictionary.
196
197        @param  aLeftText
198            the left text of the pair to be removed.
199
200        @param  aRightText
201            the right text of the pair to be removed.
202
203        @throws com::sun::star::container::NoSuchElementException
204            if there is no such entry.
205    */
206    void removeEntry(
207            [in] string     aLeftText,
208            [in] string     aRightText )
209        raises( com::sun::star::container::NoSuchElementException );
210
211    //-------------------------------------------------------------------------
212    /** returns the maximum number of characters used as left or right text
213        in entries.
214
215        @param eDirection
216            specifies if the left text or the right text of entries will
217            be used.
218
219        @see com::sun::star::linguistic2::ConversionDirection
220    */
221    short getMaxCharCount(
222            [in] com::sun::star::linguistic2::ConversionDirection eDirection );
223
224    //-------------------------------------------------------------------------
225    /**
226        @returns
227            a list of all left or right parts of the dictionaries entries.
228        @param  eDirection
229            specifies if all left or all right parts of the entries
230            should be returned.
231    */
232
233    sequence< string > getConversionEntries(
234            [in] com::sun::star::linguistic2::ConversionDirection eDirection );
235
236};
237
238//=============================================================================
239
240}; }; }; };
241
242#endif
243
244