<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Azeeman</id>
	<title>Apache OpenOffice Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Azeeman"/>
	<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/wiki/Special:Contributions/Azeeman"/>
	<updated>2026-06-18T05:47:43Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Basic/Progress_Bar&amp;diff=149877</id>
		<title>Documentation/DevGuide/Basic/Progress Bar</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Basic/Progress_Bar&amp;diff=149877"/>
		<updated>2009-11-26T03:36:12Z</updated>

		<summary type="html">&lt;p&gt;Azeeman: Sample code works when copied and pasted into Basic&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/DevGuide/BasicTOC&lt;br /&gt;
|Basic2d=block&lt;br /&gt;
|BasicControls=block&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|PrevPage=Documentation/DevGuide/Basic/Group Box&lt;br /&gt;
|NextPage=Documentation/DevGuide/Basic/HorizontalVertical Line&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Basic/{{SUBPAGENAME}}}} &lt;br /&gt;
 {{DISPLAYTITLE:Progress Bar}}&lt;br /&gt;
The progress bar control &amp;lt;idl&amp;gt;com.sun.star.awt.UnoControlProgressBar&amp;lt;/idl&amp;gt; displays a growing or shrinking bar to give the user feedback during an operation, for example, the completion of a lengthy task. The minimum and the maximum progress value of the control is set by the &amp;lt;code&amp;gt;ProgressValueMin&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;ProgressValueMax&amp;lt;/code&amp;gt; properties. The progress value is controlled by the &amp;lt;code&amp;gt;ProgressValue&amp;lt;/code&amp;gt; property. By default, the progress bar is blue, but the fill color can be changed by setting the &amp;lt;code&amp;gt;FillColor&amp;lt;/code&amp;gt; property. The functionality of a progress bar is demonstrated in the following example: &lt;br /&gt;
&amp;lt;!--[SOURCE:BasicAndDialogs/ToolkitControls/ProgressBar.xba]--&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Sub ProgressBarDemo()&lt;br /&gt;
	Dim oProgressBar as Object, oProgressBarModel As Object, oDialog as Object&lt;br /&gt;
	Dim ProgressValue As Long&lt;br /&gt;
	REM Dialog1 contains progress bar ProgressBar1 saved in standard library&lt;br /&gt;
	DialogLibraries.loadLibrary(&amp;quot;Standard&amp;quot;)&lt;br /&gt;
	oDialog = CreateUnoDialog(DialogLibraries.Standard.Dialog1)&lt;br /&gt;
	REM progress bar settings&lt;br /&gt;
	Const ProgressValueMin = 0&lt;br /&gt;
	Const ProgressValueMax = 40&lt;br /&gt;
	Const ProgressStep = 4&lt;br /&gt;
	REM set minimum and maximum progress value&lt;br /&gt;
	oProgressBarModel = oDialog.getModel().getByName( &amp;quot;ProgressBar1&amp;quot; )&lt;br /&gt;
	oProgressBarModel.setPropertyValue( &amp;quot;ProgressValueMin&amp;quot;, ProgressValueMin)&lt;br /&gt;
	oProgressBarModel.setPropertyValue( &amp;quot;ProgressValueMax&amp;quot;, ProgressValueMax)&lt;br /&gt;
	REM show progress bar&lt;br /&gt;
	oDialog.setVisible( True )&lt;br /&gt;
	REM increase progress value every second&lt;br /&gt;
	For ProgressValue = ProgressValueMin To ProgressValueMax Step ProgressStep&lt;br /&gt;
		oProgressBarModel.setPropertyValue( &amp;quot;ProgressValue&amp;quot;, ProgressValue )&lt;br /&gt;
		Wait 1000&lt;br /&gt;
	Next ProgressValue&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
{{PDL1}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide/Basic and Dialogs]]&lt;/div&gt;</summary>
		<author><name>Azeeman</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Basic/Progress_Bar&amp;diff=148394</id>
		<title>Documentation/DevGuide/Basic/Progress Bar</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Basic/Progress_Bar&amp;diff=148394"/>
		<updated>2009-11-22T22:46:48Z</updated>

		<summary type="html">&lt;p&gt;Azeeman: Remove button code since it doesn&amp;#039;t work and is not needed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/DevGuide/BasicTOC&lt;br /&gt;
|Basic2d=block&lt;br /&gt;
|BasicControls=block&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|PrevPage=Documentation/DevGuide/Basic/Group Box&lt;br /&gt;
|NextPage=Documentation/DevGuide/Basic/HorizontalVertical Line&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Basic/{{SUBPAGENAME}}}} &lt;br /&gt;
 {{DISPLAYTITLE:Progress Bar}}&lt;br /&gt;
The progress bar control &amp;lt;idl&amp;gt;com.sun.star.awt.UnoControlProgressBar&amp;lt;/idl&amp;gt; displays a growing or shrinking bar to give the user feedback during an operation, for example, the completion of a lengthy task. The minimum and the maximum progress value of the control is set by the &amp;lt;code&amp;gt;ProgressValueMin&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;ProgressValueMax&amp;lt;/code&amp;gt; properties. The progress value is controlled by the &amp;lt;code&amp;gt;ProgressValue&amp;lt;/code&amp;gt; property. By default, the progress bar is blue, but the fill color can be changed by setting the &amp;lt;code&amp;gt;FillColor&amp;lt;/code&amp;gt; property. The functionality of a progress bar is demonstrated in the following example: &lt;br /&gt;
&amp;lt;!--[SOURCE:BasicAndDialogs/ToolkitControls/ProgressBar.xba]--&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
  Sub ProgressBarDemo()&lt;br /&gt;
      Dim oProgressBar As Object, oProgressBarModel As Object&lt;br /&gt;
      Dim ProgressValue As Long&lt;br /&gt;
      REM progress bar settings&lt;br /&gt;
      Const ProgressValueMin = 0&lt;br /&gt;
      Const ProgressValueMax = 40&lt;br /&gt;
      Const ProgressStep = 4&lt;br /&gt;
      REM set minimum and maximum progress value&lt;br /&gt;
      oProgressBarModel = oDialog.Model.ProgressBar1&lt;br /&gt;
      oProgressBarModel.setRange( ProgressValueMin, ProgressValueMax )&lt;br /&gt;
      REM show progress bar&lt;br /&gt;
      oProgressBar = oDialog.getControl(&amp;quot;ProgressBar1&amp;quot;)&lt;br /&gt;
      oProgressBar.setVisible( True )&lt;br /&gt;
      REM increase progress value every second&lt;br /&gt;
      For ProgressValue = &lt;br /&gt;
          ProgressValueMin To ProgressValueMax Step ProgressStep&lt;br /&gt;
          oProgressBarModel.setValue( ProgressValue )&lt;br /&gt;
          Wait 1000&lt;br /&gt;
      Next ProgressValue&lt;br /&gt;
      REM hide progress bar&lt;br /&gt;
      oProgressBar.setVisible( False )&lt;br /&gt;
  End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
{{PDL1}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide/Basic and Dialogs]]&lt;/div&gt;</summary>
		<author><name>Azeeman</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Other_Functions_(Runtime_Library)&amp;diff=148391</id>
		<title>Documentation/BASIC Guide/Other Functions (Runtime Library)</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Other_Functions_(Runtime_Library)&amp;diff=148391"/>
		<updated>2009-11-22T21:00:50Z</updated>

		<summary type="html">&lt;p&gt;Azeeman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Message and Input Boxes (Runtime Library)&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/API Intro&lt;br /&gt;
