Initial import

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@5 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2009-02-20 09:37:06 +00:00
parent 75e32b1e8f
commit b0b66fcae9
252 changed files with 49000 additions and 0 deletions

View file

@ -0,0 +1,96 @@
/************************************************************************
*
* BatchConverter.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-23)
*
*/
package writer2latex.api;
import java.io.File;
import java.io.InputStream;
import java.io.IOException;
/** This is an interface for a converter, which offers conversion of
* all OpenDocument (or OpenOffice.org 1.x) documents in a directory
* (and optionally subdirectories), creating index pages in a specific format.
* Instances of this interface are created using the
* {@link ConverterFactory}
*/
public interface BatchConverter {
/** Get the configuration interface for this batch converter
*
* @return the configuration
*/
public Config getConfig();
/** Define a <code>Converter</code> implementation to use for
* conversion of the individual documents.
* If no converter is given, the <code>convert</code> method cannot
* convert documents (but can still create index pages).
*
* @param converter the <code>Converter</code> to use
*/
public void setConverter(Converter converter);
/** Read a template to use as a base for the index pages.
* The format of the template depends on the <code>BatchConverter</code>
* implementation.
*
* @param is an <code>InputStream</code> from which to read the template
* @throws IOException if some exception occurs while reading the template
*/
public void readTemplate(InputStream is) throws IOException;
/** Read a template to use as a base for the index pages.
* The format of the template depends on the <code>BatchConverter</code>
* implementation.
*
* @param file the file from which to read the template
* @throws IOException if the file does not exist or some exception occurs
* while reading the template
*/
public void readTemplate(File file) throws IOException;
/** Create an index page with specific entries
*
* @param sHeading a heading describing the index page
* @param entries an array of <code>IndexPageEntry</code> objects (null entries
* are allowed, and will be ignored) describing the individual directories
* and documents
*/
public OutputFile createIndexFile(String sHeading, IndexPageEntry[] entries);
/** Convert a directory using the given <code>Converter</code> (if none is given,
* all files will be ignored).
* This method fails silently if you haven't set a converter.
*
* @param source a <code>File</code> representing the directory to convert
* @param target a <code>File</code> representing the directory to contain
* the converted documents
* @param bRecurse determines wether or not to recurse into subdirectories
* @param handler a </code>BatchHandler</code>
*/
public void convert(File source, File target, boolean bRecurse, BatchHandler handler);
}

View file

@ -0,0 +1,77 @@
/************************************************************************
*
* BatchHandler.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-23)
*
*/
package writer2latex.api;
/** This is a call back interface to handle user interaction during a
* batch conversion with a {@link BatchConverter}
*/
public interface BatchHandler {
/** Notification that the conversion is started */
public void startConversion();
/** Notification that the conversion has finished */
public void endConversion();
/** Notification that a directory conversion starts
*
* @param sName the name of the directory to convert
*/
public void startDirectory(String sName);
/** Notification that a directory conversion has finished
*
* @param sName the name of the directory
* @param bSuccess true if the conversion was successful (this only means
* that the index page was created with success, not that the conversion
* of files and subdirectories was successful)
*/
public void endDirectory(String sName, boolean bSuccess);
/** Notification that a file conversion starts
*
* @param sName the name of the file to convert
*/
public void startFile(String sName);
/** Notification that a file conversion has finished
*
* @param sName the name of the file
* @param bSuccess true if the conversion of this file was successful
*/
public void endFile(String sName, boolean bSuccess);
/** Notification that the conversion may be cancelled. The
* {@link BatchConverter} fires this event once per document.
* Cancelling the conversion does not delete files that was already
* converted
*
* @return true if the handler wants to cancel the conversion
*/
public boolean cancel();
}

View file

@ -0,0 +1,99 @@
/************************************************************************
*
* Config.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-23)
*
*/
package writer2latex.api;
import java.io.File;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.IllegalArgumentException;
/** This is an interface for configuration of a {@link Converter}.
* A configuration always supports simple name/value options.
* In addition, you can read and write configurations using streams
* or abstract file names. The format depends on the {@link Converter}
* implementation, cf. the user's manual.
*/
public interface Config {
/** Read a default configuration: The available configurations depend on the
* {@link Converter} implementation
*
* @param sName the name of the configuration
* @throws IllegalArgumentException if the configuration does not exist
*/
public void readDefaultConfig(String sName) throws IllegalArgumentException;
/** Read a configuration (stream based version)
*
* @param is the <code>InputStream</code> to read from
* @throws IOException if an error occurs reading the stream, or the data
* is not in the right format
*/
public void read(InputStream is) throws IOException;
/** Read a configuration (file based version)
*
* @param file the <code>File</code> to read from
* @throws IOException if the file does not exist, an error occurs reading
* the file, or the data is not in the right format
*/
public void read(File file) throws IOException;
/** Write the configuration (stream based version)
*
* @param os the <code>OutputStream</code> to write to
* @throws IOException if an error occurs writing to the stream
*/
public void write(OutputStream os) throws IOException;
/** Write the configuration (file based version)
*
* @param file the <code>File</code> to write to
* @throws IOException if an error occurs writing to the file
*/
public void write(File file) throws IOException;
/** Set a name/value option. Options that are not defined by the
* {@link Converter} implementation as well as null values are
* silently ignored
*
* @param sName the name of the option
* @param sValue the value of the option
*/
public void setOption(String sName, String sValue);
/** Get a named option
*
* @param sName the name of the option
* @return the value of the option, or <code>null</code> if the option does
* not exist or the given name is null
*/
public String getOption(String sName);
}

