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