uno based odf toolkit api
TRANSCRIPT
- 1. UNO basedODF Toolkit API
- Jrgen Schmidt
-
- StarOffice/OpenOffice.org
-
-
- Sun Microsystems, Inc.
-
2. UNO based ODF Toolkit API
- What we have
- Why UNO
- What it could be tomorrow
- Summary
- Q & A
3. What we have ODF OpenOffice.org Idea Vision 4. What we have the vision 5.
- OpenOffice.orgreference implementation for the standardized Open Document Format (ODF)
-
- UNO API to create, manipulate, convert or print ODF documents
-
- 3878 UNOIDL types
-
-
- document specific or
-
-
-
- user interface and application specific
-
-
- API is closely teethed with the whole office
-
- monolithic
-
-
- complete office installation is necessary
-
-
- can run in server mode
What we have 6.
- Component middleware
- Platform independent
- Language independent(or should i say open)
-
- C++, Java, Python, CLI (C#, VBA.Net), Basic, OLE Automation, ooRexx, JavaScript, ....
- UNO Runtime Environment
-
- standalone usable
- UNO is threadsafe
Why UNO 7.
- Requirements
-
- fast
-
- intuitive
-
- well documented
-
- well documented and useful examples
- Focus on pure ODF document creation and manipulation
-
- no printing, no conversion
- Intensive use of UNO ease of use features
-
- type safe versus less generic
What it could be tomorrow 8.
- New API besides the existing office API
-
- ODF model API
- Pure Java reference implementation
-
- based on the Java UNO runtime
- C++ implementation later possible
-
- when the office becomes ready
What it could be tomorrow 9. What it could be tomorrow document creation // create an empty TextDocument org.openoffice.uodft.text.XTextDocument xDoc =org.openoffice.uodft.text.TextDocument.create(xContext); // load an TextDocument try { org.openoffice.uodft.text.XTextDocument xDoc =org.openoffice.uodft.text.TextDocument.load(xContext, "file:///somewhere/HelloODFToolkit.odt"); } catch (org.openoffice.uodft.document.DocumentError e) { // do some error handling } Fake: this API's does not exist! 10. What it could be tomorrow document saving try { XTextDocument xDoc = ... // do some manipulation // save a TextDocument xDoc.save(); // save under a new name xDoc.saveAs("file:///somewhere/newname.odt"); } catch (org.openoffice.uodft.document.DocumentError e) { // do some error handling } Fake: this API's does not exist! 11. What it could be tomorrow adding content try { // append a string at the end xDoc.append("Hello UNO based ODF Toolkit!"); // new line should be interpreted as paragraph end xDoc.append(" When can we use this API?"); // append new a Paragraph Paragraph para = text.Paragraph.createWithString(xContext, "a paragraph can be created directly with a string"); xDoc.appendContent(para); } catch ( ... ) {// do some error handling} Fake: this API's does not exist! 12. What it could be tomorrow adding content try { // create a new ParagraphStyle ParagraphStyle myStyle = text.ParagraphStyle.create( xContext, "MyStyleName"); newStyle.setCategory(ParagrpahStyleCategory.LIST); // set more style specific attribtues newStyle.setXXX(...); // append a new Paragraph Paragraph para = text.Paragraph.createWithStyle( xContext, "some text", myStyle); para.append(" and more text for this paragraph."); xDoc.appendContent(para); } catch ( ... ) {// do some error handling} Fake: this API's does not exist! 13. What it could be tomorrow adding content try { // append a new graphic object TextGraphicObject graphic = text.TextGraphicObject.create( xContext, "file:///somewhere/picture.png", false); // set some attributes graphic.setSize(8000, 5000); graphic.setTransparency(80); graphic.setMargin(5); xDoc.appendContent(graphic); } catch ( ... ) {// do some error handling} Fake: this API's does not exist! 14. What it could be tomorrow manipulate content try { // get navigation cursor XParagraphCursor xCursor = xDoc.getParagraphCursor(); xCursor.gotoStart(false); do { if (xCursor.getParagraph().getText().equals("...")) xCursor.getParagraph().setStyle( xDoc.getStyleManager().getStyleByName("MyStyle")); } while (xCursor.gotoNextParagraph(false); } catch ( ... ) {// do some error handling} Fake: this API's does not exist! 15. What it could be tomorrow manipulate content try { // get navigation cursor XParagraphCursor xCursor = xDoc.getParagraphCursor(); xCursor.gotoStart(false); do { if (xCursor.getParagraph().getText().equals("...")) xCursor.getParagraph().setStyle( xDoc.getStyleManager().getStyleByName("MyStyle")); } while (xCursor.gotoNextParagraph(false); } catch ( ... ) {// do some error handling} Fake: this API's does not exist! 16. What it could be tomorrow manipulate content try { // create a new empty Spreadsheet document XSpreadsheetDocument xDoc = XSpreadsheetDocument.create(xContext); // insert a new Sheet by index xDoc.insertSheet(3, "MySheet"); // manipulate cells by index xDoc.getCell("B", 50).setString("Result"); xDoc.getCell("B", 51).setFormula("=sum(A1:A45"); } catch ( ... ) {// do some error handling} Fake: this API's does not exist! 17. What it could be tomorrow manipulate content try { long[] data = { 2,4,5,8,89,56 }; long[][] matrix = { { 2,4,5,8,89,56 }, { 5,67,7,8,99,4 } }; // set data array in a row, address Sheet directxDoc.setData(1, "B2", data); // set data array in a column, get Sheet first by indexxDoc.getSheet(3).setData("2B", data); // set data array in a column, address Sheet direct xDoc.setDataMatrix(1, "B2", matrix); } catch ( ... ) {// do some error handling} Fake: this API's does not exist! 18.
- New API versus reuse of the existing office API
-
- existing API combines model with UI
-
- existing API is partly a mirror of the old office core
- No compatibility statement from the beginning
-
- API should evolve over the time
- Realization is not 100% ensured
-
- vision versus reality
- Don't underestimate the existing office API
-
- really, really feature rich and ready to use
-
- usability could be improved
Summary 19. Q & A 20. UNO basedODF Toolkit API
- Jrgen Schmidt
-
- [email_address]