Some minor bugfixing, refactoring and rearrangement

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@165 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2014-08-27 07:25:22 +00:00
parent 8a6e654344
commit 6249ef406e
31 changed files with 146 additions and 288 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.4 (2014-08-10)
* Version 1.4 (2014-08-27)
*
*/
@ -125,19 +125,19 @@ public final class ConverterPalette extends ConverterBase {
public void convertInner() throws IOException {
sTargetFileName = Misc.trimDocumentName(sTargetFileName,".tex");
String sSafeTargetFileName = new ExportNameCollection(true).getExportName(sTargetFileName);
imageLoader.setBaseFileName(sSafeTargetFileName+"-img");
imageConverter.setBaseFileName(sSafeTargetFileName+"-img");
if (config.saveImagesInSubdir()) {
imageLoader.setUseSubdir(sSafeTargetFileName+"-img");
imageConverter.setUseSubdir(sSafeTargetFileName+"-img");
}
// Set graphics formats depending on backend
if (config.getBackend()==LaTeXConfig.PDFTEX || config.getBackend()==LaTeXConfig.XETEX) {
imageLoader.setDefaultFormat(MIMETypes.PNG);
imageLoader.setDefaultVectorFormat(MIMETypes.PDF);
imageLoader.addAcceptedFormat(MIMETypes.JPEG);
imageConverter.setDefaultFormat(MIMETypes.PNG);
imageConverter.setDefaultVectorFormat(MIMETypes.PDF);
imageConverter.addAcceptedFormat(MIMETypes.JPEG);
}
else if (config.getBackend()==LaTeXConfig.DVIPS) {
imageLoader.setDefaultFormat(MIMETypes.EPS);
imageConverter.setDefaultFormat(MIMETypes.EPS);
}
// Other values: keep original format

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.4 (2014-08-25)
* Version 1.4 (2014-08-26)
*
*/
@ -32,6 +32,7 @@ import java.util.Stack;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import writer2latex.base.BinaryGraphicsDocument;
import writer2latex.latex.util.BeforeAfter;
import writer2latex.latex.util.Context;
import writer2latex.office.EmbeddedObject;
@ -41,7 +42,6 @@ import writer2latex.office.OfficeReader;
import writer2latex.office.XMLString;
import writer2latex.util.CSVList;
import writer2latex.util.Misc;
import writer2latex.xmerge.BinaryGraphicsDocument;
/**
* <p>This class handles draw elements.</p>
@ -312,7 +312,7 @@ public class DrawConverter extends ConverterHelper {
(config.getBackend()==LaTeXConfig.DVIPS && MIMETypes.EPS_EXT.equals(sExt)));
}
else { // embedded or base64 encoded image
BinaryGraphicsDocument bgd = palette.getImageLoader().getImage(node);
BinaryGraphicsDocument bgd = palette.getImageCv().getImage(node);
if (bgd!=null) {
palette.addDocument(bgd);
sFileName = bgd.getFileName();

View file

@ -16,21 +16,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2010 by Henrik Just
* Copyright: 2002-2014 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2010-03-28)
* Version 1.4 (2014-08-27)
*
*/
package writer2latex.latex;
import writer2latex.api.MIMETypes;
import writer2latex.xmerge.Document;
import writer2latex.api.OutputFile;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@ -38,7 +36,7 @@ import java.io.OutputStreamWriter;
* <p>Class representing a LaTeX document.</p>
*
*/
public class LaTeXDocument implements Document {
public class LaTeXDocument implements OutputFile {
private static final String FILE_EXTENSION = ".tex";
private String sName;
@ -68,19 +66,6 @@ public class LaTeXDocument implements Document {
contents = new LaTeXDocumentPortion(true);
}
/**
* <p>This method is supposed to read <code>byte</code> data from the InputStream.
* Currently it does nothing, since we don't need it.</p>
*
* @param is InputStream containing a LaTeX data file.
*
* @throws IOException In case of any I/O errors.
*/
public void read(InputStream is) throws IOException {
// Do nothing.
}
/**
* <p>Returns the <code>Document</code> name with no file extension.</p>
*

View file

@ -146,7 +146,7 @@ public final class MathConverter extends ConverterHelper {
/** Try to convert a draw:frame or draw:g element as an (inline) TexMaths or OOoLaTeX equation
*
* @param the element containing the equation (draw:frame or draw:g)
* @param node the element containing the equation (draw:frame or draw:g)
* @param ldp the LaTeXDocumentPortion to contain the converted equation
*
* @return true if this elements happen to be a TexMaths equation, otherwise false