Difference between revisions of "Documentation/DevGuide/Scripting/How the Scripting Framework Works"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Reference to URI specification)
(Added ScriptProviderForPython)
Line 35: Line 35:

Latest revision as of 07:10, 24 May 2010

The goals of the ScriptingFramework are to provide plug-able support for new scripting languages and allow macros written in supported languages to be:

  • Executed
  • Displayed
  • Organized
  • Assigned to OpenOffice.org events, key combinations, menu and toolbar items

This is achieved by enabling new language support to be added by deploying an UNO component that satisfies the service definition specified by com.sun.star.script.provider.LanguageScriptProvider. The ScriptingFramework detects supported languages by discovering the available components that satisfy the service specification and obey the naming convention "com.sun.star.script.provider.ScriptProviderFor[Language]"

OpenOffice.org comes with a number of reference LanguageScriptProviders installed by default.

Language Service name
Java com.sun.star.script.provider.ScriptProviderForJava
JavaScript com.sun.star.script.provider.ScriptProviderForJavaScript
BeanShell com.sun.star.script.provider.ScriptProviderForBeanShell
Basic com.sun.star.script.provider.ScriptProviderForBasic
Python com.sun.star.script.provider.ScriptProviderForPython

For more details on naming conventions, interfaces and implementation of a LanguageScriptProvider please see Writing a LanguageScriptProvider UNO Component From Scratch and Writing a LanguageScriptProvider UNO Component using the Java Helper Classes.


The illustration above shows the simplified interaction between the Office Process and the ScriptingFramework when invoking a macro. Macros are identified by a URI and are represented by objects implementing the com.sun.star.script.provider.XScript interface. When the getScript() method is called the ScriptingFramework uses the URI to determine the correct LanguageScriptProvider to call getScript() on. The LanguageScriptProvider translates a URI into a object that implements Xscript. Office can then invoke the macro by calling invoke on that object.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages