/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */


module com { module sun { module star { module awt {

interface XItemListListener;


/** provides convenient access to the list of items in a list box
 */
interface XItemList
{
    /** is the number of items in the list
    */
    [attribute, readonly]   long    ItemCount;

    /** inserts a new item into the list

        @param Position
            the position at which the item should be inserted. Must be greater or equal to 0, and
            lesser than or equal to #ItemCount.

        @param ItemText
            the text of the item to be inserted.

        @param ItemImageURL
            the URL of the image to display for the item

        @throws ::com::sun::star::lang::IndexOutOfBoundsException
            if <code>Position</code> is invalid.
    */
    void    insertItem(
                [in] long Position,
                [in] string ItemText,
                [in] string ItemImageURL
            )
            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );

    /** inserts an item which has only a text, but no image

        @param Position
            the position at which the item should be inserted. Must be greater or equal to 0, and
            lesser than or equal to #ItemCount.

        @param ItemText
            the text of the item to be inserted.

        @throws ::com::sun::star::lang::IndexOutOfBoundsException
            if <code>Position</code> is invalid.
    */
    void    insertItemText(
                [in] long Position,
                [in] string ItemText
            )
            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );

    /** inserts an item which has only an image, but no text

        @param Position
            the position at which the item should be inserted. Must be greater or equal to 0, and
            lesser than or equal to #ItemCount.

        @param ItemImageURL
            the URL of the image to display for the item

        @throws ::com::sun::star::lang::IndexOutOfBoundsException
            if <code>Position</code> is invalid.
    */
    void    insertItemImage(
                [in] long Position,
                [in] string ItemImageURL
            )
            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );

    /** removes an item from the list

        @param Position
            the position of the item which should be removed. Must be greater or equal to 0, and
            lesser than #ItemCount.

        @throws ::com::sun::star::lang::IndexOutOfBoundsException
            if <code>Position</code> is invalid.
    */
    void    removeItem(
                [in] long Position
            )
            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );

    /** removes all items from the list
    */
    void    removeAllItems();

    /** sets a new text for an existing item

        @param Position
            the position of the item whose text is to be changed. Must be greater or equal to 0, and
            lesser than #ItemCount.

        @param ItemText
            the new text of the item

        @throws ::com::sun::star::lang::IndexOutOfBoundsException
            if <code>Position</code> is invalid.
    */
    void    setItemText(
                [in] long Position,
                [in] string ItemText
            )
            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );

    /** sets a new image for an existing item

        @param Position
            the position of the item whose image is to be changed. Must be greater or equal to 0, and
            lesser than #ItemCount.

        @param ItemImageURL
            the new URL of the image to display for the item

        @throws ::com::sun::star::lang::IndexOutOfBoundsException
            if <code>Position</code> is invalid.
    */
    void    setItemImage(
                [in] long Position,
                [in] string ItemImageURL
            )
            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );

    /** sets both a new position and text for an existing item

        @param Position
            the position of the item whose text and image is to be changed. Must be greater or equal to 0, and
            lesser than #ItemCount.

        @param ItemText
            the new text of the item

        @param ItemImageURL
            the new URL of the image to display for the item

        @throws ::com::sun::star::lang::IndexOutOfBoundsException
            if <code>Position</code> is invalid.
    */
    void    setItemTextAndImage(
                [in] long Position,
                [in] string ItemText,
                [in] string ItemImageURL
            )
            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );

    /** associates an implementation dependent value with the given list item.

        <p>You can use this to store data for an item which does not interfere with the displayed
        text and image, but can be used by the client of the list box for an arbitrary purpose.</p>

        @param Position
            the position of the item whose data value should be set. Must be greater or equal to 0, and
            lesser than #ItemCount.

        @param ItemData
            the data to associate with the list item

        @throws ::com::sun::star::lang::IndexOutOfBoundsException
            if <code>Position</code> is invalid.

        @see getItemData
    */
    void    setItemData(
                [in] long Position,
                [in] any ItemData
            )
            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );

    /** retrieves the text of an existing item

        @param Position
            the position of the item whose text should be retrieved. Must be greater or equal to 0, and
            lesser than #ItemCount.

        @throws ::com::sun::star::lang::IndexOutOfBoundsException
            if <code>Position</code> is invalid.
    */
    string  getItemText(
                [in] long Position
            )
            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );

    /** retrieves the URL of the image of an existing item

        @param Position
            the position of the item whose image should be retrieved. Must be greater or equal to 0, and
            lesser than #ItemCount.

        @throws ::com::sun::star::lang::IndexOutOfBoundsException
            if <code>Position</code> is invalid.
    */
    string  getItemImage(
                [in] long Position
            )
            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );

    /** retrieves both the text and the image URL of an existing item

        @param Position
            the position of the item whose text and image should be retrieved. Must be greater or equal to 0, and
            lesser than #ItemCount.

        @throws ::com::sun::star::lang::IndexOutOfBoundsException
            if <code>Position</code> is invalid.
    */
    ::com::sun::star::beans::Pair< string, string >
            getItemTextAndImage(
                [in] long Position
            )
            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );

    /** retrieves the implementation dependent value associated with the given list item.
        @param Position
            the position of the item whose data value should be retrieved. Must be greater or equal to 0, and
            lesser than #ItemCount.

        @throws ::com::sun::star::lang::IndexOutOfBoundsException
            if <code>Position</code> is invalid.

        @see setItemData
    */
    any     getItemData(
                [in] long Position
            )
            raises  ( ::com::sun::star::lang::IndexOutOfBoundsException );

    /** retrieves the texts and images of all items in the list
    */
    sequence< ::com::sun::star::beans::Pair< string, string > >
            getAllItems();

    /** registers a listener which is notified about changes in the item list.
    */
    void addItemListListener( [in] XItemListListener Listener );

    /** revokes a listener which is notified about changes in the item list.
    */
    void removeItemListListener( [in] XItemListListener Listener );
};


}; }; }; };


/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
