Config ui prototype and some minor fixes
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@29 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
f6c8e1709e
commit
e8bba32302
50 changed files with 1091 additions and 110 deletions
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2009-02-08)
|
||||
* Version 1.2 (2009-09-05)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -94,6 +94,7 @@ public class BatchConverterImpl extends BatchConverterBase {
|
|||
htmlDoc.setNoDoctype(config.xhtmlNoDoctype());
|
||||
htmlDoc.setAddBOM(config.xhtmlAddBOM());
|
||||
htmlDoc.setUseNamedEntities(config.useNamedEntities());
|
||||
htmlDoc.setHexadecimalEntities(config.hexadecimalEntities());
|
||||
if (template!=null) { htmlDoc.readFromTemplate(template); }
|
||||
else { htmlDoc.createHeaderFooter(); }
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2009-05-29)
|
||||
* Version 1.2 (2009-09-05)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -446,6 +446,7 @@ public class Converter extends ConverterBase {
|
|||
htmlDoc.setNoDoctype(config.xhtmlNoDoctype());
|
||||
htmlDoc.setAddBOM(config.xhtmlAddBOM());
|
||||
htmlDoc.setUseNamedEntities(config.useNamedEntities());
|
||||
htmlDoc.setHexadecimalEntities(config.hexadecimalEntities());
|
||||
htmlDoc.setXsltPath(config.getXsltPath());
|
||||
if (template!=null) { htmlDoc.readFromTemplate(template); }
|
||||
else if (bNeedHeaderFooter) { htmlDoc.createHeaderFooter(); }
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2009-03-08)
|
||||
* Version 1.0 (2009-09-07)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -391,6 +391,9 @@ public class DrawConverter extends ConverterHelper {
|
|||
// Add alternative text, using either alt.text, name or file name
|
||||
Element frame = getFrame(onode);
|
||||
Element desc = Misc.getChildByTagName(frame,XMLString.SVG_DESC);
|
||||
if (desc==null) {
|
||||
desc = Misc.getChildByTagName(frame,XMLString.SVG_TITLE);
|
||||
}
|
||||
String sAltText = desc!=null ? Misc.getPCDATA(desc) : (sName!=null ? sName : sFileName);
|
||||
image.setAttribute("alt",sAltText);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.w3c.dom.Element;
|
|||
|
||||
/**
|
||||
* Helper class (a struct) to contain information about a Link (used to manage
|
||||
* links to be resolved later)
|
||||
* links to be resolved later)
|
||||
*/
|
||||
final class LinkDescriptor {
|
||||
Element element; // the a-element
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2009-03-10)
|
||||
* Version 1.0 (2009-09-05)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -1456,16 +1456,16 @@ public class TextConverter extends ConverterHelper {
|
|||
}
|
||||
|
||||
private void handleTabStop(Node onode, Node hnode) {
|
||||
// xhtml does not have tab stops, we export a space, which the
|
||||
// xhtml does not have tab stops, but we export and ASCII TAB character, which the
|
||||
// user may choose to format
|
||||
if (config.getXhtmlTabstopStyle().length()>0) {
|
||||
Element span = converter.createElement("span");
|
||||
hnode.appendChild(span);
|
||||
span.setAttribute("class",config.getXhtmlTabstopStyle());
|
||||
span.appendChild(converter.createTextNode(" "));
|
||||
span.appendChild(converter.createTextNode("\t"));
|
||||
}
|
||||
else {
|
||||
hnode.appendChild(converter.createTextNode(" "));
|
||||
hnode.appendChild(converter.createTextNode("\t"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
* Copyright: 2002-2009 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-14)
|
||||
* Version 1.2 (2009-09-05)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -38,7 +38,7 @@ import writer2latex.util.Misc;
|
|||
|
||||
public class XhtmlConfig extends writer2latex.base.ConfigBase {
|
||||
// Implement configuration methods
|
||||
protected int getOptionCount() { return 36; }
|
||||
protected int getOptionCount() { return 37; }
|
||||
protected String getDefaultConfigPath() { return "/writer2latex/xhtml/config/"; }
|
||||
|
||||
// Override setOption: To be backwards compatible, we must accept options
|
||||
|
@ -65,34 +65,35 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
|
|||
private static final int ADD_BOM = 5;
|
||||
private static final int ENCODING = 6;
|
||||
private static final int USE_NAMED_ENTITIES = 7;
|
||||
private static final int CUSTOM_STYLESHEET = 8;
|
||||
private static final int FORMATTING = 9;
|
||||
private static final int FRAME_FORMATTING = 10;
|
||||
private static final int SECTION_FORMATTING = 11;
|
||||
private static final int TABLE_FORMATTING = 12;
|
||||
private static final int IGNORE_TABLE_DIMENSIONS = 13;
|
||||
private static final int USE_DUBLIN_CORE = 14;
|
||||
private static final int NOTES = 15;
|
||||
private static final int CONVERT_TO_PX = 16;
|
||||
private static final int SCALING = 17;
|
||||
private static final int COLUMN_SCALING = 18;
|
||||
private static final int FLOAT_OBJECTS = 19;
|
||||
private static final int TABSTOP_STYLE = 20;
|
||||
private static final int USE_LIST_HACK = 21;
|
||||
private static final int SPLIT_LEVEL = 22;
|
||||
private static final int REPEAT_LEVELS = 23;
|
||||
private static final int CALC_SPLIT = 24;
|
||||
private static final int DISPLAY_HIDDEN_SHEETS = 25;
|
||||
private static final int DISPLAY_HIDDEN_ROWS_COLS = 26;
|
||||
private static final int DISPLAY_FILTERED_ROWS_COLS = 27;
|
||||
private static final int APPLY_PRINT_RANGES = 28;
|
||||
private static final int USE_TITLE_AS_HEADING = 29;
|
||||
private static final int USE_SHEET_NAMES_AS_HEADINGS = 30;
|
||||
private static final int XSLT_PATH = 31;
|
||||
private static final int SAVE_IMAGES_IN_SUBDIR = 32;
|
||||
private static final int UPLINK = 33;
|
||||
private static final int DIRECTORY_ICON = 34;
|
||||
private static final int DOCUMENT_ICON = 35;
|
||||
private static final int HEXADECIMAL_ENTITIES = 8;
|
||||
private static final int CUSTOM_STYLESHEET = 9;
|
||||
private static final int FORMATTING = 10;
|
||||
private static final int FRAME_FORMATTING = 11;
|
||||
private static final int SECTION_FORMATTING = 12;
|
||||
private static final int TABLE_FORMATTING = 13;
|
||||
private static final int IGNORE_TABLE_DIMENSIONS = 14;
|
||||
private static final int USE_DUBLIN_CORE = 15;
|
||||
private static final int NOTES = 16;
|
||||
private static final int CONVERT_TO_PX = 17;
|
||||
private static final int SCALING = 18;
|
||||
private static final int COLUMN_SCALING = 19;
|
||||
private static final int FLOAT_OBJECTS = 20;
|
||||
private static final int TABSTOP_STYLE = 21;
|
||||
private static final int USE_LIST_HACK = 22;
|
||||
private static final int SPLIT_LEVEL = 23;
|
||||
private static final int REPEAT_LEVELS = 24;
|
||||
private static final int CALC_SPLIT = 25;
|
||||
private static final int DISPLAY_HIDDEN_SHEETS = 26;
|
||||
private static final int DISPLAY_HIDDEN_ROWS_COLS = 27;
|
||||
private static final int DISPLAY_FILTERED_ROWS_COLS = 28;
|
||||
private static final int APPLY_PRINT_RANGES = 29;
|
||||
private static final int USE_TITLE_AS_HEADING = 30;
|
||||
private static final int USE_SHEET_NAMES_AS_HEADINGS = 31;
|
||||
private static final int XSLT_PATH = 32;
|
||||
private static final int SAVE_IMAGES_IN_SUBDIR = 33;
|
||||
private static final int UPLINK = 34;
|
||||
private static final int DIRECTORY_ICON = 35;
|
||||
private static final int DOCUMENT_ICON = 36;
|
||||
|
||||
protected XhtmlStyleMap xpar = new XhtmlStyleMap();
|
||||
protected XhtmlStyleMap xtext = new XhtmlStyleMap();
|
||||
|
@ -111,6 +112,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
|
|||
options[ADD_BOM] = new BooleanOption("add_bom","false");
|
||||
options[ENCODING] = new Option("encoding","UTF-8");
|
||||
options[USE_NAMED_ENTITIES] = new BooleanOption("use_named_entities","false");
|
||||
options[HEXADECIMAL_ENTITIES] = new BooleanOption("hexadecimal_entities","true");
|
||||
options[CUSTOM_STYLESHEET] = new Option("custom_stylesheet","");
|
||||
options[FORMATTING] = new XhtmlFormatOption("formatting","convert_all");
|
||||
options[FRAME_FORMATTING] = new XhtmlFormatOption("frame_formatting","convert_all");
|
||||
|
@ -216,6 +218,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
|
|||
public boolean xhtmlAddBOM() { return ((BooleanOption) options[ADD_BOM]).getValue(); }
|
||||
public String xhtmlEncoding() { return options[ENCODING].getString(); }
|
||||
public boolean useNamedEntities() { return ((BooleanOption) options[USE_NAMED_ENTITIES]).getValue(); }
|
||||
public boolean hexadecimalEntities() { return ((BooleanOption) options[HEXADECIMAL_ENTITIES]).getValue(); }
|
||||
public String xhtmlCustomStylesheet() { return options[CUSTOM_STYLESHEET].getString(); }
|
||||
public int xhtmlFormatting() { return ((XhtmlFormatOption) options[FORMATTING]).getValue(); }
|
||||
public int xhtmlFrameFormatting() { return ((XhtmlFormatOption) options[FRAME_FORMATTING]).getValue(); }
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2009-05-29)
|
||||
* Version 1.2 (2009-09-05)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -82,6 +82,7 @@ public class XhtmlDocument extends DOMDocument {
|
|||
// Configuration
|
||||
private String sEncoding = "UTF-8";
|
||||
private boolean bUseNamedEntities = false;
|
||||
private boolean bHexadecimalEntities = true;
|
||||
private char cLimit = 65535;
|
||||
private boolean bNoDoctype = false;
|
||||
private boolean bAddBOM = false;
|
||||
|
@ -292,6 +293,10 @@ public class XhtmlDocument extends DOMDocument {
|
|||
bUseNamedEntities = b;
|
||||
}
|
||||
|
||||
public void setHexadecimalEntities(boolean b) {
|
||||
bHexadecimalEntities = b;
|
||||
}
|
||||
|
||||
public void setXsltPath(String s) { sXsltPath = s; }
|
||||
|
||||
public String getFileExtension() { return super.getFileExtension(); }
|
||||
|
@ -474,7 +479,12 @@ public class XhtmlDocument extends DOMDocument {
|
|||
}
|
||||
}
|
||||
if (c>cLimit) {
|
||||
osw.write("&#x"+Integer.toHexString(c).toUpperCase()+";");
|
||||
if (bHexadecimalEntities) {
|
||||
osw.write("&#x"+Integer.toHexString(c).toUpperCase()+";");
|
||||
}
|
||||
else {
|
||||
osw.write("&#"+Integer.toString(c).toUpperCase()+";");
|
||||
}
|
||||
}
|
||||
else {
|
||||
osw.write(c);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue