DokeosDocumentFormatRegistry.java 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //
  2. //DokeosConverter using JODConverter - Java OpenDocument Converter
  3. //Eric Marguin <e.marguin@elixir-interactive.com>
  4. //
  5. //This library is free software; you can redistribute it and/or
  6. //modify it under the terms of the GNU Lesser General Public
  7. //License as published by the Free Software Foundation; either
  8. //version 2.1 of the License, or (at your option) any later version.
  9. //
  10. //This library is distributed in the hope that it will be useful,
  11. //but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. //Lesser General Public License for more details.
  14. //http://www.gnu.org/copyleft/lesser.html
  15. //
  16. import com.artofsolving.jodconverter.BasicDocumentFormatRegistry;
  17. import com.artofsolving.jodconverter.DocumentFamily;
  18. import com.artofsolving.jodconverter.DocumentFormat;
  19. public class DokeosDocumentFormatRegistry extends BasicDocumentFormatRegistry {
  20. public DokeosDocumentFormatRegistry() {
  21. final DocumentFormat pdf = new DocumentFormat("Portable Document Format", "application/pdf", "pdf");
  22. pdf.setExportFilter(DocumentFamily.DRAWING, "draw_pdf_Export");
  23. pdf.setExportFilter(DocumentFamily.PRESENTATION, "impress_pdf_Export");
  24. pdf.setExportFilter(DocumentFamily.SPREADSHEET, "calc_pdf_Export");
  25. pdf.setExportFilter(DocumentFamily.TEXT, "writer_pdf_Export");
  26. addDocumentFormat(pdf);
  27. final DocumentFormat swf = new DocumentFormat("Macromedia Flash", "application/x-shockwave-flash", "swf");
  28. swf.setExportFilter(DocumentFamily.DRAWING, "draw_flash_Export");
  29. swf.setExportFilter(DocumentFamily.PRESENTATION, "impress_flash_Export");
  30. addDocumentFormat(swf);
  31. final DocumentFormat xhtml = new DocumentFormat("XHTML", "application/xhtml+xml", "xhtml");
  32. xhtml.setExportFilter(DocumentFamily.PRESENTATION, "XHTML Impress File");
  33. xhtml.setExportFilter(DocumentFamily.SPREADSHEET, "XHTML Calc File");
  34. xhtml.setExportFilter(DocumentFamily.TEXT, "XHTML Writer File");
  35. addDocumentFormat(xhtml);
  36. // HTML is treated as Text when supplied as input, but as an output it is also
  37. // available for exporting Spreadsheet and Presentation formats
  38. final DocumentFormat html = new DocumentFormat("HTML", DocumentFamily.TEXT, "text/html", "html");
  39. html.setExportFilter(DocumentFamily.PRESENTATION, "impress_html_Export");
  40. html.setExportFilter(DocumentFamily.SPREADSHEET, "HTML (StarCalc)");
  41. html.setExportFilter(DocumentFamily.TEXT, "HTML (StarWriter)");
  42. addDocumentFormat(html);
  43. final DocumentFormat odt = new DocumentFormat("OpenDocument Text", DocumentFamily.TEXT, "application/vnd.oasis.opendocument.text", "odt");
  44. odt.setExportFilter(DocumentFamily.TEXT, "writer8");
  45. addDocumentFormat(odt);
  46. final DocumentFormat sxw = new DocumentFormat("OpenOffice.org 1.0 Text Document", DocumentFamily.TEXT, "application/vnd.sun.xml.writer", "sxw");
  47. sxw.setExportFilter(DocumentFamily.TEXT, "StarOffice XML (Writer)");
  48. addDocumentFormat(sxw);
  49. final DocumentFormat doc = new DocumentFormat("Microsoft Word", DocumentFamily.TEXT, "application/msword", "doc");
  50. doc.setExportFilter(DocumentFamily.TEXT, "MS Word 97");
  51. addDocumentFormat(doc);
  52. final DocumentFormat docx = new DocumentFormat("Microsoft Word 2007", DocumentFamily.TEXT, "application/msword", "docx");
  53. doc.setExportFilter(DocumentFamily.TEXT, "MS Word 2007");
  54. addDocumentFormat(docx);
  55. final DocumentFormat rtf = new DocumentFormat("Rich Text Format", DocumentFamily.TEXT, "text/rtf", "rtf");
  56. rtf.setExportFilter(DocumentFamily.TEXT, "Rich Text Format");
  57. addDocumentFormat(rtf);
  58. final DocumentFormat wpd = new DocumentFormat("WordPerfect", DocumentFamily.TEXT, "application/wordperfect", "wpd");
  59. addDocumentFormat(wpd);
  60. final DocumentFormat txt = new DocumentFormat("Plain Text", DocumentFamily.TEXT, "text/plain", "txt");
  61. // set FilterName to "Text" to prevent OOo from tryign to display the "ASCII Filter Options" dialog
  62. // alternatively FilterName could be "Text (encoded)" and FilterOptions used to set encoding if needed
  63. txt.setImportOption("FilterName", "Text");
  64. txt.setExportFilter(DocumentFamily.TEXT, "Text");
  65. addDocumentFormat(txt);
  66. final DocumentFormat ods = new DocumentFormat("OpenDocument Spreadsheet", DocumentFamily.SPREADSHEET, "application/vnd.oasis.opendocument.spreadsheet", "ods");
  67. ods.setExportFilter(DocumentFamily.SPREADSHEET, "calc8");
  68. addDocumentFormat(ods);
  69. final DocumentFormat sxc = new DocumentFormat("OpenOffice.org 1.0 Spreadsheet", DocumentFamily.SPREADSHEET, "application/vnd.sun.xml.calc", "sxc");
  70. sxc.setExportFilter(DocumentFamily.SPREADSHEET, "StarOffice XML (Calc)");
  71. addDocumentFormat(sxc);
  72. final DocumentFormat xls = new DocumentFormat("Microsoft Excel", DocumentFamily.SPREADSHEET, "application/vnd.ms-excel", "xls");
  73. xls.setExportFilter(DocumentFamily.SPREADSHEET, "MS Excel 97");
  74. addDocumentFormat(xls);
  75. final DocumentFormat csv = new DocumentFormat("CSV", DocumentFamily.SPREADSHEET, "text/csv", "csv");
  76. csv.setImportOption("FilterName", "Text - txt - csv (StarCalc)");
  77. csv.setImportOption("FilterOptions", "44,34,0"); // Field Separator: ','; Text Delimiter: '"'
  78. csv.setExportFilter(DocumentFamily.SPREADSHEET, "Text - txt - csv (StarCalc)");
  79. csv.setExportOption(DocumentFamily.SPREADSHEET, "FilterOptions", "44,34,0");
  80. addDocumentFormat(csv);
  81. final DocumentFormat tsv = new DocumentFormat("Tab-separated Values", DocumentFamily.SPREADSHEET, "text/tab-separated-values", "tsv");
  82. tsv.setImportOption("FilterName", "Text - txt - csv (StarCalc)");
  83. tsv.setImportOption("FilterOptions", "9,34,0"); // Field Separator: '\t'; Text Delimiter: '"'
  84. tsv.setExportFilter(DocumentFamily.SPREADSHEET, "Text - txt - csv (StarCalc)");
  85. tsv.setExportOption(DocumentFamily.SPREADSHEET, "FilterOptions", "9,34,0");
  86. addDocumentFormat(tsv);
  87. final DocumentFormat odp = new DocumentFormat("OpenDocument Presentation", DocumentFamily.PRESENTATION, "application/vnd.oasis.opendocument.presentation", "odp");
  88. odp.setExportFilter(DocumentFamily.PRESENTATION, "impress8");
  89. addDocumentFormat(odp);
  90. final DocumentFormat sxi = new DocumentFormat("OpenOffice.org 1.0 Presentation", DocumentFamily.PRESENTATION, "application/vnd.sun.xml.impress", "sxi");
  91. sxi.setExportFilter(DocumentFamily.PRESENTATION, "StarOffice XML (Impress)");
  92. addDocumentFormat(sxi);
  93. final DocumentFormat ppt = new DocumentFormat("Microsoft PowerPoint", DocumentFamily.PRESENTATION, "application/vnd.ms-powerpoint", "ppt");
  94. ppt.setExportFilter(DocumentFamily.PRESENTATION, "MS PowerPoint 97");
  95. addDocumentFormat(ppt);
  96. final DocumentFormat pptx = new DocumentFormat("Microsoft PowerPoint 2007", DocumentFamily.PRESENTATION, "application/vnd.ms-powerpoint", "pptx");
  97. ppt.setExportFilter(DocumentFamily.PRESENTATION, "MS PowerPoint 2007");
  98. addDocumentFormat(pptx);
  99. final DocumentFormat odg = new DocumentFormat("OpenDocument Drawing", DocumentFamily.DRAWING, "application/vnd.oasis.opendocument.graphics", "odg");
  100. odg.setExportFilter(DocumentFamily.DRAWING, "draw8");
  101. addDocumentFormat(odg);
  102. final DocumentFormat svg = new DocumentFormat("Scalable Vector Graphics", "image/svg+xml", "svg");
  103. svg.setExportFilter(DocumentFamily.DRAWING, "draw_svg_Export");
  104. addDocumentFormat(svg);
  105. }
  106. }