From f1687933b4b380774871fdeeb0985209e63b430d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 29 Apr 2010 10:05:04 +0200 Subject: fs33a: #i111238# add support for images to AWT's ListBoxControl/Model --- offapi/com/sun/star/awt/ItemListEvent.idl | 76 ++++++++ offapi/com/sun/star/awt/XItemList.idl | 246 ++++++++++++++++++++++++++ offapi/com/sun/star/awt/XItemListListener.idl | 85 +++++++++ offapi/com/sun/star/awt/makefile.mk | 5 +- 4 files changed, 411 insertions(+), 1 deletion(-) create mode 100644 offapi/com/sun/star/awt/ItemListEvent.idl create mode 100644 offapi/com/sun/star/awt/XItemList.idl create mode 100644 offapi/com/sun/star/awt/XItemListListener.idl diff --git a/offapi/com/sun/star/awt/ItemListEvent.idl b/offapi/com/sun/star/awt/ItemListEvent.idl new file mode 100644 index 000000000000..f9d2658bd5bd --- /dev/null +++ b/offapi/com/sun/star/awt/ItemListEvent.idl @@ -0,0 +1,76 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __offapi_com_sun_star_awt_ListItemEvent_idl__ +#define __offapi_com_sun_star_awt_ListItemEvent_idl__ + +#include +#include + +//================================================================================================================== + +module com { module sun { module star { module awt { + +//================================================================================================================== + +/** is the event broadcasted by a XListItems implementation for changes + in its item list. + */ +struct ItemListEvent : ::com::sun::star::lang::EventObject +{ + /** specifies the position of the item which is affected by the event + +

In case the event is not related to a single item, but to the complete list, the value of this + member is undefined.

+ */ + long ItemPosition; + + /** the text of the item. + +

If the event being notified did not touch the text of an item, this member is empty. For instance, upon + invocation of XItemList::setItemImage, only ItemImageURL will be set, and + ItemText will be empty.

+ */ + ::com::sun::star::beans::Optional< string > + ItemText; + + /** the URL of the image of the item + +

If the event being notified did not touch the image of an item, this member is empty. For instance, upon + invocation of XItemList::setItemText, only ItemText will be set, and + ItemImageURL will be empty.

+ */ + ::com::sun::star::beans::Optional< string > + ItemImageURL; +}; + +//================================================================================================================== + +}; }; }; }; + +//================================================================================================================== + +#endif diff --git a/offapi/com/sun/star/awt/XItemList.idl b/offapi/com/sun/star/awt/XItemList.idl new file mode 100644 index 000000000000..55721bf0af36 --- /dev/null +++ b/offapi/com/sun/star/awt/XItemList.idl @@ -0,0 +1,246 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __offapi_com_sun_star_awt_XItemList_idl__ +#define __offapi_com_sun_star_awt_XItemList_idl__ + +#include +#include + +//================================================================================================================== + +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 Position 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 Position 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 Position 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 Position 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 Position 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 Position 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 Position is invalid. + */ + void setItemTextAndImage( + [in] long Position, + [in] string ItemText, + [in] string ItemImageURL + ) + 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 Position 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 Position 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 Position is invalid. + */ + ::com::sun::star::beans::Pair< string, string > + getItemTextAndImage( + [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 ); +}; + +//================================================================================================================== + +}; }; }; }; + +//================================================================================================================== + +#endif diff --git a/offapi/com/sun/star/awt/XItemListListener.idl b/offapi/com/sun/star/awt/XItemListListener.idl new file mode 100644 index 000000000000..d41d8b104a02 --- /dev/null +++ b/offapi/com/sun/star/awt/XItemListListener.idl @@ -0,0 +1,85 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __offapi_com_sun_star_awt_XItemListListener_idl__ +#define __offapi_com_sun_star_awt_XItemListListener_idl__ + +#include +#include + +//================================================================================================================== + +module com { module sun { module star { module awt { + +//================================================================================================================== + +/** describes a listener for changes in a item list + @see XListItems + */ +interface XItemListListener : ::com::sun::star::lang::XEventListener +{ + /** is called when an item is inserted into the list + */ + void listItemInserted( + [in] ItemListEvent Event + ); + + /** is called when an item is removed from the list + */ + void listItemRemoved( + [in] ItemListEvent Event + ); + + /** is called when an item in the list is modified, i.e. its text or image changed + */ + void listItemModified( + [in] ItemListEvent Event + ); + /** is called when the list has been completely cleared, i.e. after an invocation of + XItemList::removeAllItems + */ + void allItemsRemoved( + [in] ::com::sun::star::lang::EventObject Event + ); + + /** is called when the changes to the item list which occured are too complex to be notified + in single events. + +

Consumers of this event should discard their cached information about the current item list, + and completely refresh it from the XItemList's current state.

+ */ + void itemListChanged( + [in] ::com::sun::star::lang::EventObject Event + ); +}; + +//================================================================================================================== + +}; }; }; }; + +//================================================================================================================== + +#endif diff --git a/offapi/com/sun/star/awt/makefile.mk b/offapi/com/sun/star/awt/makefile.mk index 1e2350a3a1d3..55734fd75ca6 100644 --- a/offapi/com/sun/star/awt/makefile.mk +++ b/offapi/com/sun/star/awt/makefile.mk @@ -328,7 +328,10 @@ IDLFILES=\ MenuLogo.idl \ XMenuExtended2.idl \ XMenuBarExtended.idl \ - XPopupMenuExtended.idl + XPopupMenuExtended.idl \ + XItemList.idl \ + XItemListListener.idl \ + ItemListEvent.idl # ------------------------------------------------------------------ -- cgit From 11553bcd8eacca6cda02ea0e32c5d5bcf611638e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 29 Apr 2010 10:15:25 +0200 Subject: fs33a: #i111238# add (optional, since the thing is published) support for XItemList --- offapi/com/sun/star/awt/UnoControlListBoxModel.idl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/offapi/com/sun/star/awt/UnoControlListBoxModel.idl b/offapi/com/sun/star/awt/UnoControlListBoxModel.idl index 5017b05635ad..1cd36de93231 100644 --- a/offapi/com/sun/star/awt/UnoControlListBoxModel.idl +++ b/offapi/com/sun/star/awt/UnoControlListBoxModel.idl @@ -39,6 +39,8 @@ #include #endif +#include + //============================================================================= @@ -208,6 +210,11 @@ published service UnoControlListBoxModel this is possible.

