pax_global_header00006660000000000000000000000064112473322750014520gustar00rootroot0000000000000052 comment=acf9bd00d20c468de9dde47896842cd1e243b03b jodconverter-2.2.2/000077500000000000000000000000001124733227500142275ustar00rootroot00000000000000jodconverter-2.2.2/ChangeLog.txt000066400000000000000000000073531124733227500166270ustar00rootroot00000000000000JODConverter 2.2.2 ------------------ * added docx, xlsx, and pptx (supported by OOo since v3.0) to default formats * updated plain text format to use UTF8,CRLF as default options * added switch to pass a custom xml document format registry file to the command line tool JODConverter 2.2.1 ------------------ ** Improvement * [JODC-12] - Provide more detailed 'conversion failed' error messages * [JODC-24] - Add MediaWiki wikitext format * [JODC-25] - Add configurable outputDir to Maven plugin * [JODC-26] - Expose low level OOo services as public in OOoConnection ** New Feature * [JODC-6] - Maven plugin * [JODC-27] - Add utility methods to retrieve OOo version and locale at runtime JODConverter 2.2.0 ------------------ ** Bug * [JODC-14] - Incorrect Excel mime-type * [JODC-16] - Failure when converting from .txt files with different line endings * [JODC-18] - File extension should be treated as case insensitive ** Improvement * [JODC-5] - Add macro execution options * [JODC-10] - Make XStream dependency optional * [JODC-11] - Replace commons-logging with slf4j * [JODC-17] - Add CSV to default formats * [JODC-19] - Revise DocumentFormat exportOptions API * [JODC-20] - Make document formats easily customisable in webapp * [JODC-22] - Add DocumentFamily.DRAWING ** New Feature * [JODC-9] - IKVM compatibility to build as a .NET DLL * [JODC-13] - Add support for converting multiple files at once in ConvertDocument command line tool ** Task * [JODC-21] - Split CLI into separate module JODConverter 2.1.1 ------------------- * renamed project to JODConverter * renamed packages from net.sf.jooreports to com.artofsolving.jodconverter * updated OpenOffice.org JARs to 2.1.0 JOOConverter 2.1.0 ------------------- * added support for custom export options (e.g. Image Quality for PDFs) * HTML as an input format is now enabled by default * fixed a rare pagination bug when exporting to PDF a document with fields * many internal code improvements: switched to Maven2-based build process and directory layout, improved unit test coverage, refactorings JOOConverter 2.1rc2 ------------------- * file-based conversions are the default again; stream-based conversions introduced in 2.1rc1 proved to be frequently slower so they are still available but as an option (using StreamOpenOfficeDocumentConverter) * made the webapp settings configurable using Spring and XML * added a sample C#.net web service client to the online guide JOOConverter 2.1rc1 ------------------- * now all conversions pass UNO streams instead of files to OpenOffice.org - no need to use temporary files anymore - works with an OOo service running as a different user - works with an OOo service running on a different machine * added servlet that can be invoked as a simple "web service" by remote clients * added WordPerfect as a supported input format (thanks to Derek Hulley of Alfresco) * added isConnected() method to OpenOfficeConnection JOOConverter 2.0.0 ------------------ * added default constructor to DocumentFormat to prevent error with XStream on some JVMs * compiled and tested with Java 1.3 (was 1.4) * replaced custom IO code with Jakarta Commons IO * updated third-party libraries to their latest available versions JOOConverter 2.0rc2 ------------------- Due to popular demand JOOConverter, while still being part of JOOReports, is now released as a standalone project (as it was already the case with the 1.0 series). Changes compared to the version included in JOOReports 2.0rc1 * added the converter web application * made jar file executable with ConvertDocument as main class * added (but unsupported) HTML and XHTML export formats * minor bug fixes jodconverter-2.2.2/LICENSE.txt000066400000000000000000000635041124733227500160620ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! jodconverter-2.2.2/README.txt000066400000000000000000000034271124733227500157330ustar00rootroot00000000000000JODConverter ============ This is JODConverter version 2.2.2, released on 2009-04-11. JODConverter is a Java library for converting office documents into different formats, using OpenOffice.org 2.x or 3.x. See http://www.artofsolving.com/opensource/jodconverter for the latest documentation. Before you can perform any conversions you need to start OpenOffice.org in listening mode on port 8100 as described in the JODConverter Guide. As a quick start you can type from a command line soffice -headless -accept="socket,port=8100;urp;" JODConverter is both a Java library and a set of ready-to-use tools: * a web application that you can deploy into any servlet container (e.g. Apache Tomcat) * a command line tool (java -jar jodconverter-cli-2.2.2.jar ) Requirements ============ The JAR library requires * Java 1.4 or higher * OpenOffice.org 2.x or 3.x; the latest stable version (currenty 3.0.1) is generally recommended The webapp additionally requires * A Servlet 2.3 container such as Apache Tomcat v4.x or higher Licenses ======== JODConverter is distributed under the terms of the LGPL. This basically means that you are free to use it in both open source and commercial projects. If you modify the library itself you are required to contribute your changes back, so JODConverter can be improved. (You are free to modify the sample webapp as a starting point for your own webapp without restrictions.) JODConverter includes various third-party libraries so you must agree to their respective licenses - included in docs/third-party-licenses. That may include software developed by * the Apache Software Foundation (http://www.apache.org) * the Spring Framework project (http://www.springframework.org) -- Mirko Nasato jodconverter-2.2.2/pom.xml000066400000000000000000000072141124733227500155500ustar00rootroot00000000000000 4.0.0 com.artofsolving jodconverter 2.2.2 jar JODConverter JODConverter converts between different office documents formats, using OpenOffice.org. http://www.artofsolving.com/opensource/jodconverter GNU Lesser General Public License, Version 2.1 http://www.gnu.org/licenses/lgpl.html http://jodconverter.svn.sourceforge.net/viewvc/jodconverter/trunk/jodconverter/ scm:svn:https://jodconverter.svn.sourceforge.net/svnroot/jodconverter/trunk/jodconverter 2003 Art of Solving http://www.artofsolving.com mnasato Mirko Nasato mirko@artofsolving.com org.slf4j slf4j-api 1.5.6 org.slf4j slf4j-jdk14 1.5.6 test commons-io commons-io 1.4 com.thoughtworks.xstream xstream 1.3.1 true xpp3 xpp3_min org.openoffice juh 3.0.1 org.openoffice ridl 3.0.1 org.openoffice unoil 3.0.1 junit junit 3.8.2 test pdfbox pdfbox 0.7.3 test org.apache.maven.plugins maven-compiler-plugin 1.4 1.4 org.apache.maven.plugins maven-javadoc-plugin org.apache.maven.plugins maven-surefire-report-plugin jodconverter-2.2.2/src/000077500000000000000000000000001124733227500150165ustar00rootroot00000000000000jodconverter-2.2.2/src/main/000077500000000000000000000000001124733227500157425ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/000077500000000000000000000000001124733227500166635ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/000077500000000000000000000000001124733227500174415ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/000077500000000000000000000000001124733227500221565ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/000077500000000000000000000000001124733227500246625ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/BasicDocumentFormatRegistry.java000066400000000000000000000037041124733227500331530ustar00rootroot00000000000000// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class BasicDocumentFormatRegistry implements DocumentFormatRegistry { private List/**/ documentFormats = new ArrayList(); public void addDocumentFormat(DocumentFormat documentFormat) { documentFormats.add(documentFormat); } protected List/**/ getDocumentFormats() { return documentFormats; } /** * @param extension the file extension * @return the DocumentFormat for this extension, or null if the extension is not mapped */ public DocumentFormat getFormatByFileExtension(String extension) { if (extension == null) { return null; } String lowerExtension = extension.toLowerCase(); for (Iterator it = documentFormats.iterator(); it.hasNext();) { DocumentFormat format = (DocumentFormat) it.next(); if (format.getFileExtension().equals(lowerExtension)) { return format; } } return null; } public DocumentFormat getFormatByMimeType(String mimeType) { for (Iterator it = documentFormats.iterator(); it.hasNext();) { DocumentFormat format = (DocumentFormat) it.next(); if (format.getMimeType().equals(mimeType)) { return format; } } return null; } } jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/DefaultDocumentFormatRegistry.java000066400000000000000000000170601124733227500335160ustar00rootroot00000000000000// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter; public class DefaultDocumentFormatRegistry extends BasicDocumentFormatRegistry { public DefaultDocumentFormatRegistry() { final DocumentFormat pdf = new DocumentFormat("Portable Document Format", "application/pdf", "pdf"); pdf.setExportFilter(DocumentFamily.DRAWING, "draw_pdf_Export"); pdf.setExportFilter(DocumentFamily.PRESENTATION, "impress_pdf_Export"); pdf.setExportFilter(DocumentFamily.SPREADSHEET, "calc_pdf_Export"); pdf.setExportFilter(DocumentFamily.TEXT, "writer_pdf_Export"); addDocumentFormat(pdf); final DocumentFormat swf = new DocumentFormat("Macromedia Flash", "application/x-shockwave-flash", "swf"); swf.setExportFilter(DocumentFamily.DRAWING, "draw_flash_Export"); swf.setExportFilter(DocumentFamily.PRESENTATION, "impress_flash_Export"); addDocumentFormat(swf); final DocumentFormat xhtml = new DocumentFormat("XHTML", "application/xhtml+xml", "xhtml"); xhtml.setExportFilter(DocumentFamily.PRESENTATION, "XHTML Impress File"); xhtml.setExportFilter(DocumentFamily.SPREADSHEET, "XHTML Calc File"); xhtml.setExportFilter(DocumentFamily.TEXT, "XHTML Writer File"); addDocumentFormat(xhtml); // HTML is treated as Text when supplied as input, but as an output it is also // available for exporting Spreadsheet and Presentation formats final DocumentFormat html = new DocumentFormat("HTML", DocumentFamily.TEXT, "text/html", "html"); html.setExportFilter(DocumentFamily.PRESENTATION, "impress_html_Export"); html.setExportFilter(DocumentFamily.SPREADSHEET, "HTML (StarCalc)"); html.setExportFilter(DocumentFamily.TEXT, "HTML (StarWriter)"); addDocumentFormat(html); final DocumentFormat odt = new DocumentFormat("OpenDocument Text", DocumentFamily.TEXT, "application/vnd.oasis.opendocument.text", "odt"); odt.setExportFilter(DocumentFamily.TEXT, "writer8"); addDocumentFormat(odt); final DocumentFormat sxw = new DocumentFormat("OpenOffice.org 1.0 Text Document", DocumentFamily.TEXT, "application/vnd.sun.xml.writer", "sxw"); sxw.setExportFilter(DocumentFamily.TEXT, "StarOffice XML (Writer)"); addDocumentFormat(sxw); final DocumentFormat doc = new DocumentFormat("Microsoft Word", DocumentFamily.TEXT, "application/msword", "doc"); doc.setExportFilter(DocumentFamily.TEXT, "MS Word 97"); addDocumentFormat(doc); final DocumentFormat docx = new DocumentFormat("Microsoft Word 2007 XML", DocumentFamily.TEXT, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "docx"); addDocumentFormat(docx); final DocumentFormat rtf = new DocumentFormat("Rich Text Format", DocumentFamily.TEXT, "text/rtf", "rtf"); rtf.setExportFilter(DocumentFamily.TEXT, "Rich Text Format"); addDocumentFormat(rtf); final DocumentFormat wpd = new DocumentFormat("WordPerfect", DocumentFamily.TEXT, "application/wordperfect", "wpd"); addDocumentFormat(wpd); final DocumentFormat txt = new DocumentFormat("Plain Text", DocumentFamily.TEXT, "text/plain", "txt"); // default to "Text (encoded)" UTF8,CRLF to prevent OOo from trying to display the "ASCII Filter Options" dialog txt.setImportOption("FilterName", "Text (encoded)"); txt.setImportOption("FilterOptions", "UTF8,CRLF"); txt.setExportFilter(DocumentFamily.TEXT, "Text (encoded)"); txt.setExportOption(DocumentFamily.TEXT, "FilterOptions", "UTF8,CRLF"); addDocumentFormat(txt); final DocumentFormat wikitext = new DocumentFormat("MediaWiki wikitext", "text/x-wiki", "wiki"); wikitext.setExportFilter(DocumentFamily.TEXT, "MediaWiki"); addDocumentFormat(wikitext); final DocumentFormat ods = new DocumentFormat("OpenDocument Spreadsheet", DocumentFamily.SPREADSHEET, "application/vnd.oasis.opendocument.spreadsheet", "ods"); ods.setExportFilter(DocumentFamily.SPREADSHEET, "calc8"); addDocumentFormat(ods); final DocumentFormat sxc = new DocumentFormat("OpenOffice.org 1.0 Spreadsheet", DocumentFamily.SPREADSHEET, "application/vnd.sun.xml.calc", "sxc"); sxc.setExportFilter(DocumentFamily.SPREADSHEET, "StarOffice XML (Calc)"); addDocumentFormat(sxc); final DocumentFormat xls = new DocumentFormat("Microsoft Excel", DocumentFamily.SPREADSHEET, "application/vnd.ms-excel", "xls"); xls.setExportFilter(DocumentFamily.SPREADSHEET, "MS Excel 97"); addDocumentFormat(xls); final DocumentFormat xlsx = new DocumentFormat("Microsoft Excel 2007 XML", DocumentFamily.SPREADSHEET, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "xlsx"); addDocumentFormat(xlsx); final DocumentFormat csv = new DocumentFormat("CSV", DocumentFamily.SPREADSHEET, "text/csv", "csv"); csv.setImportOption("FilterName", "Text - txt - csv (StarCalc)"); csv.setImportOption("FilterOptions", "44,34,0"); // Field Separator: ','; Text Delimiter: '"' csv.setExportFilter(DocumentFamily.SPREADSHEET, "Text - txt - csv (StarCalc)"); csv.setExportOption(DocumentFamily.SPREADSHEET, "FilterOptions", "44,34,0"); addDocumentFormat(csv); final DocumentFormat tsv = new DocumentFormat("Tab-separated Values", DocumentFamily.SPREADSHEET, "text/tab-separated-values", "tsv"); tsv.setImportOption("FilterName", "Text - txt - csv (StarCalc)"); tsv.setImportOption("FilterOptions", "9,34,0"); // Field Separator: '\t'; Text Delimiter: '"' tsv.setExportFilter(DocumentFamily.SPREADSHEET, "Text - txt - csv (StarCalc)"); tsv.setExportOption(DocumentFamily.SPREADSHEET, "FilterOptions", "9,34,0"); addDocumentFormat(tsv); final DocumentFormat odp = new DocumentFormat("OpenDocument Presentation", DocumentFamily.PRESENTATION, "application/vnd.oasis.opendocument.presentation", "odp"); odp.setExportFilter(DocumentFamily.PRESENTATION, "impress8"); addDocumentFormat(odp); final DocumentFormat sxi = new DocumentFormat("OpenOffice.org 1.0 Presentation", DocumentFamily.PRESENTATION, "application/vnd.sun.xml.impress", "sxi"); sxi.setExportFilter(DocumentFamily.PRESENTATION, "StarOffice XML (Impress)"); addDocumentFormat(sxi); final DocumentFormat ppt = new DocumentFormat("Microsoft PowerPoint", DocumentFamily.PRESENTATION, "application/vnd.ms-powerpoint", "ppt"); ppt.setExportFilter(DocumentFamily.PRESENTATION, "MS PowerPoint 97"); addDocumentFormat(ppt); final DocumentFormat pptx = new DocumentFormat("Microsoft PowerPoint 2007 XML", DocumentFamily.PRESENTATION, "application/vnd.openxmlformats-officedocument.presentationml.presentation", "pptx"); addDocumentFormat(pptx); final DocumentFormat odg = new DocumentFormat("OpenDocument Drawing", DocumentFamily.DRAWING, "application/vnd.oasis.opendocument.graphics", "odg"); odg.setExportFilter(DocumentFamily.DRAWING, "draw8"); addDocumentFormat(odg); final DocumentFormat svg = new DocumentFormat("Scalable Vector Graphics", "image/svg+xml", "svg"); svg.setExportFilter(DocumentFamily.DRAWING, "draw_svg_Export"); addDocumentFormat(svg); } } jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/DocumentConverter.java000066400000000000000000000037171124733227500312030ustar00rootroot00000000000000// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter; import java.io.File; import java.io.InputStream; import java.io.OutputStream; public interface DocumentConverter { /** * Convert a document. *