|runtime=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Other Functions ({{OOo}} Runtime Library)}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
== Beep ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Beep&amp;lt;/tt&amp;gt; function causes the system to play a sound that can be used to warn the user of an incorrect action. &amp;lt;tt&amp;gt;Beep&amp;lt;/tt&amp;gt; does not have any parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Beep     &amp;#039; creates an informative tone&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shell ==&lt;br /&gt;
&lt;br /&gt;
External programs can be started using the Shell function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Shell(Pathname, Windowstyle, Param, bSync)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Pathname : the path of the program to be executed.&lt;br /&gt;
: In MS-Windows, use &amp;lt;tt&amp;gt;ConvertToURL(Pathname)&amp;lt;/tt&amp;gt; otherwise the command will not work if &amp;lt;tt&amp;gt;Pathname&amp;lt;/tt&amp;gt; contains spaces or national characters.&lt;br /&gt;
&lt;br /&gt;
; Windowstyle : the window in which the program is started. &lt;br /&gt;
:The following values are possible: &lt;br /&gt;
:* &amp;lt;tt&amp;gt; 0&amp;lt;/tt&amp;gt; - The program receives the focus and is started in a concealed window. &lt;br /&gt;
:* &amp;lt;tt&amp;gt; 1&amp;lt;/tt&amp;gt; - The program receives the focus and is started in a normal-sized window.&lt;br /&gt;
:* &amp;lt;tt&amp;gt; 2&amp;lt;/tt&amp;gt; - The program receives the focus and is started in a minimized window. &lt;br /&gt;
:* &amp;lt;tt&amp;gt; 3&amp;lt;/tt&amp;gt; - The program receives the focus and is started in a maximized window. &lt;br /&gt;
:* &amp;lt;tt&amp;gt; 4&amp;lt;/tt&amp;gt; - The program is started in a normal-sized window, without receiving the focus. &lt;br /&gt;
:* &amp;lt;tt&amp;gt; 6&amp;lt;/tt&amp;gt; - The program is started in a minimized window, the focus remains in the current window. &lt;br /&gt;
:* &amp;lt;tt&amp;gt;10&amp;lt;/tt&amp;gt; - The program is started in full screen mode. &lt;br /&gt;
&lt;br /&gt;
; Param : command line parameters to be transferred to the program to be started.&lt;br /&gt;
&lt;br /&gt;
; bSync : wait for shell command to finish flag&lt;br /&gt;
:* &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; - wait for shell command to finish&lt;br /&gt;
:* &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt; - don&amp;#039;t wait for shell command to finish&lt;br /&gt;
&lt;br /&gt;
== Wait and WaitUntil ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Wait&amp;lt;/tt&amp;gt; statement suspends program execution for a specified time. The waiting period is specified in milliseconds. The command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Wait 2000&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
specifies a delay of 2 seconds (2000 milliseconds).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;WaitUntil&amp;lt;/tt&amp;gt; statement provides a greater degree of compatibility with VBA parameter usage. &amp;lt;tt&amp;gt;WaitUntil&amp;lt;/tt&amp;gt; takes a parameter of type &amp;lt;tt&amp;gt;Date&amp;lt;/tt&amp;gt;, with a combined date and time value. The command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
WaitUntil Now + TimeValue(&amp;quot;00:00:02&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
specifies the same delay, 2 seconds, as the previous example.&lt;br /&gt;
&lt;br /&gt;
== Environ ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Environ&amp;lt;/tt&amp;gt; function returns the environmental variables of the operating system. Depending on the system and configuration, various types of data are saved here. The following call determines the environment variables of temporary directory of the operating system:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim TempDir&lt;br /&gt;
TempDir=Environ (&amp;quot;TEMP&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Other Functions (Runtime Library)}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Azeeman</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Basic/Progress_Bar&amp;diff=148377</id>
		<title>Documentation/DevGuide/Basic/Progress Bar</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Basic/Progress_Bar&amp;diff=148377"/>
		<updated>2009-11-22T04:57:57Z</updated>

		<summary type="html">&lt;p&gt;Azeeman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/DevGuide/BasicTOC&lt;br /&gt;
|Basic2d=block&lt;br /&gt;
|BasicControls=block&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|PrevPage=Documentation/DevGuide/Basic/Group Box&lt;br /&gt;
|NextPage=Documentation/DevGuide/Basic/HorizontalVertical Line&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Basic/{{SUBPAGENAME}}}} &lt;br /&gt;
 {{DISPLAYTITLE:Progress Bar}}&lt;br /&gt;
The progress bar control &amp;lt;idl&amp;gt;com.sun.star.awt.UnoControlProgressBar&amp;lt;/idl&amp;gt; displays a growing or shrinking bar to give the user feedback during an operation, for example, the completion of a lengthy task. The minimum and the maximum progress value of the control is set by the &amp;lt;code&amp;gt;ProgressValueMin&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;ProgressValueMax&amp;lt;/code&amp;gt; properties. The progress value is controlled by the &amp;lt;code&amp;gt;ProgressValue&amp;lt;/code&amp;gt; property. By default, the progress bar is blue, but the fill color can be changed by setting the &amp;lt;code&amp;gt;FillColor&amp;lt;/code&amp;gt; property. The functionality of a progress bar is demonstrated in the following example: &lt;br /&gt;
&amp;lt;!--[SOURCE:BasicAndDialogs/ToolkitControls/ProgressBar.xba]--&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
  Sub ProgressBarDemo()&lt;br /&gt;
      Dim oProgressBar As Object, oProgressBarModel As Object&lt;br /&gt;
      Dim oCancelButtonModel As Object &lt;br /&gt;
      Dim oStartButtonModel As Object&lt;br /&gt;
      Dim ProgressValue As Long&lt;br /&gt;
      REM progress bar settings&lt;br /&gt;
      Const ProgressValueMin = 0&lt;br /&gt;
      Const ProgressValueMax = 40&lt;br /&gt;
      Const ProgressStep = 4&lt;br /&gt;
      REM set minimum and maximum progress value&lt;br /&gt;
      oProgressBarModel = oDialog.Model.ProgressBar1&lt;br /&gt;
      oProgressBarModel.ProgressValueMin = ProgressValueMin&lt;br /&gt;
      oProgressBarModel.ProgressValueMax = ProgressValueMax&lt;br /&gt;
      REM disable cancel and start button&lt;br /&gt;
      oCancelButtonModel = oDialog.Model.CommandButton1&lt;br /&gt;
      oCancelButtonModel.Enabled = False&lt;br /&gt;
      oStartButtonModel = oDialog.Model.CommandButton2&lt;br /&gt;
      oStartButtonModel.Enabled = False&lt;br /&gt;
      REM show progress bar&lt;br /&gt;
      oProgressBar = oDialog.getControl(&amp;quot;ProgressBar1&amp;quot;)&lt;br /&gt;
      oProgressBar.setVisible( True )&lt;br /&gt;
      REM increase progress value every second&lt;br /&gt;
      For ProgressValue = &lt;br /&gt;
              ProgressValueMin To ProgressValueMax Step ProgressStep&lt;br /&gt;
          oProgressBarModel.ProgressValue = ProgressValue&lt;br /&gt;
          Wait 1000&lt;br /&gt;
      Next ProgressValue&lt;br /&gt;
      REM hide progress bar&lt;br /&gt;
      oProgressBar.setVisible( False )&lt;br /&gt;
      REM enable cancel and start button&lt;br /&gt;
      oCancelButtonModel.Enabled = True&lt;br /&gt;
      oStartButtonModel.Enabled = True&lt;br /&gt;
  End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
{{PDL1}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide/Basic and Dialogs]]&lt;/div&gt;</summary>
		<author><name>Azeeman</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Treecontrol&amp;diff=146148</id>
		<title>Treecontrol</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Treecontrol&amp;diff=146148"/>
		<updated>2009-11-08T00:06:24Z</updated>

		<summary type="html">&lt;p&gt;Azeeman: /* Tree Control Using Basic */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;API Preview: file://x|/cl/awt/com/sun/star/awt/tree/module-ix.html&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|See also an other documentation [[Going_further_with_Dialog_and_Component#The_New_Tree_Control|here]] in OOoBasic first and then in C++.}}&lt;br /&gt;
