To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=85298


User fs changed the following:

                What    |Old value                 |New value
================================================================================
                      CC|''                        |'cd,fs,npower'
--------------------------------------------------------------------------------
                 Summary|When a Java macro is assig|Java macros assigned to a 
                        |ned to a toolbar button, i|toolbar button cannot be e
                        |t is invoked with an extra|xecuted from there
                        | Short argument           |
--------------------------------------------------------------------------------




------- Additional comments from [EMAIL PROTECTED] Wed Jan 16 17:41:51 +0000 
2008 -------
(took the liberty to make the summary more concise)

fs->ab,cd,npower: Not sure who is to blame for this ...
When the user clicks the toolbar button, then the protocol handler for script
URLs (scripting/source/protocolhandler/scripthandler.cxx) is invoked
(ScriptProtocolHandler::dispatchWithNotification). The framework passes an
argument "KeyModifier" to this method, obviously to allow the user to press
modifier keys when executing the toolbar slot.

However, the ScriptProtocolHandler implementation passes all the arguments it
gets (except "Referrer") to the XScript::invoke method (after stripping the 
name).

Thus, the actual script is invoked with an additional parameter of type short.
Unless all other script languages, Java is strictly type-safe, so in fact a Java
method taking an XScriptContext and an additional short is searched - and not 
found.

I could imagine different solutions:

- let the ScriptProtocolHandler also strip the "KeyModifier" argument. This
  might, in theory, break existing scripts in other script languages

- the the JavaScriptProvider (resp. its XScript implementation) fall back
  to a method without the additional "short" parameter, if it doesn't find
  such a method.
  This is kind of magic, and probably hard to maintain.

- add some additional "invokeWithContext" (or so) method to XScript, which
  takes an explicit "KeyModifier"  (and maybe more) parameter.
  Might be overkill.

- Declare this as feature: If you want to execute your Java code from within
  a toolbar, then add a method taking an additional short parameter.
  This is somewhat hacky IMO, since the fact that the short is a KeyModifier
  is known in the toolbar and in the final Java code only, inbetween, it is
  only transported as mere short. This means that if, for whatever other
  reasons, other shorts are transported, this might end up in the method
  which feels responsible for the "KeyModifier" parameter. Not really
  nice.

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to