* Note that this method does not close inputStream and outputStream. * * @param inputStream * @param inputFormat * @param outputStream * @param outputFormat */ public void convert(InputStream inputStream, DocumentFormat inputFormat, OutputStream outputStream, DocumentFormat outputFormat); /** * Convert a document. * * @param inputFile * @param inputFormat * @param outputFile * @param outputFormat */ public void convert(File inputFile, DocumentFormat inputFormat, File outputFile, DocumentFormat outputFormat); /** * Convert a document. The input format is guessed from the file extension. * * @param inputDocument * @param outputDocument * @param outputFormat */ public void convert(File inputDocument, File outputDocument, DocumentFormat outputFormat); /** * Convert a document. Both input and output formats are guessed from the file extension. * * @param inputDocument * @param outputDocument */ public void convert(File inputDocument, File outputDocument); } jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/DocumentFamily.java000066400000000000000000000035071124733227500304520ustar00rootroot00000000000000// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter; import java.util.HashMap; import java.util.Map; /** * Enum-style class declaring the available document families (Text, Spreadsheet, Presentation). */ public class DocumentFamily { public static final DocumentFamily TEXT = new DocumentFamily("Text"); public static final DocumentFamily SPREADSHEET = new DocumentFamily("Spreadsheet"); public static final DocumentFamily PRESENTATION = new DocumentFamily("Presentation"); public static final DocumentFamily DRAWING = new DocumentFamily("Drawing"); private static Map FAMILIES = new HashMap(); static { FAMILIES.put(TEXT.name, TEXT); FAMILIES.put(SPREADSHEET.name, SPREADSHEET); FAMILIES.put(PRESENTATION.name, PRESENTATION); FAMILIES.put(DRAWING.name, DRAWING); } private String name; private DocumentFamily(String name) { this.name = name; } public String getName() { return name; } public static DocumentFamily getFamily(String name) { DocumentFamily family = (DocumentFamily) FAMILIES.get(name); if (family == null) { throw new IllegalArgumentException("invalid DocumentFamily: " + name); } return family; } } jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/DocumentFormat.java000066400000000000000000000066511124733227500304640ustar00rootroot00000000000000// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter; import java.util.Collections; import java.util.HashMap; import java.util.Map; /** * Represents a document format ("OpenDocument Text" or "PDF"). * Also contains its available export filters. */ public class DocumentFormat { private static final String FILTER_NAME = "FilterName"; private String name; private DocumentFamily family; private String mimeType; private String fileExtension; private Map/*>*/ exportOptions = new HashMap(); private Map/**/ importOptions = new HashMap(); public DocumentFormat() { // empty constructor needed for XStream deserialization } public DocumentFormat(String name, String mimeType, String extension) { this.name = name; this.mimeType = mimeType; this.fileExtension = extension; } public DocumentFormat(String name, DocumentFamily family, String mimeType, String extension) { this.name = name; this.family = family; this.mimeType = mimeType; this.fileExtension = extension; } public String getName() { return name; } public DocumentFamily getFamily() { return family; } public String getMimeType() { return mimeType; } public String getFileExtension() { return fileExtension; } private String getExportFilter(DocumentFamily family) { return (String) getExportOptions(family).get(FILTER_NAME); } public boolean isImportable() { return family != null; } public boolean isExportOnly() { return !isImportable(); } public boolean isExportableTo(DocumentFormat otherFormat) { return otherFormat.isExportableFrom(this.family); } public boolean isExportableFrom(DocumentFamily family) { return getExportFilter(family) != null; } public void setExportFilter(DocumentFamily family, String filter) { getExportOptions(family).put(FILTER_NAME, filter); } public void setExportOption(DocumentFamily family, String name, Object value) { Map/**/ options = (Map) exportOptions.get(family); if (options == null) { options = new HashMap(); exportOptions.put(family, options); } options.put(name, value); } public Map/**/ getExportOptions(DocumentFamily family) { Map/**/ options = (Map) exportOptions.get(family); if (options == null) { options = new HashMap(); exportOptions.put(family, options); } return options; } public void setImportOption(String name, Object value) { importOptions.put(name, value); } public Map/**/ getImportOptions() { if (importOptions != null) { return importOptions; } else { return Collections.EMPTY_MAP; } } } jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/DocumentFormatRegistry.java000066400000000000000000000016101124733227500322030ustar00rootroot00000000000000// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter; public interface DocumentFormatRegistry { public DocumentFormat getFormatByFileExtension(String extension); public DocumentFormat getFormatByMimeType(String extension); } jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/XmlDocumentFormatRegistry.java000066400000000000000000000075721124733227500327010ustar00rootroot00000000000000// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStreamWriter; import java.util.Iterator; import org.apache.commons.io.IOUtils; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter; import com.thoughtworks.xstream.io.xml.DomDriver; public class XmlDocumentFormatRegistry extends BasicDocumentFormatRegistry implements DocumentFormatRegistry { private static final String DEFAULT_CONFIGURATION = "/"+ XmlDocumentFormatRegistry.class.getPackage().getName().replace('.', '/') + "/document-formats.xml"; /** * @deprecated use {@link DefaultDocumentFormatRegistry} instead (since version 2.1.2) */ public XmlDocumentFormatRegistry() { load(getClass().getResourceAsStream(DEFAULT_CONFIGURATION)); } public XmlDocumentFormatRegistry(InputStream inputStream) { load(inputStream); } private void load(InputStream inputStream) { if (inputStream == null) { throw new IllegalArgumentException("inputStream is null"); } XStream xstream = createXStream(); try { ObjectInputStream in = xstream.createObjectInputStream(new InputStreamReader(inputStream)); while (true) { try { addDocumentFormat((DocumentFormat) in.readObject()); } catch (EOFException endOfFile) { break; } } } catch (Exception exception) { throw new RuntimeException("invalid registry configuration", exception); } finally { IOUtils.closeQuietly(inputStream); } } private static XStream createXStream() { XStream xstream = new XStream(new DomDriver()); xstream.setMode(XStream.NO_REFERENCES); xstream.alias("document-format", DocumentFormat.class); xstream.aliasField("mime-type", DocumentFormat.class, "mimeType"); xstream.aliasField("file-extension", DocumentFormat.class, "fileExtension"); xstream.aliasField("export-filters", DocumentFormat.class, "exportFilters"); xstream.aliasField("export-options", DocumentFormat.class, "exportOptions"); xstream.aliasField("import-options", DocumentFormat.class, "importOptions"); xstream.alias("family", DocumentFamily.class); xstream.registerConverter(new AbstractSingleValueConverter() { public boolean canConvert(Class type) { return type.equals(DocumentFamily.class); } public Object fromString(String name) { return DocumentFamily.getFamily(name); } public String toString(Object object) { DocumentFamily family = (DocumentFamily) object; return family.getName(); } }); return xstream; } /** * Prints out a document-formats.xml from the {@link DefaultDocumentFormatRegistry} */ public static void main(String[] args) throws IOException { DefaultDocumentFormatRegistry registry = new DefaultDocumentFormatRegistry(); XStream xstream = createXStream(); ObjectOutputStream outputStream = xstream.createObjectOutputStream(new OutputStreamWriter(System.out), "document-formats"); for (Iterator iterator = registry.getDocumentFormats().iterator(); iterator.hasNext();) { outputStream.writeObject(iterator.next()); } outputStream.close(); } } jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/openoffice/000077500000000000000000000000001124733227500267775ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/openoffice/connection/000077500000000000000000000000001124733227500311365ustar00rootroot00000000000000AbstractOpenOfficeConnection.java000066400000000000000000000132321124733227500374440ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/openoffice/connection// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // // Contributor: // Laurent Godard // package com.artofsolving.jodconverter.openoffice.connection; import java.net.ConnectException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.sun.star.beans.XPropertySet; import com.sun.star.bridge.XBridge; import com.sun.star.bridge.XBridgeFactory; import com.sun.star.comp.helper.Bootstrap; import com.sun.star.connection.NoConnectException; import com.sun.star.connection.XConnection; import com.sun.star.connection.XConnector; import com.sun.star.frame.XComponentLoader; import com.sun.star.lang.EventObject; import com.sun.star.lang.XComponent; import com.sun.star.lang.XEventListener; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.ucb.XFileIdentifierConverter; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; public abstract class AbstractOpenOfficeConnection implements OpenOfficeConnection, XEventListener { protected final Logger logger = LoggerFactory.getLogger(getClass()); private String connectionString; private XComponent bridgeComponent; private XMultiComponentFactory serviceManager; private XComponentContext componentContext; private XBridge bridge; private boolean connected = false; private boolean expectingDisconnection = false; protected AbstractOpenOfficeConnection(String connectionString) { this.connectionString = connectionString; } public synchronized void connect() throws ConnectException { logger.debug("connecting"); try { XComponentContext localContext = Bootstrap.createInitialComponentContext(null); XMultiComponentFactory localServiceManager = localContext.getServiceManager(); XConnector connector = (XConnector) UnoRuntime.queryInterface(XConnector.class, localServiceManager.createInstanceWithContext("com.sun.star.connection.Connector", localContext)); XConnection connection = connector.connect(connectionString); XBridgeFactory bridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(XBridgeFactory.class, localServiceManager.createInstanceWithContext("com.sun.star.bridge.BridgeFactory", localContext)); bridge = bridgeFactory.createBridge("", "urp", connection, null); bridgeComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, bridge); bridgeComponent.addEventListener(this); serviceManager = (XMultiComponentFactory) UnoRuntime.queryInterface(XMultiComponentFactory.class, bridge.getInstance("StarOffice.ServiceManager")); XPropertySet properties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, serviceManager); componentContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, properties.getPropertyValue("DefaultContext")); connected = true; logger.info("connected"); } catch (NoConnectException connectException) { throw new ConnectException("connection failed: "+ connectionString +": " + connectException.getMessage()); } catch (Exception exception) { throw new OpenOfficeException("connection failed: "+ connectionString, exception); } } public synchronized void disconnect() { logger.debug("disconnecting"); expectingDisconnection = true; bridgeComponent.dispose(); } public boolean isConnected() { return connected; } public void disposing(EventObject event) { connected = false; if (expectingDisconnection) { logger.info("disconnected"); } else { logger.error("disconnected unexpectedly"); } expectingDisconnection = false; } // for unit tests only void simulateUnexpectedDisconnection() { disposing(null); bridgeComponent.dispose(); } private Object getService(String className) { try { if (!connected) { logger.info("trying to (re)connect"); connect(); } return serviceManager.createInstanceWithContext(className, componentContext); } catch (Exception exception) { throw new OpenOfficeException("could not obtain service: " + className, exception); } } public XComponentLoader getDesktop() { return (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, getService("com.sun.star.frame.Desktop")); } public XFileIdentifierConverter getFileContentProvider() { return (XFileIdentifierConverter) UnoRuntime.queryInterface(XFileIdentifierConverter.class, getService("com.sun.star.ucb.FileContentProvider")); } public XBridge getBridge() { return bridge; } public XMultiComponentFactory getRemoteServiceManager() { return serviceManager; } public XComponentContext getComponentContext() { return componentContext; } } OpenOfficeConfiguration.java000066400000000000000000000070511124733227500364720ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/openoffice/connection// // JODConverter - Java OpenDocument Converter // OpenOffice.org Configuration checker // Copyright (C) 2007 - Laurent Godard // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // // Contributor: // Mirko Nasato // package com.artofsolving.jodconverter.openoffice.connection; import com.sun.star.beans.PropertyValue; import com.sun.star.container.XNameAccess; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; /** * Utility class to access OpenOffice.org configuration properties at runtime */ public class OpenOfficeConfiguration { public static final String NODE_L10N = "org.openoffice.Setup/L10N"; public static final String NODE_PRODUCT = "org.openoffice.Setup/Product"; private OpenOfficeConnection connection; public OpenOfficeConfiguration(OpenOfficeConnection connection){ this.connection = connection; } public String getOpenOfficeProperty(String nodePath, String node){ if (!nodePath.startsWith("/")){ nodePath = "/" + nodePath; } String property = ""; // create the provider and remember it as a XMultiServiceFactory try { final String sProviderService = "com.sun.star.configuration.ConfigurationProvider"; Object configProvider = connection.getRemoteServiceManager().createInstanceWithContext( sProviderService, connection.getComponentContext()); XMultiServiceFactory xConfigProvider = (XMultiServiceFactory) UnoRuntime.queryInterface( com.sun.star.lang.XMultiServiceFactory.class, configProvider); // The service name: Need only read access: final String sReadOnlyView = "com.sun.star.configuration.ConfigurationAccess"; // creation arguments: nodepath PropertyValue aPathArgument = new PropertyValue(); aPathArgument.Name = "nodepath"; aPathArgument.Value = nodePath; Object[] aArguments = new Object[1]; aArguments[0] = aPathArgument; // create the view XInterface xElement = (XInterface) xConfigProvider.createInstanceWithArguments(sReadOnlyView, aArguments); XNameAccess xChildAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xElement); // get the value property = (String) xChildAccess.getByName(node); } catch (Exception exception){ throw new OpenOfficeException("Could not retrieve property", exception); } return property; } public String getOpenOfficeVersion(){ try { // OOo >= 2.2 returns major.minor.micro return getOpenOfficeProperty(NODE_PRODUCT, "ooSetupVersionAboutBox"); } catch (OpenOfficeException noSuchElementException) { // OOo < 2.2 only returns major.minor return getOpenOfficeProperty(NODE_PRODUCT, "ooSetupVersion"); } } public String getOpenOfficeLocale(){ return getOpenOfficeProperty(NODE_L10N, "ooLocale"); } } OpenOfficeConnection.java000066400000000000000000000031111124733227500357530ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/openoffice/connection// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.connection; import java.net.ConnectException; import com.sun.star.bridge.XBridge; import com.sun.star.frame.XComponentLoader; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.ucb.XFileIdentifierConverter; import com.sun.star.uno.XComponentContext; /** * A UNO remote protocol connection to a listening OpenOffice.org instance */ public interface OpenOfficeConnection { public void connect() throws ConnectException; public void disconnect(); public boolean isConnected(); /** * @return the com.sun.star.frame.Desktop service */ public XComponentLoader getDesktop(); /** * @return the com.sun.star.ucb.FileContentProvider service */ public XFileIdentifierConverter getFileContentProvider(); public XBridge getBridge(); public XMultiComponentFactory getRemoteServiceManager(); public XComponentContext getComponentContext(); } OpenOfficeException.java000066400000000000000000000020131124733227500356120ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/openoffice/connection// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.connection; public class OpenOfficeException extends RuntimeException { private static final long serialVersionUID = 1L; public OpenOfficeException(String message) { super(message); } public OpenOfficeException(String message, Throwable cause) { super(message, cause); } } PipeOpenOfficeConnection.java000066400000000000000000000025541124733227500366030ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/openoffice/connection// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.connection; /** * OpenOffice connection using a named pipe *

* Warning! This requires the sal3 native library shipped with OpenOffice.org; * it must be made available via the java.library.path parameter, e.g. *

 *   java -Djava.library.path=/opt/openoffice.org/program my.App
 * 
