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:
henrikjust 2009-09-07 08:01:40 +00:00
parent f6c8e1709e
commit e8bba32302
50 changed files with 1091 additions and 110 deletions

View file

@ -33,7 +33,7 @@ public class ConverterFactory {
// Version information
private static final String VERSION = "1.1.1";
private static final String DATE = "2008-08-31";
private static final String DATE = "2008-09-07";
/** Return version information
* @return the Writer2LaTeX version in the form

View file

@ -27,7 +27,7 @@
package writer2latex.api;
/** A simple interface for a graphic converter which converts between various
* graphics formats
* graphics formats
*/
public interface GraphicConverter {

View file

@ -26,7 +26,7 @@
package writer2latex.api;
/** This class represents a single entry on an index page created by a batch converter
/** This class represents a single entry on an index page created by a batch converter
*/
public class IndexPageEntry {

View file

@ -26,7 +26,7 @@
package writer2latex.base;
// The mother of all options; reads and writes string values
// The mother of all options; reads and writes string values
public class Option {
protected String sValue;
private String sName;

View file

@ -26,7 +26,7 @@
package writer2latex.latex.i18n;
/** This class contains a node in a trie of string -> LaTeX code replacements
/** This class contains a node in a trie of string -> LaTeX code replacements
*/
public class ReplacementTrieNode {

View file

@ -26,7 +26,7 @@
package writer2latex.latex.i18n;
// Helper class: A struct to hold the LaTeX representations of a unicode character
// Helper class: A struct to hold the LaTeX representations of a unicode character
class UnicodeCharacter implements Cloneable {
final static int NORMAL = 0; // this is a normal character
final static int COMBINING = 1; // this character should be ignored

View file

@ -29,7 +29,7 @@ package writer2latex.latex.i18n;
// Helper class: Parse a unicode string.
// Note: Some 8-bit fonts have additional "spacer" characters that are used
// for manual placement of accents. These are ignored between the base character
// and the combining character, thus we are parsing according to the rule
// and the combining character, thus we are parsing according to the rule
// <base char> <spacer char>* <combining char>?
class UnicodeStringParser {
private UnicodeTable table; // the table to use

View file

@ -18,7 +18,7 @@
*
* Copyright: 2002-2007 by Henrik Just
*
* All Rights Reserved.
* All Rights Reserved.
*
* Version 0.5 (2007-07-24)
*

View file

@ -26,7 +26,7 @@
package writer2latex.latex.util;
/** Utility class to hold LaTeX code to put before/after other LaTeX code
/** Utility class to hold LaTeX code to put before/after other LaTeX code
*/
public class BeforeAfter {
private String sBefore="";

View file

@ -27,7 +27,7 @@
package writer2latex.latex.util;
/** This class contains data for the mapping of OOo headings to LaTeX headings.
A LaTeX heading is characterized by a name and a level.
A LaTeX heading is characterized by a name and a level.
The heading is inserted with \name{...} or \name[...]{...}
The headings are supposed to be "normal" LaTeX headings,
ie. the names are also counter names, and the headings

View file

@ -26,7 +26,7 @@
package writer2latex.latex.util;
// A struct to hold data about a style map
// A struct to hold data about a style map
class StyleMapItem {
String sBefore;
String sAfter;

View file

@ -29,7 +29,7 @@ package writer2latex.office;
import org.w3c.dom.Element;
/**
* This class represent a cell in a table view</p>
* This class represent a cell in a table view
*/
public class CellView {
public Element cell = null;

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2009-03-27)
* Version 1.2 (2009-09-07)
*
*/
@ -440,6 +440,7 @@ public class XMLString {
// svg namespace
public static final String SVG_DESC="svg:desc";
public static final String SVG_TITLE="svg:title";
public static final String SVG_FONT_FAMILY="svg:font-family"; // oasis (font declarations only)
public static final String SVG_X="svg:x";

View file

@ -1,5 +1,5 @@
/**
* This is Robert Harders public domain Base64 class. It is unmodified, except for the package name.
* This is Robert Harders public domain Base64 class. It is unmodified, except for the package name.
*
* <p>Encodes and decodes to and from Base64 notation.</p>
* <p>Homepage: <a href="http://iharder.net/base64">http://iharder.net/base64</a>.</p>

View file

@ -26,7 +26,7 @@
package writer2latex.util;
// Create a list of values separated by commas or another seperation character
// Create a list of values separated by commas or another seperation character
public class CSVList{
private String sSep;
private String sNameValueSep;

View file

@ -39,7 +39,7 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.NamedNodeMap;
// This class contains some usefull, but unrelated static methods
// This class contains some usefull, but unrelated static methods
public class Misc{
private final static int BUFFERSIZE = 1024;

View file

@ -27,7 +27,7 @@
package writer2latex.util;
/** This class provides a simple string input buffer; it can be used as the
* basis of a tokenizer.
* basis of a tokenizer.
*/
public class SimpleInputBuffer {

View file

@ -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(); }

View file

@ -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(); }

View file

@ -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);

View file

@ -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

View file

@ -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"));
}
}

View file

@ -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(); }

View file

@ -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);

View file

@ -42,7 +42,7 @@ package writer2latex.xmerge;
/**
* This interface contains constants for StarOffice XML tags,
* attributes (StarCalc cell types, etc.).
* attributes (StarCalc cell types, etc.).
*
* @author Herbie Ong, Paul Rank, Martin Maher
*/

View file

@ -52,7 +52,7 @@ import org.xml.sax.SAXParseException;
/**
* Used by OfficeDocument to encapsulate exceptions. It will add
* more details to the message string if it is of type
* <code>SAXParseException</code>.
* <code>SAXParseException</code>.
*
* @author Herbie Ong
*/