UNO based ODF Toolkit API

2,270 views
2,201 views

Published on

Published in: Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,270
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
29
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

UNO based ODF Toolkit API

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

×