Macro in JS: How to access ThisComponent-equivalent, run findAll

I would like to execute the command “findAll” in a Javascript Macro. In Basic, one can access thisComponent and access its findAll method (See e.g. p405 of OpenOffice.org Macros Explained)

However, javascript does not have thisComponent. I tried

importClass(Packages.com.sun.star.frame.XDesktop)
var currentComp = XDesktop.getCurrentComponent()

to get the current document (as described in http://www.pitonyak.org/AndrewMacro.odt, section 3.6.9.2) but it failed silently.

I also tried

var desktop = XSCRIPTCONTEXT.getDesktop();
var comp = desktop.getCurrentComponent();

…which gives me something, but that returned object does not have the findAll-Method.

How to run findAll() in a JS Macro?

You may get some replies if you join and post in the OpenOffice forum here. It has been going for a long time and I have seen questions regarding the use of JavaScript there.

If you get an answer post it back here.