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-03-02)
* Version 1.2 (2010-03-15)
*
*/
@ -69,7 +69,7 @@ public class BatchConverterImpl extends BatchConverterBase {
}
public void readTemplate(InputStream is) throws IOException {
template = new XhtmlDocument("Template",XhtmlDocument.XHTML10);
template = new XhtmlDocument("Template",XhtmlDocument.XHTML10,-1);
try {
template.read(is);
}
@ -89,7 +89,7 @@ public class BatchConverterImpl extends BatchConverterBase {
public OutputFile createIndexFile(String sHeading, IndexPageEntry[] entries) {
// Create the index page (with header/footer or from template)
XhtmlDocument htmlDoc = new XhtmlDocument("index",XhtmlDocument.XHTML10);
XhtmlDocument htmlDoc = new XhtmlDocument("index",XhtmlDocument.XHTML10,0);
htmlDoc.setConfig(config);
if (template!=null) { htmlDoc.readFromTemplate(template); }
else { htmlDoc.createHeaderFooter(); }

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2010-03-02)
* Version 1.2 (2010-03-15)
*
*/
@ -102,7 +102,7 @@ public class Converter extends ConverterBase {
// override
public void readTemplate(InputStream is) throws IOException {
template = new XhtmlDocument("Template",nType);
template = new XhtmlDocument("Template",nType,-1);
template.read(is);
}
@ -441,7 +441,7 @@ public class Converter extends ConverterBase {
// Prepare next output file
public Element nextOutFile() {
if (nOutFileIndex>=0) { textCv.insertFootnotes(htmlDoc.getContentNode()); }
htmlDoc = new XhtmlDocument(getOutFileName(++nOutFileIndex,false),nType);
htmlDoc = new XhtmlDocument(getOutFileName(++nOutFileIndex,false),nType,nOutFileIndex);
htmlDoc.setConfig(config);
if (template!=null) { htmlDoc.readFromTemplate(template); }
else if (bNeedHeaderFooter) { htmlDoc.createHeaderFooter(); }

View file

@ -20,13 +20,12 @@
*
* All Rights Reserved.
*
* Version 1.2 (2010-03-04)
* Version 1.2 (2010-03-15)
*
*/
package writer2latex.xhtml;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Element;

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2010-03-03)
* Version 1.2 (2010-03-15)
*
*/
@ -42,6 +42,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
//import javax.xml.parsers.ParserConfigurationException;
import writer2latex.api.MIMETypes;
import writer2latex.xmerge.DOMDocument;
import java.io.InputStream;
@ -77,6 +78,9 @@ public class XhtmlDocument extends DOMDocument {
// Type of document
private int nType;
// Sequence number
private int nSequenceNumber;
// Configuration
private String sEncoding = "UTF-8";
@ -111,10 +115,12 @@ public class XhtmlDocument extends DOMDocument {
* writer2latex.xmerge.DOMDocument.
* @param name <code>Document</code> name.
* @param nType the type of document
* @param nSequenceNumber the sequence number of this file in the export
*/
public XhtmlDocument(String name, int nType) {
public XhtmlDocument(String name, int nType, int nSequenceNumber) {
super(name,sExtension[nType]);
this.nType = nType;
this.nSequenceNumber = nSequenceNumber;
// Define publicId and systemId
String sPublicId = null;
String sSystemId = null;
@ -161,6 +167,20 @@ public class XhtmlDocument extends DOMDocument {
setContentDOM(contentDOM);
}
@Override public String getMIMEType() {
switch (nType) {
case XHTML10: return MIMETypes.XHTML;
case XHTML11: return MIMETypes.XHTML_MATHML; // TODO: Change the constant names in MIMETypes, this is a bit confusing...
case XHTML_MATHML: return MIMETypes.XHTML_MATHML;
case XHTML_MATHML_XSL: return MIMETypes.XHTML_MATHML_XSL;
}
return "";
}
@Override public int getSequenceNumber() {
return nSequenceNumber;
}
public Element getHeadNode() { return headNode; }