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?