View file

@ -0,0 +1,99 @@
/************************************************************************
*
* Converter.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-23)
*
*/
package writer2latex.api;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
/** This is an interface for a converter, which offers conversion of
* OpenDocument (or OpenOffice.org 1.x) documents into a specific format.
* Instances of this interface are created using the
* <code>ConverterFactory</code>
*/
public interface Converter {
/** Get the interface for the configuration of this converter
*
* @return the configuration
*/
public Config getConfig();
/** Define a <code>GraphicConverter</code> implementation to use for
* conversion of graphic files. If no converter is specified, graphic
* files will not be converted into other formats.
*
* @param gc the <code>GraphicConverter</code> to use
*/
public void setGraphicConverter(GraphicConverter gc);
/** Read a template to use as a base for the converted document.
* The format of the template depends on the <code>Converter</code>
* implementation.
*
* @param is an <code>InputStream</code> from which to read the template
* @throws IOException if some exception occurs while reading the template
*/
public void readTemplate(InputStream is) throws IOException;
/** Read a template to use as a base for the converted document.
* The format of the template depends on the <code>Converter</code>
* implementation.
*
* @param file a file from which to read the template
* @throws IOException if the file does not exist or some exception occurs
* while reading the template
*/
public void readTemplate(File file) throws IOException;
/** Convert a document
*
* @param is an <code>InputStream</code> from which to read the source document.
* @param sTargetFileName the file name to use for the converted document
* (if the converted document is a compound document consisting consisting
* of several files, this name will be used for the master document)
* @return a <code>ConverterResult</code> containing the converted document
* @throws IOException if some exception occurs while reading the document
*/
public ConverterResult convert(InputStream is, String sTargetFileName)
throws IOException;
/** Convert a document
*
* @param source a <code>File</code> from which to read the source document.
* @param sTargetFileName the file name to use for the converted document
* (if the converted document is a compound document consisting consisting
* of several files, this name will be used for the master document)
* @return a <code>ConverterResult</code> containing the converted document
* @throws FileNotFoundException if the file does not exist
* @throws IOException if some exception occurs while reading the document
*/
public ConverterResult convert(File source, String sTargetFileName)
throws FileNotFoundException, IOException;
}

View file

