Writer2xhtml custom config ui + EPUB export
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@55 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
a58ea7fa19
commit
ce61f7bc3b
41 changed files with 1118 additions and 212 deletions
|
@ -161,6 +161,7 @@
|
|||
<include name="org/openoffice/da/comp/writer2xhtml/**/*.class"/>
|
||||
<include name="writer2latex/api/**/*.class"/>
|
||||
<include name="writer2latex/base/**/*.class"/>
|
||||
<include name="writer2latex/epub/**/*.class"/>
|
||||
<include name="writer2latex/office/**/*.class"/>
|
||||
<include name="writer2latex/util/**/*.class"/>
|
||||
<include name="writer2latex/xhtml/**/*.class"/>
|
||||
|
|
|
@ -2,12 +2,19 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
|
|||
|
||||
---------- version 1.1.2 ----------
|
||||
|
||||
[all] API change: The interface ConverterResult supports additional methods
|
||||
to access the main document flow as a List, an "external" table of contents
|
||||
and meta data of the source document. New interfaces TocEntry and MetaData
|
||||
have been introduced to support this.
|
||||
[w2x] Added EPUB export
|
||||
|
||||
[all] API change: New method getMIMEType() added to the OutputFile interface
|
||||
[all] API change: The interface ConverterResult supports an additional method
|
||||
to access the meta data of the source document. A new interface MetaData has
|
||||
been introduced to support this
|
||||
|
||||
[all] API change: The interface ConverterResult supports additional methods
|
||||
providing pointers to headings and index tables in the document.
|
||||
A new interface TocEntry has been introduced to support this
|
||||
|
||||
[all] API change: New methods getMIMEType() and isMasterDocument() added to the OutputFile
|
||||
interface. The latter is used to identify files that are part of the main document flow
|
||||
(only the XHTML export generates more that one master document currently)
|
||||
|
||||
[w2x] Added user interface to edit custom configuration
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-22)
|
||||
* Version 1.2 (2010-03-26)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -354,11 +354,11 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
|
|||
config.setOption(sConfigName, Boolean.toString(dlg.getCheckBoxStateAsBoolean(sCheckBoxName)));
|
||||
}
|
||||
|
||||
protected void textBoxFromConfig(DialogAccess dlg, String sTextBoxName, String sConfigName) {
|
||||
protected void textFieldFromConfig(DialogAccess dlg, String sTextBoxName, String sConfigName) {
|
||||
dlg.setTextFieldText(sTextBoxName, config.getOption(sConfigName));
|
||||
}
|
||||
|
||||
protected void textBoxToConfig(DialogAccess dlg, String sTextBoxName, String sConfigName) {
|
||||
protected void textFieldToConfig(DialogAccess dlg, String sTextBoxName, String sConfigName) {
|
||||
config.setOption(sConfigName, dlg.getTextFieldText(sTextBoxName));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-22)
|
||||
* Version 1.2 (2010-03-26)
|
||||
*
|
||||
*/
|
||||
package org.openoffice.da.comp.writer2xhtml;
|
||||
|
@ -69,9 +69,11 @@ public class ConfigurationDialog extends ConfigurationDialogBase implements XSer
|
|||
|
||||
pageHandlers.put("General", new GeneralHandler());
|
||||
//pageHandlers.put("Template", new TemplateHandler());
|
||||
pageHandlers.put("Stylesheets", new StylesheetsHandler());
|
||||
pageHandlers.put("Formatting", new FormattingHandler());
|
||||
//pageHandlers.put("Styles1", new StylesPartIHandler());
|
||||
//pageHandlers.put("Styles2", new StylesPartIIHandler());
|
||||
pageHandlers.put("Formatting", new FormattingHandler());
|
||||
//pageHandlers.put("StylesPartI", new StylesPartIHandler());
|
||||
//pageHandlers.put("StylesPartII", new StylesPartIIHandler());
|
||||
pageHandlers.put("Content", new ContentHandler());
|
||||
}
|
||||
|
||||
|
@ -133,6 +135,57 @@ public class ConfigurationDialog extends ConfigurationDialogBase implements XSer
|
|||
|
||||
}
|
||||
|
||||
private class StylesheetsHandler extends PageHandler {
|
||||
|
||||
@Override protected void setControls(DialogAccess dlg) {
|
||||
dlg.setCheckBoxStateAsBoolean("UseCustomStylesheet", config.getOption("custom_stylesheet").length()>0);
|
||||
textFieldFromConfig(dlg, "CustomStylesheet", "custom_stylesheet");
|
||||
|
||||
useCustomStylesheetChange(dlg);
|
||||
includeCustomStylesheetChange(dlg);
|
||||
}
|
||||
|
||||
@Override protected void getControls(DialogAccess dlg) {
|
||||
if (dlg.getCheckBoxStateAsBoolean("UseCustomStylesheet")) {
|
||||
textFieldToConfig(dlg, "CustomStylesheet", "custom_stylesheet");
|
||||
}
|
||||
else {
|
||||
config.setOption("custom_stylesheet", "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected boolean handleEvent(DialogAccess dlg, String sMethod) {
|
||||
if (sMethod.equals("UseCustomStylesheetChange")) {
|
||||
useCustomStylesheetChange(dlg);
|
||||
return true;
|
||||
}
|
||||
else if (sMethod.equals("IncludeCustomStylesheetChange")) {
|
||||
includeCustomStylesheetChange(dlg);
|
||||
return true;
|
||||
}
|
||||
else if (sMethod.equals("LoadButtonClick")) {
|
||||
loadButtonClick(dlg);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void useCustomStylesheetChange(DialogAccess dlg) {
|
||||
boolean bUseCustomStylesheet = dlg.getCheckBoxStateAsBoolean("UseCustomStylesheet");
|
||||
dlg.setControlEnabled("CustomStylesheetLabel", bUseCustomStylesheet);
|
||||
dlg.setControlEnabled("CustomStylesheet", bUseCustomStylesheet);
|
||||
}
|
||||
|
||||
private void includeCustomStylesheetChange(DialogAccess dlg) {
|
||||
dlg.setControlEnabled("IncludedCustomStylesheet", dlg.getCheckBoxStateAsBoolean("IncludeCustomStylesheet"));
|
||||
}
|
||||
|
||||
private void loadButtonClick(DialogAccess dlg) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class FormattingHandler extends PageHandler {
|
||||
private final String[] sExportValues = { "convert_all", "ignore_styles", "ignore_hard", "ignore_all" };
|
||||
|
||||
|
|
|
@ -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-06-11)
|
||||
* Version 1.2 (2010-03-29)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -46,13 +46,13 @@ import writer2latex.api.MIMETypes;
|
|||
import writer2latex.util.Misc;
|
||||
|
||||
/**
|
||||
* <p>Commandline utility to convert an OpenOffice.org Writer XML file into XHTML/LaTeX/BibTeX</p>
|
||||
* <p>Command line utility to convert an OpenOffice.org Writer XML file into XHTML/LaTeX/BibTeX</p>
|
||||
* <p>The utility is invoked with the following command line:</p>
|
||||
* <pre>java -jar writer2latex.jar [options] source [target]</pre>
|
||||
* <p>Where the available options are
|
||||
* <ul>
|
||||
* <li><code>-latex</code>, <code>-bibtex</code>, <code>-xhtml</code>,
|
||||
<code>-xhtml+mathml</code>, <code>-xhtml+mathml+xsl</code>
|
||||
<code>-xhtml+mathml</code>, <code>-xhtml+mathml+xsl</code>, <code>-epub</code>
|
||||
* <li><code>-recurse</code>
|
||||
* <li><code>-ultraclean</code>, <code>-clean</code>, <code>-pdfscreen</code>,
|
||||
* <code>-pdfprint</code>, <code>-cleanxhtml</code>
|
||||
|
@ -279,6 +279,7 @@ public final class Application {
|
|||
System.out.println(" -xhtml11");
|
||||
System.out.println(" -xhtml+mathml");
|
||||
System.out.println(" -xhtml+mathml+xsl");
|
||||
System.out.println(" -epub");
|
||||
System.out.println(" -recurse");
|
||||
System.out.println(" -template[=]<template file>");
|
||||
System.out.println(" -ultraclean");
|
||||
|
@ -312,6 +313,7 @@ public final class Application {
|
|||
else if ("-xhtml11".equals(sArg)) { sTargetMIME = MIMETypes.XHTML11; }
|
||||
else if ("-xhtml+mathml".equals(sArg)) { sTargetMIME = MIMETypes.XHTML_MATHML; }
|
||||
else if ("-xhtml+mathml+xsl".equals(sArg)) { sTargetMIME = MIMETypes.XHTML_MATHML_XSL; }
|
||||
else if ("-epub".equals(sArg)) { sTargetMIME = MIMETypes.EPUB; }
|
||||
else if ("-recurse".equals(sArg)) { bRecurse = true; }
|
||||
else if ("-ultraclean".equals(sArg)) { configFileNames.add("*ultraclean.xml"); }
|
||||
else if ("-clean".equals(sArg)) { configFileNames.add("*clean.xml"); }
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-12)
|
||||
* Version 1.2 (2010-03-29)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -33,11 +33,12 @@ public class ConverterFactory {
|
|||
|
||||
// Version information
|
||||
private static final String VERSION = "1.1.2";
|
||||
private static final String DATE = "2010-03-14";
|
||||
private static final String DATE = "2010-03-29";
|
||||
|
||||
/** Return version information
|
||||
* @return the Writer2LaTeX version in the form
|
||||
* (major version).(minor version).(development version).(patch level)
|
||||
/** Return the Writer2LaTeX version in the form
|
||||
* (major version).(minor version).(patch level)<br/>
|
||||
* Development versions have an odd minor version number
|
||||
* @return the version number
|
||||
*/
|
||||
public static String getVersion() { return VERSION; }
|
||||
|
||||
|
@ -60,6 +61,7 @@ public class ConverterFactory {
|
|||
* <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>
|
||||
* <li><code>application/epub+zip</code></li> for EPUB format
|
||||
* </ul>
|
||||
*
|
||||
* @param sMIME the MIME type of the target format
|
||||
|
@ -86,6 +88,9 @@ public class ConverterFactory {
|
|||
else if (MIMETypes.XHTML_MATHML_XSL.equals(sMIME)) {
|
||||
converter = createInstance("writer2latex.xhtml.XhtmlMathMLXSLConverter");
|
||||
}
|
||||
else if (MIMETypes.EPUB.equals(sMIME)) {
|
||||
converter = createInstance("writer2latex.epub.EPUBConverter");
|
||||
}
|
||||
return converter instanceof Converter ? (Converter) converter : null;
|
||||
}
|
||||
|
||||
|
@ -117,7 +122,7 @@ public class ConverterFactory {
|
|||
|
||||
private static Object createInstance(String sClassName) {
|
||||
try {
|
||||
return Class.forName(sClassName).newInstance();
|
||||
return Class.forName(sClassName).newInstance();
|
||||
}
|
||||
catch (java.lang.ClassNotFoundException e) {
|
||||
return null;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-16)
|
||||
* Version 1.2 (2010-03-28)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -29,6 +29,7 @@ package writer2latex.api;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/** A <code>ConverterResult</code> represent a document, which is the result
|
||||
* of a conversion performed by a <code>Converter</code>implementation.
|
||||
|
@ -36,12 +37,16 @@ import java.util.Iterator;
|
|||
public interface ConverterResult {
|
||||
|
||||
/** Get the master document
|
||||
* Deprecated as of Writer2LaTeX 1.2: The master document is always the first document
|
||||
* returned by the <code>iterator</code>
|
||||
*
|
||||
* @return <code>OutputFile</code> the master document
|
||||
*/
|
||||
public OutputFile getMasterDocument();
|
||||
@Deprecated public OutputFile getMasterDocument();
|
||||
|
||||
/** Gets an <code>Iterator</code> to access all files in the
|
||||
* <code>ConverterResult</code>. This <em>includes</em> the master document.
|
||||
* <code>ConverterResult</code>. The iterator will return the master documents first
|
||||
* in logical order (starting with the primary master document)
|
||||
* @return an <code>Iterator</code> of all files
|
||||
*/
|
||||
public Iterator<OutputFile> iterator();
|
||||
|
@ -51,6 +56,37 @@ public interface ConverterResult {
|
|||
*/
|
||||
public MetaData getMetaData();
|
||||
|
||||
/** Get the content table (based on headings) for this <code>ConverterResult</code>
|
||||
*
|
||||
* @return list view of the content
|
||||
*/
|
||||
public List<ContentEntry> getContent();
|
||||
|
||||
/** Get the entry which contains the table of contents
|
||||
*
|
||||
* @return the entry
|
||||
*/
|
||||
public ContentEntry getTocFile();
|
||||
|
||||
|
||||
/** Get the entry which contains the list of tables
|
||||
*
|
||||
* @return the entry
|
||||
*/
|
||||
public ContentEntry getLotFile();
|
||||
|
||||
/** Get the entry which contains the list of figures
|
||||
*
|
||||
* @return the entry
|
||||
*/
|
||||
public ContentEntry getLofFile();
|
||||
|
||||
/** Get the entry which contains the alphabetical index
|
||||
*
|
||||
* @return the entry
|
||||
*/
|
||||
public ContentEntry getIndexFile();
|
||||
|
||||
/** Write all files of the <code>ConverterResult</code> to a directory.
|
||||
* Subdirectories are created as required by the individual
|
||||
* <code>OutputFile</code>s.
|
||||
|
|
|
@ -16,17 +16,17 @@
|
|||
* 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-05-29)
|
||||
* Version 1.2 (2010-03-29)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.api;
|
||||
|
||||
/* Some helpers to handle the MIME types used by OOo
|
||||
/* Some helpers to handle the MIME types used by OOo and Writer2LaTeX
|
||||
*/
|
||||
|
||||
public class MIMETypes {
|
||||
|
@ -50,6 +50,7 @@ public class MIMETypes {
|
|||
public static final String XHTML11="application/xhtml11";
|
||||
public static final String XHTML_MATHML="application/xhtml+xml";
|
||||
public static final String XHTML_MATHML_XSL="application/xml";
|
||||
public static final String EPUB="application/epub+zip";
|
||||
public static final String LATEX="application/x-latex";
|
||||
public static final String BIBTEX="application/x-bibtex";
|
||||
public static final String TEXT="text";
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-15)
|
||||
* Version 1.2 (2010-03-28)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -29,7 +29,7 @@ package writer2latex.api;
|
|||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/** An <code>OutputFile</code> represent a single file in a
|
||||
/** An <code>OutputFile</code> represents a single file in a
|
||||
* {@link ConverterResult}, which is output from a {@link Converter}
|
||||
* implementation.
|
||||
*/
|
||||
|
@ -56,4 +56,10 @@ public interface OutputFile {
|
|||
*/
|
||||
public String getMIMEType();
|
||||
|
||||
/** Test whether this document is part of the main document flow (master documents) or
|
||||
* an auxiliary document
|
||||
*
|
||||
* @return true if this document is a master document
|
||||
*/
|
||||
public boolean isMasterDocument();
|
||||
}
|
||||
|
|
60
source/java/writer2latex/base/ContentEntryImpl.java
Normal file
60
source/java/writer2latex/base/ContentEntryImpl.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* ConverterResultImpl.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-2010 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-24)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.base;
|
||||
|
||||
import writer2latex.api.ContentEntry;
|
||||
import writer2latex.api.OutputFile;
|
||||
|
||||
public class ContentEntryImpl implements ContentEntry {
|
||||
private String sTitle;
|
||||
private int nLevel;
|
||||
private OutputFile file;
|
||||
private String sTarget;
|
||||
|
||||
public ContentEntryImpl(String sTitle, int nLevel, OutputFile file, String sTarget) {
|
||||
this.sTitle = sTitle;
|
||||
this.nLevel = nLevel;
|
||||
this.file = file;
|
||||
this.sTarget = sTarget;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return sTitle;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return nLevel;
|
||||
}
|
||||
|
||||
public OutputFile getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public String getTarget() {
|
||||
return sTarget;
|
||||
}
|
||||
}
|
|
@ -16,11 +16,11 @@
|
|||
* 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-29)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -31,7 +31,6 @@ import java.io.FileInputStream;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import writer2latex.api.GraphicConverter;
|
||||
import writer2latex.api.Converter;
|
||||
import writer2latex.api.ConverterResult;
|
||||
|
@ -57,12 +56,12 @@ public abstract class ConverterBase implements Converter {
|
|||
|
||||
// The output file(s)
|
||||
protected String sTargetFileName;
|
||||
protected ConverterResultImpl convertData;
|
||||
protected ConverterResultImpl converterResult;
|
||||
|
||||
// Constructor
|
||||
public ConverterBase() {
|
||||
graphicConverter = null;
|
||||
convertData = new ConverterResultImpl();
|
||||
converterResult = new ConverterResultImpl();
|
||||
}
|
||||
|
||||
// Implement the interface
|
||||
|
@ -91,11 +90,16 @@ public abstract class ConverterBase implements Converter {
|
|||
|
||||
// Prepare output
|
||||
this.sTargetFileName = sTargetFileName;
|
||||
convertData.reset();
|
||||
converterResult.reset();
|
||||
|
||||
converterResult.setMetaData(metaData);
|
||||
if (metaData.getLanguage()==null || metaData.getLanguage().length()==0) {
|
||||
metaData.setLanguage(ofr.getMajorityLanguage());
|
||||
}
|
||||
|
||||
convertInner();
|
||||
|
||||
return convertData;
|
||||
|
||||
return converterResult;
|
||||
}
|
||||
|
||||
// The subclass must provide the implementation
|
||||
|
@ -105,7 +109,7 @@ public abstract class ConverterBase implements Converter {
|
|||
|
||||
public ImageLoader getImageLoader() { return imageLoader; }
|
||||
|
||||
public void addDocument(OutputFile doc) { convertData.addDocument(doc); }
|
||||
public void addDocument(OutputFile doc) { converterResult.addDocument(doc); }
|
||||
|
||||
public EmbeddedObject getEmbeddedObject(String sHref) {
|
||||
return odDoc.getEmbeddedObject(sHref);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-22)
|
||||
* Version 1.2 (2010-03-28)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -29,125 +29,164 @@ package writer2latex.base;
|
|||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import java.util.Iterator;
|
||||
|
||||
import writer2latex.api.ConverterResult;
|
||||
import writer2latex.api.MetaData;
|
||||
import writer2latex.api.OutputFile;
|
||||
import writer2latex.api.ContentEntry;
|
||||
|
||||
/**
|
||||
* <p><code>ConvertData</code> is used as a container for passing
|
||||
* <code>OutputFile</code> objects in and out of the <code>Convert</code>
|
||||
* class. The <code>ConvertData</code> contains a <code>String</code>
|
||||
* name and a <code>Vector</code> of <code>OutputFile</code> objects.</p>
|
||||
*
|
||||
* @author Martin Maher
|
||||
* TODO: Rewrite to support extended API
|
||||
/** <code>ConverterResultImpl</code> is a straightforward implementation of <code>ConverterResult</code>
|
||||
*/
|
||||
public class ConverterResultImpl implements ConverterResult {
|
||||
|
||||
/**
|
||||
* Vector of <code>OutputFile</code> objects.
|
||||
*/
|
||||
private Vector<OutputFile> v = new Vector<OutputFile>();
|
||||
private List<OutputFile> files;
|
||||
|
||||
/** Master doc */
|
||||
private OutputFile masterDoc = null;
|
||||
|
||||
/**
|
||||
* Name of the <code>ConvertData</code> object.
|
||||
*/
|
||||
private String name;
|
||||
private List<ContentEntry> content;
|
||||
private ContentEntry tocFile;
|
||||
private ContentEntry lofFile;
|
||||
private ContentEntry lotFile;
|
||||
private ContentEntry indexFile;
|
||||
|
||||
private MetaData metaData = null;
|
||||
|
||||
|
||||
/**
|
||||
* Resets ConvertData. This empties all <code>OutputFile</code>
|
||||
* objects from this class. This allows reuse of a
|
||||
* <code>ConvertData</code>.
|
||||
*/
|
||||
public void reset() {
|
||||
name = null;
|
||||
v.removeAllElements();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>OutputFile</code> name.
|
||||
*
|
||||
* @return The <code>OutputFile</code> name.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the <code>OutputFile</code> name.
|
||||
*
|
||||
* @param docName The name of the <code>OutputFile</code>.
|
||||
*/
|
||||
public void setName(String docName) {
|
||||
name = docName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a <code>OutputFile</code> to the vector.
|
||||
*
|
||||
* @param doc The <code>OutputFile</code> to add.
|
||||
*/
|
||||
public void addDocument(OutputFile doc) {
|
||||
if (v.size()==0) { masterDoc = doc; }
|
||||
v.add(doc);
|
||||
private int nMasterCount;
|
||||
|
||||
/** Construct a new <code>ConverterResultImpl</code> with empty content
|
||||
*/
|
||||
public ConverterResultImpl() {
|
||||
reset();
|
||||
}
|
||||
|
||||
/** Get the master document
|
||||
/** Resets all data. This empties all <code>OutputFile</code> and <code>ContentEntry</code> objects
|
||||
* objects from this class. This allows reuse of a <code>ConvertResult</code> object.
|
||||
*/
|
||||
public void reset() {
|
||||
files = new Vector<OutputFile>();
|
||||
content = new Vector<ContentEntry>();
|
||||
tocFile = null;
|
||||
lofFile = null;
|
||||
lotFile = null;
|
||||
indexFile = null;
|
||||
metaData = null;
|
||||
nMasterCount = 0;
|
||||
}
|
||||
|
||||
/** Adds an <code>OutputFile</code> to the list
|
||||
*
|
||||
* @param file The <code>OutputFile</code> to add.
|
||||
*/
|
||||
public void addDocument(OutputFile file) {
|
||||
if (file.isMasterDocument()) {
|
||||
files.add(nMasterCount++, file);
|
||||
}
|
||||
else {
|
||||
files.add(file);
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the first master document
|
||||
*
|
||||
* @return <code>OutputFile</code> the master document
|
||||
*/
|
||||
public OutputFile getMasterDocument() {
|
||||
return masterDoc;
|
||||
return files.size()>0 ? files.get(0) : null;
|
||||
}
|
||||
|
||||
/** Check if a given document is the master document
|
||||
* @param doc The <code>OutputFile</code> to check
|
||||
* @return true if this is the master document
|
||||
*/
|
||||
public boolean isMasterDocument(OutputFile doc) {
|
||||
return doc == masterDoc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets an <code>Iterator</code> to access the <code>Vector</code>
|
||||
* Gets an <code>Iterator</code> to access the <code>List</code>
|
||||
* of <code>OutputFile</code> objects
|
||||
*
|
||||
* @return The <code>Iterator</code> to access the
|
||||
* <code>Vector</code> of <code>OutputFile</code> objects.
|
||||
* <code>List</code> of <code>OutputFile</code> objects.
|
||||
*/
|
||||
public Iterator<OutputFile> iterator() {
|
||||
return v.iterator();
|
||||
return files.iterator();
|
||||
}
|
||||
|
||||
public MetaData getMetaData() {
|
||||
return metaData;
|
||||
}
|
||||
|
||||
/** Add an entry to the "external" table of contents
|
||||
*
|
||||
* @param entry the entry to add
|
||||
*/
|
||||
public void addContentEntry(ContentEntry entry) {
|
||||
content.add(entry);
|
||||
}
|
||||
|
||||
public List<ContentEntry> getContent() {
|
||||
return Collections.unmodifiableList(content);
|
||||
}
|
||||
|
||||
/** Define the entry which contains the table of contents
|
||||
*
|
||||
* @param entry the entry
|
||||
*/
|
||||
public void setTocFile(ContentEntry entry) {
|
||||
tocFile = entry;
|
||||
}
|
||||
|
||||
public ContentEntry getTocFile() {
|
||||
return tocFile;
|
||||
}
|
||||
|
||||
/** Define the entry which contains the list of figures
|
||||
*
|
||||
* @param entry the entry
|
||||
*/
|
||||
public void setLofFile(ContentEntry entry) {
|
||||
lofFile = entry;
|
||||
}
|
||||
|
||||
public ContentEntry getLofFile() {
|
||||
return lofFile;
|
||||
}
|
||||
|
||||
/** Define the entry which contains the list of tables
|
||||
*
|
||||
* @param entry the entry
|
||||
*/
|
||||
public void setLotFile(ContentEntry entry) {
|
||||
lotFile = entry;
|
||||
}
|
||||
|
||||
public ContentEntry getLotFile() {
|
||||
return lotFile;
|
||||
}
|
||||
|
||||
/** Define the entry which contains the alphabetical index
|
||||
*
|
||||
* @param entry the entry
|
||||
*/
|
||||
public void setIndexFile(ContentEntry entry) {
|
||||
indexFile = entry;
|
||||
}
|
||||
|
||||
public ContentEntry getIndexFile() {
|
||||
return indexFile;
|
||||
}
|
||||
|
||||
/** Set the meta data of this <code>ConverterResult</code>
|
||||
*
|
||||
* @param metaData the meta data
|
||||
*/
|
||||
public void setMetaData(MetaData metaData) {
|
||||
this.metaData = metaData;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the number of <code>OutputFile</code> objects currently stored
|
||||
*
|
||||
* @return The number of <code>OutputFile</code> objects currently
|
||||
* stored.
|
||||
*/
|
||||
public int getNumDocuments() {
|
||||
return (v.size());
|
||||
|
||||
/** Get the meta data of this <code>ConverterResult</code>
|
||||
*
|
||||
* @return the meta data
|
||||
*/
|
||||
public MetaData getMetaData() {
|
||||
return metaData;
|
||||
}
|
||||
|
||||
/** Write all files to a given directory
|
||||
*
|
||||
* @param dir the directory to use
|
||||
*/
|
||||
public void write(File dir) throws IOException {
|
||||
if (dir!=null && !dir.exists()) throw new IOException("Directory does not exist");
|
||||
Iterator<OutputFile> docEnum = iterator();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-15)
|
||||
* Version 1.2 (2010-03-28)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -55,6 +55,8 @@ public class BibTeXDocument implements Document {
|
|||
private Hashtable<String, BibMark> entries = new Hashtable<String, BibMark>();
|
||||
private ExportNameCollection exportNames = new ExportNameCollection("",true,"_-:");
|
||||
private I18n i18n;
|
||||
|
||||
private boolean bIsMaster;
|
||||
|
||||
/**
|
||||
* <p>Constructs a new BibTeX Document.</p>
|
||||
|
@ -64,8 +66,9 @@ public class BibTeXDocument implements Document {
|
|||
*
|
||||
* @param sName The name of the <code>BibTeXDocument</code>.
|
||||
*/
|
||||
public BibTeXDocument(String sName) {
|
||||
public BibTeXDocument(String sName, boolean bIsMaster) {
|
||||
this.sName = trimDocumentName(sName);
|
||||
this.bIsMaster = bIsMaster;
|
||||
// Use default config (only ascii, no extra font packages)
|
||||
i18n = new ClassicI18n(new LaTeXConfig());
|
||||
}
|
||||
|
@ -105,6 +108,10 @@ public class BibTeXDocument implements Document {
|
|||
public String getMIMEType() {
|
||||
return MIMETypes.BIBTEX;
|
||||
}
|
||||
|
||||
public boolean isMasterDocument() {
|
||||
return bIsMaster;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Writes out the <code>Document</code> content to the specified
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2001-2008 by Henrik Just
|
||||
* Copyright: 2001-2010 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* version 1.0 (2008-11-22)
|
||||
* version 1.2 (2010-03-28)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -70,7 +70,7 @@ public final class Converter extends ConverterBase {
|
|||
public void convertInner() throws IOException {
|
||||
sTargetFileName = Misc.trimDocumentName(sTargetFileName,".bib");
|
||||
|
||||
BibTeXDocument bibDoc = new BibTeXDocument(sTargetFileName);
|
||||
BibTeXDocument bibDoc = new BibTeXDocument(sTargetFileName,true);
|
||||
|
||||
// Collect all text:bibliography-mark elements from the content
|
||||
Element doc = ofr.getContent();
|
||||
|
@ -85,7 +85,7 @@ public final class Converter extends ConverterBase {
|
|||
}
|
||||
|
||||
// Add result
|
||||
convertData.addDocument(bibDoc);
|
||||
converterResult.addDocument(bibDoc);
|
||||
}
|
||||
|
||||
}
|
77
source/java/writer2latex/epub/ContainerWriter.java
Normal file
77
source/java/writer2latex/epub/ContainerWriter.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* ContainerWriter.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: 2001-2010 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* version 1.2 (2010-03-29)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.epub;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentType;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import writer2latex.xmerge.NewDOMDocument;
|
||||
|
||||
/** This class creates the required META-INF/container.xml file for an EPUB package
|
||||
* (see http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm)
|
||||
*/
|
||||
public class ContainerWriter extends NewDOMDocument {
|
||||
|
||||
public ContainerWriter(String sRootFile) {
|
||||
super("container", "xml");
|
||||
|
||||
// create DOM
|
||||
Document contentDOM = null;
|
||||
try {
|
||||
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder = builderFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = builder.getDOMImplementation();
|
||||
DocumentType doctype = domImpl.createDocumentType("container","","");
|
||||
contentDOM = domImpl.createDocument("urn:oasis:names:tc:opendocument:xmlns:container","container",doctype);
|
||||
}
|
||||
catch (ParserConfigurationException t) { // this should never happen
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
|
||||
// Populate the DOM tree
|
||||
Element container = contentDOM.getDocumentElement();
|
||||
container.setAttribute("version", "1.0");
|
||||
container.setAttribute("xmlns","urn:oasis:names:tc:opendocument:xmlns:container");
|
||||
|
||||
Element rootfiles = contentDOM.createElement("rootfiles");
|
||||
container.appendChild(rootfiles);
|
||||
|
||||
Element rootfile = contentDOM.createElement("rootfile");
|
||||
rootfile.setAttribute("full-path", sRootFile);
|
||||
rootfile.setAttribute("media-type", "application/oebps-package+xml");
|
||||
rootfiles.appendChild(rootfile);
|
||||
|
||||
setContentDOM(contentDOM);
|
||||
}
|
||||
|
||||
}
|
55
source/java/writer2latex/epub/EPUBConverter.java
Normal file
55
source/java/writer2latex/epub/EPUBConverter.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* EPUBConverter.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: 2001-2010 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* version 1.2 (2010-03-28)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.epub;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import writer2latex.api.ConverterResult;
|
||||
import writer2latex.base.ConverterResultImpl;
|
||||
import writer2latex.xhtml.Xhtml11Converter;
|
||||
|
||||
|
||||
/** This class converts an OpenDocument file to an EPUB document.
|
||||
*/
|
||||
public final class EPUBConverter extends Xhtml11Converter {
|
||||
|
||||
// Constructor
|
||||
public EPUBConverter() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override public ConverterResult convert(InputStream is, String sTargetFileName) throws IOException {
|
||||
ConverterResult xhtmlResult = super.convert(is, sTargetFileName);
|
||||
|
||||
ConverterResultImpl epubResult = new ConverterResultImpl();
|
||||
epubResult.addDocument(new EPUBWriter(xhtmlResult,sTargetFileName));
|
||||
epubResult.setMetaData(xhtmlResult.getMetaData());
|
||||
return epubResult;
|
||||
}
|
||||
|
||||
}
|
122
source/java/writer2latex/epub/EPUBWriter.java
Normal file
122
source/java/writer2latex/epub/EPUBWriter.java
Normal file
|
@ -0,0 +1,122 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* EPUBWriter.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: 2001-2010 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* version 1.2 (2010-03-29)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.epub;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import writer2latex.api.ConverterResult;
|
||||
import writer2latex.api.OutputFile;
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/** This class repackages an XHTML document into EPUB format
|
||||
*
|
||||
*/
|
||||
public class EPUBWriter implements OutputFile {
|
||||
|
||||
private static final byte[] mimeBytes = { 'a', 'p', 'p', 'l', 'i', 'c', 'a', 't', 'i', 'o', 'n', '/',
|
||||
'e', 'p', 'u', 'b', '+', 'z', 'i', 'p'};
|
||||
|
||||
private ConverterResult xhtmlResult;
|
||||
private String sFileName;
|
||||
|
||||
public EPUBWriter(ConverterResult xhtmlResult, String sFileName) {
|
||||
this.xhtmlResult = xhtmlResult;
|
||||
this.sFileName = Misc.removeExtension(sFileName);
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return sFileName+".epub";
|
||||
}
|
||||
|
||||
public String getMIMEType() {
|
||||
return "application/epub+zip";
|
||||
}
|
||||
|
||||
public boolean isMasterDocument() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void write(OutputStream os) throws IOException {
|
||||
ZipOutputStream zos = new ZipOutputStream(os);
|
||||
|
||||
// Write MIME type as first entry
|
||||
ZipEntry mimeEntry = new ZipEntry("mimetype");
|
||||
mimeEntry.setMethod(ZipEntry.STORED);
|
||||
mimeEntry.setCrc(0x2CAB616F);
|
||||
mimeEntry.setSize(mimeBytes.length);
|
||||
zos.putNextEntry(mimeEntry);
|
||||
zos.write(mimeBytes, 0, mimeBytes.length);
|
||||
zos.closeEntry();
|
||||
|
||||
// Write container entry next
|
||||
OutputFile containerWriter = new ContainerWriter("OEBPS/book.opf");
|
||||
ZipEntry containerEntry = new ZipEntry("META-INF/container.xml");
|
||||
zos.putNextEntry(containerEntry);
|
||||
writeZipEntry(containerWriter,zos);
|
||||
zos.closeEntry();
|
||||
|
||||
// Then manifest
|
||||
OutputFile manifest = new OPFWriter(xhtmlResult, "xxx", "book.ncx", "book.opf");
|
||||
ZipEntry manifestEntry = new ZipEntry("OEBPS/book.opf");
|
||||
zos.putNextEntry(manifestEntry);
|
||||
writeZipEntry(manifest,zos);
|
||||
zos.closeEntry();
|
||||
|
||||
// And content table
|
||||
OutputFile ncx = new NCXWriter(xhtmlResult, "xxx", "book.ncx");
|
||||
ZipEntry ncxEntry = new ZipEntry("OEBPS/book.ncx");
|
||||
zos.putNextEntry(ncxEntry);
|
||||
writeZipEntry(ncx,zos);
|
||||
zos.closeEntry();
|
||||
|
||||
// Finally XHTML content in the OEBPS sub directory
|
||||
Iterator<OutputFile> iter = xhtmlResult.iterator();
|
||||
while (iter.hasNext()) {
|
||||
OutputFile file = iter.next();
|
||||
ZipEntry entry = new ZipEntry("OEBPS/"+file.getFileName());
|
||||
zos.putNextEntry(entry);
|
||||
writeZipEntry(file, zos);
|
||||
zos.closeEntry();
|
||||
}
|
||||
|
||||
zos.close();
|
||||
}
|
||||
|
||||
private void writeZipEntry(OutputFile file, ZipOutputStream zos) throws IOException {
|
||||
// TODO: Fix this waste of memory :-)
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
file.write(baos);
|
||||
byte[] content = baos.toByteArray();
|
||||
zos.write(content, 0, content.length);
|
||||
}
|
||||
|
||||
}
|
141
source/java/writer2latex/epub/NCXWriter.java
Normal file
141
source/java/writer2latex/epub/NCXWriter.java
Normal file
|
@ -0,0 +1,141 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* NCXWriter.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: 2001-2010 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* version 1.2 (2010-03-29)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.epub;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentType;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import writer2latex.api.ContentEntry;
|
||||
import writer2latex.api.ConverterResult;
|
||||
import writer2latex.util.Misc;
|
||||
import writer2latex.xmerge.NewDOMDocument;
|
||||
|
||||
/** This class creates the required NXC file for an EPUB document
|
||||
* (see http://www.idpf.org/2007/opf/OPF_2.0_final_spec.html#Section2.4)
|
||||
*
|
||||
*/
|
||||
public class NCXWriter extends NewDOMDocument {
|
||||
|
||||
public NCXWriter(ConverterResult cr, String sUUID, String sFileName) {
|
||||
super(Misc.removeExtension(sFileName), "ncx");
|
||||
|
||||
// create DOM
|
||||
Document contentDOM = null;
|
||||
try {
|
||||
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder = builderFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = builder.getDOMImplementation();
|
||||
DocumentType doctype = domImpl.createDocumentType("ncx","","");
|
||||
contentDOM = domImpl.createDocument("http://www.daisy.org/z3986/2005/ncx/","ncx",doctype);
|
||||
}
|
||||
catch (ParserConfigurationException t) { // this should never happen
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
|
||||
System.out.println("populating the ncx");
|
||||
|
||||
// Populate the DOM tree
|
||||
Element ncx = contentDOM.getDocumentElement();
|
||||
ncx.setAttribute("version", "2005-1");
|
||||
ncx.setAttribute("xml:lang", cr.getMetaData().getLanguage());
|
||||
ncx.setAttribute("xmlns","http://www.daisy.org/z3986/2005/ncx/");
|
||||
|
||||
// The head has four required meta data items
|
||||
Element head = contentDOM.createElement("head");
|
||||
ncx.appendChild(head);
|
||||
|
||||
Element uid = contentDOM.createElement("meta");
|
||||
uid.setAttribute("name","dtb:uid");
|
||||
uid.setAttribute("content", sUUID);
|
||||
head.appendChild(uid);
|
||||
|
||||
Element depth = contentDOM.createElement("meta");
|
||||
depth.setAttribute("name","dtb:depth");
|
||||
depth.setAttribute("content", "1");
|
||||
head.appendChild(depth);
|
||||
|
||||
Element totalPageCount = contentDOM.createElement("meta");
|
||||
totalPageCount.setAttribute("name","dtb:totalPageCount");
|
||||
totalPageCount.setAttribute("content", "0");
|
||||
head.appendChild(totalPageCount);
|
||||
|
||||
Element maxPageNumber = contentDOM.createElement("meta");
|
||||
maxPageNumber.setAttribute("name","dtb:maxPageNumber");
|
||||
maxPageNumber.setAttribute("content", "0");
|
||||
head.appendChild(maxPageNumber);
|
||||
|
||||
// The ncx must contain a docTitle element
|
||||
Element docTitle = contentDOM.createElement("docTitle");
|
||||
ncx.appendChild(docTitle);
|
||||
Element docTitleText = contentDOM.createElement("text");
|
||||
docTitle.appendChild(docTitleText);
|
||||
docTitleText.appendChild(contentDOM.createTextNode(cr.getMetaData().getTitle()));
|
||||
|
||||
// Build the navMap from the content table in the converter result
|
||||
Element navMap = contentDOM.createElement("navMap");
|
||||
ncx.appendChild(navMap);
|
||||
|
||||
int nPlayOrder = 0;
|
||||
Iterator<ContentEntry> content = cr.getContent().iterator();
|
||||
while (content.hasNext()) {
|
||||
ContentEntry entry = content.next();
|
||||
//if (entry.getLevel()==1) {
|
||||
System.out.println("Found content entry "+entry.getTitle());
|
||||
Element navPoint = contentDOM.createElement("navPoint");
|
||||
navPoint.setAttribute("playOrder", Integer.toString(++nPlayOrder));
|
||||
navPoint.setAttribute("id", "text"+nPlayOrder);
|
||||
navMap.appendChild(navPoint);
|
||||
|
||||
Element navLabel = contentDOM.createElement("navLabel");
|
||||
navPoint.appendChild(navLabel);
|
||||
Element navLabelText = contentDOM.createElement("text");
|
||||
navLabel.appendChild(navLabelText);
|
||||
navLabelText.appendChild(contentDOM.createTextNode(entry.getTitle()));
|
||||
|
||||
Element navPointContent = contentDOM.createElement("content");
|
||||
String sHref = entry.getFile().getFileName();
|
||||
if (entry.getTarget()!=null) { sHref+="#"+entry.getTarget(); }
|
||||
navPointContent.setAttribute("src", sHref);
|
||||
navPoint.appendChild(navPointContent);
|
||||
//}
|
||||
}
|
||||
|
||||
setContentDOM(contentDOM);
|
||||
|
||||
System.out.println("finished populating the ncx");
|
||||
|
||||
|
||||
}
|
||||
}
|
159
source/java/writer2latex/epub/OPFWriter.java
Normal file
159
source/java/writer2latex/epub/OPFWriter.java
Normal file
|
@ -0,0 +1,159 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* OPFWriter.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: 2001-2010 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* version 1.2 (2010-03-29)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.epub;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentType;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import writer2latex.api.ContentEntry;
|
||||
import writer2latex.api.ConverterResult;
|
||||
import writer2latex.api.OutputFile;
|
||||
import writer2latex.util.Misc;
|
||||
import writer2latex.xmerge.NewDOMDocument;
|
||||
|
||||
/** This class writes an OPF-file for an EPUB document (see http://www.idpf.org/2007/opf/OPF_2.0_final_spec.html)
|
||||
*
|
||||
*/
|
||||
public class OPFWriter extends NewDOMDocument {
|
||||
|
||||
public OPFWriter(ConverterResult cr, String sUUID, String sNcxFileName, String sFileName) {
|
||||
super(Misc.removeExtension(sFileName), "opf");
|
||||
|
||||
// create DOM
|
||||
Document contentDOM = null;
|
||||
try {
|
||||
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder = builderFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = builder.getDOMImplementation();
|
||||
DocumentType doctype = domImpl.createDocumentType("package","","");
|
||||
contentDOM = domImpl.createDocument("http://www.idpf.org/2007/opf","package",doctype);
|
||||
}
|
||||
catch (ParserConfigurationException t) { // this should never happen
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
|
||||
// Populate the DOM tree
|
||||
Element pack = contentDOM.getDocumentElement();
|
||||
pack.setAttribute("version", "2.0");
|
||||
pack.setAttribute("xmlns","http://www.idpf.org/2007/opf");
|
||||
pack.setAttribute("unique-identifier", "BookId");
|
||||
|
||||
// Meta data, at least dc:title, dc:language and dc:identifier are required by the specification
|
||||
Element metadata = contentDOM.createElement("metadata");
|
||||
metadata.setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
|
||||
metadata.setAttribute("xmlns:opf", "http://www.idpf.org/2007/opf");
|
||||
pack.appendChild(metadata);
|
||||
|
||||
Element title = contentDOM.createElement("dc:title");
|
||||
metadata.appendChild(title);
|
||||
title.appendChild(contentDOM.createTextNode(cr.getMetaData().getTitle()));
|
||||
|
||||
Element language = contentDOM.createElement("dc:language");
|
||||
metadata.appendChild(language);
|
||||
language.appendChild(contentDOM.createTextNode(cr.getMetaData().getLanguage()));
|
||||
|
||||
Element identifier = contentDOM.createElement("dc:identifier");
|
||||
identifier.setAttribute("id", "BookId");
|
||||
identifier.setAttribute("opf:scheme", "UUID");
|
||||
metadata.appendChild(identifier);
|
||||
identifier.appendChild(contentDOM.createTextNode(sUUID));
|
||||
|
||||
// Manifest must contain references to all the files in the XHTML converter result
|
||||
// Spine should contain references to all the master documents within the converter result
|
||||
Element manifest = contentDOM.createElement("manifest");
|
||||
pack.appendChild(manifest);
|
||||
|
||||
Element spine = contentDOM.createElement("spine");
|
||||
spine.setAttribute("toc", "ncx");
|
||||
pack.appendChild(spine);
|
||||
|
||||
int nMasterCount = 0;
|
||||
int nResourceCount = 0;
|
||||
Iterator<OutputFile> iterator = cr.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
OutputFile file = iterator.next();
|
||||
Element item = contentDOM.createElement("item");
|
||||
manifest.appendChild(item);
|
||||
item.setAttribute("href",file.getFileName());
|
||||
item.setAttribute("media-type", file.getMIMEType());
|
||||
if (file.isMasterDocument()) {
|
||||
String sId = "text"+(++nMasterCount);
|
||||
item.setAttribute("id", sId);
|
||||
|
||||
Element itemref = contentDOM.createElement("itemref");
|
||||
itemref.setAttribute("idref", sId);
|
||||
spine.appendChild(itemref);
|
||||
}
|
||||
else {
|
||||
item.setAttribute("id", "resource"+(++nResourceCount));
|
||||
}
|
||||
}
|
||||
|
||||
Element item = contentDOM.createElement("item");
|
||||
item.setAttribute("href", sNcxFileName);
|
||||
item.setAttribute("media-type", "application/x-dtbncx+xml");
|
||||
item.setAttribute("id", "ncx");
|
||||
manifest.appendChild(item);
|
||||
|
||||
// The guide may contain references to some fundamental structural components
|
||||
Element guide = contentDOM.createElement("guide");
|
||||
pack.appendChild(guide);
|
||||
addGuideReference(contentDOM,guide,"toc",cr.getTocFile());
|
||||
addGuideReference(contentDOM,guide,"index",cr.getIndexFile());
|
||||
addGuideReference(contentDOM,guide,"loi",cr.getLofFile());
|
||||
addGuideReference(contentDOM,guide,"lot",cr.getLotFile());
|
||||
// TODO addGuideReference(contentDOM,guide,"bibliography",cr.getBibliographyile());
|
||||
List<ContentEntry> contents = cr.getContent();
|
||||
if (contents.size()>0) {
|
||||
addGuideReference(contentDOM,guide,"text",contents.get(0));
|
||||
}
|
||||
|
||||
setContentDOM(contentDOM);
|
||||
}
|
||||
|
||||
private void addGuideReference(Document contentDOM, Element guide, String sType, ContentEntry entry) {
|
||||
if (entry!=null) {
|
||||
Element reference = contentDOM.createElement("reference");
|
||||
reference.setAttribute("type", sType);
|
||||
reference.setAttribute("title", entry.getTitle());
|
||||
String sHref = entry.getFile().getFileName();
|
||||
if (entry.getTarget()!=null) { sHref+="#"+entry.getTarget(); }
|
||||
reference.setAttribute("href", sHref);
|
||||
guide.appendChild(reference);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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-06-05)
|
||||
* Version 1.2 (2010-03-28)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -103,7 +103,7 @@ public class BibConverter extends ConverterHelper {
|
|||
.append("}").nl();
|
||||
}
|
||||
else {
|
||||
if (bibDoc==null) { bibDoc = new BibTeXDocument(palette.getOutFileName()); }
|
||||
if (bibDoc==null) { bibDoc = new BibTeXDocument(palette.getOutFileName(),false); }
|
||||
ldp.append("\\bibliography{")
|
||||
.append(bibDoc.getName())
|
||||
.append("}").nl();
|
||||
|
@ -129,7 +129,7 @@ public class BibConverter extends ConverterHelper {
|
|||
String sIdentifier = node.getAttribute(XMLString.TEXT_IDENTIFIER);
|
||||
if (sIdentifier!=null) {
|
||||
if (config.externalBibtexFiles().length()==0) {
|
||||
if (bibDoc==null) { bibDoc = new BibTeXDocument(palette.getOutFileName()); }
|
||||
if (bibDoc==null) { bibDoc = new BibTeXDocument(palette.getOutFileName(),false); }
|
||||
if (!bibDoc.containsKey(sIdentifier)) {
|
||||
bibDoc.put(new BibMark(node));
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-15)
|
||||
* Version 1.2 (2010-03-28)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -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(),true);
|
||||
if (config.getBackend()!=LaTeXConfig.XETEX) {
|
||||
texDoc.setEncoding(ClassicI18n.writeJavaEncoding(config.getInputencoding()));
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ public final class ConverterPalette extends ConverterBase {
|
|||
texDoc.setEncoding("UTF-8");
|
||||
|
||||
}
|
||||
convertData.addDocument(texDoc);
|
||||
converterResult.addDocument(texDoc);
|
||||
|
||||
// Create other data
|
||||
globalOptions = new CSVList(',');
|
||||
|
@ -288,7 +288,7 @@ public final class ConverterPalette extends ConverterBase {
|
|||
|
||||
// Add BibTeX document if there's any bibliographic data
|
||||
if (bibCv.getBibTeXDocument()!=null) {
|
||||
convertData.addDocument(bibCv.getBibTeXDocument());
|
||||
converterResult.addDocument(bibCv.getBibTeXDocument());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-15)
|
||||
* Version 1.2 (2010-03-28)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -42,6 +42,8 @@ public class LaTeXDocument implements Document {
|
|||
private static final String FILE_EXTENSION = ".tex";
|
||||
|
||||
private String sName;
|
||||
|
||||
private boolean bIsMaster;
|
||||
|
||||
private String sEncoding = "ASCII";
|
||||
|
||||
|
@ -57,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 bIsMaster true if this is a master document
|
||||
*/
|
||||
public LaTeXDocument(String sName,int nWrap) {
|
||||
public LaTeXDocument(String sName,int nWrap,boolean bIsMaster) {
|
||||
this.nWrap = nWrap;
|
||||
this.sName = trimDocumentName(sName);
|
||||
this.bIsMaster = bIsMaster;
|
||||
contents = new LaTeXDocumentPortion(true);
|
||||
}
|
||||
|
||||
|
@ -99,6 +103,10 @@ public class LaTeXDocument implements Document {
|
|||
public String getMIMEType() {
|
||||
return MIMETypes.LATEX;
|
||||
}
|
||||
|
||||
public boolean isMasterDocument() {
|
||||
return bIsMaster;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Writes out the <code>Document</code> content to the specified
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-15)
|
||||
* Version 1.2 (2010-03-28)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -80,7 +80,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(),false);
|
||||
if (config.getBackend()!=LaTeXConfig.XETEX) {
|
||||
newDoc.setEncoding(ClassicI18n.writeJavaEncoding(config.getInputencoding()));
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-15)
|
||||
* Version 1.2 (2010-03-29)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -142,6 +142,10 @@ public class MetaData implements writer2latex.api.MetaData {
|
|||
* @return the language of the document
|
||||
*/
|
||||
public String getLanguage() { return sLanguage; }
|
||||
|
||||
public void setLanguage(String sLanguage) {
|
||||
this.sLanguage = sLanguage;
|
||||
}
|
||||
|
||||
/** <p> Get the subject of this document (may be null)</p>
|
||||
* @return the subject of the document
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-15)
|
||||
* Version 1.2 (2010-03-25)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -44,8 +44,10 @@ import org.w3c.dom.NodeList;
|
|||
import org.w3c.dom.Text;
|
||||
|
||||
import writer2latex.api.Config;
|
||||
import writer2latex.api.ContentEntry;
|
||||
import writer2latex.api.ConverterFactory;
|
||||
//import writer2latex.api.ConverterResult;
|
||||
import writer2latex.base.ContentEntryImpl;
|
||||
import writer2latex.base.ConverterBase;
|
||||
//import writer2latex.latex.LaTeXDocumentPortion;
|
||||
//import writer2latex.latex.util.Context;
|
||||
|
@ -57,7 +59,7 @@ import writer2latex.util.ExportNameCollection;
|
|||
import writer2latex.util.Misc;
|
||||
|
||||
/**
|
||||
* <p>This class converts an OpenDocument file to an XHTML(+MathML) document<.</p>
|
||||
* <p>This class converts an OpenDocument file to an XHTML(+MathML) document.</p>
|
||||
*
|
||||
*/
|
||||
public class Converter extends ConverterBase {
|
||||
|
@ -86,6 +88,8 @@ public class Converter extends ConverterBase {
|
|||
private XhtmlDocument htmlDoc; // current outfile
|
||||
private Document htmlDOM; // current DOM, usually within htmlDoc
|
||||
private boolean bNeedHeaderFooter = false;
|
||||
private int nTocFileIndex = -1;
|
||||
private int nAlphabeticalIndex = -1;
|
||||
|
||||
// Hyperlinks
|
||||
Hashtable<String, Integer> targets = new Hashtable<String, Integer>();
|
||||
|
@ -123,6 +127,28 @@ public class Converter extends ConverterBase {
|
|||
protected int getType() { return nType; }
|
||||
|
||||
protected int getOutFileIndex() { return nOutFileIndex; }
|
||||
|
||||
protected void addContentEntry(String sTitle, int nLevel, String sTarget) {
|
||||
converterResult.addContentEntry(new ContentEntryImpl(sTitle,nLevel,htmlDoc,sTarget));
|
||||
}
|
||||
|
||||
protected void setTocFile(String sTarget) {
|
||||
converterResult.setTocFile(new ContentEntryImpl(l10n.get(L10n.CONTENTS),1,htmlDoc,sTarget));
|
||||
nTocFileIndex = nOutFileIndex;
|
||||
}
|
||||
|
||||
protected void setLofFile(String sTarget) {
|
||||
converterResult.setLofFile(new ContentEntryImpl("Figures",1,htmlDoc,sTarget));
|
||||
}
|
||||
|
||||
protected void setLotFile(String sTarget) {
|
||||
converterResult.setLotFile(new ContentEntryImpl("Tables",1,htmlDoc,sTarget));
|
||||
}
|
||||
|
||||
protected void setIndexFile(String sTarget) {
|
||||
converterResult.setIndexFile(new ContentEntryImpl(l10n.get(L10n.INDEX),1,htmlDoc,sTarget));
|
||||
nAlphabeticalIndex = nOutFileIndex;
|
||||
}
|
||||
|
||||
protected Element createElement(String s) { return htmlDOM.createElement(s); }
|
||||
|
||||
|
@ -327,13 +353,14 @@ public class Converter extends ConverterBase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void addNavigationLink(Document dom, Node node, String s, int nIndex) {
|
||||
if (nIndex>=0 && nIndex<=nOutFileIndex) {
|
||||
Element a = dom.createElement("a");
|
||||
a.setAttribute("href",Misc.makeHref(getOutFileName(nIndex,true)));
|
||||
a.setAttribute("href",getOutFileName(nIndex,true));
|
||||
a.appendChild(dom.createTextNode(s));
|
||||
//node.appendChild(dom.createTextNode("["));
|
||||
node.appendChild(a);
|
||||
|
@ -446,7 +473,7 @@ public class Converter extends ConverterBase {
|
|||
if (template!=null) { htmlDoc.readFromTemplate(template); }
|
||||
else if (bNeedHeaderFooter) { htmlDoc.createHeaderFooter(); }
|
||||
outFiles.add(nOutFileIndex,htmlDoc);
|
||||
convertData.addDocument(htmlDoc);
|
||||
converterResult.addDocument(htmlDoc);
|
||||
|
||||
// Create head + body
|
||||
htmlDOM = htmlDoc.getContentDOM();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-12)
|
||||
* Version 1.2 (2010-03-26)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -568,10 +568,17 @@ public class TextConverter extends ConverterHelper {
|
|||
heading.appendChild(span);
|
||||
span.appendChild( converter.createTextNode(sLabel) );
|
||||
}
|
||||
|
||||
|
||||
// Add to toc
|
||||
if (!bInToc) {
|
||||
converter.addTarget(heading,"toc"+(++nTocIndex));
|
||||
|
||||
// Add in external content
|
||||
if (nLevel<=nSplit) {
|
||||
converter.addContentEntry(sLabel+(sLabel.length()>0 ? " " : "")+Misc.getPCDATA(onode), nLevel, null);
|
||||
}
|
||||
|
||||
// Add to real toc
|
||||
TocEntry entry = new TocEntry();
|
||||
entry.onode = (Element) onode;
|
||||
entry.sLabel = sLabel;
|
||||
|
@ -1014,6 +1021,8 @@ public class TextConverter extends ConverterHelper {
|
|||
if (!ofr.getTocReader((Element)onode).isByChapter()) {
|
||||
nTocFileIndex = converter.getOutFileIndex();
|
||||
}
|
||||
|
||||
converter.setTocFile(null);
|
||||
|
||||
Element div = converter.createElement("div");
|
||||
hnode.appendChild(div);
|
||||
|
@ -1175,6 +1184,8 @@ public class TextConverter extends ConverterHelper {
|
|||
*/
|
||||
private void handleAlphabeticalIndex (Node onode, Node hnode) {
|
||||
nAlphabeticalIndex = converter.getOutFileIndex();
|
||||
converter.setIndexFile(null);
|
||||
|
||||
Node source = Misc.getChildByTagName(onode,XMLString.TEXT_ALPHABETICAL_INDEX_SOURCE);
|
||||
if (source!=null) {
|
||||
Element div = converter.createElement("div");
|
||||
|
|
|
@ -173,6 +173,10 @@ public class XhtmlDocument extends DOMDocument {
|
|||
return "";
|
||||
}
|
||||
|
||||
@Override public boolean isMasterDocument() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Element getHeadNode() { return headNode; }
|
||||
|
||||
public Element getBodyNode() { return bodyNode; }
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-15)
|
||||
* Version 1.2 (2010-03-28)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -166,5 +166,9 @@ public class BinaryGraphicsDocument implements Document {
|
|||
public String getMIMEType() {
|
||||
return sMimeType;
|
||||
}
|
||||
|
||||
public boolean isMasterDocument() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -393,10 +393,14 @@ public class DOMDocument
|
|||
return doc;
|
||||
}
|
||||
|
||||
// We need this because we implement OutputFile
|
||||
// We need these because we implement OutputFile
|
||||
public String getMIMEType() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean isMasterDocument() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
************************************************************************/
|
||||
|
||||
// This version is adapted for Writer2LaTeX
|
||||
// Version 1.2 (2010-03-15)
|
||||
// Version 1.2 (2010-03-28)
|
||||
|
||||
package writer2latex.xmerge;
|
||||
|
||||
|
@ -1287,6 +1287,10 @@ public class OfficeDocument
|
|||
public String getMIMEType() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean isMasterDocument() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -81,10 +81,10 @@
|
|||
</prop>
|
||||
</node>
|
||||
|
||||
<node oor:name="org.openoffice.da.writer2xhtml.configuration.formatting"
|
||||
<node oor:name="org.openoffice.da.writer2xhtml.configuration.stylesheets"
|
||||
oor:op="fuse">
|
||||
<prop oor:name="Id">
|
||||
<value>org.openoffice.da.writer2xhtml.configuration.formatting</value>
|
||||
<value>org.openoffice.da.writer2xhtml.configuration.stylesheets</value>
|
||||
</prop>
|
||||
<prop oor:name="GroupId">
|
||||
<value>org.openoffice.da.writer2xhtml.configuration</value>
|
||||
|
@ -93,10 +93,10 @@
|
|||
<value>2</value>
|
||||
</prop>
|
||||
<prop oor:name="Label">
|
||||
<value xml:lang="en-US">Formatting</value>
|
||||
<value xml:lang="en-US">Style sheets</value>
|
||||
</prop>
|
||||
<prop oor:name="OptionsPage">
|
||||
<value>%origin%/W2XDialogs2/Formatting.xdl</value>
|
||||
<value>%origin%/W2XDialogs2/Stylesheets.xdl</value>
|
||||
</prop>
|
||||
<prop oor:name="EventHandlerService">
|
||||
<value>org.openoffice.da.writer2xhtml.ConfigurationDialog</value>
|
||||
|
@ -115,10 +115,10 @@
|
|||
<value>3</value>
|
||||
</prop>
|
||||
<prop oor:name="Label">
|
||||
<value xml:lang="en-US">Styles part I</value>
|
||||
<value xml:lang="en-US">Styles part 1</value>
|
||||
</prop>
|
||||
<prop oor:name="OptionsPage">
|
||||
<value>%origin%/W2XDialogs2/StylesPartI.xdl</value>
|
||||
<value>%origin%/W2XDialogs2/Styles1.xdl</value>
|
||||
</prop>
|
||||
<prop oor:name="EventHandlerService">
|
||||
<value></value>
|
||||
|
@ -137,16 +137,38 @@
|
|||
<value>4</value>
|
||||
</prop>
|
||||
<prop oor:name="Label">
|
||||
<value xml:lang="en-US">Styles part II</value>
|
||||
<value xml:lang="en-US">Styles part 2</value>
|
||||
</prop>
|
||||
<prop oor:name="OptionsPage">
|
||||
<value>%origin%/W2XDialogs2/StylesPartII.xdl</value>
|
||||
<value>%origin%/W2XDialogs2/Styles2.xdl</value>
|
||||
</prop>
|
||||
<prop oor:name="EventHandlerService">
|
||||
<value></value>
|
||||
</prop>
|
||||
</node>
|
||||
|
||||
<node oor:name="org.openoffice.da.writer2xhtml.configuration.formatting"
|
||||
oor:op="fuse">
|
||||
<prop oor:name="Id">
|
||||
<value>org.openoffice.da.writer2xhtml.configuration.formatting</value>
|
||||
</prop>
|
||||
<prop oor:name="GroupId">
|
||||
<value>org.openoffice.da.writer2xhtml.configuration</value>
|
||||
</prop>
|
||||
<prop oor:name="GroupIndex">
|
||||
<value>5</value>
|
||||
</prop>
|
||||
<prop oor:name="Label">
|
||||
<value xml:lang="en-US">Formatting</value>
|
||||
</prop>
|
||||
<prop oor:name="OptionsPage">
|
||||
<value>%origin%/W2XDialogs2/Formatting.xdl</value>
|
||||
</prop>
|
||||
<prop oor:name="EventHandlerService">
|
||||
<value>org.openoffice.da.writer2xhtml.ConfigurationDialog</value>
|
||||
</prop>
|
||||
</node>
|
||||
|
||||
<node oor:name="org.openoffice.da.writer2xhtml.configuration.content"
|
||||
oor:op="fuse">
|
||||
<prop oor:name="Id">
|
||||
|
@ -156,7 +178,7 @@
|
|||
<value>org.openoffice.da.writer2xhtml.configuration</value>
|
||||
</prop>
|
||||
<prop oor:name="GroupIndex">
|
||||
<value>5</value>
|
||||
<value>6</value>
|
||||
</prop>
|
||||
<prop oor:name="Label">
|
||||
<value xml:lang="en-US">Content</value>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</dlg:styles>
|
||||
<dlg:bulletinboard>
|
||||
<dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="0" dlg:left="6" dlg:top="32" dlg:width="248" dlg:height="2"/>
|
||||
<dlg:img dlg:style-id="0" dlg:id="ImageControl1" dlg:tab-index="1" dlg:left="8" dlg:top="6" dlg:width="21" dlg:height="21" dlg:scale-image="false" dlg:src="../images/w2licon.png"/>
|
||||
<dlg:img dlg:style-id="0" dlg:id="ImageControl1" dlg:tab-index="1" dlg:left="8" dlg:top="6" dlg:width="21" dlg:height="21" dlg:scale-image="false"/>
|
||||
<dlg:text dlg:style-id="1" dlg:id="Label1" dlg:tab-index="2" dlg:left="34" dlg:top="10" dlg:width="193" dlg:height="16" dlg:value="Writer2xhtml Custom Configuration"/>
|
||||
<dlg:text dlg:id="Label2" dlg:tab-index="3" dlg:left="34" dlg:top="43" dlg:width="194" dlg:height="78" dlg:value="This is where you create a custom configuration for the Writer2xhtml export filter. You can define technical details of the generated XHTML documents and you can define how to map formatting to CSS. Creating a custom configuration requires some knowledge of XHTML and CSS." dlg:multiline="true"/>
|
||||
</dlg:bulletinboard>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Content" dlg:left="139" dlg:top="84" dlg:width="258" dlg:height="172" dlg:closeable="true" dlg:moveable="true" dlg:title="Content" dlg:withtitlebar="false">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Content" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:closeable="true" dlg:moveable="true" dlg:title="Content" dlg:withtitlebar="false">
|
||||
<dlg:bulletinboard>
|
||||
<dlg:text dlg:id="FormulasHeadingLabel" dlg:tab-index="0" dlg:left="5" dlg:top="8" dlg:width="245" dlg:height="12" dlg:value="Formulas"/>
|
||||
<dlg:text dlg:id="FormulasLabel" dlg:tab-index="1" dlg:left="10" dlg:top="22" dlg:width="110" dlg:height="12" dlg:value="Include as"/>
|
||||
|
|
|
@ -25,6 +25,6 @@
|
|||
<dlg:checkbox dlg:id="IgnoreTableDimensions" dlg:tab-index="6" dlg:left="10" dlg:top="64" dlg:width="240" dlg:height="12" dlg:value="Ignore table dimensions" dlg:checked="false"/>
|
||||
<dlg:checkbox dlg:id="UseListHack" dlg:tab-index="7" dlg:left="10" dlg:top="78" dlg:width="240" dlg:height="12" dlg:value="Use non-standard continued lists" dlg:checked="false"/>
|
||||
<dlg:checkbox dlg:id="ConvertToPx" dlg:tab-index="8" dlg:left="10" dlg:top="92" dlg:width="240" dlg:height="12" dlg:value="Convert units to px (pixels)" dlg:checked="false"/>
|
||||
<dlg:checkbox dlg:id="SeparateStylesheet" dlg:tab-index="9" dlg:left="10" dlg:top="106" dlg:width="240" dlg:height="12" dlg:value="Create separate styles sheet on file split" dlg:checked="false"/>
|
||||
<dlg:checkbox dlg:id="SeparateStylesheet" dlg:tab-index="9" dlg:visible="false" dlg:left="10" dlg:top="106" dlg:width="240" dlg:height="12" dlg:value="Create separate styles sheet on file split" dlg:checked="false"/>
|
||||
</dlg:bulletinboard>
|
||||
</dlg:window>
|
38
source/oxt/writer2xhtml/W2XDialogs2/Styles1.xdl
Normal file
38
source/oxt/writer2xhtml/W2XDialogs2/Styles1.xdl
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Styles1" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:closeable="true" dlg:moveable="true" dlg:title="Styles1" dlg:withtitlebar="false">
|
||||
<dlg:bulletinboard>
|
||||
<dlg:text dlg:id="StyleMappingsLabel" dlg:tab-index="0" dlg:left="5" dlg:top="8" dlg:width="245" dlg:height="12" dlg:value="Style mappings"/>
|
||||
<dlg:text dlg:id="StyleFamilyLabel" dlg:tab-index="1" dlg:left="10" dlg:top="22" dlg:width="60" dlg:height="12" dlg:value="Style family"/>
|
||||
<dlg:menulist dlg:id="ListBox1" dlg:tab-index="2" dlg:left="80" dlg:top="20" dlg:width="170" dlg:height="12" dlg:spin="true">
|
||||
<dlg:menupopup>
|
||||
<dlg:menuitem dlg:value="Character"/>
|
||||
<dlg:menuitem dlg:value="Paragraph"/>
|
||||
<dlg:menuitem dlg:value="List"/>
|
||||
<dlg:menuitem dlg:value="Frame"/>
|
||||
</dlg:menupopup>
|
||||
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:StyleFamilyChange" script:language="UNO"/>
|
||||
</dlg:menulist>
|
||||
<dlg:text dlg:id="StyleNameLabel" dlg:tab-index="3" dlg:left="10" dlg:top="42" dlg:width="60" dlg:height="12" dlg:value="Style name"/>
|
||||
<dlg:menulist dlg:id="StyleName" dlg:tab-index="4" dlg:left="80" dlg:top="40" dlg:width="80" dlg:height="12" dlg:spin="true">
|
||||
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:StyleNameChange" script:language="UNO"/>
|
||||
</dlg:menulist>
|
||||
<dlg:button dlg:id="NewStyleButton" dlg:tab-index="5" dlg:left="165" dlg:top="40" dlg:width="40" dlg:height="12" dlg:value="New...">
|
||||
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:NewStyleClick" script:language="UNO"/>
|
||||
</dlg:button>
|
||||
<dlg:button dlg:id="DeleteStyleButton" dlg:tab-index="6" dlg:left="210" dlg:top="40" dlg:width="40" dlg:height="12" dlg:value="Delete...">
|
||||
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:DeleteStyleClick" script:language="UNO"/>
|
||||
</dlg:button>
|
||||
<dlg:text dlg:id="XhtmlLabel" dlg:tab-index="7" dlg:left="10" dlg:top="56" dlg:width="60" dlg:height="12" dlg:value="XHTML element"/>
|
||||
<dlg:combobox dlg:id="Xhtml" dlg:tab-index="8" dlg:left="80" dlg:top="54" dlg:width="170" dlg:height="12" dlg:spin="true"/>
|
||||
<dlg:text dlg:id="CssLabel" dlg:tab-index="9" dlg:left="10" dlg:top="70" dlg:width="60" dlg:height="12" dlg:value="CSS class"/>
|
||||
<dlg:textfield dlg:id="Css" dlg:tab-index="10" dlg:left="80" dlg:top="68" dlg:width="170" dlg:height="12"/>
|
||||
<dlg:text dlg:id="BlockXhtmlLabel" dlg:tab-index="11" dlg:left="10" dlg:top="84" dlg:width="60" dlg:height="12" dlg:value="Block XHTML element"/>
|
||||
<dlg:combobox dlg:id="BlockXhtml" dlg:tab-index="12" dlg:left="80" dlg:top="82" dlg:width="170" dlg:height="12" dlg:spin="true"/>
|
||||
<dlg:text dlg:id="BlockCssLabel" dlg:tab-index="13" dlg:left="10" dlg:top="98" dlg:width="60" dlg:height="12" dlg:value="Block CSS class"/>
|
||||
<dlg:textfield dlg:id="BlockCss" dlg:tab-index="14" dlg:left="80" dlg:top="96" dlg:width="170" dlg:height="12"/>
|
||||
<dlg:button dlg:id="LoadDefaults" dlg:tab-index="15" dlg:left="10" dlg:top="118" dlg:width="120" dlg:height="12" dlg:value="Load default mappings...">
|
||||
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:LoadDefaultsClick" script:language="UNO"/>
|
||||
</dlg:button>
|
||||
</dlg:bulletinboard>
|
||||
</dlg:window>
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="StylesPartII" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:closeable="true" dlg:moveable="true" dlg:withtitlebar="false">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Styles2" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:closeable="true" dlg:moveable="true" dlg:title="Styles2" dlg:withtitlebar="false">
|
||||
<dlg:bulletinboard>
|
||||
<dlg:text dlg:id="HardFormattingLabel" dlg:tab-index="0" dlg:left="5" dlg:top="8" dlg:width="245" dlg:height="12" dlg:value="Mappings for hard formatting"/>
|
||||
<dlg:text dlg:id="HardFormattingLabel" dlg:tab-index="0" dlg:left="5" dlg:top="8" dlg:width="245" dlg:height="12" dlg:value="Style mappings for hard formatting"/>
|
||||
<dlg:text dlg:id="FormattingAttributeLabel" dlg:tab-index="1" dlg:left="10" dlg:top="22" dlg:width="100" dlg:height="12" dlg:value="Formatting attribute"/>
|
||||
<dlg:menulist dlg:id="FormattingAttribute" dlg:tab-index="2" dlg:left="120" dlg:top="20" dlg:width="130" dlg:height="12" dlg:spin="true" dlg:linecount="7">
|
||||
<dlg:menupopup>
|
||||
|
@ -19,5 +19,8 @@
|
|||
<dlg:combobox dlg:id="Xhtml" dlg:tab-index="4" dlg:left="120" dlg:top="34" dlg:width="130" dlg:height="12" dlg:spin="true"/>
|
||||
<dlg:text dlg:id="CSSLabel" dlg:tab-index="5" dlg:left="10" dlg:top="50" dlg:width="100" dlg:height="12" dlg:value="CSS class"/>
|
||||
<dlg:textfield dlg:id="Css" dlg:tab-index="6" dlg:left="120" dlg:top="48" dlg:width="130" dlg:height="12"/>
|
||||
<dlg:text dlg:id="OtherStylesLabel" dlg:tab-index="7" dlg:left="5" dlg:top="64" dlg:width="245" dlg:height="12" dlg:value="Other styles"/>
|
||||
<dlg:text dlg:id="TabstopLabel" dlg:tab-index="8" dlg:left="10" dlg:top="78" dlg:width="100" dlg:height="12" dlg:value="CSS class for tabulator stop"/>
|
||||
<dlg:textfield dlg:id="TabstopStyle" dlg:tab-index="9" dlg:left="120" dlg:top="76" dlg:width="130" dlg:height="12"/>
|
||||
</dlg:bulletinboard>
|
||||
</dlg:window>
|
|
@ -1,44 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="StylesPartI" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:closeable="true" dlg:moveable="true" dlg:title="Styles part I" dlg:withtitlebar="false">
|
||||
<dlg:bulletinboard>
|
||||
<dlg:text dlg:id="StyleSheetLabel" dlg:tab-index="0" dlg:left="5" dlg:top="8" dlg:width="245" dlg:height="12" dlg:value="Style sheet"/>
|
||||
<dlg:checkbox dlg:id="UseCustomStylesheet" dlg:tab-index="1" dlg:left="10" dlg:top="22" dlg:width="240" dlg:height="12" dlg:value="Use custom style sheet" dlg:checked="false">
|
||||
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:UseCustomStylesheetChange" script:language="UNO"/>
|
||||
</dlg:checkbox>
|
||||
<dlg:text dlg:id="CustomStylesheetLabel" dlg:tab-index="2" dlg:left="19" dlg:top="36" dlg:width="55" dlg:height="12" dlg:value="URL"/>
|
||||
<dlg:textfield dlg:id="CustomStylesheet" dlg:tab-index="3" dlg:left="80" dlg:top="34" dlg:width="170" dlg:height="12"/>
|
||||
<dlg:text dlg:id="StyleMappingsLabel" dlg:tab-index="4" dlg:left="5" dlg:top="50" dlg:width="245" dlg:height="12" dlg:value="Style mappings"/>
|
||||
<dlg:text dlg:id="StyleFamilyLabel" dlg:tab-index="5" dlg:left="10" dlg:top="64" dlg:width="60" dlg:height="12" dlg:value="Style family"/>
|
||||
<dlg:menulist dlg:id="ListBox1" dlg:tab-index="6" dlg:left="80" dlg:top="62" dlg:width="170" dlg:height="12" dlg:spin="true">
|
||||
<dlg:menupopup>
|
||||
<dlg:menuitem dlg:value="Character"/>
|
||||
<dlg:menuitem dlg:value="Paragraph"/>
|
||||
<dlg:menuitem dlg:value="List"/>
|
||||
<dlg:menuitem dlg:value="Frame"/>
|
||||
</dlg:menupopup>
|
||||
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:StyleFamilyChange" script:language="UNO"/>
|
||||
</dlg:menulist>
|
||||
<dlg:text dlg:id="StyleNameLabel" dlg:tab-index="7" dlg:left="10" dlg:top="84" dlg:width="60" dlg:height="12" dlg:value="Style name"/>
|
||||
<dlg:menulist dlg:id="StyleName" dlg:tab-index="8" dlg:left="80" dlg:top="82" dlg:width="80" dlg:height="12" dlg:spin="true">
|
||||
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:StyleNameChange" script:language="UNO"/>
|
||||
</dlg:menulist>
|
||||
<dlg:button dlg:id="NewStyleButton" dlg:tab-index="9" dlg:left="165" dlg:top="82" dlg:width="40" dlg:height="12" dlg:value="New...">
|
||||
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:NewStyleClick" script:language="UNO"/>
|
||||
</dlg:button>
|
||||
<dlg:button dlg:id="DeleteStyleButton" dlg:tab-index="10" dlg:left="210" dlg:top="82" dlg:width="40" dlg:height="12" dlg:value="Delete...">
|
||||
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:DeleteStyleClick" script:language="UNO"/>
|
||||
</dlg:button>
|
||||
<dlg:text dlg:id="XhtmlLabel" dlg:tab-index="11" dlg:left="10" dlg:top="98" dlg:width="60" dlg:height="12" dlg:value="XHTML element"/>
|
||||
<dlg:combobox dlg:id="Xhtml" dlg:tab-index="12" dlg:left="80" dlg:top="96" dlg:width="170" dlg:height="12" dlg:spin="true"/>
|
||||
<dlg:text dlg:id="CssLabel" dlg:tab-index="13" dlg:left="10" dlg:top="112" dlg:width="60" dlg:height="12" dlg:value="CSS class"/>
|
||||
<dlg:textfield dlg:id="Css" dlg:tab-index="14" dlg:left="80" dlg:top="110" dlg:width="170" dlg:height="12"/>
|
||||
<dlg:text dlg:id="BlockXhtmlLabel" dlg:tab-index="15" dlg:left="10" dlg:top="126" dlg:width="60" dlg:height="12" dlg:value="Block XHTML element"/>
|
||||
<dlg:combobox dlg:id="BlockXhtml" dlg:tab-index="16" dlg:left="80" dlg:top="124" dlg:width="170" dlg:height="12" dlg:spin="true"/>
|
||||
<dlg:text dlg:id="BlockCssLabel" dlg:tab-index="17" dlg:left="10" dlg:top="140" dlg:width="60" dlg:height="12" dlg:value="Block CSS class"/>
|
||||
<dlg:textfield dlg:id="BlockCss" dlg:tab-index="18" dlg:left="80" dlg:top="138" dlg:width="170" dlg:height="12"/>
|
||||
<dlg:button dlg:id="LoadDefaults" dlg:tab-index="19" dlg:left="10" dlg:top="160" dlg:width="120" dlg:height="12" dlg:value="Load default mappings...">
|
||||
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:LoadDefaultsClick" script:language="UNO"/>
|
||||
</dlg:button>
|
||||
</dlg:bulletinboard>
|
||||
</dlg:window>
|
19
source/oxt/writer2xhtml/W2XDialogs2/Stylesheets.xdl
Normal file
19
source/oxt/writer2xhtml/W2XDialogs2/Stylesheets.xdl
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Stylesheets" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:closeable="true" dlg:moveable="true" dlg:title="Stylesheets" dlg:withtitlebar="false">
|
||||
<dlg:bulletinboard>
|
||||
<dlg:checkbox dlg:id="UseCustomStylesheet" dlg:tab-index="1" dlg:left="10" dlg:top="22" dlg:width="240" dlg:height="12" dlg:value="Insert link to custom style sheet" dlg:checked="false">
|
||||
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:UseCustomStylesheetChange" script:language="UNO"/>
|
||||
</dlg:checkbox>
|
||||
<dlg:text dlg:id="CustomStylesheetLabel" dlg:tab-index="2" dlg:left="19" dlg:top="36" dlg:width="55" dlg:height="12" dlg:value="URL"/>
|
||||
<dlg:textfield dlg:id="CustomStylesheet" dlg:tab-index="3" dlg:left="80" dlg:top="34" dlg:width="170" dlg:height="12"/>
|
||||
<dlg:checkbox dlg:id="IncludeCustomStylesheet" dlg:tab-index="4" dlg:left="10" dlg:top="50" dlg:width="240" dlg:height="12" dlg:value="Include custom style sheet" dlg:checked="false">
|
||||
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:IncludeCustomStylesheetChange" script:language="UNO"/>
|
||||
</dlg:checkbox>
|
||||
<dlg:text dlg:id="IncludedCustomStylesheetLabel" dlg:tab-index="0" dlg:left="5" dlg:top="8" dlg:width="245" dlg:height="12" dlg:value="Custom style sheets"/>
|
||||
<dlg:textfield dlg:id="IncludedCustomStylesheet" dlg:tab-index="5" dlg:left="18" dlg:top="64" dlg:width="232" dlg:height="84" dlg:hscroll="true" dlg:vscroll="true" dlg:multiline="true"/>
|
||||
<dlg:button dlg:id="LoadButton" dlg:tab-index="6" dlg:left="18" dlg:top="156" dlg:width="60" dlg:height="12" dlg:value="Load...">
|
||||
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:LoadButtonClick" script:language="UNO"/>
|
||||
</dlg:button>
|
||||
</dlg:bulletinboard>
|
||||
</dlg:window>
|
|
@ -4,8 +4,9 @@
|
|||
<library:element library:name="ConfigurationRoot"/>
|
||||
<library:element library:name="General"/>
|
||||
<library:element library:name="Template"/>
|
||||
<library:element library:name="Stylesheets"/>
|
||||
<library:element library:name="Styles1"/>
|
||||
<library:element library:name="Styles2"/>
|
||||
<library:element library:name="Formatting"/>
|
||||
<library:element library:name="StylesPartI"/>
|
||||
<library:element library:name="StylesPartII"/>
|
||||
<library:element library:name="Content"/>
|
||||
</library:library>
|
|
@ -87,6 +87,20 @@
|
|||
<prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
|
||||
</node>
|
||||
|
||||
<node oor:name="org.openoffice.da.writer2xhtml.epub" oor:op="replace" oor:finalized="true" oor:mandatory="true">
|
||||
<prop oor:name="FileFormatVersion"><value>0</value></prop>
|
||||
<prop oor:name="Type"><value>writer_epub_File</value></prop>
|
||||
<prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
|
||||
<prop oor:name="UIComponent"><value>org.openoffice.da.comp.writer2xhtml.XhtmlOptionsDialog</value></prop>
|
||||
<prop oor:name="UserData"><value>org.openoffice.da.comp.writer2xhtml.W2XExportFilter unused com.sun.star.comp.Writer.XMLOasisImporter com.sun.star.comp.Writer.XMLOasisExporter staroffice/sxw application/epub+zip</value></prop>
|
||||
<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
|
||||
<prop oor:name="TemplateName"/>
|
||||
<prop oor:name="UIName">
|
||||
<value>EPUB</value>
|
||||
</prop>
|
||||
<prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
|
||||
</node>
|
||||
|
||||
</node>
|
||||
|
||||
</oor:component-data>
|
||||
|
|
|
@ -51,6 +51,18 @@
|
|||
<prop oor:name="ClipboardFormat"/>
|
||||
</node>
|
||||
|
||||
<node oor:name="writer_epub_File" oor:op="replace" oor:finalized="true" oor:mandatory="true">
|
||||
<prop oor:name="DetectService"/>
|
||||
<prop oor:name="URLPattern"/>
|
||||
<prop oor:name="Extensions"><value>epub</value></prop>
|
||||
<prop oor:name="MediaType"/>
|
||||
<prop oor:name="Preferred"><value>false</value></prop>
|
||||
<prop oor:name="UIName">
|
||||
<value>EPUB</value>
|
||||
</prop>
|
||||
<prop oor:name="ClipboardFormat"/>
|
||||
</node>
|
||||
|
||||
</node>
|
||||
|
||||
</oor:component-data>
|
||||
|
|
Loading…
Add table
Reference in a new issue