UNO based ODF Toolkit API
Upcoming SlideShare
Loading in...5
×
 

UNO based ODF Toolkit API

on

  • 3,514 views

 

Statistics

Views

Total Views
3,514
Views on SlideShare
3,501
Embed Views
13

Actions

Likes
0
Downloads
28
Comments
0

2 Embeds 13

http://www.slideshare.net 11
http://wiki.almg.uucp 2

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

UNO based ODF Toolkit API UNO based ODF Toolkit API Presentation Transcript

  • UNO based ODF Toolkit API
    • Jürgen Schmidt
      • StarOffice/OpenOffice.org
        • Sun Microsystems, Inc.
  • UNO based ODF Toolkit API
    • What we have
    • Why UNO
    • What it could be tomorrow
    • Summary
    • Q & A
  • What we have ODF OpenOffice.org Idea Vision
  • What we have — the vision
    • OpenOffice.org — reference 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
    • 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
    • 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
    • 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
  • 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!
  • 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!
  • 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!
  • 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!
  • 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!
  • 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!
  • 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!
  • 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!
  • 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 direct xDoc.setData(1, "B2", data); // set data array in a column, get Sheet first by index xDoc.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!
    • 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
  • Q & A
  • UNO based ODF Toolkit API
    • Jürgen Schmidt
      • [email_address]