Calligra/Proposal for scripting in ODF: Difference between revisions

From KDE Community Wiki
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
This page should provide a suggestion how to implement scripting in ODF.
This page provides a proposal how to implement scripting in ODF.
 
===Proposal===


Proposal
* So far the only way to get such dynamic functionality in is using macros. But macros suck, they are unflexible and functionality is missing.
* So far the only way to get such dynamic functionality in is using macros. But macros suck, they are unflexible and functionality is missing.
* Since this days we have so many different Javascript-implementations around + they allow to sandbox (unlike python for exampl) + they are light and fast (unlike Java) and are already a de facto standard in HTML it would make sense to get Javascript into ODF as official "scripting-language".
* Since this days we have so many different Javascript-implementations around + they allow to sandbox (unlike python for exampl) + they are light and fast (unlike Java) and are already a de facto standard in HTML it would make sense to get Javascript into ODF as official "scripting-language".
* The Javascript is loaded from and saved to the ODF document zip-file as ScriptN/content.js and then referenced with a unique name in the document-content or other scripts.
* Ideally Calligra, LibreOffice and OpenOffice.org are adopting the same solution and provide compatible Javascript-APIs.


Use-cases
===Use-cases===
* Allow to register Javascript for on-load or on-save events.
 
* Allow to register Javascript for on-load, on-save and other events.
* Do something if e.g. an image is clicked.
* Do something if e.g. an image is clicked.
* Formula variable for calculation.
* Formula variable for complex calculations.
* Forms, e.g. input-validation.
* In forms e.g. for input-validation.
 
===API===


API
* Allow live-editing (loading and manipulation) of the ODF DOM tree from within Javascript. That covers all kind of scenarios and provides an (in the ODF specifications) already well documented and proven API. So, very much what Javascript is able to do with HTML+Stylesheet in a Browser for an Office-suite.
* The is to allow live-editing access to the ODF DOM tree from with Javascript. That covers all kind of manipulation-scenarios and provides an (in the ODF specifications) already well documented API and proven API. So, very much what Javascript is able to do with HTML and Stylesheet in the Browser for a Office-suite.
* Helper-classes written in Javascript could provide a higher level API to deal with the ODF DOM tree.
* Helper-classes written in Javascript could provide a higher level API to deal with the ODF DOM tree.
* It would maybe make sense to allow access from within Javascript to the Calligra Tables formula logic. So Words and Stage could do complex calculations the OpenFormula way in Javascript.
* Add or remove files from the ODF zip file.
* Maybe allow access from within Javascript to the Calligra Tables formula logic. So Words and Stage could do complex calculations the OpenFormula-way in Javascript.
* Network-access to e.g. update content or fetch informations for processing from the internet. By it's nature this needs proper security (e.g. document signing).
* Persistent per-document and application-local storage to e.g. save and restore settings or variable-states.

Latest revision as of 11:12, 15 November 2011

This page provides a proposal how to implement scripting in ODF.

Proposal

  • So far the only way to get such dynamic functionality in is using macros. But macros suck, they are unflexible and functionality is missing.
  • Since this days we have so many different Javascript-implementations around + they allow to sandbox (unlike python for exampl) + they are light and fast (unlike Java) and are already a de facto standard in HTML it would make sense to get Javascript into ODF as official "scripting-language".
  • The Javascript is loaded from and saved to the ODF document zip-file as ScriptN/content.js and then referenced with a unique name in the document-content or other scripts.
  • Ideally Calligra, LibreOffice and OpenOffice.org are adopting the same solution and provide compatible Javascript-APIs.

Use-cases

  • Allow to register Javascript for on-load, on-save and other events.
  • Do something if e.g. an image is clicked.
  • Formula variable for complex calculations.
  • In forms e.g. for input-validation.

API

  • Allow live-editing (loading and manipulation) of the ODF DOM tree from within Javascript. That covers all kind of scenarios and provides an (in the ODF specifications) already well documented and proven API. So, very much what Javascript is able to do with HTML+Stylesheet in a Browser for an Office-suite.
  • Helper-classes written in Javascript could provide a higher level API to deal with the ODF DOM tree.
  • Add or remove files from the ODF zip file.
  • Maybe allow access from within Javascript to the Calligra Tables formula logic. So Words and Stage could do complex calculations the OpenFormula-way in Javascript.
  • Network-access to e.g. update content or fetch informations for processing from the internet. By it's nature this needs proper security (e.g. document signing).
  • Persistent per-document and application-local storage to e.g. save and restore settings or variable-states.