&lt;br /&gt;
=== The tree control ===&lt;br /&gt;
&lt;br /&gt;
=== The tree control model ===&lt;br /&gt;
&lt;br /&gt;
=== The tree model ===&lt;br /&gt;
&lt;br /&gt;
The tree control needs a tree model that stores the model information of the entries in the tree.&lt;br /&gt;
You can provide your own model which must at least support the interface com.sun.star.awt.XTreeModel.&lt;br /&gt;
Or you can use the service DefaultTreeModel which manages a hierarchy of MutableTreeModels.&lt;br /&gt;
&lt;br /&gt;
==== XTreeNode ====&lt;br /&gt;
&lt;br /&gt;
==== Using the DefaultTreeModel ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define O(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; ComponentContext &amp;gt; xCC(...);&lt;br /&gt;
Reference&amp;lt; XTreeControlModel &amp;gt; xTreeControlModel(...);&lt;br /&gt;
&lt;br /&gt;
// create the root node with the text value &amp;quot;root node text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XMutableTreeNode &amp;gt; xRootNode( MutableTreeNode::create2( xCC, Any( O( &amp;quot;root node text&amp;quot; ) ) ) );&lt;br /&gt;
&lt;br /&gt;
// add two child nodes with text&lt;br /&gt;
xRootNode.appendChild( MutableTreeNode::create2( xCC, Any( O( &amp;quot;child 1&amp;quot; ) ) ) );&lt;br /&gt;
xRootNode.appendChild( MutableTreeNode::create2( xCC, Any( O( &amp;quot;child 2&amp;quot; ) ) ) );&lt;br /&gt;
&lt;br /&gt;
// create the default tree model with the root node&lt;br /&gt;
Reference&amp;lt; XTreeModel &amp;gt; xDefaultTreeModel( DefaultTreeModel::create2( xCC, xRootNode ), UNO_QUERY );&lt;br /&gt;
&lt;br /&gt;
// set the default model at the tree control model&lt;br /&gt;
xTreeControlModel-&amp;gt;setTreeModel( xDefaultTreeModel );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The tree cell renderer ===&lt;br /&gt;
&lt;br /&gt;
The DefaultTreeCellRenderer renders values with the following types:&lt;br /&gt;
&lt;br /&gt;
# OUString&lt;br /&gt;
# sal_Int32, sal_Int16, double, sal_Bool&lt;br /&gt;
# ::com::sun::star::awt::XBitmap&lt;br /&gt;
# ::com::sun::star::graphics::XGraphic&lt;br /&gt;
# ::com::sun::star::awt::XControlModel&lt;br /&gt;
# Sequence&amp;lt; T &amp;gt; where T is one of the supported types&lt;br /&gt;
&lt;br /&gt;
==== Using the DefaultTreeCellRenderer ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define O(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; ComponentContext &amp;gt; xCC(...);&lt;br /&gt;
Reference&amp;lt; XTreeControlModel &amp;gt; xTreeControlModel(...);&lt;br /&gt;
&lt;br /&gt;
// create the default tree cell renderer and tell him to use images before nodes&lt;br /&gt;
Reference&amp;lt; XDefaultTreeCellRenderer &amp;gt; xDefaultRenderer( DefaultTreeCellRenderer::create( xCC ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setExpandedImageURL( O( &amp;quot;expand.png&amp;quot; ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setCollapsedImageURL( O( &amp;quot;collapsed.png&amp;quot; ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setLeafNodeImageURL( O( &amp;quot;leaf.png&amp;quot; ) );&lt;br /&gt;
&lt;br /&gt;
// set the default cell renderer at the tree control model&lt;br /&gt;
xTreeControlModel-&amp;gt;setCellRenderer( Reference&amp;lt; XTreeCellRenderer &amp;gt;( xDefaultTreeModel, UNO_QUERY ) );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Tree Control Using Basic ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
&lt;br /&gt;
&amp;#039;TreeControl using Basic&lt;br /&gt;
&lt;br /&gt;
private oTreeControlDialog as object&lt;br /&gt;
public oTreeControl as object&lt;br /&gt;
private oMutableTreeDataModel as object&lt;br /&gt;
private oTreeModel as object&lt;br /&gt;
&lt;br /&gt;
Sub TreeControl&lt;br /&gt;
	dim oRoot as object&lt;br /&gt;
	dim oParent as object&lt;br /&gt;
	dim oChild as object&lt;br /&gt;
	dim iLevel as integer&lt;br /&gt;
	DialogLibraries.loadLibrary(&amp;quot;Standard&amp;quot;)&lt;br /&gt;
	&amp;#039;Dialog contains Tree Control with name &amp;quot;TreeControl1&lt;br /&gt;
	&amp;#039;To use selectionChange listener; selection type must be changed from &amp;quot;none&amp;quot; to &amp;quot;single&amp;quot;&lt;br /&gt;
	&amp;#039;Dialog also contains button with name &amp;quot;CommandButton1&amp;quot; triggered by mouse pressed event&lt;br /&gt;
	&amp;#039;to call subprogram OkayButton&lt;br /&gt;
	oTreeControlDialog = CreateUnoDialog(DialogLibraries.Standard.Dialog1)&lt;br /&gt;
	&amp;#039;Use mutable tree data model&lt;br /&gt;
	oMutableTreeDataModel = createUnoService(&amp;quot;com.sun.star.awt.tree.MutableTreeDataModel&amp;quot;)&lt;br /&gt;
	&amp;#039;Create root node&lt;br /&gt;
	oRoot = oMutableTreeDataModel.createNode(&amp;quot;Root&amp;quot;, true)&lt;br /&gt;
	&amp;#039;Place node at root of tree&lt;br /&gt;
	oMutableTreeDataModel.setRoot(oRoot)&lt;br /&gt;
	&amp;#039;Create tree consisting of parent and four children&lt;br /&gt;
	oParent = oMutableTreeDataModel.createNode(&amp;quot;Parent&amp;quot;, true)&lt;br /&gt;
	&amp;#039;Append four children to parent&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Parent&lt;br /&gt;
	&amp;#039;		Child 1&lt;br /&gt;
	&amp;#039;		Child 2&lt;br /&gt;
	&amp;#039;		Child 3&lt;br /&gt;
	&amp;#039;		Child 4	&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;	&lt;br /&gt;
	for iLevel = 1 to 4&lt;br /&gt;
		oParent.appendChild(oMutableTreeDataModel.createNode(&amp;quot;Child&amp;quot; &amp;amp; str(iLevel), true))&lt;br /&gt;
	next iLevel&lt;br /&gt;
	&amp;#039;Append grandchild to third child.  Note that index starts at 0&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Parent&lt;br /&gt;
	&amp;#039;		Child 1&lt;br /&gt;
	&amp;#039;		Child 2&lt;br /&gt;
	&amp;#039;		Child 3&lt;br /&gt;
	&amp;#039;				Grandchild 1&lt;br /&gt;
	&amp;#039;				Grandchild 2&lt;br /&gt;
	&amp;#039;				Grandchild 3&lt;br /&gt;
	&amp;#039;		Child 4	&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Get third child&lt;br /&gt;
	oChild = oParent.getChildAt(2)&lt;br /&gt;
	&amp;#039;Add three grandchildren&lt;br /&gt;
	for iLevel = 1 to 3&lt;br /&gt;
		oChild.appendChild(oMutableTreeDataModel.createNode(&amp;quot;Grandchild&amp;quot; &amp;amp; str(iLevel), true))&lt;br /&gt;
	next iLevel&lt;br /&gt;
	&amp;#039;Add great grandchildren to grandchild 1&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Parent&lt;br /&gt;
	&amp;#039;		Child 1&lt;br /&gt;
	&amp;#039;		Child 2&lt;br /&gt;
	&amp;#039;		Child 3&lt;br /&gt;
	&amp;#039;				Grandchild 1&lt;br /&gt;
	&amp;#039;				Grandchild 2&lt;br /&gt;
	&amp;#039;							Greatgrandchild 1&lt;br /&gt;
	&amp;#039;							Greatgrandchild 2&lt;br /&gt;
	&amp;#039;				Grandchild 3&lt;br /&gt;
	&amp;#039;		Child 4	&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;&lt;br /&gt;
	oChild = oParent.getChildAt(2)&lt;br /&gt;
	oChild = oChild.getChildAt(1)&lt;br /&gt;
	for iLevel = 1 to 3&lt;br /&gt;
		oChild.appendChild(oMutableTreeDataModel.createNode(&amp;quot;Greatgrandchild&amp;quot; &amp;amp; str(iLevel), true))&lt;br /&gt;
	next iLevel	&lt;br /&gt;
	&amp;#039;Append tree to root&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Root&lt;br /&gt;
	&amp;#039;	Parent&lt;br /&gt;
	&amp;#039;			Child 1&lt;br /&gt;
	&amp;#039;			Child 2&lt;br /&gt;
	&amp;#039;			Child 3&lt;br /&gt;
	&amp;#039;					Grandchild 1&lt;br /&gt;
	&amp;#039;					Grandchild 2&lt;br /&gt;
	&amp;#039;								Greatgrandchild 1&lt;br /&gt;
	&amp;#039;								Greatgrandchild 2&lt;br /&gt;
	&amp;#039;					Grandchild 3&lt;br /&gt;
	&amp;#039;			Child 4	&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;&lt;br /&gt;
	oRoot.appendChild(oParent)&lt;br /&gt;
	&amp;#039;Insert a new child under Parent&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Root&lt;br /&gt;
	&amp;#039;	Parent&lt;br /&gt;
	&amp;#039;			Child 1&lt;br /&gt;
	&amp;#039;			Child 2&lt;br /&gt;
	&amp;#039;			Child 3&lt;br /&gt;
	&amp;#039;					Grandchild 1&lt;br /&gt;
	&amp;#039;					Grandchild 2&lt;br /&gt;
	&amp;#039;								Greatgrandchild 1&lt;br /&gt;
	&amp;#039;								Greatgrandchild 2&lt;br /&gt;
	&amp;#039;					Grandchild 3&lt;br /&gt;
	&amp;#039;			Child 4	&lt;br /&gt;
	&amp;#039;			Accidental child&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;&lt;br /&gt;
	oParent.insertChildByIndex(4,oMutableTreeDataModel.createNode(&amp;quot;Accidental child&amp;quot;, true)&lt;br /&gt;
	&amp;#039;Place some data in child 1.  Data can be any object; string data is used for simplicity&lt;br /&gt;
	oChild = oParent.getChildAt(0)&lt;br /&gt;
	oChild.dataValue = &amp;quot;Some data for child 1&amp;quot;&lt;br /&gt;
	&amp;#039;Get handle to tree control within dialog&lt;br /&gt;
	oTreeControl = oTreeControlDialog.getControl(&amp;quot;TreeControl1&amp;quot;)&lt;br /&gt;
	&amp;#039;Set tree model to tree control model&lt;br /&gt;
	oTreeModel = oTreeControl.Model&lt;br /&gt;
	&amp;#039;Use mutable tree data model&lt;br /&gt;
	oTreeModel.DataModel = oMutableTreeDataModel&lt;br /&gt;
	&amp;#039;Start the dialog&lt;br /&gt;
	oTreeControlDialog.execute()&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub OkayButton&lt;br /&gt;
	dim oNode as object&lt;br /&gt;
	&amp;#039;Verify that there is a valid selection&lt;br /&gt;
	if oTreeControl.selectionCount &amp;gt; 0 then&lt;br /&gt;
		&amp;#039;Get selected node&lt;br /&gt;
		oNode = oTreeControl.view.getSelection()&lt;br /&gt;
		&amp;#039;Show node display value&lt;br /&gt;
		msgbox(&amp;quot;Selected value &amp;quot; &amp;amp; oNode.displayValue)&lt;br /&gt;
		&amp;#039;Check if node is carrying any data&lt;br /&gt;
		if not isNull(oNode.dataValue) then&lt;br /&gt;
			&amp;#039;Display data payload&lt;br /&gt;
			msgbox(&amp;quot;Payload &amp;quot; &amp;amp; oNode.dataValue)&lt;br /&gt;
		end if&lt;br /&gt;
		&amp;#039;Kill dialog after node has been selected&lt;br /&gt;
		oTreeControlDialog.endExecute()&lt;br /&gt;
	end if&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The tree cell editor ===&lt;br /&gt;
&lt;br /&gt;
=== The listeners ===&lt;br /&gt;
&lt;br /&gt;
==== XTreeModelListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeSelectionListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeExpandListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeWillExpandListener ====&lt;br /&gt;
[[Category:API]]&lt;/div&gt;</summary>
		<author><name>Azeeman</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Treecontrol&amp;diff=146147</id>
		<title>Treecontrol</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Treecontrol&amp;diff=146147"/>
		<updated>2009-11-08T00:05:15Z</updated>

		<summary type="html">&lt;p&gt;Azeeman: /* Example using Basic */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;API Preview: file://x|/cl/awt/com/sun/star/awt/tree/module-ix.html&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|See also an other documentation [[Going_further_with_Dialog_and_Component#The_New_Tree_Control|here]] in OOoBasic first and then in C++.}}&lt;br /&gt;
&lt;br /&gt;
=== The tree control ===&lt;br /&gt;
&lt;br /&gt;
=== The tree control model ===&lt;br /&gt;
&lt;br /&gt;
=== The tree model ===&lt;br /&gt;
&lt;br /&gt;
The tree control needs a tree model that stores the model information of the entries in the tree.&lt;br /&gt;
You can provide your own model which must at least support the interface com.sun.star.awt.XTreeModel.&lt;br /&gt;
Or you can use the service DefaultTreeModel which manages a hierarchy of MutableTreeModels.&lt;br /&gt;
&lt;br /&gt;
==== XTreeNode ====&lt;br /&gt;
&lt;br /&gt;
==== Using the DefaultTreeModel ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define O(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; ComponentContext &amp;gt; xCC(...);&lt;br /&gt;
Reference&amp;lt; XTreeControlModel &amp;gt; xTreeControlModel(...);&lt;br /&gt;
&lt;br /&gt;
// create the root node with the text value &amp;quot;root node text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XMutableTreeNode &amp;gt; xRootNode( MutableTreeNode::create2( xCC, Any( O( &amp;quot;root node text&amp;quot; ) ) ) );&lt;br /&gt;
&lt;br /&gt;
// add two child nodes with text&lt;br /&gt;
xRootNode.appendChild( MutableTreeNode::create2( xCC, Any( O( &amp;quot;child 1&amp;quot; ) ) ) );&lt;br /&gt;
xRootNode.appendChild( MutableTreeNode::create2( xCC, Any( O( &amp;quot;child 2&amp;quot; ) ) ) );&lt;br /&gt;
&lt;br /&gt;
// create the default tree model with the root node&lt;br /&gt;
Reference&amp;lt; XTreeModel &amp;gt; xDefaultTreeModel( DefaultTreeModel::create2( xCC, xRootNode ), UNO_QUERY );&lt;br /&gt;
&lt;br /&gt;
// set the default model at the tree control model&lt;br /&gt;
xTreeControlModel-&amp;gt;setTreeModel( xDefaultTreeModel );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The tree cell renderer ===&lt;br /&gt;
&lt;br /&gt;
The DefaultTreeCellRenderer renders values with the following types:&lt;br /&gt;
&lt;br /&gt;
# OUString&lt;br /&gt;
# sal_Int32, sal_Int16, double, sal_Bool&lt;br /&gt;
# ::com::sun::star::awt::XBitmap&lt;br /&gt;
# ::com::sun::star::graphics::XGraphic&lt;br /&gt;
# ::com::sun::star::awt::XControlModel&lt;br /&gt;
# Sequence&amp;lt; T &amp;gt; where T is one of the supported types&lt;br /&gt;
&lt;br /&gt;
==== Using the DefaultTreeCellRenderer ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define O(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; ComponentContext &amp;gt; xCC(...);&lt;br /&gt;
Reference&amp;lt; XTreeControlModel &amp;gt; xTreeControlModel(...);&lt;br /&gt;
&lt;br /&gt;
// create the default tree cell renderer and tell him to use images before nodes&lt;br /&gt;
Reference&amp;lt; XDefaultTreeCellRenderer &amp;gt; xDefaultRenderer( DefaultTreeCellRenderer::create( xCC ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setExpandedImageURL( O( &amp;quot;expand.png&amp;quot; ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setCollapsedImageURL( O( &amp;quot;collapsed.png&amp;quot; ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setLeafNodeImageURL( O( &amp;quot;leaf.png&amp;quot; ) );&lt;br /&gt;
&lt;br /&gt;
// set the default cell renderer at the tree control model&lt;br /&gt;
xTreeControlModel-&amp;gt;setCellRenderer( Reference&amp;lt; XTreeCellRenderer &amp;gt;( xDefaultTreeModel, UNO_QUERY ) );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Tree Control Using Basic ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
&lt;br /&gt;
&amp;#039;TreeControl using Basic&lt;br /&gt;
&lt;br /&gt;
private oTreeControlDialog as object&lt;br /&gt;
public oTreeControl as object&lt;br /&gt;
private oMutableTreeDataModel as object&lt;br /&gt;
private oTreeModel as object&lt;br /&gt;
&lt;br /&gt;
Sub TreeControl&lt;br /&gt;
	dim oRoot as object&lt;br /&gt;
	dim oParent as object&lt;br /&gt;
	dim oChild as object&lt;br /&gt;
	dim iLevel as integer&lt;br /&gt;
	DialogLibraries.loadLibrary(&amp;quot;Standard&amp;quot;)&lt;br /&gt;
	&amp;#039;Dialog contains Tree Control with name &amp;quot;TreeControl1&lt;br /&gt;
	&amp;#039;To use selectionChange listener; selection type must be changed from &amp;quot;none&amp;quot; to &amp;quot;single&amp;quot;&lt;br /&gt;
	&amp;#039;Dialog also contains button with name &amp;quot;CommandButton1&amp;quot; triggered by mouse pressed event&lt;br /&gt;
	&amp;#039;to call subprogram OkayButton&lt;br /&gt;
	oTreeControlDialog = CreateUnoDialog(DialogLibraries.Standard.Dialog1)&lt;br /&gt;
	&amp;#039;Use mutable tree data model&lt;br /&gt;
	oMutableTreeDataModel = createUnoService(&amp;quot;com.sun.star.awt.tree.MutableTreeDataModel&amp;quot;)&lt;br /&gt;
	&amp;#039;Create root node&lt;br /&gt;
	oRoot = oMutableTreeDataModel.createNode(&amp;quot;Root&amp;quot;, true)&lt;br /&gt;
	&amp;#039;Place node at root of tree&lt;br /&gt;
	oMutableTreeDataModel.setRoot(oRoot)&lt;br /&gt;
	&amp;#039;Create tree consisting of parent and four children&lt;br /&gt;
	oParent = oMutableTreeDataModel.createNode(&amp;quot;Parent&amp;quot;, true)&lt;br /&gt;
	&amp;#039;Append four children to parent&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Parent&lt;br /&gt;
	&amp;#039;		Child 1&lt;br /&gt;
	&amp;#039;		Child 2&lt;br /&gt;
	&amp;#039;		Child 3&lt;br /&gt;
	&amp;#039;		Child 4	&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;	&lt;br /&gt;
	for iLevel = 1 to 4&lt;br /&gt;
		oParent.appendChild(oMutableTreeDataModel.createNode(&amp;quot;Child&amp;quot; &amp;amp; str(iLevel), true))&lt;br /&gt;
	next iLevel&lt;br /&gt;
	&amp;#039;Append grandchild to third child.  Note that index starts at 0&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Parent&lt;br /&gt;
	&amp;#039;		Child 1&lt;br /&gt;
	&amp;#039;		Child 2&lt;br /&gt;
	&amp;#039;		Child 3&lt;br /&gt;
	&amp;#039;				Grandchild 1&lt;br /&gt;
	&amp;#039;				Grandchild 2&lt;br /&gt;
	&amp;#039;				Grandchild 3&lt;br /&gt;
	&amp;#039;		Child 4	&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Get third child&lt;br /&gt;
	oChild = oParent.getChildAt(2)&lt;br /&gt;
	&amp;#039;Add three grandchildren&lt;br /&gt;
	for iLevel = 1 to 3&lt;br /&gt;
		oChild.appendChild(oMutableTreeDataModel.createNode(&amp;quot;Grandchild&amp;quot; &amp;amp; str(iLevel), true))&lt;br /&gt;
	next iLevel&lt;br /&gt;
	&amp;#039;Add great grandchildren to grandchild 1&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Parent&lt;br /&gt;
	&amp;#039;		Child 1&lt;br /&gt;
	&amp;#039;		Child 2&lt;br /&gt;
	&amp;#039;		Child 3&lt;br /&gt;
	&amp;#039;				Grandchild 1&lt;br /&gt;
	&amp;#039;				Grandchild 2&lt;br /&gt;
	&amp;#039;							Greatgrandchild 1&lt;br /&gt;
	&amp;#039;							Greatgrandchild 2&lt;br /&gt;
	&amp;#039;				Grandchild 3&lt;br /&gt;
	&amp;#039;		Child 4	&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;&lt;br /&gt;
	oChild = oParent.getChildAt(2)&lt;br /&gt;
	oChild = oChild.getChildAt(1)&lt;br /&gt;
	for iLevel = 1 to 3&lt;br /&gt;
		oChild.appendChild(oMutableTreeDataModel.createNode(&amp;quot;Greatgrandchild&amp;quot; &amp;amp; str(iLevel), true))&lt;br /&gt;
	next iLevel	&lt;br /&gt;
	&amp;#039;Append tree to root&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Root&lt;br /&gt;
	&amp;#039;	Parent&lt;br /&gt;
	&amp;#039;			Child 1&lt;br /&gt;
	&amp;#039;			Child 2&lt;br /&gt;
	&amp;#039;			Child 3&lt;br /&gt;
	&amp;#039;					Grandchild 1&lt;br /&gt;
	&amp;#039;					Grandchild 2&lt;br /&gt;
	&amp;#039;								Greatgrandchild 1&lt;br /&gt;
	&amp;#039;								Greatgrandchild 2&lt;br /&gt;
	&amp;#039;					Grandchild 3&lt;br /&gt;
	&amp;#039;			Child 4	&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;&lt;br /&gt;
	oRoot.appendChild(oParent)&lt;br /&gt;
	&amp;#039;Insert a new child under Parent&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Root&lt;br /&gt;
	&amp;#039;	Parent&lt;br /&gt;
	&amp;#039;			Child 1&lt;br /&gt;
	&amp;#039;			Child 2&lt;br /&gt;
	&amp;#039;			Child 3&lt;br /&gt;
	&amp;#039;					Grandchild 1&lt;br /&gt;
	&amp;#039;					Grandchild 2&lt;br /&gt;
	&amp;#039;								Greatgrandchild 1&lt;br /&gt;
	&amp;#039;								Greatgrandchild 2&lt;br /&gt;
	&amp;#039;					Grandchild 3&lt;br /&gt;
	&amp;#039;			Child 4	&lt;br /&gt;
	&amp;#039;			Accidental child&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;&lt;br /&gt;
	oParent.insertChildByIndex(4,oMutableTreeDataModel.createNode(&amp;quot;Accidental child&amp;quot;, true)&lt;br /&gt;
	&amp;#039;Place some data in child 1.  Data can be any object; string data is used for simplicity&lt;br /&gt;
	oChild = oParent.getChildAt(0)&lt;br /&gt;
	oChild.dataValue = &amp;quot;Some data for child 1&amp;quot;&lt;br /&gt;
	&amp;#039;Get handle to tree control within dialog&lt;br /&gt;
	oTreeControl = oTreeControlDialog.getControl(&amp;quot;TreeControl1&amp;quot;)&lt;br /&gt;
	&amp;#039;Set tree model to tree control model&lt;br /&gt;
	oTreeModel = oTreeControl.Model&lt;br /&gt;
	&amp;#039;Use mutable tree data model&lt;br /&gt;
	oTreeModel.DataModel = oMutableTreeDataModel&lt;br /&gt;
	&amp;#039;Start the dialog&lt;br /&gt;
	oTreeControlDialog.execute()&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub OkayButton&lt;br /&gt;
	dim oNode as object&lt;br /&gt;
	&amp;#039;Verify that there is a valid selection&lt;br /&gt;
	if oTreeControl.selectionCount &amp;gt; 0 then&lt;br /&gt;
		&amp;#039;Get selected node&lt;br /&gt;
		oNode = oTreeControl.view.getSelection()&lt;br /&gt;
		&amp;#039;Show node display value&lt;br /&gt;
		msgbox(&amp;quot;Selected value &amp;quot; &amp;amp; oNode.displayValue)&lt;br /&gt;
		&amp;#039;Check if node is carrying any data&lt;br /&gt;
		if not isNull(oNode.dataValue) then&lt;br /&gt;
			&amp;#039;Display data payload&lt;br /&gt;
			msgbox(&amp;quot;Payload &amp;quot; &amp;amp; oNode.dataValue)&lt;br /&gt;
		end if&lt;br /&gt;
		&amp;#039;Kill dialog after node has been selected&lt;br /&gt;
		oTreeControlDialog.endExecute()&lt;br /&gt;
	end if&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&lt;br /&gt;
&lt;br /&gt;
=== The tree cell editor ===&lt;br /&gt;
&lt;br /&gt;
=== The listeners ===&lt;br /&gt;
&lt;br /&gt;
==== XTreeModelListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeSelectionListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeExpandListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeWillExpandListener ====&lt;br /&gt;
[[Category:API]]&lt;/div&gt;</summary>
		<author><name>Azeeman</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Treecontrol&amp;diff=146146</id>
		<title>Treecontrol</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Treecontrol&amp;diff=146146"/>
		<updated>2009-11-08T00:01:40Z</updated>

		<summary type="html">&lt;p&gt;Azeeman: /* Using the DefaultTreeModel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;API Preview: file://x|/cl/awt/com/sun/star/awt/tree/module-ix.html&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|See also an other documentation [[Going_further_with_Dialog_and_Component#The_New_Tree_Control|here]] in OOoBasic first and then in C++.}}&lt;br /&gt;
&lt;br /&gt;
=== The tree control ===&lt;br /&gt;
&lt;br /&gt;
=== The tree control model ===&lt;br /&gt;
&lt;br /&gt;
=== The tree model ===&lt;br /&gt;
&lt;br /&gt;
The tree control needs a tree model that stores the model information of the entries in the tree.&lt;br /&gt;
You can provide your own model which must at least support the interface com.sun.star.awt.XTreeModel.&lt;br /&gt;
Or you can use the service DefaultTreeModel which manages a hierarchy of MutableTreeModels.&lt;br /&gt;
&lt;br /&gt;
==== XTreeNode ====&lt;br /&gt;
&lt;br /&gt;
==== Using the DefaultTreeModel ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define O(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; ComponentContext &amp;gt; xCC(...);&lt;br /&gt;
Reference&amp;lt; XTreeControlModel &amp;gt; xTreeControlModel(...);&lt;br /&gt;
&lt;br /&gt;
// create the root node with the text value &amp;quot;root node text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XMutableTreeNode &amp;gt; xRootNode( MutableTreeNode::create2( xCC, Any( O( &amp;quot;root node text&amp;quot; ) ) ) );&lt;br /&gt;
&lt;br /&gt;
// add two child nodes with text&lt;br /&gt;
xRootNode.appendChild( MutableTreeNode::create2( xCC, Any( O( &amp;quot;child 1&amp;quot; ) ) ) );&lt;br /&gt;
xRootNode.appendChild( MutableTreeNode::create2( xCC, Any( O( &amp;quot;child 2&amp;quot; ) ) ) );&lt;br /&gt;
&lt;br /&gt;
// create the default tree model with the root node&lt;br /&gt;
Reference&amp;lt; XTreeModel &amp;gt; xDefaultTreeModel( DefaultTreeModel::create2( xCC, xRootNode ), UNO_QUERY );&lt;br /&gt;
&lt;br /&gt;
// set the default model at the tree control model&lt;br /&gt;
xTreeControlModel-&amp;gt;setTreeModel( xDefaultTreeModel );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example using Basic ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
&lt;br /&gt;
&amp;#039;TreeControl using Basic&lt;br /&gt;
&lt;br /&gt;
private oTreeControlDialog as object&lt;br /&gt;
public oTreeControl as object&lt;br /&gt;
private oMutableTreeDataModel as object&lt;br /&gt;
private oTreeModel as object&lt;br /&gt;
&lt;br /&gt;
Sub TreeControl&lt;br /&gt;
	dim oRoot as object&lt;br /&gt;
	dim oParent as object&lt;br /&gt;
	dim oChild as object&lt;br /&gt;
	dim iLevel as integer&lt;br /&gt;
	DialogLibraries.loadLibrary(&amp;quot;Standard&amp;quot;)&lt;br /&gt;
	&amp;#039;Dialog contains Tree Control with name &amp;quot;TreeControl1&lt;br /&gt;
	&amp;#039;To use selectionChange listener; selection type must be changed from &amp;quot;none&amp;quot; to &amp;quot;single&amp;quot;&lt;br /&gt;
	&amp;#039;Dialog also contains button with name &amp;quot;CommandButton1&amp;quot; triggered by mouse pressed event&lt;br /&gt;
	&amp;#039;to call subprogram OkayButton&lt;br /&gt;
	oTreeControlDialog = CreateUnoDialog(DialogLibraries.Standard.Dialog1)&lt;br /&gt;
	&amp;#039;Use mutable tree data model&lt;br /&gt;
	oMutableTreeDataModel = createUnoService(&amp;quot;com.sun.star.awt.tree.MutableTreeDataModel&amp;quot;)&lt;br /&gt;
	&amp;#039;Create root node&lt;br /&gt;
	oRoot = oMutableTreeDataModel.createNode(&amp;quot;Root&amp;quot;, true)&lt;br /&gt;
	&amp;#039;Place node at root of tree&lt;br /&gt;
	oMutableTreeDataModel.setRoot(oRoot)&lt;br /&gt;
	&amp;#039;Create tree consisting of parent and four children&lt;br /&gt;
	oParent = oMutableTreeDataModel.createNode(&amp;quot;Parent&amp;quot;, true)&lt;br /&gt;
	&amp;#039;Append four children to parent&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Parent&lt;br /&gt;
	&amp;#039;		Child 1&lt;br /&gt;
	&amp;#039;		Child 2&lt;br /&gt;
	&amp;#039;		Child 3&lt;br /&gt;
	&amp;#039;		Child 4	&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;	&lt;br /&gt;
	for iLevel = 1 to 4&lt;br /&gt;
		oParent.appendChild(oMutableTreeDataModel.createNode(&amp;quot;Child&amp;quot; &amp;amp; str(iLevel), true))&lt;br /&gt;
	next iLevel&lt;br /&gt;
	&amp;#039;Append grandchild to third child.  Note that index starts at 0&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Parent&lt;br /&gt;
	&amp;#039;		Child 1&lt;br /&gt;
	&amp;#039;		Child 2&lt;br /&gt;
	&amp;#039;		Child 3&lt;br /&gt;
	&amp;#039;				Grandchild 1&lt;br /&gt;
	&amp;#039;				Grandchild 2&lt;br /&gt;
	&amp;#039;				Grandchild 3&lt;br /&gt;
	&amp;#039;		Child 4	&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Get third child&lt;br /&gt;
	oChild = oParent.getChildAt(2)&lt;br /&gt;
	&amp;#039;Add three grandchildren&lt;br /&gt;
	for iLevel = 1 to 3&lt;br /&gt;
		oChild.appendChild(oMutableTreeDataModel.createNode(&amp;quot;Grandchild&amp;quot; &amp;amp; str(iLevel), true))&lt;br /&gt;
	next iLevel&lt;br /&gt;
	&amp;#039;Add great grandchildren to grandchild 1&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Parent&lt;br /&gt;
	&amp;#039;		Child 1&lt;br /&gt;
	&amp;#039;		Child 2&lt;br /&gt;
	&amp;#039;		Child 3&lt;br /&gt;
	&amp;#039;				Grandchild 1&lt;br /&gt;
	&amp;#039;				Grandchild 2&lt;br /&gt;
	&amp;#039;							Greatgrandchild 1&lt;br /&gt;
	&amp;#039;							Greatgrandchild 2&lt;br /&gt;
	&amp;#039;				Grandchild 3&lt;br /&gt;
	&amp;#039;		Child 4	&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;&lt;br /&gt;
	oChild = oParent.getChildAt(2)&lt;br /&gt;
	oChild = oChild.getChildAt(1)&lt;br /&gt;
	for iLevel = 1 to 3&lt;br /&gt;
		oChild.appendChild(oMutableTreeDataModel.createNode(&amp;quot;Greatgrandchild&amp;quot; &amp;amp; str(iLevel), true))&lt;br /&gt;
	next iLevel	&lt;br /&gt;
	&amp;#039;Append tree to root&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Root&lt;br /&gt;
	&amp;#039;	Parent&lt;br /&gt;
	&amp;#039;			Child 1&lt;br /&gt;
	&amp;#039;			Child 2&lt;br /&gt;
	&amp;#039;			Child 3&lt;br /&gt;
	&amp;#039;					Grandchild 1&lt;br /&gt;
	&amp;#039;					Grandchild 2&lt;br /&gt;
	&amp;#039;								Greatgrandchild 1&lt;br /&gt;
	&amp;#039;								Greatgrandchild 2&lt;br /&gt;
	&amp;#039;					Grandchild 3&lt;br /&gt;
	&amp;#039;			Child 4	&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;&lt;br /&gt;
	oRoot.appendChild(oParent)&lt;br /&gt;
	&amp;#039;Insert a new child under Parent&lt;br /&gt;
	&amp;#039;&amp;lt;Tree&amp;gt;&lt;br /&gt;
	&amp;#039;Root&lt;br /&gt;
	&amp;#039;	Parent&lt;br /&gt;
	&amp;#039;			Child 1&lt;br /&gt;
	&amp;#039;			Child 2&lt;br /&gt;
	&amp;#039;			Child 3&lt;br /&gt;
	&amp;#039;					Grandchild 1&lt;br /&gt;
	&amp;#039;					Grandchild 2&lt;br /&gt;
	&amp;#039;								Greatgrandchild 1&lt;br /&gt;
	&amp;#039;								Greatgrandchild 2&lt;br /&gt;
	&amp;#039;					Grandchild 3&lt;br /&gt;
	&amp;#039;			Child 4	&lt;br /&gt;
	&amp;#039;			Accidental child&lt;br /&gt;
	&amp;#039;&amp;lt;/Tree&amp;gt;&lt;br /&gt;
	oParent.insertChildByIndex(4,oMutableTreeDataModel.createNode(&amp;quot;Accidental child&amp;quot;, true)&lt;br /&gt;
	&amp;#039;Place some data in child 1.  Data can be any object; string data is used for simplicity&lt;br /&gt;
	oChild = oParent.getChildAt(0)&lt;br /&gt;
	oChild.dataValue = &amp;quot;Some data for child 1&amp;quot;&lt;br /&gt;
	&amp;#039;Get handle to tree control within dialog&lt;br /&gt;
	oTreeControl = oTreeControlDialog.getControl(&amp;quot;TreeControl1&amp;quot;)&lt;br /&gt;
	&amp;#039;Set tree model to tree control model&lt;br /&gt;
	oTreeModel = oTreeControl.Model&lt;br /&gt;
	&amp;#039;Use mutable tree data model&lt;br /&gt;
	oTreeModel.DataModel = oMutableTreeDataModel&lt;br /&gt;
	&amp;#039;Start the dialog&lt;br /&gt;
	oTreeControlDialog.execute()&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub OkayButton&lt;br /&gt;
	dim oNode as object&lt;br /&gt;
	&amp;#039;Verify that there is a valid selection&lt;br /&gt;
	if oTreeControl.selectionCount &amp;gt; 0 then&lt;br /&gt;
		&amp;#039;Get selected node&lt;br /&gt;
		oNode = oTreeControl.view.getSelection()&lt;br /&gt;
		&amp;#039;Show node display value&lt;br /&gt;
		msgbox(&amp;quot;Selected value &amp;quot; &amp;amp; oNode.displayValue)&lt;br /&gt;
		&amp;#039;Check if node is carrying any data&lt;br /&gt;
		if not isNull(oNode.dataValue) then&lt;br /&gt;
			&amp;#039;Display data payload&lt;br /&gt;
			msgbox(&amp;quot;Payload &amp;quot; &amp;amp; oNode.dataValue)&lt;br /&gt;
		end if&lt;br /&gt;
		&amp;#039;Kill dialog after node has been selected&lt;br /&gt;
		oTreeControlDialog.endExecute()&lt;br /&gt;
	end if&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&lt;br /&gt;
&lt;br /&gt;
=== The tree cell renderer ===&lt;br /&gt;
&lt;br /&gt;
The DefaultTreeCellRenderer renders values with the following types:&lt;br /&gt;
&lt;br /&gt;
# OUString&lt;br /&gt;
# sal_Int32, sal_Int16, double, sal_Bool&lt;br /&gt;
# ::com::sun::star::awt::XBitmap&lt;br /&gt;
# ::com::sun::star::graphics::XGraphic&lt;br /&gt;
# ::com::sun::star::awt::XControlModel&lt;br /&gt;
# Sequence&amp;lt; T &amp;gt; where T is one of the supported types&lt;br /&gt;
&lt;br /&gt;
==== Using the DefaultTreeCellRenderer ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define O(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; ComponentContext &amp;gt; xCC(...);&lt;br /&gt;
Reference&amp;lt; XTreeControlModel &amp;gt; xTreeControlModel(...);&lt;br /&gt;
&lt;br /&gt;
// create the default tree cell renderer and tell him to use images before nodes&lt;br /&gt;
Reference&amp;lt; XDefaultTreeCellRenderer &amp;gt; xDefaultRenderer( DefaultTreeCellRenderer::create( xCC ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setExpandedImageURL( O( &amp;quot;expand.png&amp;quot; ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setCollapsedImageURL( O( &amp;quot;collapsed.png&amp;quot; ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setLeafNodeImageURL( O( &amp;quot;leaf.png&amp;quot; ) );&lt;br /&gt;
&lt;br /&gt;
// set the default cell renderer at the tree control model&lt;br /&gt;
xTreeControlModel-&amp;gt;setCellRenderer( Reference&amp;lt; XTreeCellRenderer &amp;gt;( xDefaultTreeModel, UNO_QUERY ) );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The tree cell editor ===&lt;br /&gt;
&lt;br /&gt;
=== The listeners ===&lt;br /&gt;
&lt;br /&gt;
==== XTreeModelListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeSelectionListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeExpandListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeWillExpandListener ====&lt;br /&gt;
[[Category:API]]&lt;/div&gt;</summary>
		<author><name>Azeeman</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Treecontrol&amp;diff=146139</id>
		<title>Treecontrol</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Treecontrol&amp;diff=146139"/>
		<updated>2009-11-07T23:57:26Z</updated>

		<summary type="html">&lt;p&gt;Azeeman: /* The tree model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;API Preview: file://x|/cl/awt/com/sun/star/awt/tree/module-ix.html&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|See also an other documentation [[Going_further_with_Dialog_and_Component#The_New_Tree_Control|here]] in OOoBasic first and then in C++.}}&lt;br /&gt;
&lt;br /&gt;
=== The tree control ===&lt;br /&gt;
&lt;br /&gt;
=== The tree control model ===&lt;br /&gt;
&lt;br /&gt;
=== The tree model ===&lt;br /&gt;
&lt;br /&gt;
The tree control needs a tree model that stores the model information of the entries in the tree.&lt;br /&gt;
You can provide your own model which must at least support the interface com.sun.star.awt.XTreeModel.&lt;br /&gt;
Or you can use the service DefaultTreeModel which manages a hierarchy of MutableTreeModels.&lt;br /&gt;
&lt;br /&gt;
==== XTreeNode ====&lt;br /&gt;
&lt;br /&gt;
==== Using the DefaultTreeModel ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define O(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; ComponentContext &amp;gt; xCC(...);&lt;br /&gt;
Reference&amp;lt; XTreeControlModel &amp;gt; xTreeControlModel(...);&lt;br /&gt;
&lt;br /&gt;
// create the root node with the text value &amp;quot;root node text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XMutableTreeNode &amp;gt; xRootNode( MutableTreeNode::create2( xCC, Any( O( &amp;quot;root node text&amp;quot; ) ) ) );&lt;br /&gt;
&lt;br /&gt;
// add two child nodes with text&lt;br /&gt;
xRootNode.appendChild( MutableTreeNode::create2( xCC, Any( O( &amp;quot;child 1&amp;quot; ) ) ) );&lt;br /&gt;
xRootNode.appendChild( MutableTreeNode::create2( xCC, Any( O( &amp;quot;child 2&amp;quot; ) ) ) );&lt;br /&gt;
&lt;br /&gt;
// create the default tree model with the root node&lt;br /&gt;
Reference&amp;lt; XTreeModel &amp;gt; xDefaultTreeModel( DefaultTreeModel::create2( xCC, xRootNode ), UNO_QUERY );&lt;br /&gt;
&lt;br /&gt;
// set the default model at the tree control model&lt;br /&gt;
xTreeControlModel-&amp;gt;setTreeModel( xDefaultTreeModel );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The tree cell renderer ===&lt;br /&gt;
&lt;br /&gt;
The DefaultTreeCellRenderer renders values with the following types:&lt;br /&gt;
&lt;br /&gt;
# OUString&lt;br /&gt;
# sal_Int32, sal_Int16, double, sal_Bool&lt;br /&gt;
# ::com::sun::star::awt::XBitmap&lt;br /&gt;
# ::com::sun::star::graphics::XGraphic&lt;br /&gt;
# ::com::sun::star::awt::XControlModel&lt;br /&gt;
# Sequence&amp;lt; T &amp;gt; where T is one of the supported types&lt;br /&gt;
&lt;br /&gt;
==== Using the DefaultTreeCellRenderer ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define O(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; ComponentContext &amp;gt; xCC(...);&lt;br /&gt;
Reference&amp;lt; XTreeControlModel &amp;gt; xTreeControlModel(...);&lt;br /&gt;
&lt;br /&gt;
// create the default tree cell renderer and tell him to use images before nodes&lt;br /&gt;
Reference&amp;lt; XDefaultTreeCellRenderer &amp;gt; xDefaultRenderer( DefaultTreeCellRenderer::create( xCC ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setExpandedImageURL( O( &amp;quot;expand.png&amp;quot; ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setCollapsedImageURL( O( &amp;quot;collapsed.png&amp;quot; ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setLeafNodeImageURL( O( &amp;quot;leaf.png&amp;quot; ) );&lt;br /&gt;
&lt;br /&gt;
// set the default cell renderer at the tree control model&lt;br /&gt;
xTreeControlModel-&amp;gt;setCellRenderer( Reference&amp;lt; XTreeCellRenderer &amp;gt;( xDefaultTreeModel, UNO_QUERY ) );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The tree cell editor ===&lt;br /&gt;
&lt;br /&gt;
=== The listeners ===&lt;br /&gt;
&lt;br /&gt;
==== XTreeModelListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeSelectionListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeExpandListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeWillExpandListener ====&lt;br /&gt;
[[Category:API]]&lt;/div&gt;</summary>
		<author><name>Azeeman</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Treecontrol&amp;diff=146121</id>
		<title>Treecontrol</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Treecontrol&amp;diff=146121"/>
		<updated>2009-11-07T18:22:35Z</updated>

		<summary type="html">&lt;p&gt;Azeeman: /* The tree model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;API Preview: file://x|/cl/awt/com/sun/star/awt/tree/module-ix.html&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|See also an other documentation [[Going_further_with_Dialog_and_Component#The_New_Tree_Control|here]] in OOoBasic first and then in C++.}}&lt;br /&gt;
&lt;br /&gt;
=== The tree control ===&lt;br /&gt;
&lt;br /&gt;
=== The tree control model ===&lt;br /&gt;
&lt;br /&gt;
=== The tree model ===&lt;br /&gt;
&lt;br /&gt;
The tree control needs a tree model that stores the model information of the entries in the tree.&lt;br /&gt;
You can provide your own model which must at least support the interface com.sun.star.awt.XTreeModel.&lt;br /&gt;
Or you can use the service DefaultTreeModel which manages a hirarchie of MutableTreeModels.&lt;br /&gt;
&lt;br /&gt;
==== XTreeNode ====&lt;br /&gt;
&lt;br /&gt;
==== Using the DefaultTreeModel ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define O(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; ComponentContext &amp;gt; xCC(...);&lt;br /&gt;
Reference&amp;lt; XTreeControlModel &amp;gt; xTreeControlModel(...);&lt;br /&gt;
&lt;br /&gt;
// create the root node with the text value &amp;quot;root node text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XMutableTreeNode &amp;gt; xRootNode( MutableTreeNode::create2( xCC, Any( O( &amp;quot;root node text&amp;quot; ) ) ) );&lt;br /&gt;
&lt;br /&gt;
// add two child nodes with text&lt;br /&gt;
xRootNode.appendChild( MutableTreeNode::create2( xCC, Any( O( &amp;quot;child 1&amp;quot; ) ) ) );&lt;br /&gt;
xRootNode.appendChild( MutableTreeNode::create2( xCC, Any( O( &amp;quot;child 2&amp;quot; ) ) ) );&lt;br /&gt;
&lt;br /&gt;
// create the default tree model with the root node&lt;br /&gt;
Reference&amp;lt; XTreeModel &amp;gt; xDefaultTreeModel( DefaultTreeModel::create2( xCC, xRootNode ), UNO_QUERY );&lt;br /&gt;
&lt;br /&gt;
// set the default model at the tree control model&lt;br /&gt;
xTreeControlModel-&amp;gt;setTreeModel( xDefaultTreeModel );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The tree cell renderer ===&lt;br /&gt;
&lt;br /&gt;
The DefaultTreeCellRenderer renders values with the following types:&lt;br /&gt;
&lt;br /&gt;
# OUString&lt;br /&gt;
# sal_Int32, sal_Int16, double, sal_Bool&lt;br /&gt;
# ::com::sun::star::awt::XBitmap&lt;br /&gt;
# ::com::sun::star::graphics::XGraphic&lt;br /&gt;
# ::com::sun::star::awt::XControlModel&lt;br /&gt;
# Sequence&amp;lt; T &amp;gt; where T is one of the supported types&lt;br /&gt;
&lt;br /&gt;
==== Using the DefaultTreeCellRenderer ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define O(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; ComponentContext &amp;gt; xCC(...);&lt;br /&gt;
Reference&amp;lt; XTreeControlModel &amp;gt; xTreeControlModel(...);&lt;br /&gt;
&lt;br /&gt;
// create the default tree cell renderer and tell him to use images before nodes&lt;br /&gt;
Reference&amp;lt; XDefaultTreeCellRenderer &amp;gt; xDefaultRenderer( DefaultTreeCellRenderer::create( xCC ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setExpandedImageURL( O( &amp;quot;expand.png&amp;quot; ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setCollapsedImageURL( O( &amp;quot;collapsed.png&amp;quot; ) );&lt;br /&gt;
xDefaultRenderer-&amp;gt;setLeafNodeImageURL( O( &amp;quot;leaf.png&amp;quot; ) );&lt;br /&gt;
&lt;br /&gt;
// set the default cell renderer at the tree control model&lt;br /&gt;
xTreeControlModel-&amp;gt;setCellRenderer( Reference&amp;lt; XTreeCellRenderer &amp;gt;( xDefaultTreeModel, UNO_QUERY ) );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The tree cell editor ===&lt;br /&gt;
&lt;br /&gt;
=== The listeners ===&lt;br /&gt;
&lt;br /&gt;
==== XTreeModelListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeSelectionListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeExpandListener ====&lt;br /&gt;
&lt;br /&gt;
==== XTreeWillExpandListener ====&lt;/div&gt;</summary>
		<author><name>Azeeman</name></author>
	</entry>
</feed>