*/ public class PipeOpenOfficeConnection extends AbstractOpenOfficeConnection { public static final String DEFAULT_PIPE_NAME = "jodconverter"; public PipeOpenOfficeConnection() { this(DEFAULT_PIPE_NAME); } public PipeOpenOfficeConnection(String pipeName) { super("pipe,name="+ pipeName); } } SocketOpenOfficeConnection.java000066400000000000000000000023471124733227500371360ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/openoffice/connection// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.connection; public class SocketOpenOfficeConnection extends AbstractOpenOfficeConnection { public static final String DEFAULT_HOST = "localhost"; public static final int DEFAULT_PORT = 8100; public SocketOpenOfficeConnection() { this(DEFAULT_HOST, DEFAULT_PORT); } public SocketOpenOfficeConnection(int port) { this(DEFAULT_HOST, port); } public SocketOpenOfficeConnection(String host, int port) { super("socket,host=" + host + ",port=" + port + ",tcpNoDelay=1"); } } jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/openoffice/converter/000077500000000000000000000000001124733227500310065ustar00rootroot00000000000000AbstractOpenOfficeDocumentConverter.java000066400000000000000000000135331124733227500406670ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/openoffice/converter// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.converter; import java.io.File; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.commons.io.FilenameUtils; import com.artofsolving.jodconverter.DefaultDocumentFormatRegistry; import com.artofsolving.jodconverter.DocumentConverter; import com.artofsolving.jodconverter.DocumentFormat; import com.artofsolving.jodconverter.DocumentFormatRegistry; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; import com.sun.star.beans.PropertyValue; import com.sun.star.lang.XComponent; import com.sun.star.uno.UnoRuntime; import com.sun.star.util.XRefreshable; public abstract class AbstractOpenOfficeDocumentConverter implements DocumentConverter { private final Map/**/ defaultLoadProperties; protected OpenOfficeConnection openOfficeConnection; private DocumentFormatRegistry documentFormatRegistry; public AbstractOpenOfficeDocumentConverter(OpenOfficeConnection connection) { this(connection, new DefaultDocumentFormatRegistry()); } public AbstractOpenOfficeDocumentConverter(OpenOfficeConnection openOfficeConnection, DocumentFormatRegistry documentFormatRegistry) { this.openOfficeConnection = openOfficeConnection; this.documentFormatRegistry = documentFormatRegistry; defaultLoadProperties = new HashMap(); defaultLoadProperties.put("Hidden", Boolean.TRUE); defaultLoadProperties.put("ReadOnly", Boolean.TRUE); } public void setDefaultLoadProperty(String name, Object value) { defaultLoadProperties.put(name, value); } protected Map getDefaultLoadProperties() { return defaultLoadProperties; } protected DocumentFormatRegistry getDocumentFormatRegistry() { return documentFormatRegistry; } public void convert(File inputFile, File outputFile) { convert(inputFile, outputFile, null); } public void convert(File inputFile, File outputFile, DocumentFormat outputFormat) { convert(inputFile, null, outputFile, outputFormat); } public void convert(InputStream inputStream, DocumentFormat inputFormat, OutputStream outputStream, DocumentFormat outputFormat) { ensureNotNull("inputStream", inputStream); ensureNotNull("inputFormat", inputFormat); ensureNotNull("outputStream", outputStream); ensureNotNull("outputFormat", outputFormat); convertInternal(inputStream, inputFormat, outputStream, outputFormat); } public void convert(File inputFile, DocumentFormat inputFormat, File outputFile, DocumentFormat outputFormat) { ensureNotNull("inputFile", inputFile); ensureNotNull("outputFile", outputFile); if (!inputFile.exists()) { throw new IllegalArgumentException("inputFile doesn't exist: " + inputFile); } if (inputFormat == null) { inputFormat = guessDocumentFormat(inputFile); } if (outputFormat == null) { outputFormat = guessDocumentFormat(outputFile); } if (!inputFormat.isImportable()) { throw new IllegalArgumentException("unsupported input format: " + inputFormat.getName()); } if (!inputFormat.isExportableTo(outputFormat)) { throw new IllegalArgumentException("unsupported conversion: from " + inputFormat.getName() + " to " + outputFormat.getName()); } convertInternal(inputFile, inputFormat, outputFile, outputFormat); } protected abstract void convertInternal(InputStream inputStream, DocumentFormat inputFormat, OutputStream outputStream, DocumentFormat outputFormat); protected abstract void convertInternal(File inputFile, DocumentFormat inputFormat, File outputFile, DocumentFormat outputFormat); private void ensureNotNull(String argumentName, Object argumentValue) { if (argumentValue == null) { throw new IllegalArgumentException(argumentName + " is null"); } } private DocumentFormat guessDocumentFormat(File file) { String extension = FilenameUtils.getExtension(file.getName()); DocumentFormat format = getDocumentFormatRegistry().getFormatByFileExtension(extension); if (format == null) { throw new IllegalArgumentException("unknown document format for file: " + file); } return format; } protected void refreshDocument(XComponent document) { XRefreshable refreshable = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, document); if (refreshable != null) { refreshable.refresh(); } } protected static PropertyValue property(String name, Object value) { PropertyValue property = new PropertyValue(); property.Name = name; property.Value = value; return property; } protected static PropertyValue[] toPropertyValues(Map/**/ properties) { PropertyValue[] propertyValues = new PropertyValue[properties.size()]; int i = 0; for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); Object value = entry.getValue(); if (value instanceof Map) { // recursively convert nested Map to PropertyValue[] Map subProperties = (Map) value; value = toPropertyValues(subProperties); } propertyValues[i++] = property((String) entry.getKey(), value); } return propertyValues; } } OpenOfficeDocumentConverter.java000066400000000000000000000155731124733227500372110ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/openoffice/converter// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.converter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.Map; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.artofsolving.jodconverter.DocumentConverter; import com.artofsolving.jodconverter.DocumentFormat; import com.artofsolving.jodconverter.DocumentFormatRegistry; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException; import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XStorable; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.XComponent; import com.sun.star.task.ErrorCodeIOException; import com.sun.star.ucb.XFileIdentifierConverter; import com.sun.star.uno.UnoRuntime; import com.sun.star.util.CloseVetoException; import com.sun.star.util.XCloseable; /** * Default file-based {@link DocumentConverter} implementation. *

* This implementation passes document data to and from the OpenOffice.org * service as file URLs. *

* File-based conversions are faster than stream-based ones (provided by * {@link StreamOpenOfficeDocumentConverter}) but they require the * OpenOffice.org service to be running locally and have the correct * permissions to the files. * * @see StreamOpenOfficeDocumentConverter */ public class OpenOfficeDocumentConverter extends AbstractOpenOfficeDocumentConverter { private static final Logger logger = LoggerFactory.getLogger(OpenOfficeDocumentConverter.class); public OpenOfficeDocumentConverter(OpenOfficeConnection connection) { super(connection); } public OpenOfficeDocumentConverter(OpenOfficeConnection connection, DocumentFormatRegistry formatRegistry) { super(connection, formatRegistry); } /** * In this file-based implementation, streams are emulated using temporary files. */ protected void convertInternal(InputStream inputStream, DocumentFormat inputFormat, OutputStream outputStream, DocumentFormat outputFormat) { File inputFile = null; File outputFile = null; try { inputFile = File.createTempFile("document", "." + inputFormat.getFileExtension()); OutputStream inputFileStream = null; try { inputFileStream = new FileOutputStream(inputFile); IOUtils.copy(inputStream, inputFileStream); } finally { IOUtils.closeQuietly(inputFileStream); } outputFile = File.createTempFile("document", "." + outputFormat.getFileExtension()); convert(inputFile, inputFormat, outputFile, outputFormat); InputStream outputFileStream = null; try { outputFileStream = new FileInputStream(outputFile); IOUtils.copy(outputFileStream, outputStream); } finally { IOUtils.closeQuietly(outputFileStream); } } catch (IOException ioException) { throw new OpenOfficeException("conversion failed", ioException); } finally { if (inputFile != null) { inputFile.delete(); } if (outputFile != null) { outputFile.delete(); } } } protected void convertInternal(File inputFile, DocumentFormat inputFormat, File outputFile, DocumentFormat outputFormat) { Map/**/ loadProperties = new HashMap(); loadProperties.putAll(getDefaultLoadProperties()); loadProperties.putAll(inputFormat.getImportOptions()); Map/**/ storeProperties = outputFormat.getExportOptions(inputFormat.getFamily()); synchronized (openOfficeConnection) { XFileIdentifierConverter fileContentProvider = openOfficeConnection.getFileContentProvider(); String inputUrl = fileContentProvider.getFileURLFromSystemPath("", inputFile.getAbsolutePath()); String outputUrl = fileContentProvider.getFileURLFromSystemPath("", outputFile.getAbsolutePath()); loadAndExport(inputUrl, loadProperties, outputUrl, storeProperties); } } private void loadAndExport(String inputUrl, Map/**/ loadProperties, String outputUrl, Map/**/ storeProperties) throws OpenOfficeException { XComponent document; try { document = loadDocument(inputUrl, loadProperties); } catch (ErrorCodeIOException errorCodeIOException) { throw new OpenOfficeException("conversion failed: could not load input document; OOo errorCode: " + errorCodeIOException.ErrCode, errorCodeIOException); } catch (Exception otherException) { throw new OpenOfficeException("conversion failed: could not load input document", otherException); } if (document == null) { throw new OpenOfficeException("conversion failed: could not load input document"); } refreshDocument(document); try { storeDocument(document, outputUrl, storeProperties); } catch (ErrorCodeIOException errorCodeIOException) { throw new OpenOfficeException("conversion failed: could not save output document; OOo errorCode: " + errorCodeIOException.ErrCode, errorCodeIOException); } catch (Exception otherException) { throw new OpenOfficeException("conversion failed: could not save output document", otherException); } } private XComponent loadDocument(String inputUrl, Map loadProperties) throws com.sun.star.io.IOException, IllegalArgumentException { XComponentLoader desktop = openOfficeConnection.getDesktop(); return desktop.loadComponentFromURL(inputUrl, "_blank", 0, toPropertyValues(loadProperties)); } private void storeDocument(XComponent document, String outputUrl, Map storeProperties) throws com.sun.star.io.IOException { try { XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, document); storable.storeToURL(outputUrl, toPropertyValues(storeProperties)); } finally { XCloseable closeable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, document); if (closeable != null) { try { closeable.close(true); } catch (CloseVetoException closeVetoException) { logger.warn("document.close() vetoed"); } } else { document.dispose(); } } } } StreamOpenOfficeDocumentConverter.java000066400000000000000000000126231124733227500403560ustar00rootroot00000000000000jodconverter-2.2.2/src/main/java/com/artofsolving/jodconverter/openoffice/converter// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.converter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.Map; import org.apache.commons.io.IOUtils; import com.artofsolving.jodconverter.DocumentConverter; import com.artofsolving.jodconverter.DocumentFormat; import com.artofsolving.jodconverter.DocumentFormatRegistry; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException; import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XStorable; import com.sun.star.lang.XComponent; import com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter; import com.sun.star.lib.uno.adapter.OutputStreamToXOutputStreamAdapter; import com.sun.star.uno.UnoRuntime; /** * Alternative stream-based {@link DocumentConverter} implementation. *

* This implementation passes document data to and from the OpenOffice.org * service as streams. *

* Stream-based conversions are slower than the default file-based ones (provided * by {@link OpenOfficeDocumentConverter}) but they allow to run the OpenOffice.org * service on a different machine, or under a different system user on the same * machine without file permission problems. *

* Warning! There is a bug * in OpenOffice.org 2.2.x that causes some input formats, including Word and Excel, not to work when * using stream-base conversions. *

