Difference between revisions of "ObjectInspectorComparison"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Object Inspector 2.0)
m (Object Inspector 2.0)
Line 47: Line 47:
  
 
If you ask to generate code, the fist tab generate :
 
If you ask to generate code, the fist tab generate :
<source code="OOBas">
+
<source lang="OOBas">
 
REM This program stub was automatically created by the  
 
REM This program stub was automatically created by the  
 
REM OpenOffice.org Object Inspector Extension.
 
REM OpenOffice.org Object Inspector Extension.
Line 58: Line 58:
 
</source>
 
</source>
 
instead of what I expected :
 
instead of what I expected :
<source code="OOBas">
+
<source lang="OOBas">
 
Sub Main
 
Sub Main
 
   doc = ThisComponent
 
   doc = ThisComponent

Revision as of 18:01, 10 February 2009

OOoBasic generation

I want to generate OOoBasic code for the example showed here.

Object Inspector 1.0

The old Object Inspector was very easy to use. You never have to "invoke" if you want, only to develop the IDL-tree branchs. It is also able to generate this code :

Sub Main(_oUnoEntryObject as Object)
	Dim xController as Object
	xController = _oUnoEntryObject.getCurrentController()
	Dim oSelection as Object
	oSelection = xController.getSelection()
	Dim oIndex as Object
	oIndex = oSelection.getByIndex(0)
	Dim sString as String
	sString = oIndex.getString()
End Sub

It's a kind of Sub (which I wouldn't name Main) with a parameter. You call it with ThisComponent and it works properly, perhaps with a print sString to see the corresponding result in a message Box. For Instance :

Sub Main
   Main2(ThisComponent)
end Sub
 
Sub Main2(_oUnoEntryObject as Object)
	Dim xController as Object
	xController = _oUnoEntryObject.getCurrentController()
	Dim oSelection as Object
	oSelection = xController.getSelection()
	Dim oIndex as Object
	oIndex = oSelection.getByIndex(0)
	Dim sString as String
	sString = oIndex.getString()
	print sString
End Sub

works for me very well, only with a very little modification if you compare it with the automatic generated code of the first listing.

Object Inspector 2.0

Using this Object Inspector 2.0 is less intuitive for me, than the previous one. It's impossible to walk through the IDL tree. It shows you the result of a method but you have to "invoke" this method to walk trough the complete IDL-Tree and sometimes it doesn't work : for me the getByIndex doesn't work. The problem of invoking is, you create a new "tab" and when generating the code you have to generate the code in every "tab". And you have then also great modifications to do.

I want to resolve the same problem with this new Object Inspector. First a tab ("Sans nom 1") is autmaticaly created and it stops with method getCurrentController : Inspector shows me that the Returned type is : com.sun.star.uno.XInterface but cut the branch here : unable to go further. If you want to go further you have to "invoke" the corresponding method wich gives you a new tab : "getCurrentController result". And so on...

If you ask to generate code, the fist tab generate :

REM This program stub was automatically created by the 
REM OpenOffice.org Object Inspector Extension.
REM See http://api.openoffice.org/ for more information.
 
Sub Main
  doc = StarDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, Array())
 
End Sub

instead of what I expected :

Sub Main
  doc = ThisComponent
 
End Sub
Personal tools