Hi, 

I've attached a code snippet with an example of use of the 
css.form.PropertyBrowserController

The IDL documentation contains already a Java example for this service but 
I've thought that an OOBasic translation would have been useful too.

For Tom:
I've tried to use the new extensions:
{see $IDL_Reference}
{link $IDL_Reference}

I hope to have done it correctly, but please, have a look before to put the 
snippet in the repository.

ciao
Paolo M. 
<?xml version="1.0"?>

<!--
$RCSfile: index.html,v $

last change: $Revision: $ $Author: $ $Date: $

(c)2003 by the copyright holders listed with the author-tags.
If no explicit copyright holder is mentioned with a certain author,
the author him-/herself is the copyright holder. All rights reserved.

Public Documentation License Notice:

The contents of this Documentation are subject to the
Public Documentation License Version 1.0 (the "License");
you may only use this Documentation if you comply with
the terms of this License. A copy of the License is
available at http://www.openoffice.org/licenses/PDL.html

The Original Documentation can be found in the CVS archives
of openoffice.org at the place specified by RCSfile: in this header.

The Initial Writer(s) of the Original Documentation are listed
with the author-tags below.

The Contributor(s) are listed with the author-tags below
without the marker for being an initial author.

All Rights Reserved.
-->

<snippet language="OOBasic" application="Office">

<keywords>
        <keyword>Property Browser</keyword>
        <keyword>com.sun.star.awt.Toolkit</keyword>
        <keyword>com.sun.star.frame.Frame</keyword>
        <keyword>com.sun.star.form.PropertyBrowserController</keyword>
        <keyword>introspectedObject</keyword>
</keywords>

<authors>
        <author id="paolomantovani" initial="true" email="[EMAIL 
PROTECTED]">Paolo Mantovani</author>
</authors>

<versions>
        <version number="1.1.3" status="tested"/>
        <version number="1.1.4" status="tested"/>
        <version number="1.1.x" status="may_work"/>
</versions>

<operating-systems>
        <operating-system name="All"/>
</operating-systems>

<question heading="Use of the PropertyBrowserController service">
Is it possible to use the service [EMAIL PROTECTED] 
com.sun.star.form.PropertyBrowserController} from a OOBasic macro ?
<p>The IDL documentation contains a java example for this service but it&apos;s 
not easy to translate it in OOBasic</p>
</question>

<answer>
<p>Here you&apos;ll find an OOBasic &quot;translation&quot; of the example in 
the IDL documentation for the service 
com.sun.star.form.PropertyBrowserController.</p>
<p>The code does the following operations:</p>
<ul>
        <li>creates a new container window</li>
        <li>creates a new empty frame and set the container window on it</li>
        <li>creates the Property Browser controller and attach it on the 
frame</li>
        <li>finally, takes an UNO control model as 
&quot;introspectedObject&quot; and shows it&apos;s properties and events</li>
</ul>
<p></p>
<p>To see it working:</p>
<p>Open the OOBasic IDE, add a new empty dialog (this will be the introspected 
Object)  and run the following code:</p>
<p></p>
<listing>
REM  *****  BASIC  *****

Sub ShowPropertyBrowser()

        &apos; Create a rectangle struct
        Dim aRect As New [EMAIL PROTECTED] com.sun.star.awt.Rectangle}
        aRect.Y    = 0
        aRect.X   = 0
        aRect.width  = 350
        aRect.height = 550

        &apos; Create a window descriptor and set up its properties
        Dim aDescriptor As New [EMAIL PROTECTED] 
com.sun.star.awt.WindowDescriptor}
        aDescriptor.Type = [EMAIL PROTECTED] com.sun.star.awt.WindowClass.TOP}
&apos;  aDescriptor.WindowServiceName = &quot;window&quot;
&apos;  aDescriptor.ParentIndex = -1
&apos;  aDescriptor.Parent = Null 'not available in OOBasic
        aDescriptor.Bounds = aRect

        aDescriptor.WindowAttributes = _
        [EMAIL PROTECTED] com.sun.star.awt.WindowAttribute.BORDER} + _
        [EMAIL PROTECTED] com.sun.star.awt.WindowAttribute.MOVEABLE} + _
        [EMAIL PROTECTED] com.sun.star.awt.WindowAttribute.SIZEABLE} + _
        [EMAIL PROTECTED] com.sun.star.awt.WindowAttribute.CLOSEABLE}

        &apos; Use a Toolkit to create a Window
        oToolkit = createUnoService(&quot;[EMAIL PROTECTED] 
com.sun.star.awt.Toolkit}&quot;)
        oContainerWindow = oToolkit.createWindow(aDescriptor)

        &apos; Create a new empty target frame.
        oFrame = createUnoService(&quot;[EMAIL PROTECTED] 
com.sun.star.frame.Frame}&quot;)

        &apos; Set the container window on it.
        oFrame.initialize(oContainerWindow)

        &apos; Insert the new frame in desktop hierarchy.
        oFrameContainer = StarDesktop.getFrames()
        oFrameContainer.append(oFrame)

        &apos; Make some other initializations.
        oFrame.Name = &quot;newly created 1&quot;
        oFrame.Title = &quot;newly created 1&quot;
        oContainerWindow.setVisible(True)       
                
        &apos; Create the Property Browser Controller
        oPropBrowser = CreateUnoService(&quot;[EMAIL PROTECTED] 
com.sun.star.form.PropertyBrowserController}&quot;)
        oPropBrowser.attachFrame(oFrame)
        
        &apos; Now we have a component window !
        &apos; Make it visible
        oFrame.ComponentWindow.setVisible(True) 

        &apos; Retrieve an UNO Control Model
        oDlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
        oCtrlModel = oDlg.getModel
        
        &apos;also Form Controls works well(obvious)
&apos;  oCtrlModel = ThisComponent.DrawPage.Forms.Standard.PushButton
                
        &apos; Show Control properties in the browser
        oPropBrowser.introspectedObject = oCtrlModel

End Sub

</listing>
</answer>

<changelog>
        <change author-id="paolomantovani" date="2005-03-14">Initial 
version</change>
</changelog>

</snippet>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to