* Use this implementation only if {@link OpenOfficeDocumentConverter} is not possible. * * @see OpenOfficeDocumentConverter */ public class StreamOpenOfficeDocumentConverter extends AbstractOpenOfficeDocumentConverter { public StreamOpenOfficeDocumentConverter(OpenOfficeConnection connection) { super(connection); } public StreamOpenOfficeDocumentConverter(OpenOfficeConnection connection, DocumentFormatRegistry formatRegistry) { super(connection, formatRegistry); } protected void convertInternal(File inputFile, DocumentFormat inputFormat, File outputFile, DocumentFormat outputFormat) { InputStream inputStream = null; OutputStream outputStream = null; try { inputStream = new FileInputStream(inputFile); outputStream = new FileOutputStream(outputFile); convert(inputStream, inputFormat, outputStream, outputFormat); } catch (FileNotFoundException fileNotFoundException) { throw new IllegalArgumentException(fileNotFoundException.getMessage()); } finally { IOUtils.closeQuietly(inputStream); IOUtils.closeQuietly(outputStream); } } protected void convertInternal(InputStream inputStream, DocumentFormat inputFormat, OutputStream outputStream, DocumentFormat outputFormat) { Map/**/ exportOptions = outputFormat.getExportOptions(inputFormat.getFamily()); try { synchronized (openOfficeConnection) { loadAndExport(inputStream, inputFormat.getImportOptions(), outputStream, exportOptions); } } catch (OpenOfficeException openOfficeException) { throw openOfficeException; } catch (Throwable throwable) { throw new OpenOfficeException("conversion failed", throwable); } } private void loadAndExport(InputStream inputStream, Map/**/ importOptions, OutputStream outputStream, Map/**/ exportOptions) throws Exception { XComponentLoader desktop = openOfficeConnection.getDesktop(); Map/**/ loadProperties = new HashMap(); loadProperties.putAll(getDefaultLoadProperties()); loadProperties.putAll(importOptions); // doesn't work using InputStreamToXInputStreamAdapter; probably because it's not XSeekable //property("InputStream", new InputStreamToXInputStreamAdapter(inputStream)) loadProperties.put("InputStream", new ByteArrayToXInputStreamAdapter(IOUtils.toByteArray(inputStream))); XComponent document = desktop.loadComponentFromURL("private:stream", "_blank", 0, toPropertyValues(loadProperties)); if (document == null) { throw new OpenOfficeException("conversion failed: input document is null after loading"); } refreshDocument(document); Map/**/ storeProperties = new HashMap(); storeProperties.putAll(exportOptions); storeProperties.put("OutputStream", new OutputStreamToXOutputStreamAdapter(outputStream)); try { XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, document); storable.storeToURL("private:stream", toPropertyValues(storeProperties)); } finally { document.dispose(); } } } jodconverter-2.2.2/src/main/resources/000077500000000000000000000000001124733227500177545ustar00rootroot00000000000000jodconverter-2.2.2/src/main/resources/com/000077500000000000000000000000001124733227500205325ustar00rootroot00000000000000jodconverter-2.2.2/src/main/resources/com/artofsolving/000077500000000000000000000000001124733227500232475ustar00rootroot00000000000000jodconverter-2.2.2/src/main/resources/com/artofsolving/jodconverter/000077500000000000000000000000001124733227500257535ustar00rootroot00000000000000jodconverter-2.2.2/src/main/resources/com/artofsolving/jodconverter/document-formats.xml000066400000000000000000000322231124733227500317660ustar00rootroot00000000000000 Portable Document Format application/pdf pdf Spreadsheet FilterName calc_pdf_Export Text FilterName writer_pdf_Export Drawing FilterName draw_pdf_Export Presentation FilterName impress_pdf_Export Macromedia Flash application/x-shockwave-flash swf Drawing FilterName draw_flash_Export Presentation FilterName impress_flash_Export XHTML application/xhtml+xml xhtml Spreadsheet FilterName XHTML Calc File Text FilterName XHTML Writer File Presentation FilterName XHTML Impress File HTML Text text/html html Spreadsheet FilterName HTML (StarCalc) Text FilterName HTML (StarWriter) Presentation FilterName impress_html_Export OpenDocument Text Text application/vnd.oasis.opendocument.text odt Text FilterName writer8 OpenOffice.org 1.0 Text Document Text application/vnd.sun.xml.writer sxw Text FilterName StarOffice XML (Writer) Microsoft Word Text application/msword doc Text FilterName MS Word 97 Microsoft Word 2007 XML Text application/vnd.openxmlformats-officedocument.wordprocessingml.document docx Rich Text Format Text text/rtf rtf Text FilterName Rich Text Format WordPerfect Text application/wordperfect wpd Plain Text Text text/plain txt Text FilterOptions UTF8,CRLF FilterName Text (encoded) FilterOptions UTF8,CRLF FilterName Text (encoded) MediaWiki wikitext text/x-wiki wiki Text FilterName MediaWiki OpenDocument Spreadsheet Spreadsheet application/vnd.oasis.opendocument.spreadsheet ods Spreadsheet FilterName calc8 OpenOffice.org 1.0 Spreadsheet Spreadsheet application/vnd.sun.xml.calc sxc Spreadsheet FilterName StarOffice XML (Calc) Microsoft Excel Spreadsheet application/vnd.ms-excel xls Spreadsheet FilterName MS Excel 97 Microsoft Excel 2007 XML Spreadsheet application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx CSV Spreadsheet text/csv csv Spreadsheet FilterOptions 44,34,0 FilterName Text - txt - csv (StarCalc) FilterOptions 44,34,0 FilterName Text - txt - csv (StarCalc) Tab-separated Values Spreadsheet text/tab-separated-values tsv Spreadsheet FilterOptions 9,34,0 FilterName Text - txt - csv (StarCalc) FilterOptions 9,34,0 FilterName Text - txt - csv (StarCalc) OpenDocument Presentation Presentation application/vnd.oasis.opendocument.presentation odp Presentation FilterName impress8 OpenOffice.org 1.0 Presentation Presentation application/vnd.sun.xml.impress sxi Presentation FilterName StarOffice XML (Impress) Microsoft PowerPoint Presentation application/vnd.ms-powerpoint ppt Presentation FilterName MS PowerPoint 97 Microsoft PowerPoint 2007 XML Presentation application/vnd.openxmlformats-officedocument.presentationml.presentation pptx OpenDocument Drawing Drawing application/vnd.oasis.opendocument.graphics odg Drawing FilterName draw8 Scalable Vector Graphics image/svg+xml svg Drawing FilterName draw_svg_Export jodconverter-2.2.2/src/test/000077500000000000000000000000001124733227500157755ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/000077500000000000000000000000001124733227500167165ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/000077500000000000000000000000001124733227500174745ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/000077500000000000000000000000001124733227500222115ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/000077500000000000000000000000001124733227500247155ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/DocumentFamilyTest.java000066400000000000000000000025301124733227500313400ustar00rootroot00000000000000// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter; import com.artofsolving.jodconverter.DocumentFamily; import junit.framework.TestCase; public class DocumentFamilyTest extends TestCase { public void testValidFamilies() { assertEquals(DocumentFamily.TEXT, DocumentFamily.getFamily("Text")); assertEquals(DocumentFamily.SPREADSHEET, DocumentFamily.getFamily("Spreadsheet")); assertEquals(DocumentFamily.PRESENTATION, DocumentFamily.getFamily("Presentation")); } public void testInvalidFamily() { try { DocumentFamily.getFamily("Invalid"); fail("invalid family should throw an exception"); } catch (IllegalArgumentException illegalArgumentException) { // expected } } } jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/DocumentFormatRegistryTest.java000066400000000000000000000031471124733227500331050ustar00rootroot00000000000000// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter; import junit.framework.TestCase; public class DocumentFormatRegistryTest extends TestCase { private DocumentFormatRegistry defaultRegistry = new DefaultDocumentFormatRegistry(); public void testDefaults() { DocumentFormat pdf1 = defaultRegistry.getFormatByFileExtension("pdf"); assertNotNull(pdf1); DocumentFormat pdf2 = defaultRegistry.getFormatByMimeType("application/pdf"); assertNotNull(pdf2); assertEquals(pdf1, pdf2); } public void testUnknownFormats() { DocumentFormat unknown1 = defaultRegistry.getFormatByFileExtension("xyz"); assertNull(unknown1); DocumentFormat unknown2 = defaultRegistry.getFormatByMimeType("type/xyz"); assertNull(unknown2); } public void testCaseInsensitivity() { DocumentFormat pdf = defaultRegistry.getFormatByFileExtension("PDF"); assertNotNull(pdf); assertEquals(defaultRegistry.getFormatByFileExtension("pdf"), pdf); } } jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/DocumentFormatTest.java000066400000000000000000000121711124733227500313510ustar00rootroot00000000000000// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter; import java.util.Map; import com.artofsolving.jodconverter.DocumentFamily; import com.artofsolving.jodconverter.DocumentFormat; import junit.framework.TestCase; public class DocumentFormatTest extends TestCase { public void testNewInstanceForDeserialization() throws InstantiationException, IllegalAccessException { // XStream uses reflection on some JVMs to deserialize from XML DocumentFormat documentFormat = (DocumentFormat) DocumentFormat.class.newInstance(); assertNotNull(documentFormat); } public void testBasicFields() { DocumentFormat documentFormat = new DocumentFormat("A Text Format", DocumentFamily.TEXT, "type/a-text", "atf"); assertEquals("A Text Format", documentFormat.getName()); assertEquals(DocumentFamily.TEXT, documentFormat.getFamily()); assertEquals("type/a-text", documentFormat.getMimeType()); assertEquals("atf", documentFormat.getFileExtension()); } public void testExportOptions() { DocumentFormat documentFormat = new DocumentFormat("A Text Format", DocumentFamily.TEXT, "type/a-text", "atf"); Map defaultExportOptions = documentFormat.getExportOptions(DocumentFamily.TEXT); assertNotNull(defaultExportOptions); assertTrue(defaultExportOptions.isEmpty()); documentFormat.setExportOption(DocumentFamily.TEXT, "option1", "a"); documentFormat.setExportOption(DocumentFamily.TEXT, "option2", "b"); Map exportOptions = documentFormat.getExportOptions(DocumentFamily.TEXT); assertEquals(2, exportOptions.size()); assertEquals("a", exportOptions.get("option1")); assertEquals("b", exportOptions.get("option2")); } public void testImportOptions() { DocumentFormat documentFormat = new DocumentFormat("A Text Format", DocumentFamily.TEXT, "type/a-text", "atf"); Map defaultImportOptions = documentFormat.getImportOptions(); assertNotNull(defaultImportOptions); assertTrue(defaultImportOptions.isEmpty()); documentFormat.setImportOption("option1", "a"); documentFormat.setImportOption("option2", "b"); Map importOptions = documentFormat.getImportOptions(); assertEquals(2, importOptions.size()); assertEquals("a", importOptions.get("option1")); assertEquals("b", importOptions.get("option2")); } public void testImportableFlag() { DocumentFormat exportOnlyFormat = new DocumentFormat("Export Only Format", "type/export-only", "eof"); assertTrue("should be export-only", exportOnlyFormat.isExportOnly()); assertFalse("should not be importable", exportOnlyFormat.isImportable()); DocumentFormat importFormat = new DocumentFormat("Import Text Format", DocumentFamily.TEXT, "type/text-import", "itf"); assertTrue("should be importable", importFormat.isImportable()); assertFalse("should not be export-only", importFormat.isExportOnly()); } public void testExportableFromAndTo() { DocumentFormat exportFormat1 = new DocumentFormat("Export Format One", "type/export-1", "ef1"); exportFormat1.setExportFilter(DocumentFamily.TEXT, "export-1-filter"); exportFormat1.setExportFilter(DocumentFamily.SPREADSHEET, "export-1-filter"); assertTrue(exportFormat1.isExportableFrom(DocumentFamily.TEXT)); assertTrue(exportFormat1.isExportableFrom(DocumentFamily.SPREADSHEET)); assertFalse(exportFormat1.isExportableFrom(DocumentFamily.PRESENTATION)); DocumentFormat exportFormat2 = new DocumentFormat("Export Format Two", "type/export-2", "ef2"); exportFormat2.setExportFilter(DocumentFamily.TEXT, "export-2-filter"); assertTrue(exportFormat2.isExportableFrom(DocumentFamily.TEXT)); assertFalse(exportFormat2.isExportableFrom(DocumentFamily.SPREADSHEET)); assertFalse(exportFormat2.isExportableFrom(DocumentFamily.PRESENTATION)); DocumentFormat textFormat = new DocumentFormat("A Text Format", DocumentFamily.TEXT, "type/a-text", "atf"); assertTrue(textFormat.isExportableTo(exportFormat1)); assertTrue(textFormat.isExportableTo(exportFormat2)); DocumentFormat spreadsheetFormat = new DocumentFormat("A Spreadsheet Format", DocumentFamily.SPREADSHEET, "type/a-spreadsheet", "asf"); assertTrue(spreadsheetFormat.isExportableTo(exportFormat1)); assertFalse(spreadsheetFormat.isExportableTo(exportFormat2)); DocumentFormat presentationFormat = new DocumentFormat("A Presentation Format", DocumentFamily.PRESENTATION, "type/a-presentation", "apf"); assertFalse(presentationFormat.isExportableTo(exportFormat1)); assertFalse(presentationFormat.isExportableTo(exportFormat2)); } } jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/XmlDocumentFormatRegistryTest.java000066400000000000000000000034031124733227500335610ustar00rootroot00000000000000// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter; import com.artofsolving.jodconverter.DocumentFormat; import com.artofsolving.jodconverter.DocumentFormatRegistry; import com.artofsolving.jodconverter.XmlDocumentFormatRegistry; import junit.framework.TestCase; public class XmlDocumentFormatRegistryTest extends TestCase { private DocumentFormatRegistry defaultRegistry = new XmlDocumentFormatRegistry(); public void testDefaults() { DocumentFormat pdf1 = defaultRegistry.getFormatByFileExtension("pdf"); assertNotNull(pdf1); DocumentFormat pdf2 = defaultRegistry.getFormatByMimeType("application/pdf"); assertNotNull(pdf2); assertEquals(pdf1, pdf2); } public void testUnknownFormats() { DocumentFormat unknown1 = defaultRegistry.getFormatByFileExtension("xyz"); assertNull(unknown1); DocumentFormat unknown2 = defaultRegistry.getFormatByMimeType("type/xyz"); assertNull(unknown2); } public void testNullConfiguration() { try { new XmlDocumentFormatRegistry(null); fail("should throw exception"); } catch (IllegalArgumentException illegalArgumentException) { // expected } } } jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/000077500000000000000000000000001124733227500270325ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/connection/000077500000000000000000000000001124733227500311715ustar00rootroot00000000000000OpenOfficeConfigurationTest.java000066400000000000000000000015201124733227500373600ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/connectionpackage com.artofsolving.jodconverter.openoffice.connection; import com.artofsolving.jodconverter.test.OpenOfficeTestContext; import junit.framework.TestCase; public class OpenOfficeConfigurationTest extends TestCase { private OpenOfficeConfiguration configuration; protected void setUp() throws Exception { super.setUp(); OpenOfficeConnection connection = OpenOfficeTestContext.getInstance().getOpenOfficeConnection(); configuration = new OpenOfficeConfiguration(connection); } public void testVersion() { checkNotEmpty(configuration.getOpenOfficeVersion()); } public void testLocale() { checkNotEmpty(configuration.getOpenOfficeLocale()); } private void checkNotEmpty(String value) { assertNotNull(value); assertTrue(value.length() > 0); } } PipeOpenOfficeConnectionTest.java000066400000000000000000000031321124733227500374670ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/connection// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.connection; import java.io.IOException; import java.net.ConnectException; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; import com.artofsolving.jodconverter.openoffice.connection.PipeOpenOfficeConnection; import junit.framework.TestCase; public class PipeOpenOfficeConnectionTest extends TestCase { public void testInvalidConnection() throws ConnectException { OpenOfficeConnection connection = new PipeOpenOfficeConnection("no-such-pipe-name"); try { connection.connect(); fail("should throw exception"); } catch (ConnectException connectException) { // expected } } public void testConnectAndDisconnect() throws IOException { OpenOfficeConnection connection = new PipeOpenOfficeConnection(); connection.connect(); assertTrue(connection.isConnected()); assertNotNull(connection.getDesktop()); connection.disconnect(); } } SocketOpenOfficeConnectionTest.java000066400000000000000000000056211124733227500400270ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/connection// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.connection; import java.io.IOException; import java.net.ConnectException; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; import junit.framework.TestCase; public class SocketOpenOfficeConnectionTest extends TestCase { public void testInvalidConnection() throws ConnectException { OpenOfficeConnection connection = new SocketOpenOfficeConnection(59999); try { connection.connect(); fail("should throw exception"); } catch (ConnectException connectException) { // expected } } public void testConnectAndDisconnect() throws IOException { OpenOfficeConnection connection = new SocketOpenOfficeConnection(); connection.connect(); assertTrue(connection.isConnected()); assertNotNull(connection.getDesktop()); assertNotNull(connection.getBridge()); assertNotNull(connection.getComponentContext()); assertNotNull(connection.getRemoteServiceManager()); connection.disconnect(); } public void testAutoConnect() throws IOException { OpenOfficeConnection connection = new SocketOpenOfficeConnection(); assertFalse(connection.isConnected()); assertNotNull(connection.getDesktop()); assertTrue(connection.isConnected()); connection.disconnect(); } public void testAutoReconnectAfterUnexpectedDisconnection() throws IOException { SocketOpenOfficeConnection connection = new SocketOpenOfficeConnection(); connection.connect(); assertTrue(connection.isConnected()); assertNotNull(connection.getDesktop()); connection.simulateUnexpectedDisconnection(); assertFalse(connection.isConnected()); // getDesktop() should force the reconnect assertNotNull(connection.getDesktop()); assertTrue(connection.isConnected()); connection.disconnect(); } public void testMultipleConnections() throws Exception { OpenOfficeConnection connection1 = new SocketOpenOfficeConnection(); OpenOfficeConnection connection2 = new SocketOpenOfficeConnection(); connection1.connect(); assertTrue(connection1.isConnected()); connection2.connect(); assertTrue(connection2.isConnected()); connection1.disconnect(); connection2.disconnect(); } } jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/converter/000077500000000000000000000000001124733227500310415ustar00rootroot00000000000000AbstractConverterTest.java000066400000000000000000000104071124733227500361220ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/converter// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.converter; import java.io.File; import java.io.IOException; import junit.framework.TestCase; import org.apache.commons.io.FileUtils; import com.artofsolving.jodconverter.BasicDocumentFormatRegistry; import com.artofsolving.jodconverter.DocumentConverter; import com.artofsolving.jodconverter.DocumentFamily; import com.artofsolving.jodconverter.DocumentFormat; import com.artofsolving.jodconverter.DocumentFormatRegistry; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; import com.artofsolving.jodconverter.test.FileType; import com.artofsolving.jodconverter.test.OpenOfficeTestContext; public abstract class AbstractConverterTest extends TestCase { private static final String TEST_RESOURCE_PATH = "src/test/resources"; private static final int BYTE_ORDER_MARK_CHAR = 0xFEFF; private OpenOfficeConnection openOfficeConnection; private DocumentFormatRegistry documentFormatRegistry; private DocumentConverter documentConverter; protected void setUp() throws Exception { openOfficeConnection = OpenOfficeTestContext.getInstance().getOpenOfficeConnection(); documentFormatRegistry = createTestDocumentFormatRegistry(); documentConverter = new OpenOfficeDocumentConverter(openOfficeConnection, documentFormatRegistry); } private DocumentFormatRegistry createTestDocumentFormatRegistry() { // ODT to PDF is the only conversions needed by *unit* tests BasicDocumentFormatRegistry registry = new BasicDocumentFormatRegistry(); DocumentFormat odt = new DocumentFormat("ODT", DocumentFamily.TEXT, "application/vnd.oasis.opendocument.text", "odt"); registry.addDocumentFormat(odt); DocumentFormat pdf = new DocumentFormat("PDF", DocumentFamily.TEXT, "application/pdf", "pdf"); pdf.setExportFilter(DocumentFamily.TEXT, "writer_pdf_Export"); registry.addDocumentFormat(pdf); return registry; } protected OpenOfficeConnection getOpenOfficeConnection() { return openOfficeConnection; } public DocumentFormatRegistry getDocumentFormatRegistry() { return documentFormatRegistry; } protected DocumentConverter getDocumentConverter() { return documentConverter; } protected File createTempFile(String extension) throws IOException { File tempFile = File.createTempFile("document", "."+ extension); tempFile.deleteOnExit(); return tempFile; } protected File getTestFile(String fileName) { return new File(TEST_RESOURCE_PATH, fileName); } protected File convertAndCheck(String fileName, String extension, FileType fileType) throws IOException { File inputFile = getTestFile(fileName); File outputFile = createTempFile(extension); getDocumentConverter().convert(inputFile, outputFile); checkOutputFile(outputFile, fileType); return outputFile; } protected void checkOutputFile(File outputFile, FileType fileType) throws IOException { assertTrue("file not created", outputFile.isFile()); assertFalse("file is empty", outputFile.length() == 0); assertTrue("file not of type " + fileType.getName(), fileType.matches(outputFile)); } protected String readTextContent(File file) throws IOException { String content = FileUtils.readFileToString(file, "UTF-8"); return stripByteOrderMarkChar(content).trim(); } protected String stripByteOrderMarkChar(String content) { if (content.length() > 0 && content.charAt(0) == BYTE_ORDER_MARK_CHAR) { return content.substring(1).trim(); } return content; } } OpenOfficeDocumentConverterTest.java000066400000000000000000000136421124733227500400770ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/converter// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.converter; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.commons.io.output.ByteArrayOutputStream; import com.artofsolving.jodconverter.DefaultDocumentFormatRegistry; import com.artofsolving.jodconverter.DocumentFamily; import com.artofsolving.jodconverter.DocumentFormat; import com.artofsolving.jodconverter.DocumentFormatRegistry; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException; public class OpenOfficeDocumentConverterTest extends AbstractConverterTest { public void testConversionWithEmulatedStreams() throws IOException { DocumentFormatRegistry registry = new DefaultDocumentFormatRegistry(); InputStream inputStream = new FileInputStream(getTestFile("hello.odt")); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); getDocumentConverter().convert(inputStream, registry.getFormatByFileExtension("odt"), outputStream, registry.getFormatByFileExtension("txt")); inputStream.close(); assertEquals("output content", "Hello from an OpenDocument Text!", stripByteOrderMarkChar(outputStream.toString("UTF-8"))); } public void testNullArgumentWithStreams() { DocumentFormat inputFormat = new DocumentFormat("XYZ", "application/xyz", "xyz"); DocumentFormat outputFormat = new DocumentFormat("ABC", "application/abc", "abc"); InputStream inputStream = new ByteArrayInputStream(new byte[0]); OutputStream outputStream = new ByteArrayOutputStream(); try { getDocumentConverter().convert(null, inputFormat, outputStream, outputFormat); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertEquals("inputStream is null", argumentException.getMessage()); } try { getDocumentConverter().convert(inputStream, null, outputStream, outputFormat); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertEquals("inputFormat is null", argumentException.getMessage()); } try { getDocumentConverter().convert(inputStream, inputFormat, null, outputFormat); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertEquals("outputStream is null", argumentException.getMessage()); } try { getDocumentConverter().convert(inputStream, inputFormat, outputStream, null); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertEquals("outputFormat is null", argumentException.getMessage()); } } public void testNullArgumentWithFiles() throws IOException { try { getDocumentConverter().convert(null, new File("unused")); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertEquals("inputFile is null", argumentException.getMessage()); } try { getDocumentConverter().convert(new File("unused"), null); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertEquals("outputFile is null", argumentException.getMessage()); } } public void testNoSuchInputFile() throws IOException { try { getDocumentConverter().convert(new File("no-such-file.odt"), new File("unused")); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertTrue(argumentException.getMessage().startsWith("inputFile doesn't exist")); } } public void testUnknownInputFileFormat() throws IOException { try { getDocumentConverter().convert(getTestFile("unknown-type.xyz"), new File("unused")); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertTrue(argumentException.getMessage().startsWith("unknown document format")); } } public void testExportOnlyFormatAsInput() throws IOException { DocumentFormat inputFormat = new DocumentFormat("XYZ", "application/xyz", "xyz"); DocumentFormat outputFormat = new DocumentFormat("ABC", "application/abc", "abc"); try { getDocumentConverter().convert(getTestFile("unknown-type.xyz"), inputFormat, new File("unused"), outputFormat); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertTrue(argumentException.getMessage().startsWith("unsupported input format")); } } public void testUnsupportedConversion() throws IOException { DocumentFormat inputFormat = new DocumentFormat("XYZ", DocumentFamily.TEXT, "application/xyz", "xyz"); DocumentFormat outputFormat = new DocumentFormat("ABC", "application/abc", "abc"); try { getDocumentConverter().convert(getTestFile("unknown-type.xyz"), inputFormat, new File("unused"), outputFormat); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertTrue(argumentException.getMessage().startsWith("unsupported conversion")); } } public void testCorruptedInputFile() throws IOException { File inputFile = getTestFile("invalid.odt"); try { getDocumentConverter().convert(inputFile, createTempFile("pdf")); fail("should have detected that the input file was invalid"); } catch (OpenOfficeException openOfficeException) { assertTrue(openOfficeException.getMessage().startsWith("conversion failed")); } } } StreamOpenOfficeDocumentConverterTest.java000066400000000000000000000035231124733227500412500ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/converter// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.converter; import java.io.IOException; import com.artofsolving.jodconverter.DocumentConverter; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException; import com.artofsolving.jodconverter.openoffice.converter.StreamOpenOfficeDocumentConverter; import com.artofsolving.jodconverter.test.FileType; public class StreamOpenOfficeDocumentConverterTest extends AbstractConverterTest { private DocumentConverter converter; protected void setUp() throws Exception { super.setUp(); converter = new StreamOpenOfficeDocumentConverter(getOpenOfficeConnection(), getDocumentFormatRegistry()); } protected DocumentConverter getDocumentConverter() { return converter; } public void testValidConversion() throws IOException { convertAndCheck("hello.odt", "pdf", FileType.PDF); } public void testCorruptedInputFile() throws IOException { try { convertAndCheck("invalid.odt", "pdf", FileType.PDF); fail("should have detected that the input file was invalid"); } catch (OpenOfficeException openOfficeException) { assertTrue(openOfficeException.getMessage().startsWith("conversion failed")); } } } jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/converter/functional/000077500000000000000000000000001124733227500332035ustar00rootroot00000000000000AbstractFunctionalConversionTest.java000066400000000000000000000025661124733227500424740ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/converter/functional// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.converter.functional; import com.artofsolving.jodconverter.DocumentConverter; import com.artofsolving.jodconverter.openoffice.converter.AbstractConverterTest; import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; public abstract class AbstractFunctionalConversionTest extends AbstractConverterTest { private DocumentConverter documentConverter; protected void setUp() throws Exception { super.setUp(); // use the default one for functional tests documentConverter = new OpenOfficeDocumentConverter(getOpenOfficeConnection()); } protected DocumentConverter getDocumentConverter() { return documentConverter; } } PdfConversionTest.java000066400000000000000000000125601124733227500374120ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/converter/functional// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.converter.functional; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.pdfbox.pdmodel.PDDocument; import org.pdfbox.util.PDFTextStripper; import com.artofsolving.jodconverter.DocumentFamily; import com.artofsolving.jodconverter.DocumentFormat; import com.artofsolving.jodconverter.test.FileType; /** * All known input formats should be exportable to PDF. Since PDF is * the most popular export format we also check the content. */ public class PdfConversionTest extends AbstractFunctionalConversionTest { private static final String NL = System.getProperty("line.separator"); private String convertAndCheckPdf(String fileName) throws IOException { File outputFile = convertAndCheck(fileName, "pdf", FileType.PDF); return readPdfText(outputFile); } private void assertContains(String content, String expected) throws IOException { if (content.indexOf(expected) == -1) { fail("string not found: \"" + expected + "\"; content is: " + content); } } private String readPdfText(File pdfFile) throws IOException { PDFTextStripper textStripper = new PDFTextStripper(); PDDocument document = PDDocument.load(pdfFile); String text = textStripper.getText(document); document.close(); return text.trim(); } public void testOdtToPdf() throws IOException { String pdfContent = convertAndCheckPdf("hello.odt"); assertEquals("incorrect pdf content", "Hello from an OpenDocument Text!", pdfContent); } public void testSxwToPdf() throws IOException { String pdfContent = convertAndCheckPdf("hello.sxw"); assertEquals("incorrect pdf content", "Hello from an OpenOffice.org 1.0 Text Document!", pdfContent); } public void testDocToPdf() throws IOException { String pdfContent = convertAndCheckPdf("hello.doc"); assertEquals("incorrect pdf content", "Hello from a Microsoft Word Document!", pdfContent); } public void testRtfToPdf() throws IOException { String pdfContent = convertAndCheckPdf("hello.rtf"); assertEquals("incorrect pdf content", "Hello from a RTF Document!", pdfContent); } //TODO: find a WordPerfect document public void _testWpdToPdf() throws IOException { String pdfContent = convertAndCheckPdf("hello.wpd"); assertEquals("incorrect pdf content", "Hello from a WordPerfect document!", pdfContent); } public void testHtmlToPdf() throws IOException { String pdfContent = convertAndCheckPdf("hello.html"); assertEquals("incorrect pdf content", "Hello from an HTML page!", pdfContent); } public void testOdsToPdf() throws IOException { String pdfContent = convertAndCheckPdf("hello.ods"); assertContains(pdfContent, "Hello from an OpenDocument Spreadsheet!"); } public void testSxcToPdf() throws IOException { String pdfContent = convertAndCheckPdf("hello.sxc"); assertContains(pdfContent, "Hello from an OpenOffice.org 1.0 Spreadsheet!"); } public void testXlsToPdf() throws IOException { String pdfContent = convertAndCheckPdf("hello.xls"); assertContains(pdfContent, "Hello from a Microsoft Excel Spreadsheet!"); } public void testOdpToPdf() throws IOException { String pdfContent = convertAndCheckPdf("hello.odp"); assertEquals("incorrect pdf content", "Hello from an OpenDocument Presentation!", pdfContent); } public void testSxiToPdf() throws IOException { String pdfContent = convertAndCheckPdf("hello.sxi"); assertEquals("incorrect pdf content", "Hello from an OpenOffice.org 1.0 Presentation!", pdfContent); } public void testPptToPdf() throws IOException { String pdfContent = convertAndCheckPdf("hello.ppt"); assertEquals("incorrect pdf content", "Hello from a Microsoft PowerPoint Presentation!", pdfContent); } public void testCustomExportOption() throws IOException { String defaultPdfContent = convertAndCheckPdf("two-pages.odt"); assertEquals("incorrect pdf content", "First page" + NL + "Second page", defaultPdfContent); // normally configured in the registry DocumentFormat customPdfFormat = new DocumentFormat("PDF", "application/pdf", "pdf"); customPdfFormat.setExportFilter(DocumentFamily.TEXT, "writer_pdf_Export"); // export the first page only (easy to verify) Map/**/ pdfOptions = new HashMap(); pdfOptions.put("PageRange", "1"); customPdfFormat.setExportOption(DocumentFamily.TEXT, "FilterData", pdfOptions); File inputFile = getTestFile("two-pages.odt"); File outputFile = createTempFile("pdf"); getDocumentConverter().convert(inputFile, outputFile, customPdfFormat); checkOutputFile(outputFile, FileType.PDF); String customPdfContent = readPdfText(outputFile); assertEquals("incorrect pdf content", "First page", customPdfContent); } } PresentationConversionTest.java000066400000000000000000000025071124733227500413540ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/converter/functional// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.converter.functional; import java.io.IOException; import com.artofsolving.jodconverter.test.FileType; public class PresentationConversionTest extends AbstractFunctionalConversionTest { public void testOdpToPpt() throws IOException { convertAndCheck("hello.odp", "ppt", FileType.MSOFFICE); } public void testOdpToSxi() throws IOException { convertAndCheck("hello.odp", "sxi", FileType.SXI); } public void testOdpToSwf() throws IOException { convertAndCheck("hello.odp", "swf", FileType.SWF); } public void testPptToOdp() throws IOException { convertAndCheck("hello.ppt", "odp", FileType.ODP); } } SpreadsheetConversionTest.java000066400000000000000000000023341124733227500411460ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/converter/functional// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.converter.functional; import java.io.IOException; import com.artofsolving.jodconverter.test.FileType; public class SpreadsheetConversionTest extends AbstractFunctionalConversionTest { public void testOdsToXls() throws IOException { convertAndCheck("hello.ods", "xls", FileType.MSOFFICE); } public void testOdsToSxc() throws IOException { convertAndCheck("hello.ods", "sxc", FileType.SXC); } public void testXlsToOds() throws IOException { convertAndCheck("hello.xls", "ods", FileType.ODS); } } TextConversionTest.java000066400000000000000000000047721124733227500376330ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/openoffice/converter/functional// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.openoffice.converter.functional; import java.io.File; import java.io.IOException; import com.artofsolving.jodconverter.test.FileType; public class TextConversionTest extends AbstractFunctionalConversionTest { public void testOdtToTxt() throws IOException { File outputFile = convertAndCheck("hello.odt", "txt", FileType.TXT); assertEquals("output content", "Hello from an OpenDocument Text!", readTextContent(outputFile)); } public void testOdtToDoc() throws IOException { convertAndCheck("hello.odt", "doc", FileType.MSOFFICE); } public void testOdtToRtf() throws IOException { convertAndCheck("hello.odt", "rtf", FileType.RTF); } public void testOdtToSxw() throws IOException { convertAndCheck("hello.odt", "sxw", FileType.SXW); } public void testOdtToHtml() throws IOException { convertAndCheck("hello.odt", "html", FileType.HTML); } // fails with OOo 2.3.1, passes with 2.0.4: XHTML must have been removed at some point public void _testOdtToXhtml() throws IOException { convertAndCheck("hello.odt", "xhtml", FileType.XHTML); } // requires OOo >= 2.3.0 public void testOdtToWikitext() throws IOException { convertAndCheck("hello.odt", "wiki", FileType.TXT); } public void testDocToOdt() throws IOException { convertAndCheck("hello.doc", "odt", FileType.ODT); } public void testSxwToOdt() throws IOException { convertAndCheck("hello.sxw", "odt", FileType.ODT); } public void testRtfToOdt() throws IOException { convertAndCheck("hello.rtf", "odt", FileType.ODT); } public void testHtmlToOdt() throws IOException { convertAndCheck("hello.html", "odt", FileType.ODT); } public void testTxtToOdt() throws IOException { convertAndCheck("hello-dos.txt", "odt", FileType.ODT); convertAndCheck("hello-unix.txt", "odt", FileType.ODT); } } jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/test/000077500000000000000000000000001124733227500256745ustar00rootroot00000000000000jodconverter-2.2.2/src/test/java/com/artofsolving/jodconverter/test/FileType.java000066400000000000000000000066751124733227500302760ustar00rootroot00000000000000// // JODConverter - Java OpenDocument Converter // Copyright (C) 2004-2007 - Mirko Nasato // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.test; import java.io.EOFException; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.util.Arrays; /** * Trivially simple file type identifier in the style of *nix file(1) and magic(5) *

* Only intended for checking documents generated by OpenOffice.org by automated tests. */ public class FileType { public static FileType TXT = new FileType("Plain Text", 0, ""); // fake check; no easy way to detect plain text public static FileType PDF = new FileType("PDF", 0, "%PDF-"); public static FileType SWF = new FileType("Flash", 0, "FWS"); public static FileType RTF = new FileType("RTF", 0, "{\\rtf"); public static FileType HTML = new FileType("HTML", 0, " // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // http://www.gnu.org/copyleft/lesser.html // package com.artofsolving.jodconverter.test; import java.net.ConnectException; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; public class OpenOfficeTestContext { private static final OpenOfficeTestContext instance = new OpenOfficeTestContext(); private OpenOfficeConnection openOfficeConnection; private OpenOfficeTestContext() { openOfficeConnection = new SocketOpenOfficeConnection(); try { openOfficeConnection.connect(); } catch (ConnectException connectException) { throw new RuntimeException(connectException); } Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { openOfficeConnection.disconnect(); } }); } public OpenOfficeConnection getOpenOfficeConnection() { return openOfficeConnection; } public static OpenOfficeTestContext getInstance() { return instance; } } jodconverter-2.2.2/src/test/resources/000077500000000000000000000000001124733227500200075ustar00rootroot00000000000000jodconverter-2.2.2/src/test/resources/hello-dos.txt000066400000000000000000000000431124733227500224330ustar00rootroot00000000000000Hello from a Plain Text document! jodconverter-2.2.2/src/test/resources/hello-unix.txt000066400000000000000000000000421124733227500226300ustar00rootroot00000000000000Hello from a Plain Text document! jodconverter-2.2.2/src/test/resources/hello.doc000066400000000000000000000170001124733227500215770ustar00rootroot00000000000000ࡱ;   Root Entry  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF  FMicrosoft Word-Dokument MSWordDocWord.Document.89q [bbDefault$a$1$*$A$/B*OJQJCJmH sH PJnH^JaJ_HtHBA@BAbsatz-StandardschriftartBBAbsatz-StandardschriftartHHWW-Absatz-Standardschriftart& LL&&PGTimes New Roman5Symbol3&Arial5TahomaBhFFQ '0Oh+'0  p x 2@N@Y>@nh^O@KQO Mirko Nasato Mirko NasatoM 0LCaolan80 4 &ldddx4  X Hello from a Microsoft Word Document! L'B*CJmH sH PJnH^JaJ_HtHL2. A!n"nn#nn$n2P1h3P(20Root Entry FCompObjjOle 1Table)SummaryInformation(PWordDocument4 jodconverter-2.2.2/src/test/resources/hello.html000066400000000000000000000001521124733227500217760ustar00rootroot00000000000000 Hello

Hello from an HTML page!

jodconverter-2.2.2/src/test/resources/hello.odp000066400000000000000000000217421124733227500216240ustar00rootroot00000000000000PKt23&//mimetypeapplication/vnd.oasis.opendocument.presentationPKt2Configurations2/PKt2 Pictures/PKt2 content.xmlYn6+\=Jd;{Y=$h@DP@R?c_CR);r‡]7̛}t$({#͟{?,# ^< ̔p\ٕW Hdr%/1k.ziֲ^`uvޫE+ @{IE9bO {^y[ev`7 hXf58iqe%AI)֋0 Xik A DXՉ9AN'^МlgMI:'L*ȂQlO"F:Soӝwúy˰JqVz񕗖W 2~r5/,r) Js+/D+Q}0%S"K^aJocg ƺf}@䰯HѬԅE/WcϾ sq,@$DBHJR$ҖZeE 3ZD9|< |}|>$28S5J׌ip|&w$ U'E+qZ~O y5$#$!usL\? UT ֕?:}qM#l>z2`29, nuv #~>Ǔh_&}b9S"(w,<@mMdTb5ZN)cOן ohxr}z-66UCE;rdIm7j;gsyё%J+љMt} ʏb EA| M/*]8^%C7chr^+ݧchz ]>/Fڨ^ZߙG7{1G^ :-sGc w0~d&@zӸ)zJ.<Ե-mi{=5#=&DCwL)e#F}FA?tÃiDb/} CES>MP1MQD$:DA<3MMttKP$MNX;0 CnʼnCM8 4oYo/S%rz:J(ixfP ;l PKw mPKt2 styles.xml]ݲSH܁ ٚT*IMef@l"y,G\@F-C׊ Ȇ{h{Ӫ D/P)m9 Ȑ#Ya!beXEQ$[ЃI .҆?p|Zҋ[w+!t9-d ^AU@Q &eEEO ,x.u?uY1?PS@2 iaNUfXFQZFR\V[^/)* ;Čb 3*jHO6ȴW-L ` ^Ѣ54ܴ\oكn:erhj54ǵU7ed%iY Q=( Tac^U9ה*Bwcj(;`ǵm"BZo)="d<%BR%),IBiGN+roP3Չ?<  oslO<0u4ȗeDRL;Wd[ǁHӚLB!$@Tx Tcv*f a9 ^^H2 ,=R< ILyyϗ)l%Q,Qꟲ@pE LZ2 >:Kx)%<$:wNJnEV;&٬6B̺fEjCdќ/1]rt"dKT& $Gn(:MLus<}tV^Cru$kYR~j8IIWНݢsn޻I}icoLN,z'z!YOYaYOW3LAi1ibG,2L_d阆Q0r}J[mC>m*#(`,Ӽ%VGf&y\jW!W!?E21dF Mf$Z[Qu1l̑+Xя3bsF%4?g /~0'nh{dIcm)/VacIvե;3w6wMt~6,ŝKkyy\7Gv8)I͔&<*+O㒻 ^Z?`ךRwmaj`of29Ka]{[vK^9v)~`׻ރ+ g@_=2~`wcA}d؍~`_tcA}d~`7}#ƝEQ = / zxrvC$WAO@!s]b>$yF>|k$#19+KRiױӜ̂)smX#uEv$`8Pʰ#1 őiICpqF/4"Ĵ"]!ᷯPAb!_^/D5)**RSH\*MqY Ɂue+](4qܸ[f$o\ˀa KHN7Xf C_Qnʙ)ۍ {+Oo$@!!]ѝ,s_Ihc|?pwV~6KjqX3<Q%Y7svýUؗ|&(Ch|l,Zw}Ca̺Aq^{u[y9nY.`Y`ҴR]y}͗oe; :NuW#鑍hy'd0ggv+6 vr~Q3~Cߐ !~CߐϙoH9oH?FY3wf0syp;aiab|A"okH]mz3T]ϼM+ZKj!B5P$G մ(<9@'RIοünonK7o߳-`|&y29m>I*s~*5>aoNrZ0G^÷d\`ɶ# ?Agz (SZ,;HG%CQ.FMZvCibJ~[m' =;rm46>{7RX3z\^3Ԍ"\4.U2S$+HAQ}zWeia{~4nsEUG$"WǡTzJYI5x3I1KLf:dhD9rX"R.C$qNYOVjEY+.^'v=2L-&KZ hJaSs.x`C2sl1o 1u:;NNX+E\> Yt7XH! NE 5^fXihR%uVʐ -n E=|7Y$Ϊ$9_E{=Eht&n6NE'K66ˮ6ƪ*ޖj{%۫m3NKn"2)w_Hѧ6QPK*c vPKt2,HHmeta.xml OpenOffice.org/1.9.95$Linux OpenOffice.org_project/680m95$Build-8900Mirko Nasato2005-05-03T14:26:41Mirko Nasato2005-05-03T15:37:34en-US3PT1M7SPKt2Thumbnails/thumbnail.png sb``p  H.x1b .r_Y`0wUfnDGZ~gjX%^H&ιuy+rngyݽܿrgw~,rǬΉ5yUƏwX_40ٵ{퍫dY ԯ}p/1]z3s?*?=MOOޞĤ0J{ [| ~.PK3  PKt2 settings.xmlZr8}߯H6$*aB&ld%1ޯ_@3hkjybIOۭ6w_7.z#J3Ħ"p3_+ٰPw!YS\Nxy;|)S/B^vz엕g#a+>+F:GȗJ%#O y)Y(ه)ՂbiE\Yjn֦'9¨Z6+{MZ)"]ee%>#U/!{B&n5#ĕ2`@~PDDd*Bxg|%6\Xuj1r*P,ޘ!Zbu> ,"@X sàIOT_CN~N)d* 9Ld%[O7J)x]/-6" l;Eɋڥt(>[8FU+X孆O'40rv)mk RRLZ,&٣ ByT% f*ٯ}2.]"]شϩ?PK?aQL?SL=CQYG2y$qː~Q|:zW-wR |Ҋ5nDA'O4'd$d {t[UhPy .jd-}!MرkFA=%tO&rǦ M~c~\$k0OϛI3OsOޔI3=i֩UBi~=.d@Pok&uHhKIQؾ˘zLQ!4cOi>ޘQ꾒錬 a?Cq~m{gQ+]7p8ՁOHHEaXuʊp[S#aϕr[×aIb~6zyAq]5ުYa4T-cGPN윬Op1NPKr*z%PKt2META-INF/manifest.xmlj1>E$mW%8 -b\tfL&7o(Z;HmkrMNWKDn(圴~CׂЌk|V{KlUXdl8s;+ :+[pɫr*`Qԋ}Ɉ6%a; ^ ,Ct\b3ۑ˺; *Ɏg;+**(|?ܖ[=m4IC$a۾Gulu~<]:=cn g+#h~n(4ؚp(?K ²t f$ۂC_eB5 c™],77 CX:л`cN eBTV}S>p7gYL ph/KKǗ\F<`PK7DZ PKt2 styles.xmlXk6S P$@eI޸]-?"H%HuzCJ%a5mE yۧsƜ#|熋u"<ݹ=O[$M,pB])PŦ:ܹ Zl8HQx#r­ҦWnmmEjvt~gnk*k,pVO\sDxXd9R&3=(o|t:-N !S?\׾9m ./%3E[lFƶCe'r65H^Vc:"50nz}ۺR (YM)tT$P2xWǕߐbZi:[z]7͢nBbkπK B0@N4+*AfM 'BP qa"gQt+^/Sy I03BbRz,%lKɄW} b3ѝA!T G׹r*%f4(Jm:P*BaA?HfIuqL^r=ORug;ǤwRD jLzjM.wY"d&_9oV!,1Fd G$+5+ 4?R'ֶ,O<}2֟{E3sY`~ "Gq @G{=Syl{3? ?-L*wϠ/l_*u=2Bmiji 6WEm7Yyoq GOOO[VXKnRh5-`)&^EMJ6(Z^T}Cr!']?#LvW8EkC=::"xET5 ݰӿnGjPKt2AowB  meta.xml OpenOffice.org/1.9.95$Linux OpenOffice.org_project/680m95$Build-8900Mirko Nasato2005-05-03T14:25:36Mirko Nasato2005-05-03T15:39:38en-US3PT33SPKt2Thumbnails/thumbnail.png sb``p ҥ@ H}WV``` tq ۼ jOWf6R|15җoұ]5U}6Ϗw;{}{޽qv=XmY/܋xl_Em˾m+]-=FO%ǜW΅+ޔy|>kW_>c>*W~\W/Mr-ݷ9r雳O9?o^3|˻{3K{wsܿ{G~/wco\B` (&d4,2OW?uN MPKKSRPKt2 settings.xml[s:ϯpx=ӊrS݃bݽA!C$A=-"ΜSTH򭕕VÕ%dQRjǪRĦ"2](?]gdæCDq(+r8ͤ4)7 o I}HÚ{7’;+ȢBj5 䘲yh4mWg4UT(JoADVkQi[;l߾H~^lvZK"KVSƽc!fj m|وPe=K{,C!GYzbozilW#DNZ h=F:vwNJI.\7־i M9)vB(j;0NYr$l'NRܥ P"6}u`.e{7dهZ5[%\ @9)[}KY[Qz_g|Agׅ_xĝ7(3?-;HN[:Zij>բN0 ML>qْ( 0L!ky=T }P:@:ŔИ[V??y zt1h؅UA4@ȓ4#oF17a:!"$Pp ]Jw|S.L\P- q_D<[fDlQ^`@T;ȣF@_9?,o#0@u򝒾SwJSg@P`;2Tcǣ9B+{8H?O;)wUu̳"0z=F lϵg:71ϻ4A7EG\Sv5q{NLm:5L=u~[+ҽlA,mbDVuqibldu(%ɸG$w15S)?WIg'tQ=j~hW,.j!լ^OƆ;[0ZSkt|ѐCv(u0`Kԩ3Qs;2qH? @ƓR+%6ODǔ"$ zGh!ƲEt@lP|Q2G{ {KV{PKe=rPKt2META-INF/manifest.xmln0<{춧" T-¡G7Ky޾)@E.3fgOwe[h')Rޒ>,^-X)IuZ~O\eirgs"[g{<¯q(kʃwhP9]*U&58Rc2bgpi,$Q0:} )mkM) G/qi! ?C`mjڤ\ry''bW*gRϷCW&oH1 <"-H6qXE몡 DqOՎՆN~PKЃ99PKt2l9..mimetypePKt2TConfigurations2/PKt2 Pictures/PKt27DZ content.xmlPKt2>Gj styles.xmlPKt2AowB  z meta.xmlPKt2KSR Thumbnails/thumbnail.pngPKt2e=r Asettings.xmlPKt2Ѓ99META-INF/manifest.xmlPK ijodconverter-2.2.2/src/test/resources/hello.odt000066400000000000000000000135341124733227500216300ustar00rootroot00000000000000PKt2^2 ''mimetypeapplication/vnd.oasis.opendocument.textPKt2Configurations2/PKt2 Pictures/PKt2 content.xmlVM0W9f KKJUJK+uԫةdwZx潙ɛáɞ*ͤd&T`IWp>,0KawbBgDLLTYY\͑G=6`b;M|fBm,a}z)cA)U {QŁ37OwmND-- ]ՍE0d&3xVԠ_h U ^uUߎHwHEφ;'흓>Bf7ғ{Nẑbs9@*XK)R!\P_ts^zp|ǝzK4Atƴ|'!zz;Z LhS{8/ S@(XI8&+Q1~9.lns*fvJM~HP-`$x*fۭN8Qcl0qzn$9vҋ_k۫ ژxadcv۹yj/wushlRro >?mQϛ<juxA >a'HF9Ii cWS$8SQPK xhPKt2 styles.xmlY͎6) 퍖Mҵzjzh%bCI<}gHQl+4mqp}TŁiÕ|J*Y0So1{U,ާfIzM* L-4ҹP7$zPK/jٌ8쯤& <.C1El[S[]c\X;JUy3{^;WJPPwZIHxSe:RoT}U=4R 4M] УJ9#˅y~//oSV84j.^"`pCQTsIkEX?3mL/{}giԝk}[(XI[ใ״x7i4S[豻mME u$0KNOjɔLhT'I4Щ@M/Us^N"`Gn+o  "' cCxWz9;(tuc6Hh!Z`.4 ,x#dPiuؽ:MkAbU]\ =zE<"ÿlX&ܷtKL\j×O^Fer92$ הh`+^{߱pH9P}T/M$\lJAi p-Vܶna@HC GPbl~ 'cL:tW: L4.dϤkA5$b 3KrIp Z_(5TY:GNid< 0pC W70xVWb՞ gY<[z~RP]$W[@(<8&=TTk}1Fkf! &8HT^46[$;7nZwNqS\o׻;˝zS\;ŕ`cQV* \IJV z HwJY= S*ZD-CC)ʭ{bi.xpC#CwBOk432 d=Ao6axNdȂ`d\}6ÞûcZ@uGCSgɄl$G^Gj }f AK] []r?LT!x+(NY_lΖ1Itp$5=YťS0 |6VU8 GN&thiS*5Wsk8 oFqq%#{aS8ihKuG[DO7'@шg?< PK!mmjPKt2G{{meta.xml OpenOffice.org/1.9.95$Linux OpenOffice.org_project/680m95$Build-8900Mirko Nasato2005-05-03T14:23:39Mirko Nasato2005-05-03T15:38:04en-US3PT41SPKt2Thumbnails/thumbnail.png sb``p ҅@ HZ4G100tq E&-O7b2\m ϋN w?*)|_yAfCaeM1.N{qz[3^:nn6w,.wi2k8NFd1,W N)lF,:&PKIٽPKt2 settings.xmlYr8}߯Hu+L6P S6sVȒKcد߶!\yFӭ雸;H `L+gF[3өB 7KZu۹*P S%N|P%D|[,A)*r\2Y >fNJZ%oX)+MnݸX+46/߯>.= ~lpڃ"KDV3- +c3x\e>x&Lu>·NlWM:3Q( *sgvL`@Q2t2ܖ"R"(BIpq _m\t < kcҿCĻ+ӣpkL& & ]:nO?ytc!."l.dz[Ġ5j!͔ WIH{}/tr|Z hLg%Y$]TpaAEw ζzEM z%z_ް#4&Y~ AٙA3xY S 3M t !ik:EgaqvhLjuMҖBcAB=rW Qp{c{ȥ;Rĉ37mZXQ| er/!\~3)%z? 0wf/z&ut`Y/Vٖ5wJNfkQ696B?,q5 ao Y_:c& ݭF(YOqF ^wezDQzjr6&y4V~_ậq0*WtOyʥ GGW u N!YpH=s>YП̒lͤ sl(I e^ Q.M8xLoUPKhiPKt2META-INF/manifest.xml1o0 {Se T0ttK\A P6~ݓn2WƔ?M[,S^g>My^J- ޼O\5DݖR.u-3_r1EUkoB]WdTڄ oƘޱ3(l@nuBRY) w{Ep.i4mS.("Xaj,lRn5Ђօ"c8 uu1 H: ˶FmԗrlQ\SyPKbi42PKt2^2 ''mimetypePKt2MConfigurations2/PKt2 {Pictures/PKt2 xh content.xmlPKt2!mmj Cstyles.xmlPKt2G{{meta.xmlPKt2Iٽ Thumbnails/thumbnail.pngPKt2hi settings.xmlPKt2bi42META-INF/manifest.xmlPK 1jodconverter-2.2.2/src/test/resources/hello.ppt000066400000000000000000000350001124733227500216350ustar00rootroot00000000000000ࡱ;  Root Entry  dO)MS PowerPoint 97$_& Current UserOh+'0  Dh Mirko Nasato Mirko NasatoGf  N  " ---. ""-8"""- Times New Roman-! 5' Times New Roman-! ' Arial-N2 A/Hello from a Microsoft PowerPoint Presentation!             ''--''՜.+,D՜.+,L 8@ _PID_GUIDAN{DB1AC964-E39C-11D2-A1EF-006097DA5689}(O/ 0|DTimes New RomanDArial DGothic0DStarSymbol@DTahomaf  @?%-W} %-d} %-d} %-d} %-d 0 c $@> g4UdUdUdUd ppp@ <4 g4;d;d;d;d (p@ pp?  %O  =/P$` ̙33` ` ff3333f` 333MMM` f` f` 3?%-W,} %-d,} %-d,} %-d,} %-d,?%-WC }  KWk} %-W/}  KW?} %-WO ?" dd }  dd  } " dd@ }  dd` } dd @?%-W} %-d} %-d} %-d} %-dP}%-W }%-d}%-d}%-d}%-d`}" dd,} dd ,}" dd@,} dd`,}dd,p}" dd } dd }" dd@} dd`}dd}" dd } dd }" dd@} dd`}dd V(    Z$0z =  zFClick to edit the title text format$ $  Z0z Z=  Click to edit the outline text format Second Outline Level Third Outline Level Fourth Outline Level Fifth Outline Level Sixth Outline Level Seventh Outline Level Eighth Outline Level Ninth Outline Level6& l  Z1z =:  *,%-]'  Z5Pk ( C ^yn  Zd2z |W:   *.%-]'  Z5Pk ( C ^yn  Z$3z :  *.%-]'  Z5Pk ( C ^yN  6qљYs ? ̙33 ^V (  v"  NG$ ?O  Z3z      Z4z  T  l  Zd5z P   *,%-]'  Z5Pk ( C ^yn  Z$6z  P  *.%-]'  Z5Pk ( C ^yl  Z6z N   *,%-]'  Z5Pk ( C ^yn  Z7z  N  *.%-]'  Z5Pk ( C ^yH  0޽h ? ̙33 % 4,0 (     T8z_ȯ_ȯ ?q  ^Hello from a Microsoft PowerPoint Presentation!&0%-]0 0 Z5Pk ( C ^y<  c $qљqљ ? ̙33ZR___PPT102.]0G+D' = @B D' = @BA?%,( < +O%,( < ++ 5 tl@(  @  C ?   0 ? V   H  0޽h ? ̙33rP $ &Root EntrydO)CompObj9Ole Current User,PicturesSummaryInformation(<PowerPoint Document(&DocumentSummaryInformation8jodconverter-2.2.2/src/test/resources/hello.rtf000066400000000000000000000022651124733227500216340ustar00rootroot00000000000000{\rtf1\ansi\deff1\adeflang1025 {\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\froman\fprq2\fcharset0 Times New Roman;}{\f3\fnil\fprq2\fcharset0 Tahoma;}} {\colortbl;\red0\green0\blue0;\red128\green128\blue128;} {\stylesheet{\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs24\lang255\ltrch\dbch\af3\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033\snext1 Normal;} } {\info{\creatim\yr2005\mo5\dy3\hr15\min40}{\revtim\yr1601\mo1\dy1\hr0\min0}{\printim\yr1601\mo1\dy1\hr0\min0}{\comment StarWriter}{\vern6800}}\deftab709 {\*\pgdsctbl {\pgdsc0\pgdscuse195\pgwsxn11905\pghsxn16837\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Standard;}} {\*\pgdscno0}\paperh16837\paperw11905\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\pgwsxn11905\pghsxn16837\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ql\rtlch\af3\afs24\lang255\ltrch\dbch\af3\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Hello from a RTF Document!} \par }jodconverter-2.2.2/src/test/resources/hello.sxc000066400000000000000000000131241124733227500216320ustar00rootroot00000000000000PKu2Emimetypeapplication/vnd.sun.xml.calcPKu2Configurations2/PKu2 Pictures/PKu2 content.xmlݖKo0 (5HS ZUX$ͷ%3`ԏԟEgu.Egrd&LQqK p!!^r@ e NreBT  Ldӏ+xVg&PyjRQPi.4ef׿PKǷ PKu2 styles.xmlXێ6}WZHʔuvm-Zi"+MQ2(w'-iK𮆇Ù3Ùng G 3S]݋!xL,#oR3Vj6jcwAr/199XDQs6ݓxpr o6OByaR6.THrr 8V詜'A$8#HQC"/FBQK0sw3p |+g u/T&e2X;{K"  bkNiW3,:u2Ӊlƥ85u+u2"LiP#R@"\킅LmVJy+TLB0W2̌Iyjc+e0 8~iZj"^G6C:<'[[\ioUj4sOa!aj_Jr"9h@gB4tTݿGN$HQ`@S[ӏcGcم2ju ^i;XNr$$媙e*>Ʃ-8 C̞ue,%Ҕ#5~\~k2%u\̚yO o~ná7%MnDBJPSTÚXFW#on `:[Ux-7ز/>>Yz ׿`%Ë9gak[HFΆvi w(| FvNǟglk%,: v: \rk$(7RBMNt)x=)C JE(m&m,U;C%3 K\J=Ev|h2"\Wf*W\=+GUtv/(aj_$~ K}ݼCnX Toqug+` 9).=6dVM~W@<>>nIʋ_8H"U3H_kW܃N.IȮLzOh\r1IXXpۊor={fqHڅW OpenOffice.org/1.9.95$Linux OpenOffice.org_project/680m95$Build-8900Mirko Nasato2005-05-03T14:25:36Mirko Nasato2005-05-03T15:40:33en-US3PT29SPKu2Thumbnails/thumbnail.png sb``p ҥ@ H}WV```Jtq ż j߳6%縧H$1ݞ~;e&yg}.gqbos}3nO?9_CZb̹o?u;۷znk?We~{O=1kKU\] O(-1qXD~#wnޯ5WMî>-ms-{+ݹx1zn_]S_K/w_]-bRɚqAU_, IeSBPK4']PKu2 settings.xmlYs8WxJ8x 7ZH$ɯ_aT˜WmM.@ut"{s8Bih$^(9}zB<}"|Ov',oP!3U$ʦi+ E>Ip)h6u-Qj.@)}GŒOoo=];:+3a1{`2&ʦ>ođ HY74COb7!E ǧ[;Mǟ Gć 5d- [`$Lο_49@(X~f8e=ʑ+T*yKHP)F8e[ovE/X:kw7dĂ{1~|OQz d[InFnJ,UZioU:)On {ShumcѡaFUOۆʗvD͵6Icm2mZOFhy!'5ælw͸kf0n05yw<\^*x%;whLKXor;#J<}RU$냦d\Y\GV`v0ѝ>EqvI.*.(Cv `kҤa "D@nOȈ x":J̡y$&|&/W 0ދG[(10W.5 AEoʈVuL-2PKUkX[PKu2META-INF/manifest.xmln0 "1piIP;-4j\olR^zˏَTYq&ڥ0#tWޒX̟fϫ2ޮE)([}) Axr0dݔl%>h#@@w$s!f,ʅ6"ѯd4c!q c)!bʍJ)5Zq.u2&ZY 'EkmR@A2Fllې0y4y?5ۆ£Ӊ1ޯn8>mnP7R?~,;)crޕC~,1| pPK3߶#PKu2EmimetypePKu2BConfigurations2/PKu2 pPictures/PKu2Ƿ content.xmlPKu2< styles.xmlPKu2vvmeta.xmlPKu24'] Thumbnails/thumbnail.pngPKu2UkX[ 1settings.xmlPKu23߶#META-INF/manifest.xmlPK )jodconverter-2.2.2/src/test/resources/hello.sxi000066400000000000000000000201211124733227500216330ustar00rootroot00000000000000PKt2Xmimetypeapplication/vnd.sun.xml.impressPKt2Configurations2/PKt2 Pictures/PKt2 content.xmlXr8SL0qllM!IUv*5%DKqodZ?8._9$ը~+EE8[q8=R^%y2f2H9lVHY΢S:JAdfB%i?^#,\7ًVF3kkgm{ jX|z݆ۡF4}@Η7JIu~WւjTFb%xaYl%Y, ~H<I=3@1&NtDT5bav&N LJ]PEѻ8~ eb'p{У辄E[A$-x OM88D_UU ;p\sځyp@X%kUЅ_ 6"٨әmKl*Ug!HeV'Y)zS*#p=%W wrMa̵kge7w0h};ྐW^ۅUD]Me /kk"JQ;NeQHBV^z-[ TnHZY{zR!Syũu@Q@J-4͈zw?(pA~{Q8 J%Lo-Tq3`H;YA3ٚEab=3HH \8at稦2`ܣӉY !ǼTCb Tъ1nUrA@ t w,0hFIC^]K *;7f(P'6 ,g؞ŊSH]aHxWll%6,_?4>O/\Cw5vQ#*k)Zl1p!eM]Krﮣ?_I :/|kv5+_k9E'f`ų\UhNMg0Z~@kk*n0=,+vn*w5 ~x-M# G:kxhoA@D(ȵ /L)r 1kWNjÁj~o4-ATR7X1D1AM0[ }K$L 3a?/~ ;ȶ륋vqx?HM* I;У06410=iw7fX0P+v;lwOPK=͍PKt2 styles.xml]KܸW4:V?x \ @lݭ$ zzfOr!/$ER[; VQ*V#ч_`'PG.h4Or} G}LI+N|,^iqěTl5Su<;ރCg% 3Zl!ؽ)CoH}8ԃ8 q|D~Q 9܂/'\ ; o34(3e>\dXE0*ʘS 2ROsaHwYe2gȳN-=}hŒ'q2a~`]yxA&m@ק6Awө`%|Ȉ&$3ƈfFÄRP 6~Lai1CNu$4K|7x Q mg?05/)T7(H)V y䠰n. ,ˆg b7+>LNB؜_Oӄ8b?s!@Q\,J_AӦm{&,Y~5$7v0d{DA/ǭpС \AHTt"UŢq ~ N jxupZXIkM?.jq VG[C7*,XwK~,a9wtR VjѮm AAW< 1)Bq\wa#VV `3:F&YFt-RZ*nB{ J 4řRWN|$ :˄lHK7 \z[wr0М5|}XYnvkG'༙X晎85dP$`>ܽ/$YǛ:uڃ&ܗZ47!iJܭ̷?-l@Q京A3 Z3?Mv%ܦCt5\P=VKڐ#0GYe19 xF i:BkH<ܭiۧ|hgoC??M}롕_'iSg?W!\?~X/~ZZ(؞W\5fcQx7kEg?T~ʀ4%t[ -?suxk^_h٧0۸'*=(0b;k!~|ϫK/1K/1yg[ 7U=`q(B-bw=΋,Lj٤]9zyMfuvC.ޥ E=3KuV!|, o {OI8'ᜄsI8'ᜄsr|G/#/m>6v;=ϢhޭJ W܈׎ P{UB}rQ߯rPJAgUi9&vVѹS{hNC#tQ p{^>ޫGd`}[v{ۭz~[=b[VתrFn-E#hoќqBt={rXi)=1\Ȼ1=bJ#A/fH#A1H#ALY#6!PY]ƌ>)/`in;]8>.1%૯w.H4(ѠD J4(ѠD/hF:>ȥu)0{YU LWX 震t O]5`{{rY]]Ǯwss"ԻӂZPohDxrD<'B=CO{9zY|g-}1y- xD TUiL'<Y畴yjcTkXZ=FwRSǟ:ن5:ƨvN'a֙aFǨ1F=`yL:;Ƥsl"=Q1.ϱL=Q1:Xy<ƨ~uZӏ2,Q37Fp{PHdR#+dOB|O%{ޮ>c_O?ҍmJ-ħ$E[SEys7Qs24gJYüLBL@LT{iv&n!Bs&%6ҀGcgWV@QM|+tL.tJ0a8a% _~=.+J {٩qY}lt. OpenOffice.org/1.9.95$Linux OpenOffice.org_project/680m95$Build-8900Mirko Nasato2005-05-03T14:26:41Mirko Nasato2005-05-03T15:39:02en-US3PT54SPKt2Thumbnails/thumbnail.png sb``p  H.x1bD.rӌYR;9k3jcs]5 &U(ϨwzS]Զ?f{n͟mf4/כ?pAƒl;vTlmy7-:fɁG}ϐ3Ͽ{gݧgOo۶틥sbſ+cB F _a=kE=:&PK6PKt2 settings.xmlZKs8H6$*aʼ20&la4ȒKc_LBL&c@aӭ67_6>x#JnB2. qwk\R.ȁ:q($r;"& SE˲ݵ߰_(G1m\.4`K@~5aCyl+;JWGjp[#dBGByE8`ڜC@ z? hcw{Ǽ`ஃ7;%!}‹mxF0zq-q 8,m F5W,]n@ށK~U >AX%K++3=D*Q_^".@qöFmHL.⢐w mR 1K9̂bm> R`aF#`"\Adq3=-CGKʇH2={@\ #*t@>j{G@# `ml!l.)/iᢽ?:`+c|_W5)Uӟm:Yz2E Hӡ?9TBvib^1d:ʃ\Q&bҠ q,bkjJ r|mRν&&yNdHfuAv`g-DN:4K榔 .An KB:u .Ϥfͽtv*m^ 9Gښ6G 5J¾fPZGLJLdӌT钾Gnv[s2@ A˸=/QP`Uc5Ə9 eZHCE~I\Y?p}\JVS: Z 5L9>c X BuVq-cdfŰeo^rs!60r8TjfbAr.  6?ނɣ7-?#m qm09Ķ`amgӕ_w-k67uR_[i/!mkx[r},,0)q!l}v0v$Nla3l@$z6 e_%(4쯳b/.i k۵)n돹{>fQYb~5EQɺjΦUVx~Z7-ZWP,!9]bgR_PK [$PKt2META-INF/manifest.xmln0 {iBQ&Mr1n)ME&腩7'߿%/Vڈ#^76 5e -ziln#jeuA} v׏qnBg$DLD|u9gb9\e PKH{=%PKt2XmimetypePKt2EConfigurations2/PKt2 sPictures/PKt2=͍ content.xmlPKt2O  styles.xmlPKt2L))&meta.xmlPKt26uThumbnails/thumbnail.pngPKt2 [$ settings.xmlPKt2H{=%META-INF/manifest.xmlPK &jodconverter-2.2.2/src/test/resources/hello.sxw000066400000000000000000000132131124733227500216550ustar00rootroot00000000000000PK u219mimetypeapplication/vnd.sun.xml.writerPK u2Configurations2/PK u2 Pictures/PK u2 content.xmlMs0A!Pp.L;L3 IMeɕd FgWwWHfR,h*$LɟsSAW!pf`N}݉-sMUvxaDSn;/[-ygJᒻ)ضmQ\N~Nƶ9A$ʹ)@3]\~m)OnPKe;.RPK u2 styles.xmlY=6+4$DRwv$tr"gϸHPD ~dcTą=>,v KG"|(X. w?<, ٦" 5R\mqZ0%nh)!\EQA=Ξ[kgЀoT, }:;7M}$d.//xkmx$ $4 #&*qxx0=[1.3&I|b, ]z!wiGȭ`}xE _"i9A! ~ o@i>QLxmc~FB@TFCa6C=a_Kl:&w\Zc 1D"ӰT^ʊ'rO`Q7%AfxzKP_N.ՙq3Re %-M-+၂$)0ȴ^F3PY| _+5lBM@ U0\*ƿ$4qR"-D禃3greDXbX) ezpߓ Mϯ^KͿ[QiW{c V{eY5 j<ᵩ&SK^IfuKdn-ysKd_nlnLGl.Ŭr]#י>~Nfw]OxxsXb/yd?FO0t#9=?:J. gp6,."ҩR-3%7 OpenOffice.org/1.9.95$Linux OpenOffice.org_project/680m95$Build-8900Mirko Nasato2005-05-03T14:23:39Mirko Nasato2005-05-03T15:41:00en-US3PT36SPK u2Thumbnails/thumbnail.png sb``p ҅@ HZ4G100tq ŮC"뻇 8]\rCV/MtsZxAFW$͏գ%ׯoͮY??sW{*zI17;V߯zvv"գ|~rYS҂Q j^<9ftsYPK\PK u2 settings.xmlYYs8~_u+L6̕!!ojYrIr mJ82Ubח>;H ^ .>dm{{1Qp}@kQ8WwLk0|yJȩ3MX~Ϭ3m0 lP(Z|NKB/7;Yҵ%j/bu~w!$=$3q:S4]Q0)]gpsn= Mgs7dLmH&(R0ᙢ$Q%)B/! ahK.0䊟<^[[UZ"s3ňǹourQ7{U$F=wLǠCI%^6HH< h8ZY3!p]@ko$=7?Uzr\Y~ $XK(mI:i`ĉr3d SnCTfa;$K+t}JfF2h,<_:g$K Zz&1$^$6E|"tϡhs2A؎2H* ê!iI1 a(.E8rq(hdQJ,0Q cx{ ߆I-Hey9S5iJvϢ}zø-Y*+ǚ9yohP/s`4xOc}-^{x]3Izw>3ȘD_:5#۰g|[PGcr6*0WPhP2I\Z~z=rG0- n]碽ΪA{Vf(됁ϚoUM{82BpYI6*8 Ȩ zGę ,B]9'@X]B49?|FLp6yL4o䑉1aMQ ߷\[wtIV%6y*Ʀ0#dжJa$O?We]ZY]RiR@qd7esWJwqF\H\@oX m {f7El\h4.(B"PBb*J(ѹ5l!CkeL*fpyT$N>$GeRW϶ {[s)ܫ1cju ٚXDz}[YM@jh|؏%8篝PKF\%PK u219mimetypePK u2DConfigurations2/PK u2 rPictures/PK u2e;.R content.xmlPK u2x$o]XH $styles.xmlPK u2_ ;meta.xmlPK u2\ Thumbnails/thumbnail.pngPK u205 settings.xmlPK u2F\%META-INF/manifest.xmlPK `jodconverter-2.2.2/src/test/resources/hello.xls000066400000000000000000000150001124733227500216360ustar00rootroot00000000000000ࡱ;   Root Entry  !"#$%&'(*-./01  \pCalc Ba=@=@ 8"1Arial1Arial1Arial1Arial GENERAL                + ) , *  `Sheet1Sheet2bSheet3,,jb( 3  @@  4)Hello from a Microsoft Excel Spreadsheet! z   dMbP?_%*+$!&C&"Times New Roman,Regular"&12&A)&&C&"Times New Roman,Regular"&12Page &P&333333?'333333?(-؂-?)-؂-?" d,,333333?333333?U }   PH0(  >@   dMbP?_%*+$!&C&"Times New Roman,Regular"&12&A)&&C&"Times New Roman,Regular"&12Page &P&333333?'333333?(-؂-?)-؂-?" d,,333333?333333?U }  PH 0(  >@   dMbP?_%*+$!&C&"Times New Roman,Regular"&12&A)&&C&"Times New Roman,Regular"&12Page &P&333333?'333333?(-؂-?)-؂-?" d,,333333?333333?U }  PH0 0(   >@  FMicrosoft Excel 97-TabelleBiff8Oh+'0  p x 2@! @|J@O@HO Mirko Nasato Mirko NasatoRoot EntryF Workbook& CompObj)IOle +SummaryInformation(,Pjodconverter-2.2.2/src/test/resources/invalid.odt000066400000000000000000000135321124733227500221510ustar00rootroot00000000000000PKt2^2 ''mimetypeapplication/invalid.opendocument.textPKt2Configurations2/PKt2 Pictures/PKt2 content.xmlVM0W9f KKJUJK+uԫةdwZx潙ɛáɞ*ͤd&T`IWp>,0KawbBgDLLTYY\͑G=6`b;M|fBm,a}z)cA)U {QŁ37OwmND-- ]ՍE0d&3xVԠ_h U ^uUߎHwHEφ;'흓>Bf7ғ{Nẑbs9@*XK)R!\P_ts^zp|ǝzK4Atƴ|'!zz;Z LhS{8/ S@(XI8&+Q1~9.lns*fvJM~HP-`$x*fۭN8Qcl0qzn$9vҋ_k۫ ژxadcv۹yj/wushlRro >?mQϛ<juxA >a'HF9Ii cWS$8SQPK xhPKt2 styles.xmlY͎6) 퍖Mҵzjzh%bCI<}gHQl+4mqp}TŁiÕ|J*Y0So1{U,ާfIzM* L-4ҹP7$zPK/jٌ8쯤& <.C1El[S[]c\X;JUy3{^;WJPPwZIHxSe:RoT}U=4R 4M] УJ9#˅y~//oSV84j.^"`pCQTsIkEX?3mL/{}giԝk}[(XI[ใ״x7i4S[豻mME u$0KNOjɔLhT'I4Щ@M/Us^N"`Gn+o  "' cCxWz9;(tuc6Hh!Z`.4 ,x#dPiuؽ:MkAbU]\ =zE<"ÿlX&ܷtKL\j×O^Fer92$ הh`+^{߱pH9P}T/M$\lJAi p-Vܶna@HC GPbl~ 'cL:tW: L4.dϤkA5$b 3KrIp Z_(5TY:GNid< 0pC W70xVWb՞ gY<[z~RP]$W[@(<8&=TTk}1Fkf! &8HT^46[$;7nZwNqS\o׻;˝zS\;ŕ`cQV* \IJV z HwJY= S*ZD-CC)ʭ{bi.xpC#CwBOk432 d=Ao6axNdȂ`d\}6ÞûcZ@uGCSgɄl$G^Gj }f AK] []r?LT!x+(NY_lΖ1Itp$5=YťS0 |6VU8 GN&thiS*5Wsk8 oFqq%#{aS8ihKuG[DO7'@шg?< PK!mmjPKt2G{{meta.xml OpenOffice.org/1.9.95$Linux OpenOffice.org_project/680m95$Build-8900Mirko Nasato2005-05-03T14:23:39Mirko Nasato2005-05-03T15:38:04en-US3PT41SPKt2Thumbnails/thumbnail.png sb``p ҅@ HZ4G100tq E&-O7b2\m ϋN w?*)|_yAfCaeM1.N{qz[3^:nn6w,.wi2k8NFd1,W N)lF,:&PKIٽPKt2 settings.xmlYr8}߯Hu+L6P S6sVȒKcد߶!\yFӭ雸;H `L+gF[3өB 7KZu۹*P S%N|P%D|[,A)*r\2Y >fNJZ%oX)+MnݸX+46/߯>.= ~lpڃ"KDV3- +c3x\e>x&Lu>·NlWM:3Q( *sgvL`@Q2t2ܖ"R"(BIpq _m\t < kcҿCĻ+ӣpkL& & ]:nO?ytc!."l.dz[Ġ5j!͔ WIH{}/tr|Z hLg%Y$]TpaAEw ζzEM z%z_ް#4&Y~ AٙA3xY S 3M t !ik:EgaqvhLjuMҖBcAB=rW Qp{c{ȥ;Rĉ37mZXQ| er/!\~3)%z? 0wf/z&ut`Y/Vٖ5wJNfkQ696B?,q5 ao Y_:c& ݭF(YOqF ^wezDQzjr6&y4V~_ậq0*WtOyʥ GGW u N!YpH=s>YП̒lͤ sl(I e^ Q.M8xLoUPKhiPKt2META-INF/manifest.xml1o0 {Se T0ttK\A P6~ݓn2WƔ?M[,S^g>My^J- ޼O\5DݖR.u-3_r1EUkoB]WdTڄ oƘޱ3(l@nuBRY) w{Ep.i4mS.("Xaj,lRn5Ђօ"c8 uu1 H: ˶FmԗrlQ\SyPKbi42PKt2^2 ''mimetypePKt2MConfigurations2/PKt2 {Pictures/PKt2 xh content.xmlPKt2!mmj Cstyles.xmlPKt2G{{meta.xmlPKt2Iٽ Thumbnails/thumbnail.pngPKt2hi settings.xmlPKt2bi42META-INF/manifest.xmlPK 1jodconverter-2.2.2/src/test/resources/two-pages.odt000066400000000000000000000164121124733227500224310ustar00rootroot00000000000000PKr5^2 ''mimetypeapplication/vnd.oasis.opendocument.textPKr5Configurations2/statusbar/PKr5'Configurations2/accelerator/current.xmlPKPKr5Configurations2/floater/PKr5Configurations2/popupmenu/PKr5Configurations2/progressbar/PKr5Configurations2/menubar/PKr5Configurations2/toolbar/PKr5Configurations2/images/Bitmaps/PKr5 layout-cachecd`d(c``d``a2PKPKr5 content.xmlVn0+z'=$@@RuRJS̆"U/L'VB &wfw;|,nv5KD**xgiB8U>=ށfyveI1 ۚp &UyJ 84DCBt,![%[#;p.$bkKK)Ja^7HYyѺ n]΄:0qM+CFl095(6? Sm&24HW]U*Zj4xd6E|{/[#|0Fy?hAֱ,TX&zc7K3ݽ $Dp&#NJT n (|[5AP42vt.ϒ%W0* J (fX%c<}w%?ExК}~BP_^dxPN$5nK}5Hv"a~:R~K_mB\M%DD&i-d7>Vj6}c>oDDf0 {ada7:fIM,J%A`M }5IK;amkQYE1(%qSU C{ Zm.,,O~k&}x؇]ӭ*p>J㩧qG҉ms黎d·qF1Q9Ʊ8|\PK  PKr5 styles.xmlYK6W*-˛kw$=4i-Hʲ;$E%Q!9~3q޽=@mhf }~ cʐ9-ϔR=' 9fgrOtjI < X/H=QS7 8I I0&\Y3,%#Թ*O[5"'j|记|ʢa>)-- zBvm˕[Dޟ NNTPRr *|S2[pQlࠃ65e~15PL|~ƅnxb Nˎ1'`niFbF{X\&tkM>InjǞgkpe>>c-wo-Q*/zF$G M+s_I0tg> }zN5t vkw @.5|y _]ky{ W2Z({ބb\ sqP=7w+{( RDT'nQ_$?_ K0a:5-F|+V+Pj'm.2SX?^Ny66b% ~iQ{ ݹIyԻ4z{T4Y.+Sm $S!.(Dsiy[:[5{e$Fvc%I|ڔ,I%:";RR*[} . Z};2Oo,̿N OpenOffice.org/2.0$Linux OpenOffice.org_project/680m5$Build-9073 Mirko Nasato 2006-11-18T21:19:56 Mirko Nasato 2006-11-18T21:23:16 en-GB 3 PT41S PKr5Thumbnails/thumbnail.png sb``p ҅@ HZ4G100tq &Gzꃆ2qƜsX4iW3<-yŎoϜF% $5vdzΒ?Ϻ}棯U뾛gGe*Yre߂X>wήhnpAمG`A ?~) PKU((PKr5 settings.xmlY]s:}`Nj{&cHMC{߄ndGl`'[ޣ]-#Qz9vQJ  xnS@3 @ch.R77^d)Yi& 75_nhٕƛ7+bqh\UjWWWfhrgBe_C!>M&W+^i=7i}*m*)]*]Q27֗nڱ=+_s& Lr${d0Aic_o;_>)bڨvY[1#LTKّ{h:,6[/G;J#U!.\54kzV4N- "<5yR,K*3Qe鱃 lU,?g1Vz웑MmX-]Cަl'E[.:{uFwj7火F\80pd.oၭr/ )~&.+ mR&#Fl6`:-&\I0 4ΫP}>WY̠͂DeqcFzn+J{JyNαuePK  PKr5META-INF/manifest.xmlMn F9ަDj =$ ő6@X)H;ۈAhky+zX`uiP}F`k0 լjѶN-ןדi(.N,0J=67Z:޶U]+*.Sz]#wnS^tñzA)4.HCݕE'3RJgL6G/q'k^PSE]kj|-" TLa'8 NG\ ͎alⰵ I> +o6ӛ{nR~{rWPKOPKr5^2 ''mimetypePKr5MConfigurations2/statusbar/PKr5'Configurations2/accelerator/current.xmlPKr5Configurations2/floater/PKr5Configurations2/popupmenu/PKr5JConfigurations2/progressbar/PKr5Configurations2/menubar/PKr5Configurations2/toolbar/PKr5Configurations2/images/Bitmaps/PKr5 -layout-cachePKr5  ycontent.xmlPKr5|PW styles.xmlPKr5]|@ meta.xmlPKr5U(( Thumbnails/thumbnail.pngPKr5   ?settings.xmlPKr5O:META-INF/manifest.xmlPK(jodconverter-2.2.2/src/test/resources/unknown-type.xyz000066400000000000000000000000001124733227500232270ustar00rootroot00000000000000