How does this work? an official Libreoffice 4.1 sample js file imports and uses java code?

Hi, the sample script I am referring to is in the default installation of LibreOffice:

File:“exportsheetstohtml.js”
Location: “C:\Program Files\LibreOffice 4\share\Scripts\javascript\ExportSheetsToHTML”

I was just wondering if there is a software design document explaining how several script languages are implemented.

explaining things like:

(1) how does this work? the above sample js file imports java code, and then uses the java methods throughout the js script?

(1.a) if the js code is runs as a new process, or in a new thread to affect the current document,

(1.b) what language does libreoffice use to parse and run the scripting languages? (ie does libreoffice actually use the ‘official’ script compiler/interpreters engines for (js, py), or does libreoffice use a language like C++ just read the script, then convert it straight to a a C++ command, then run it?

(2) if the js engine (not the js libreoffice api) was made by libreoffice, or if it uses something like the mozilla rhino js engine, or another one.

(3) I can see that there is a python libreoffice api - which could be used outside of a macro I assume. I was thinking, Is it possible to use a general IDE (external to libreoffice) to run some js code on a libreoffice document or set of documents in a folder? ( I am just thinking out loud, trying to build a mental picture, sorry if this is a silly question).
if so, does anyone have some tips to set this up on an IDE like eclipse, or Code::Blocks?

Thanks to the person/s who can give me some info, so I can get a good mental picture of how the scriping engines are implemented, and work from a software developer perspective.

ill have a look at the code, I just thought i’d pop in a post to see if anyone would give an overview.