xref: /aoo41x/main/offapi/com/sun/star/awt/XItemList.idl (revision cdf0e10c)
1/*************************************************************************
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * Copyright 2000, 2010 Oracle and/or its affiliates.
5 *
6 * OpenOffice.org - a multi-platform office productivity suite
7 *
8 * This file is part of OpenOffice.org.
9 *
10 * OpenOffice.org is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License version 3
12 * only, as published by the Free Software Foundation.
13 *
14 * OpenOffice.org is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU Lesser General Public License version 3 for more details
18 * (a copy is included in the LICENSE file that accompanied this code).
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * version 3 along with OpenOffice.org.  If not, see
22 * <http://www.openoffice.org/license.html>
23 * for a copy of the LGPLv3 License.
24 *
25 ************************************************************************/
26
27#ifndef __offapi_com_sun_star_awt_XItemList_idl__
28#define __offapi_com_sun_star_awt_XItemList_idl__
29
30#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
31#include <com/sun/star/beans/Pair.idl>
32
33//==================================================================================================================
34
35module com { module sun { module star { module awt {
36
37published interface XItemListListener;
38
39//==================================================================================================================
40
41/** provides convenient access to the list of items in a list box
42 */
43published interface XItemList
44{
45    /** is the number of items in the list
46    */
47    [attribute, readonly]   long    ItemCount;
48
49    /** inserts a new item into the list
50
51        @param Position
52            the position at which the item should be inserted. Must be greater or equal to 0, and
53            lesser than or equal to <member>ItemCount</member>.
54
55        @param ItemText
56            the text of the item to be inserted.
57
58        @param ItemImageURL
59            the URL of the image to display for the item
60
61        @throws ::com::sun::star::lang::IndexOutOfBoundsException
62            if <code>Position</code> is invalid.
63    */
64    void    insertItem(
65                [in] long Position,
66                [in] string ItemText,
67                [in] string ItemImageURL
68            )
69            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );
70
71    /** inserts an item which has only a text, but no image
72
73        @param Position
74            the position at which the item should be inserted. Must be greater or equal to 0, and
75            lesser than or equal to <member>ItemCount</member>.
76
77        @param ItemText
78            the text of the item to be inserted.
79
80        @throws ::com::sun::star::lang::IndexOutOfBoundsException
81            if <code>Position</code> is invalid.
82    */
83    void    insertItemText(
84                [in] long Position,
85                [in] string ItemText
86            )
87            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );
88
89    /** inserts an item which has only an image, but no text
90
91        @param Position
92            the position at which the item should be inserted. Must be greater or equal to 0, and
93            lesser than or equal to <member>ItemCount</member>.
94
95        @param ItemImageURL
96            the URL of the image to display for the item
97
98        @throws ::com::sun::star::lang::IndexOutOfBoundsException
99            if <code>Position</code> is invalid.
100    */
101    void    insertItemImage(
102                [in] long Position,
103                [in] string ItemImageURL
104            )
105            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );
106
107    /** removes an item from the list
108
109        @param Position
110            the position of the item which should be removed. Must be greater or equal to 0, and
111            lesser than <member>ItemCount</member>.
112
113        @throws ::com::sun::star::lang::IndexOutOfBoundsException
114            if <code>Position</code> is invalid.
115    */
116    void    removeItem(
117                [in] long Position
118            )
119            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );
120
121    /** removes all items from the list
122    */
123    void    removeAllItems();
124
125    /** sets a new text for an existing item
126
127        @param Position
128            the position of the item whose text is to be changed. Must be greater or equal to 0, and
129            lesser than <member>ItemCount</member>.
130
131        @param ItemText
132            the new text of the item
133
134        @throws ::com::sun::star::lang::IndexOutOfBoundsException
135            if <code>Position</code> is invalid.
136    */
137    void    setItemText(
138                [in] long Position,
139                [in] string ItemText
140            )
141            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );
142
143    /** sets a new image for an existing item
144
145        @param Position
146            the position of the item whose image is to be changed. Must be greater or equal to 0, and
147            lesser than <member>ItemCount</member>.
148
149        @param ItemImageURL
150            the new URL of the image to display for the item
151
152        @throws ::com::sun::star::lang::IndexOutOfBoundsException
153            if <code>Position</code> is invalid.
154    */
155    void    setItemImage(
156                [in] long Position,
157                [in] string ItemImageURL
158            )
159            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );
160
161    /** sets both a new position and text for an existing item
162
163        @param Position
164            the position of the item whose text and image is to be changed. Must be greater or equal to 0, and
165            lesser than <member>ItemCount</member>.
166
167        @param ItemText
168            the new text of the item
169
170        @param ItemImageURL
171            the new URL of the image to display for the item
172
173        @throws ::com::sun::star::lang::IndexOutOfBoundsException
174            if <code>Position</code> is invalid.
175    */
176    void    setItemTextAndImage(
177                [in] long Position,
178                [in] string ItemText,
179                [in] string ItemImageURL
180            )
181            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );
182
183    /** associates an implementation dependend value with the given list item.
184
185        <p>You can use this to store data for an item which does not interfere with the displayed
186        text and image, but can be used by the client of the list box for an arbitrary purpose.</p>
187
188        @param Position
189            the position of the item whose data value should be set. Must be greater or equal to 0, and
190            lesser than <member>ItemCount</member>.
191
192        @param ItemData
193            the data to associate with the list item
194
195        @throws ::com::sun::star::lang::IndexOutOfBoundsException
196            if <code>Position</code> is invalid.
197
198        @see getItemData
199    */
200    void    setItemData(
201                [in] long Position,
202                [in] any ItemData
203            )
204            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );
205
206    /** retrieves the text of an existing item
207
208        @param Position
209            the position of the item whose text should be retrieved. Must be greater or equal to 0, and
210            lesser than <member>ItemCount</member>.
211
212        @throws ::com::sun::star::lang::IndexOutOfBoundsException
213            if <code>Position</code> is invalid.
214    */
215    string  getItemText(
216                [in] long Position
217            )
218            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );
219
220    /** retrieves the URL of the image of an existing item
221
222        @param Position
223            the position of the item whose image should be retrieved. Must be greater or equal to 0, and
224            lesser than <member>ItemCount</member>.
225
226        @throws ::com::sun::star::lang::IndexOutOfBoundsException
227            if <code>Position</code> is invalid.
228    */
229    string  getItemImage(
230                [in] long Position
231            )
232            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );
233
234    /** retrieves both the text and the image URL of an existing item
235
236        @param Position
237            the position of the item whose text and image should be retrieved. Must be greater or equal to 0, and
238            lesser than <member>ItemCount</member>.
239
240        @throws ::com::sun::star::lang::IndexOutOfBoundsException
241            if <code>Position</code> is invalid.
242    */
243    ::com::sun::star::beans::Pair< string, string >
244            getItemTextAndImage(
245                [in] long Position
246            )
247            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );
248
249    /** retrieves the implementation dependend value associated with the given list item.
250        @see setItemData
251
252        @param Position
253            the position of the item whose data value should be retrieved. Must be greater or equal to 0, and
254            lesser than <member>ItemCount</member>.
255
256        @throws ::com::sun::star::lang::IndexOutOfBoundsException
257            if <code>Position</code> is invalid.
258
259        @see setItemData
260    */
261    any     getItemData(
262                [in] long Position
263            )
264            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );
265
266    /** retrieves the texts and images of all items in the list
267    */
268    sequence< ::com::sun::star::beans::Pair< string, string > >
269            getAllItems();
270
271    /** registers a listener which is notified about changes in the item list.
272    */
273    void addItemListListener( [in] XItemListListener Listener );
274
275    /** revokes a listener which is notified about changes in the item list.
276    */
277    void removeItemListListener( [in] XItemListListener Listener );
278};
279
280//==================================================================================================================
281
282}; }; }; };
283
284//==================================================================================================================
285
286#endif
287