EPUB 3 support

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@239 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2015-04-28 11:48:39 +00:00
parent b0b61acb19
commit d141619053
15 changed files with 413 additions and 122 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.6 (2015-01-14)
* Version 1.6 (2015-04-28)
*
*/
@ -41,7 +41,7 @@ import writer2latex.util.Misc;
public class XhtmlConfig extends writer2latex.base.ConfigBase {
// Implement configuration methods
protected int getOptionCount() { return 57; }
protected int getOptionCount() { return 58; }
protected String getDefaultConfigPath() { return "/writer2latex/xhtml/config/"; }
// Override setOption: To be backwards compatible, we must accept options
@ -137,26 +137,27 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
private static final int FOOTNOTES_HEADING = 34;
private static final int EXTERNAL_TOC_DEPTH = 35;
private static final int INCLUDE_TOC = 36;
private static final int SPLIT_LEVEL = 37;
private static final int REPEAT_LEVELS = 38;
private static final int PAGE_BREAK_SPLIT = 39;
private static final int SPLIT_AFTER = 40;
private static final int IMAGE_SPLIT = 41;
private static final int COVER_IMAGE = 42;
private static final int EMBED_SVG = 43;
private static final int EMBED_IMG = 44;
private static final int USE_MATHJAX = 45;
private static final int CALC_SPLIT = 46;
private static final int DISPLAY_HIDDEN_SHEETS = 47;
private static final int DISPLAY_HIDDEN_ROWS_COLS = 48;
private static final int DISPLAY_FILTERED_ROWS_COLS = 49;
private static final int APPLY_PRINT_RANGES = 50;
private static final int USE_TITLE_AS_HEADING = 51;
private static final int USE_SHEET_NAMES_AS_HEADINGS = 52;
private static final int SAVE_IMAGES_IN_SUBDIR = 53;
private static final int UPLINK = 54;
private static final int DIRECTORY_ICON = 55;
private static final int DOCUMENT_ICON = 56;
private static final int INCLUDE_NCX = 37;
private static final int SPLIT_LEVEL = 38;
private static final int REPEAT_LEVELS = 39;
private static final int PAGE_BREAK_SPLIT = 40;
private static final int SPLIT_AFTER = 41;
private static final int IMAGE_SPLIT = 42;
private static final int COVER_IMAGE = 43;
private static final int EMBED_SVG = 44;
private static final int EMBED_IMG = 45;
private static final int USE_MATHJAX = 46;
private static final int CALC_SPLIT = 47;
private static final int DISPLAY_HIDDEN_SHEETS = 48;
private static final int DISPLAY_HIDDEN_ROWS_COLS = 49;
private static final int DISPLAY_FILTERED_ROWS_COLS = 50;
private static final int APPLY_PRINT_RANGES = 51;
private static final int USE_TITLE_AS_HEADING = 52;
private static final int USE_SHEET_NAMES_AS_HEADINGS = 53;
private static final int SAVE_IMAGES_IN_SUBDIR = 54;
private static final int UPLINK = 55;
private static final int DIRECTORY_ICON = 56;
private static final int DOCUMENT_ICON = 57;
protected ComplexOption xheading = addComplexOption("heading-map");
protected ComplexOption xpar = addComplexOption("paragraph-map");
@ -245,6 +246,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
}
};
options[INCLUDE_TOC] = new BooleanOption("include_toc","true");
options[INCLUDE_NCX] = new BooleanOption("include_ncx","true");
options[SPLIT_LEVEL] = new IntegerOption("split_level","0") {
@Override public void setString(String sValue) {
super.setString(sValue);
@ -408,6 +410,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
public int formulas() { return ((IntegerOption) options[FORMULAS]).getValue(); }
public int externalTocDepth() { return ((IntegerOption) options[EXTERNAL_TOC_DEPTH]).getValue(); }
public boolean includeToc() { return ((BooleanOption) options[INCLUDE_TOC]).getValue(); }
public boolean includeNCX() { return ((BooleanOption) options[INCLUDE_NCX]).getValue(); }
public int getXhtmlSplitLevel() { return ((IntegerOption) options[SPLIT_LEVEL]).getValue(); }
public int getXhtmlRepeatLevels() { return ((IntegerOption) options[REPEAT_LEVELS]).getValue(); }
public int pageBreakSplit() { return ((IntegerOption) options[PAGE_BREAK_SPLIT]).getValue(); }

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2014 by Henrik Just
* Copyright: 2002-2015 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.4 (2014-09-23)
* Version 1.6 (2015-04-21)
*
*/
@ -40,7 +40,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
import writer2latex.api.MIMETypes;
import writer2latex.base.DOMDocument;
import writer2latex.office.XMLString;
@ -294,13 +293,9 @@ public class XhtmlDocument extends DOMDocument {
}
@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 HTML5: return MIMETypes.HTML5;
}
return "";
// Get the real MIME type, not the pseudo ones used by the converter API
// We always produce XHTML, thus
return "application/xhtml+xml";
}
@Override public boolean isMasterDocument() {