diff --git a/source/COPYING.TXT b/source/COPYING.TXT new file mode 100644 index 0000000..d18617e --- /dev/null +++ b/source/COPYING.TXT @@ -0,0 +1,460 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 + + diff --git a/source/distro/COPYING.TXT b/source/distro/COPYING.TXT new file mode 100644 index 0000000..101dfa2 --- /dev/null +++ b/source/distro/COPYING.TXT @@ -0,0 +1,460 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 + + diff --git a/source/distro/History.txt b/source/distro/History.txt new file mode 100644 index 0000000..e80ec69 --- /dev/null +++ b/source/distro/History.txt @@ -0,0 +1,121 @@ +Version history for Writer2LaTeX +================================ + +Version 0.9.4 (February 2009) + -Filters: + - Changed to oxt format and separated into Writer2LaTeX and Writer2xhtml extensions + - Added (localized) dialogs to the filters + - LaTeX: + - Export vector graphics to pdf for use with pdfTeX. + - Support equations generated by OOoLaTeX. + - XHTML: + - Improved navigation features for splitted documents + - Do not export hidden or filtered rows and columns. Apply print ranges. + - Improved batch conversion + - General: + - Export images to a subdirectory. + +Version 0.5 (June 2007) + - LaTeX: + - support fancyhdr.sty + - support geometry.sty + - support supertabular.sty + - support tabulary.sty + - support colortbl.sty + - support l, c, r columns in tables + - support floating figures and tables + - some graphics improvements + - custom tabstop handling + - flexible handling of notes (ignore, comment, marginpar, pdf annotation) + - string replace (eg. LaTeX -> \LaTeX) + - XHTML: + - convert an entire directory with index page(s) + - convert using a template document + - support html forms + - custom tabstop handling + - support continued lists + - improved export of table formatting + - support background images + - improved table of contents + - General: + - support OpenDocument + - now installable as uno package (extension) + - no longer using the XMerge framework + +Version 0.4 (July 2005) + - LaTeX: + - improved readability of output (wrap long lines, do not include unused + labels and hypertargets) + - support for more languages + - writer.sty is replaced by the optional package ooomath.sty + - color.sty is now optional + - new options to ignore hard page and line breaks + - new option to ignore double spaces + - new option to specify that the document is *not* multilingual + - support for cp1251 (Windows cyrillic) and latin2 inputenc + - improved style maps for paragraphs (avoid line break, verbatim content) + - cleaned up configuration of formatting + - improved export of list formatting + - support for other documentclasses than article + - support for lastpage.sty + - support for eurosym.sty + - support for tipa.sty + - support for various 8-bit fonts: Wingdings, Windows Symbol + - support for OpenSymbol + - XHTML: + - converts units to px (default) + - Calc2xhtml added + - improved support for table formatting; table formatting is now always + exported + - (partial) bidi support + - support for sections (margins and background color) + - new option to scale column widths + - new options to ignore double spaces, hard line breaks and empty paragraphs + - General + - Added ant build file (provided by Michael Niedermair) + - Now possible to specify output path+file name on command line + - removed usage of document specific configuration files (*-config.xml) + - new option to create user configuration automatically + +Version 0.3.2 (February 2004) + - LaTeX: + - support for custom math symbols (%symbol) + - improved handling of paragraph formatting + - support for table borders + - support for alphabetical index + - support for pdf meta data + - XHTML: + - support for three different XHTML variants + - long documents can be split in several XHTML documents + - support for custom style sheets + - more flexible handling of fomatting + - support for most XHTML elements (including blockquote, dl, hr) + - support for alphabetical index + - support for meta data + +Version 0.3 (October 2003) + - support for BibTeX + - support for greek and russian text + - support for more languages + - support for latin1, cp1250, iso-8859-7, koi8-r and utf8 (Dominique + Unruh's ucs.sty) inputencodings + - support for symbol fonts: pifont.sty, wasysym.sty, ifsym.sty and + bbding.sty + - support for ulem.sty (underline/cross out) + - export of footnotes configuration, list label styles, heading + styles and hard paragraph formatting can be disabled + - custom export of list styles + - bugfixes + +Version 0.2 (March 2003) + - support for tables + - support for graphics + - support for outline numbering and list styles + - support for page styles + - support for sections (columns) + - custom export of text and paragraph styles + - integration with xmerge (enables use as export filter) + - export to XHTML + MathML + +Version 0.1 (September 2002) + - first simple version \ No newline at end of file diff --git a/source/distro/Readme.txt b/source/distro/Readme.txt new file mode 100644 index 0000000..f87afdd --- /dev/null +++ b/source/distro/Readme.txt @@ -0,0 +1,18 @@ +Writer2LaTeX version 0.9.4 +========================== + +This is the distribution of Writer2LaTeX version 0.9.4 + +Latest version can be found at the web site + http://writer2latex.sourceforge.net + +You can read about installation and usage of Writer2LaTeX +in the user guide, which is included in the +directory doc. + +Bugs and feature requests should be reported to + henrikjust (at) openoffice.org + + +February 2009 +Henrik Just diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt new file mode 100644 index 0000000..25b4bcf --- /dev/null +++ b/source/distro/changelog.txt @@ -0,0 +1,325 @@ +Changelog for Writer2LaTeX version 0.5 -> 1.0 + +---------- version 1.0 beta ---------- + +[w2l] Bugfix: Fixed crash for tables with fewer columns than rows + +---------- version 0.9.4 ----------- + +[w2l] Added sample LaTeX configuration for Google Docs from Elefterios Stamatogiannakis + +[w2x] Added MathML named entites table from Bruno Mascret + +[all] Bugfix: Locked controls are now updated correctly when the dialog is displayed + +[w2l] New backed xetex (initial prototype) + +[c2x] Bugfix: Corrected wrong calculation of column number for columns with two letters + (affected apply_print_ranges=true) + +[c2x] Bugfix: Ensure that we always export a document, even if there are no defined + print ranges (affected apply_print_ranges=true) + +[c2x] Bugfix: Now also exports uplink for spreadsheets + +[w2l] Bugfix: No longer incorrectly assume math mode when exporting plain text + +[all] Added support for the new Writer notes/annotations (which now can contain several + formatted paragraphs rather than a single, plain text paragraph) + +[all] Added russian and ukrainian translations from Volodymyr Volkov + +[all] Bugfix: Removed PreferredFilter propery from type definitions (makes sense + only for import filters) + +[all] Changed unix startscript: By default assume that w2l and writer2latex are + in the same directory (thus using dirname $0), and assume that the java executable + is either in the PATH or the location is defined by JAVA_HOME + (which these assumptions manual editing of the script is usually not required) + +[all] Added french translation from Jacques Lamoine + +[w2l] The option simple_table_limit now refers to the *total* width of the table + measured in characters rather than the width of individual cells + +[w2x] Bugfix: The position and dimensions of a frame is now calculated correctly + (previously the size of margins, borders and padding was not taken into account) + +[w2l] The inputencoding utf8 now uses the LaTeX standard rather than ucs.sty + (which only supports latin and cyrillic alphabets) + +[w2l] New style map family "text-attribute" to map text formatting to LaTeX code + currently only the values "bold", "italic", "small-caps", "subscript" and + "superscript" are supported, and the verbatim attribute is not supported + +---------- version 0.9.3 ----------- + +[all] All source files are now US ASCII; added encoding of source files to build file + +[all] Added more File-based methods to the API + +[w2l] The paper sizes defined by standard LaTeX document classes are now + identified and added as global options (a4paper, a5paper, b5paper, + letterpaper, legalpaper, executivepaper, including landscape variants) + +[w2x] Bugfix: Now only exports the name of a text box if it actually exists! + +[w2l] Removed option "pagecolor" from \hypersetup (this option has been removed + from the hyperref package) + +[all] Filter bugfix: The new option name "ConfigURL" is now used in the dialogs + +[all] Added (partial) german localization from Martin Friedrich + +[w2x] New option use_named_entities: When set to true, named character entities + as defined in xhtml 1.0 are used (currently only those within ISO latin 1) + +[w2x] Characters not supported by the encoding are now exported as numeric + character entities + +[w2x] Bugfix: Internal hyperlinks to tables, sections, frames and graphics now + works correctly + +[w2x] Bugfix: Subtables are no longer exported with an id attribute + +[all] Bugfix: table:number-rows-repeated is now treated correctly + +[c2x] New option: apply_print_ranges + +---------- version 0.9.2 ----------- + +[c2x] No longer exports for tables without + +[all] Renamed "class" to "family" in style maps to avoid confusion + with css classes (old name is still accepted) + +[all] Filter: Renamed template and config options to the more + descriptive TemplateURL and ConfigURL + +[all] API: Added convenience method convert(File) to Converterer + +[all] API: Added convenience method write(File) to ConverterResult + +[all] New option: save_images_in_subdir + +[all] Use Robert Harders public domain Base64 decoder (replacing + the non-standard decoder in sun.misc) + +[all] MIMETypes used in the API are now defined in writer2latex.api.MIMETypes + +[all] Renamed the option keep_image_size to original_image_size (the meaning of + this option was confusing). The old name is still recognized. + +[all] OOo now saves SVM files with a MIME type in the package format. + This is now recognized by w2l, which implies that GraphicConverter + implementations can use SVM files from a package + +[w2x] New uno service org.openoffice.da.writer2xhtml.BatchConverter + provides batch conversion via uno. Interaction with the user can be implemented + using the interface org.openoffice.da.writer2xhtml.XBatchHandler + +[w2x] Batch processing from the command line can now be cancelled (using the Enter key) + +[all] API: Created new API for batch conversion + +[w2l] Bugfix: Tables were in rare cases exported with invalid row alignment + (null character) + +[w2x] Filter ui bugfix: Default value for RepeatLevels changed from + 6 to 5 (6 was not valid) + +[w2x] Filter: The xhtml export now uses it's own custom configuration + (writer2xhtml.xml, also stored in the user configuration of OOo) + +[w2l] Tabstops are now exported as \ \ , which usually is closer to + the expectations of the user (and is not ignored at the beginning of a par.) + +[w2x] Empty paragraphs are now (again!) exported with a   + (otherwise they are ignored by the browser) + +[w2x] Xhtml specific options no longer starts with the prefix xhtml_ + (is still accepted for backwards compatibility) + +[all] Filter: Added display name and description to the extensions + +[w2x] BatchConverter: Localized alternative text for icons + +[w2b] Bugfix: Replace ";" with "and" also in in editor field + +[w2x] Added new options xslt_path to give the path to the XSL + transformation from w3c (also in the ui) + +[all] Filter: Optimized the size of the extensions by excluding code not + relevant for the format(s) supported by the extension + +[all] Separated LaTeX and xhtml code. As a consequence, it is possible to build + and run Writer2LaTeX with support for only one format + +[c2x] New options display_hiddens_rows_cols and display_filtered_rows_cols. If + set to false (default), rows and columns that are hidden or filtered are not + exported + +[all] Filter: Translated dialogs to Danish + +[all] Filter: Raised requirement in description.xml to OOo 2.2 + (needs support for localized dialogs) + +[w2l] Added ui option "Support additional symbols". This sets all the + options use_pifont, use_ifsym, use_wasysym, use_eurosym and use_tipa. + The pseudo-option additional_symbols can be used in the LockedOptions list + +[all] Bugfix: The class w2l.xmerge.DOMDocument did not throw IOException when + trying to read a non-xml document + +[w2x] Bugfix: The convert method did not restart document enumeration + (relevant if it's called several times for the same converter instance) + +[w2x] API: Created new API for batch conversion, which is also moved + from Application to a separate class + +[all] API: The API now uses a interface to the configuration rather than using + the class writer2latex.util.Config + +[w2x] Style of header/footer in index pages (batch conversion) aligned with + document header/footer + +[all] Added package descriptions to the javadoc + +[w2l] Always export non-breaking space as ~ even if inputenc supports it + directly - non-breaking spaces are usually not easy to identify in text editors + +---------- version 0.9.1 ----------- + +[w2x] New option: xhtml_add_bom (default false), if set to true + a BOM will be added at the start of generated xhtml files + +[w2x] Fixed typo in filter name: XHTML 1.0 + MathML 2.0 should be + XHTML 1.1 + MathML 2.0 + +[w2l] Added support for the latin language + +[w2l] Removed article.xml from w2l - it now belongs to Writer4LaTeX + +[all] The distribution now includes a sample configuration + package: xhtml-config-sample.oxt + +[all] Filter: Split the filter component into two extensions: + writer2latex.oxt for LaTeX and BibTeX, writer2xhtml.oxt for xhtml + The build file now produces optimized jars for each application, and the + standalone jar does not contain any uno code + +[w2l] Added (imcomplete) support for some of the Euclid fonts from Design Science + +[w2b] Replace ";" with "and" in author field (multiple authors) + +[w2l] Added support for formulas inserted by OOoLaTeX + +[w2x] Now adds mini-toc to the element with id "panel" if it exists in the xhtml + template + +[w2l] API: Added new api for standalone StarMath converter + Writer2LaTeX api: writer2latex.api.StarMathConverter + Uno service: org.openoffice.da.writer2latex.StarMathConverter + +[all] Filter: Added dialogs to all filters (w2l, w2x and c2x) + +[w2l] Vector graphics (except wmf) is now exported as pdf if backend is pdftex + +[all] API: In the GraphicConverter interface, the method + supportsFormat has been replaced with the method supportsConversion + +[w2l] Added support for *numbered* display equations: If paragraph + contains exactly one equation and exactly one sequence field (and otherwise + only whitespace and brackets), it treated as a numbered equation + +[w2l] I18n: If several characters in a row are converted using math mode, they + are now combined (ie. ${\alpha}{\beta}$ rather than ${\alpha}$${\beta}$) + +[all] Extended FilterData to support the property AutoCreate. If set to true, + the configuration file will be created if it does not exist + +[w2l] Even if formatting=IGNORE_ALL, we should still obey character style maps + from the configuration + +[w2x] Added german translation of navigation pane (w2l.util.L10n) + +[all] Bugfix: A paragraph with a bibliographic reference as the only + content was considered empty (and the reference was lost) + +[w2l] Use url decoding when creating file names for linked sections + (in order to obtain more readable file names) + +[w2l] Avoid redundant \mathit in StarMathConverter in some rare + cases (such as greek letters pasted into Math) + +[w2l] Support formulas for sequence fields (only the most common + cases oow:Name, oow:Name+Number, oow:Name-Number and oow:Number) + +[c2x] New options xhtml_display_hidden_sheets, xhtml_use_title_as_heading and + xhtml_use_sheet_names_as_headings + +[o2x] New option xhtml_notes. If true notes (annotations) are exported to xhtml + comments, if false they are ignored + +[c2x] Convert notes (annotations) + +[w2l] Heading formatting: The prefix and suffix to the counter should not be + included in \thesection, but rather in the formatting. This means that the + prefix and suffix no longer will be exported if formatting=CONVERT_BASIC + +[w2l] Added support for chapter references to reference marks and bookmarks + (if the marks are contained in a heading) + +[w2l] New option external_bibtex_files gives a list of BibTeX files. If nonempty, + these files will be used instead of converting the actual bibliography marks + +[w2l] New option metadata. If true, export metadata as \author, + \date and pdf metadata, as well as pdf metadata (if use_hyperref is true) + +[all] Filters/API: Changed filternames to the more obvious + org.openoffice.da.writer2latex etc. + +[w2l] Updated clean.xml and ultraclean.xml. Both configurations + now exports predefined Writer styles (like article.xml) + +[w2x] New option: xhtml_repeat_levels defines the number of heading + levels to repeat when splitting a file (0 means no levels are repeated) + +[w2x] Allow xhtml templates without header and footer elements + +[w2x] Bugfix (w2l.office.ListCounter): OpenDocument does not use + numberings like 1.0.1 if a list level is missing, but rather 1.1.1 + +[all] Command line application now uses internal standard configurations + (*ultraclean.xml etc.) + +[all] Command line application now accepts several configuration + files (by using the -config option more than once) + +[w2x] Use text style for label when applying numbering to heading + +[w2x] Added support for other list styes applied to headings + +[w2x] Added support for text:restart-numbering, text:is-list-header on headings + +[w2x] No longer add hr and [] to links in navigation (the template and style + sheet should take care of this) + +[all] New filter configuration concept: Configuration packages containing an OOo + template, a w2l configuration and registry information to bind these together: + When a configuration package is installed in OOo, the configuration is added + to the filter ui, and is preselected for documents based on the OOo template + +[all] Repackaging: Distribution files are included in source, build + file is extended to create the distribution; source distribution is separated + +[all] Changed to new extension format (.oxt) + +[all] Filter: Added messagebox to display the error in case an + exception happens during conversion + +[all] Moved default configurations to jar; the FilterData property + can refer to these using the special url *filename.xml + +[all] The filter now reads the FilterData property, which can be + used to specify options, configuration fil (url) and xhtml template (url) \ No newline at end of file diff --git a/source/distro/doc/user-manual.odt b/source/distro/doc/user-manual.odt new file mode 100644 index 0000000..2efa35c Binary files /dev/null and b/source/distro/doc/user-manual.odt differ diff --git a/source/distro/doc/w2llogo.png b/source/distro/doc/w2llogo.png new file mode 100644 index 0000000..990bc7c Binary files /dev/null and b/source/distro/doc/w2llogo.png differ diff --git a/source/distro/latex/obsolete/writer.sty b/source/distro/latex/obsolete/writer.sty new file mode 100644 index 0000000..ed8e7cd --- /dev/null +++ b/source/distro/latex/obsolete/writer.sty @@ -0,0 +1,83 @@ +%% File: ooomath.sty, Copyright (C) 2002-2004 Henrik Just +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.2 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{ooomath}[2004/08/08 v1.0 - stylefile used by Writer2LaTeX] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Some math mode macros defining additional symbols +% \ddotsup is taken from "The comprehensive LaTeX symbol list" +\newcommand\defeq{\stackrel{\mathrm{def}}{=}} +\newcommand\lambdabar{\mathchar'26\mkern-10mu\lambda} +\newcommand\ddotsup{\mathinner{\mkern1mu\raise\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu\raise4\p@\hbox{.}\mkern2mu\raise7\p@ +\hbox{.}\mkern1mu}} +% Fallback definitions for math mode macros defined in other packages +\providecommand\multimapdotbothA{\bullet\kern-0.4em-\kern-0.4em\circ} +\providecommand\multimapdotbothB{\circ\kern-0.4em-\kern-0.4em\bullet} +\providecommand\oiint{\oint} % should be area integral... +\providecommand\oiiint{\oint} % should be volume integral... +\providecommand\llbracket{[} % should be double... +\providecommand\rrbracket{]} % should be double... +% More math mode macros +\newcommand\wideslash[2]{{}^{#1}/_{#2}} % too small +\newcommand\widebslash[2]{{}_{#1}\backslash^{#2}} % too small +\newcommand\normalsubformula[1]{\text{$#1$}} +\newcommand\boldsubformula[1]{\text{\mathversion{bold}$#1$}} +% Multiscripts, based on leftidx.sty by Harald Harders +\newlength{\idxmathdepth} +\newlength{\idxmathtotal} +\newlength{\idxmathwidth} +\newlength{\idxraiseme} +% +\newcommand{\idxdheight}[1]{% +\protect\settoheight{\idxmathtotal}{\(\displaystyle#1\)}% +\protect\settodepth{\idxmathdepth}{\(\displaystyle#1\)}% +\protect\settowidth{\idxmathwidth}{\(\displaystyle#1\)}% +\protect\addtolength{\idxmathtotal}{\idxmathdepth}% +\protect\setlength{\idxraiseme}{\idxmathtotal/2-\idxmathdepth}} +\newcommand{\idxtheight}[1]{% +\protect\settoheight{\idxmathtotal}{\(\textstyle #1\)}% +\protect\settodepth{\idxmathdepth}{\(\textstyle #1\)}% +\protect\settowidth{\idxmathwidth}{\(\textstyle#1\)}% +\protect\addtolength{\idxmathtotal}{\idxmathdepth}% +\protect\setlength{\idxraiseme}{\idxmathtotal/2-\idxmathdepth}} +\newcommand{\idxsheight}[1]{% +\protect\settoheight{\idxmathtotal}{\(\scriptstyle #1\)}% +\protect\settodepth{\idxmathdepth}{\(\scriptstyle #1\)}% +\protect\settowidth{\idxmathwidth}{\(\scriptstyle#1\)}% +\protect\addtolength{\idxmathtotal}{\idxmathdepth}% +\protect\setlength{\idxraiseme}{\idxmathtotal/2-\idxmathdepth}} +\newcommand{\idxssheight}[1]{% +\protect\settoheight{\idxmathtotal}{\(\scriptscriptstyle #1\)}% +\protect\settodepth{\idxmathdepth}{\(\scriptscriptstyle #1\)}% +\protect\settowidth{\idxmathwidth}{\(\scriptscriptstyle#1\)}% +\protect\addtolength{\idxmathtotal}{\idxmathdepth}% +\protect\setlength{\idxraiseme}{\idxmathtotal/2-\idxmathdepth}} +% \multiscripts{}{}{}{}{} +\newcommand\multiscripts[5]{% +\mathchoice% +{\idxdheight{#4}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#1\underset{#2} +{\overset{#3}{#4}}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#5}% +{\idxtheight{#4}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#1\underset{#2} +{\overset{#3}{#4}}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#5}% +{\idxsheight{#4}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#1\underset{#2} +{\overset{#3}{#4}}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#5}% +{\idxssheight{#4}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#1\underset{#2} +{\overset{#3}{#4}}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#5} +}% +\newcommand\mathoverstrike[1]{% +\mathchoice% +{\idxdheight{#1}\rlap{\rule[\idxraiseme]{\idxmathwidth}{0.4pt}}{#1}}% +{\idxtheight{#1}\rlap{\rule[\idxraiseme]{\idxmathwidth}{0.4pt}}{#1}}% +{\idxsheight{#1}\rlap{\rule[\idxraiseme]{\idxmathwidth}{0.4pt}}{#1}}% +{\idxssheight{#1}\rlap{\rule[\idxraiseme]{\idxmathwidth}{0.4pt}}{#1}}% +} +\endinput + diff --git a/source/distro/latex/ooomath.sty b/source/distro/latex/ooomath.sty new file mode 100644 index 0000000..9944903 --- /dev/null +++ b/source/distro/latex/ooomath.sty @@ -0,0 +1,83 @@ +%% File: ooomath.sty, Copyright (C) 2002-2004 Henrik Just +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.2 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{ooomath}[2004/12/27 v1.01 - stylefile used by Writer2LaTeX] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Some math mode macros defining additional symbols +% \ddotsup is taken from "The comprehensive LaTeX symbol list" +\newcommand\defeq{\stackrel{\mathrm{def}}{=}} +\newcommand\lambdabar{\mathchar'26\mkern-10mu\lambda} +\newcommand\ddotsup{\mathinner{\mkern1mu\raise\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu\raise4\p@\hbox{.}\mkern2mu\raise7\p@ +\hbox{.}\mkern1mu}} +% Fallback definitions for math mode macros defined in other packages +\providecommand\multimapdotbothA{\bullet\kern-0.4em-\kern-0.4em\circ} +\providecommand\multimapdotbothB{\circ\kern-0.4em-\kern-0.4em\bullet} +\providecommand\oiint{\oint} % should be area integral... +\providecommand\oiiint{\oint} % should be volume integral... +\providecommand\llbracket{[} % should be double... +\providecommand\rrbracket{]} % should be double... +% More math mode macros +\newcommand\wideslash[2]{{}^{#1}/_{#2}} % too small +\newcommand\widebslash[2]{{}_{#1}\backslash^{#2}} % too small +\newcommand\normalsubformula[1]{\text{\mathversion{normal}$#1$}} +\newcommand\boldsubformula[1]{\text{\mathversion{bold}$#1$}} +% Multiscripts, based on leftidx.sty by Harald Harders +\newlength{\idxmathdepth} +\newlength{\idxmathtotal} +\newlength{\idxmathwidth} +\newlength{\idxraiseme} +% +\newcommand{\idxdheight}[1]{% +\protect\settoheight{\idxmathtotal}{\(\displaystyle#1\)}% +\protect\settodepth{\idxmathdepth}{\(\displaystyle#1\)}% +\protect\settowidth{\idxmathwidth}{\(\displaystyle#1\)}% +\protect\addtolength{\idxmathtotal}{\idxmathdepth}% +\protect\setlength{\idxraiseme}{\idxmathtotal/2-\idxmathdepth}} +\newcommand{\idxtheight}[1]{% +\protect\settoheight{\idxmathtotal}{\(\textstyle #1\)}% +\protect\settodepth{\idxmathdepth}{\(\textstyle #1\)}% +\protect\settowidth{\idxmathwidth}{\(\textstyle#1\)}% +\protect\addtolength{\idxmathtotal}{\idxmathdepth}% +\protect\setlength{\idxraiseme}{\idxmathtotal/2-\idxmathdepth}} +\newcommand{\idxsheight}[1]{% +\protect\settoheight{\idxmathtotal}{\(\scriptstyle #1\)}% +\protect\settodepth{\idxmathdepth}{\(\scriptstyle #1\)}% +\protect\settowidth{\idxmathwidth}{\(\scriptstyle#1\)}% +\protect\addtolength{\idxmathtotal}{\idxmathdepth}% +\protect\setlength{\idxraiseme}{\idxmathtotal/2-\idxmathdepth}} +\newcommand{\idxssheight}[1]{% +\protect\settoheight{\idxmathtotal}{\(\scriptscriptstyle #1\)}% +\protect\settodepth{\idxmathdepth}{\(\scriptscriptstyle #1\)}% +\protect\settowidth{\idxmathwidth}{\(\scriptscriptstyle#1\)}% +\protect\addtolength{\idxmathtotal}{\idxmathdepth}% +\protect\setlength{\idxraiseme}{\idxmathtotal/2-\idxmathdepth}} +% \multiscripts{}{}{}{}{} +\newcommand\multiscripts[5]{% +\mathchoice% +{\idxdheight{#4}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#1\underset{#2} +{\overset{#3}{#4}}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#5}% +{\idxtheight{#4}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#1\underset{#2} +{\overset{#3}{#4}}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#5}% +{\idxsheight{#4}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#1\underset{#2} +{\overset{#3}{#4}}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#5}% +{\idxssheight{#4}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#1\underset{#2} +{\overset{#3}{#4}}\rule[-\idxmathdepth]{0mm}{\idxmathtotal}#5} +}% +\newcommand\mathoverstrike[1]{% +\mathchoice% +{\idxdheight{#1}\rlap{\rule[\idxraiseme]{\idxmathwidth}{0.4pt}}{#1}}% +{\idxtheight{#1}\rlap{\rule[\idxraiseme]{\idxmathwidth}{0.4pt}}{#1}}% +{\idxsheight{#1}\rlap{\rule[\idxraiseme]{\idxmathwidth}{0.4pt}}{#1}}% +{\idxssheight{#1}\rlap{\rule[\idxraiseme]{\idxmathwidth}{0.4pt}}{#1}}% +} +\endinput + diff --git a/source/distro/samples/config/google-docs-config.xml b/source/distro/samples/config/google-docs-config.xml new file mode 100644 index 0000000..f509a70 --- /dev/null +++ b/source/distro/samples/config/google-docs-config.xml @@ -0,0 +1,113 @@ + + + + + + + diff --git a/source/distro/samples/xhtml/sample-xhtml.odt b/source/distro/samples/xhtml/sample-xhtml.odt new file mode 100644 index 0000000..72a2be1 Binary files /dev/null and b/source/distro/samples/xhtml/sample-xhtml.odt differ diff --git a/source/distro/w2l b/source/distro/w2l new file mode 100644 index 0000000..43713be --- /dev/null +++ b/source/distro/w2l @@ -0,0 +1,22 @@ +# *Very* simple script to run Writer2LaTeX (unix version) +# Created by Henrik Just, october 2003 +# Modified december 2003 as suggested by Juan Julian Merelo Guervos +# Modified may 2004 as suggested by J. Wolfgang Kaltz +# Last modified december 2008 + +# If writer2latex.jar is not in the same directory as the script, please +# edit the following line to contain the full path to Writer2LaTeX: +W2LPATH=`dirname $0` + +# If the required JVM is not in your path, or the path is not set by JAVA_HOME, +# please edit the following line to contain the full path and file name +MYJAVAEXE="java" + +if [ "$JAVA_HOME" = "" ] +then +JAVAEXE="$MYJAVAEXE" +else +JAVAEXE="$JAVA_HOME/bin/java" +fi + +$JAVAEXE -jar "$W2LPATH/writer2latex.jar" "$@" \ No newline at end of file diff --git a/source/distro/w2l.bat b/source/distro/w2l.bat new file mode 100644 index 0000000..9bd4355 --- /dev/null +++ b/source/distro/w2l.bat @@ -0,0 +1,19 @@ +@echo off +rem *Very* simple batch file to run Writer2LaTeX +rem Created by Henrik Just, october 2003 +rem Modfied december 2003 as suggested by Juan Julian Merelo Guervos +rem Last modified july 2007 + +rem Please edit the following line to contain the full path to Writer2LaTeX: + +set W2LPATH="c:\writer2latex09" + +rem If the Java executable is not in your path, please edit the following +rem line to contain the full path and file name + +set JAVAEXE="java" + +%JAVAEXE% -jar %W2LPATH%\writer2latex.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 + +set W2LPATH= +set JAVAEXE= diff --git a/source/distro/xslt/pmathml.xsl b/source/distro/xslt/pmathml.xsl new file mode 100644 index 0000000..97012f1 --- /dev/null +++ b/source/distro/xslt/pmathml.xsl @@ -0,0 +1,612 @@ + + + + + + + + + + '<!--' + + + + + + + + + + + + + + + + + + + + + + + + +in mpdialog mode, we just write out some JavaScript to display +dialog to the reader asking whether they want to install MathPlayer +Depending on the response we get, we then instantiate an XSL processor +and reprocess the doc, passing $secondpass according to the +reader response. + +Using d-o-e is fairly horrible, but this code is only for IE +anyway, and we need to force HTML semantics in this case. + + +var cookieName = "MathPlayerInstall="; +function MPInstall(){ + var showDialog=true; + var c = document.cookie; + var i = c.indexOf(cookieName); + if (i >= 0) { + if ( c.substr(i + cookieName.length, 1) >= 2) { showDialog=false; } + } + if (showDialog) { + MPDialog(); + c = document.cookie; + i = c.indexOf(cookieName); + } + if (i >= 0) return c.substr(i + cookieName.length, 1); + else return null; +} + +function MPDialog() { + var vArgs=""; + var sFeatures="dialogWidth:410px;dialogHeight:190px;help:off;status:no"; + var text = ""; + text += "javascript:document.write('" + text += '<script>' + text += 'function fnClose(v) { ' + text += 'var exp = new Date();' + text += 'var thirtyDays = exp.getTime() + (30 * 24 * 60 * 60 * 1000);' + text += 'exp.setTime(thirtyDays);' + text += 'var cookieProps = ";expires=" + exp.toGMTString();' + text += 'if (document.forms[0].dontask.checked) v+=2;' + text += 'document.cookie="' + cookieName + '"+v+cookieProps;' + text += 'window.close();' + text += '}' + text += '</' + 'script>' + text += '<head><title>Install MathPlayer?</title></head>' + text += '<body bgcolor="#D4D0C8"><form>' + text += '<table cellpadding=10 style="font-family:Arial;font-size:10pt" border=0 width=100%>' + text += '<tr><td align=left>This page requires Design Science\\\'s MathPlayer&trade;.<br>' + text += 'Do you want to download and install MathPlayer?</td></tr>'; + text += '<tr><td align=center><input type="checkbox" name="dontask">' + text += 'Don\\\'t ask me again</td></tr>' + text += '<tr><td align=center><input id=yes type="button" value=" Yes "' + text += ' onClick="fnClose(1)">&nbsp;&nbsp;&nbsp;' + text += '<input type="button" value=" No " onClick="fnClose(0)"></td></tr>' + text += '</table></form>'; + text += '</body>' + text += "')" + window.showModalDialog( text , vArgs, sFeatures ); +} + +function WaitDialog() { + var vArgs=""; + var sFeatures="dialogWidth:510px;dialogHeight:150px;help:off;status:no"; + var text = ""; + text += "javascript:document.write('" + text += '<script>' + text += 'window.onload=fnLoad;' + text += 'function fnLoad() {document.forms[0].yes.focus();}' + text += 'function fnClose(v) { ' + text += 'window.returnValue=v;' + text += 'window.close();' + text += '}' + text += '</' + 'script>' + text += '<head><title>Wait for Installation?</title></head>' + text += '<body bgcolor="#D4D0C8" onload="fnLoad()"><form><' + text += 'table cellpadding=10 style="font-family:Arial;font-size:10pt" border=0 width=100%>' + text += '<tr><td align=left>Click OK once MathPlayer is installed ' + text += 'to refresh the page.<br>' + text += 'Click Cancel to view the page immediately without MathPlayer.</td></tr>'; + text += '<tr><td align=center><input id=yes type="button" ' + text += 'value=" OK " onClick="fnClose(1)">&nbsp;&nbsp;&nbsp;' + text += '<input type="button" value="Cancel" onClick="fnClose(0)"></td></tr>' + text += '</table></form>'; + text += '</body>' + text += "')" + return window.showModalDialog( text , vArgs, sFeatures ); +} + +var result = MPInstall(); + +var action = "fallthrough"; +if (result == 1 || result == 3) { + window.open("http://www.dessci.com/webmath/mathplayer"); + var wait = WaitDialog(); + if ( wait == 1) { + action = "install"; + document.location.reload(); + + } +} +if (action == "fallthrough") { +var xsl = new ActiveXObject("Microsoft.FreeThreadedXMLDOM"); +xsl.async = false; +xsl.validateOnParse = false; +xsl.load("pmathmlcss.xsl"); +var xslTemplate = new ActiveXObject("MSXML2.XSLTemplate.3.0"); +xslTemplate.stylesheet=xsl.documentElement; +var xslProc = xslTemplate.createProcessor(); +xslProc.input = document.XMLDocument; + +xslProc.transform(); +var str = xslProc.output; + +var repl = "replace"; +if (window.navigator.appVersion.match(/Windows NT 5.1/)) { repl = ""; } +var newDoc = document.open("text/html", repl); +newDoc.write(str); +document.close(); +} + + +mathplayer-dl + +techexplorer-plugin + + + + + + + + techexplorer-plugin + + + + + mathplayer-dl + + + + + + + + + + + + +IE5 hacks +This code will be ignored by an XSLT engine as a top level +element in a foreign namespace. It will be executed by an IE5XSL +engine and insert <!-- into the output stream, ie the start of a +comment. This will comment out all the XSLT code which will be copied +to the output. A similar clause below will close this comment, it is +then followed by the IE5XSL templates to be executed. +This trick is due to Jonathan Marsh of Microsoft, and used in +the stylesheet for +the XPath 2 data model draft. + + +XSLT stylesheet +MSXSL script block + +The following script block implements an extension function that +tests whether a specified ActiveX component is known to the client. +This is used below to test for the existence of MathML rendering +components. + + function isinstalled(ax) + { + try { + var ActiveX = new ActiveXObject(ax); + return "true"; + } catch (e) { + return "false"; + } +} + + +The main bulk of this stylesheet is an identity transformation so... + + + + + + + + + +XHTML elements are copied sans prefix (XHTML is default namespace +here, so these elements will still be in XHTML namespace + + + + + + + +IE's treatment of XHTML as HTML needs a little help here... + + + + + + > + + + + + + + + + + +This just ensures the mathml prefix declaration isn't copied from +the source at this stage, so that the system will use the mml prefix +coming from this stylesheet + + + + + + + +We modify the head element to add code to specify a Microsoft +"Behaviour" if the behaviour component is known to the system. +Test for MathPlayer (Design Science) +Test for Techexplorer (IBM) +Test for Microsoft. In this case we just +output a small HTML file that executes a script that will re-process +the source docuument with a different stylesheet. Doing things this +way avoids the need to xsl:import the second stylesheet, which would +very much increase the processing overhead of running this +stylesheet. +Further tests (eg for netscape/mozilla) could +be added here if necessary + + + + + + + + + + namespace="mml" implementation="#mmlFactory" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Somewhat bizarrely in an otherwise namespace aware system, +Microsoft behaviours are defined to trigger off the +prefix not the Namespace. In the code above +we associated a MathML rendering behaviour (if one was found) with the +prefix mml: so here we ensure that this is the prefix +that actually gets used in the output. + + + + + + + +Copy semantics element through in IE (so mathplayer gets to see +mathplayer annotations, otherwise use first child or a presentation annotation. + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + /> + + + + + + " + + + + + + " + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +IE5XSL stylesheet +In a rare fit of sympathy for users of +the-language-known-as-XSL-in-IE5 this file incorporates a +version of the above code designed to work in the Microsoft dialect. +This is needed otherwise users of a MathML rendering behaviour would +have to make a choice whether they wanted to use this stylesheet +(keeping their source documents conforming XHTML+MathML) or to use +the explicit Microsoft Object code, which is less portable, but would +work in at least IE5.5. + +This entire section of code, down to the end of the stylesheet is +contained within this ie5:if. Thus XSLT sees it as a top level element +from a foreign namespace and silently ignores it. IE5XSL sees it as +"if true" and so executes the code. + + +First close the comment started at the beginning. This ensures +that the bulk of the XSLT code, while being copied to the result tree +by the IE5XSL engine, will not be rendered in the browser. + +Lacking attribute value templates in +xsl:element, and the local-name() function, we resort to constructing +the start and end tags in strings in javascript, then using +no-entities attribute which is the IE5XSL equivalent of disable-output-encoding + + +'-->' + + + + + + function mpisinstalled() + { + try { + var ActiveX = new ActiveXObject("MathPlayer.Factory.1"); + return "true"; + } catch (e) { + return "false"; + } +} + + + + + + + + + + + + + + + + + + + + +'<mml:' + this.nodeName.substring(this.nodeName.indexOf(":")+1) + +' ' + this.nodeName="" + +'>' + +'</mml:' + this.nodeName.substring(this.nodeName.indexOf(":")+1) + '>' + + + + + + + +'<math>' + +'</math>' + + + + +'<mml:' + this.nodeName.substring(this.nodeName.indexOf(":")+1) + +' ' + this.nodeName="" + +'>' + +'</mml:' + this.nodeName.substring(this.nodeName.indexOf(":")+1) + '>' + + + + + + + + + + + namespace="mml" implementation="#mmlFactory" + + + + + + + + + + + + + + + + + diff --git a/source/distro/xslt/pmathmlcss.xsl b/source/distro/xslt/pmathmlcss.xsl new file mode 100644 index 0000000..27e518e --- /dev/null +++ b/source/distro/xslt/pmathmlcss.xsl @@ -0,0 +1,872 @@ + + + + + + + +Dictionary + + The following elements in the x: namespace form an +implementation of an "Operator Dictionary" for this MathML +Implementation. In the case of stretch operators, the element +specifies the symbol parts via the latin-1 equivalent character based +on the encoding in the symbol font. It is a clear "failure to comply +to the spec" that using latin 1 characters (or numeric character +references) in the latin 1 range access glyphs in teh symbol font via +font position, however most of these character parts are not in +Unicode (until 3.2), so there is no standard way to access these characters. + +{ +{ + +( +) + +[ +] + +[[ +]] + +| +|| + + + + +~ +_v_ + + +Remove these for now, as XML parser in IE6 is broken and doesn't +accept plane 1 characters. + + +Grab all of the above into a variable. + + +HTML elements + + +XHTML elements get passed straight through, sans namespace prefix. + + + + + + + + + + + + +Template for the head element copies the original content, aand in +addition adds a script element and CSS style element that implement +the core of the MathML renderer. + + + +The malign function first finds the left most item in the aligngroup, and +then modifies the left margin of each item to make them +align. (Currently only left alignment is supported.) + + + +The mrowStretch function implements stretchy brackets. It is called +repeatedly, once for each mo child,after a span corresponding to an +mrow. The arguments are the id of teh span and the characters to use +for the parts of the stretch operator. +constructed fence. The + + + +Inline CSS style block handles all font and size specification for the +various MathML operators. + + + + + + + + + + + + + + + + +Unimplemented MathML elements get copied literally, in red, mainly as +a debugging aid. + + +<> + +</> + + + +mi: set default font based on string length, otherwise behaviour based +on entries in the operator dictionary if one exists, or content is +copied through to the output unchanged. + + + + +mi1 + + + + + + + + + + + + + + + + +Handling of mathvariant attribute. +The choice of font families here (currently) avoids math-specific +fonts but does use several fionts coming with windows 9.x and/or +office 2000. + + +font-weight: bold; font-style: upright + + +font-style: upright; font-weight: bold; font-style: italic; + + +font-style: italic; + + +font-family: monospace; + + + +font-family: sans-serif; + + +font-family: sans-serif; font-weight: bold; + + + +font-family: old english text mt + + + + +doublestruck + + + + +font-family: brush script mt italic + + + + +mo: Generate a unique ID so that a script at the end of any +surrounding mrow may replace the conent by a suitably stretched +operator if need be. + + + + + + +mn: a simple span + + + + + + +munder: currently only supports underline, with a bottom border + + + + border-width: 0pt 0pt .1em 0pt; border-style: solid;" + + + + + +mover: currently only supports overline, with a top border + + + + border-width: .1em 0pt 0pt 0pt; border-style: solid;" + + + + + +munderover: + + + + + +
+
+ +mtext: a simple span + + + + + + +mstyle: not many attributes currently supported + + + + color: ; + background-color: ; + + + + + + +mglyph: Uses disable output escaping to construct a numeric +character reference. Uses IE's non conforming behaviour of using this +number to access the font encoding rather than unicode. + + +; + + + +ms: a simple span with left and right character added to the content. + + + " + + " + + + + + + + + + + + + + + + ( + + + + + + ) + + + + + + + + + + , + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\ + + + + + +\ + + + + + + + + + + + + + + + + + +\ + + + + + + + + + + font-size: 75% ; + + + font-size: 100% ; + + + +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +left + + + + + + +
diff --git a/source/idl/readme-idl.txt b/source/idl/readme-idl.txt new file mode 100644 index 0000000..6fd2f0d --- /dev/null +++ b/source/idl/readme-idl.txt @@ -0,0 +1,30 @@ +This directory contains idl specifications for the custom uno interfaces +defined by the Writer2LaTeX and Writer2xhtml extensions + +To avoid dependencies on the OOo SDK in the build process, compiled versions +are included here. + +If you need to rebuild it, the complete SDK is required. These are the steps: + +To create the registry database for Writer2LaTeX: + +idlc -I\idl XW2LStarMathConverter.idl +regmerge writer2latex.rdb /UCR XW2LStarMathConverter.urd + +To create the java interface + +javamaker -BUCR -Torg.openoffice.da.writer2latex.XW2LStarMathConverter -nD \program\types.rdb writer2latex.rdb + +and likewise for Writer2xhtml: + +idlc -I\idl XBatchConverter.idl +regmerge writer2xhtml.rdb /UCR XBatchConverter.urd + +To create the java interfaces + +javamaker -BUCR -Torg.openoffice.da.writer2xhtml.XBatchConverter -nD \program\types.rdb writer2xhtml.rdb +javamaker -BUCR -Torg.openoffice.da.writer2xhtml.XBatchHandler -nD \program\types.rdb writer2xhtml.rdb + + +If you need to use the interfaces from C++ you will also need to run cppumaker + diff --git a/source/idl/writer2latex/XW2LStarMathConverter.idl b/source/idl/writer2latex/XW2LStarMathConverter.idl new file mode 100644 index 0000000..c66f048 --- /dev/null +++ b/source/idl/writer2latex/XW2LStarMathConverter.idl @@ -0,0 +1,22 @@ +#ifndef __org_openoffice_da_writer2latex_XW2LStarMathConverter_idl__ +#define __org_openoffice_da_writer2latex_XW2LStarMathConverter_idl__ +#include + +module org { module openoffice { module da { module writer2latex { + +interface XW2LStarMathConverter : com::sun::star::uno::XInterface +{ + + // method org::openoffice::da::writer2latex::XW2LStarMathConverter::convertFormula + string convertFormula ( [in] string sStarMathFormula ); + + // method org::openoffice::da::writer2latex::XW2LStarMathConverter::getPreamble + string getPreamble ( ); + +}; + +}; }; }; }; + +#endif + + \ No newline at end of file diff --git a/source/idl/writer2latex/org/openoffice/da/writer2latex/XW2LStarMathConverter.class b/source/idl/writer2latex/org/openoffice/da/writer2latex/XW2LStarMathConverter.class new file mode 100644 index 0000000..20fc93e Binary files /dev/null and b/source/idl/writer2latex/org/openoffice/da/writer2latex/XW2LStarMathConverter.class differ diff --git a/source/idl/writer2latex/writer2latex.rdb b/source/idl/writer2latex/writer2latex.rdb new file mode 100644 index 0000000..df61666 Binary files /dev/null and b/source/idl/writer2latex/writer2latex.rdb differ diff --git a/source/idl/writer2xhtml/XBatchConverter.idl b/source/idl/writer2xhtml/XBatchConverter.idl new file mode 100644 index 0000000..cd8f72e --- /dev/null +++ b/source/idl/writer2xhtml/XBatchConverter.idl @@ -0,0 +1,52 @@ +#ifndef __org_openoffice_da_writer2xhtml_XBatchConverter_idl__ +#define __org_openoffice_da_writer2xhtml_XBatchConverter_idl__ +#include +#include + +module org { module openoffice { module da { module writer2xhtml { + +// This interface is an IDL version of the java interface (writer2latex.api.BatchHandler) +interface XBatchHandler : com::sun::star::uno::XInterface +{ + + // method org::openoffice::da::writer2xhtml::XBatchHandler::startConversion + void startConversion (); + + // method org::openoffice::da::writer2xhtml::XBatchHandler::endConversion + void endConversion (); + + // method org::openoffice::da::writer2xhtml::XBatchHandler::startDirectory + void startDirectory ( [in] string sName ); + + // method org::openoffice::da::writer2xhtml::XBatchHandler::endDirectory + void endDirectory ( [in] string sName, [in] boolean bSuccess ); + + // method org::openoffice::da::writer2xhtml::XBatchHandler::startFile + void startFile ( [in] string sName ); + + // method org::openoffice::da::writer2xhtml::XBatchHandler::endFile + void endFile ( [in] string sName, [in] boolean bSuccess ); + + // method org::openoffice::da::writer2xhtml::XBatchHandler::cancel + boolean cancel (); + +}; + +// This interface is an IDL version of the java interface (writer2latex.api.BatchConverter) +interface XBatchConverter : com::sun::star::uno::XInterface +{ + + // method org::openoffice::da::writer2xhtml::XBatchConverter::convert + void convert ( [in] string sSourceURL, + [in] string sTargetURL, + [in] sequence< com::sun::star::beans::PropertyValue > lArguments, + [in] XBatchHandler handler ); + +} ; + + +}; }; }; }; + +#endif + + \ No newline at end of file diff --git a/source/idl/writer2xhtml/org/openoffice/da/writer2xhtml/XBatchConverter.class b/source/idl/writer2xhtml/org/openoffice/da/writer2xhtml/XBatchConverter.class new file mode 100644 index 0000000..3c7d608 Binary files /dev/null and b/source/idl/writer2xhtml/org/openoffice/da/writer2xhtml/XBatchConverter.class differ diff --git a/source/idl/writer2xhtml/org/openoffice/da/writer2xhtml/XBatchHandler.class b/source/idl/writer2xhtml/org/openoffice/da/writer2xhtml/XBatchHandler.class new file mode 100644 index 0000000..0d03a74 Binary files /dev/null and b/source/idl/writer2xhtml/org/openoffice/da/writer2xhtml/XBatchHandler.class differ diff --git a/source/idl/writer2xhtml/writer2xhtml.rdb b/source/idl/writer2xhtml/writer2xhtml.rdb new file mode 100644 index 0000000..ba0a189 Binary files /dev/null and b/source/idl/writer2xhtml/writer2xhtml.rdb differ diff --git a/source/java/org/openoffice/da/comp/w2lcommon/filter/ByteArrayXStream.java b/source/java/org/openoffice/da/comp/w2lcommon/filter/ByteArrayXStream.java new file mode 100644 index 0000000..c76cf30 --- /dev/null +++ b/source/java/org/openoffice/da/comp/w2lcommon/filter/ByteArrayXStream.java @@ -0,0 +1,188 @@ +/************************************************************************ + * + * ByteArrayXStream.java + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * Copyright: 2002-2008 by Henrik Just + * + * All Rights Reserved. + * + * Version 1.0 (2008-07-22) + * + */ + +package org.openoffice.da.comp.w2lcommon.filter; + +// This class is based on these java uno adapter classes: +// com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter; +// com.sun.star.lib.uno.adapter.XOutputStreamToByteArrayAdapter; +// See http://go-oo.org/lxr/source/udk/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java +// and http://go-oo.org/lxr/source/udk/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java +// for original source + +import com.sun.star.io.XInputStream; +import com.sun.star.io.XOutputStream; +import com.sun.star.io.XSeekable; +import com.sun.star.io.XStream; + +/**

This is a java-uno adapter class which implements XStream using a + * byte array. (We need this because XGraphicProvider demans read/write access + * when storing a graphic to a stream.)

+ */ +public class ByteArrayXStream implements XInputStream, XOutputStream, XSeekable, XStream { + + // Keep data about our byte array (we read and write to the same byte array) + + private int initialSize = 100240; // 10 kb + private int size = 0; // The current buffer size + private int position = 0; // The current write position, always<=size + private int readPosition = 0; // The current read position, always<=position + private boolean closed = false; // The XStream is closed + private byte[] buffer; // The buffer + + // Constructor: Initialize the byte array + + public ByteArrayXStream() { + size = initialSize; + buffer = new byte[size]; + } + + // Implementation of XOutputStream + + public void closeOutput() + throws com.sun.star.io.NotConnectedException, + com.sun.star.io.BufferSizeExceededException, + com.sun.star.io.IOException { + + // trim buffer + if ( buffer.length > position) { + byte[] newBuffer = new byte[position]; + System.arraycopy(buffer, 0, newBuffer, 0, position); + buffer = newBuffer; + } + closed = true; + } + + public void flush() + throws com.sun.star.io.NotConnectedException, + com.sun.star.io.BufferSizeExceededException, + com.sun.star.io.IOException { + } + + public void writeBytes(byte[] values) + throws com.sun.star.io.NotConnectedException, + com.sun.star.io.BufferSizeExceededException, + com.sun.star.io.IOException { + if ( values.length > size-position ) { + byte[] newBuffer = null; + while ( values.length > size-position ) + size *= 2; + newBuffer = new byte[size]; + System.arraycopy(buffer, 0, newBuffer, 0, position); + buffer = newBuffer; + } + System.arraycopy(values, 0, buffer, position, values.length); + position += values.length; + } + + // Implementation of XInputStream + + private void _check() throws com.sun.star.io.NotConnectedException, com.sun.star.io.IOException { + if(closed) { + throw new com.sun.star.io.IOException("input closed"); + } + } + + public int available() throws com.sun.star.io.NotConnectedException, com.sun.star.io.IOException { + _check(); + return position - readPosition; + } + + public void closeInput() throws com.sun.star.io.NotConnectedException, com.sun.star.io.IOException { + closed = true; + } + + public int readBytes(byte[][] values, int param) throws com.sun.star.io.NotConnectedException, com.sun.star.io.BufferSizeExceededException, com.sun.star.io.IOException { + _check(); + try { + int remain = (int)(position - readPosition); + if (param > remain) param = remain; + /* ARGH!!! */ + if (values[0] == null){ + values[0] = new byte[param]; + // System.err.println("allocated new buffer of "+param+" bytes"); + } + System.arraycopy(buffer, readPosition, values[0], 0, param); + // System.err.println("readbytes() -> "+param); + readPosition += param; + return param; + } catch (ArrayIndexOutOfBoundsException ae) { + // System.err.println("readbytes() -> ArrayIndexOutOfBounds"); + ae.printStackTrace(); + throw new com.sun.star.io.BufferSizeExceededException("buffer overflow"); + } catch (Exception e) { + // System.err.println("readbytes() -> Exception: "+e.getMessage()); + e.printStackTrace(); + throw new com.sun.star.io.IOException("error accessing buffer"); + } + } + + public int readSomeBytes(byte[][] values, int param) throws com.sun.star.io.NotConnectedException, com.sun.star.io.BufferSizeExceededException, com.sun.star.io.IOException { + // System.err.println("readSomebytes()"); + return readBytes(values, param); + } + + public void skipBytes(int param) throws com.sun.star.io.NotConnectedException, com.sun.star.io.BufferSizeExceededException, com.sun.star.io.IOException { + // System.err.println("skipBytes("+param+")"); + _check(); + if (param > (position - readPosition)) + throw new com.sun.star.io.BufferSizeExceededException("buffer overflow"); + readPosition += param; + } + + + // Implementation of XSeekable + + public long getLength() throws com.sun.star.io.IOException { + // System.err.println("getLength() -> "+m_length); + if (buffer != null) return position; + else throw new com.sun.star.io.IOException("no bytes"); + } + + public long getPosition() throws com.sun.star.io.IOException { + // System.err.println("getPosition() -> "+m_pos); + if (buffer != null) return readPosition; + else throw new com.sun.star.io.IOException("no bytes"); + } + + public void seek(long param) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.io.IOException { + // System.err.println("seek("+param+")"); + if (buffer != null) { + if (param < 0 || param > position) throw new com.sun.star.lang.IllegalArgumentException("invalid seek position"); + else readPosition = (int)param; + } else throw new com.sun.star.io.IOException("no bytes"); + } + + // Implementation of XStream + public XInputStream getInputStream() { return this; } + + public XOutputStream getOutputStream() { return this; } + + // Get the buffer + public byte[] getBuffer() { return buffer; } + +} + diff --git a/source/java/org/openoffice/da/comp/w2lcommon/filter/ExportFilterBase.java b/source/java/org/openoffice/da/comp/w2lcommon/filter/ExportFilterBase.java new file mode 100644 index 0000000..3899deb --- /dev/null +++ b/source/java/org/openoffice/da/comp/w2lcommon/filter/ExportFilterBase.java @@ -0,0 +1,504 @@ +/************************************************************************ + * + * ExportFilterBase.java + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * Copyright: 2002-2008 by Henrik Just + * + * All Rights Reserved. + * + * Version 1.0 (2008-11-24) + * + */ + +// This file was originally based on OOo's XMergeBridge, which is (c) by Sun Microsystems + +package org.openoffice.da.comp.w2lcommon.filter; + +import com.sun.star.lib.uno.adapter.XInputStreamToInputStreamAdapter; +import com.sun.star.lib.uno.adapter.XOutputStreamToOutputStreamAdapter; + +//import com.sun.star.beans.PropertyValue; +import com.sun.star.io.XInputStream; +import com.sun.star.io.XOutputStream; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.XServiceName; +import com.sun.star.lang.XTypeProvider; +import com.sun.star.uno.AnyConverter; +import com.sun.star.ucb.XSimpleFileAccess2; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +//import com.sun.star.xml.sax.InputSource; +//import com.sun.star.xml.sax.XParser; +import com.sun.star.xml.sax.XDocumentHandler; +import com.sun.star.xml.XExportFilter; + +import org.openoffice.da.comp.w2lcommon.helper.MessageBox; +//import org.openoffice.da.comp.w2lcommon.helper.PropertyHelper; +import writer2latex.api.Converter; +import writer2latex.api.ConverterFactory; +import writer2latex.api.ConverterResult; +import writer2latex.api.OutputFile; + +import java.util.Iterator; +//import java.util.Enumeration; +//import java.util.Vector; +import java.io.*; +//import javax.xml.parsers.*; +//import org.xml.sax.SAXException; +//import java.net.URI; + + +/** This class provides an abstract uno component which implements an XExportFilter. + * The filter is actually generic and only then constructor and 3 strings needs + * to changed by the subclass. + */ +public abstract class ExportFilterBase implements + XExportFilter, + XServiceName, + XServiceInfo, + XDocumentHandler, + XTypeProvider { + + /** Service name for the component */ + public static final String __serviceName = ""; + + /** Implementation name for the component */ + public static final String __implementationName = ""; + + /** Filter name to include in error messages */ + public static final String __displayName = ""; + + private static XComponentContext xComponentContext = null; + protected static XMultiServiceFactory xMSF; + private static XInputStream xInStream =null; + private static XOutputStream xOutStream=null; + private static XOutputStream xos = null; + private static String sdMime=null; + private static String sURL=""; + + private Object filterData; + private XSimpleFileAccess2 sfa2; + + + /** We need to get the Service Manager from the Component context to + * instantiate certain services, hence this constructor. + * The subclass must override this to set xMSF properly from the reigstration class + */ + public ExportFilterBase(XComponentContext xComponentContext1) { + xComponentContext = xComponentContext1; + xMSF = null; + } + + + // Some utility methods: + + String getFileName(String origName) { + String name=null; + if (origName !=null) { + if(origName.equalsIgnoreCase("")) + name = "OutFile"; + else { + if (origName.lastIndexOf("/")>=0) { + origName=origName.substring(origName.lastIndexOf("/")+1,origName.length()); + } + if (origName.lastIndexOf(".")>=0) { + name = origName.substring(0,(origName.lastIndexOf("."))); + } + else { + name=origName; + } + } + } + else{ + name = "OutFile"; + } + + return name; + } + + public String replace(String origString, String origChar, String replaceChar){ + String tmp=""; + int index=origString.indexOf(origChar); + if(index !=-1){ + while (index !=-1){ + String first =origString.substring(0,index); + first=first.concat(replaceChar); + tmp=tmp.concat(first); + origString=origString.substring(index+1,origString.length()); + index=origString.indexOf(origChar); + if(index==-1) { + tmp=tmp.concat(origString); + } + } + } + return tmp; + } + + public String needsMask(String origString) { + if (origString.indexOf("&")!=-1){ + origString=replace(origString,"&","&"); + } + if (origString.indexOf("\"")!=-1){ + origString=replace(origString,"\"","""); + } + if (origString.indexOf("<")!=-1){ + origString=replace(origString,"<","<"); + } + if (origString.indexOf(">")!=-1){ + origString=replace(origString,">",">"); + } + return origString; + + } + + + // Implementation of XExportFilter: + + public boolean exporter(com.sun.star.beans.PropertyValue[] aSourceData, + java.lang.String[] msUserData) throws com.sun.star.uno.RuntimeException{ + + sURL=null; + filterData = null; + + // Get user data from configuration (type detection) + //String udConvertClass=msUserData[0]; + //String udImport =msUserData[2]; + //String udExport =msUserData[3]; + sdMime = msUserData[5]; + + // Get source data (only the OutputStream and the URL are actually used) + com.sun.star.beans.PropertyValue[] pValue = aSourceData; + for (int i = 0 ; i < pValue.length; i++) { + try{ + if (pValue[i].Name.compareTo("OutputStream")==0){ + xos=(com.sun.star.io.XOutputStream)AnyConverter.toObject(new Type(com.sun.star.io.XOutputStream.class), pValue[i].Value); + } + //if (pValue[i].Name.compareTo("FileName")==0){ + // sFileName=(String)AnyConverter.toObject(new Type(java.lang.String.class), pValue[i].Value); + //} + if (pValue[i].Name.compareTo("URL")==0){ + sURL=(String)AnyConverter.toObject(new Type(java.lang.String.class), pValue[i].Value); + } + //if (pValue[i].Name.compareTo("Title")==0){ + // title=(String)AnyConverter.toObject(new Type(java.lang.String.class), pValue[i].Value); + //} + if (pValue[i].Name.compareTo("FilterData")==0) { + filterData = pValue[i].Value; + } + } + catch(com.sun.star.lang.IllegalArgumentException AnyExec){ + System.err.println("\nIllegalArgumentException "+AnyExec); + } + } + + + if (sURL==null){ + sURL=""; + } + + // Create a pipe to be used by the XDocumentHandler implementation: + try { + Object xPipeObj=xMSF.createInstance("com.sun.star.io.Pipe"); + xInStream = (XInputStream) UnoRuntime.queryInterface( + XInputStream.class , xPipeObj ); + xOutStream = (XOutputStream) UnoRuntime.queryInterface( + XOutputStream.class , xPipeObj ); + } + catch (Exception e){ + System.err.println("Exception "+e); + return false; + } + + return true; + } + + + + // Implementation of XDocumentHandler: + // Flat xml is created by the sax events and passed through the pipe + // created by exporter() + + public void startDocument () { + //Do nothing + } + + public void endDocument()throws com.sun.star.uno.RuntimeException { + try{ + xOutStream.closeOutput(); + convert(xInStream,xos); + } + catch (IOException e){ + MessageBox msgBox = new MessageBox(xComponentContext); + msgBox.showMessage(__displayName+": IO error in conversion", + e.toString()+" at "+e.getStackTrace()[0].toString()); + throw new com.sun.star.uno.RuntimeException(e.getMessage()); + } + catch (Exception e){ + MessageBox msgBox = new MessageBox(xComponentContext); + msgBox.showMessage(__displayName+": Internal error in conversion", + e.toString()+" at "+e.getStackTrace()[0].toString()); + throw new com.sun.star.uno.RuntimeException(__displayName+" Exception"); + } + } + + + + public void startElement (String str, com.sun.star.xml.sax.XAttributeList xattribs) + { + + str="<".concat(str); + if (xattribs !=null) + { + str= str.concat(" "); + int len=xattribs.getLength(); + for (short i=0;i"); + try{ + xOutStream.writeBytes(str.getBytes("UTF-8")); + } + catch (Exception e){ + System.err.println("\n"+e); + } + + } + + public void endElement(String str){ + + str=""); + try{ + xOutStream.writeBytes(str.getBytes("UTF-8")); + + } + catch (Exception e){ + System.err.println("\n"+e); + } + + + } + public void characters(String str){ + str=needsMask(str); + try{ + xOutStream.writeBytes(str.getBytes("UTF-8")); + } + catch (Exception e){ + System.err.println("\n"+e); + } + + + } + + public void ignorableWhitespace(String str){ + + + } + public void processingInstruction(String aTarget, String aData){ + + } + + public void setDocumentLocator(com.sun.star.xml.sax.XLocator xLocator){ + + } + + + + // This is the actual conversion method, using Writer2LaTeX to convert + // the flat xml recieved from the XInputStream, and writing the result + // to the XOutputStream. The XMLExporter does not support export to + // compound documents with multiple output files; so the main file + // is written to the XOutStream and other files are written using ucb. + + public void convert (com.sun.star.io.XInputStream xml,com.sun.star.io.XOutputStream exportStream) + throws com.sun.star.uno.RuntimeException, IOException { + + // Initialise the file access + sfa2 = null; + try { + Object sfaObject = xComponentContext.getServiceManager().createInstanceWithContext( + "com.sun.star.ucb.SimpleFileAccess", xComponentContext); + sfa2 = (XSimpleFileAccess2) UnoRuntime.queryInterface(XSimpleFileAccess2.class, sfaObject); + } + catch (com.sun.star.uno.Exception e) { + // failed to get SimpleFileAccess service (should not happen) + } + + // Get base name from the url provided by OOo + String sName= getFileName(sURL); + + // Adapter for input stream (OpenDocument flat xml) + XInputStreamToInputStreamAdapter xis =new XInputStreamToInputStreamAdapter(xml); + + // Adapter for output stream (Main output file) + XOutputStreamToOutputStreamAdapter newxos =new XOutputStreamToOutputStreamAdapter(exportStream); + + // Create converter + Converter converter = ConverterFactory.createConverter(sdMime); + if (converter==null) { + throw new com.sun.star.uno.RuntimeException("Failed to create converter to "+sdMime); + } + + // Apply the FilterData to the converter + if (filterData!=null) { + FilterDataParser fdp = new FilterDataParser(xComponentContext); + fdp.applyFilterData(filterData,converter); + } + + // Do conversion + converter.setGraphicConverter(new GraphicConverterImpl(xComponentContext)); + + ConverterResult dataOut = null; + try { + dataOut = converter.convert(xis,sName); + } + catch (IOException e) { + // Fail silently + } + + // Write out files + Iterator docEnum = dataOut.iterator(); + + // Remove the file name part of the url + String sNewURL = null; + if (sURL.lastIndexOf("/")>-1) { + // Take the url up to and including the last slash + sNewURL = sURL.substring(0,sURL.lastIndexOf("/")+1); + } + else { + // The url does not include a path; this should not really happen, + // but in this case we will write to the current default directory + sNewURL = ""; + } + + while (docEnum.hasNext() && sURL.startsWith("file:")) { + OutputFile docOut = (OutputFile)docEnum.next(); + + if (dataOut.getMasterDocument()==docOut) { + // The master document is written to the XOutStream supplied + // by the XMLFilterAdaptor + docOut.write(newxos); + newxos.flush(); + newxos.close(); + } + else { + // Additional documents are written directly using ucb + + // Get the file name and the (optional) directory name + String sFullFileName = docOut.getFileName(); + String sDirName = ""; + String sFileName = sFullFileName; + int nSlash = sFileName.indexOf("/"); + if (nSlash>-1) { + sDirName = sFileName.substring(0,nSlash); + sFileName = sFileName.substring(nSlash+1); + } + + try{ + // Create subdirectory if required + if (sDirName.length()>0 && !sfa2.exists(sNewURL+sDirName)) { + sfa2.createFolder(sNewURL+sDirName); + } + + // writeFile demands an InputStream, so we need a pipe + Object xPipeObj=xMSF.createInstance("com.sun.star.io.Pipe"); + XInputStream xInStream + = (XInputStream) UnoRuntime.queryInterface(XInputStream.class, xPipeObj ); + XOutputStream xOutStream + = (XOutputStream) UnoRuntime.queryInterface(XOutputStream.class, xPipeObj ); + OutputStream outStream = new XOutputStreamToOutputStreamAdapter(xOutStream); + // Feed the pipe with content... + docOut.write(outStream); + outStream.flush(); + outStream.close(); + xOutStream.closeOutput(); + // ...and then write the content to the url + sfa2.writeFile(sNewURL+sFullFileName,xInStream); + } + catch (Throwable e){ + MessageBox msgBox = new MessageBox(xComponentContext); + msgBox.showMessage(__displayName+": Error writing files", + e.toString()+" at "+e.getStackTrace()[0].toString()); + } + } + + } + + } + + + // Implement methods from interface XTypeProvider + // Implementation of XTypeProvider + + public com.sun.star.uno.Type[] getTypes() { + Type[] typeReturn = {}; + + try { + typeReturn = new Type[] { + new Type( XTypeProvider.class ), + new Type( XExportFilter.class ), + new Type( XServiceName.class ), + new Type( XServiceInfo.class ) }; + } + catch( Exception exception ) { + + } + + return( typeReturn ); + } + + + public byte[] getImplementationId() { + byte[] byteReturn = {}; + + byteReturn = new String( "" + this.hashCode() ).getBytes(); + + return( byteReturn ); + } + + // Implement method from interface XServiceName + public String getServiceName() { + return( __serviceName ); + } + + // Implement methods from interface XServiceInfo + public boolean supportsService(String stringServiceName) { + return( stringServiceName.equals( __serviceName ) ); + } + + public String getImplementationName() { + return __implementationName; + //return( W2LExportFilter.class.getName() ); + } + + public String[] getSupportedServiceNames() { + String[] stringSupportedServiceNames = { __serviceName }; + return( stringSupportedServiceNames ); + } + + +} + + + diff --git a/source/java/org/openoffice/da/comp/w2lcommon/filter/FilterDataParser.java b/source/java/org/openoffice/da/comp/w2lcommon/filter/FilterDataParser.java new file mode 100644 index 0000000..765dd6b --- /dev/null +++ b/source/java/org/openoffice/da/comp/w2lcommon/filter/FilterDataParser.java @@ -0,0 +1,271 @@ +/************************************************************************ + * + * FilterDataParser.java + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * Copyright: 2002-2008 by Henrik Just + * + * All Rights Reserved. + * + * Version 1.0 (2008-11-22) + * + */ + +package org.openoffice.da.comp.w2lcommon.filter; + +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Enumeration; + +import com.sun.star.beans.PropertyValue; +import com.sun.star.io.NotConnectedException; +import com.sun.star.io.XInputStream; +import com.sun.star.io.XOutputStream; +import com.sun.star.ucb.CommandAbortedException; +import com.sun.star.ucb.XSimpleFileAccess2; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.XStringSubstitution; + +import com.sun.star.lib.uno.adapter.XInputStreamToInputStreamAdapter; +import com.sun.star.lib.uno.adapter.XOutputStreamToOutputStreamAdapter; + +import org.openoffice.da.comp.w2lcommon.helper.PropertyHelper; +import writer2latex.api.Converter; + + +/** This class parses the FilterData property passed to the filter and + * applies it to a Converter + * All errors are silently ignored + */ +public class FilterDataParser { + + //private static XComponentContext xComponentContext = null; + + private XSimpleFileAccess2 sfa2; + private XStringSubstitution xPathSub; + + public FilterDataParser(XComponentContext xComponentContext) { + //this.xComponentContext = xComponentContext; + + // Get the SimpleFileAccess service + sfa2 = null; + try { + Object sfaObject = xComponentContext.getServiceManager().createInstanceWithContext( + "com.sun.star.ucb.SimpleFileAccess", xComponentContext); + sfa2 = (XSimpleFileAccess2) UnoRuntime.queryInterface(XSimpleFileAccess2.class, sfaObject); + } + catch (com.sun.star.uno.Exception e) { + // failed to get SimpleFileAccess service (should not happen) + } + + // Get the PathSubstitution service + xPathSub = null; + try { + Object psObject = xComponentContext.getServiceManager().createInstanceWithContext( + "com.sun.star.util.PathSubstitution", xComponentContext); + xPathSub = (XStringSubstitution) UnoRuntime.queryInterface(XStringSubstitution.class, psObject); + } + catch (com.sun.star.uno.Exception e) { + // failed to get PathSubstitution service (should not happen) + } + } + + /** Apply the given FilterData property to the given converter + * @param data an Any containing the FilterData property + * @param converter a writer2latex.api.Converter implementation + */ + public void applyFilterData(Object data, Converter converter) { + // Get the array from the data, if possible + PropertyValue[] filterData = null; + if (AnyConverter.isArray(data)) { + try { + Object[] arrayData = (Object[]) AnyConverter.toArray(data); + if (arrayData instanceof PropertyValue[]) { + filterData = (PropertyValue[]) arrayData; + } + } + catch (com.sun.star.lang.IllegalArgumentException e) { + // Failed to convert to array; should not happen - ignore + } + } + if (filterData==null) { return; } + + PropertyHelper props = new PropertyHelper(filterData); + + // Get the special properties TemplateURL, ConfigURL and AutoCreate + Object tpl = props.get("TemplateURL"); + String sTemplate = null; + if (tpl!=null && AnyConverter.isString(tpl)) { + try { + sTemplate = substituteVariables(AnyConverter.toString(tpl)); + } + catch (com.sun.star.lang.IllegalArgumentException e) { + // Failed to convert to String; should not happen - ignore + } + } + + Object auto = props.get("AutoCreate"); + boolean bAutoCreate = false; + if (auto!=null && AnyConverter.isString(auto)) { + try { + if ("true".equals(AnyConverter.toString(auto))) { + bAutoCreate = true; + } + } + catch (com.sun.star.lang.IllegalArgumentException e) { + // Failed to convert to String; should not happen - ignore + } + } + + Object cfg = props.get("ConfigURL"); + String sConfig = null; + if (cfg!=null && AnyConverter.isString(cfg)) { + try { + sConfig = substituteVariables(AnyConverter.toString(cfg)); + } + catch (com.sun.star.lang.IllegalArgumentException e) { + // Failed to convert to String; should not happen - ignore + } + } + + // Load the template from the specified URL, if any + if (sfa2!=null && sTemplate!=null && sTemplate.length()>0) { + try { + XInputStream xIs = sfa2.openFileRead(sTemplate); + if (xIs!=null) { + InputStream is = new XInputStreamToInputStreamAdapter(xIs); + converter.readTemplate(is); + is.close(); + xIs.closeInput(); + } + } + catch (IOException e) { + // ignore + } + catch (NotConnectedException e) { + // ignore + } + catch (CommandAbortedException e) { + // ignore + } + catch (com.sun.star.uno.Exception e) { + // ignore + } + } + + // Create config if required + try { + if (bAutoCreate && sfa2!=null && sConfig!=null && !sConfig.startsWith("*") && !sfa2.exists(sConfig)) { + // Note: Requires random access, ie. must be a file URL: + XOutputStream xOs = sfa2.openFileWrite(sConfig); + if (xOs!=null) { + OutputStream os = new XOutputStreamToOutputStreamAdapter(xOs); + converter.getConfig().write(os); + os.flush(); + os.close(); + xOs.closeOutput(); + } + } + } + catch (IOException e) { + // ignore + } + catch (NotConnectedException e) { + // ignore + } + catch (CommandAbortedException e) { + // Ignore + } + catch (com.sun.star.uno.Exception e) { + // Ignore + } + + // Load the configuration from the specified URL, if any + if (sConfig!=null) { + if (sConfig.startsWith("*")) { // internal configuration + try { + converter.getConfig().readDefaultConfig(sConfig.substring(1)); + } + catch (IllegalArgumentException e) { + // ignore + } + } + else if (sfa2!=null) { // real URL + try { + XInputStream xIs = sfa2.openFileRead(sConfig);; + if (xIs!=null) { + InputStream is = new XInputStreamToInputStreamAdapter(xIs); + converter.getConfig().read(is); + is.close(); + xIs.closeInput(); + } + } + catch (IOException e) { + // Ignore + } + catch (NotConnectedException e) { + // Ignore + } + catch (CommandAbortedException e) { + // Ignore + } + catch (com.sun.star.uno.Exception e) { + // Ignore + } + } + } + + // Read further configuration properties + Enumeration keys = props.keys(); + while (keys.hasMoreElements()) { + String sKey = (String) keys.nextElement(); + if (!"ConfigURL".equals(sKey) && !"TemplateURL".equals(sKey) && !"AutoCreate".equals(sKey)) { + Object value = props.get(sKey); + if (AnyConverter.isString(value)) { + try { + converter.getConfig().setOption(sKey,AnyConverter.toString(value)); + } + catch (com.sun.star.lang.IllegalArgumentException e) { + // Failed to convert to String; should not happen - ignore + } + } + } + } + } + + private String substituteVariables(String sUrl) { + if (xPathSub!=null) { + try { + return xPathSub.substituteVariables(sUrl, false); + } + catch (com.sun.star.container.NoSuchElementException e) { + // Found an unknown variable, no substitution + // (This will only happen if false is replaced by true above) + return sUrl; + } + } + else { // Not path substitution available + return sUrl; + } + } + +} + + + diff --git a/source/java/org/openoffice/da/comp/w2lcommon/filter/GraphicConverterImpl.java b/source/java/org/openoffice/da/comp/w2lcommon/filter/GraphicConverterImpl.java new file mode 100644 index 0000000..e291271 --- /dev/null +++ b/source/java/org/openoffice/da/comp/w2lcommon/filter/GraphicConverterImpl.java @@ -0,0 +1,67 @@ +/************************************************************************ + * + * GraphicConverterImpl.java + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * Copyright: 2002-2008 by Henrik Just + * + * All Rights Reserved. + * + * Version 1.0 (2008-07-21) + * + */ + +package org.openoffice.da.comp.w2lcommon.filter; + +import com.sun.star.uno.XComponentContext; + +import writer2latex.api.GraphicConverter; + +public class GraphicConverterImpl implements GraphicConverter { + + private GraphicConverter graphicConverter1; + private GraphicConverter graphicConverter2; + + public GraphicConverterImpl(XComponentContext xComponentContext) { + graphicConverter1 = new GraphicConverterImpl1(xComponentContext); + graphicConverter2 = new GraphicConverterImpl2(xComponentContext); + } + + public boolean supportsConversion(String sSourceMime, String sTargetMime, boolean bCrop, boolean bResize) { + return graphicConverter1.supportsConversion(sSourceMime, sTargetMime, bCrop, bResize) || + graphicConverter2.supportsConversion(sSourceMime, sTargetMime, bCrop, bResize); + } + + public byte[] convert(byte[] source, String sSourceMime, String sTargetMime) { + byte[] result = null; + + // Prefer the simple implementation (GraphicProvider) + if (graphicConverter1.supportsConversion(sSourceMime, sTargetMime, false, false)) { + result = graphicConverter1.convert(source, sSourceMime, sTargetMime); + } + + // If this is not possible or fails, try the complex implementation + if (result==null) { + result = graphicConverter2.convert(source, sSourceMime, sTargetMime); + } + + return result; + + } + + +} + diff --git a/source/java/org/openoffice/da/comp/w2lcommon/filter/GraphicConverterImpl1.java b/source/java/org/openoffice/da/comp/w2lcommon/filter/GraphicConverterImpl1.java new file mode 100644 index 0000000..d2faa17 --- /dev/null +++ b/source/java/org/openoffice/da/comp/w2lcommon/filter/GraphicConverterImpl1.java @@ -0,0 +1,194 @@ +/************************************************************************ + * + * GraphicConverterImpl1.java + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * Copyright: 2002-2008 by Henrik Just + * + * All Rights Reserved. + */ + +// Version 1.0 (2008-11-22) + +package org.openoffice.da.comp.w2lcommon.filter; + +// Java uno helper class +import com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter; + +// UNO classes +import com.sun.star.beans.PropertyValue; +import com.sun.star.graphic.XGraphic; +import com.sun.star.graphic.XGraphicProvider; +//import com.sun.star.io.XInputStream; +//import com.sun.star.io.XOutputStream; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.uno.XComponentContext; +import com.sun.star.uno.UnoRuntime; + +//import java.io.InputStream; +//import java.io.OutputStream; + +import writer2latex.api.GraphicConverter; +import writer2latex.api.MIMETypes; + +/** A GraphicConverter implementation which uses the GraphicProvider service + * to convert the graphic. This service does only support simple format + * conversion using the "internal" graphics filters in Draw. Advanced features + * like pdf, crop and resize thus cannot be handled. + */ +public class GraphicConverterImpl1 implements GraphicConverter { + + // Signatures for start and end in exp + private byte[] psStart; + private byte[] psEnd; + + + private XGraphicProvider xGraphicProvider; + + public GraphicConverterImpl1(XComponentContext xComponentContext) { + try { + // Get the XGraphicProvider interface of the GraphicProvider service + XMultiComponentFactory xMCF = xComponentContext.getServiceManager(); + Object graphicProviderObject = xMCF.createInstanceWithContext("com.sun.star.graphic.GraphicProvider", xComponentContext); + xGraphicProvider = (XGraphicProvider) UnoRuntime.queryInterface(XGraphicProvider.class, graphicProviderObject); + } + catch (com.sun.star.uno.Exception ex) { + System.err.println("Failed to get XGraphicProvider object"); + xGraphicProvider = null; + } + try { + psStart = "%!PS-Adobe".getBytes("US-ASCII"); + psEnd = "%%EOF".getBytes("US-ASCII"); + } + catch (java.io.UnsupportedEncodingException ex) { + // US-ASCII *is* supported :-) + } + + } + + public boolean supportsConversion(String sSourceMime, String sTargetMime, boolean bCrop, boolean bResize) { + // We don't support cropping and resizing + if (bCrop || bResize) { return false; } + + // We can convert vector formats to eps: + if (MIMETypes.EPS.equals(sTargetMime) && (MIMETypes.WMF.equals(sSourceMime) && MIMETypes.SVM.equals(sSourceMime))) { + return true; + } + + // And we can convert all formats to bitmaps + boolean bSupportsSource = + MIMETypes.PNG.equals(sSourceMime) || MIMETypes.JPEG.equals(sSourceMime) || + MIMETypes.GIF.equals(sSourceMime) || MIMETypes.TIFF.equals(sSourceMime) || + MIMETypes.BMP.equals(sSourceMime) || MIMETypes.WMF.equals(sSourceMime) || + MIMETypes.SVM.equals(sSourceMime); + boolean bSupportsTarget = + MIMETypes.PNG.equals(sTargetMime) || MIMETypes.JPEG.equals(sTargetMime) || + MIMETypes.GIF.equals(sTargetMime) || MIMETypes.TIFF.equals(sTargetMime) || + MIMETypes.BMP.equals(sTargetMime); + return bSupportsSource && bSupportsTarget; + } + + public byte[] convert(byte[] source, String sSourceMime, String sTargetMime) { + + // It seems that the GraphicProvider can only create proper eps if + // the source is a vector format, hence + if (MIMETypes.EPS.equals(sTargetMime)) { + if (!MIMETypes.WMF.equals(sSourceMime) && !MIMETypes.SVM.equals(sSourceMime)) { + return null; + } + } + + ByteArrayToXInputStreamAdapter xSource = new ByteArrayToXInputStreamAdapter(source); + ByteArrayXStream xTarget = new ByteArrayXStream(); + try { + // Read the source + PropertyValue[] sourceProps = new PropertyValue[1]; + sourceProps[0] = new PropertyValue(); + sourceProps[0].Name = "InputStream"; + sourceProps[0].Value = xSource; + XGraphic result = xGraphicProvider.queryGraphic(sourceProps); + + // Store as new type + PropertyValue[] targetProps = new PropertyValue[2]; + targetProps[0] = new PropertyValue(); + targetProps[0].Name = "MimeType"; + targetProps[0].Value = sTargetMime; + targetProps[1] = new PropertyValue(); + targetProps[1].Name = "OutputStream"; + targetProps[1].Value = xTarget; + xGraphicProvider.storeGraphic(result,targetProps); + + + // Close the output and return the result + xTarget.closeOutput(); + xTarget.flush(); + if (MIMETypes.EPS.equals(sTargetMime)) { + return cleanEps(xTarget.getBuffer()); + } + else { + return xTarget.getBuffer(); + } + } + catch (com.sun.star.io.IOException e) { + return null; + } + catch (com.sun.star.lang.IllegalArgumentException e) { + return null; + } + catch (com.sun.star.lang.WrappedTargetException e) { + return null; + } + catch (Throwable e) { + return null; + } + } + + private byte[] cleanEps(byte[] blob) { + int n = blob.length; + + int nStart = 0; + for (int i=0; i=blob.length) { return false; } + for (int i=0; i