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:
parent
be54e842f4
commit
9241a44f6c
83 changed files with 2373 additions and 631 deletions
|
@ -64,7 +64,7 @@ public class ConvertData implements ConverterResult {
|
|||
/**
|
||||
* Vector of <code>OutputFile</code> objects.
|
||||
*/
|
||||
private Vector v = new Vector();
|
||||
private Vector<OutputFile> v = new Vector<OutputFile>();
|
||||
|
||||
/** Master doc */
|
||||
private OutputFile masterDoc = null;
|
||||
|
@ -137,7 +137,7 @@ public class ConvertData implements ConverterResult {
|
|||
* @return The <code>Iterator</code> to access the
|
||||
* <code>Vector</code> of <code>OutputFile</code> objects.
|
||||
*/
|
||||
public Iterator iterator() {
|
||||
public Iterator<OutputFile> iterator() {
|
||||
return v.iterator();
|
||||
}
|
||||
|
||||
|
@ -154,9 +154,9 @@ public class ConvertData implements ConverterResult {
|
|||
|
||||
public void write(File dir) throws IOException {
|
||||
if (dir!=null && !dir.exists()) throw new IOException("Directory does not exist");
|
||||
Iterator docEnum = iterator();
|
||||
Iterator<OutputFile> docEnum = iterator();
|
||||
while (docEnum.hasNext()) {
|
||||
OutputFile docOut = (OutputFile) docEnum.next();
|
||||
OutputFile docOut = docEnum.next();
|
||||
String sDirName = "";
|
||||
String sFileName = docOut.getFileName();
|
||||
File subdir = dir;
|
||||
|
|
|
@ -120,7 +120,7 @@ public class OfficeDocument
|
|||
private OfficeZip zip = null;
|
||||
|
||||
/** Collection to keep track of the embedded objects in the document. */
|
||||
private Map embeddedObjects = null;
|
||||
private Map<String, EmbeddedObject> embeddedObjects = null;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -320,10 +320,10 @@ public class OfficeDocument
|
|||
*
|
||||
* @return An <code>Iterator</code> of <code>EmbeddedObject</code> objects.
|
||||
*/
|
||||
public Iterator getEmbeddedObjects() {
|
||||
public Iterator<EmbeddedObject> getEmbeddedObjects() {
|
||||
|
||||
if (embeddedObjects == null && manifestDoc != null) {
|
||||
embeddedObjects = new HashMap();
|
||||
embeddedObjects = new HashMap<String, EmbeddedObject>();
|
||||
|
||||
// Need to read the manifest file and construct a list of objects
|
||||
NodeList nl = manifestDoc.getElementsByTagName(TAG_MANIFEST_FILE);
|
||||
|
@ -400,7 +400,7 @@ public class OfficeDocument
|
|||
}
|
||||
|
||||
if (embeddedObjects.containsKey(name)) {
|
||||
return (EmbeddedObject)embeddedObjects.get(name);
|
||||
return embeddedObjects.get(name);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
|
@ -419,7 +419,7 @@ public class OfficeDocument
|
|||
}
|
||||
|
||||
if (embeddedObjects == null) {
|
||||
embeddedObjects = new HashMap();
|
||||
embeddedObjects = new HashMap<String, EmbeddedObject>();
|
||||
}
|
||||
|
||||
embeddedObjects.put(embObj.getName(), embObj);
|
||||
|
@ -734,9 +734,9 @@ public class OfficeDocument
|
|||
Element manifestRoot = manifestDoc.getDocumentElement();
|
||||
|
||||
// The EmbeddedObjects come first.
|
||||
Iterator embObjs = getEmbeddedObjects();
|
||||
Iterator<EmbeddedObject> embObjs = getEmbeddedObjects();
|
||||
while (embObjs.hasNext()) {
|
||||
EmbeddedObject obj = (EmbeddedObject)embObjs.next();
|
||||
EmbeddedObject obj = embObjs.next();
|
||||
obj.writeManifestData(manifestDoc);
|
||||
|
||||
obj.write(zip);
|
||||
|
|
|
@ -75,7 +75,7 @@ class OfficeZip {
|
|||
|
||||
private final static int BUFFERSIZE = 1024;
|
||||
|
||||
private List entryList = null;
|
||||
private List<Entry> entryList = null;
|
||||
|
||||
private int contentIndex = -1;
|
||||
private int styleIndex = -1;
|
||||
|
@ -86,7 +86,7 @@ class OfficeZip {
|
|||
/** Default constructor. */
|
||||
OfficeZip() {
|
||||
|
||||
entryList = new LinkedList();
|
||||
entryList = new LinkedList<Entry>();
|
||||
}
|
||||
|
||||
|
||||
|
@ -229,7 +229,7 @@ class OfficeZip {
|
|||
// Could improve performance by caching the name and index when
|
||||
// iterating through the ZipFile in read().
|
||||
for (int i = 0; i < entryList.size(); i++) {
|
||||
Entry e = (Entry)entryList.get(i);
|
||||
Entry e = entryList.get(i);
|
||||
|
||||
if (e.zipEntry.getName().equals(name)) {
|
||||
return getEntryBytes(i);
|
||||
|
@ -252,7 +252,7 @@ class OfficeZip {
|
|||
*/
|
||||
void setNamedBytes(String name, byte[] bytes) {
|
||||
for (int i = 0; i < entryList.size(); i++) {
|
||||
Entry e = (Entry)entryList.get(i);
|
||||
Entry e = entryList.get(i);
|
||||
|
||||
if (e.zipEntry.getName().equals(name)) {
|
||||
setEntryBytes(i, bytes, name);
|
||||
|
@ -283,7 +283,7 @@ class OfficeZip {
|
|||
byte[] bytes = null;
|
||||
|
||||
if (index > -1) {
|
||||
Entry entry = (Entry) entryList.get(index);
|
||||
Entry entry = entryList.get(index);
|
||||
bytes = entry.bytes;
|
||||
}
|
||||
return bytes;
|
||||
|
@ -373,7 +373,7 @@ class OfficeZip {
|
|||
|
||||
// replace existing entry in entryList
|
||||
|
||||
Entry entry = (Entry) entryList.get(index);
|
||||
Entry entry = entryList.get(index);
|
||||
name = entry.zipEntry.getName();
|
||||
int method = entry.zipEntry.getMethod();
|
||||
|
||||
|
@ -409,11 +409,11 @@ class OfficeZip {
|
|||
|
||||
ZipOutputStream zos = new ZipOutputStream(os);
|
||||
|
||||
ListIterator iterator = entryList.listIterator();
|
||||
ListIterator<Entry> iterator = entryList.listIterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
||||
Entry entry = (Entry) iterator.next();
|
||||
Entry entry = iterator.next();
|
||||
ZipEntry ze = entry.zipEntry;
|
||||
|
||||
//String name = ze.getName();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue