Some more minor bugfixing, refactoring and rearrangement

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@167 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2014-08-27 09:00:49 +00:00
parent 6249ef406e
commit 9babea1b6c
7 changed files with 106 additions and 115 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.4 (2012-08-25)
* Version 1.4 (2012-08-27)
*
*/
@ -33,7 +33,7 @@ public class ConverterFactory {
// Version information
private static final String VERSION = "1.3.2";
private static final String DATE = "2014-08-24";
private static final String DATE = "2014-08-27";
/** Return the Writer2LaTeX version in the form
* (major version).(minor version).(patch level)<br/>

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-2014 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.0 (2008-10-15)
* Version 1.4 (2014-08-27)
*
*/
@ -175,7 +175,7 @@ public abstract class BatchConverterBase implements BatchConverter {
handler.endFile(infile.getPath(),true);
return dataOut.getMasterDocument().getFileName();
return dataOut.iterator().next().getFileName();
}

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2009 by Henrik Just
* Copyright: 2002-2014 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2009-09-17)
* Version 1.4 (2014-08-27)
*
*/
@ -157,7 +157,7 @@ public class PageStyleConverter extends StyleConverter {
context.setInHeaderFooter(true);
Enumeration<Object> styles = ofr.getMasterPages().getStylesEnumeration();
Enumeration<OfficeStyle> styles = ofr.getMasterPages().getStylesEnumeration();
ldp.append("% Pages styles").nl();
if (!config.useFancyhdr()) {
ldp.append("\\makeatletter").nl();
@ -385,7 +385,7 @@ public class PageStyleConverter extends StyleConverter {
boolean bIncludeHead = false;
boolean bIncludeFoot = false;
// Look through all applied page layouts and use largest heights
Enumeration<Object> masters = ofr.getMasterPages().getStylesEnumeration();
Enumeration<OfficeStyle> masters = ofr.getMasterPages().getStylesEnumeration();
while (masters.hasMoreElements()) {
MasterPage master = (MasterPage) masters.nextElement();
if (styleNames.containsName(getDisplayName(master.getName()))) {

View file

@ -519,7 +519,7 @@ public class OfficeReader {
* @return the iso language
*/
public String getMajorityLanguage() {
Hashtable<Object, Integer> langs = new Hashtable<Object, Integer>();
Hashtable<String, Integer> langs = new Hashtable<String, Integer>();
// Read the default language from the default paragraph style
String sDefaultLang = null;
@ -529,7 +529,7 @@ public class OfficeReader {
}
// Collect languages from paragraph styles
Enumeration<Object> enumeration = getParStyles().getStylesEnumeration();
Enumeration<OfficeStyle> enumeration = getParStyles().getStylesEnumeration();
while (enumeration.hasMoreElements()) {
style = (StyleWithProperties) enumeration.nextElement();
String sLang = style.getProperty(XMLString.FO_LANGUAGE);
@ -546,9 +546,9 @@ public class OfficeReader {
// Find the most common language
int nMaxCount = 0;
String sMajorityLanguage = null;
enumeration = langs.keys();
while (enumeration.hasMoreElements()) {
String sLang = (String) enumeration.nextElement();
Enumeration<String> langenum = langs.keys();
while (langenum.hasMoreElements()) {
String sLang = langenum.nextElement();
int nCount = langs.get(sLang).intValue();
if (nCount>nMaxCount) {
nMaxCount = nCount;

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-2014 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.0 (2008-11-23)
* Version 1.4 (2014-08-27)
*
*/
@ -33,8 +33,8 @@ import writer2latex.util.Misc;
/** Container class representing a style family in OOo */
public class OfficeStyleFamily {
private Hashtable<String, Object> styles = new Hashtable<String, Object>();
private Class styleClass;
private Hashtable<String, OfficeStyle> styles = new Hashtable<String, OfficeStyle>();
private Class<? extends OfficeStyle> styleClass;
private Hashtable<String, String> displayNames = new Hashtable<String, String>();
@ -44,7 +44,7 @@ public class OfficeStyleFamily {
* @param styleClass the subclass of OfficeStyle used to represent styles
* in this family
*/
public OfficeStyleFamily(Class styleClass) {
public OfficeStyleFamily(Class<? extends OfficeStyle> styleClass) {
this.styleClass = styleClass;
}
@ -70,7 +70,7 @@ public class OfficeStyleFamily {
*/
public OfficeStyle getStyle(String sName) {
if (sName==null) { return null; }
else { return (OfficeStyle) styles.get(sName); }
else { return styles.get(sName); }
}
/** Get a style by display name. Automatic styles does not have a display
@ -101,7 +101,7 @@ public class OfficeStyleFamily {
/** Get all named styles in the family (ie. excluding the default style)
* @return an enumeration of all styles represented by OfficeStyle objects
*/
public Enumeration<Object> getStylesEnumeration(){
public Enumeration<OfficeStyle> getStylesEnumeration(){
return styles.elements();
}
@ -113,7 +113,7 @@ public class OfficeStyleFamily {
String sName = Misc.getAttribute(node,XMLString.STYLE_NAME);
if (sName!=null) {
try {
OfficeStyle style = (OfficeStyle) styleClass.newInstance();
OfficeStyle style = styleClass.newInstance();
style.sName=sName;
style.family=this;
style.bAutomatic=bAutomatic;

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.4 (2014-08-26)
* Version 1.4 (2014-08-27)
*
*/
@ -100,8 +100,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;
//private int nTocFileIndex = -1;
//private int nAlphabeticalIndex = -1;
// Hyperlinks
Hashtable<String, Integer> targets = new Hashtable<String, Integer>();
@ -201,7 +201,7 @@ public class Converter extends ConverterBase {
protected void setTocFile(String sTarget) {
converterResult.setTocFile(new ContentEntryImpl(l10n.get(L10n.CONTENTS),1,htmlDoc,sTarget));
nTocFileIndex = nOutFileIndex;
//nTocFileIndex = nOutFileIndex;
}
protected void setLofFile(String sTarget) {
@ -214,7 +214,7 @@ public class Converter extends ConverterBase {
protected void setIndexFile(String sTarget) {
converterResult.setIndexFile(new ContentEntryImpl(l10n.get(L10n.INDEX),1,htmlDoc,sTarget));
nAlphabeticalIndex = nOutFileIndex;
//nAlphabeticalIndex = nOutFileIndex;
}
protected void setCoverFile(String sTarget) {