LibreOffice
LibreOffice 24.2 SDK API Reference
List of all members
TreeControl Service Reference

A control that displays a set of hierarchical data as an outline. More...

import"TreeControl.idl";

Inheritance diagram for TreeControl:
XTreeControl XMultiSelectionSupplier XSelectionSupplier XInterface

Additional Inherited Members

- Exported Interfaces inherited from XTreeControl
interface ::com::sun::star::view::XMultiSelectionSupplier
 This interfaces provides access to the selection of tree nodes for this control. More...
 
- Public Member Functions inherited from XTreeControl
boolean isNodeExpanded ([in] XTreeNode Node) raises ( ::com::sun::star::lang::IllegalArgumentException )
 Returns TRUE if Node is currently expanded. More...
 
boolean isNodeCollapsed ([in] XTreeNode Node) raises ( ::com::sun::star::lang::IllegalArgumentException )
 Returns TRUE if Node is currently collapsed. More...
 
void makeNodeVisible ([in] XTreeNode Node) raises ( com::sun::star::lang::IllegalArgumentException, ExpandVetoException )
 Ensures that Node is currently visible. More...
 
boolean isNodeVisible ([in] XTreeNode Node) raises ( com::sun::star::lang::IllegalArgumentException )
 Returns TRUE if Node is currently visible. More...
 
void expandNode ([in] XTreeNode Node) raises ( com::sun::star::lang::IllegalArgumentException, ExpandVetoException )
 Ensures that Node is expanded and visible. More...
 
void collapseNode ([in] XTreeNode Node) raises ( com::sun::star::lang::IllegalArgumentException, ExpandVetoException )
 Ensures that Node is collapsed. More...
 
void addTreeExpansionListener ([in] XTreeExpansionListener Listener)
 Adds a listener for TreeExpansion events. More...
 
void removeTreeExpansionListener ([in] XTreeExpansionListener Listener)
 Removes a listener for TreeExpansion events. More...
 
XTreeNode getNodeForLocation ([in] long x, [in] long y)
 Returns the node at the specified location. More...
 
XTreeNode getClosestNodeForLocation ([in] long x, [in] long y)
 Returns the node that is closest to x,y. More...
 
::com::sun::star::awt::Rectangle getNodeRect ([in] XTreeNode Node) raises ( ::com::sun::star::lang::IllegalArgumentException )
 returns the rectangle occupied by the visual representation of the given node More...
 
boolean isEditing ()
 Returns TRUE if one of tree's nodes is being currently edited. More...
 
boolean stopEditing ()
 Ends the current editing session. More...
 
void cancelEditing ()
 Cancels the current editing session. More...
 
void startEditingAtNode ([in] XTreeNode Node) raises ( ::com::sun::star::lang::IllegalArgumentException )
 Selects Node and initiates editing. More...
 
void addTreeEditListener ([in] XTreeEditListener Listener)
 Adds a XTreeEditListener. More...
 
void removeTreeEditListener ([in] XTreeEditListener Listener)
 Removes a XTreeEditListener. More...
 
- Public Member Functions inherited from XMultiSelectionSupplier
boolean addSelection ([in] any Selection) raises ( com::sun::star::lang::IllegalArgumentException )
 adds the object or the objects represented by Selection to the selection of this XMultiSelectionSupplier. More...
 
void removeSelection ([in] any Selection) raises ( com::sun::star::lang::IllegalArgumentException )
 remove the object or objects represented by Selection from the selection of this XMultiSelectionSupplier. More...
 
void clearSelection ()
 clears the selection of this XMultiSelectionSupplier. More...
 
long getSelectionCount ()
 returns the number of selected objects of this XMultiSelectionSupplier. More...
 
com::sun::star::container::XEnumeration createSelectionEnumeration ()
 
com::sun::star::container::XEnumeration createReverseSelectionEnumeration ()
 
- Public Member Functions inherited from XSelectionSupplier
boolean select ([in] any xSelection) raises ( com::sun::star::lang::IllegalArgumentException )
 selects the object represented by xSelection if it is known and selectable in this object. More...
 
any getSelection ()
 
void addSelectionChangeListener ([in] com::sun::star::view::XSelectionChangeListener xListener)
 registers an event listener, which is called when the selection changes. More...
 
void removeSelectionChangeListener ([in] com::sun::star::view::XSelectionChangeListener xListener)
 unregisters an event listener which was registered with XSelectionSupplier::addSelectionChangeListener(). More...
 
- Public Member Functions inherited from XInterface
any queryInterface ([in] type aType)
 queries for a new interface to an existing UNO object. More...
 
void acquire ()
 increases the reference counter by one. More...
 
void release ()
 decreases the reference counter by one. More...
 
- Public Attributes inherited from XTreeControl
string DefaultExpandedGraphicURL
 If the given URL points to a loadable graphic, the graphic is rendered before expanded non leaf nodes. More...
 
string DefaultCollapsedGraphicURL
 If the given URL points to a loadable graphic, the graphic is rendered before collapsed non leaf nodes. More...
 

Detailed Description

A control that displays a set of hierarchical data as an outline.

The Data Model

A specific node in a tree is identified by a XTreeNode. A leaf node is a node without any children and that returns FALSE when calling XTreeNode::hasChildrenOnDemand(). An expanded node is a non-leaf node that will displays its children when all its ancestors are expanded. A collapsed node is one which hides them. A node is visible when all parent nodes are expanded and the node itself is in the display area.

The nodes are retrieved from a XTreeDataModel. You can implement it yourself or use the MutableTreeDataModel which uses XMutableTreeNode and XMutableTreeDataModel for a simple and mutable data model.

The data model must be set at the TreeControlModel::TreeDataModel property.

Selection

If you are interested in knowing when the selection changes implement a com::sun::star::view::XSelectionChangeListener and add the instance with the method com::sun::star::view::XSelectionSupplier::addSelectionChangeListener(). You than will be notified for any selection change.

If you are interested in detecting either double-click events or when a user clicks on a node, regardless of whether or not it was selected, you can get the com::sun::star::awt::XWindow and add yourself as a com::sun::star::awt::XMouseClickHandler. You can use the method XTreeControl::getNodeForLocation() to retrieve the node that was under the mouse at the time the event was fired.

Adding child nodes on demand

If you want to add child nodes to your tree on demand you can do the following.

Now you get called when the node will become expanded or collapsed. So on XTreeExpansionListener::treeExpanding() you can check the TreeExpansionEvent if the parent node with children on demand is going to be expanded and in that case add the missing child nodes. You can also veto the expansion or collapsing of a parent node by using the ExpandVetoException.


The documentation for this service was generated from the following file: