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

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