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