@ -0,0 +1,126 @@
/************************************************************************
*
* ConverterFactory.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-2009 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-18)
*
*/
package writer2latex.api;
/** This is a factory class which provides static methods to create converters
* for documents in OpenDocument (or OpenOffice.org 1.x) format into a specific MIME type
*/
public class ConverterFactory {
// Version information
private static final String VERSION = "0.9.4";
private static final String DATE = "2008-02-19";
/** Return version information
* @return the Writer2LaTeX version in the form
* (major version).(minor version).(development version).(patch level)
*/
public static String getVersion() { return VERSION; }
/** Return date information
* @return the release date for this Writer2LaTeX version
*/
public static String getDate() { return DATE; }
/** <p>Create a <code>Converter</code> implementation which supports
* conversion into the specified MIME type.</p>
* <p>Currently supported MIME types are:</p>
* <ul>
* <li><code>application/x-latex</code> for LaTeX format</li>
* <li><code>application/x-bibtex</code> for BibTeX format</li>
* <li><code>text/html</code> for XHTML 1.0 strict format</li>
* <li><code>application/xhtml+xml</code> for XHTML+MathML</li>
* <li><code>application/xml</code> for XHTML+MathML using stylesheets from w3c's
* math working group</li>
* </ul>
*
* @param sMIME the MIME type of the target format
* @return the required <code>Converter</code> or null if a converter for
* the requested MIME type could not be created
*/
public static Converter createConverter(String sMIME) {
Object converter = null;
if (MIMETypes.LATEX.equals(sMIME)) {
converter = createInstance("writer2latex.latex.ConverterPalette");
}
else if (MIMETypes.BIBTEX.equals(sMIME)) {
converter = createInstance("writer2latex.bibtex.Converter");
}
else if (MIMETypes.XHTML.equals(sMIME)) {
converter = createInstance("writer2latex.xhtml.Xhtml10Converter");
}
else if (MIMETypes.XHTML_MATHML.equals(sMIME)) {
converter = createInstance("writer2latex.xhtml.XhtmlMathMLConverter");
}
else if (MIMETypes.XHTML_MATHML_XSL.equals(sMIME)) {
converter = createInstance("writer2latex.xhtml.XhtmlMathMLXSLConverter");
}
return converter instanceof Converter ? (Converter) converter : null;
}
/** <p>Create a <code>BatchConverter</code> implementation which supports
* conversion into the specified MIME type</p>
* <p>The only currently supported MIME type is <code>text/html</code>
* (XHTML 1.0 strict)</p>
*
* @param sMIME the MIME type of the target format
* @return the required <code>BatchConverter</code> or null if a converter
* for the requested MIME type could not be created
*/
public static BatchConverter createBatchConverter(String sMIME) {
Object converter = null;
if (MIMETypes.XHTML.equals(sMIME)) {
converter = createInstance("writer2latex.xhtml.BatchConverterImpl");
}
return converter instanceof BatchConverter ? (BatchConverter) converter : null;
}
/** Create a <code>StarMathConverter</code> implementation
*
* @return the converter
*/
public static StarMathConverter createStarMathConverter() {
Object converter = createInstance("writer2latex.latex.StarMathConverter");
return converter instanceof StarMathConverter ? (StarMathConverter) converter : null;
}
private static Object createInstance(String sClassName) {
try {
return Class.forName(sClassName).newInstance();
}
catch (java.lang.ClassNotFoundException e) {
return null;
}
catch (java.lang.InstantiationException e) {
return null;
}
catch (java.lang.IllegalAccessException e) {
return null;
}
}
}

View file

@ -0,0 +1,59 @@
/************************************************************************
*
* ConverterResult.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)
*
*/
package writer2latex.api;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
/** A <code>ConverterResult</code> represent a document, which is the result
* of a conversion performed by a <code>Converter</code>implementation.
*/
public interface ConverterResult {
/** Get the master document
* @return <code>OutputFile</code> the master document
*/
public OutputFile getMasterDocument();
/** Gets an <code>Iterator</code> to access all files in the
* <code>ConverterResult</code>. This <em>includes</em> the master document.
* @return an <code>Iterator</code> of all files
*/
public Iterator iterator();
/** Write all files of the <code>ConverterResult</code> to a directory.
* Subdirectories are created as required by the individual
* <code>OutputFile</code>s.
* @param dir the directory to write to (this directory must exist).
If the parameter is null, the default directory is used
* @throws IOException if the directory does not exist or one or more files
* could not be written
*/
public void write(File dir) throws IOException;
}

View file

@ -0,0 +1,58 @@
/************************************************************************
*
* GraphicConverter.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-23)
*
*/
package writer2latex.api;
/** A simple interface for a graphic converter which converts between various
* graphics formats
*/
public interface GraphicConverter {
/** Check whether a certain conversion is supported by the converter
*
* @param sSourceMime a string containing the source Mime type
* @param sTargetMime a string containing the target Mime type
* @param bCrop true if the target graphic should be cropped
* @param bResize true if the target graphic should be resized
* (the last two parameters are for future use)
* @return true if the conversion is supported
*/
public boolean supportsConversion(String sSourceMime, String sTargetMime, boolean bCrop, boolean bResize);
/** Convert a graphics file from one format to another
*
* @param source a byte array containing the source graphic
* @param sSourceMime a string containing the Mime type of the source
* @param sTargetMime a string containing the desired Mime type of the target
* @return a byte array containing the converted graphic. Returns null
* if the conversion failed.
*/
public byte[] convert(byte[] source, String sSourceMime, String sTargetMime);
}

View file

