Apache OpenOffice (AOO) Bugzilla – Issue 25276
JavaScript and BeanShell script providers do not pass parameters to scripts
Last modified: 2005-01-06 11:25:54 UTC
The JavaScript and BeanShell ScriptProvider implementations do not pass the parameters passed to the invoke command to the scripts. This is particularly important when executing scripts for UI controls in dialogs.
.
This is can be fixed by pushing a global variable called ARGUMENTS into the scope of the BeanShell or JavaScript script when invoking it. The script should then be able to use the ARGUMENTS array to access the parameters and use them. One of the difficulties in assigning a BeanShell or JavaScript script to an event for a UI control (eg. a button in a dialog) is that when the script is executed the ActionEvent object passed in will have the button in its Source member variable, but it won't have the XDialog in which the button is placed. The script will have to get the XDialog by calling getContext on the XControl interface of the button. We should provide examples of how to write BeanShell and JavaScript scripts to handle dialog events.
BeanShell and JavaScript XScript implementations now pass the parameters on to the interpreters via a global array variable called ARGUMENTS. The Highlight example has been modified for BeanShell and JavaScript to include a ButtonPressHandler script that looks for a com.sun.star.awt.ActionEvent as the first element in the ARGUMENTS array. See issue 25271 for a test case to verify this is working.
verified
closing, i have verified this in an m69 build