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's
not easy to translate it in OOBasic</p>
</question>
<answer>
<p>Here you'll find an OOBasic "translation" 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
"introspectedObject" and shows it'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()
' 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
' 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}
' aDescriptor.WindowServiceName = "window"
' aDescriptor.ParentIndex = -1
' 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}
' Use a Toolkit to create a Window
oToolkit = createUnoService("[EMAIL PROTECTED]
com.sun.star.awt.Toolkit}")
oContainerWindow = oToolkit.createWindow(aDescriptor)
' Create a new empty target frame.
oFrame = createUnoService("[EMAIL PROTECTED]
com.sun.star.frame.Frame}")
' Set the container window on it.
oFrame.initialize(oContainerWindow)
' Insert the new frame in desktop hierarchy.
oFrameContainer = StarDesktop.getFrames()
oFrameContainer.append(oFrame)
' Make some other initializations.
oFrame.Name = "newly created 1"
oFrame.Title = "newly created 1"
oContainerWindow.setVisible(True)
' Create the Property Browser Controller
oPropBrowser = CreateUnoService("[EMAIL PROTECTED]
com.sun.star.form.PropertyBrowserController}")
oPropBrowser.attachFrame(oFrame)
' Now we have a component window !
' Make it visible
oFrame.ComponentWindow.setVisible(True)
' Retrieve an UNO Control Model
oDlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
oCtrlModel = oDlg.getModel
'also Form Controls works well(obvious)
' oCtrlModel = ThisComponent.DrawPage.Forms.Standard.PushButton
' 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]