Java 5 + Writer4LaTeX + bugfixes

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@11 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2009-03-30 07:38:37 +00:00
parent be54e842f4
commit 9241a44f6c
83 changed files with 2373 additions and 631 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-16)
* Version 1.2 (2009-03-26)
*
*/
@ -185,12 +185,12 @@ public class ClassicI18n extends I18n {
// End of static part of I18n!
// **** Global variables ****
private Hashtable babelLanguages; // mappings iso->babel language
private Hashtable<String,String> babelLanguages; // mappings iso->babel language
// Unicode translation
private Hashtable tableSet; // all tables
private Hashtable<String,UnicodeTable> tableSet; // all tables
private UnicodeTable table; // currently active table (top of stack)
private Stack tableStack; // stack of active tables
private Stack<UnicodeTable> tableStack; // stack of active tables
private UnicodeStringParser ucparser; // Unicode string parser
// Collected data
@ -231,7 +231,7 @@ public class ClassicI18n extends I18n {
if (config.useEurosym()) sSymbols+="|eurosym";
if (config.useTipa()) sSymbols+="|tipa";
tableSet = new Hashtable();
tableSet = new Hashtable<String,UnicodeTable>();
UnicodeTableHandler handler=new UnicodeTableHandler(tableSet, sSymbols);
SAXParserFactory factory=SAXParserFactory.newInstance();
InputStream is = this.getClass().getResourceAsStream("symbols.xml");
@ -244,9 +244,9 @@ public class ClassicI18n extends I18n {
t.printStackTrace();
}
// put root table at top of stack
tableStack = new Stack();
tableStack.push((UnicodeTable) tableSet.get("root"));
table = (UnicodeTable) tableSet.get("root");
tableStack = new Stack<UnicodeTable>();
tableStack.push(tableSet.get("root"));
table = tableSet.get("root");
}
/** Construct a new I18n for general use
@ -386,8 +386,8 @@ public class ClassicI18n extends I18n {
// If no name is specified we should keep the current table
// Otherwise try to find the table, and use root if it's not available
if (sName!=null) {
table = (UnicodeTable) tableSet.get(sName);
if (table==null) { table = (UnicodeTable) tableSet.get("root"); }
table = tableSet.get(sName);
if (table==null) { table = tableSet.get("root"); }
}
tableStack.push(table);
}
@ -396,7 +396,7 @@ public class ClassicI18n extends I18n {
*/
public void popSpecialTable() {
tableStack.pop();
table = (UnicodeTable) tableStack.peek();
table = tableStack.peek();
}
/** Get the number of characters defined in the current table
@ -632,7 +632,7 @@ public class ClassicI18n extends I18n {
// todo: support automatic choice of inputenc (see comments)?
private String getBabelLanguage(String sLang) {
if (babelLanguages.containsKey(sLang)) {
return (String) babelLanguages.get(sLang);
return babelLanguages.get(sLang);
}
else {
return "english"; // interpret unknown languages as English
@ -640,7 +640,7 @@ public class ClassicI18n extends I18n {
}
private void prepareBabelLanguages() {
babelLanguages = new Hashtable();
babelLanguages = new Hashtable<String,String>();
babelLanguages.put("en", "english"); // latin1
babelLanguages.put("bg", "bulgarian"); // cp1251?
babelLanguages.put("cs", "czech"); // latin2

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-16)
* Version 1.2 (2009-03-26)
*
*/
@ -49,7 +49,7 @@ public abstract class I18n {
// Collected data
protected String sDefaultLanguage; // The default iso language to use
protected HashSet languages = new HashSet(); // All languages used
protected HashSet<String> languages = new HashSet<String>(); // All languages used
// **** Constructors ****

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-17)
* Version 1.2 (2009-03-26)
*
*/
@ -31,9 +31,10 @@ import java.util.Hashtable;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;
// Helper classs: SAX handler to parse symbols.xml from jar
class UnicodeTableHandler extends DefaultHandler{
private Hashtable tableSet; // collection of all tables
/** Helper classs: SAX handler to parse symbols.xml from jar
*/
public class UnicodeTableHandler extends DefaultHandler{
private Hashtable<String,UnicodeTable> tableSet; // collection of all tables
private UnicodeTable table; // the current table
private String sSymbolSets;
private boolean bGlobalReadThisSet;
@ -42,7 +43,12 @@ class UnicodeTableHandler extends DefaultHandler{
private int nFontencs = 0; // The currently active fontencodings
private boolean b8bit = false;
UnicodeTableHandler(Hashtable tableSet, String sSymbolSets){
/** Create a new <code>UnicodeTableHandler</code>
*
* @param tableSet the <code>Hashtable</code> to fill with tables read from the file
* @param sSymbolSets string containing table names to read (separated by |)
*/
public UnicodeTableHandler(Hashtable<String,UnicodeTable> tableSet, String sSymbolSets){
this.sSymbolSets = sSymbolSets;
this.tableSet = tableSet;
}
@ -63,7 +69,7 @@ class UnicodeTableHandler extends DefaultHandler{
}
else if (qName.equals("special-symbol-set")) {
// start a new special symbol set; this requires a new table
table = new UnicodeTable((UnicodeTable) tableSet.get("root"));
table = new UnicodeTable(tableSet.get("root"));
tableSet.put(attributes.getValue("name"),table);
// Read it if it requires nothing, or something we read

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-17)
* Version 1.2 (2009-03-26)
*
*/