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

From Apache OpenOffice Wiki
Jump to: navigation, search
(Added ScriptProviderForPython)
m
 
Line 15: Line 15:
 
This is achieved by enabling new language support to be added by deploying an UNO component that satisfies the service definition specified by <idl>com.sun.star.script.provider.LanguageScriptProvider</idl>. The ScriptingFramework detects supported languages by discovering the available components that satisfy the service specification and obey the naming convention "<code>com.sun.star.script.provider.ScriptProviderFor[Language]</code>"
 
This is achieved by enabling new language support to be added by deploying an UNO component that satisfies the service definition specified by <idl>com.sun.star.script.provider.LanguageScriptProvider</idl>. The ScriptingFramework detects supported languages by discovering the available components that satisfy the service specification and obey the naming convention "<code>com.sun.star.script.provider.ScriptProviderFor[Language]</code>"
  
{{PRODUCTNAME}} comes with a number of reference LanguageScriptProviders installed by default.
+
{{AOo}} comes with a number of reference LanguageScriptProviders installed by default.
  
 
{|border="1" cellpadding=4 style="border-collapse:collapse;"
 
{|border="1" cellpadding=4 style="border-collapse:collapse;"

Latest revision as of 18:23, 21 December 2020



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]"

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

LanguageScriptProviders
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.

LanguageScriptProvider

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