From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001
From: Daniel Baumann
+ 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. 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.
+ If you want to add child nodes to your tree on demand you can do the following.
+ The Data Model
+ Selection
+ Adding child nodes on demand
+
+
+ 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 default value is com::sun::star::view::SelectionType::NONE
+ */ + [property] ::com::sun::star::view::SelectionType SelectionType; + + /** Specifies the XTreeDataModel that is providing the hierarchical data. + +You can implement your own instance of XTreeDataModel or use + the MutableTreeDataModel. + */ + [property] XTreeDataModel DataModel; + + /** Specifies if the root node of the tree is displayed. +
If RootDisplayed is set to `FALSE`, the root node of a model is no longer + a valid node for the XTreeControl and can't be used with any method of + XTreeControl. +
The default value is `TRUE`
+ */ + [property] boolean RootDisplayed; + + /** Specifies whether the node handles should be displayed. +The handles are doted lines that visualize the tree like hierarchy
+
The default value is `TRUE`
+ */ + [property] boolean ShowsHandles; + + /** Specifies whether the node handles should also be displayed at root level. +The default value is `TRUE`
+ */ + [property] boolean ShowsRootHandles; + + /** Specifies the height of each row, in pixels. +If the specified value is less than or equal to zero, the row height is the maximum height + of all rows.
+The default value is 0
+ */ + [property] long RowHeight; + + /** Specifies whether the nodes of the tree are editable. +The default value is `FALSE`
+ + @see XTreeControl::startEditingAtNode() + @see XTreeEditListener + */ + [property] boolean Editable; + + /** Specifies what happens when editing is interrupted by selecting another node in the tree, + a change in the tree's data, or by some other means. +Setting this property to `TRUE` causes the changes to be automatically saved when editing + is interrupted. `FALSE` means that editing is canceled and changes are lost +
The default value is `FALSE`
+ */ + [property] boolean InvokesStopNodeEditing; +}; + + +}; }; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/awt/tree/TreeDataModelEvent.idl b/offapi/com/sun/star/awt/tree/TreeDataModelEvent.idl new file mode 100644 index 000000000..c84f3ebee --- /dev/null +++ b/offapi/com/sun/star/awt/tree/TreeDataModelEvent.idl @@ -0,0 +1,54 @@ +/* -*- 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 . + */ +#ifndef __com_sun_star_awt_tree_TreeDataModelEvent_idl__ +#define __com_sun_star_awt_tree_TreeDataModelEvent_idl__ + +#includeAll nodes must have #ParentNode as parent. */ + sequence< XTreeNode > Nodes; + + /** holds the parent node for changed, added or removed nodes. +
If this is null, #Nodes must contain only the root node */
+ XTreeNode ParentNode;
+};
+
+
+}; }; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/awt/tree/TreeExpansionEvent.idl b/offapi/com/sun/star/awt/tree/TreeExpansionEvent.idl
new file mode 100644
index 000000000..61238eda9
--- /dev/null
+++ b/offapi/com/sun/star/awt/tree/TreeExpansionEvent.idl
@@ -0,0 +1,45 @@
+/* -*- 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 .
+ */
+#ifndef __com_sun_star_awt_tree_TreeExpansionEvent_idl__
+#define __com_sun_star_awt_tree_TreeExpansionEvent_idl__
+
+#include Note that only XTreeNode created from the same instance with createNode()
+ are valid nodes for this instance. You can use this attribute to store data for this node that
+ is independent of the display value If this URL is empty, no graphic is rendered.
+ */
+ void setNodeGraphicURL( [in] string URL );
+
+ /** The URL for a graphic that is rendered to visualize expanded non leaf nodes.
+ If URL is empty, XTreeControl::DefaultExpandedGraphicURL is used.
+ */
+ void setExpandedGraphicURL( [in] string URL );
+
+ /** The URL for a graphic that is rendered to visualize collapsed non leaf nodes.
+ If URL is empty, XTreeControl::DefaultCollapsedGraphicURL is used.
+ */
+ void setCollapsedGraphicURL( [in] string URL );
+};
+
+
+}; }; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/awt/tree/XTreeControl.idl b/offapi/com/sun/star/awt/tree/XTreeControl.idl
new file mode 100644
index 000000000..657f27677
--- /dev/null
+++ b/offapi/com/sun/star/awt/tree/XTreeControl.idl
@@ -0,0 +1,269 @@
+/* -*- 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 .
+ */
+#ifndef __com_sun_star_awt_tree_XTreeControl_idl__
+#define __com_sun_star_awt_tree_XTreeControl_idl__
+
+#include valid selection values for this interface are
+ XTreeNode or sequence<XTreeNode>. This includes expanding all parent nodes and scroll the control so this
+ node is visible in the controls display area. Visible means it is either the root or all of its parents are expanded. If Node is a leaf node, this will have no effect. This can be overridden for individual nodes by XTreeNode::getExpandedGraphicURL() This can be overridden for individual nodes by XTreeNode::getCollapsedGraphicURL() If no nodes are currently viewable, or there is no model, returns null,
+ otherwise it always returns a valid node. To test if the node is exactly
+ at x, y, use getNodeForLocation().
+
+ @param x
+ an integer giving the number of pixels horizontally from the left edge of the controls display area
+ @param y
+ an integer giving the number of pixels vertically from the top edge of the controls display area
+ @returns
+ the XTreeNode for the node closest to that location, null if nothing is viewable or there is no model
+ */
+ XTreeNode getClosestNodeForLocation( [in] long x, [in] long y );
+
+ /** returns the rectangle occupied by the visual representation of the given node
+
+ @param Node
+ the node whose geometry should be obtained
+ @throws ::com::sun::star::lang::IllegalArgumentException
+ if the given node is `NULL`, or does not belong to the tree's data model
+ */
+ ::com::sun::star::awt::Rectangle
+ getNodeRect( [in] XTreeNode Node )
+ raises( ::com::sun::star::lang::IllegalArgumentException );
+
+ // tree editing
+
+ /** Returns `TRUE` if one of tree's nodes is being currently edited.
+ The node that is being edited can be obtained using com::sun::star::view::XSelectionSupplier::getSelection().
+
+ @returns
+ `TRUE` if the user is currently editing a node
+ */
+ boolean isEditing();
+
+ /** Ends the current editing session.
+ All registered XTreeEditListener are notified if an editing session was in progress Has no effect if the tree isn't being edited. Has no effect if the tree isn't being edited. If TreeControlModel::Editable is `FALSE` or if there are no
+ registered XTreeEditListener, this call has no effect. Calling this method also ensures that Node will become visible. If you implement your own XTreeDataModel you need to notify registered
+ XTreeDataModelListener if your model changes after the control is created.
+ If this is not done correctly the TreeControl will not update the data properly. Returns null only if the tree has no nodes.
+
+ @returns
+ the root of the tree
+ */
+ XTreeNode getRoot();
+
+ /** Adds a listener for the TreeDataModelEvent posted after the tree changes.
+
+ @param Listener
+ the listener to add.
+ */
+ void addTreeDataModelListener( [in] XTreeDataModelListener Listener );
+
+
+ /** Removes a listener previously added with addTreeDataModelListener().
+
+ @param Listener
+ the listener to remove.
+ */
+ void removeTreeDataModelListener( [in] XTreeDataModelListener Listener );
+
+};
+
+
+}; }; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/awt/tree/XTreeDataModelListener.idl b/offapi/com/sun/star/awt/tree/XTreeDataModelListener.idl
new file mode 100644
index 000000000..85a9cb395
--- /dev/null
+++ b/offapi/com/sun/star/awt/tree/XTreeDataModelListener.idl
@@ -0,0 +1,82 @@
+/* -*- 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 .
+ */
+#ifndef __com_sun_star_awt_tree_XTreeDataModelListener_idl__
+#define __com_sun_star_awt_tree_XTreeDataModelListener_idl__
+
+#include Usually you must not implement this interface yourself as it is already handled
+ by the TreeControl, but you must notify it correctly if
+ you implement the XTreeDataModel yourself Note that if a subtree is removed from the tree,
+ this method may only be invoked once for the root of the removed subtree,
+ not once for each individual set of siblings removed.
+
+ Use TreeDataModelEvent::ParentNode to get the former parent of the deleted node(s).
+ TreeDataModelEvent::Nodes contains the removed node(s).
+ */
+ void treeNodesRemoved( [in] TreeDataModelEvent Event );
+
+ /** Invoked after the tree has drastically changed structure from a given node down.
+
+ Use TreeDataModelEvent::ParentNode to get the node which
+ structure has changed. TreeDataModelEvent::Nodes is empty.
+ */
+ void treeStructureChanged( [in] TreeDataModelEvent Event );
+};
+
+
+}; }; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/awt/tree/XTreeEditListener.idl b/offapi/com/sun/star/awt/tree/XTreeEditListener.idl
new file mode 100644
index 000000000..6fc0c4f65
--- /dev/null
+++ b/offapi/com/sun/star/awt/tree/XTreeEditListener.idl
@@ -0,0 +1,72 @@
+/* -*- 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 .
+ */
+#ifndef __com_sun_star_awt_tree_XTreeEditListener_idl__
+#define __com_sun_star_awt_tree_XTreeEditListener_idl__
+
+#include You have to set the TreeControlModel::Editable property to
+ `TRUE` before a tree supports editing. Implementations that register a XTreeEditListener must update the
+ display value at the Node. This event is invoked before the treeExpanding()
+ event. The TreeControl uses this interface to retrieve the model
+ information needed to display a hierarchical outline Each XTreeNode in a XTreeDataModel must be unique.
+ */
+interface XTreeNode
+{
+ /** Returns the child tree node at Index.
+
+ @throws ::com::sun::star::lang::IndexOutOfBoundsException
+ if Index is less than 0 or equal or greater than getChildCount().
+ */
+ XTreeNode getChildAt( [in] long Index )
+ raises( com::sun::star::lang::IndexOutOfBoundsException );
+
+ /** Returns the number of child nodes. */
+ long getChildCount();
+
+ /** Returns the parent node of this node. */
+ XTreeNode getParent();
+
+ /** Returns the index of Node in this instances children.
+ @returns
+ The child index of Node,
+ or -1 if Node is no child of this instance.
+ */
+ long getIndex( [in] XTreeNode Node);
+
+ /** Returns `TRUE` if the children of this node are created on demand.
+ A TreeControl will handle a node that returns `TRUE` always
+ like a node that has child nodes, even if getChildCount()
+ returns 0. If this URL is empty, no graphic is rendered.
+ */
+ string getNodeGraphicURL();
+
+ /** The URL for a graphic that is rendered to visualize expanded non leaf nodes.
+ If URL is empty, XTreeControl::DefaultExpandedGraphicURL is used.
+ */
+ string getExpandedGraphicURL();
+
+ /** The URL for a graphic that is rendered to visualize collapsed non leaf nodes.
+ If URL is empty, XTreeControl::DefaultCollapsedGraphicURL is used.
+ */
+ string getCollapsedGraphicURL();
+};
+
+
+}; }; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
--
cgit v1.2.3