Writer2xhtml custom config ui + API changes

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@53 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2010-03-15 08:49:05 +00:00
parent 6c82e57709
commit e0cb22dd2e
23 changed files with 221 additions and 43 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2010-02-26)
* Version 1.2 (2010-03-15)
*
*/
@ -57,7 +57,7 @@ public final class ConverterPalette extends ConverterBase {
// The main outfile
private LaTeXDocument texDoc;
// Various data used in conversion
private Context mainContext; // main context
private CSVList globalOptions; // global options
@ -174,7 +174,7 @@ public final class ConverterPalette extends ConverterBase {
info = new Info(ofr,config,this);
// Create master document and add this
this.texDoc = new LaTeXDocument(sTargetFileName,config.getWrapLinesAfter());
this.texDoc = new LaTeXDocument(sTargetFileName,config.getWrapLinesAfter(),0);
if (config.getBackend()!=LaTeXConfig.XETEX) {
texDoc.setEncoding(ClassicI18n.writeJavaEncoding(config.getInputencoding()));
}

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2010-02-19)
* Version 1.2 (2010-03-15)
*
*/
@ -490,7 +490,7 @@ public class DrawConverter extends ConverterHelper {
public void flushFloatingFrames(LaTeXDocumentPortion ldp, Context oc) {
// todo: fix language
LinkedList floatingFrames = floatingFramesStack.peek();
LinkedList<Element> floatingFrames = floatingFramesStack.peek();
int n = floatingFrames.size();
if (n==0) { return; }
for (int i=0; i<n; i++) {

View file

@ -16,16 +16,17 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2008 by Henrik Just
* Copyright: 2002-2010 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.0 (2008-11-23)
* Version 1.2 (2010-03-15)
*
*/
package writer2latex.latex;
import writer2latex.api.MIMETypes;
import writer2latex.xmerge.Document;
import java.io.IOException;
@ -47,6 +48,8 @@ public class LaTeXDocument implements Document {
private int nWrap;
private LaTeXDocumentPortion contents;
private int nSequenceNumber = -1;
/**
* <p>Constructs a new LaTeX Document.</p>
@ -56,10 +59,12 @@ public class LaTeXDocument implements Document {
*
* @param sName The name of the <code>LaTeXDocument</code>.
* @param nWrap Lines should be wrapped after this position
* @param nSequenceNumber this file has this sequence number in the result
*/
public LaTeXDocument(String sName,int nWrap) {
public LaTeXDocument(String sName,int nWrap, int nSequenceNumber) {
this.nWrap = nWrap;
this.sName = trimDocumentName(sName);
this.nSequenceNumber = nSequenceNumber;
contents = new LaTeXDocumentPortion(true);
}
@ -95,7 +100,14 @@ public class LaTeXDocument implements Document {
return new String(sName + FILE_EXTENSION);
}
public String getMIMEType() {
return MIMETypes.LATEX;
}
public int getSequenceNumber() {
return nSequenceNumber;
}
/**
* <p>Writes out the <code>Document</code> content to the specified
* <code>OutputStream</code>.</p>
@ -148,5 +160,6 @@ public class LaTeXDocument implements Document {
return name;
}
}

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2009 by Henrik Just
* Copyright: 2002-2010 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-17)
* Version 1.2 (2010-03-15)
*
*/
@ -45,6 +45,9 @@ public class SectionConverter extends ConverterHelper {
// Filenames for external sections
private ExportNameCollection fileNames = new ExportNameCollection(true);
// Current sequence number (until this class creates further LaTeX files, the master file is the only document)
private int nSequenceNumber = 0;
/** <p>Constructs a new <code>SectionStyleConverter</code>.</p>
*/
@ -80,7 +83,7 @@ public class SectionConverter extends ConverterHelper {
LaTeXDocumentPortion sectionLdp = ldp;
if (sFileName!=null) {
LaTeXDocument newDoc = new LaTeXDocument(sFileName,config.getWrapLinesAfter());
LaTeXDocument newDoc = new LaTeXDocument(sFileName,config.getWrapLinesAfter(),++nSequenceNumber);
if (config.getBackend()!=LaTeXConfig.XETEX) {
newDoc.setEncoding(ClassicI18n.writeJavaEncoding(config.getInputencoding()));
}

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2009 by Henrik Just
* Copyright: 2002-2010 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2009-03-26)
* Version 1.2 (2010-03-15)
*
*/
@ -286,9 +286,9 @@ public class ClassicI18n extends I18n {
// Load babel with the used languages
CSVList babelopt = new CSVList(",");
Iterator langiter = languages.iterator();
Iterator<String> langiter = languages.iterator();
while (langiter.hasNext()) {
String sLang = (String) langiter.next();
String sLang = langiter.next();
if (!sLang.equals(sDefaultLanguage)) {
if ("el".equals(sLang) && this.polytonicGreek()) {
babelopt.addValue("polutonikogreek");