*/ [optional, property] short MouseWheelBehavior; + + /** allows mmanipulating the list of items in the list box more fine-grained than the + StringItemList property. + */ + [optional] interface XItemList; }; //============================================================================= -- cgit From a41a0230c9c56f4f21c8ca5c4b7fd898678e30bb Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 29 Apr 2010 14:10:03 +0200 Subject: fs33a: #i111238# now with UserData support --- offapi/com/sun/star/awt/XItemList.idl | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/offapi/com/sun/star/awt/XItemList.idl b/offapi/com/sun/star/awt/XItemList.idl index 55721bf0af36..3d618d760322 100644 --- a/offapi/com/sun/star/awt/XItemList.idl +++ b/offapi/com/sun/star/awt/XItemList.idl @@ -180,6 +180,26 @@ interface XItemList ) raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); + /** associates an implementation dependend value with the given list item. + +

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.

+ + @param Position + the position of the item whose data value should be set. Must be greater or equal to 0, and + lesser than ItemCount. + + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if Position is invalid. + + @see getUserData + */ + void setUserData( + [in] long Position, + [in] any DataValue + ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); + /** retrieves the text of an existing item @param Position @@ -223,6 +243,23 @@ interface XItemList ) raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); + /** retrieves the implementation dependend value associated with the given list item. + @see setUserData + + @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 Position is invalid. + + @see getUserData + */ + any getUserData( + [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 > > -- cgit From cc27b5e0d42b9773d2657a7f405f09007e64b134 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 29 Apr 2010 15:29:46 +0200 Subject: fs33a: #i111238# [s|g]etUserData -> [s|g]etItemData --- offapi/com/sun/star/awt/XItemList.idl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/offapi/com/sun/star/awt/XItemList.idl b/offapi/com/sun/star/awt/XItemList.idl index 3d618d760322..6419ea94d0b0 100644 --- a/offapi/com/sun/star/awt/XItemList.idl +++ b/offapi/com/sun/star/awt/XItemList.idl @@ -189,14 +189,17 @@ interface XItemList 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 Position is invalid. - @see getUserData + @see getItemData */ - void setUserData( + void setItemData( [in] long Position, - [in] any DataValue + [in] any ItemData ) raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); @@ -244,7 +247,7 @@ interface XItemList raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); /** retrieves the implementation dependend value associated with the given list item. - @see setUserData + @see setItemData @param Position the position of the item whose data value should be retrieved. Must be greater or equal to 0, and @@ -253,9 +256,9 @@ interface XItemList @throws ::com::sun::star::lang::IndexOutOfBoundsException if Position is invalid. - @see getUserData + @see setItemData */ - any getUserData( + any getItemData( [in] long Position ) raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); -- cgit From ad1eb0b34015402650dce8b3d25987519c50c39a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 16 Jun 2010 14:29:22 +0200 Subject: fs33a: oops, forgot this addition to the documentation of the UnoControlListBoxModel in CWS unoawt --- offapi/com/sun/star/awt/UnoControlListBoxModel.idl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/offapi/com/sun/star/awt/UnoControlListBoxModel.idl b/offapi/com/sun/star/awt/UnoControlListBoxModel.idl index 1cd36de93231..1ecf338bf095 100644 --- a/offapi/com/sun/star/awt/UnoControlListBoxModel.idl +++ b/offapi/com/sun/star/awt/UnoControlListBoxModel.idl @@ -213,8 +213,19 @@ published service UnoControlListBoxModel /** allows mmanipulating the list of items in the list box more fine-grained than the StringItemList property. + + @since OOo 3.3 */ [optional] interface XItemList; + + /** specifies where an item separator - a horizontal line - is drawn. + +

If this is not , then a horizontal line will be drawn between the item at the given position, + and the following item.

+ + @since OOo 3.3 + */ + [optional, property, maybevoid] short ItemSeparatorPos; }; //============================================================================= -- cgit From f938ba01accd59845de858c77a6825d37e2bc5a2 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 1 Jul 2010 11:52:27 +0200 Subject: unoawt2: add XItemList same as for listbox model --- offapi/com/sun/star/awt/UnoControlComboBoxModel.idl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/offapi/com/sun/star/awt/UnoControlComboBoxModel.idl b/offapi/com/sun/star/awt/UnoControlComboBoxModel.idl index 83057417edbf..eedd7b78c346 100644 --- a/offapi/com/sun/star/awt/UnoControlComboBoxModel.idl +++ b/offapi/com/sun/star/awt/UnoControlComboBoxModel.idl @@ -39,6 +39,7 @@ #include #endif +#include //============================================================================= @@ -225,6 +226,11 @@ published service UnoControlComboBoxModel this is possible.

*/ [optional, property] short MouseWheelBehavior; + + /** allows mmanipulating the list of items in the combo box more fine-grained than the + StringItemList property. + */ + [optional] interface XItemList; }; //============================================================================= -- cgit