1*d1766043SAndrew Rist/**************************************************************
2*d1766043SAndrew Rist *
3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*d1766043SAndrew Rist * distributed with this work for additional information
6*d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9*d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10*d1766043SAndrew Rist *
11*d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*d1766043SAndrew Rist *
13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d1766043SAndrew Rist * software distributed under the License is distributed on an
15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17*d1766043SAndrew Rist * specific language governing permissions and limitations
18*d1766043SAndrew Rist * under the License.
19*d1766043SAndrew Rist *
20*d1766043SAndrew Rist *************************************************************/
21*d1766043SAndrew Rist
22*d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_awt_tree_XTreeControl_idl__
24cdf0e10cSrcweir#define __com_sun_star_awt_tree_XTreeControl_idl__
25cdf0e10cSrcweir
26cdf0e10cSrcweir#ifndef __com_sun_star_awt_XControl_idl__
27cdf0e10cSrcweir#include <com/sun/star/awt/XControl.idl>
28cdf0e10cSrcweir#endif
29cdf0e10cSrcweir
30cdf0e10cSrcweir#ifndef __com_sun_star_awt_tree_XTreeExpansionListener_idl__
31cdf0e10cSrcweir#include <com/sun/star/awt/tree/XTreeExpansionListener.idl>
32cdf0e10cSrcweir#endif
33cdf0e10cSrcweir
34cdf0e10cSrcweir#ifndef __com_sun_star_view_XMultiSelectionSupplier_idl__
35cdf0e10cSrcweir#include <com/sun/star/view/XMultiSelectionSupplier.idl>
36cdf0e10cSrcweir#endif
37cdf0e10cSrcweir
38cdf0e10cSrcweir#ifndef __com_sun_star_awt_tree_XTreeEditListener_idl__
39cdf0e10cSrcweir#include <com/sun/star/awt/tree/XTreeEditListener.idl>
40cdf0e10cSrcweir#endif
41cdf0e10cSrcweir
42cdf0e10cSrcweir//=============================================================================
43cdf0e10cSrcweir
44cdf0e10cSrcweirmodule com {  module sun {  module star {  module awt { module tree {
45cdf0e10cSrcweir
46cdf0e10cSrcweir//=============================================================================
47cdf0e10cSrcweir
48cdf0e10cSrcweir/** An interface to a control that displays a set of hierarchical data as an outline.
49cdf0e10cSrcweir
50cdf0e10cSrcweir    @see TreeControl
51cdf0e10cSrcweir */
52cdf0e10cSrcweirpublished interface XTreeControl
53cdf0e10cSrcweir{
54cdf0e10cSrcweir    /**	This interfaces provides access to the selection of tree nodes for this control.
55cdf0e10cSrcweir
56cdf0e10cSrcweir        <p>valid selection values for this interface are
57cdf0e10cSrcweir        <type>XTreeNode</type> or sequence&lt;<type>XTreeNode</type>&gt;.</p>
58cdf0e10cSrcweir
59cdf0e10cSrcweir        <method scope="::com::sun::star::view">XSelectionSupplier::getSelection()</method>
60cdf0e10cSrcweir        returns an emtpy any for no selection, an any with <type>XTreeNode</type> for
61cdf0e10cSrcweir        a single selection and a sequence&lt;<type>XTreeNode</type>&gt; for a multiselection.
62cdf0e10cSrcweir    */
63cdf0e10cSrcweir    interface ::com::sun::star::view::XMultiSelectionSupplier;
64cdf0e10cSrcweir
65cdf0e10cSrcweir    // ----------------------------
66cdf0e10cSrcweir    // expanding/collapsing/visible
67cdf0e10cSrcweir    // ----------------------------
68cdf0e10cSrcweir
69cdf0e10cSrcweir    /** Returns <TRUE/> if <var>Node</var> is currently expanded.
70cdf0e10cSrcweir
71cdf0e10cSrcweir        @param Node
72cdf0e10cSrcweir            the <type>XTreeNode</type> specifying the node to check.
73cdf0e10cSrcweir
74cdf0e10cSrcweir        @returns
75cdf0e10cSrcweir            <FALSE/> if <var>Node</var> or at least one of its parent nodes are collapsed,
76cdf0e10cSrcweir            <TRUE/> if <var>Node</var> and all of its parent nodes are expanded.
77cdf0e10cSrcweir
78cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
79cdf0e10cSrcweir            if <var>Node</var> is not a valid node of the corresponding <type>XTreeDataModel</type>.
80cdf0e10cSrcweir    */
81cdf0e10cSrcweir    boolean isNodeExpanded( [in] XTreeNode Node )
82cdf0e10cSrcweir        raises( ::com::sun::star::lang::IllegalArgumentException );
83cdf0e10cSrcweir
84cdf0e10cSrcweir    /** Returns <TRUE/> if <var>Node</var> is currently collapsed.
85cdf0e10cSrcweir
86cdf0e10cSrcweir        @param Node
87cdf0e10cSrcweir            the <type>XTreeNode</type> specifying the node to check
88cdf0e10cSrcweir
89cdf0e10cSrcweir        @returns
90cdf0e10cSrcweir            <TRUE/> if <var>Node</var> or at least one of its parent nodes are collapsed,
91cdf0e10cSrcweir            <FALSE/> if <var>Node</var> and all of its parent nodes are expanded
92cdf0e10cSrcweir
93cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
94cdf0e10cSrcweir            if <var>Node</var> is not a valid node of the corresponding <type>XTreeDataModel</type>.
95cdf0e10cSrcweir    */
96cdf0e10cSrcweir    boolean isNodeCollapsed( [in] XTreeNode Node )
97cdf0e10cSrcweir        raises( ::com::sun::star::lang::IllegalArgumentException );
98cdf0e10cSrcweir
99cdf0e10cSrcweir    /** Ensures that <var>Node</var> is currently visible.
100cdf0e10cSrcweir        <p>This includes expanding all parent nodes and scroll the control so this
101cdf0e10cSrcweir        node is visible in the controls display area.</p>
102cdf0e10cSrcweir
103cdf0e10cSrcweir        @param Node
104cdf0e10cSrcweir            the <type>XTreeNode</type> specifying the node to make visible.
105cdf0e10cSrcweir
106cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
107cdf0e10cSrcweir            if <var>Node</var> is not a valid node of the corresponding <type>XTreeDataModel</type>.
108cdf0e10cSrcweir
109cdf0e10cSrcweir        @throws ExpandVetoException
110cdf0e10cSrcweir            if <var>Node</var>can't be made visible since at least one of the parent nodes are
111cdf0e10cSrcweir            collapsed and expanding failed because at least one of the registered
112cdf0e10cSrcweir            <type>XTreeExpansionListener</type> raised a <type>ExpandVetoException</type>.
113cdf0e10cSrcweir    */
114cdf0e10cSrcweir    void makeNodeVisible( [in] XTreeNode Node )
115cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException, ExpandVetoException );
116cdf0e10cSrcweir
117cdf0e10cSrcweir    /** Returns <TRUE/> if <var>Node</var> is currently visible.
118cdf0e10cSrcweir        <p>Visible means it is either the root or all of its parents are expanded.</p>
119cdf0e10cSrcweir
120cdf0e10cSrcweir        @returns
121cdf0e10cSrcweir            <TRUE/> if <var>Node</var> is visible, otherwise <FALSE/>
122cdf0e10cSrcweir
123cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
124cdf0e10cSrcweir            if <var>Node</var> is not a valid node of the corresponding <type>XTreeDataModel</type>.
125cdf0e10cSrcweir    */
126cdf0e10cSrcweir    boolean isNodeVisible( [in] XTreeNode Node )
127cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException );
128cdf0e10cSrcweir
129cdf0e10cSrcweir    /** Ensures that <var>Node</var> is expanded and visible.
130cdf0e10cSrcweir        <p>If <var>Node</var> is a leaf node, this will have no effect.</p>
131cdf0e10cSrcweir
132cdf0e10cSrcweir        @param Node
133cdf0e10cSrcweir            the <type>XTreeNode</type> identifying a node.
134cdf0e10cSrcweir
135cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
136cdf0e10cSrcweir            if <var>Node</var> is not a valid node of the corresponding <type>XTreeDataModel</type>.
137cdf0e10cSrcweir
138cdf0e10cSrcweir        @throws ExpandVetoException
139cdf0e10cSrcweir            if expanding <var>Node</var> failed because at least one of the registered
140cdf0e10cSrcweir            <type>XTreeExpansionListener</type> raised a <type>ExpandVetoException</type>.
141cdf0e10cSrcweir    */
142cdf0e10cSrcweir    void expandNode( [in] XTreeNode Node )
143cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException, ExpandVetoException );
144cdf0e10cSrcweir
145cdf0e10cSrcweir    /** Ensures that <var>Node</var> is collapsed.
146cdf0e10cSrcweir
147cdf0e10cSrcweir        @param Node
148cdf0e10cSrcweir            the <type>XTreeNode</type> identifying a node
149cdf0e10cSrcweir
150cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
151cdf0e10cSrcweir            if <var>Node</var> is not a valid node of the corresponding <type>XTreeDataModel</type>.
152cdf0e10cSrcweir
153cdf0e10cSrcweir        @throws ExpandVetoException
154cdf0e10cSrcweir            if collapsing <var>Node</var> failed because at least one of the registered
155cdf0e10cSrcweir            <type>XTreeExpansionListener</type> raised a <type>ExpandVetoException</type>.
156cdf0e10cSrcweir    */
157cdf0e10cSrcweir    void collapseNode( [in] XTreeNode Node )
158cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException, ExpandVetoException );
159cdf0e10cSrcweir
160cdf0e10cSrcweir    /** Adds a listener for <type>TreeExpansion</type> events.
161cdf0e10cSrcweir
162cdf0e10cSrcweir        @param Listener
163cdf0e10cSrcweir            a <type>XTreeExpansionListener</type> that will be notified when a tree
164cdf0e10cSrcweir            node is expanded or collapsed.
165cdf0e10cSrcweir    */
166cdf0e10cSrcweir    void addTreeExpansionListener( [in] XTreeExpansionListener Listener );
167cdf0e10cSrcweir
168cdf0e10cSrcweir    /** Removes a listener for <type>TreeExpansion</type> events.
169cdf0e10cSrcweir
170cdf0e10cSrcweir        @param Listener
171cdf0e10cSrcweir            the <type>XTreeExpansionListener</type> to remove.
172cdf0e10cSrcweir    */
173cdf0e10cSrcweir    void removeTreeExpansionListener( [in] XTreeExpansionListener Listener );
174cdf0e10cSrcweir
175cdf0e10cSrcweir    /** If the given URL points to a loadable graphic, the graphic is rendered
176cdf0e10cSrcweir        before expanded non leaf nodes.
177cdf0e10cSrcweir
178cdf0e10cSrcweir        <p>This can be overriden for individual nodes by <member>XTreeNode::getExpandedGraphicURL()</member></p>
179cdf0e10cSrcweir    */
180cdf0e10cSrcweir    [attribute] string DefaultExpandedGraphicURL;
181cdf0e10cSrcweir
182cdf0e10cSrcweir    /** If the given URL points to a loadable graphic, the graphic is rendered
183cdf0e10cSrcweir        before collapsed non leaf nodes.
184cdf0e10cSrcweir
185cdf0e10cSrcweir        <p>This can be overriden for individual nodes by <member>XTreeNode::getCollapsedGraphicURL()</member></p>
186cdf0e10cSrcweir    */
187cdf0e10cSrcweir    [attribute] string DefaultCollapsedGraphicURL;
188cdf0e10cSrcweir
189cdf0e10cSrcweir    // ------------
190cdf0e10cSrcweir    // tree geometry
191cdf0e10cSrcweir    // ------------
192cdf0e10cSrcweir
193cdf0e10cSrcweir    /** Returns the node at the specified location.
194cdf0e10cSrcweir
195cdf0e10cSrcweir        @param x
196cdf0e10cSrcweir            an integer giving the number of pixels horizontally from the left edge of the controls display area
197cdf0e10cSrcweir        @param y
198cdf0e10cSrcweir            an integer giving the number of pixels vertically from the top edge of the controls display area
199cdf0e10cSrcweir        @returns
200cdf0e10cSrcweir            the <type>XTreeNode</type> for the node at that location, or 0 if there is no node at the given position
201cdf0e10cSrcweir    */
202cdf0e10cSrcweir    XTreeNode getNodeForLocation( [in] long x, [in] long y );
203cdf0e10cSrcweir
204cdf0e10cSrcweir    /** Returns the node that is closest to x,y.
205cdf0e10cSrcweir        <p>If no nodes are currently viewable, or there is no model, returns null,
206cdf0e10cSrcweir        otherwise it always returns a valid node. To test if the node is exactly
207cdf0e10cSrcweir        at x, y, use <member>getNodeForLocation()</member>.
208cdf0e10cSrcweir
209cdf0e10cSrcweir        @param x
210cdf0e10cSrcweir            an integer giving the number of pixels horizontally from the left edge of the controls display area
211cdf0e10cSrcweir        @para y
212cdf0e10cSrcweir            an integer giving the number of pixels vertically from the top edge of the controls display area
213cdf0e10cSrcweir        @returns
214cdf0e10cSrcweir            the <type>XTreeNode</type> for the node closest to that location, null if nothing is viewable or there is no model
215cdf0e10cSrcweir    */
216cdf0e10cSrcweir    XTreeNode getClosestNodeForLocation( [in] long x, [in] long y );
217cdf0e10cSrcweir
218cdf0e10cSrcweir    /** returns the rectangle occupied by the visual representation of the given node
219cdf0e10cSrcweir
220cdf0e10cSrcweir        @param Node
221cdf0e10cSrcweir            the node whose geometry should be obtained
222cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
223cdf0e10cSrcweir            if the given node is <NULL/>, or does not belong to the tree's data model
224cdf0e10cSrcweir    */
225cdf0e10cSrcweir    ::com::sun::star::awt::Rectangle
226cdf0e10cSrcweir        getNodeRect( [in] XTreeNode Node )
227cdf0e10cSrcweir            raises( ::com::sun::star::lang::IllegalArgumentException );
228cdf0e10cSrcweir
229cdf0e10cSrcweir    // ------------
230cdf0e10cSrcweir    // tree editing
231cdf0e10cSrcweir    // ------------
232cdf0e10cSrcweir
233cdf0e10cSrcweir    /** Returns <TRUE/> if one of tree's nodes is being currently edited.
234cdf0e10cSrcweir        <p>The node that is being edited can be obtained using <method scope="com::sun::star::view">XSelectionSupplier::getSelection()</method>.
235cdf0e10cSrcweir
236cdf0e10cSrcweir        @returns
237cdf0e10cSrcweir            <TRUE/> if the user is currently editing a node
238cdf0e10cSrcweir    */
239cdf0e10cSrcweir    boolean isEditing();
240cdf0e10cSrcweir
241cdf0e10cSrcweir    /** Ends the current editing session.
242cdf0e10cSrcweir        <p>All registered <type>XTreeEditListener</type> are notified if an editing session was in progress</p>
243cdf0e10cSrcweir        <p>Has no effect if the tree isn't being edited.</p>
244cdf0e10cSrcweir
245cdf0e10cSrcweir        @returns
246cdf0e10cSrcweir            <TRUE/> if editing was in progress and is now stopped, <FALSE/> if editing was not in progress
247cdf0e10cSrcweir    */
248cdf0e10cSrcweir    boolean stopEditing();
249cdf0e10cSrcweir
250cdf0e10cSrcweir    /** Cancels the current editing session.
251cdf0e10cSrcweir        <p>Has no effect if the tree isn't being edited.</p>
252cdf0e10cSrcweir    */
253cdf0e10cSrcweir    void cancelEditing();
254cdf0e10cSrcweir
255cdf0e10cSrcweir    /** Selects <var>Node</var> and initiates editing.
256cdf0e10cSrcweir
257cdf0e10cSrcweir        <p>If <member>TreeControlModel::Editable</member> is <FALSE/> or if there are no
258cdf0e10cSrcweir        registered <type>XTreeEditListener</type>, this call has no effect.</p>
259cdf0e10cSrcweir
260cdf0e10cSrcweir        <p>Calling this method also ensures that <var>Node</var> will become visible.</p>
261cdf0e10cSrcweir
262cdf0e10cSrcweir        @param Node
263cdf0e10cSrcweir            the <type>XTreeNode</type> identifying a node.
264cdf0e10cSrcweir
265cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
266cdf0e10cSrcweir            if <var>Node</var> is not a valid node of the corresponding <type>XTreeDataModel</type>.
267cdf0e10cSrcweir    */
268cdf0e10cSrcweir    void startEditingAtNode( [in] XTreeNode Node )
269cdf0e10cSrcweir        raises( ::com::sun::star::lang::IllegalArgumentException );
270cdf0e10cSrcweir
271cdf0e10cSrcweir    /** Adds a <type>XTreeEditListener</type>.
272cdf0e10cSrcweir
273cdf0e10cSrcweir        @param xListener
274cdf0e10cSrcweir            a <type>XTreeEditListener</type> that will be notified
275cdf0e10cSrcweir            before and after a tree node is edited.
276cdf0e10cSrcweir    */
277cdf0e10cSrcweir    void addTreeEditListener( [in] XTreeEditListener Listener );
278cdf0e10cSrcweir
279cdf0e10cSrcweir    /** Removes a <type>XTreeEditListener</type>.
280cdf0e10cSrcweir
281cdf0e10cSrcweir        @param xListener
282cdf0e10cSrcweir            the <type>XTreeEditListener</type> to remove
283cdf0e10cSrcweir    */
284cdf0e10cSrcweir    void removeTreeEditListener( [in] XTreeEditListener Listener );
285cdf0e10cSrcweir};
286cdf0e10cSrcweir
287cdf0e10cSrcweir//=============================================================================
288cdf0e10cSrcweir
289cdf0e10cSrcweir}; }; }; }; };
290cdf0e10cSrcweir
291cdf0e10cSrcweir#endif
292