@ -0,0 +1,141 @@
/************************************************************************
*
* IndexPageEntry.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-2009 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-08)
*
*/
package writer2latex.api;
/** This class represents a single entry on an index page created by a batch converter
*/
public class IndexPageEntry {
private String sFile;
private String sDisplayName;
private String sDescription = null;
private String sPdfFile = null;
private String sOriginalFile = null;
private boolean bIsDirectory;
/** Construct a new <code>IndexPageEntry</code> based on a file name.
* The file name is also used as display name.
*
* @param sFile the file name for this entry
* @param bIsDirectory true if this is a directory, false if it is a file
*/
public IndexPageEntry(String sFile, boolean bIsDirectory) {
this.sFile = sFile;
this.sDisplayName = sFile;
this.bIsDirectory = bIsDirectory;
}
/** Set the file name
*
* @param sFile the file name
*/
public void setFile(String sFile) {
this.sFile = sFile;
}
/** Set the display name for this entry. The display name is the
* name presented on the index page.
*
* @param sDisplayName the display name
*/
public void setDisplayName(String sDisplayName) {
this.sDisplayName = sDisplayName;
}
/** Set the description of this file (additional information about the file)
*
* @param sDescription the description
*/
public void setDescription(String sDescription) {
this.sDescription = sDescription;
}
/** Set the file name for a pdf file associated with this file
*
* @param sPdfFile the file name
*/
public void setPdfFile(String sPdfFile) {
this.sPdfFile = sPdfFile;
}
/** Set the file name for the original file
*
* @param sOriginalFile the origianl file name
*/
public void setOriginalFile(String sOriginalFile) {
this.sOriginalFile = sOriginalFile;
}
/** Get the file name
*
* @return the file name
*/
public String getFile() {
return sFile;
}
/** Get the display name
*
* @return the display name
*/
public String getDisplayName() {
return sDisplayName;
}
/** Get the description
*
* @return the description, or null if there is no description
*/
public String getDescription() {
return sDescription;
}
/** Get the pdf file name
*
* @return the file name or null if there is none
*/
public String getPdfFile() {
return sPdfFile;
}
/** Get the original file name
*
* @return the file name or null if there is none
*/
public String getOriginalFile() {
return sOriginalFile;
}
/** Check whether this is a file or a directory
*
* @return true for a directory, false for a file
*/
public boolean isDirectory() {
return bIsDirectory;
}
}

View file

@ -0,0 +1,55 @@
/************************************************************************
*
* MIMETypes.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-23)
*
*/
package writer2latex.api;
/* Some helpers to handle the MIME types used by OOo
*/
public class MIMETypes {
// Various graphics formats, see
// http://api.openoffice.org/docs/common/ref/com/sun/star/graphic/MediaProperties.html#MimeType
public static final String PNG="image/png";
public static final String JPEG="image/jpeg";
public static final String GIF="image/gif";
public static final String TIFF="image/tiff";
public static final String BMP="image/bmp";
public static final String WMF="image/x-wmf";
public static final String EPS="image/x-eps";
// MIME type for SVM has changed
//public static final String SVM="image/x-svm";
public static final String SVM="application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"";
public static final String PDF="application/pdf";
// Desitination formats
public static final String XHTML="text/html";
public static final String XHTML_MATHML="application/xhtml+xml";
public static final String XHTML_MATHML_XSL="application/xml";
public static final String LATEX="application/x-latex";
public static final String BIBTEX="application/x-bibtex";
public static final String TEXT="text";
}

View file

@ -0,0 +1,53 @@
/************************************************************************
*
* OutputFile.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-23)
*
*/
package writer2latex.api;
import java.io.OutputStream;
import java.io.IOException;
/** An <code>OutputFile</code> represent a single file in a
* {@link ConverterResult}, which is output from a {@link Converter}
* implementation.
*/
public interface OutputFile {
/** Writes the <code>OutputFile</code> to an <code>OutputStream</code>.
*
* @param os <code>OutputStream</code> to which the content should be written
* @throws IOException if any I/O error occurs
*/
public void write(OutputStream os) throws IOException;
/** Returns the file name of the <code>OutputFile</code>. This includes
* the file extension and may also include a relative path, always using
* / as separator.
*
* @return the file name of this <code>OutputFile</code>
*/
public String getFileName();
}

View file

@ -0,0 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>The package writer2latex.api</title>
</head>
<body>
<p>This package contains the api for using Writer2LaTeX.</p>
<p>The api consitst of a factory class and a number of interfaces, and is
used by the command line application as well as by the filters.
</body>
</html>

View file

@ -0,0 +1,61 @@
/************************************************************************
*
* StarMathConverter.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-23)
*
*/
package writer2latex.api;
//import java.io.InputStream;
//import java.io.IOException;
/** This is an interface for a converter, which offers conversion of
* a StarMath formula into LaTeX
* Instances of this interface are created using the
* {@link ConverterFactory}
*/
public interface StarMathConverter {
/** Get the configuration used when converting.
*
* @return the configuration used by this converter
*/
public Config getConfig();
/** Convert a StarMath formula
*
* @param sStarMathFormula is a string containing the StarMath formula
* @return a string containing the converted LaTeX formula
*/
public String convert(String sStarMathFormula);
/** Create a suitable LaTeX preamble to process the formulas converted so far
*
* @return a string containg the entire LaTeX preamble
*/
public String getPreamble();
}