diff options
author | rbuj <robert.buj@gmail.com> | 2014-09-04 15:58:32 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-09-04 09:08:09 -0500 |
commit | a5a9457609e8bbe76a8c6d620b81b8666c2e4491 (patch) | |
tree | 9651dc29fa39243b87b0ffc79b20b6d5305f0a42 /xmerge | |
parent | 8e4dc1d760d85e09bbc3f3bbb5b8be2947db1b63 (diff) |
xmerge: javadoc maintenance and minor code formatting
Javadoc:
* Replaces <code>..</code> tags with {@code ..}.
* Replaces HTML entities with {@literal ..}
* Removes <p>..</p> tags in the first sentence.
* Reduces code snippet spacing.
* Adds tables.
* Uses only one space after a comment delimiter.
* Adjusts the margins.
Minor code formating:
* Removes some extra blank lines (very few).
* Fixes some indentations (very few).
* Adjusts the margins in some method headers (very few).
Change-Id: I01bd9df58e4cb41bc3a38a2b2d3d7d2612081c32
Reviewed-on: https://gerrit.libreoffice.org/11202
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'xmerge')
96 files changed, 3496 insertions, 4521 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/Convert.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/Convert.java index 982cb3f5aa80..122bffd94d07 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/Convert.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/Convert.java @@ -25,64 +25,57 @@ import java.util.Iterator; import org.openoffice.xmerge.util.registry.ConverterInfo; /** - * The <code>Convert</code> class manages a conversion from one - * mime-type to another. The <code>ConvertFactory</code> is - * responsible for returning the appropriate <code>Convert</code> - * class for a specified conversion. This class is responsible - * for all interactions with the <code>PluginFactory</code> - * implementation. + * The {@code Convert} class manages a conversion from one mime-type to another. * - * @see ConverterFactory - * @see PluginFactory - * @see org.openoffice.xmerge.util.registry.ConverterInfo + * <p>The {@code ConvertFactory} is responsible for returning the appropriate + * {@code Convert} class for a specified conversion. This class is responsible + * for all interactions with the {@code PluginFactory} implementation.</p> + * + * @see ConverterFactory + * @see PluginFactory + * @see org.openoffice.xmerge.util.registry.ConverterInfo */ public class Convert implements Cloneable { - /** - * ConvertInfo that corresponds to the from-mime/to-mime - * conversion. - */ + /** ConvertInfo that corresponds to the from-mime/to-mime conversion. */ private ConverterInfo ci; /** - * true if converting to the Office format, false if converting - * to the device format. + * {@code true} if converting to the Office format, {@code false} if + * converting to the device format. */ private boolean toOffice; - /** - * Holds the convert input data. - */ + /** Holds the convert input data. */ private ConvertData inputCD = new ConvertData(); - /** - * Construct a Convert class with specified <code>ConvertInfo</code> - * registry information. - * - * @param ci A <code>ConvertInfo</code> object containing - * registry information corresponding to a - * specific plug-in. - * @param toOffice true if converting to the Office format, - * false if converting to the device format. + * Construct a Convert class with specified {@code ConvertInfo} registry + * information. + * + * @param ci A {@code ConvertInfo} object containing registry + * information corresponding to a specific plug-in. + * @param toOffice {@code true} if converting to the Office format, + * {@code false} if converting to the device format. */ public Convert(ConverterInfo ci, boolean toOffice) { this.ci = ci; this.toOffice = toOffice; } - /** - * Adds an <code>InputStream</code> to be used as input by the - * <code>Convert</code> class. It is possible that many files - * need to be converted into a single output <code>Document</code>, - * so this function may be called more than one time. It is the - * plug-in's responsibility to know how to handle the input. + * Adds an {@code InputStream} to be used as input by the {@code Convert} + * class. + * + * <p>It is possible that many files need to be converted into a single + * output {@code Document}, so this function may be called more than one + * time. It is the plug-in's responsibility to know how to handle the input. + * </p> * - * @param name The name corresponding to the <code>InputStream</code>. - * @param is <code>InputStream</code> to be used as input. + * @param name The name corresponding to the {@code InputStream}. + * @param is {@code InputStream} to be used as input. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void addInputStream(String name, InputStream is) throws IOException { @@ -97,18 +90,20 @@ public class Convert implements Cloneable { inputCD.addDocument(inputDoc); } - /** - * Adds an <code>InputStream</code> to be used as input by the - * <code>Convert</code> class. It is possible that many files - * need to be converted into a single output <code>Document</code>, - * so this function may be called more than one time. It is the - * plug-in's responsibility to know how to handle the input. + /** + * Adds an {@code InputStream} to be used as input by the {@code Convert} + * class. + * + * <p>It is possible that many files need to be converted into a single + * output {@code Document}, so this function may be called more than one + * time. It is the plug-in's responsibility to know how to handle the input. + * </p> * - * @param name The name corresponding to the <code>InputStream</code>. - * @param is <code>InputStream</code> to be used as input. - * @param isZip <code>boolean</code> to identify that incoming stream is * zipped + * @param name The name corresponding to the {@code InputStream}. + * @param is {@code InputStream} to be used as input. + * @param isZip {@code boolean} to identify that incoming stream is * zipped. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void addInputStream(String name, InputStream is,boolean isZip) throws IOException { @@ -125,40 +120,39 @@ public class Convert implements Cloneable { /** - * Returns a <code>DocumentMerger</code> for the given <code>Document</code>. + * Returns a {@code DocumentMerger} for the given {@code Document}. * - * @param origDoc The <code>Document</code> were later changes will be merged to + * @param origDoc The {@code Document} were later changes will be merged to. * - * @return The <code>DocumentMerger</code> object for the given document. + * @return The {@code DocumentMerger} object for the given document. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ - public DocumentMerger getDocumentMerger(Document origDoc) - throws IOException { - - DocumentMergerFactory myDocMergerFactory = ci.getDocMergerFactory(); - DocumentMerger merger = myDocMergerFactory.createDocumentMerger(origDoc); - return merger; + public DocumentMerger getDocumentMerger(Document origDoc) throws IOException { + DocumentMergerFactory myDocMergerFactory = ci.getDocMergerFactory(); + DocumentMerger merger = myDocMergerFactory.createDocumentMerger(origDoc); + return merger; } /** - * Resets the input queue, so that the user can use this class to - * perform another conversion. This causes the - * <code>addInputStream</code> method to accept input for the next - * conversion. + * Resets the input queue, so that the user can use this class to perform + * another conversion. + * + * <p>This causes the {@code addInputStream} method to accept input for the + * next conversion.</p> */ private void reset() { inputCD.reset(); } - /** - * Clones a Convert object so another Convert object can - * do the same conversion. <code>InputStream</code> objects passed - * in via calls to the <code>addInputStream</code> method are not - * copied. + * Clones a {@code Convert} object so another Convert object can do the same + * conversion. * - * @return The cloned <code>Convert</code> object. + * <p>{@code InputStream} objects passed in via calls to the + * {@code addInputStream} method are not copied.</p> + * + * @return The cloned {@code Convert} object. */ @Override public Object clone() { @@ -175,16 +169,14 @@ public class Convert implements Cloneable { return aClone; } - /** - * Convert the input specified in calls to the <code>addInputStream</code> - * method to the output format specified by this <code>Convert</code> - * class. + * Convert the input specified in calls to the {@code addInputStream} + * method to the output format specified by this {@code Convert} class. * - * @return The output data. + * @return The output data. * - * @throws ConvertException If any conversion error occurs. - * @throws IOException If any I/O error occurs. + * @throws ConvertException If any conversion error occurs. + * @throws IOException If any I/O error occurs. */ public ConvertData convert() throws ConvertException, IOException { @@ -192,7 +184,7 @@ public class Convert implements Cloneable { if (toOffice) { - // From device format to Office format + // From device format to Office format DocumentDeserializerFactory myDocDeserializerFactory = ci.getDocDeserializerFactory(); @@ -206,7 +198,7 @@ public class Convert implements Cloneable { } else { - // From Office format to device format + // From Office format to device format DocumentSerializerFactory myDocSerializerFactory = ci.getDocSerializerFactory(); @@ -221,27 +213,21 @@ public class Convert implements Cloneable { } } - - /** - * Returns the appropriate "Office" <code>Document</code> - * object for this plug-in. + * Returns the appropriate "Office" {@code Document} object for + * this plug-in. * - * @param name The name of the <code>Document</code> to create. - * @param is The <code>InputStream</code> corresponding to the - * <code>Document</code> to create. + * @param name The name of the {@code Document} to create. + * @param is The {@code InputStream} corresponding to the + * {@code Document} to create. * - * @return The appropriate "Office" <code>Document</code> - * object for this plug-in. + * @return The appropriate "Office" {@code Document} object for + * this plug-in. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public Document getOfficeDocument(String name, InputStream is) throws IOException { return(ci.getPluginFactory().createOfficeDocument(name, is)); } - - - -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertData.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertData.java index 195e23515a07..b355298a3b15 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertData.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertData.java @@ -22,29 +22,29 @@ import java.util.ArrayList; import java.util.Iterator; /** - * <p><code>ConvertData</code> is used as a container for passing - * <code>Document</code> objects in and out of the <code>Convert</code> - * class. The <code>ConvertData</code> contains a <code>String</code> - * name and a <code>Vector</code> of <code>Document</code> objects.</p> + * {@code ConvertData} is used as a container for passing {@code Document} + * objects in and out of the {@code Convert} class. * + * <p>The {@code ConvertData} contains a {@code String} name and a + * {@code Vector} of {@code Document} objects.</p> */ public class ConvertData { /** - * Vector of <code>Document</code> objects. + * Vector of {@code Document} objects. */ private ArrayList<Object> v = new ArrayList<Object>(); /** - * Name of the <code>ConvertData</code> object. + * Name of the {@code ConvertData} object. */ private String name; - /** - * Resets ConvertData. This empties all <code>Document</code> - * objects from this class. This allows reuse of a - * <code>ConvertData</code>. + * Resets ConvertData. + * + * <p>This empties all {@code Document} objects from this class. This allows + * reuse of a {@code ConvertData}.</p> */ public void reset() { name = null; @@ -52,56 +52,50 @@ public class ConvertData { } /** - * Returns the <code>Document</code> name. + * Returns the {@code Document} name. * - * @return The <code>Document</code> name. + * @return The {@code Document} name. */ public String getName() { return name; } - /** - * Sets the <code>Document</code> name. + * Sets the {@code Document} name. * - * @param docName The name of the <code>Document</code>. + * @param docName The name of the {@code Document}. */ public void setName(String docName) { name = docName; } - /** - * Adds a <code>Document</code> to the vector. + * Adds a {@code Document} to the vector. * - * @param doc The <code>Document</code> to add. + * @param doc The {@code Document} to add. */ public void addDocument(Document doc) { v.add(doc); } - /** - * Gets an <code>Enumeration</code> to access the <code>Vector</code> - * of <code>Document</code> objects. + * Gets an {@code Enumeration} to access the {@code Vector} of + * {@code Document} objects. * - * @return The <code>Enumeration</code> to access the - * <code>Vector</code> of <code>Document</code> objects. + * @return The {@code Enumeration} to access the {@code Vector} of + * {@code Document} objects. */ public Iterator<Object> getDocumentEnumeration() { Iterator<Object> enumerate = v.iterator(); return (enumerate); } - /** - * Gets the number of <code>Document</code> objects currently stored + * Gets the number of {@code Document} objects currently stored. * - * @return The number of <code>Document</code> objects currently - * stored. + * @return The number of {@code Document} objects currently stored. */ public int getNumDocuments() { return (v.size()); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertException.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertException.java index d9073856007f..6d05e8d26f5f 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertException.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertException.java @@ -19,18 +19,16 @@ package org.openoffice.xmerge; /** - * This <code>Exception</code> is thrown by convert algorithms. + * This {@code Exception} is thrown by convert algorithms. */ public class ConvertException extends Exception { /** - * Exception thrown by convert algorithms. + * Exception thrown by convert algorithms. * - * @param message Message to be included in the - * <code>Exception</code>. + * @param message Message to be included in the {@code Exception}. */ public ConvertException(String message) { super(message); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterCapabilities.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterCapabilities.java index 9bbe4945bb11..da36f7da2cb4 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterCapabilities.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterCapabilities.java @@ -19,40 +19,36 @@ package org.openoffice.xmerge; /** - * <p>A <code>ConverterCapabilities</code> object is used by - * <code>DocumentMerger</code> implementations. The - * <code>ConverterCapabilities</code> indicates which - * "Office" XML tags are supported by the - * "Device" format.</p> + * A {@code ConverterCapabilities} object is used by {@code DocumentMerger} + * implementations. * - * @see org.openoffice.xmerge.PluginFactory - * @see org.openoffice.xmerge.DocumentMerger + * <p>The {@code ConverterCapabilities} indicates which "Office" XML + * tags are supported by the "Device" format.</p> + * + * @see org.openoffice.xmerge.PluginFactory + * @see org.openoffice.xmerge.DocumentMerger */ public interface ConverterCapabilities { - /** - * Test to see if the device document format supports the - * tag in question. + * Test to see if the device document format supports the tag in question. * - * @param tag The tag to check. + * @param tag The tag to check. * - * @return true if the device format supports the - * tag, false otherwise. + * @return {@code true} if the device format supports the tag, + * {@code false} otherwise. */ boolean canConvertTag(String tag); - /** - * Test to see if the device document format supports the - * tag attribute in question. + * Test to see if the device document format supports the tag attribute in + * question. * - * @param tag The tag to check. - * @param attribute The tag attribute to check. + * @param tag The tag to check. + * @param attribute The tag attribute to check. * - * @return true if the device format supports the - * attribute, false otherwise. + * @return {@code true} if the device format supports the attribute, + * {@code false} otherwise. */ boolean canConvertAttribute(String tag, String attribute); -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterFactory.java index 75417be8c527..2f12e458fee0 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterFactory.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterFactory.java @@ -22,32 +22,30 @@ import org.openoffice.xmerge.util.registry.ConverterInfo; import org.openoffice.xmerge.util.registry.ConverterInfoMgr; /** - * Factory that provides access to <code>Convert</code> objects, which - * are used to do a conversion. The <code>ConvertFactory</code> does - * this via the <code>ConvertInfoMgr</code> which maintains a list of - * which <code>Convert</code> objects are available and their - * capabilities. + * Factory that provides access to {@code Convert} objects, which are used to do + * a conversion. * - * @see Convert - * @see org.openoffice.xmerge.util.registry.ConverterInfoMgr + * <p>The {@code ConvertFactory} does this via the {@code ConvertInfoMgr} which + * maintains a list of which {@code Convert} objects are available and their + * capabilities.</p> * + * @see Convert + * @see org.openoffice.xmerge.util.registry.ConverterInfoMgr */ public class ConverterFactory { - - - /** - * Returns the <code>Convert</code> object that converts - * the specified device/office mime type conversion. If there - * are multiple <code>Converter</code> objects registered - * that support this conversion, only the first is returned. + * Returns the {@code Convert} object that converts the specified device/office + * mime type conversion. + * + * <p>If there are multiple {@code Converter} objects registered that support + * this conversion, only the first is returned.</p> * - * @param mimeTypeIn The mime input type. - * @param mimeTypeOut The mime output type. + * @param mimeTypeIn The mime input type. + * @param mimeTypeOut The mime output type. * - * @return The first <code>Convert</code> object that supports - * the specified conversion. + * @return The first {@code Convert} object that supports the specified + * conversion. */ public Convert getConverter(String mimeTypeIn, String mimeTypeOut) { @@ -69,21 +67,19 @@ public class ConverterFactory { return null; } - /** - * Returns the <code>Convert</code> object that is described - * by the <code>ConverterInfo</code> parameter. - * - * @param ci The <code>ConverterInfo</code> describing the converter. + * Returns the {@code Convert} object that is described by the + * {@code ConverterInfo} parameter. * - * @param toOffice true to convert to office, false to convert to device. + * @param ci The {@code ConverterInfo} describing the converter. + * @param toOffice {@code true} to convert to office, {@code false} to + * convert to device. * - * @return The <code>Convert</code> object + * @return The {@code Convert} object */ public Convert getConverter(ConverterInfo ci, boolean toOffice) { Convert myConvert = new Convert(ci, toOffice); return myConvert; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/Document.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/Document.java index c1a5d7ba64d8..851c1539dfba 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/Document.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/Document.java @@ -23,67 +23,57 @@ import java.io.InputStream; import java.io.IOException; /** - * <p>A <code>Document</code> represents any <code>Document</code> - * to be converted and the resulting <code>Document</code> from any - * conversion.</p> + * A {@code Document} represents any {@code Document} to be converted and the + * resulting {@code Document} from any conversion. * - * <p>It is created by the <code>PluginFactory</code> object's {@link - * org.openoffice.xmerge.PluginFactory#createOfficeDocument - * createOfficeDocument} method or the {@link - * org.openoffice.xmerge.PluginFactory#createDeviceDocument - * createDeviceDocument} method.</p> + * <p>It is created by the {@code PluginFactory} object's {@link + * org.openoffice.xmerge.PluginFactory#createOfficeDocument createOfficeDocument} + * method or the {@link org.openoffice.xmerge.PluginFactory#createDeviceDocument + * createDeviceDocument} method.</p> * - * @see org.openoffice.xmerge.PluginFactory + * @see org.openoffice.xmerge.PluginFactory */ public interface Document { /** - * <p>Writes out the <code>Document</code> content to the specified - * <code>OutputStream</code>.</p> + * Writes out the {@code Document} content to the specified + * {@code OutputStream}. * - * <p>This method may not be thread-safe. - * Implementations may or may not synchronize this - * method. User code (i.e. caller) must make sure that - * calls to this method are thread-safe.</p> + * <p>This method may not be thread-safe. Implementations may or may not + * synchronize this method. User code (i.e. caller) must make sure that + * calls to this method are thread-safe.</p> * - * @param os <code>OutputStream</code> to write out the - * <code>Document</code> content. + * @param os {@code OutputStream} to write out the {@code Document} + * content. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ void write(OutputStream os) throws IOException; - /** - * <p>Reads the content from the <code>InputStream</code> into - * the <code>Document</code>.</p> + * Reads the content from the {@code InputStream} into the {@code Document}. * - * <p>This method may not be thread-safe. - * Implementations may or may not synchronize this - * method. User code (i.e. caller) must make sure that - * calls to this method are thread-safe.</p> + * <p>This method may not be thread-safe. Implementations may or may not + * synchronize this method. User code (i.e. caller) must make sure that + * calls to this method are thread-safe.</p> * - * @param is <code>InputStream</code> to read in the - * <code>Document</code> content. + * @param is {@code InputStream} to read in the {@code Document} content. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ void read(InputStream is) throws IOException; - /** - * Returns the <code>Document</code> name with no file extension. + * Returns the {@code Document} name with no file extension. * - * @return The <code>Document</code> name with no file extension. + * @return The {@code Document} name with no file extension. */ String getName(); - /** - * Returns the <code>Document</code> name with file extension. + * Returns the {@code Document} name with file extension. * - * @return The <code>Document</code> name with file extension. + * @return The {@code Document} name with file extension. */ String getFileName(); -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer.java index 5429a16a34bd..1bfadfcfef28 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer.java @@ -21,35 +21,33 @@ package org.openoffice.xmerge; import java.io.IOException; /** - * <p>A <code>DocumentDeserializer</code> represents a converter that - * converts "Device" <code>Document</code> objects into the - * "Office" <code>Document</code> format.</p> + * A {@code DocumentDeserializer} represents a converter that converts + * "Device" {@code Document} objects into the "Office" + * {@code Document} format. * - * <p>The <code>DocumentDeserializer</code> object is created by - * the <code>PluginFactory</code> {@link - * org.openoffice.xmerge.DocumentDeserializerFactory#createDocumentDeserializer - * createDocumentDeserializer} method. When it is constructed, a - * <code>ConvertData</code> object is passed in to be used as input.</p> + * <p>The {@code DocumentDeserializer} object is created by the + * {@code PluginFactory} {@link + * org.openoffice.xmerge.DocumentDeserializerFactory#createDocumentDeserializer + * createDocumentDeserializer} method. When it is constructed, a + * {@code ConvertData} object is passed in to be used as input.</p> * - * @see org.openoffice.xmerge.PluginFactory - * @see org.openoffice.xmerge.DocumentDeserializerFactory + * @see org.openoffice.xmerge.PluginFactory + * @see org.openoffice.xmerge.DocumentDeserializerFactory */ public interface DocumentDeserializer { /** - * <p>Convert the data passed into the <code>DocumentDeserializer</code> - * constructor into the "Office" <code>Document</code> - * format.</p> + * Convert the data passed into the {@code DocumentDeserializer} constructor + * into the "Office" {@code Document} format. * - * <p>This method may or may not be thread-safe. It is expected - * that the user code does not call this method in more than one - * thread. And for most cases, this method is only done once.</p> + * <p>This method may or may not be thread-safe. It is expected that the + * user code does not call this method in more than one thread. And for + * most cases, this method is only done once.</p> * - * @return The resulting <code>Document</code> object from conversion. + * @return The resulting {@code Document} object from conversion. * - * @throws ConvertException If any Convert error occurs. - * @throws IOException If any I/O error occurs. + * @throws ConvertException If any Convert error occurs. + * @throws IOException If any I/O error occurs. */ Document deserialize() throws ConvertException, IOException; -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer2.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer2.java index a866f8237dc5..95f34413ef31 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer2.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer2.java @@ -21,41 +21,41 @@ package org.openoffice.xmerge; import java.io.IOException; /** - * <p>A <code>DocumentDeserializer</code> represents a converter that - * converts "Device" <code>Document</code> objects into the - * "Office" <code>Document</code> format.</p> + * A {@code DocumentDeserializer} represents a converter that converts + * "Device" {@code Document} objects into the "Office" + * {@code Document} format. * - * <p>The <code>PluginFactory</code> {@link - * org.openoffice.xmerge.DocumentDeserializerFactory#createDocumentDeserializer - * createDocumentDeserializer} method creates a <code>DocumentDeserializer</code>, - * which may or may not implement <code>DocumentDeserializer2</code>. - * When it is constructed, a - * <code>ConvertData</code> object is passed in to be used as input.</p> + * <p>The {@code PluginFactory} {@link + * org.openoffice.xmerge.DocumentDeserializerFactory#createDocumentDeserializer + * createDocumentDeserializer} method creates a {@code DocumentDeserializer}, + * which may or may not implement {@code DocumentDeserializer2}. When it is + * constructed, a {@code ConvertData} object is passed in to be used as input. + * </p> * - * @see org.openoffice.xmerge.PluginFactory - * @see org.openoffice.xmerge.DocumentDeserializerFactory + * @see org.openoffice.xmerge.PluginFactory + * @see org.openoffice.xmerge.DocumentDeserializerFactory */ public interface DocumentDeserializer2 extends DocumentSerializer { /** - * <p>Convert the data passed into the <code>DocumentDeserializer2</code> - * constructor into the "Office" <code>Document</code> - * format. The URL's passed may be used to resolve links and to choose the - * name of the output office document.</p> + * Convert the data passed into the {@code DocumentDeserializer2} + * constructor into the "Office" {@code Document} format. * - * <p>This method may or may not be thread-safe. It is expected - * that the user code does not call this method in more than one - * thread. And for most cases, this method is only done once.</p> + * <p>The URL's passed may be used to resolve links and to choose the name + * of the output office document.</p> * - * @return The resulting <code>Document</code> object from conversion. + * <p>This method may or may not be thread-safe. It is expected that the + * user code does not call this method in more than one thread. And for + * most cases, this method is only done once.</p> * - * @param deviceURL URL of the device document (may be null if unknown) - * @param officeURL URL of the office document (may be null if unknown) + * @return The resulting {@code Document} object from conversion. * - * @throws ConvertException If any Convert error occurs. - * @throws IOException If any I/O error occurs. + * @param deviceURL URL of the device document (may be null if unknown) + * @param officeURL URL of the office document (may be null if unknown) + * + * @throws ConvertException If any Convert error occurs. + * @throws IOException If any I/O error occurs. */ Document deserialize(String deviceURL, String officeURL) throws ConvertException, IOException; -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializerFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializerFactory.java index 1eccfded7a67..3d10d03bfe5d 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializerFactory.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializerFactory.java @@ -19,38 +19,33 @@ package org.openoffice.xmerge; /** - * <p>A <code>DocumentDeserializer</code> object is used to convert - * from the "Device" <code>Document</code> format to the - * "Office" <code>Document</code> format.</p> + * A {@code DocumentDeserializer} object is used to convert from the + * "Device" {@code Document} format to the "Office" + * {@code Document} format. * - * <p>All plug-in implementations of the <code>PluginFactory</code> - * interface that also support deserialization must also - * implement this interface.</p> + * <p>All plug-in implementations of the {@code PluginFactory} interface that + * also support deserialization must also implement this interface.</p> * - * @see PluginFactory - * @see DocumentDeserializer + * @see PluginFactory + * @see DocumentDeserializer */ public interface DocumentDeserializerFactory { /** - * <p>The <code>DocumentDeserializer</code> is used to convert - * from the "Device" <code>Document</code> format to - * the "Office" <code>Document</code> format.</p> + * The {@code DocumentDeserializer} is used to convert from the + * "Device" {@code Document} format to the "Office" + * {@code Document} format. * - * <p>The <code>ConvertData</code> object is passed along to the - * created <code>DocumentDeserializer</code> via its constructor. - * The <code>ConvertData</code> is read and converted when the - * the <code>DocumentDeserializer</code> object's - * <code>deserialize</code> method is called. - * </p> + * <p>The {@code ConvertData} object is passed along to the created + * {@code DocumentDeserializer} via its constructor. The {@code ConvertData} + * is read and converted when the {@code DocumentDeserializer} object's + * {@code deserialize} method is called.</p> * - * @param cd <code>ConvertData</code> object that the created - * <code>DocumentDeserializer</code> object uses as - * input. + * @param cd {@code ConvertData} object that the created + * {@code DocumentDeserializer} object uses as input. * - * @return A <code>DocumentDeserializer</code> object. + * @return A {@code DocumentDeserializer} object. */ DocumentDeserializer createDocumentDeserializer(ConvertData cd); -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMerger.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMerger.java index c575ef892550..4347c70fc6f8 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMerger.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMerger.java @@ -19,65 +19,56 @@ package org.openoffice.xmerge; /** - * <p>A <code>DocumentMerger</code> can merge changes from a modified - * "Device" <code>Document</code> to the assigned original - * "Office" <code>Document</code>.</p> + * A {@code DocumentMerger} can merge changes from a modified "Device" + * {@code Document} to the assigned original "Office" {@code Document}. * - * <p>Merge is useful when an <code>OfficeDocument</code> - * is converted to a "Device" <code>Document</code> format, - * and the "Device" <code>Document</code> version is modified. - * Those changes can be merged back into the original - * <code>OfficeDocument</code> with the merger. The merger is capable - * of doing this even if the "Device" format is lossy in - * comparison to the <code>OfficeDocument</code> format.</p> + * <p>Merge is useful when an {@code OfficeDocument} is converted to a + * "Device" {@code Document} format, and the "Device" + * {@code Document} version is modified. Those changes can be merged back into + * the original {@code OfficeDocument} with the merger. The merger is capable + * of doing this even if the "Device" format is lossy in + * comparison to the {@code OfficeDocument} format.</p> * - * <p>The <code>ConverterCapabilities</code> object is what the - * DocumentMerger utilizes to know how the "Office" - * <code>Document</code> tags are supported in the "Device" - * format.</p> + * <p>The {@code ConverterCapabilities} object is what the DocumentMerger + * utilizes to know how the "Office" {@code Document} tags are + * supported in the "Device" format.</p> * - * <p>The <code>DocumentMerger</code> object is created by a - * the <code>DocumentMergerFactory</code> {@link - * org.openoffice.xmerge.DocumentMergerFactory#createDocumentMerger - * createDocumenMerger} method. When it is constructed, the - * "Original Office" <code>Document</code> object is - * passed in to be used as input.</p> + * <p>The {@code DocumentMerger} object is created by a the + * {@code DocumentMergerFactory} {@link + * org.openoffice.xmerge.DocumentMergerFactory#createDocumentMerger + * createDocumenMerger} method. When it is constructed, the "Original + * Office" {@code Document} object is passed in to be used as input.</p> * - * @see org.openoffice.xmerge.PluginFactory - * @see org.openoffice.xmerge.DocumentMergerFactory - * @see org.openoffice.xmerge.ConverterCapabilities + * @see org.openoffice.xmerge.PluginFactory + * @see org.openoffice.xmerge.DocumentMergerFactory + * @see org.openoffice.xmerge.ConverterCapabilities */ public interface DocumentMerger { /** - * <p>This method will find the changes that had happened - * in the <code>modifiedDoc</code> <code>Document</code> - * object given the designated original <code>Document</code>.</p> + * This method will find the changes that had happened in the + * {@code modifiedDoc} {@code Document} object given the designated original + * {@code Document}. * - * <p>Note that this process may need the knowledge of the - * conversion process since some conversion process are lossy. - * Items/Data that are lost during the conversion process are not - * classified as changes. The main target of this method - * is to apply the changes done in <code>modifiedDoc</code> - * into the assigned original <code>Document</code> object, thus - * it also will try to preserve items that were originally in - * the original <code>Document</code>, but never got transferred - * during the - * {@link org.openoffice.xmerge.DocumentSerializer#serialize - * serialize} process/method call. After this method call, the - * original <code>Document</code> object will contain the changes - * applied.</p> + * <p>Note that this process may need the knowledge of the conversion + * process since some conversion process are lossy. Items/Data that are + * lost during the conversion process are not classified as changes. The + * main target of this method is to apply the changes done in + * {@code modifiedDoc} into the assigned original {@code Document} object, + * thus it also will try to preserve items that were originally in the + * original {@code Document}, but never got transferred during the + * {@link org.openoffice.xmerge.DocumentSerializer#serialize serialize} + * process/method call. After this method call, the original + * {@code Document} object will contain the changes applied.</p> * - * <p>This method may or may not be thread-safe. - * Also, it is expected that the user uses only one instance - * of a <code>DocumentMerger</code> object per merge process. - * Create another <code>DocumentMerger</code> object for another - * merge process.</p> + * <p>This method may or may not be thread-safe. Also, it is expected that + * the user uses only one instance of a {@code DocumentMerger} object per + * merge process. Create another {@code DocumentMerger} object for another + * merge process.</p> * - * @param modifiedDoc device <code>Document</code> object. + * @param modifiedDoc device {@code Document} object. * - * @throws MergeException If any merge error occurs. + * @throws MergeException If any merge error occurs. */ void merge(Document modifiedDoc) throws MergeException; -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMergerFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMergerFactory.java index 3ddbc56569c7..e665d662a50c 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMergerFactory.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMergerFactory.java @@ -19,36 +19,32 @@ package org.openoffice.xmerge; /** - * <p>All plug-in implementations of the <code>PluginFactory</code> - * interface that also support merging must also implement - * this interface.</p> + * All plug-in implementations of the {@code PluginFactory} interface that also + * support merging must also implement this interface. * - * <p>Merge is useful when an <code>OfficeDocument</code> - * is converted to a "Device" <code>Document</code> format, - * and the "Device" <code>Document</code> version is modified. - * Those changes can be merged back into the original - * <code>OfficeDocument</code> with the merger. The merger is capable - * of doing this even if the "Device" format is lossy in - * comparison to the <code>OfficeDocument</code> format.</p> + * <p>Merge is useful when an {@code OfficeDocument} is converted to a + * "Device" {@code Document} format, and the "Device" + * {@code Document} version is modified.</p> * - * @see PluginFactory - * @see DocumentMerger - * @see ConverterCapabilities + * <p>Those changes can be merged back into the original {@code OfficeDocument} + * with the merger. The merger is capable of doing this even if the + * "Device" format is lossy in comparison to the {@code OfficeDocument} + * format.</p> * + * @see PluginFactory + * @see DocumentMerger + * @see ConverterCapabilities */ public interface DocumentMergerFactory { /** - * <p>Create a <code>DocumentMerger</code> object given a - * <code>Document</code> object.</p> + * Create a {@code DocumentMerger} object given a {@code Document} object. * - * @param doc <code>Document</code> object that the created - * <code>DocumentMerger</code> object uses as a base - * <code>Document</code> for merging changes into. + * @param doc {@code Document} object that the created + * {@code DocumentMerger} object uses as a base {@code Document} + * for merging changes into. * - * @return A <code>DocumentMerger</code> object or null if none - * exists. + * @return A {@code DocumentMerger} object or {@code null} if none exists. */ DocumentMerger createDocumentMerger(Document doc); -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer.java index 6937fc4f28b0..c31e07c54ef1 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer.java @@ -21,36 +21,34 @@ package org.openoffice.xmerge; import java.io.IOException; /** - * <p>A <code>DocumentSerializer</code> represents a converter that - * converts a "Office" <code>Document</code> to a - * "Device" <code>Document</code> format.</p> + * A {@code DocumentSerializer} represents a converter that converts a + * "Office" {@code Document} to a "Device" {@code Document} + * format. * - * <p>The <code>DocumentSerializer</code> object is created by a - * the <code>PluginFactory</code> {@link - * org.openoffice.xmerge.DocumentSerializerFactory#createDocumentSerializer - * createDocumentSerializer} method. When it is constructed, a - * "Office" <code>Document</code> object is passed in to - * be used as input.</p> - * @see org.openoffice.xmerge.PluginFactory - * @see org.openoffice.xmerge.DocumentSerializerFactory + * <p>The {@code DocumentSerializer} object is created by a the + * {@code PluginFactory} {@link + * org.openoffice.xmerge.DocumentSerializerFactory#createDocumentSerializer + * createDocumentSerializer} method. When it is constructed, a + * "Office" {@code Document} object is passed in to be used as input. + * </p> + * + * @see org.openoffice.xmerge.PluginFactory + * @see org.openoffice.xmerge.DocumentSerializerFactory */ public interface DocumentSerializer { /** - * <p>Convert the data passed into the <code>DocumentSerializer</code> - * constructor into the "Device" <code>Document</code> - * format.</p> + * Convert the data passed into the {@code DocumentSerializer} constructor + * into the "Device" {@code Document} format. * - * <p>This method may or may not be thread-safe. It is expected - * that the user code does not call this method in more than one - * thread. And for most cases, this method is only done once.</p> + * <p>This method may or may not be thread-safe. It is expected that the + * user code does not call this method in more than one thread. And for + * most cases, this method is only done once.</p> * - * @return <code>ConvertData</code> object to pass back the - * converted data. + * @return {@code ConvertData} object to pass back the converted data. * - * @throws ConvertException If any conversion error occurs. - * @throws IOException If any I/O error occurs. + * @throws ConvertException If any conversion error occurs. + * @throws IOException If any I/O error occurs. */ ConvertData serialize() throws ConvertException, IOException; -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer2.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer2.java index e2aee8488d4a..56a1a1116411 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer2.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer2.java @@ -21,43 +21,43 @@ package org.openoffice.xmerge; import java.io.IOException; /** - * <p>A <code>DocumentSerializer2</code> represents a converter that - * converts a "Office" <code>Document</code> to a - * "Device" <code>Document</code> format.</p> + * A {@code DocumentSerializer2} represents a converter that converts a + * "Office" {@code Document} to a "Device" {@code Document} + * format. * - * <p>The <code>PluginFactory</code> {@link - * org.openoffice.xmerge.DocumentSerializerFactory#createDocumentSerializer - * createDocumentSerializer} method creates a <code>DocumentSerializer</code>, - * which may or may not implement <code>DocumentSerializer2</code>. - * When it is constructed, a - * "Office" <code>Document</code> object is passed in to - * be used as input.</p> + * <p>The {@code PluginFactory} {@link + * org.openoffice.xmerge.DocumentSerializerFactory#createDocumentSerializer + * createDocumentSerializer} method creates a {@code DocumentSerializer}, which + * may or may not implement {@code DocumentSerializer2}. When it is constructed, + * a "Office" {@code Document} object is passed in to be used as + * input.</p> * - * @see org.openoffice.xmerge.PluginFactory - * @see org.openoffice.xmerge.DocumentSerializerFactory + * @see org.openoffice.xmerge.PluginFactory + * @see org.openoffice.xmerge.DocumentSerializerFactory */ public interface DocumentSerializer2 extends DocumentSerializer { /** - * <p>Convert the data passed into the <code>DocumentSerializer2</code> - * constructor into the "Device" <code>Document</code> - * format. The URL's passed may be used to resolve links and to name - * the output device document(s).</p> + * Convert the data passed into the {@code DocumentSerializer2} constructor + * into the "Device" {@code Document} format. * - * <p>This method may or may not be thread-safe. It is expected - * that the user code does not call this method in more than one - * thread. And for most cases, this method is only done once.</p> + * <p>The URL's passed may be used to resolve links and to name the output + * device document(s).</p> * - * @return <code>ConvertData</code> object to pass back the - * converted data. + * <p>This method may or may not be thread-safe. It is expected that the + * user code does not call this method in more than one thread. And for + * most cases, this method is only done once.</p> * - * @param officeURL URL of the office document (may be null if unknown) - * @param deviceURL URL of the device document (may be null if unknown) + * @return {@code ConvertData} object to pass back the converted data. * - * @throws ConvertException If any conversion error occurs. - * @throws IOException If any I/O error occurs. + * @param officeURL URL of the office document (may be null if + * unknown) + * @param deviceURL URL of the device document (may be null if + * unknown) + * + * @throws ConvertException If any conversion error occurs. + * @throws IOException If any I/O error occurs. */ ConvertData serialize(String officeURL, String deviceURL) throws ConvertException, IOException; -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializerFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializerFactory.java index 262256610c0e..12ab4c045616 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializerFactory.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializerFactory.java @@ -19,36 +19,32 @@ package org.openoffice.xmerge; /** - * <p>A <code>DocumentSerializer</code> object is used to convert - * from the "Office" <code>Document</code> format to the - * "Device" <code>Document</code> format.</p> + * A {@code DocumentSerializer} object is used to convert from the + * "Office" {@code Document} format to the "Device" + * {@code Document} format. * - * <p>All plug-in implementations of the <code>PluginFactory</code> - * interface that also support serialization must also - * implement this interface.</p> + * <p>All plug-in implementations of the {@code PluginFactory} interface that + * also support serialization must also implement this interface.</p> * - * @see PluginFactory - * @see DocumentSerializer + * @see PluginFactory + * @see DocumentSerializer */ public interface DocumentSerializerFactory { /** - * <p>The <code>DocumentSerializer</code> is used to convert - * from the "Office" <code>Document</code> format - * to the "Device" <code>Document</code> format.</p> + * The {@code DocumentSerializer} is used to convert from the + * "Office" {@code Document} format to the "Device" + * {@code Document} format. * - * The <code>ConvertData</code> object is passed along to the - * created <code>DocumentSerializer</code> via its constructor. - * The <code>ConvertData</code> is read and converted when the - * the <code>DocumentSerializer</code> object's - * <code>serialize</code> method is called. + * <p>The {@code ConvertData} object is passed along to the created + * {@code DocumentSerializer} via its constructor. The {@code ConvertData} + * is read and converted when the the {@code DocumentSerializer} object's + * {@code serialize} method is called.</p> * - * @param doc <code>Document</code> object that the created - * <code>DocumentSerializer</code> object uses - * as input. + * @param doc {@code Document} object that the created + * {@code DocumentSerializer} object uses as input. * - * @return A <code>DocumentSerializer</code> object. + * @return A <code>DocumentSerializer</code> object. */ DocumentSerializer createDocumentSerializer(Document doc); -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/MergeException.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/MergeException.java index 3ac78c65a2eb..c592bfb6504d 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/MergeException.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/MergeException.java @@ -19,18 +19,16 @@ package org.openoffice.xmerge; /** - * This <code>Exception</code> is thrown by merge algorithms. + * This {@code Exception} is thrown by merge algorithms. */ public class MergeException extends Exception { /** - * Exception thrown by merge algorithms. + * Exception thrown by merge algorithms. * - * @param message Message to be included in the - * <code>Exception</code>. + * @param message Message to be included in the {@code Exception}. */ public MergeException(String message) { super(message); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/PluginFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/PluginFactory.java index 62df0096c941..c00a21b50523 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/PluginFactory.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/PluginFactory.java @@ -23,161 +23,141 @@ import java.io.InputStream; import java.io.IOException; /** - * <p>A <code>PluginFactory</code> encapsulates the - * conversions from one <code>Document</code> format to another. - * It provides conversions in both directions. Refer to the - * <a href="package-summary.html#package_description"> - * package description</a> for its usage.</p> + * A {@code PluginFactory} encapsulates the conversions from one {@code Document} + * format to another. * - * <p>Conversion from the "Office" <code>Document</code> - * format to a "Device" <code>Document</code> format may - * be lossy, i.e. some information may be lost. If a plug-in - * implements the <code>DocumentMergerFactory</code> interface, - * then there is the possibility for merging the changes done on the - * "Device" <code>Document</code> back to the original - * "Office" <code>Document</code> via the - * <code>DocumentMerger</code> interface.</p> + * <p>It provides conversions in both directions. Refer to the + * <a href="package-summary.html#package_description"> package description</a> + * for its usage.</p> * - * <p>Plug-ins that convert from the "Device" - * <code>Document</code> format to the "Office" - * <code>Document</code> format must implement the - * <code>DocumentDeserializerFactory</code> interface. Plug-ins - * that convert from the "Office" <code>Document</code> - * format to the "Device" format must implement the - * <code>DocumentSerializerFactory</code> interface. + * <p>Conversion from the "Office" {@code Document} format to a + * "Device" {@code Document} format may be lossy, i.e. some + * information may be lost. If a plug-in implements the + * {@code DocumentMergerFactory} interface, then there is the possibility for + * merging the changes done on the "Device" {@code Document} back to + * the original "Office" {@code Document} via the {@code DocumentMerger} + * interface.</p> * - * <p>All plug-ins should have an associated Plugin Configuration XML - * File which describes the capabilities of the plug-in. If the - * plug-in is bundled in a jarfile, then this XML file is also bundled - * with the jarfile. The data in the XML file is managed by the - * <code>ConverterInfo</code> object. The <code>ConverterInfoMgr</code> - * manages a registry of all <code>ConverterInfo</code> objects. For - * more information about this XML file, refer to - * <a href="converter/xml/sxc/package-summary.html"> - * org.openoffice.xmerge.util.registry</a>.</p> + * <p>Plug-ins that convert from the "Device" {@code Document} format + * to the "Office" {@code Document} format must implement the + * {@code DocumentDeserializerFactory} interface. Plug-ins that convert from + * the "Office" {@code Document} format to the "Device" + * format must implement the {@code DocumentSerializerFactory} interface.</p> * - * @see Document - * @see DocumentSerializer - * @see DocumentSerializerFactory - * @see DocumentDeserializer - * @see DocumentDeserializerFactory - * @see DocumentMerger - * @see DocumentMergerFactory - * @see ConverterInfo - * @see org.openoffice.xmerge.util.registry.ConverterInfoMgr + * <p>All plug-ins should have an associated Plug-in Configuration XML File which + * describes the capabilities of the plug-in. If the plug-in is bundled in a + * jarfile, then this XML file is also bundled with the jarfile. The data in + * the XML file is managed by the {@code ConverterInfo} object. The + * {@code ConverterInfoMgr} manages a registry of all {@code ConverterInfo} + * objects. For more information about this XML file, refer to + * <a href="converter/xml/sxc/package-summary.html">org.openoffice.xmerge.util.registry</a>. + * </p> + * + * @see Document + * @see DocumentSerializer + * @see DocumentSerializerFactory + * @see DocumentDeserializer + * @see DocumentDeserializerFactory + * @see DocumentMerger + * @see DocumentMergerFactory + * @see ConverterInfo + * @see org.openoffice.xmerge.util.registry.ConverterInfoMgr */ public abstract class PluginFactory { /** - * Cached <code>ConvertInfo</code> object. + * Cached {@code ConvertInfo} object. */ private ConverterInfo ciCache; - /** - * Constructor that caches the <code>ConvertInfo</code> that - * corresponds to the registry information for this plug-in. + * Constructor that caches the {@code ConvertInfo} that corresponds to the + * registry information for this plug-in. * - * @param ci <code>ConvertInfo</code> object. + * @param ci {@code ConvertInfo} object. */ public PluginFactory(ConverterInfo ci) { ciCache=ci; } - /** - * Returns the <code>ConvertInfo</code> that corresponds to this - * plug-in. + * Returns the {@code ConvertInfo} that corresponds to this plug-in. * - * @return The <code>ConvertInfo</code> that corresponds to this - * plug-in. + * @return The {@code ConvertInfo} that corresponds to this plug-in. */ public ConverterInfo getConverterInfo () { return ciCache; } - /** - * <p>Create a <code>Document</code> object that corresponds to - * the Office data passed in via the <code>InputStream</code> - * object. This abstract method must be implemented for each - * plug-in.</p> + * Create a {@code Document} object that corresponds to the Office data + * passed in via the {@code InputStream} object. + * + * <p>This abstract method must be implemented for each plug-in.</p> * - * <p>This method will read from the given <code>InputStream</code> - * object. The returned <code>Document</code> object will contain - * the necessary data for the other objects created by the - * <code>PluginFactory</code> to process, like a - * <code>DocumentSerializer</code> object and a - * <code>DocumentMerger</code> object.</p> + * <p>This method will read from the given {@code InputStream} object. The + * returned {@code Document} object will contain the necessary data for the + * other objects created by the {@code PluginFactory} to process, like a + * {@code DocumentSerializer} object and a {@code DocumentMerger} object.</p> * - * @param name The <code>Document</code> name. - * @param is <code>InputStream</code> object corresponding - * to the <code>Document</code>. + * @param name The {@code Document} name. + * @param is {@code InputStream} object corresponding to the + * {@code Document}. * - * @return A <code>Document</code> object representing the - * particular <code>Document</code> format for the - * <code>PluginFactory</code>. + * @return A {@code Document} object representing the particular + * {@code Document} format for the {@code PluginFactory}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public abstract Document createOfficeDocument(String name, InputStream is) throws IOException; - /** - * <p>Create a <code>Document</code> object that corresponds to - * the Office data passed in via the <code>InputStream</code> - * object. This abstract method must be implemented for each - * plug-in.</p> + * Create a {@code Document} object that corresponds to the Office data + * passed in via the {@code InputStream} object. * - * <p>This method will read from the given <code>InputStream</code> - * object. The returned <code>Document</code> object will contain - * the necessary data for the other objects created by the - * <code>PluginFactory</code> to process, like a - * <code>DocumentSerializer</code> object and a - * <code>DocumentMerger</code> object.</p> + * <p>This abstract method must be implemented for each plug-in.</p> * - * @param name The <code>Document</code> name. - * @param is <code>InputStream</code> object corresponding - * to the <code>Document</code>. - * @param isZip <code>boolean</code> to show that the created office - * document is to be zipped. + * <p>This method will read from the given {@code InputStream} object. The + * returned {@code Document} object will contain the necessary data for the + * other objects created by the {@code PluginFactory} to process, like a + * {@code DocumentSerializer} object and a {@code DocumentMerger} object.</p> * - * @return A <code>Document</code> object representing the - * particular <code>Document</code> format for the - * <code>PluginFactory</code>. + * @param name The {@code Document} name. + * @param is {@code InputStream} object corresponding to the + * {@code Document}. + * @param isZip {@code boolean} to show that the created office document + * is to be zipped. * - * @throws IOException If any I/O error occurs. + * @return A {@code Document} object representing the particular + * {@code Document} format for the {@code PluginFactory}. + * + * @throws IOException If any I/O error occurs. */ - public abstract Document createOfficeDocument(String name, InputStream is,boolean isZip) - throws IOException; - + public abstract Document createOfficeDocument(String name, InputStream is, + boolean isZip) throws IOException; /** - * <p>Create a <code>Document</code> object that corresponds to - * the device data passed in via the <code>InputStream</code> - * object. This abstract method must be implemented for each - * plug-in.</p> + * Create a {@code Document} object that corresponds to the device data + * passed in via the {@code InputStream} object. * - * <p>This method will read from the given <code>InputStream</code> - * object. The returned <code>Document</code> object will contain - * the necessary data for the other objects created by the - * <code>PluginFactory</code> to process, like a - * <code>DocumentSerializer</code> object and a - * <code>DocumentMerger</code> object.</p> + * <p>This abstract method must be implemented for each plug-in.</p> * - * @param name The <code>Document</code> name. - * @param is <code>InputStream</code> object corresponding - * to the <code>Document</code>. + * <p>This method will read from the given {@code InputStream} object. The + * returned {@code Document} object will contain the necessary data for the + * other objects created by the {@code PluginFactory} to process, like a + * {@code DocumentSerializer} object and a {@code DocumentMerger} object.</p> * - * @return A <code>Document</code> object representing the - * particular <code>Document</code> format for the - * <code>PluginFactory</code>. + * @param name The {@code Document} name. + * @param is {@code InputStream} object corresponding to the + * {@code Document}. * - * @throws IOException If any I/O error occurs. + * @return A {@code Document} object representing the particular + * {@code Document} format for the {@code PluginFactory}. + * + * @throws IOException If any I/O error occurs. */ public abstract Document createDeviceDocument(String name, InputStream is) throws IOException; -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/Version.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/Version.java index 27c25196aac0..02d16eedfe83 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/Version.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/Version.java @@ -19,10 +19,10 @@ package org.openoffice.xmerge; /** - * This class provides a quick utility to check the version of the - * jar file. It has a main method that prints out the version - * info. It also provides two static methods for runtime classes - * to query. + * This class provides a quick utility to check the version of the jar file. + * + * <p>It has a main method that prints out the version info. It also provides + * two static methods for runtime classes to query.</p> */ public final class Version { @@ -31,41 +31,38 @@ public final class Version { private static final Package pkg = version.getClass().getPackage(); /** - * Private constructor to provide a singleton instance. + * Private constructor to provide a singleton instance. */ private Version() { } /** - * Returns specification version. + * Returns specification version. * - * @return The specification version. + * @return The specification version. */ public static String getSpecificationVersion() { return pkg.getSpecificationVersion(); } /** - * Returns implementation version. + * Returns implementation version. * - * @return The implementation version. + * @return The implementation version. */ - public static String getImplementationVersion() { return pkg.getImplementationVersion(); } /** - * Main method for printing out version info. + * Main method for printing out version info. * - * @param args Array of arguments, not used. + * @param args Array of arguments, not used. */ public static void main(String args[]) { - System.out.println("Specification-Title: " + pkg.getSpecificationTitle()); System.out.println("Specification-Vendor: " + pkg.getSpecificationVendor()); System.out.println("Specification-Version: " + pkg.getSpecificationVersion()); System.out.println("Implementation-Version: " + pkg.getImplementationVersion()); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java index c7088a6f3a51..a2e67c08f4cf 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java @@ -24,7 +24,6 @@ import java.io.StringWriter; import java.io.ByteArrayOutputStream; import java.io.IOException; - import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.ParserConfigurationException; @@ -41,17 +40,16 @@ import org.xml.sax.SAXException; import org.openoffice.xmerge.util.Debug; /** - * An implementation of <code>Document</code> for - * StarOffice documents. + * An implementation of {@code Document} for StarOffice documents. */ public class DOMDocument implements org.openoffice.xmerge.Document { - /** Factory for <code>DocumentBuilder</code> objects. */ + /** Factory for {@code DocumentBuilder} objects. */ private static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - /** DOM <code>Document</code> of content.xml. */ + /** DOM {@code Document} of content.xml. */ private Document contentDoc = null; private String documentName = null; @@ -59,54 +57,50 @@ public class DOMDocument private String fileExt = null; /** - * Default constructor. + * Default constructor. * - * @param name <code>Document</code> name. - * @param ext <code>Document</code> extension. + * @param name {@code Document} name. + * @param ext {@code Document} extension. */ - public DOMDocument(String name,String ext) - { - this(name,ext,true, false); + public DOMDocument(String name,String ext) { + this(name,ext,true, false); } - /** - * Returns the file extension of the <code>Document</code> - * represented. + /** + * Returns the file extension of the {@code Document} represented. * - * @return file extension of the <code>Document</code>. + * @return file extension of the {@code Document}. */ private String getFileExtension() { return fileExt; } - /** - * Constructor with arguments to set <code>namespaceAware</code> - * and <code>validating</code> flags. + * Constructor with arguments to set {@code namespaceAware} and + * {@code validating} flags. * - * @param name <code>Document</code> name (may or may not - * contain extension). - * @param ext <code>Document</code> extension. - * @param namespaceAware Value for <code>namespaceAware</code> flag. - * @param validating Value for <code>validating</code> flag. + * @param name {@code Document} name (may or may not contain + * extension). + * @param ext {@code Document} extension. + * @param namespaceAware Value for {@code namespaceAware} flag. + * @param validating Value for {@code validating} flag. */ - private DOMDocument(String name, String ext,boolean namespaceAware, boolean validating) { + private DOMDocument(String name, String ext,boolean namespaceAware, + boolean validating) { factory.setValidating(validating); factory.setNamespaceAware(namespaceAware); this.fileExt = ext; - this.documentName = trimDocumentName(name); + this.documentName = trimDocumentName(name); this.fileName = documentName + getFileExtension(); } - /** - * Removes the file extension from the <code>Document</code> - * name. + * Removes the file extension from the {@code Document} name. * - * @param name Full <code>Document</code> name with extension. + * @param name Full {@code Document} name with extension. * - * @return Name of <code>Document</code> without the extension. + * @return Name of {@code Document} without the extension. */ private String trimDocumentName(String name) { String temp = name.toLowerCase(); @@ -122,15 +116,15 @@ public class DOMDocument return name; } - /** - * Return a DOM <code>Document</code> object of the document content - * file. Note that a content DOM is not created when the constructor - * is called. So, either the <code>read</code> method or the - * <code>initContentDOM</code> method will need to be called ahead - * on this object before calling this method. + * Return a DOM {@code Document} object of the document content file. + * + * <p>Note that a content DOM is not created when the constructor is called. + * So, either the {@code read} method or the {@code initContentDOM} method + * will need to be called ahead on this object before calling this method. + * </p> * - * @return DOM <code>Document</code> object. + * @return DOM {@code Document} object. */ public Document getContentDOM() { @@ -138,46 +132,42 @@ public class DOMDocument } /** - * Sets the Content of the <code>Document</code> to the contents of the - * supplied <code>Node</code> list. + * Sets the Content of the {@code Document} to the contents of the supplied + * {@code Node} list. * - * @param newDom DOM <code>Document</code> object. + * @param newDom DOM {@code Document} object. */ public void setContentDOM( Node newDom) { contentDoc=(Document)newDom; } - /** - * Return the name of the <code>Document</code>. + * Return the name of the {@code Document}. * - * @return The name of <code>Document</code>. + * @return The name of {@code Document}. */ public String getName() { return documentName; } - /** - * Return the file name of the <code>Document</code>, possibly - * with the standard extension. + * Return the file name of the {@code Document}, possibly with the standard + * extension. * - * @return The file name of <code>Document</code>. + * @return The file name of {@code Document}. */ public String getFileName() { return fileName; } - /** - * Read the Office <code>Document</code> from the specified - * <code>InputStream</code>. + * Read the Office {@code Document} from the specified {@code InputStream}. * - * @param is Office document <code>InputStream</code>. + * @param is Office document {@code InputStream}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void read(InputStream is) throws IOException { Debug.log(Debug.INFO, "reading file"); @@ -185,19 +175,18 @@ public class DOMDocument DocumentBuilder builder = factory.newDocumentBuilder(); contentDoc = builder.parse(is); } catch (ParserConfigurationException ex) { - System.out.println("Error:"+ ex); + System.out.println("Error:"+ ex); } catch (SAXException ex) { - System.out.println("Error:"+ ex); + System.out.println("Error:"+ ex); } } - /** - * Write out content to the supplied <code>OutputStream</code>. + * Write out content to the supplied {@code OutputStream}. * - * @param os XML <code>OutputStream</code>. + * @param os XML {@code OutputStream}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void write(OutputStream os) throws IOException { @@ -207,20 +196,17 @@ public class DOMDocument os.write(contentBytes); } - /** - * <p>Write out a <code>org.w3c.dom.Document</code> object into a - * <code>byte</code> array.</p> + * Write out a {@code org.w3c.dom.Document} object into a {@code byte} array. * - * <p>TODO: remove dependency on com.sun.xml.tree.XmlDocument - * package!</p> + * <p>TODO: remove dependency on {@code com.sun.xml.tree.XmlDocument} package! + * </p> * - * @param doc DOM <code>Document</code> object. + * @param doc DOM {@code Document} object. * - * @return <code>byte</code> array of DOM <code>Document</code> - * object. + * @return {@code byte} array of DOM {@code Document} object. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ private byte[] docToBytes(Document doc) throws IOException { @@ -248,83 +234,71 @@ public class DOMDocument // The method is in the XMLDocument class itself, not a helper meth = jaxpDoc.getMethod("write", - new Class[] { Class.forName("java.io.OutputStream") } ); + new Class[]{Class.forName("java.io.OutputStream")}); - meth.invoke(doc, new Object [] { baos } ); - } - else if (domImpl.equals("org.apache.crimson.tree.XmlDocument")) - { - System.out.println("Using Crimson"); - Class<?> crimsonDoc = Class.forName("org.apache.crimson.tree.XmlDocument"); - // The method is in the XMLDocument class itself, not a helper + meth.invoke(doc, new Object[]{baos}); + } else if (domImpl.equals("org.apache.crimson.tree.XmlDocument")) { + System.out.println("Using Crimson"); + Class<?> crimsonDoc = Class.forName("org.apache.crimson.tree.XmlDocument"); + // The method is in the XMLDocument class itself, not a helper meth = crimsonDoc.getMethod("write", - new Class[] { Class.forName("java.io.OutputStream") } ); + new Class[]{Class.forName("java.io.OutputStream")}); - meth.invoke(doc, new Object [] { baos } ); - } - else if (domImpl.equals("org.apache.xerces.dom.DocumentImpl") - || domImpl.equals("org.apache.xerces.dom.DeferredDocumentImpl")) { + meth.invoke(doc, new Object[]{baos}); + } else if (domImpl.equals("org.apache.xerces.dom.DocumentImpl") + || domImpl.equals("org.apache.xerces.dom.DeferredDocumentImpl")) { System.out.println("Using Xerces"); // Try for Xerces - Class<?> xercesSer = - Class.forName("org.apache.xml.serialize.XMLSerializer"); + Class<?> xercesSer + = Class.forName("org.apache.xml.serialize.XMLSerializer"); // Get the OutputStream constructor // May want to use the OutputFormat parameter at some stage too - con = xercesSer.getConstructor(new Class [] - { Class.forName("java.io.OutputStream"), - Class.forName("org.apache.xml.serialize.OutputFormat") } ); - + con = xercesSer.getConstructor(new Class[]{Class.forName("java.io.OutputStream"), + Class.forName("org.apache.xml.serialize.OutputFormat")}); // Get the serialize method meth = xercesSer.getMethod("serialize", - new Class [] { Class.forName("org.w3c.dom.Document") } ); - + new Class[]{Class.forName("org.w3c.dom.Document")}); // Get an instance - Object serializer = con.newInstance(new Object [] { baos, null } ); - + Object serializer = con.newInstance(new Object[]{baos, null}); // Now call serialize to write the document - meth.invoke(serializer, new Object [] { doc } ); - } - else if (domImpl.equals("gnu.xml.dom.DomDocument")) { + meth.invoke(serializer, new Object[]{doc}); + } else if (domImpl.equals("gnu.xml.dom.DomDocument")) { System.out.println("Using GNU"); Class<?> gnuSer = Class.forName("gnu.xml.dom.ls.DomLSSerializer"); // Get the serialize method meth = gnuSer.getMethod("serialize", - new Class [] { Class.forName("org.w3c.dom.Node"), - Class.forName("java.io.OutputStream") } ); + new Class[]{Class.forName("org.w3c.dom.Node"), + Class.forName("java.io.OutputStream")}); // Get an instance Object serializer = gnuSer.newInstance(); // Now call serialize to write the document - meth.invoke(serializer, new Object [] { doc, baos } ); - } - else { + meth.invoke(serializer, new Object[]{doc, baos}); + } else { // We dont have another parser try { - DOMSource domSource = new DOMSource(doc); - StringWriter writer = new StringWriter(); - StreamResult result = new StreamResult(writer); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer transformer = tf.newTransformer(); - transformer.transform(domSource, result); - return writer.toString().getBytes(); - } - catch (Exception e) { + DOMSource domSource = new DOMSource(doc); + StringWriter writer = new StringWriter(); + StreamResult result = new StreamResult(writer); + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer transformer = tf.newTransformer(); + transformer.transform(domSource, result); + return writer.toString().getBytes(); + } catch (Exception e) { // We don't have another parser throw new IOException("No appropriate API (JAXP/Xerces) to serialize XML document: " + domImpl); } } - } - catch (ClassNotFoundException cnfe) { + } catch (ClassNotFoundException cnfe) { throw new IOException(cnfe.toString()); - } - catch (Exception e) { + } catch (Exception e) { // We may get some other errors, but the bottom line is that // the steps being executed no longer work throw new IOException(e.toString()); @@ -334,9 +308,4 @@ public class DOMDocument return bytes; } - -} - - - - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDB.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDB.java index 643cd64bcdd7..765c6f86569c 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDB.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDB.java @@ -21,139 +21,130 @@ package org.openoffice.xmerge.converter.palm; import java.io.UnsupportedEncodingException; /** - * <p>This class contains data for a single Palm database for use during - * a conversion process.</p> + * This class contains data for a single Palm database for use during a + * conversion process. * - * <p>It contains zero or more <code>Record</code> objects stored in an - * array. The index of the <code>Record</code> object in the array is - * the <code>Record</code> id or number for that specific <code>Record</code> object. - * Note that this class does not check for maximum number of Records - * allowable in an actual PDB.</p> + * <p>It contains zero or more {@code Record} objects stored in an array. The + * index of the {@code Record} object in the array is the {@code Record} id or + * number for that specific {@code Record} object. Note that this class does + * not check for maximum number of Records allowable in an actual PDB.</p> * - * <p>This class also contains the PDB name associated with the Palm - * database it represents. A PDB name consists of 32 bytes of a - * certain encoding (extended ASCII in this case).</p> + * <p>This class also contains the PDB name associated with the Palm database + * it represents. A PDB name consists of 32 bytes of a certain encoding + * (extended ASCII in this case).</p> * - * <p>The non default constructors take in a name parameter which may not - * be the exact PDB name to be used. The name parameter in - * <code>String</code> or <code>byte</code> array are converted to an exact - * <code>NAME_LENGTH</code> byte array. If the length of the name is less - * than <code>NAME_LENGTH</code>, it is padded with '\0' characters. If it - * is more, it gets truncated. The last character in the resulting byte - * array is always a '\0' character. The resulting byte array is stored in - * <code>bName</code>, and a corresponding String object <code>sName</code> - * that contains characters without the '\0' characters.</p> + * <p>The non default constructors take in a name parameter which may not be + * the exact PDB name to be used. The name parameter in {@code String} or + * {@code byte} array are converted to an exact {@code NAME_LENGTH} byte array. + * If the length of the name is less than {@code NAME_LENGTH}, it is padded + * with {@code '\0'} characters. If it is more, it gets truncated. The last + * character in the resulting byte array is always a {@code '\0'} character. + * The resulting byte array is stored in {@code bName}, and a corresponding + * {@code String} object {@code sName} that contains characters without the + * {@code '\0'} characters.</p> * - * <p>The <code>write</code> method is called within the - * {@link org.openoffice.xmerge.converter.palm.PalmDocument#write - * PalmDocument.write} method for writing out its data to the <code>OutputStream</code> - * object.</p> + * <p>The {@code write} method is called within the {@link + * org.openoffice.xmerge.converter.palm.PalmDocument#write + * PalmDocument.write} method for writing out its data to the + * {@code OutputStream} object.</p> * - * <p>The <code>read</code> method is called within the - * {@link org.openoffice.xmerge.converter.palm.PalmDocument#read - * PalmDocument.read} method for reading in its data from the <code>InputStream</code> - * object.</p> + * <p>The {@code read} method is called within the {@link + * org.openoffice.xmerge.converter.palm.PalmDocument#read PalmDocument.read} + * method for reading in its data from the {@code InputStream} object.</p> * - * @see PalmDocument - * @see Record + * @see PalmDocument + * @see Record */ public final class PalmDB { - - - /** Number of bytes for the name field in the PDB. */ + /** Number of bytes for the name field in the PDB. */ public final static int NAME_LENGTH = 32; - /** List of <code>Record</code> objects. */ + /** List of {@code Record} objects. */ private Record[] records; - /** PDB name in bytes. */ + /** PDB name in bytes. */ private byte[] bName = null; - /** PDB name in String. */ + /** PDB name in String. */ private String sName = null; - /** Creator ID. */ + /** Creator ID. */ private int creatorID = 0; - /** Type ID */ + /** Type ID */ private int typeID = 0; /** - * PDB version. Palm UInt16. - * It is treated as a number here, since there is no unsigned 16 bit - * in Java, int is used instead, but only 2 bytes are written out or - * read in. + * PDB version. Palm UInt16. + * It is treated as a number here, since there is no unsigned 16 bit in Java, + * {@code int} is used instead, but only 2 bytes are written out or read in. */ private int version = 0; /** - * PDB attribute - flags for the database. - * Palm UInt16. Unsignedness should be irrelevant. + * PDB attribute - flags for the database. + * Palm UInt16. Unsignedness should be irrelevant. */ private short attribute = 0; - /** - * Default constructor. + * Default constructor. * - * @param creatorID The PDB Creator ID. - * @param typeID The PDB Type ID. - * @param version The PDB header version. - * @param attribute The PDB header attribute. + * @param creatorID The PDB Creator ID. + * @param typeID The PDB Type ID. + * @param version The PDB header version. + * @param attribute The PDB header attribute. */ public PalmDB(int creatorID, int typeID, int version, short attribute) { - records = new Record[0]; setAttributes(creatorID, typeID, version, attribute); } - /** - * Constructor to create <code>PalmDB</code> object with - * <code>Record</code> objects. <code>recs.length</code> - * can be zero for an empty PDB. + * Constructor to create {@code PalmDB} object with {@code Record} objects. + * + * <p>{@code recs.length} can be zero for an empty PDB.</p> * - * @param name Suggested PDB name in a <code>String</code>. - * @param creatorID The PDB Creator ID. - * @param typeID The PDB Type ID. - * @param version The PDB header version. - * @param attribute The PDB header attribute. - * @param recs Array of <code>Record</code> objects. + * @param name Suggested PDB name in a {@code String}. + * @param creatorID The PDB Creator ID. + * @param typeID The PDB Type ID. + * @param version The PDB header version. + * @param attribute The PDB header attribute. + * @param recs Array of {@code Record} objects. * - * @throws UnsupportedEncodingException If <code>name</code> is - * not properly encoded. - * @throws NullPointerException If <code>recs</code> is null. + * @throws UnsupportedEncodingException If {@code name} is not properly + * encoded. + * @throws NullPointerException If {@code recs} is {@code null}. */ public PalmDB(String name, int creatorID, int typeID, int version, - short attribute, Record[] recs) - throws UnsupportedEncodingException { + short attribute, Record[] recs) + throws UnsupportedEncodingException { this(name.getBytes(PdbUtil.ENCODING), creatorID, typeID, version, attribute, recs); } - /** - * Constructor to create object with <code>Record</code> - * objects. <code>recs.length</code> can be zero for an - * empty PDB. + * Constructor to create object with {@code Record} objects. + * + * <p>{@code recs.length} can be zero for an empty PDB.</p> * - * @param name Suggested PDB name in a <code>byte</code> - * array. - * @param creatorID The PDB Creator ID. - * @param typeID The PDB Type ID. - * @param version The PDB header version. - * @param attribute The PDB header attribute. - * @param recs Array of <code>Record</code> objects. + * @param name Suggested PDB name in a {@code byte} array. + * @param creatorID The PDB Creator ID. + * @param typeID The PDB Type ID. + * @param version The PDB header version. + * @param attribute The PDB header attribute. + * @param recs Array of {@code Record} objects. * - * @throws UnsupportedEncodingException If <code>name</code> is - * not properly encoded. - * @throws NullPointerException If recs is null. + * @throws UnsupportedEncodingException If {@code name} is not properly + * encoded. + * @throws NullPointerException If {@code recs} is {@code null}. */ public PalmDB(byte[] name, int creatorID, int typeID, int version, - short attribute, Record[] recs) throws UnsupportedEncodingException { + short attribute, Record[] recs) + throws UnsupportedEncodingException { store(name); @@ -162,36 +153,35 @@ public final class PalmDB { setAttributes(creatorID, typeID, version, attribute); } - /** - * Set the attributes for the <code>PalmDB</code> object. + * Set the attributes for the {@code PalmDB} object. * - * @param creatorID The PDB Creator ID. - * @param typeID The PDB Type ID. - * @param version The PDB header version. - * @param attribute The PDB header attribute. + * @param creatorID The PDB Creator ID. + * @param typeID The PDB Type ID. + * @param version The PDB header version. + * @param attribute The PDB header attribute. */ - private void setAttributes (int creatorID, int typeID, int version, short attribute) { + private void setAttributes (int creatorID, int typeID, int version, + short attribute) { this.creatorID = creatorID; this.typeID = typeID; this.version = version; this.attribute = attribute; } - /** - * This private method is mainly used by the constructors above. - * to store bytes into name and also create a <code>String</code> - * representation. and also by the <code>read</code> method. + * This private method is mainly used by the constructors above. + * + * <p>to store bytes into name and also create a {@code String} + * representation, and also by the {@code read} method.</p> * - * TODO: Note that this method assumes that the <code>byte</code> - * array parameter contains one character per <code>byte</code>, - * else it would truncate improperly. + * <p>TODO: Note that this method assumes that the {@code byte} array + * parameter contains one character per {@code byte}, else it would + * truncate improperly.</p> * - * @param bytes PDB name in <code>byte</code> array. + * @param bytes PDB name in {@code byte<} array. * - * @throws UnsupportedEncodingException If ENCODING is - * not supported. + * @throws UnsupportedEncodingException If ENCODING is not supported. */ private void store(byte[] bytes) throws UnsupportedEncodingException { @@ -202,11 +192,9 @@ public final class PalmDB { // Note that the last byte in bName has to be '\0'. int lastIndex = NAME_LENGTH - 1; - int len = (bytes.length < lastIndex)? bytes.length: lastIndex; int i; - for (i = 0; i < len; i++) { if (bytes[i] == 0) { @@ -220,130 +208,105 @@ public final class PalmDB { sName = new String(bName, 0, i, PdbUtil.ENCODING); } - /** - * Returns creator ID. + * Returns creator ID. * - * @return The creator ID. + * @return The creator ID. */ public int getCreatorID() { - return creatorID; } - /** - * Returns type ID. + * Returns type ID. * - * @return The type ID. + * @return The type ID. */ public int getTypeID() { - return typeID; } - /** - * Returns attribute flag. + * Returns attribute flag. * - * @return The attribute flag. + * @return The attribute flag. */ public short getAttribute() { - return attribute; } - /** - * Returns version. + * Returns version. * - * @return The version. + * @return The version. */ public int getVersion() { - return version; } - /** - * Return the number of Records contained in this - * PDB <code>PalmDB</code> object. + * Return the number of Records contained in this PDB {@code PalmDB} object. * - * @return Number of <code>Record</code> objects. + * @return Number of {@code Record} objects. */ public int getRecordCount() { - return records.length; } - /** - * Return the specific <code>Record</code> object associated - * with the <code>Record</code> number. + * Return the specific {@code Record} object associated with the + * {@code Record} number. * - * @param index <code>Record</code> index number. + * @param index {@code Record} index number. * - * @return The <code>Record</code> object in the specified index + * @return The {@code Record} object in the specified index * - * @throws ArrayIndexOutOfBoundsException If index is out of bounds. + * @throws ArrayIndexOutOfBoundsException If index is out of bounds. */ public Record getRecord(int index) { - return records[index]; } - /** - * Return the list of <code>Record</code> objects. + * Return the list of {@code Record} objects. * - * @return The array of <code>Record</code> objects. + * @return The array of {@code Record} objects. */ public Record[] getRecords() { - return records; } /** - * Return the PDB name associated with this object. + * Return the PDB name associated with this object. * - * @return The PDB name. + * @return The PDB name. */ public String getPDBNameString() { - return sName; } - /** - * Return the PDB name associated with this object in - * <code>byte</code> array of exact length of 32 bytes. + * Return the PDB name associated with this object in {@code byte} array of + * exact length of 32 bytes. * - * @return The PDB name in <code>byte</code> array of - * length 32. + * @return The PDB name in {@code byte} array of length 32. */ public byte[] getPDBNameBytes() { - return bName; } - - - - - /** - * Override equals method of <code>Object</code>. + * Override equals method of {@code Object}. * - * Two <code>PalmDB</code> objects are equal if they contain - * the same information, i.e. PDB name and Records. + * <p>Two {@code PalmDB} objects are equal if they contain the same + * information, i.e. PDB name and Records.</p> * - * This is used primarily for testing purposes only for now. + * <p>This is used primarily for testing purposes only for now.</p> * - * @param obj A <code>PalmDB</code> <code>Object</code> to - * compare. + * @param obj A {@code PalmDB} {@code Object} to compare. * - * @return true if <code>obj</code> is equal to this, otherwise - * false. + * @return {@code true} if {@code obj} is equal to this, otherwise + * {@code false}. */ @Override public boolean equals(Object obj) { @@ -357,38 +320,26 @@ public final class PalmDB { checkLabel: { // compare sName - if (!sName.equals(pdb.sName)) { - break checkLabel; } // compare bName - if (bName.length != pdb.bName.length) { - break checkLabel; } - for (int i = 0; i < bName.length; i++) { - if (bName[i] != pdb.bName[i]) { - break checkLabel; } } // compare each Record - if (records.length != pdb.records.length) { - break checkLabel; } - for (int i = 0; i < records.length; i++) { - if (!records[i].equals(pdb.records[i])) { - break checkLabel; } } @@ -400,5 +351,4 @@ public final class PalmDB { return bool; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDocument.java index 82977ea21ee3..b7fb67bcf886 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDocument.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDocument.java @@ -28,54 +28,45 @@ import java.io.UnsupportedEncodingException; import org.openoffice.xmerge.Document; /** - * <p> A <code>PalmDocument</code> is palm implementaion of the - * <code>Document</code> interface.</p> - * - * <p>This implementation allows the Palm device format to be - * read via an <code>InputStream</code> and written via an - * <code>OutputStream</code>.</p> + * A {@code PalmDocument} is palm implementation of the {@code Document} + * interface. * + * <p>This implementation allows the Palm device format to be read via an + * {@code InputStream} and written via an {@code OutputStream}.</p> */ - public class PalmDocument implements Document { - /** - * The internal representation of a pdb. - */ + /** The internal representation of a pdb. */ private PalmDB pdb; - /** - * The file name. - */ + /** The file name. */ private String fileName; /** - * Constructor to create a <code>PalmDocument</code> - * from an <code>InputStream</code>. + * Constructor to create a {@code PalmDocument} from an {@code InputStream}. * - * @param is <code>InputStream</code> containing a PDB. + * @param is {@code InputStream} containing a PDB. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public PalmDocument(InputStream is) throws IOException { read(is); } - /** - * Constructor to create a <code>PalmDocument</code> with - * <code>Record</code> objects. <code>recs.length</code> - * can be zero for an empty PDB. + * Constructor to create a {@code PalmDocument} with {@code Record} objects. + * + * <p>{@code recs.length} can be zero for an empty PDB.</p> * - * @param name Suggested PDB name in <code>String</code>. - * @param creatorID The PDB Creator ID. - * @param typeID The PDB Type ID. - * @param version The PDB header version. - * @param attribute The PDB header attribute. - * @param recs Array of <code>Record</code> objects. + * @param name Suggested PDB name in {@code String}. + * @param creatorID The PDB Creator ID. + * @param typeID The PDB Type ID. + * @param version The PDB header version. + * @param attribute The PDB header attribute. + * @param recs Array of {@code Record} objects. * - * @throws NullPointerException If <code>recs</code> is null. + * @throws NullPointerException If {@code recs} is {@code null}. */ public PalmDocument(String name, int creatorID, int typeID, int version, short attribute, Record[] recs) @@ -84,15 +75,13 @@ public class PalmDocument fileName = pdb.getPDBNameString(); } - /** - * Reads in a file from the <code>InputStream</code>. + * Reads in a file from the {@code InputStream}. * - * @param is <code>InputStream</code> to read in its content. + * @param is {@code InputStream} to read in its content. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ - public void read(InputStream is) throws IOException { PdbDecoder decoder = new PdbDecoder(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -106,35 +95,31 @@ public class PalmDocument fileName = pdb.getPDBNameString(); } - /** - * Writes the <code>PalmDocument</code> to an <code>OutputStream</code>. + * Writes the {@code PalmDocument} to an {@code OutputStream}. * - * @param os The <code>OutputStream</code> to write the content. + * @param os The {@code OutputStream} to write the content. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void write(OutputStream os) throws IOException { PdbEncoder encoder = new PdbEncoder(pdb); encoder.write(os); } - /** - * Returns the <code>PalmDB</code> contained in this object. + * Returns the {@code PalmDB} contained in this object. * - * @return The <code>PalmDB</code>. + * @return The {@code PalmDB}. */ public PalmDB getPdb() { return pdb; } - /** - * Sets the <code>PalmDocument</code> to a new <code>PalmDB</code> - * value. + * Sets the {@code PalmDocument} to a new {@code PalmDB} value. * - * @param pdb The new <code>PalmDB</code> value. + * @param pdb The new {@code PalmDB} value. */ public void setPdb(PalmDB pdb) { this.pdb = pdb; @@ -143,25 +128,21 @@ public class PalmDocument fileName = name; } - /** - * Returns the name of the file. + * Returns the name of the file. * - * @return The name of the file represented in the - * <code>PalmDocument</code>. + * @return The name of the file represented in the {@code PalmDocument}. */ public String getFileName() { return fileName + ".pdb"; } - /** - * Returns the <code>Document</code> name. + * Returns the {@code Document} name. * - * @return The <code>Document</code> name. + * @return The {@code Document} name. */ public String getName() { return fileName; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbDecoder.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbDecoder.java index 02143e789cb5..bbd892a2f2d2 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbDecoder.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbDecoder.java @@ -23,63 +23,53 @@ import java.io.ByteArrayInputStream; import java.io.DataInputStream; /** - * <p>Provides functionality to decode a PDB formatted file into - * a <code>PalmDB</code> object given an <code>InputStream</code>. - * This class is only used by the <code>PalmDB</code> object.</p> + * Provides functionality to decode a PDB formatted file into a {@code PalmDB} + * object given an {@code InputStream}. * - * <p>Sample usage:</p> + * <p>This class is only used by the {@code PalmDB} object.</p> * - * <blockquote><pre><code> - * PdbDecoder decoder = new PdbDecoder("sample.pdb"); - * PalmDB palmDB = decoder.parse(); - * </code></pre></blockquote> + * <p>Sample usage:</p> + * <blockquote><pre>{@code PdbDecoder decoder = new PdbDecoder("sample.pdb"); + * PalmDB palmDB = decoder.parse();}</pre></blockquote> * - * <p>This decoder has the following assumptions on the PDB file:</p> + * <p>This decoder has the following assumptions on the PDB file:</p> + * <ol> + * <li>There is only one RecordList section in the PDB.</li> + * <li>The {@code Record} indices in the RecordList are sorted in order, i.e. + * the first {@code Record} index refers to {@code Record} 0, and so + * forth.</li> + * <li>The raw {@code Record} in the {@code Record} section are sorted as + * well in order, i.e. first {@code Record} comes ahead of second + * {@code Record}, etc.</li> + * </ol> * - * <ol> - * <li>There is only one RecordList section in the PDB.</li> - * <li>The <code>Record</code> indices in the RecordList are sorted in - * order, i.e. the first <code>Record</code> index refers to - * <code>Record</code> 0, and so forth.</li> - * <li>The raw <code>Record</code> in the <code>Record</code> section - * are sorted as well in order, i.e. first <code>Record</code> - * comes ahead of second <code>Record</code>, etc.</li> - * </ol> + * <p>Other decoders assume these as well.</p> * - * <p>Other decoders assume these as well.</p> - * - * @see PalmDB - * @see Record + * @see PalmDB + * @see Record */ public final class PdbDecoder { - - - /** - * <p>This method decodes a PDB file into a <code>PalmDB</code> - * object.</p> + * This method decodes a PDB file into a {@code PalmDB} object. * - * <p>First, the header data is read using the <code>PdbHeader</code> - * <code>read</code> method. Next, the RecordList section is - * read and the <code>Record</code> offsets are stored for use when - * parsing the Records. Based on these offsets, the bytes - * corresponding to each <code>Record</code> are read and each is - * stored in a <code>Record</code> object. Lastly, the data is - * used to create a <code>PalmDB</code> object.</p> + * <p>First, the header data is read using the {@code PdbHeader.read} + * method. Next, the RecordList section is read and the {@code Record} + * offsets are stored for use when parsing the Records. Based on these + * offsets, the bytes corresponding to each {@code Record} are read and + * each is stored in a {@code Record} object. Lastly, the data is used + * to create a {@code PalmDB} object.</p> * - * @param b <code>byte[]</code> containing PDB. + * @param b {@code byte[]} containing PDB. * - * @throws IOException If I/O error occurs. + * @throws IOException If I/O error occurs. */ - public PalmDB parse(byte[] b) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(b); DataInputStream dis = new DataInputStream(bais); // read the PDB header - PdbHeader header = new PdbHeader(); header.read(dis); @@ -87,7 +77,6 @@ public final class PdbDecoder { if (header.numRecords != 0) { // read in the record indices + offsets - int recOffset[] = new int[header.numRecords]; byte recAttrs[] = new byte[header.numRecords]; @@ -97,20 +86,18 @@ public final class PdbDecoder { // read in attributes (1 byte) + unique id (3 bytes) // take away the unique id, store the attributes - int attr = dis.readInt(); recAttrs[i] = (byte) (attr >>> 24); } // read the records - int lastIndex = header.numRecords - 1; for (int i = 0; i < lastIndex; i++) { //dis.seek(recOffset[i]); - dis.reset(); - dis.skip(recOffset[i]); + dis.reset(); + dis.skip(recOffset[i]); int len = recOffset[i+1] - recOffset[i]; byte[] bytes = new byte[len]; dis.readFully(bytes); @@ -118,26 +105,18 @@ public final class PdbDecoder { } // last record - dis.reset(); - int len = dis.available() - recOffset[lastIndex]; - dis.skip(recOffset[lastIndex]); - byte[] bytes = new byte[len]; + int len = dis.available() - recOffset[lastIndex]; + dis.skip(recOffset[lastIndex]); + byte[] bytes = new byte[len]; dis.readFully(bytes); recArray[lastIndex] = new Record(bytes, recAttrs[lastIndex]); } - - // create PalmDB and return it - PalmDB pdb = new PalmDB(header.pdbName, header.creatorID, header.typeID, header.version, header.attribute, recArray); return pdb; } - - - -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbEncoder.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbEncoder.java index 83f8a27f423d..f3f68045afe4 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbEncoder.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbEncoder.java @@ -25,48 +25,43 @@ import java.io.IOException; import java.util.Date; /** - * <p>Provides functionality to encode a <code>PalmDB</code> object - * into a PDB formatted file given a file <code>OutputStream</code>. - * This class is only used by the <code>PalmDB</code> object.</p> + * Provides functionality to encode a {@code PalmDB} object into a PDB + * formatted file given a file {@code OutputStream}. * - * <p>One needs to create one <code>PdbEncoder</code> object per - * <code>PalmDB</code> object to be encoded. This class keeps - * the PDB header data and functionality in the <code>PdbHeader</code> - * class.</p> + * <p>This class is only used by the {@code PalmDB} object.</p> * - * <p>Sample usage:</p> + * <p>One needs to create one {@code PdbEncoder} object per {@code PalmDB} + * object to be encoded. This class keeps the PDB header data and functionality + * in the {@code PdbHeader} class.</p> * - * <blockquote><pre><code> - * PdbEncoder encoder = new PdbEncoder(palmDB, "STRW", "data"); - * encoder.write(new FileOutputStream("sample.pdb")); - * </code></pre></blockquote> + * <p>Sample usage:</p> + * <blockquote><pre>{@code PdbEncoder encoder = new PdbEncoder(palmDB, "STRW", "data"); + * encoder.write(new FileOutputStream("sample.pdb"));}</pre></blockquote> * - * @see PalmDB - * @see Record + * @see PalmDB + * @see Record */ public final class PdbEncoder { - /** PDB header. */ + /** PDB header. */ private PdbHeader header = null; - /** the PalmDB object. */ + /** the PalmDB object. */ private PalmDB db = null; - /** - * The pattern for unique_id=0x00BABE(start). - */ + /** The pattern for unique_id=0x00BABE(start). */ private final static int START_UNIQUE_ID = 0x00BABE; /** - * Constructor. + * Constructor. * - * @param db The <code>PalmDB</code> to be encoded. + * @param db The {@code PalmDB} to be encoded. */ public PdbEncoder(PalmDB db) { header = new PdbHeader(); - header.version = db.getVersion(); + header.version = db.getVersion(); header.attribute = db.getAttribute(); @@ -84,33 +79,29 @@ public final class PdbEncoder { header.numRecords = db.getRecordCount(); } - /** - * Write out a PDB into the given <code>OutputStream</code>. + * Write out a PDB into the given {@code OutputStream}. * - * <p>First, write out the header data by using the - * <code>PdbHeader</code> <code>write</code> method. Next, - * calculate the RecordList section and write it out. - * Lastly, write out the bytes corresponding to each - * <code>Record</code>.</p> + * <p>First, write out the header data by using the {@code PdbHeader.write} + * method. Next, calculate the RecordList section and write it out. Lastly, + * write out the bytes corresponding to each {@code Record}.</p> * - * <p>The RecordList section contains a list of - * <code>Record</code> index info, where each <code>Record</code> - * index info contains:</p> + * <p>The RecordList section contains a list of {@code Record} index info, + * where each {@code Record} index info contains:</p> * - * <ul> - * <li>4 bytes local offset of the <code>Record</code> from the - * top of the PDB.</li> - * <li>1 byte of <code>Record</code> attribute.</li> - * <li>3 bytes unique <code>Record</code> ID.</li> - * </ul> + * <ul> + * <li>4 bytes local offset of the {@code Record} from the top of the + * PDB.</li> + * <li>1 byte of {@code Record} attribute.</li> + * <li>3 bytes unique {@code Record} ID.</li> + * </ul> * - * <p>There should be a total of <code>header.numRecords</code> - * of <code>Record</code> index info</p>. + * <p>There should be a total of {@code header.numRecords} of {@code Record} + * index info.</p> * - * @param os <code>OutputStream</code> to write out PDB. + * @param os {@code OutputStream} to write out PDB. * - * @throws IOException If I/O error occurs. + * @throws IOException If I/O error occurs. */ public void write(OutputStream os) throws IOException { @@ -123,7 +114,6 @@ public final class PdbEncoder { if (header.numRecords > 0) { // compute for recOffset[] - int recOffset[] = new int[header.numRecords]; byte recAttr[] = new byte[header.numRecords]; @@ -132,7 +122,6 @@ public final class PdbEncoder { recOffset[0] = PdbUtil.HEADER_SIZE + (header.numRecords * 8); int lastIndex = header.numRecords - 1; - for (int i = 0; i < lastIndex; i++) { Record rec = db.getRecord(i); @@ -143,13 +132,10 @@ public final class PdbEncoder { } // grab the last record's attribute. - Record lastRec = db.getRecord(lastIndex); recAttr[lastIndex] = lastRec.getAttributes(); - int uid = START_UNIQUE_ID; - for (int i = 0; i < header.numRecords; i++) { // write out each record offset @@ -166,21 +152,17 @@ public final class PdbEncoder { } // write out the raw records - for (int i = 0; i < header.numRecords; i++) { Record rec = db.getRecord(i); byte bytes[] = rec.getBytes(); dos.write(bytes); } - } else { - // placeholder bytes if there are no records in the list. dos.writeShort(0); } dos.flush(); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbHeader.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbHeader.java index fc8303111557..280c6e3dbcf5 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbHeader.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbHeader.java @@ -23,89 +23,85 @@ import java.io.DataOutput; import java.io.IOException; /** - * <p>Class used only internally by <code>PdbEncoder</code> and - * <code>PdbDecoder</code> to store, read and write a PDB header.</p> + * Class used only internally by {@code PdbEncoder} and {@code PdbDecoder} to + * store, read and write a PDB header. * - * <p>Note that fields are intended to be accessible only at the - * package level.</p> + * <p>Note that fields are intended to be accessible only at the package + * level.</p> * - * <p>Some of the fields are internally represented using a - * larger type since Java does not have unsigned types. - * Some are not since they are not relevant for now. - * The <code>read</code> and <code>write</code> methods should - * handle them properly.</p> + * <p>Some of the fields are internally represented using a larger type since + * Java does not have unsigned types. Some are not since they are not relevant + * for now. The {@code read} and {@code write} methods should handle them + * properly.</p> * - * @see PalmDB - * @see Record + * @see PalmDB + * @see Record */ final class PdbHeader { - - /** Name of the database. 32 bytes. */ + /** Name of the database. 32 bytes. */ byte[] pdbName = null; /** - * Flags for the database. Palm UInt16. Unsignedness should be - * irrelevant. + * Flags for the database. Palm UInt16. Unsignedness should be irrelevant. */ short attribute = 0; - /** Application-specific version for the database. Palm UInt16. */ + /** Application-specific version for the database. Palm UInt16. */ int version = 0; - /** Date created. Palm UInt32. */ + /** Date created. Palm UInt32. */ long creationDate = 0; - /** Date last modified. Palm UInt32. */ + /** Date last modified. Palm UInt32. */ long modificationDate = 0; - /** Date last backup. Palm UInt32. */ + /** Date last backup. Palm UInt32. */ private long lastBackupDate = 0; /** - * Incremented every time a <code>Record</code> is - * added, deleted or modified. Palm UInt32. + * Incremented every time a {@code Record} is added, deleted or modified. + * Palm UInt32. */ private long modificationNumber = 0; - /** Optional field. Palm UInt32. Unsignedness should be irrelevant. */ + /** Optional field. Palm UInt32. Unsignedness should be irrelevant. */ private int appInfoID = 0; - /** Optional field. Palm UInt32. Unsignedness should be irrelevant. */ + /** Optional field. Palm UInt32. Unsignedness should be irrelevant. */ private int sortInfoID = 0; - /** Database type ID. Palm UInt32. Unsignedness should be irrelevant. */ + /** Database type ID. Palm UInt32. Unsignedness should be irrelevant. */ int typeID = 0; - /** Database creator ID. Palm UInt32. Unsignedness should be irrelevant. */ + /** Database creator ID. Palm UInt32. Unsignedness should be irrelevant. */ int creatorID = 0; - /** ??? */ + /** ??? */ private int uniqueIDSeed = 0; - /** See numRecords. 4 bytes. */ + /** See numRecords. 4 bytes. */ private int nextRecordListID = 0; /** - * Number of Records stored in the database header. - * If all the <code>Record</code> entries cannot fit in the header, - * then <code>nextRecordList</code> has the local ID of a - * RecordList that contains the next set of <code>Record</code>. - * Palm UInt16. + * Number of Records stored in the database header. + * If all the {@code Record} entries cannot fit in the header, then + * {@code nextRecordList} has the local ID of a RecordList that contains + * the next set of {@code Record}. + * Palm UInt16. */ int numRecords = 0; - /** - * Read in the data for the PDB header. Need to - * preserve the unsigned value for some of the fields. + * Read in the data for the PDB header. * - * @param in A <code>DataInput</code> object. + * <p>Need to preserve the unsigned value for some of the fields.</p> * - * @throws IOException If any I/O error occurs. + * @param in A {@code DataInput} object. + * + * @throws IOException If any I/O error occurs. */ public void read(DataInput in) throws IOException { - pdbName = new byte[PalmDB.NAME_LENGTH]; in.readFully(pdbName); attribute = in.readShort(); @@ -123,16 +119,14 @@ final class PdbHeader { numRecords = in.readUnsignedShort(); } - /** - * Write out PDB header data. + * Write out PDB header data. * - * @param out A <code>DataOutput</code> object. + * @param out A {@code DataOutput} object. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void write(DataOutput out) throws IOException { - out.write(pdbName); out.writeShort(attribute); out.writeShort(version); @@ -148,5 +142,4 @@ final class PdbHeader { out.writeInt(nextRecordListID); out.writeShort(numRecords); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbUtil.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbUtil.java index 85147c7980e2..dd8068d63134 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbUtil.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbUtil.java @@ -19,22 +19,17 @@ package org.openoffice.xmerge.converter.palm; /** - * Contains common static methods and constants for use within the package. + * Contains common static methods and constants for use within the package. */ public final class PdbUtil { - /** Difference in seconds from Jan 01, 1904 to Jan 01, 1970. */ + /** Difference in seconds from Jan 01, 1904 to Jan 01, 1970. */ final static long TIME_DIFF = 2082844800; - /** Encoding scheme used. */ + /** Encoding scheme used. */ final static String ENCODING = "8859_1"; - /** Size of a PDB header in bytes. */ + /** Size of a PDB header in bytes. */ final static int HEADER_SIZE = 78; - - - - -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record.java index b66d1cab6303..ac7ba521884b 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record.java @@ -25,133 +25,111 @@ import java.io.DataInputStream; import java.io.IOException; /** - * <p>Contains the raw bytes for a <code>Record</code> in a PDB.</p> + * Contains the raw bytes for a {@code Record} in a PDB. * - * <p>Note that it is not associated with a <code>Record</code> number - * or ID.</p> + * <p>Note that it is not associated with a {@code Record} number or ID.</p> * - * @see PalmDocument - * @see PalmDB + * @see PalmDocument + * @see PalmDB */ public final class Record { - /** <code>Record</code> <code>byte</code> array. */ + /** {@code Record} {@code byte} array. */ private byte[] data; - /** <code>Record</code> attributes. */ + /** {@code Record} attributes. */ private byte attributes = 0; - /** - * Default constructor. + * Default constructor. */ public Record() { - data = new byte[0]; } - /** - * <p>Constructor to create a <code>Record</code> filled with - * bytes.</p> + * Constructor to create a {@code Record} filled with bytes. * - * <p>Note that this does not check for 64k <code>Record</code> - * sizes. User of this class must check for that.</p> + * <p>Note that this does not check for 64k {@code Record} sizes. User of + * this class must check for that.</p> * - * @param d <code>byte</code> array contents for this object. + * @param d {@code byte} array contents for this object. */ public Record(byte[] d) { - this(d, (byte) 0); } - /** - * <p>Constructor to create a <code>Record</code> filled with - * bytes and assign <code>Record</code> attributes.</p> + * Constructor to create a {@code Record} filled with bytes and assign + * {@code Record} attributes. * - * <p>Note that this does not check for 64k <code>Record</code> - * sizes. User of this class must check for that.</p> + * <p>Note that this does not check for 64k {@code Record} sizes. User of + * this class must check for that.</p> * - * @param d <code>byte</code> array contents for this object. - * @param attrs <code>Record</code> attributes. + * @param d {@code byte} array contents for this object. + * @param attrs {@code Record} attributes. */ public Record(byte[] d, byte attrs) { - data = new byte[d.length]; attributes = attrs; System.arraycopy(d, 0, data, 0, d.length); } - /** - * This method returns the number of bytes in this object. + * This method returns the number of bytes in this object. * - * @return Number of bytes in this object. + * @return Number of bytes in this object. */ public int getSize() { - return data.length; } - /** - * This method returns the contents of this <code>Object</code>. + * This method returns the contents of this {@code Object}. * - * @return Contents in <code>byte</code> array + * @return Contents in {@code byte} array */ public byte[] getBytes() { - return data; } - /** - * <p>This method returns the <code>Record</code> attributes.</p> + * <p>This method returns the {@code Record} attributes.</p> * - * <blockquote><pre> - * <code>Record</code> attributes consists of (from high to low bit) + * <blockquote><pre>{@code Record} attributes consists of (from high to low bit) * - * delete (1) - dirty (1) - busy (1) - secret (1) - category (4) - * </pre></blockquote> + * delete (1) - dirty (1) - busy (1) - secret (1) - category (4)</pre></blockquote> * - * @return <code>Record</code> attribute. + * @return {@code Record} attribute. */ public byte getAttributes() { - return attributes; } - /** - * Write out the <code>Record</code> attributes and - * <code>Record</code> length followed by the data in this - * <code>Record</code> object. + * Write out the {@code Record} attributes and {@code Record} length + * followed by the data in this {@code Record} object. * - * @param outs The <code>OutputStream</code> to write the object. + * @param outs The {@code OutputStream} to write the object. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void write(OutputStream outs) throws IOException { - DataOutputStream out = new DataOutputStream(outs); out.writeByte(attributes); out.writeShort(data.length); out.write(data); } - /** - * Read the necessary data to create a PDB from - * the <code>InputStream</code>. + * Read the necessary data to create a PDB from the {@code InputStream}. * - * @param ins The <code>InputStream</code> to read data from - * in order to restore the <code>object</code>. + * @param ins The {@code InputStream} to read data from in order to + * restore the {@code object}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void read(InputStream ins) throws IOException { - DataInputStream in = new DataInputStream(ins); attributes = in.readByte(); int len = in.readUnsignedShort(); @@ -159,18 +137,17 @@ public final class Record { in.readFully(data); } - /** - * <p>Override equals method of <code>Object</code>.</p> + * Override equals method of {@code Object}. * - * <p>Two <code>Record</code> objects are equal if they contain - * the same bytes in the array and the same attributes.</p> + * <p>Two {@code Record} objects are equal if they contain the same bytes + * in the array and the same attributes.</p> * - * <p>This is used primarily for testing purposes only for now.</p> + * <p>This is used primarily for testing purposes only for now.</p> * - * @param obj A <code>Record</code> object to compare with + * @param obj A {@code Record} object to compare with * - * @return true if obj is equal, otherwise false. + * @return {@code true} if {@code obj} is equal, otherwise {@code false}. */ @Override public boolean equals(Object obj) { @@ -184,24 +161,18 @@ public final class Record { checkLabel: { if (rec.getAttributes() != attributes) { - break checkLabel; } - if (rec.getSize() == data.length) { - for (int i = 0; i < data.length; i++) { - if (data[i] != rec.data[i]) { break checkLabel; } } - bool = true; } } } return bool; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedBinaryObject.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedBinaryObject.java index d3b10bf256f9..212e07ee891a 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedBinaryObject.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedBinaryObject.java @@ -22,7 +22,6 @@ import org.w3c.dom.Document; import org.w3c.dom.DOMException; import org.w3c.dom.Element; - /** * This class represents embedded object's in an OpenOffice.org document that * have a binary representation. @@ -42,7 +41,6 @@ public class EmbeddedBinaryObject extends EmbeddedObject { super(name, type); } - /** * Package private constructor for use when reading an object from a * compressed SX? file. @@ -56,11 +54,10 @@ public class EmbeddedBinaryObject extends EmbeddedObject { super(name, type, source); } - /** * This method returns the data for this object. * - * @return A <code>byte</code> array containing the object's data. + * @return A {@code byte} array containing the object's data. */ public byte[] getBinaryData() { @@ -74,11 +71,10 @@ public class EmbeddedBinaryObject extends EmbeddedObject { return objData; } - /** * Sets the data for this object. * - * @param data A <code>byte</code> array containing data for the object. + * @param data A {@code byte} array containing data for the object. */ public void setBinaryData(byte[] data) { objData = data; @@ -89,8 +85,8 @@ public class EmbeddedBinaryObject extends EmbeddedObject { * Package private method for writing the data of the EmbeddedObject to a * SX? file. * - * @param zip An <code>OfficeZip</code> instance representing the file - * the data is to be written to. + * @param zip An {@code OfficeZip} instance representing the file the + * data is to be written to. */ @Override void write(OfficeZip zip) { @@ -99,7 +95,6 @@ public class EmbeddedBinaryObject extends EmbeddedObject { } } - /** * Package private method that constructs the manifest.xml entries for this * embedded object. @@ -113,6 +108,4 @@ public class EmbeddedBinaryObject extends EmbeddedObject { manifestDoc.getDocumentElement().appendChild(objNode); } - -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedObject.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedObject.java index cdc3d51d88fc..fc05447b28d9 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedObject.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedObject.java @@ -23,7 +23,6 @@ import java.io.IOException; import org.w3c.dom.Document; import org.w3c.dom.DOMException; - public abstract class EmbeddedObject { protected String objName; protected String objType; @@ -47,7 +46,6 @@ public abstract class EmbeddedObject { hasChanged = true; } - /** * Package private constructor for use when reading an object from a * compressed SX? file. @@ -62,13 +60,12 @@ public abstract class EmbeddedObject { zipFile = source; } - /** * Retrieves the name of the embedded object represented by an instance of * this class. * * <b>N.B.</b>The name refers to the name as found in the - * <code>META-INF/manifest.xml</code> file. + * {@code META-INF/manifest.xml} file. * * @return The name of the object. */ @@ -76,13 +73,12 @@ public abstract class EmbeddedObject { return objName; } - /** * Retrieves the type of the embedded object represented by an instance of * this class. * - * The <code>META-INF/manifest.xml</code> file currently represents the - * type of an object using MIME types. + * The {@code META-INF/manifest.xml} file currently represents the type of + * an object using MIME types. */ public final String getType() { return objType; @@ -92,8 +88,8 @@ public abstract class EmbeddedObject { * Package private method for writing the data of the EmbeddedObject to a * SX? file. * - * @param zip An <code>OfficeZip</code> instance representing the file - * the data is to be written to. + * @param zip An {@code OfficeZip} instance representing the file the + * data is to be written to. */ abstract void write(OfficeZip zip) throws IOException; @@ -102,4 +98,4 @@ public abstract class EmbeddedObject { * embedded object. */ abstract void writeManifestData(Document manifestDoc) throws DOMException; -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedXMLObject.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedXMLObject.java index bbf0128b0dee..b081d6fa13aa 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedXMLObject.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedXMLObject.java @@ -33,18 +33,32 @@ import org.xml.sax.SAXException; /** * This class represents those embedded objects in an OpenOffice.org document - * that have an XML representation. Currently, according to the OpenOffice.org - * File Format 1.0 document, there are 6 such objects: + * that have an XML representation. * - * Formulae created with Math (application/vnd.sun.xml.math) - * Charts created with Chart (application/vnd.sun.xml.chart) - * Spreadsheets created with Calc (application/vnd.sun.xml.calc) - * Text created with Writer (application/vnd.sun.xml.writer) - * Drawings created with Draw (application/vnd.sun.xml.draw) - * Presentations created with Impress (application/vnd.sun.xml.impress) + * <p>Currently, according to the OpenOffice.org File Format 1.0 document, + * there are 6 such objects:</p> + * <blockquote><table summary="" border="1" cellpadding="3" cellspacing="0"> + * <tr> + * <th>Description</th><th>Object</th> + * </tr><tr> + * <td>Formula created with Math</td><td>application/vnd.sun.xml.math</td> + * </tr><tr> + * <td>Charts created with Chart</td><td>application/vnd.sun.xml.chart</td> + * </tr><tr> + * <td>Spreadsheets created with Calc</td> + * <td>application/vnd.sun.xml.calc</td> + * </tr><tr> + * <td>Text created with Writer</td><td>application/vnd.sun.xml.writer</td> + * </tr><tr> + * <td>Drawings created with Draw</td><td>application/vnd.sun.xml.draw</td> + * </tr><tr> + * <td>Presentations created with Impress</td> + * <td>application/vnd.sun.xml.impress</td> + * </tr> + * </table></blockquote> * - * These object types are stored using a combination of content, settings and styles - * XML files. + * <p>These object types are stored using a combination of content, settings and + * styles XML files.</p> */ public class EmbeddedXMLObject extends EmbeddedObject { @@ -58,8 +72,8 @@ public class EmbeddedXMLObject extends EmbeddedObject { /** * Constructor for an embedded object stored using an XML representation. * - * @param name The name of the object. - * @param type The mime-type of the object. See the class summary. + * @param name The name of the object. + * @param type The mime-type of the object. See the class summary. */ public EmbeddedXMLObject(String name, String type) { super(name, type); @@ -69,23 +83,22 @@ public class EmbeddedXMLObject extends EmbeddedObject { * Package private constructor for use when reading an object from a * compressed SX? file. * - * @param name The name of the object. - * @param type The mime-type of the object. See the class summary. - * @param source The OfficeZip representation of the SX? file that stores - * the object. + * @param name The name of the object. + * @param type The mime-type of the object. See the class summary. + * @param source The OfficeZip representation of the SX? file that stores + * the object. */ EmbeddedXMLObject(String name, String type, OfficeZip source) { super(name, type, source); } - /** * Returns the content data for this embedded object. * - * @return DOM representation of "content.xml" + * @return DOM representation of "content.xml". * - * @throws SAXException If any parser error occurs - * @throws IOException If any IO error occurs + * @throws SAXException If any parser error occurs. + * @throws IOException If any IO error occurs. */ public Document getContentDOM() throws SAXException, IOException { @@ -96,25 +109,23 @@ public class EmbeddedXMLObject extends EmbeddedObject { return contentDOM; } - /** * Sets the content data for the embedded object. * - * @param content DOM representation of the object's content. + * @param content DOM representation of the object's content. */ public void setContentDOM(Document content) { contentDOM = content; hasChanged = true; } - /** * Returns the settings data for this embedded object. * - * @return DOM representation of "settings.xml" + * @return DOM representation of "settings.xml" * - * @throws SAXException If any parser error occurs - * @throws IOException If any IO error occurs + * @throws SAXException If any parser error occurs. + * @throws IOException If any IO error occurs. */ public Document getSettingsDOM() throws SAXException, IOException { @@ -125,25 +136,23 @@ public class EmbeddedXMLObject extends EmbeddedObject { return settingsDOM; } - /** * Sets the settings data for the embedded object. * - * @param settings DOM representation of the object's styles. + * @param settings DOM representation of the object's styles. */ public void setSettingsDOM(Document settings) { settingsDOM = settings; hasChanged = true; } - /** * Returns the style data for this embedded object. * - * @return DOM representation of "styles.xml" + * @return DOM representation of "styles.xml". * - * @throws SAXException If any parser error occurs - * @throws IOException If any IO error occurs + * @throws SAXException If any parser error occurs. + * @throws IOException If any IO error occurs. */ public Document getStylesDOM() throws SAXException, IOException { @@ -154,29 +163,27 @@ public class EmbeddedXMLObject extends EmbeddedObject { return stylesDOM; } - /** * Sets the styles data for the embedded object. * - * @param styles DOM representation of the object's styles. + * @param styles DOM representation of the object's styles. */ public void setStylesDOM(Document styles) { stylesDOM = styles; hasChanged = true; } - /** * This method extracts the data for the given XML file from the SX? file * and creates a DOM representation of it. * - * @param name The name of the XML file to retrieve. It is paired with - * the object name to access the SX? file. + * @param name The name of the XML file to retrieve. It is paired with + * the object name to access the SX? file. * * @return DOM representation of the named XML file. * - * @throws SAXException If any parser error occurs - * @throws IOException If any IO error occurs + * @throws SAXException If any parser error occurs. + * @throws IOException If any IO error occurs. */ private Document getNamedDOM(String name) throws SAXException, IOException { if (zipFile == null) { @@ -194,24 +201,21 @@ public class EmbeddedXMLObject extends EmbeddedObject { byte[] data = zipFile.getNamedBytes((objName + "/" + name)); if (data != null) { return OfficeDocument.parse(builder, data); - } - else { + } else { return null; } - } - catch (ParserConfigurationException pce) { + } catch (ParserConfigurationException pce) { throw new SAXException(pce); } } - /** * Package private method for writing the data of the EmbeddedObject to a * SX? file. * - * @param zip An <code>OfficeZip</code> instance representing the file - * the data is to be written to. + * @param zip An {@code OfficeZip} instance representing the file the data + * is to be written to. */ @Override void write(OfficeZip zip) throws IOException { @@ -235,7 +239,7 @@ public class EmbeddedXMLObject extends EmbeddedObject { * Package private method that constructs the manifest.xml entries for this * embedded object. * - * @param manifestDoc <code>Document</code> containing the manifest entries. + * @param manifestDoc {@code Document} containing the manifest entries. */ @Override void writeManifestData(Document manifestDoc) throws DOMException { @@ -266,7 +270,6 @@ public class EmbeddedXMLObject extends EmbeddedObject { stylesNode.setAttribute(OfficeConstants.ATTRIBUTE_MANIFEST_FILE_PATH, (objName + "/styles.xml")); } - Element objectNode = manifestDoc.createElement(OfficeConstants.TAG_MANIFEST_FILE); objectNode.setAttribute(OfficeConstants.ATTRIBUTE_MANIFEST_FILE_TYPE, objType); @@ -274,5 +277,4 @@ public class EmbeddedXMLObject extends EmbeddedObject { root.appendChild(objectNode); } - -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeConstants.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeConstants.java index 452869ce3cef..8605c6ad63ee 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeConstants.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeConstants.java @@ -19,9 +19,8 @@ package org.openoffice.xmerge.converter.xml; /** - * This interface contains constants for StarOffice XML tags, - * attributes (StarCalc cell types, etc.). - * + * This interface contains constants for StarOffice XML tags, attributes + * (StarCalc cell types, etc.). */ public interface OfficeConstants { @@ -29,31 +28,29 @@ public interface OfficeConstants { String TAG_OFFICE_DOCUMENT = "office:document"; /** - * Element tag for <i>office:document-content</i>, this is the root - * tag in content.xml. + * Element tag for <i>office:document-content</i>, this is the root tag in + * content.xml. */ String TAG_OFFICE_DOCUMENT_CONTENT = "office:document-content"; /** - * Element tag for <i>office:document-settings</i>, this is the root - * tag in content.xml. + * Element tag for <i>office:document-settings</i>, this is the root tag in + * content.xml. */ String TAG_OFFICE_DOCUMENT_SETTINGS= "office:document-settings"; - /** - * Element tag for <i>office:document-meta</i>, this is the root - * tag in content.xml. + /** + * Element tag for <i>office:document-meta</i>, this is the root tag in + * content.xml. */ String TAG_OFFICE_DOCUMENT_META= "office:document-meta"; /** - * Element tag for <i>office:document-styles</i>, this is the root tag - * in styles.xml. + * Element tag for <i>office:document-styles</i>, this is the root tag in + * styles.xml. */ String TAG_OFFICE_DOCUMENT_STYLES = "office:document-styles"; - - /** Element tag for <i>office:styles</i>. */ String TAG_OFFICE_STYLES = "office:styles"; @@ -82,20 +79,20 @@ public interface OfficeConstants { String ATTRIBUTE_STYLE_NAME = "style:name"; /** - * Attribute tag for <i>style:font-pitch</i> of element - * <i>style:font-pitch</i>. + * Attribute tag for <i>style:font-pitch</i> of element + * <i>style:font-pitch</i>. */ String ATTRIBUTE_STYLE_FONT_PITCH = "style:font-pitch"; /** - * Attribute tag for <i>fo:font-family</i> of element - * <i>fo:font-family</i>. + * Attribute tag for <i>fo:font-family</i> of element + * <i>fo:font-family</i>. */ String ATTRIBUTE_FO_FONT_FAMILY = "fo:font-family"; /** - * Attribute tag for <i>fo:font-family</i> of element - * <i>fo:font-family</i>. + * Attribute tag for <i>fo:font-family</i> of element + * <i>fo:font-family</i>. */ String ATTRIBUTE_FO_FONT_FAMILY_GENERIC = "fo:font-family-generic"; @@ -147,27 +144,24 @@ public interface OfficeConstants { /** Element tag for <i>table:named-expression</i>. */ String TAG_TABLE_NAMED_EXPRESSION= "table:named-expression"; - /** - * Attribute tag for <i>table:name</i> of element - * <i>table:table</i>. - */ + /** Attribute tag for <i>table:name</i> of element <i>table:table</i>. */ String ATTRIBUTE_TABLE_NAME = "table:name"; /** - * Attribute tag for <i>table:expression</i> of element - * <i>table:named-range</i>. + * Attribute tag for <i>table:expression</i> of element + * <i>table:named-range</i>. */ String ATTRIBUTE_TABLE_EXPRESSION = "table:expression"; /** - * Attribute tag for <i>table:base-cell-address</i> of element - * <i>table:named-range</i>. + * Attribute tag for <i>table:base-cell-address</i> of element + * <i>table:named-range</i>. */ String ATTRIBUTE_TABLE_BASE_CELL_ADDRESS = "table:base-cell-address"; /** - * Attribute tag for <i>table:cell-range-address</i> of element - * <i>table:named-range</i>. + * Attribute tag for <i>table:cell-range-address</i> of element + * <i>table:named-range</i>. */ String ATTRIBUTE_TABLE_CELL_RANGE_ADDRESS = "table:cell-range-address"; @@ -177,9 +171,9 @@ public interface OfficeConstants { /** Element tag for <i>table:table-column</i>. */ String TAG_TABLE_COLUMN = "table:table-column"; - /** - * Attribute tag for <i>table:default-cell-style-name</i> - * of element <i>table:table-column</i>. + /** + * Attribute tag for <i>table:default-cell-style-name</i> of element + * <i>table:table-column</i>. */ String ATTRIBUTE_DEFAULT_CELL_STYLE = "table:default-cell-style-name"; @@ -190,69 +184,65 @@ public interface OfficeConstants { String TAG_TABLE_CELL = "table:table-cell"; /** - * Attribute tag for <i>table:value-type</i> of element - * <i>table:table-cell</i>. + * Attribute tag for <i>table:value-type</i> of element + * <i>table:table-cell</i>. */ String ATTRIBUTE_TABLE_VALUE_TYPE = "table:value-type"; /** - * Attribute tag for <i>table:number-columns-repeated</i> - * of element <i>table:table-cell</i>. + * Attribute tag for <i>table:number-columns-repeated</i> of element + * <i>table:table-cell</i>. */ String ATTRIBUTE_TABLE_NUM_COLUMNS_REPEATED = "table:number-columns-repeated"; /** - * Attribute tag for <i>table:number-rows-repeated</i> - * of element <i>table:table-row</i>. + * Attribute tag for <i>table:number-rows-repeated</i> of element + * <i>table:table-row</i>. */ - String ATTRIBUTE_TABLE_NUM_ROWS_REPEATED = - "table:number-rows-repeated"; + String ATTRIBUTE_TABLE_NUM_ROWS_REPEATED = "table:number-rows-repeated"; /** - * Attribute tag for <i>table:formula</i> of element - * <i>table:table-cell</i>. + * Attribute tag for <i>table:formula</i> of element + * <i>table:table-cell</i>. */ String ATTRIBUTE_TABLE_FORMULA = "table:formula"; /** - * Attribute tag for <i>table:value</i> of element - * <i>table:table-cell</i>. + * Attribute tag for <i>table:value</i> of element <i>table:table-cell</i>. */ String ATTRIBUTE_TABLE_VALUE = "table:value"; /** - * Attribute tag for <i>table:date-value</i> of element - * <i>table:table-cell</i>. + * Attribute tag for <i>table:date-value</i> of element + * <i>table:table-cell</i>. */ String ATTRIBUTE_TABLE_DATE_VALUE = "table:date-value"; /** - * Attribute tag for <i>table:time-value</i> of element - * <i>table:table-cell</i>. + * Attribute tag for <i>table:time-value</i> of element + * <i>table:table-cell</i>. */ String ATTRIBUTE_TABLE_TIME_VALUE = "table:time-value"; /** - * Attribute tag for <i>table:string-value</i> of element - * <i>table:table-cell</i>. + * Attribute tag for <i>table:string-value</i> of element + * <i>table:table-cell</i>. */ - String ATTRIBUTE_TABLE_STRING_VALUE = - "table:string-value"; + String ATTRIBUTE_TABLE_STRING_VALUE = "table:string-value"; /** - * Attribute tag for <i>table:time-boolean-value</i> of element - * <i>table:table-cell</i>. + * Attribute tag for <i>table:time-boolean-value</i> of element + * <i>table:table-cell</i>. */ - String ATTRIBUTE_TABLE_BOOLEAN_VALUE = - "table:boolean-value"; + String ATTRIBUTE_TABLE_BOOLEAN_VALUE = "table:boolean-value"; /** Attribute tag for <i>table:style-name</i> of table elements. */ String ATTRIBUTE_TABLE_STYLE_NAME = "table:style-name"; /** - * Attribute tag for <i>table:currency</i> of element - * <i>table:table-cell</i>. + * Attribute tag for <i>table:currency</i> of element + * <i>table:table-cell</i>. */ String ATTRIBUTE_TABLE_CURRENCY = "table:currency"; @@ -325,22 +315,19 @@ public interface OfficeConstants { String TAG_CONFIG_ITEM_MAP_ENTRY= "config:config-item-map-entry"; /** - * Attribute tag for <i>config:name</i> of element - * <i>config:config-item</i>. + * Attribute tag for <i>config:name</i> of element <i>config:config-item</i>. */ String ATTRIBUTE_CONFIG_NAME = "config:name"; /** - * Attribute tag for <i>config:type</i> of element - * <i>config:config-item</i>. + * Attribute tag for <i>config:type</i> of element <i>config:config-item</i>. */ String ATTRIBUTE_CONFIG_TYPE = "config:type"; - /** StarWriter XML MIME type. */ String SXW_MIME_TYPE = "application/vnd.sun.xml.writer"; /** StarCalc XML MIME type. */ String SXC_MIME_TYPE = "application/vnd.sun.xml.calc"; -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java index b90a285938ce..df3fec9660b1 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java @@ -53,41 +53,39 @@ import javax.xml.transform.stream.*; import org.openoffice.xmerge.util.Debug; /** - * An implementation of <code>Document</code> for - * StarOffice documents. + * An implementation of {@code Document} for StarOffice documents. */ public abstract class OfficeDocument - implements org.openoffice.xmerge.Document, - OfficeConstants { + implements org.openoffice.xmerge.Document, OfficeConstants { - /** Factory for <code>DocumentBuilder</code> objects. */ + /** Factory for {@code DocumentBuilder} objects. */ private static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - /** DOM <code>Document</code> of content.xml. */ + /** DOM {@code Document} of content.xml. */ private Document contentDoc = null; - /** DOM <code>Document</code> of meta.xml. */ + /** DOM {@code Document} of meta.xml. */ private Document metaDoc = null; - /** DOM <code>Document</code> of settings.xml. */ + /** DOM {@code Document} of settings.xml. */ private Document settingsDoc = null; - /** DOM <code>Document</code> of content.xml. */ + /** DOM {@code Document} of content.xml. */ private Document styleDoc = null; - /** DOM <code>Docuemtn</code> of META-INF/manifest.xml. */ + /** DOM {@code Document} of @code META-INF/manifest.xml. */ private Document manifestDoc = null; private String documentName = null; private String fileName = null; /** - * <code>OfficeZip</code> object to store zip contents from - * read <code>InputStream</code>. Note that this member - * will still be null if it was initialized using a template - * file instead of reading from a StarOffice zipped - * XML file. + * {@code OfficeZip} object to store zip contents from read + * {@code InputStream}. + * + * <p>Note that this member will still be null if it was initialized using + * a template file instead of reading from a StarOffice zipped XML file.</p> */ private OfficeZip zip = null; @@ -95,24 +93,22 @@ public abstract class OfficeDocument private Map<String, EmbeddedObject> embeddedObjects = null; /** - * Default constructor. + * Default constructor. * - * @param name <code>Document</code> name. + * @param name {@code Document} name. */ - public OfficeDocument(String name) - { + public OfficeDocument(String name) { this(name, true, false); } - /** - * Constructor with arguments to set <code>namespaceAware</code> - * and <code>validating</code> flags. + * Constructor with arguments to set {@code namespaceAware} and + * {@code validating} flags. * - * @param name <code>Document</code> name (may or may not - * contain extension). - * @param namespaceAware Value for <code>namespaceAware</code> flag. - * @param validating Value for <code>validating</code> flag. + * @param name {@code Document} name (may or may not contain + * extension). + * @param namespaceAware Value for {@code namespaceAware} flag. + * @param validating Value for {@code validating} flag. */ public OfficeDocument(String name, boolean namespaceAware, boolean validating) { factory.setValidating(validating); @@ -121,14 +117,12 @@ public abstract class OfficeDocument this.fileName = documentName + getFileExtension(); } - /** - * Removes the file extension from the <code>Document</code> - * name. + * Removes the file extension from the {@code Document} name. * - * @param name Full <code>Document</code> name with extension. + * @param name Full {@code Document} name with extension. * - * @return Name of <code>Document</code> without the extension. + * @return Name of {@code Document} without the extension. */ private String trimDocumentName(String name) { String temp = name.toLowerCase(); @@ -144,145 +138,133 @@ public abstract class OfficeDocument return name; } - /** - * Return a DOM <code>Document</code> object of the content.xml - * file. Note that a content DOM is not created when the constructor - * is called. So, either the <code>read</code> method or the - * <code>initContentDOM</code> method will need to be called ahead - * on this object before calling this method. + * Return a DOM {@code Document} object of the content.xml file. * - * @return DOM <code>Document</code> object. + * <p>Note that a content DOM is not created when the constructor is called. + * So, either the {@code read} method or the {@code initContentDOM} method + * will need to be called ahead on this object before calling this method.</p> + * + * @return DOM {@code Document} object. */ public Document getContentDOM() { return contentDoc; } - /** - * Return a DOM <code>Document</code> object of the meta.xml - * file. Note that a content DOM is not created when the constructor - * is called. So, either the <code>read</code> method or the - * <code>initContentDOM</code> method will need to be called ahead - * on this object before calling this method. + /** + * Return a DOM {@code Document} object of the meta.xml file. + * + * <p>Note that a content DOM is not created when the constructor is called. + * So, either the {@code read} method or the {@code initContentDOM} method + * will need to be called ahead on this object before calling this method.</p> * - * @return DOM <code>Document</code> object. + * @return DOM <code>Document</code> object. */ public Document getMetaDOM() { return metaDoc; } - - /** - * Return a DOM <code>Document</code> object of the settings.xml - * file. Note that a content DOM is not created when the constructor - * is called. So, either the <code>read</code> method or the - * <code>initContentDOM</code> method will need to be called ahead - * on this object before calling this method. + /** + * Return a DOM {@code Document} object of the settings.xml file. + * + * <p>Note that a content DOM is not created when the constructor is called. + * So, either the {@code read} method or the {@code initContentDOM} method + * will need to be called ahead on this object before calling this method.</p> * - * @return DOM <code>Document</code> object. + * @return DOM {@code Document} object. */ public Document getSettingsDOM() { return settingsDoc; } - /** * Sets the content tree of the document. * - * @param newDom <code>Node</code> containing the new content tree. + * @param newDom {@code Node} containing the new content tree. */ public void setContentDOM( Node newDom) { contentDoc = (Document)newDom; } - /** * Sets the meta tree of the document. * - * @param newDom <code>Node</code> containing the new meta tree. + * @param newDom {@code Node} containing the new meta tree. */ public void setMetaDOM (Node newDom) { metaDoc = (Document)newDom; } - /** * Sets the settings tree of the document. * - * @param newDom <code>Node</code> containing the new settings tree. + * @param newDom {@code Node} containing the new settings tree. */ public void setSettingsDOM (Node newDom) { settingsDoc = (Document)newDom; } - /** * Sets the style tree of the document. * - * @param newDom <code>Node</code> containing the new style tree. + * @param newDom {@code Node} containing the new style tree. */ public void setStyleDOM (Node newDom) { styleDoc = (Document)newDom; } - /** - * Return a DOM <code>Document</code> object of the style.xml file. - * Note that this may return null if there is no style DOM. - * Note that a style DOM is not created when the constructor - * is called. Depending on the <code>InputStream</code>, a - * <code>read</code> method may or may not build a style DOM. When - * creating a new style DOM, call the <code>initStyleDOM</code> method - * first. + * Return a DOM {@code Document} object of the style.xml file. * - * @return DOM <code>Document</code> object. + * <p>Note that this may return {@code null} if there is no style DOM.</p> + * <p>Note that a style DOM is not created when the constructor is called. + * Depending on the {@code InputStream}, a {@code read} method may or may + * not build a style DOM. When creating a new style DOM, call the + * {@code initStyleDOM} method first.</p> + * + * @return DOM {@code Document} object. */ public Document getStyleDOM() { return styleDoc; } - /** - * Return the name of the <code>Document</code>. + * Return the name of the {@code Document}. * - * @return The name of <code>Document</code>. + * @return The name of {@code Document}. */ public String getName() { return documentName; } - /** - * Return the file name of the <code>Document</code>, possibly - * with the standard extension. + * Return the file name of the {@code Document}, possibly with the standard + * extension. * - * @return The file name of <code>Document</code>. + * @return The file name of {@code Document}. */ public String getFileName() { return fileName; } - /** - * Returns the file extension for this type of - * <code>Document</code>. + * Returns the file extension for this type of {@code Document}. * - * @return The file extension of <code>Document</code>. + * @return The file extension of {@code Document}. */ protected abstract String getFileExtension(); - /** * Returns all the embedded objects (graphics, formulae, etc.) present in * this document. * - * @return An <code>Iterator</code> of <code>EmbeddedObject</code> objects. + * @return An {@code Iterator} of {@code EmbeddedObject} objects. */ public Iterator<EmbeddedObject> getEmbeddedObjects() { @@ -302,7 +284,6 @@ public abstract class OfficeDocument String type = attrs.getNamedItem(ATTRIBUTE_MANIFEST_FILE_TYPE).getNodeValue(); String path = attrs.getNamedItem(ATTRIBUTE_MANIFEST_FILE_PATH).getNodeValue(); - /* * According to OpenOffice.org XML File Format document (ver. 1) * there are only two types of embedded object: @@ -338,17 +319,15 @@ public abstract class OfficeDocument } /** - * Read the Office <code>Document</code> from the given - * <code>InputStream</code>. + * Read the Office {@code Document} from the given {@code InputStream}. * - * @param is Office document <code>InputStream</code>. + * @param is Office document {@code InputStream}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void read(InputStream is) throws IOException { Debug.log(Debug.INFO, "reading Office file"); - DocumentBuilder builder = null; try { @@ -358,99 +337,69 @@ public abstract class OfficeDocument } // read in Office zip file format - zip = new OfficeZip(); zip.read(is); // grab the content.xml and // parse it into contentDoc. - byte contentBytes[] = zip.getContentXMLBytes(); - if (contentBytes == null) { - throw new OfficeDocumentException("Entry content.xml not found in file"); } - try { - contentDoc = parse(builder, contentBytes); - } catch (SAXException ex) { - throw new OfficeDocumentException(ex); } // if style.xml exists, grab the style.xml // parse it into styleDoc. - byte styleBytes[] = zip.getStyleXMLBytes(); - if (styleBytes != null) { - try { - styleDoc = parse(builder, styleBytes); - } catch (SAXException ex) { - throw new OfficeDocumentException(ex); } } - byte metaBytes[] = zip.getMetaXMLBytes(); - + byte metaBytes[] = zip.getMetaXMLBytes(); if (metaBytes != null) { - try { - metaDoc = parse(builder, metaBytes); - } catch (SAXException ex) { - throw new OfficeDocumentException(ex); } } - byte settingsBytes[] = zip.getSettingsXMLBytes(); - + byte settingsBytes[] = zip.getSettingsXMLBytes(); if (settingsBytes != null) { - try { - settingsDoc = parse(builder, settingsBytes); } catch (SAXException ex) { - throw new OfficeDocumentException(ex); } } - // Read in the META-INF/manifest.xml file byte manifestBytes[] = zip.getManifestXMLBytes(); - if (manifestBytes != null) { - try { manifestDoc = parse(builder, manifestBytes); } catch (SAXException ex) { throw new OfficeDocumentException(ex); } } - } - /** - * Read the Office <code>Document</code> from the given - * <code>InputStream</code>. + * Read the Office {@code Document} from the given {@code InputStream}. * - * @param is Office document <code>InputStream</code>. - * @param isZip <code>boolean</code> Identifies whether - * a file is zipped or not + * @param is Office document {@code InputStream}. + * @param isZip {@code boolean} Identifies whether a file is zipped or not. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void read(InputStream is, boolean isZip) throws IOException { @@ -564,18 +513,16 @@ public abstract class OfficeDocument } - /** - * Parse given <code>byte</code> array into a DOM - * <code>Document</code> object using the - * <code>DocumentBuilder</code> object. + * Parse given {@code byte} array into a DOM {@code Document} object using + * the {@code DocumentBuilder} object. * - * @param builder <code>DocumentBuilder</code> object for parsing. - * @param bytes <code>byte</code> array for parsing. + * @param builder {@code DocumentBuilder} object for parsing. + * @param bytes {@code byte} array for parsing. * - * @return Resulting DOM <code>Document</code> object. + * @return Resulting DOM {@code Document} object. * - * @throws SAXException If any parsing error occurs. + * @throws SAXException If any parsing error occurs. */ static Document parse(DocumentBuilder builder, byte bytes[]) throws SAXException, IOException { @@ -593,7 +540,6 @@ public abstract class OfficeDocument return doc; } - /** * Method to return the MIME type of the document. * @@ -601,13 +547,12 @@ public abstract class OfficeDocument */ protected abstract String getDocumentMimeType(); - /** - * Write out Office ZIP file format. + * Write out Office ZIP file format. * - * @param os XML <code>OutputStream</code>. + * @param os XML {@code OutputStream}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void write(OutputStream os) throws IOException { if (zip == null) { @@ -634,9 +579,9 @@ public abstract class OfficeDocument domEntry.setAttribute(ATTRIBUTE_MANIFEST_FILE_TYPE, ""); manifestRoot.appendChild(domEntry); - // Write content to the Zip file and then write any of the optional + // Write content to the Zip file and then write any of the optional // data, if it exists. - zip.setContentXMLBytes(docToBytes(contentDoc)); + zip.setContentXMLBytes(docToBytes(contentDoc)); domEntry = manifestDoc.createElement(TAG_MANIFEST_FILE); domEntry.setAttribute(ATTRIBUTE_MANIFEST_FILE_PATH, "content.xml"); @@ -644,7 +589,7 @@ public abstract class OfficeDocument manifestRoot.appendChild(domEntry); - if (styleDoc != null) { + if (styleDoc != null) { zip.setStyleXMLBytes(docToBytes(styleDoc)); domEntry = manifestDoc.createElement(TAG_MANIFEST_FILE); @@ -676,30 +621,27 @@ public abstract class OfficeDocument zip.write(os); } - - /** - * Write out Office ZIP file format. + /** + * Write out Office ZIP file format. * - * @param os XML <code>OutputStream</code>. - * @param isZip <code>boolean</code> + * @param os XML {@code OutputStream}. + * @param isZip {@code boolean} * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void write(OutputStream os, boolean isZip) throws IOException { // Create an OfficeZip object if one does not exist. if (isZip){ write(os); - } - else{ - try{ + } else { + try { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder= builderFactory.newDocumentBuilder(); DOMImplementation domImpl = builder.getDOMImplementation(); domImpl.createDocumentType("office:document","-//OpenOffice.org//DTD OfficeDocument 1.0//EN",null); org.w3c.dom.Document newDoc = domImpl.createDocument("http://openoffice.org/2000/office","office:document",null); - Element rootElement=newDoc.getDocumentElement(); rootElement.setAttribute("xmlns:office","http://openoffice.org/2000/office"); rootElement.setAttribute("xmlns:style","http://openoffice.org/2000/style" ); @@ -726,37 +668,33 @@ public abstract class OfficeDocument rootElement.setAttribute("office:class","text" ); rootElement.setAttribute("office:version","1.0"); - NodeList nodeList; Node tmpNode; Node rootNode = rootElement; - if (metaDoc !=null){ + if (metaDoc !=null) { nodeList= metaDoc.getElementsByTagName(TAG_OFFICE_META); - if (nodeList.getLength()>0){ + if (nodeList.getLength()>0) { tmpNode = newDoc.importNode(nodeList.item(0),true); rootNode.appendChild(tmpNode); } - }if (styleDoc !=null){ + } if (styleDoc !=null) { nodeList= styleDoc.getElementsByTagName(TAG_OFFICE_STYLES); if (nodeList.getLength()>0){ tmpNode = newDoc.importNode(nodeList.item(0),true); rootNode.appendChild(tmpNode); - } - - }if (settingsDoc !=null){ + } + } if (settingsDoc !=null) { nodeList= settingsDoc.getElementsByTagName(TAG_OFFICE_SETTINGS); if (nodeList.getLength()>0){ tmpNode = newDoc.importNode(nodeList.item(0),true); rootNode.appendChild(tmpNode); } - } - if (contentDoc !=null){ + } if (contentDoc !=null) { nodeList= contentDoc.getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES); if (nodeList.getLength()>0){ tmpNode = newDoc.importNode(nodeList.item(0),true); - rootNode.appendChild(tmpNode); + rootNode.appendChild(tmpNode); } - nodeList= contentDoc.getElementsByTagName(TAG_OFFICE_BODY); if (nodeList.getLength()>0){ tmpNode = newDoc.importNode(nodeList.item(0),true); @@ -766,27 +704,25 @@ public abstract class OfficeDocument byte contentBytes[] = docToBytes(newDoc); os.write(contentBytes); - } - catch(Exception exc){ - System.out.println("\nException in OfficeDocument.write():" +exc); - } - } + } catch(Exception exc){ + System.out.println("\nException in OfficeDocument.write():" +exc); + } + } } /** - * <p>Write out a <code>org.w3c.dom.Document</code> object into a - * <code>byte</code> array.</p> + * Write out a {@code org.w3c.dom.Document} object into a {@code byte} + * array. * - * <p>TODO: remove dependency on com.sun.xml.tree.XmlDocument - * package!</p> + * <p>TODO: remove dependency on {@code com.sun.xml.tree.XmlDocument} + * package!</p> * - * @param doc DOM <code>Document</code> object. + * @param doc DOM {@code Document} object. * - * @return <code>byte</code> array of DOM <code>Document</code> - * object. + * @return {@code byte} array of DOM {@code Document} object. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ static byte[] docToBytes(Document doc) throws IOException { @@ -818,20 +754,17 @@ public abstract class OfficeDocument new Class[] { Class.forName("java.io.OutputStream") } ); meth.invoke(doc, new Object [] { baos } ); - } - else if (domImpl.equals("org.apache.crimson.tree.XmlDocument")) - { + } else if (domImpl.equals("org.apache.crimson.tree.XmlDocument")) { Debug.log(Debug.INFO, "Using Crimson"); - Class<?> crimsonDoc = Class.forName("org.apache.crimson.tree.XmlDocument"); - // The method is in the XMLDocument class itself, not a helper + Class<?> crimsonDoc = Class.forName("org.apache.crimson.tree.XmlDocument"); + // The method is in the XMLDocument class itself, not a helper meth = crimsonDoc.getMethod("write", new Class[] { Class.forName("java.io.OutputStream") } ); meth.invoke(doc, new Object [] { baos } ); - } - else if (domImpl.equals("org.apache.xerces.dom.DocumentImpl") - || domImpl.equals("org.apache.xerces.dom.DeferredDocumentImpl")) { + } else if (domImpl.equals("org.apache.xerces.dom.DocumentImpl") + || domImpl.equals("org.apache.xerces.dom.DeferredDocumentImpl")) { Debug.log(Debug.INFO, "Using Xerces"); @@ -845,20 +778,16 @@ public abstract class OfficeDocument { Class.forName("java.io.OutputStream"), Class.forName("org.apache.xml.serialize.OutputFormat") } ); - // Get the serialize method meth = xercesSer.getMethod("serialize", new Class [] { Class.forName("org.w3c.dom.Document") } ); - // Get an instance Object serializer = con.newInstance(new Object [] { baos, null } ); - // Now call serialize to write the document meth.invoke(serializer, new Object [] { doc } ); - } - else if (domImpl.equals("gnu.xml.dom.DomDocument")) { + } else if (domImpl.equals("gnu.xml.dom.DomDocument")) { Debug.log(Debug.INFO, "Using GNU"); Class<?> gnuSer = Class.forName("gnu.xml.dom.ls.DomLSSerializer"); @@ -873,18 +802,16 @@ public abstract class OfficeDocument // Now call serialize to write the document meth.invoke(serializer, new Object [] { doc, baos } ); - } - else { - try { - DOMSource domSource = new DOMSource(doc); - StringWriter writer = new StringWriter(); - StreamResult result = new StreamResult(writer); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer transformer = tf.newTransformer(); - transformer.transform(domSource, result); - return writer.toString().getBytes(); - } - catch (Exception e) { + } else { + try { + DOMSource domSource = new DOMSource(doc); + StringWriter writer = new StringWriter(); + StreamResult result = new StreamResult(writer); + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer transformer = tf.newTransformer(); + transformer.transform(domSource, result); + return writer.toString().getBytes(); + } catch (Exception e) { // We don't have another parser throw new IOException("No appropriate API (JAXP/Xerces) to serialize XML document: " + domImpl); } @@ -904,12 +831,11 @@ public abstract class OfficeDocument return bytes; } - /** - * Initializes a new DOM <code>Document</code> with the content - * containing minimum OpenOffice XML tags. + * Initializes a new DOM {@code Document} with the content containing + * minimum OpenOffice XML tags. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public final void initContentDOM() throws IOException { @@ -930,10 +856,10 @@ public abstract class OfficeDocument } /** - * Initializes a new DOM <code>Document</code> with the content - * containing minimum OpenOffice XML tags. + * Initializes a new DOM {@code Document} with the content containing + * minimum OpenOffice XML tags. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public final void initSettingsDOM() throws IOException { @@ -948,10 +874,10 @@ public abstract class OfficeDocument } /** - * Initializes a new DOM Document with styles - * containing minimum OpenOffice XML tags. + * Initializes a new DOM Document with styles containing minimum OpenOffice + * XML tags. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public final void initStyleDOM() throws IOException { @@ -959,30 +885,24 @@ public abstract class OfficeDocument } /** - * <p>Creates a new DOM <code>Document</code> containing minimum - * OpenOffice XML tags.</p> + * Creates a new DOM {@code Document} containing minimum OpenOffice XML tags. * - * <p>This method uses the subclass - * <code>getOfficeClassAttribute</code> method to get the - * attribute for <i>office:class</i>.</p> + * <p>This method uses the subclass {@code getOfficeClassAttribute} method + * to get the attribute for <i>office:class</i>.</p> * - * @param rootName root name of <code>Document</code>. + * @param rootName root name of {@code Document}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ private final Document createSettingsDOM(String rootName) throws IOException { Document doc = null; try { - DocumentBuilder builder = factory.newDocumentBuilder(); doc = builder.newDocument(); - } catch (ParserConfigurationException ex) { - throw new OfficeDocumentException(ex); - } Element root = doc.createElement(rootName); @@ -996,32 +916,25 @@ public abstract class OfficeDocument return doc; } - /** - * <p>Creates a new DOM <code>Document</code> containing minimum - * OpenOffice XML tags.</p> + * Creates a new DOM {@code Document} containing minimum OpenOffice XML tags. * - * <p>This method uses the subclass - * <code>getOfficeClassAttribute</code> method to get the - * attribute for <i>office:class</i>.</p> + * <p>This method uses the subclass {@code getOfficeClassAttribute} method + * to get the attribute for <i>office:class</i>.</p> * - * @param rootName root name of <code>Document</code>. + * @param rootName root name of <code>Document</code>. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ private final Document createDOM(String rootName) throws IOException { Document doc = null; try { - DocumentBuilder builder = factory.newDocumentBuilder(); doc = builder.newDocument(); - } catch (ParserConfigurationException ex) { - throw new OfficeDocumentException(ex); - } Element root = doc.createElement(rootName); @@ -1047,7 +960,6 @@ public abstract class OfficeDocument return doc; } - /** * Return the <i>office:class</i> attribute value. * @@ -1055,30 +967,29 @@ public abstract class OfficeDocument */ protected abstract String getOfficeClassAttribute(); - /** - * <p>Hacked code to filter <!DOCTYPE> tag before - * sending stream to parser.</p> + * Hacked code to filter {@literal <!DOCTYPE>} tag before sending stream to + * parser. * - * <p>This hacked code needs to be changed later on.</p> + * <p>This hacked code needs to be changed later on.</p> * - * <p>Issue: using current jaxp1.0 parser, there is no way - * to turn off processing of dtds. Current set of dtds - * have bugs, processing them will throw exceptions.</p> + * <p>Issue: using current jaxp1.0 parser, there is no way to turn off + * processing of dtds. Current set of dtds have bugs, processing them will + * throw exceptions.</p> * - * <p>This is a simple hack that assumes the whole <!DOCTYPE> - * tag are all in the same line. This is sufficient for - * current StarOffice 6.0 generated XML files. Since this - * hack really needs to go away, I don't want to spend - * too much time in making it a perfect hack.</p> - * FIX (HJ): Removed requirement for DOCTYPE to be in one line - * FIX (HJ): No longer removes newlines + * <p>This is a simple hack that assumes the whole {@literal <!DOCTYPE>} tag + * are all in the same line. This is sufficient for current StarOffice 6.0 + * generated XML files. Since this hack really needs to go away, I don't + * want to spend too much time in making it a perfect hack.</p> * - * @param is <code>InputStream</code> to be filtered. + * FIX (HJ): Removed requirement for DOCTYPE to be in one line + * FIX (HJ): No longer removes newlines * - * @return Reader value without the <!DOCTYPE> tag. + * @param is {@code InputStream} to be filtered. * - * @throws IOException If any I/O error occurs. + * @return Reader value without the {@literal <!DOCTYPE>} tag. + * + * @throws IOException If any I/O error occurs. */ private static Reader hack(InputStream is) throws IOException { @@ -1086,17 +997,14 @@ public abstract class OfficeDocument StringBuffer buffer = new StringBuffer(); String str; - while ((str = br.readLine()) != null) { int sIndex = str.indexOf("<!DOCTYPE"); - if (sIndex > -1) { buffer.append(str.substring(0, sIndex)); int eIndex = str.indexOf('>', sIndex + 8 ); - if (eIndex > -1) { buffer.append(str.substring(eIndex + 1, str.length())); @@ -1134,18 +1042,18 @@ public abstract class OfficeDocument } /** - * <p>Transform the InputStream to a Reader Stream.</p> + * Transform the {@code InputStream} to a Reader Stream. * - * <p>This hacked code needs to be changed later on.</p> + * <p>This hacked code needs to be changed later on.</p> * - * <p>Issue: the new oasis input file stream means - * that the old input stream fails. see #i33702# </p> + * <p>Issue: the new oasis input file stream means that the old input stream + * fails. see #i33702# </p> * - * @param is <code>InputStream</code> to be filtered. + * @param is {@code InputStream} to be filtered. * - * @return Reader value of the InputStream(). + * @return Reader value of the {@code InputStream()}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ private static Reader secondHack(InputStream is) throws IOException { @@ -1164,7 +1072,6 @@ public abstract class OfficeDocument return r; } - /** * Method to create the initial entries in the manifest.xml file stored * in an SX? file. @@ -1178,7 +1085,7 @@ public abstract class OfficeDocument DocumentType docType = domImpl.createDocumentType(TAG_MANIFEST_ROOT, "-//OpenOffice.org//DTD Manifest 1.0//EN", "Manifest.dtd"); - manifestDoc = domImpl.createDocument("manifest", TAG_MANIFEST_ROOT, docType); + manifestDoc = domImpl.createDocument("manifest", TAG_MANIFEST_ROOT, docType); } catch (ParserConfigurationException ex) { throw new OfficeDocumentException(ex); } @@ -1196,4 +1103,3 @@ public abstract class OfficeDocument manifestRoot.appendChild(docRoot); } } - diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException.java index 815c2b4a8b50..89f91499caaf 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException.java @@ -26,21 +26,19 @@ import org.xml.sax.SAXParseException; import org.openoffice.xmerge.util.Resources; /** - * Used by OfficeDocument to encapsulate exceptions. It will add - * more details to the message string if it is of type - * <code>SAXParseException</code>. + * Used by OfficeDocument to encapsulate exceptions. + * + * <p>It will add more details to the message string if it is of type + * {@code SAXParseException}.</p> */ - public final class OfficeDocumentException extends IOException { private StringBuffer message = null; - /** - * Constructor, capturing additional information from the - * <code>SAXException</code>. + * Constructor, capturing additional information from the {@code SAXException}. * - * @param e The <code>SAXException</code>. + * @param e The {@code SAXException}. */ public OfficeDocumentException(SAXException e) { super(e.toString()); @@ -84,37 +82,32 @@ public final class OfficeDocumentException extends IOException { } } - /** - * Constructor, creates exception with provided message. + * Constructor, creates exception with provided message. * - * @param s Message value for the exception. + * @param s Message value for the exception. */ public OfficeDocumentException(String s) { super(s); } - /** - * Constructor, creates exception with the message - * corresponding to the message value of the provided - * exception. + * Constructor, creates exception with the message corresponding to the + * message value of the provided exception. * - * @param e The Exception. + * @param e The {@code Exception}. */ public OfficeDocumentException(Exception e) { super(e.getMessage()); } - /** - * Returns the message value for the <code>Exception</code>. + * Returns the message value for the {@code Exception}. * - * @return The message value for the <code>Exception</code>. + * @return The message value for the {@code Exception}. */ @Override public String getMessage() { return message.toString() + super.getMessage(); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeZip.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeZip.java index 1938a4e884d4..3bfaf3cb8404 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeZip.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeZip.java @@ -33,11 +33,9 @@ import java.io.ByteArrayOutputStream; import org.openoffice.xmerge.util.Debug; /** - * Class used by {@link - * org.openoffice.xmerge.converter.xml.OfficeDocument - * OfficeDocument} to handle reading and writing - * from a ZIP file, as well as storing ZIP entries. - * + * Class used by {@link org.openoffice.xmerge.converter.xml.OfficeDocument + * OfficeDocument} to handle reading and writing from a ZIP file, as well as + * storing ZIP entries. */ class OfficeZip { @@ -65,20 +63,20 @@ class OfficeZip { entryList = new LinkedList<Entry>(); } - /** - * <p>Read each zip entry in the <code>InputStream</code> object - * and store in entryList both the <code>ZipEntry</code> object - * as well as the bits of each entry. Call this method before - * calling the <code>getContentXMLBytes</code> method or the - * <code>getStyleXMLBytes</code> method.</p> + * Read each zip entry in the {@code InputStream} object and store in + * entryList both the {@code ZipEntry} object as well as the bits of each + * entry. * - * <p>Keep track of the CONTENTXML and STYLEXML using - * contentIndex and styleIndex, respectively.</p> + * <p>Call this method before calling the {@code getContentXMLBytes} method + * or the {@code getStyleXMLBytes} method.</p> * - * @param is <code>InputStream</code> object to read. + * <p>Keep track of the {@code CONTENTXML} and {@code STYLEXML} using + * {@code contentIndex} and {@code styleIndex}, respectively.</p> * - * @throws IOException If any I/O error occurs. + * @param is {@code InputStream} object to read. + * + * @throws IOException If any I/O error occurs. */ void read(InputStream is) throws IOException { @@ -129,47 +127,48 @@ class OfficeZip { zis.close(); } - /** - * This method returns the CONTENTXML file in a - * <code>byte</code> array. It returns null if there is no - * CONTENTXML in this zip file. + * This method returns the CONTENTXML file in a {@code byte} array. * - * @return CONTENTXML in a <code>byte</code> array. + * <p>It returns null if there is no {@code CONTENTXML} in this zip file.</p> + * + * @return CONTENTXML in a {@code byte} array. */ byte[] getContentXMLBytes() { return getEntryBytes(contentIndex); } - /** - * This method returns the STYLEXML file in a - * <code>byte</code> array. It returns null if there is - * no STYLEXML in this zip file. + * This method returns the {@code STYLEXML} file in a {@code byte} array. * - * @return STYLEXML in a <code>byte</code> array. + * <p>It returns {@code null} if there is no {@code STYLEXML} in this zip + * file.</p> + * + * @return STYLEXML in a {@code byte} array. */ byte[] getStyleXMLBytes() { return getEntryBytes(styleIndex); } - /** - * This method returns the METAXML file in a - * <code>byte</code> array. It returns null if there is - * no METAXML in this zip file. + /** + * This method returns the METAXML file in a {@code byte} array. * - * @return METAXML in a <code>byte</code> array. + * <p>It returns {@code null} if there is no {@code METAXML} in this zip + * file.</p> + * + * @return METAXML in a {@code byte} array. */ byte[] getMetaXMLBytes() { return getEntryBytes(metaIndex); } - /** - * This method returns the SETTINGSXML file in a - * <code>byte</code> array. It returns null if there is - * no SETTINGSXML in this zip file. + /** + * This method returns the {@code SETTINGSXML} file in a {@code byte} array. + * + * <p>It returns {@code null} if there is no {@code SETTINGSXML} in this zip + * file.</p> * * @return SETTINGSXML in a <code>byte</code> array. */ @@ -178,10 +177,12 @@ class OfficeZip { } /** - * This method returns the MANIFESTXML file in a <code>byte</code> array. - * It returns null if there is no MANIFESTXML in this zip file. + * This method returns the {@code MANIFESTXML} file in a {@code byte} array. + * + * <p>It returns {@code null} if there is no {@code MANIFESTXML} in this zip + * file.</p> * - * @return MANIFESTXML in a <code>byte</code> array. + * @return MANIFESTXML in a {@code byte} array. */ byte[] getManifestXMLBytes() { return getEntryBytes(manifestIndex); @@ -193,8 +194,8 @@ class OfficeZip { * * @param name The name of the entry in the Zip file to retrieve. * - * @return The data for the named entry in a <code>byte</code> array or - * <code>null</code> if no entry is found. + * @return The data for the named entry in a {@code byte} array or + * {@code null} if no entry is found. */ byte[] getNamedBytes(String name) { @@ -214,13 +215,13 @@ class OfficeZip { return null; } - /** - * This method sets the bytes for the named entry. It searches for a - * matching entry in the LinkedList. If no entry is found, a new one is - * created. + * This method sets the bytes for the named entry. + * + * <p>It searches for a matching entry in the LinkedList. If no entry is + * found, a new one is created.</p> * - * Writing of data is defferred to setEntryBytes(). + * <p>Writing of data is deferred to {@code setEntryBytes()}.</p> * * @param name The name of the entry to search for. * @param bytes The new data to write. @@ -241,17 +242,14 @@ class OfficeZip { } /** - * Used by the <code>getContentXMLBytes</code> method and the - * <code>getStyleXMLBytes</code> method to return the - * <code>byte</code> array from the corresponding - * <code>entry</code> in the <code>entryList</code>. + * Used by the {@code getContentXMLBytes} method and the + * {@code getStyleXMLBytes} method to return the {@code byte} array from the + * corresponding {@code Entry} in the {@code entryList}. * - * @param index Index of <code>Entry</code> object in - * <code>entryList</code>. + * @param index Index of {@code Entry} object in {@code entryList}. * - * @return <code>byte</code> array associated in that - * <code>Entry</code> object or null, if there is - * not such <code>Entry</code>. + * @return {@code byte} array associated in that {@code Entry} object or + * {@code null}, if there is not such {@code Entry}. */ private byte[] getEntryBytes(int index) { @@ -264,90 +262,73 @@ class OfficeZip { return bytes; } - /** - * Set or replace the <code>byte</code> array for the - * CONTENTXML file. + * Set or replace the <code>byte</code> array for the {@code CONTENTXML} file. * - * @param bytes <code>byte</code> array for the - * CONTENTXML file. + * @param bytes {@code byte} array for the {@code CONTENTXML} file. */ void setContentXMLBytes(byte bytes[]) { contentIndex = setEntryBytes(contentIndex, bytes, CONTENTXML); } - /** - * Set or replace the <code>byte</code> array for the - * STYLEXML file. + * Set or replace the {@code byte} array for the {@code STYLEXML} file. * - * @param bytes <code>byte</code> array for the - * STYLEXML file. + * @param bytes {@code byte} array for the {@code STYLEXML} file. */ void setStyleXMLBytes(byte bytes[]) { styleIndex = setEntryBytes(styleIndex, bytes, STYLEXML); } - - /** - * Set or replace the <code>byte</code> array for the - * METAXML file. + /** + * Set or replace the {@code byte} array for the {@code METAXML} file. * - * @param bytes <code>byte</code> array for the - * METAXML file. + * @param bytes {@code byte} array for the {@code METAXML} file. */ void setMetaXMLBytes(byte bytes[]) { metaIndex = setEntryBytes(metaIndex, bytes, METAXML); } - - /** - * Set or replace the <code>byte</code> array for the - * SETTINGSXML file. + /** + * Set or replace the {@code byte} array for the {@code SETTINGSXML} file. * - * @param bytes <code>byte</code> array for the - * SETTINGSXML file. + * @param bytes {@code byte} array for the {@code SETTINGSXML} file. */ void setSettingsXMLBytes(byte bytes[]) { settingsIndex = setEntryBytes(settingsIndex, bytes, SETTINGSXML); } - /** - * Set or replace the <code>byte</code> array for the MANIFESTXML file. + * Set or replace the {@code byte} array for the {@code MANIFESTXML} file. * - * @param bytes <code>byte</code> array for the MANIFESTXML file. + * @param bytes {@code byte} array for the {@code MANIFESTXML} file. */ void setManifestXMLBytes(byte bytes[]) { manifestIndex = setEntryBytes(manifestIndex, bytes, MANIFESTXML); } /** - * <p>Used by the <code>setContentXMLBytes</code> method and - * the <code>setStyleXMLBytes</code> to either replace an - * existing <code>Entry</code>, or create a new entry in - * <code>entryList</code>.</p> + * Used by the {@code setContentXMLBytes} method and the + * {@code setStyleXMLBytes} to either replace an existing {@code Entry}, or + * create a new entry in {@code entryList}. * - * <p>If there is an <code>Entry</code> object within - * entryList that corresponds to the index, replace the - * <code>ZipEntry</code> info.</p> + * <p>If there is an {@code Entry} object within {@code entryList} that + * corresponds to the index, replace the {@code ZipEntry} info.</p> * - * @param index Index of <code>Entry</code> to modify. - * @param bytes <code>Entry</code> value. - * @param name Name of <code>Entry</code>. + * @param index Index of <code>Entry</code> to modify. + * @param bytes <code>Entry</code> value. + * @param name Name of <code>Entry</code>. * - * @return Index of value added or modified in entryList + * @return Index of value added or modified in entryList */ private int setEntryBytes(int index, byte bytes[], String name) { if (index > -1) { - // replace existing entry in entryList - Entry entry = entryList.get(index); name = entry.zipEntry.getName(); int method = entry.zipEntry.getMethod(); @@ -358,7 +339,6 @@ class OfficeZip { entry.bytes= bytes; } else { - // add a new entry into entryList ZipEntry ze = createZipEntry(name, bytes, ZipEntry.DEFLATED); Entry entry = new Entry(ze, bytes); @@ -369,14 +349,12 @@ class OfficeZip { return index; } - /** - * Write out the ZIP entries into the <code>OutputStream</code> - * object. + * Write out the ZIP entries into the {@code OutputStream} object. * - * @param os <code>OutputStream</code> object to write ZIP. + * @param os <code>OutputStream</code> object to write ZIP. * - * @throws IOException If any ZIP I/O error occurs. + * @throws IOException If any ZIP I/O error occurs. */ void write(OutputStream os) throws IOException { @@ -385,7 +363,6 @@ class OfficeZip { ZipOutputStream zos = new ZipOutputStream(os); ListIterator<Entry> iterator = entryList.listIterator(); - while (iterator.hasNext()) { Entry entry = iterator.next(); @@ -402,15 +379,14 @@ class OfficeZip { zos.close(); } - /** - * Creates a <code>ZipEntry</code> object based on the given params. + * Creates a {@code ZipEntry} object based on the given parameters. * - * @param name Name for the <code>ZipEntry</code>. - * @param bytes <code>byte</code> array for <code>ZipEntry</code>. - * @param method ZIP method to be used for <code>ZipEntry</code>. + * @param name Name for the {@code ZipEntry}. + * @param bytes {@code byte} array for {@code ZipEntry}. + * @param method ZIP method to be used for {@code ZipEntry}. * - * @return A <code>ZipEntry</code> object. + * @return A {@code ZipEntry} object. */ private ZipEntry createZipEntry(String name, byte bytes[], int method) { @@ -430,9 +406,10 @@ class OfficeZip { } /** - * This inner class is used as a data structure for holding - * a <code>ZipEntry</code> info and its corresponding bytes. - * These are stored in entryList. + * This inner class is used as a data structure for holding a {@code ZipEntry} + * info and its corresponding bytes. + * + * <p>These are stored in {@code entryList}.</p> */ private class Entry { @@ -444,5 +421,4 @@ class OfficeZip { this.bytes = bytes; } } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/ParaStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/ParaStyle.java index 8cafc8c985d3..3faeb876fd14 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/ParaStyle.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/ParaStyle.java @@ -25,13 +25,12 @@ import org.w3c.dom.Element; import org.openoffice.xmerge.util.Debug; - abstract class conversionAlgorithm { abstract int I(String val); } /** - * This algorithm expects only values in millimeters, e.g. "20.3mm". + * This algorithm expects only values in millimeters, e.g. {@literal "20.3mm"}. */ class horizSize extends conversionAlgorithm { @Override @@ -54,10 +53,9 @@ class horizSize extends conversionAlgorithm { } } - -/* - * This algorithm does line height - can be either millimeters or - * a percentage. +/** + * This algorithm does line height {@literal -} can be either millimeters or a + * percentage. */ class lineHeight extends conversionAlgorithm { @Override @@ -88,9 +86,8 @@ class lineHeight extends conversionAlgorithm { } } - /** - * This class converts alignment values. + * This class converts alignment values. */ class alignment extends conversionAlgorithm { @Override @@ -115,52 +112,50 @@ class alignment extends conversionAlgorithm { } } - /** - * This class represents a paragraph <code>Style</code>. + * This class represents a paragraph {@code Style}. * - * <table summary="Paragraph style attributes and their values" border="1" cellpadding="1"> - * <caption>Table with all paragraph style attributes and their values</caption> - * <tr><td>Attribute</td><td>Value</td></tr> - * <tr><td>MARGIN_LEFT</td><td>mm * 100</td></tr> - * <tr><td>MARGIN_RIGHT</td><td>mm * 100</td></tr> - * <tr><td>MARGIN_TOP</td><td>mm * 100 (space on top of paragraph)</td></tr> - * <tr><td>MARGIN_BOTTOM</td><td>mm * 100</td></tr> - * <tr><td>TEXT_INDENT</td><td>mm * 100 (first line indent)</td></tr> - * <tr> - * <td>LINE_HEIGHT</td> - * <td>mm * 100, unless or'ed with LH_PCT, in which - * case it is a percentage (e.g. 200% for double spacing) - * Can also be or'ed with LH_ATLEAST. Value is stored - * in bits indicated by LH_VALUEMASK.</td> - * </tr> - * <tr><td>TEXT_ALIGN</td><td>ALIGN_RIGHT, ALIGN_CENTER, ALIGN_JUST, ALIGN_LEFT</td></tr> - * </table> + * <blockquote><table summary="Paragraph style attributes and their values" + * border="1" cellpadding="3" cellspacing="0"> + * <caption>Table with all paragraph style attributes and their values</caption> + * <tr><th>Attribute</th><th>Value</th></tr> + * <tr><td>MARGIN_LEFT</td><td>mm * 100</td></tr> + * <tr><td>MARGIN_RIGHT</td><td>mm * 100</td></tr> + * <tr><td>MARGIN_TOP</td><td>mm * 100 (space on top of paragraph)</td></tr> + * <tr><td>MARGIN_BOTTOM</td><td>mm * 100</td></tr> + * <tr><td>TEXT_INDENT</td><td>mm * 100 (first line indent)</td></tr> + * <tr> + * <td>LINE_HEIGHT</td> + * <td>mm * 100, unless or'ed with LH_PCT, in which case it is a percentage + * (e.g. 200% for double spacing) Can also be or'ed with LH_ATLEAST. + * Value is stored in bits indicated by LH_VALUEMASK.</td> + * </tr> + * <tr> + * <td>TEXT_ALIGN</td> + * <td>ALIGN_RIGHT, ALIGN_CENTER, ALIGN_JUST, ALIGN_LEFT</td> + * </tr> + * </table></blockquote> */ public class ParaStyle extends Style implements Cloneable { - - - - - /** Indent left property. */ + /** Indent left property. */ private static final int TEXT_INDENT = 4; - /** Indent right property. */ + /** Indent right property. */ private static final int LINE_HEIGHT = 5; - /** Align text property. */ + /** Align text property. */ private static final int TEXT_ALIGN = 6; // This must always be one more than highest property - /** Total number of properties. */ + /** Total number of properties. */ private static final int NR_PROPERTIES = 7; /** - * Array of flags indicating which attributes are set for this - * paragraph <code>Style</code>. + * Array of flags indicating which attributes are set for this paragraph + * {@code Style}. */ private boolean isSet[] = new boolean[NR_PROPERTIES]; - /** Array of attribute values for this paragraph <code>tyle</code>. */ + /** Array of attribute values for this paragraph {@code Style}. */ private int value[] = new int[NR_PROPERTIES]; - /** Array of attribute names for this paragraph <code>Style</code>. */ + /** Array of attribute names for this paragraph {@code Style}. */ private String attrName[] = { "fo:margin-left", "fo:margin-right", @@ -171,7 +166,7 @@ public class ParaStyle extends Style implements Cloneable { "fo:text-align" }; - /** Array of attribute structures for this paragraph <code>Style</code>. */ + /** Array of attribute structures for this paragraph {@code Style}. */ private Class<?> algor[] = { horizSize.class, horizSize.class, @@ -182,22 +177,22 @@ public class ParaStyle extends Style implements Cloneable { alignment.class }; - /** Align right. */ + /** Align right. */ public static final int ALIGN_RIGHT = 1; - /** Align center. */ + /** Align center. */ public static final int ALIGN_CENTER = 2; - /** Align justified. */ + /** Align justified. */ public static final int ALIGN_JUST = 3; - /** Align left. */ + /** Align left. */ public static final int ALIGN_LEFT = 4; - /** Line height percentage. */ + /** Line height percentage. */ public static final int LH_PCT = 0x40000000; - /** Line height mask. */ - private static final int LH_VALUEMASK = 0x00FFFFFF; + /** Line height mask. */ + private static final int LH_VALUEMASK = 0x00FFFFFF; - /** Ignored tags. */ + /** Ignored tags. */ private static String[] ignored = { "style:font-name", "fo:font-size", "fo:font-weight", "fo:color", "fo:language", "fo:country", "style:font-name-asian", @@ -209,15 +204,13 @@ public class ParaStyle extends Style implements Cloneable { "text:number-lines", "text:line-number" }; - /** - * Constructor for use when going from DOM to client device format. + * Constructor for use when going from DOM to client device format. * - * @param node A <i>style:style</i> <code>Node</code> which, which - * is assumed to have <i>family</i> attribute of - * <i>paragraph</i>. - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param node A <i>style:style</i> {@code Node} which, which is assumed + * to have <i>family</i> attribute of <i>paragraph</i>. + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ public ParaStyle(Node node, StyleCatalog sc) { @@ -247,19 +240,18 @@ public class ParaStyle extends Style implements Cloneable { } } - /** - * Constructor for use when going from client device format to DOM. + * Constructor for use when going from client device format to DOM. * - * @param name Name of the <code>Style</code>. Can be null. - * @param familyName Family of the <code>Style</code> - usually - * <i>paragraph</i>, <i>text</i>, etc. Can be null. - * @param parentName Name of the parent <code>Style</code>, or null - * if none. - * @param attribs Array of attributes to set. - * @param values Array of values to set. - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param name Name of the {@code Style}. Can be {@code null}. + * @param familyName Family of the {@code Style} {@literal -} usually + * <i>paragraph</i>, <i>text</i>, etc. Can be {@code null}. + * @param parentName Name of the parent {@code Style}, or {@code null} + * if none. + * @param attribs Array of attributes to set. + * @param values Array of values to set. + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ public ParaStyle(String name, String familyName, String parentName, String attribs[], String values[], StyleCatalog sc) { @@ -269,20 +261,17 @@ public class ParaStyle extends Style implements Cloneable { setAttribute(attribs[i], values[i]); } - /** - * Alternate constructor for use when going from client device - * format to DOM. + * Alternate constructor for use when going from client device format to DOM. * - * @param name Name of the <code>Style</code>. Can be null. - * @param familyName Family of the <code>Style</code> - usually - * <i>paragraph</i>, <i>text</i>, etc. Can be null. - * @param parentName Name of the parent <code>Style</code>, or - * null if none. - * @param attribs Array of attributes indices to set. - * @param values Array of values to set. - * @param lookup The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param name Name of the {@code Style}. Can be {@code null}. + * @param familyName Family of the {@code Style} {@literal -} usually + * <i>paragraph</i>, <i>text</i>, etc. Can be {@code null}. + * @param parentName Name of the parent {@code Style}, or null if none. + * @param attribs Array of attributes indices to set. + * @param values Array of values to set. + * @param lookup The {@code StyleCatalog}, which is used for looking + * up ancestor {@code Style} objects. */ public ParaStyle(String name, String familyName, String parentName, int attribs[], String values[], StyleCatalog lookup) { @@ -292,14 +281,12 @@ public class ParaStyle extends Style implements Cloneable { setAttribute(attribs[i], values[i]); } - /** - * This code checks whether an attribute is one that we - * intentionally ignore. + * This code checks whether an attribute is one that we intentionally ignore. * - * @param attribute The attribute to check. + * @param attribute The attribute to check. * - * @return true if attribute can be ignored, false otherwise. + * @return {@code true} if attribute can be ignored, {@code false} otherwise. */ private boolean isIgnored(String attribute) { for (int i = 0; i < ignored.length; i++) { @@ -309,12 +296,11 @@ public class ParaStyle extends Style implements Cloneable { return false; } - /** - * Set an attribute for this paragraph <code>Style</code>. + * Set an attribute for this paragraph {@code Style}. * - * @param attr The attribute to set. - * @param value The attribute value to set. + * @param attr The attribute to set. + * @param value The attribute value to set. */ private void setAttribute(String attr, String value) { for (int i = 0; i < NR_PROPERTIES; i++) { @@ -327,18 +313,11 @@ public class ParaStyle extends Style implements Cloneable { Debug.log(Debug.INFO, "ParaStyle Unhandled: " + attr + "=" + value); } - - - - - - - /** - * Set an attribute for this paragraph <code>Style</code>. + * Set an attribute for this paragraph {@code Style}. * - * @param attr The attribute index to set. - * @param value The attribute value to set. + * @param attr The attribute index to set. + * @param value The attribute value to set. */ private void setAttribute(int attr, String value) { isSet[attr] = true; @@ -349,11 +328,10 @@ public class ParaStyle extends Style implements Cloneable { } } - /** - * Return the <code>Style</code> in use. + * Return the {@code Style} in use. * - * @return The fully-resolved copy of the <code>Style</code> in use. + * @return The fully-resolved copy of the {@code Style} in use. */ @Override public Style getResolved() { @@ -396,14 +374,13 @@ public class ParaStyle extends Style implements Cloneable { return resolved; } - /** - * Private function to return the value as an element in - * a Comma Separated Value (CSV) format. + * Private function to return the value as an element in a Comma Separated + * Value (CSV) format. * - * @param value The value to format. + * @param value The value to format. * - * @return The formatted value. + * @return The formatted value. */ private static String toCSV(String value) { if (value != null) @@ -412,14 +389,13 @@ public class ParaStyle extends Style implements Cloneable { return "\"\","; } - /** - * Private function to return the value as a last element in - * a Comma Separated Value (CSV) format. + * Private function to return the value as a last element in a Comma + * Separated Value (CSV) format. * - * @param value The value to format. + * @param value The value to format. * - * @return The formatted value. + * @return The formatted value. */ private static String toLastCSV(String value) { if (value != null) @@ -428,10 +404,8 @@ public class ParaStyle extends Style implements Cloneable { return "\"\""; } - /** - * Print a Comma Separated Value (CSV) header line for the - * spreadsheet dump. + * Print a Comma Separated Value (CSV) header line for the spreadsheet dump. */ public static void dumpHdr() { System.out.println(toCSV("Name") + toCSV("Family") + toCSV("parent") @@ -440,10 +414,8 @@ public class ParaStyle extends Style implements Cloneable { + toCSV("line height") + toLastCSV("txt align")); } - /** - * Dump this <code>Style</code> as a Comma Separated Value (CSV) - * line. + * Dump this {@code Style} as a Comma Separated Value (CSV) line. */ public void dumpCSV() { String attributes = ""; @@ -458,15 +430,13 @@ public class ParaStyle extends Style implements Cloneable { + attributes + toLastCSV(null)); } - /** - * Create the <code>Node</code> with the specified elements. + * Create the {@code Node} with the specified elements. * - * @param parentDoc Parent <code>Document</code> of the - * <code>Node</code> to create. - * @param name Name of the <code>Node</code>. + * @param parentDoc Parent {@code Document} of the {@code Node} to create. + * @param name Name of the {@code Node}. * - * @return The created <code>Node</code>. + * @return The created {@code Node}. */ @Override public Node createNode(org.w3c.dom.Document parentDoc, String name) { @@ -475,15 +445,13 @@ public class ParaStyle extends Style implements Cloneable { return node; } - /** - * Return true if <code>style</code> is a subset of the - * <code>Style</code>. + * Return {@code true} if {@code style} is a subset of the {@code Style}. * - * @param style <code>Style</code> to check. + * @param style {@code Style} to check. * - * @return true if <code>style</code> is a subset, false - * otherwise. + * @return {@code true} if <code>style</code> is a subset, {@code false} + * otherwise. */ @Override public boolean isSubset(Style style) { @@ -518,14 +486,12 @@ public class ParaStyle extends Style implements Cloneable { return true; } - /** - * Add <code>Style</code> attributes to the given - * <code>Node</code>. This may involve writing child - * <code>Node</code> objects as well. + * Add {@code Style} attributes to the given {@code Node}. + * + * <p>This may involve writing child {@code Node} objects as well.</p> * - * @param node The <code>Node</code> to add <code>Style</code> - * attributes. + * @param node The {@code Node} to add {@code Style} attributes. */ private void writeAttributes(Element node) { for (int i = 0; i <= TEXT_INDENT; i++) { @@ -559,5 +525,4 @@ public class ParaStyle extends Style implements Cloneable { node.setAttribute(attrName[TEXT_ALIGN], val); } } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/Style.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/Style.java index 1f5bcd5ce44c..d28d6a45fd1d 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/Style.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/Style.java @@ -22,40 +22,39 @@ import org.w3c.dom.Node; import org.w3c.dom.NamedNodeMap; /** - * An object of class <code>Style</code> represents a <i>style</i> - * in an OpenOffice document. In practice subclasses of this - * <code>Style</code>, such as <code>TextStyle</code>, - * <code>ParaStyle</code> are used. + * An object of class {@code Style} represents a <i>style</i> in an OpenOffice + * document. * - * @see <a href="TextStyle.html">TextStyle</a> - * @see <a href="ParaStyle.html">ParaStyle</a> + * <p>In practice subclasses of this {@code Style}, such as {@code TextStyle}, + * {@code ParaStyle} are used.</p> + * + * @see <a href="TextStyle.html">TextStyle</a> + * @see <a href="ParaStyle.html">ParaStyle</a> */ public class Style { - /** Name of the <code>Style</code>. */ + /** Name of the {@code Style}. */ protected String name = null; - /** Family of the <code>Style</code>. */ + /** Family of the {@code Style}. */ protected String family = null; - /** Parent of the <code>Style</code>. */ + /** Parent of the {@code Style}. */ protected String parent = null; /** - * A reference to the <code>StyleCatalog</code> to be used for - * looking up ancestor <code>Style</code> objects. + * A reference to the {@code StyleCatalog} to be used for looking up ancestor + * {@code Style} objects. */ protected StyleCatalog sc; - /** - * Constructor for use when going from DOM to client device format. + * Constructor for use when going from DOM to client device format. * - * @param node A <i>style:style</i> or <i>style:default-style</i> - * <code>Node</code> from the document being parsed. - * No checking of <code>Node</code> is done, so if it - * is not of the proper type the results will be - * unpredictable. - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param node A <i>style:style</i> or <i>style:default-style</i> + * {@code Node} from the document being parsed. No checking of + * {@code Node} is done, so if it is not of the proper type + * the results will be unpredictable. + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ public Style(Node node, StyleCatalog sc) { @@ -81,16 +80,15 @@ public class Style { } } - /** - * Constructor for use when going from client device format to DOM. + * Constructor for use when going from client device format to DOM. * - * @param name Name of the <code>Style</code>. Can be null. - * @param family Family of the <code>Style</code> - usually - * <i>paragraph</i>, <i>text</i>, etc. Can be null. - * @param parent Name of the parent <code>Style</code>, or null if none. - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param name Name of the {@code Style}. Can be {@code null}. + * @param family Family of the {@code Style} {@literal -} usually + * <i>paragraph</i>, <i>text</i>, etc. Can be {@code null}. + * @param parent Name of the parent {@code Style}, or {@code null} if none. + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ public Style(String name, String family, String parent, StyleCatalog sc) { this.sc = sc; @@ -99,107 +97,95 @@ public class Style { this.parent = parent; } - /** - * Set the <code>StyleCatalog</code> to be used when looking up the - * <code>Style</code> parent. + * Set the {@code StyleCatalog} to be used when looking up the {@code Style} + * parent. * - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ public void setCatalog(StyleCatalog sc) { this.sc = sc; } - /** - * Returns the name of this <code>Style</code>. + * Returns the name of this {@code Style}. * - * @return The name of this <code>Style</code>. + * @return The name of this {@code Style}. */ public String getName() { return name; } - /** - * Sets the name of this <code>Style</code>. + * Sets the name of this {@code Style}. * - * @param newName The new name of this <code>Style</code>. + * @param newName The new name of this {@code Style}. */ public void setName(String newName) { name = newName; } - /** - * Return the family of this <code>Style</code>. + * Return the family of this {@code Style}. * - * @return The family of this <code>Style</code>. + * @return The family of this {@code Style}. */ public String getFamily() { return family; } /** - * Return the name of the parent of this <code>Style</code>. + * Return the name of the parent of this {@code Style}. * - * @return The parent of this <code>Style</code>. + * @return The parent of this {@code Style}. */ public String getParent() { return parent; } - /** - * Return a <code>Style</code> object corresponding to this one, but with - * all of the inherited information from parent <code>Style</code> - * objects filled in. The object returned will be a new object, not a - * reference to this object, even if it does not need any information - * added. + * Return a {@code Style} object corresponding to this one, but with all of + * the inherited information from parent {@code Style} objects filled in. + * + * <p>The object returned will be a new object, not a reference to this + * object, even if it does not need any information added.</p> * - * @return A resolved <code>Style</code> object in which to look up - * ancestors. + * @return A resolved {@code Style} object in which to look up ancestors. */ public Style getResolved() { return new Style(name, family, parent, sc); } - /** - * Write a <code>Node</code> in <code>parentDoc</code> - * representing this <code>Style</code>. Note that the - * <code>Node</code> is returned unconnected. + * Write a {@code Node} in {@code parentDoc} representing this {@code Style}. + * + * <p>Note that the {@code Node} is returned unconnected.</p> * - * @param parentDoc Document to which new <code>Node</code> will - * belong. - * @param name Name to use for new <code>Node</code>. + * @param parentDoc Document to which new {@code Node} will belong. + * @param name Name to use for new {@code Node}. */ public Node createNode(org.w3c.dom.Document parentDoc, String name) { // DJP: write this! Should call writeAttributes() return null; } - - - - /** - * Return true if <code>Style</code> is a subset of this one. Note - * that this will return true even if <code>Style</code> is less - * specific than this <code>Style</code>, so long as it does not - * contradict this <code>Style</code> in any way. + * Return {@code true} if {@code Style} is a subset of this one. * - * This always returns true since only subclasses of - * <code>Style</code> contain any actual <code>Style</code> - * information. + * <p>Note that this will return true even if {@code Style} is less specific + * than this {@code Style}, so long as it does not contradict this + * {@code Style} in any way.</p> * - * @param style The <code>Style</code> to check + * <p>This always returns true since only subclasses of {@code Style} + * contain any actual {@code Style} information.</p> * - * @return true if the <code>Style</code> is a subset, false otherwise. + * @param style The {@code Style} to check. + * + * @return {@code true} if the {@code Style} is a subset, {@code false} + * otherwise. */ public boolean isSubset(Style style) { return true; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java index 70ac5cebfd35..ac66285b4e45 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java @@ -27,67 +27,61 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; - /** - * A <code>StyleCatalog</code> holds a collection of <code>Style</code> - * objects. It is intended for use when parsing or building a DOM - * document. + * A {@code StyleCatalog} holds a collection of {@code Style} objects. + * + * <p>It is intended for use when parsing or building a DOM document.</p> * - * Each entry in the <code>StyleCatalog</code> represents a - * <code>Style</code>, and is an object which is a subclass of - * <code>Style</code>. + * <p>Each entry in the {@code StyleCatalog} represents a {@code Style}, and is + * an object which is a subclass of {@code Style}.</p> * - * @see <a href="Style.html">Style</a> + * @see <a href="Style.html">Style</a> */ public class StyleCatalog { private ArrayList<Style> styles; // The actual styles /** - * Constructor + * Constructor. * - * @param initialEntries Expected number of entries to set - * for efficiency purposes. + * @param initialEntries Expected number of entries to set for efficiency + * purposes. */ public StyleCatalog(int initialEntries) { styles = new ArrayList<Style>(initialEntries); } - /** - * <p>Parse the <code>Document</code> starting from <code>node</code> - * and working downward, and add all styles found, so long as their - * family name is listed in <code>families</code>. For each - * family name in <code>families</code> there must be a corresponding - * element in <code>classes</code>, which specifies the class type - * to use for that family. All of these classes must be - * subclasses of <code>Style</code>. There can be multiple - * classes specified for a particular family.</p> + * Parse the {@code Document} starting from {@code node} and working downward, + * and add all styles found, so long as their family name is listed in + * {@code families}. * - * <p>If <code>defaultClass</code> is non-null, then all styles that - * are found will be added. Any <code>Style</code> whose family is - * not listed in <code>families</code> will be added using defaultClass, - * which, of course, must be a subclass of <code>Style</code>. - * If <code>alwaysCreateDefault</code> is true, then a class - * of type <code>defaultClass</code> will always be created, - * regardless of whether there was also a match in - * <code>families</code>.</p> + * <p>For each family name in {@code families} there must be a corresponding + * element in {@code classes}, which specifies the class type to use for that + * family. All of these classes must be subclasses of {@code Style}. There + * can be multiple classes specified for a particular family.</p> * - * <p>DJP Todo: make it recursive so that <code>node</code> can be - * higher up in the <code>Document</code> tree.</p> + * <p>If {@code defaultClass} is non-null, then all styles that are found + * will be added. Any {@code Style} whose family is not listed in + * {@code families} will be added using defaultClass, which, of course, must + * be a subclass of {@code Style}. If {@code alwaysCreateDefault} is + * {@code true}, then a class of type {@code defaultClass} will always be + * created, regardless of whether there was also a match in {@code families}. + * </p> * - * @param node The node to be searched for - * <code>Style</code> objects. - * @param families An array of <code>Style</code> families - * to add. - * @param classes An array of class types corresponding - * to the families array. - * @param defaultClass All <code>Style</code> objects that are - * found are added to this class. - * @param alwaysCreateDefault A class of type <code>defaultClass</code> - * will always be created, regardless of - * whether there is a match in the - * families array. + * <p>DJP ToDo: make it recursive so that {@code node} can be higher up in + * the {@code Document} tree.</p> + * + * @param node The node to be searched for {@code Style} + * objects. + * @param families An array of {@code Style} families to add. + * @param classes An array of class types corresponding to the + * families array. + * @param defaultClass All {@code Style} objects that are found are + * added to this class. + * @param alwaysCreateDefault A class of type {@code defaultClass} will + * always be created, regardless of whether + * there is a match in the families array. */ public void add(Node node, String families[], Class<?> classes[], Class<?> defaultClass, boolean alwaysCreateDefault) { @@ -127,14 +121,12 @@ public class StyleCatalog { } } - /** - * Call the constructor of class <code>cls</code> with parameters - * <code>node</code>, and add the resulting <code>Style</code> to - * the catalog. + * Call the constructor of class {@code cls} with parameters {@code node}, + * and add the resulting {@code Style} to the catalog. * - * @param cls The class whose constructor will be called. - * @param node The constructed class will be added to this node. + * @param cls The class whose constructor will be called. + * @param node The constructed class will be added to this node. */ private void callConstructor(Class<?> cls, Node node) { Class<?> params[] = new Class[2]; @@ -151,31 +143,29 @@ public class StyleCatalog { } } - /** - * Add a <code>Style</code> to the catalog. + * Add a {@code Style} to the catalog. * - * @param s The <code>Style</code> to add. + * @param s The {@code Style} to add. */ public void add(Style s) { styles.add(s); } - /** - * Return the first <code>Style</code> matching the specified names. + * Return the first {@code Style} matching the specified names. * - * @param name Name to match, null is considered + * @param name Name to match, {@code null} is considered * <i>always match</i>. - * @param family Family to match, null is considered + * @param family Family to match, {@code null} is considered * <i>always match</i>. - * @param parent Parent to match, null is considered + * @param parent Parent to match, {@code null} is considered * <i>always match</i>. - * @param styleClass styleClass to match, null is considered + * @param styleClass styleClass to match, {@code null} is considered * <i>always match</i>. * - * @return <code>Style</code> value if all parameters match, - * null otherwise + * @return {@code Style} value if all parameters match, {@code null} + * otherwise. */ public Style lookup(String name, String family, String parent, Class<?> styleClass) { @@ -199,15 +189,13 @@ public class StyleCatalog { return null; // none found } - /** - * Given a <code>Style</code> <code>s</code> return all - * <code>Style</code> objects that match. + * Given a {@code Style s} return all {@code Style} objects that match. * - * @param s <code>Style</code> to match. + * @param s {@code Style} to match. * - * @return An array of <code>Style</code> objects that match, an - * empty array if none match. + * @return An array of {@code Style} objects that match, an empty array if + * none match. */ public Style[] getMatching(Style s) { @@ -230,24 +218,18 @@ public class StyleCatalog { return matchArray; } - - - - /** - * <p>Create a <code>Node</code> named <code>name</code> in - * <code>Document</code> <code>parentDoc</code>, and write the - * entire <code>StyleCatalog</code> to it.</p> + * Create a {@code Node} named {@code name} in {@code Document parentDoc}, + * and write the entire {@code StyleCatalog} to it. * - * <p>Note that the resulting node is returned, but is not connected - * into the document. Placing the output node in the document is - * left to the caller.</p> + * <p>Note that the resulting node is returned, but is not connected into the + * document. Placing the output node in the document is left to the caller. + * </p> * - * @param parentDoc The <code>Document</code> to add the - * <code>Node</code>. - * @param name The name of the <code>Node</code> to add. + * @param parentDoc The {@code Document} to add the {@code Node}. + * @param name The name of the {@code Node} to add. * - * @return The <code>Element</code> that was created. + * @return The {@code Element} that was created. */ public Element writeNode(org.w3c.dom.Document parentDoc, String name) { Element rootNode = parentDoc.createElement(name); @@ -276,17 +258,12 @@ public class StyleCatalog { return rootNode; } - - - - /** - * Find the family attribute of a <code>Style</code> <code>Node</code>. + * Find the family attribute of a {@code Style Node}. * - * @param node The <code>Node</code> to check. + * @param node The {@code Node} to check. * - * @return The family attribute, or null if one does not - * exist. + * @return The family attribute, or {@code null} if one does not exist. */ private String getFamilyName(Node node) { NamedNodeMap attributes = node.getAttributes(); @@ -301,5 +278,4 @@ public class StyleCatalog { } return null; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java index c752f1e1fb4f..41fb07014a4c 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java @@ -30,12 +30,10 @@ import org.w3c.dom.Element; import org.openoffice.xmerge.util.Debug; /** - * Represents a text <code>Style</code> in an OpenOffice document. - * + * Represents a text {@code Style} in an OpenOffice document. */ public class TextStyle extends Style implements Cloneable { - /** Indicates <i>bold</i> text. */ final private static int BOLD = 0x01; /** Indicates <i>italic</i> text. */ @@ -49,7 +47,6 @@ public class TextStyle extends Style implements Cloneable { /** Indicates <i>subscripted</i> text. */ final private static int SUBSCRIPT = 0x20; - /** Values of text attributes. */ private int values = 0; /** Bitwise mask of text attributes. */ @@ -59,19 +56,19 @@ public class TextStyle extends Style implements Cloneable { private int sizeInPoints = 0; /** Font name. */ private String fontName = null; - /** Font <code>Color</code>. */ + /** Font {@code Color}. */ private Color fontColor = null; - /** Background <code>Color</code>. */ + /** Background {@code Color}. */ private Color bgColor = null; /** - * Constructor for use when going from DOM to client device format. + * Constructor for use when going from DOM to client device format. * - * @param node The <i>style:style</i> <code>Node</code> containing - * the <code>Style</code>. (This <code>Node</code> is - * assumed have a <i>family</i> attribute of <i>text</i>). - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param node The <i>style:style</i> {@code Node} containing the + * {@code Style}. (This {@code Node} is assumed have a + * <i>family</i> attribute of <i>text</i>). + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ public TextStyle(Node node, StyleCatalog sc) { super(node, sc); @@ -111,35 +108,31 @@ public class TextStyle extends Style implements Cloneable { } } - /** - * Constructor for use when going from client device format to DOM + * Constructor for use when going from client device format to DOM * - * @param name Name of text <code>Style</code>. Can be null. - * @param family Family of text <code>Style</code> (usually - * <i>text</i>). Can be null. - * @param parent Name of parent text <code>Style</code>, or null - * for none. - * @param mask Bitwise mask of text attributes that this text - * <code>Style</code> will specify. Can be any - * combination of the following, or'ed together: - * {@link #BOLD}, {@link #ITALIC}, {@link #UNDERLINE}, - * {@link #STRIKETHRU}, {@link #SUPERSCRIPT}, - * {@link #SUBSCRIPT}. This parameter determines what - * attributes this <code>Style</code> will specify. - * When an attribute is specified in a - * <code>Style</code>, its value can be either - * <i>on</i> or <i>off</i>. The on/off value for - * each attribute is controlled by the - * <code>values</code> parameter. - * @param values Values of text attributes that this text - * <code>Style</code> will be setting. Any of the - * attributes ({@link #BOLD}, etc) listed for - * <code>mask</code> can be used for this. - * @param fontSize Font size in points. - * @param fontName Name of font. - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param name Name of text {@code Style}. Can be {@code null}. + * @param family Family of text {@code Style} (usually <i>text</i>). + * Can be {@code null}. + * @param parent Name of parent text {@code Style}, or {@code null} for + * none. + * @param mask Bitwise mask of text attributes that this text + * {@code Style} will specify. Can be any combination of + * the following, or'ed together: {@link #BOLD}, + * {@link #ITALIC}, {@link #UNDERLINE}, {@link #STRIKETHRU}, + * {@link #SUPERSCRIPT}, {@link #SUBSCRIPT}. This parameter + * determines what attributes this {@code Style} will + * specify. When an attribute is specified in a + * {@code Style}, its value can be either <i>on</i> or + * <i>off</i>. The on/off value for each attribute is + * controlled by the {@code values} parameter. + * @param values Values of text attributes that this text {@code Style} + * will be setting. Any of the attributes ({@link #BOLD}, + * etc) listed for {@code mask} can be used for this. + * @param fontSize Font size in points. + * @param fontName Name of font. + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ public TextStyle(String name, String family, String parent, int mask, int values, int fontSize, String fontName, StyleCatalog sc) { @@ -150,13 +143,12 @@ public class TextStyle extends Style implements Cloneable { this.fontName = fontName; } - /** - * Parse a color specification of the form <i>#rrggbb</i> + * Parse a color specification of the form <i>#rrggbb</i> * - * @param value <code>Color</code> specification to parse. + * @param value {@code Color} specification to parse. * - * @return The <code>Color</code> associated the value. + * @return The {@code Color} associated the value. */ private Color parseColorString(String value) { // Assume color value is of form #rrggbb @@ -176,12 +168,11 @@ public class TextStyle extends Style implements Cloneable { return new Color(red, green, blue); } - /** - * Set an attribute. + * Set an attribute. * - * @param attr The attribute to set. - * @param value The attribute value to set. + * @param attr The attribute to set. + * @param value The attribute value to set. */ private void handleAttribute(String attr, String value) { @@ -257,70 +248,56 @@ public class TextStyle extends Style implements Cloneable { } } - - - - - - - /** - * Return the font size for this <code>Style</code>. + * Return the font size for this {@code Style}. * - * @return The font size in points + * @return The font size in points */ public int getFontSize() { return sizeInPoints; } - /** - * Return the name of the font for this <code>Style</code>. + * Return the name of the font for this {@code Style}. * - * @return Name of font, or null if no font is specified by - * this <code>Style</code>. + * @return Name of font, or null if no font is specified by this + * {@code Style}. */ public String getFontName() { return fontName; } - /** - * Return the font <code>Color</code> for this <code>Style</code>. - * Can be null if none was specified. + * Return the font {@code Color} for this {@code Style}. * - * @return <code>Color</code> value for this <code>Style</code>. - * Can be null. + * <p>Can be {@code null} if none was specified.</p> + * + * @return {@code Color} value for this {@code Style}. Can be {@code null}. */ public Color getFontColor() { return fontColor; } - /** - * Return the background <code>Color</code> for this - * <code>Style</code>. Can be null if none was specified. + * Return the background {@code Color} for this {@code Style}. * - * @return Background <code>Color</code> value for this - * <code>Style</code>. Can be null. + * <p>Can be {@code null} if none was specified.</p> + * + * @return Background {@code Color} value for this {@code Style}. Can be + * {@code null}. */ public Color getBackgroundColor() { return bgColor; } - - - - /** - * Return a <code>Style</code> object corresponding to this one, - * but with all of the inherited information from parent - * <code>Style</code> objects filled in. The object returned will - * be a new object, not a reference to this object, even if it does - * not need any information added. + * Return a {@code Style} object corresponding to this one, but with all of + * the inherited information from parent {@code Style} objects filled in. * - * @return The <code>StyleCatalog</code> in which to look up - * ancestors. + * <p>The object returned will be a new object, not a reference to this + * object, even if it does not need any information added.</p> + * + * @return The {@code StyleCatalog} in which to look up ancestors. */ @Override public Style getResolved() { @@ -375,36 +352,33 @@ public class TextStyle extends Style implements Cloneable { return resolved; } - /** - * Set one or more text attributes to <i>on</i>. + * Set one or more text attributes to <i>on</i>. * - * @param flags Flag values to set <i>on</i>. + * @param flags Flag values to set <i>on</i>. */ private void turnAttributesOn(int flags) { mask |= flags; values |= flags; } - /** - * Set one or more text attributes to <i>off</i>. + * Set one or more text attributes to <i>off</i>. * - * @param flags The flag values to set <i>off</i>. + * @param flags The flag values to set <i>off</i>. */ private void turnAttributesOff(int flags) { mask |= flags; values &= ~flags; } - /** - * Private function to return the value as an element in - * a Comma Separated Value (CSV) format. + * Private function to return the value as an element in a Comma Separated + * Value (CSV) format. * - * @param value The value to format. + * @param value The value to format. * - * @return The formatted value. + * @return The formatted value. */ private static String toCSV(String value) { if (value != null) @@ -413,14 +387,13 @@ public class TextStyle extends Style implements Cloneable { return "\"\","; } - /** - * Private function to return the value as a last element in - * a Comma Separated Value (CSV) format. + * Private function to return the value as a last element in a Comma + * Separated Value (CSV) format. * - * @param value The value to format. + * @param value The value to format. * - * @return The formatted value. + * @return The formatted value. */ private static String toLastCSV(String value) { if (value != null) @@ -429,10 +402,8 @@ public class TextStyle extends Style implements Cloneable { return "\"\""; } - /** - * Print a Comma Separated Value (CSV) header line for the - * spreadsheet dump. + * Print a Comma Separated Value (CSV) header line for the spreadsheet dump. */ public static void dumpHdr() { System.out.println(toCSV("Name") + toCSV("Family") + toCSV("parent") @@ -441,9 +412,8 @@ public class TextStyle extends Style implements Cloneable { + toCSV("Strikethru") + toCSV("Superscript") + toLastCSV("Subscript")); } - /** - * Dump this <code>Style</code> as a Comma Separated Value (CSV) line. + * Dump this {@code Style} as a Comma Separated Value (CSV) line. */ public void dumpCSV() { String attributes = ""; @@ -456,17 +426,15 @@ public class TextStyle extends Style implements Cloneable { + toCSV(fontName) + toCSV("" + sizeInPoints) + attributes + toLastCSV(null)); } - /** - * Create a new <code>Node</code> in the <code>Document</code>, and - * write this <code>Style</code> to it. + * Create a new {@code Node} in the {@code Document}, and write this + * {@code Style} to it. * - * @param parentDoc Parent <code>Document</code> of the - * <code>Node</code> to create. - * @param name Name to use for the new <code>Node</code> (e.g. - * <i>style:style</i>) + * @param parentDoc Parent {@code Document} of the {@code Node} to create. + * @param name Name to use for the new {@code Node} (e.g. + * <i>style:style</i>) * - * @return Created <code>Node</code>. + * @return Created {@code Node}. */ @Override public Node createNode(org.w3c.dom.Document parentDoc, String name) { @@ -475,16 +443,14 @@ public class TextStyle extends Style implements Cloneable { return node; } - /** - * Return true if <code>style</code> specifies as much or less - * than this <code>Style</code>, and nothing it specifies - * contradicts this <code>Style</code>. + * Return {@code true} if {@code style} specifies as much or less than this + * {@code Style}, and nothing it specifies contradicts this {@code Style}. * - * @param style The <code>Style</code> to check. + * @param style The {@code Style} to check. * - * @return true if <code>style</code> is a subset, false - * otherwise. + * @return {@code true} if {@code style} is a subset, {@code false} + * otherwise. */ @Override public boolean isSubset(Style style) { @@ -524,13 +490,11 @@ public class TextStyle extends Style implements Cloneable { return true; } - /** - * Write this <code>Style</code> object's attributes to a - * <code>Node</code> in the <code>Document</code>. + * Write this {@code Style} object's attributes to a {@code Node} in the + * {@code Document}. * - * @param node The <code>Node</code> to add <code>Style</code> - * attributes. + * @param node The {@code Node} to add {@code Style} attributes. */ private void writeAttributes(Element node) { @@ -573,14 +537,12 @@ public class TextStyle extends Style implements Cloneable { buildColorString(bgColor)); } - /** - * Given a <code>Color</code>, return a string of the form - * <i>#rrggbb</i>. + * Given a {@code Color}, return a string of the form <i>{@literal #rrggbb}</i>. * - * @param c The <code>Color</code> value. + * @param c The {@code Color} value. * - * @return The <code>Color</code> value in the form <i>#rrggbb</i>. + * @return The {@code Color} value in the form <i>{@literal #rrggbb}</i>. */ private String buildColorString(Color c) { int v[] = new int[3]; @@ -597,7 +559,6 @@ public class TextStyle extends Style implements Cloneable { return colorString; } - private static String[] ignored = { "style:text-autospace", "style:text-underline-color", "fo:margin-left", "fo:margin-right", "fo:text-indent", @@ -611,15 +572,13 @@ public class TextStyle extends Style implements Cloneable { "style:line-break", "fo:keep-with-next" }; - - /* - * This code checks whether an attribute is one that we - * intentionally ignore. + /** + * This code checks whether an attribute is one that we intentionally ignore. * - * @param attribute The attribute to check. + * @param attribute The attribute to check. * - * @return true if <code>attribute</code> can be ignored, - * otherwise false. + * @return {@code true} if {@code attribute} can be ignored, otherwise + * {@code false}. */ private boolean isIgnored(String attribute) { for (String ignored1 : ignored) { @@ -629,5 +588,4 @@ public class TextStyle extends Style implements Cloneable { } return false; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings.java index fd47549359a1..2b1a48f7d657 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings.java @@ -34,27 +34,29 @@ import org.w3c.dom.NodeList; */ public class BookSettings implements OfficeConstants { - /** A w3c <code>Document</code>. */ + /** A w3c {@code Document}. */ private org.w3c.dom.Document settings = null; - private boolean hasColumnRowHeaders = true; - private String activeSheet = ""; - private ArrayList<SheetSettings> worksheetSettings = new ArrayList<SheetSettings>(); + private boolean hasColumnRowHeaders = true; + private String activeSheet = ""; + private ArrayList<SheetSettings> worksheetSettings + = new ArrayList<SheetSettings>(); /** - * Constructor for a <code>BookSettings</code>. Reads document settings - * from xml and inits SheetSettings variables. + * Constructor for a {@code BookSettings}. * - * @param root The root XML node to read from. + * <p>Reads document settings from xml and inits SheetSettings variables.</p> + * + * @param root The root XML node to read from. */ public BookSettings(Node root) { readNode(root); } /** - * Constructor for a <code>BookSettings</code> + * Constructor for a {@code BookSettings}. * - * @param worksheetSettings If it's a row the height, a column the width + * @param worksheetSettings If it's a row the height, a column the width */ public BookSettings(ArrayList<SheetSettings> worksheetSettings) { this.worksheetSettings = worksheetSettings; @@ -63,52 +65,49 @@ public class BookSettings implements OfficeConstants { /** * Set the flag indicating whether we have row/column headers. * - * @param hasColumnRowHeaders Flag to enable or disable headers. + * @param hasColumnRowHeaders Flag to enable or disable headers. */ public void setColumnRowHeaders(boolean hasColumnRowHeaders) { this.hasColumnRowHeaders = hasColumnRowHeaders; } - - /** - * Gets the <code>Vector</code> of <code>SheetSettings</code> + * Gets the {@code Vector} of {@code SheetSettings}. * - * @return <code>Vector</code> of <code>SheetSettings</code> + * @return {@code Vector} of {@code SheetSettings} */ public ArrayList<SheetSettings> getSheetSettings() { return worksheetSettings; } /** - * Gets the active sheet name + * Gets the active sheet name. * * @return the active sheet name */ public String getActiveSheet() { - return activeSheet; } /** - * Sets the active sheet name + * Sets the active sheet name. * - * @param activeSheet the active sheet name + * @param activeSheet the active sheet name. */ public void setActiveSheet(String activeSheet) { - this.activeSheet = activeSheet; } /** - * Adds an XML entry for a particular setting + * Adds an XML entry for a particular setting. * - * @param root the root node at which to add the xml entry - * @param attribute the name of the attribute to add - * @param type the attribute type (int, short etc) - * @param value the value of the attribute + * @param root the root node at which to add the xml entry. + * @param attribute the name of the attribute to add. + * @param type the attribute type ({@code int}, {@code short} etc). + * @param value the value of the attribute. */ - private void addConfigItem(Node root, String attribute, String type, String value) { + private void addConfigItem(Node root, String attribute, String type, + String value) { Element configItem = settings.createElement(TAG_CONFIG_ITEM); configItem.setAttribute(ATTRIBUTE_CONFIG_NAME, attribute); @@ -120,10 +119,10 @@ public class BookSettings implements OfficeConstants { } /** - * Writes out a settings.xml entry for this BookSettings object + * Writes out a settings.xml entry for this {@code BookSettings} object. * - * @param settings a <code>Document</code> object representing the settings.xml - * @param root the root xml node to add to + * @param settings a {@code Document} object representing the settings.xml + * @param root the root xml node to add to. */ public void writeNode(org.w3c.dom.Document settings, Node root) { @@ -140,13 +139,12 @@ public class BookSettings implements OfficeConstants { } /** - * Sets a variable based on a String value read from XML + * Sets a variable based on a {@code String} value read from XML. * - * @param name xml name of the attribute to set - * @param value String value fo the attribute + * @param name xml name of the attribute to set. + * @param value {@code String} value for the attribute. */ private void addAttribute(String name, String value) { - if(name.equals("ActiveTable")) { activeSheet = value; } else if(name.equals("HasColumnRowHeaders")) { @@ -156,9 +154,9 @@ public class BookSettings implements OfficeConstants { } /** - * Reads document settings from xml and inits SheetSettings variables + * Reads document settings from xml and inits {@code SheetSettings} variables. * - * @param root XML Node to read from + * @param root XML {@code Node} to read from. */ private void readNode(Node root) { @@ -208,4 +206,4 @@ public class BookSettings implements OfficeConstants { } } } -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/CellStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/CellStyle.java index 434912c6159d..1e319f4d7da3 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/CellStyle.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/CellStyle.java @@ -30,20 +30,20 @@ import org.openoffice.xmerge.converter.xml.StyleCatalog; import org.openoffice.xmerge.util.Debug; /** - * Represents a text <code>Style</code> in an OpenOffice document. + * Represents a text {@code Style} in an OpenOffice document. */ public class CellStyle extends Style implements Cloneable { private Format fmt = new Format(); /** - * Constructor for use when going from DOM to client device format. + * Constructor for use when going from DOM to client device format. * - * @param node The <i>style:style</i> <code>Node</code> containing - * the <code>Style</code>. (This <code>Node</code> is - * assumed have a <i>family</i> attribute of <i>text</i>). - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param node The <i>style:style</i> {@code Node} containing the + * {@code Style}. (This {@code Node} is assumed have a + * <i>family</i> attribute of <i>text</i>). + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ public CellStyle(Node node, StyleCatalog sc) { super(node, sc); @@ -83,39 +83,39 @@ public class CellStyle extends Style implements Cloneable { } } - /** - * Constructor for use when going from client device format to DOM + * Constructor for use when going from client device format to DOM. * - * @param name Name of cell <code>Style</code>. Can be null. - * @param family Family of text <code>Style</code> (usually - * <i>text</i>). Can be null. - * @param parent Name of parent text <code>Style</code>, or null - * for none. - * @param fmt size in points. - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param name Name of cell {@code Style}. Can be {@code null}. + * @param family Family of text {@code Style} (usually <i>text</i>). Can + * be {@code null}. + * @param parent Name of parent text {@code Style}, or {@code null} for + * none. + * @param fmt size in points. + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ - public CellStyle(String name, String family, String parent,Format fmt, StyleCatalog sc) { + public CellStyle(String name, String family, String parent,Format fmt, + StyleCatalog sc) { super(name, family, parent, sc); this.fmt = fmt; } /** - * Returns the <code>Format</code> object for this particular style + * Returns the {@code Format} object for this particular style. * - * @return the <code>Format</code> object + * @return the {@code Format} object */ public Format getFormat() { return fmt; } /** - * Parse a color specification of the form <i>#rrggbb</i> + * Parse a color specification of the form <i>{@literal #rrggbb}</i>. * - * @param value <code>Color</code> specification to parse. + * @param value {@code Color} specification to parse. * - * @return The <code>Color</code> associated the value. + * @return The {@code Color} associated the value. */ private Color parseColorString(String value) { // Assume color value is of form #rrggbb @@ -135,12 +135,11 @@ public class CellStyle extends Style implements Cloneable { return new Color(red, green, blue, 0); } - /** - * Set an attribute. + * Set an attribute. * - * @param attr The attribute to set. - * @param value The attribute value to set. + * @param attr The attribute to set. + * @param value The attribute value to set. */ private void handleAttribute(String attr, String value) { @@ -252,16 +251,14 @@ public class CellStyle extends Style implements Cloneable { } } - /** - * Return a <code>Style</code> object corresponding to this one, - * but with all of the inherited information from parent - * <code>Style</code> objects filled in. The object returned will - * be a new object, not a reference to this object, even if it does - * not need any information added. + * Return a {@code Style} object corresponding to this one, but with all of + * the inherited information from parent {@code Style} objects filled in. * - * @return The <code>StyleCatalog</code> in which to look up - * ancestors. + * <p>The object returned will be a new object, not a reference to this + * object, even if it does not need any information added.</p> + * + * @return The {@code StyleCatalog} in which to look up ancestors. */ @Override public Style getResolved() { @@ -321,17 +318,15 @@ public class CellStyle extends Style implements Cloneable { return resolved; } - /** - * Create a new <code>Node</code> in the <code>Document</code>, and - * write this <code>Style</code> to it. + * Create a new {@code Node} in the {@code Document}, and write this + * {@code Style} to it. * - * @param parentDoc Parent <code>Document</code> of the - * <code>Node</code> to create. - * @param name Name to use for the new <code>Node</code> (e.g. - * <i>style:style</i>) + * @param parentDoc Parent {@code Document} of the {@code Node} to create. + * @param name Name to use for the new {@code Node} (e.g. + * <i>style:style</i>) * - * @return Created <code>Node</code>. + * @return Created {@code Node}. */ @Override public Node createNode(org.w3c.dom.Document parentDoc, String name) { @@ -340,16 +335,14 @@ public class CellStyle extends Style implements Cloneable { return node; } - /** - * Return true if <code>style</code> specifies as much or less - * than this <code>Style</code>, and nothing it specifies - * contradicts this <code>Style</code>. + * Return {@code true} if {@code style} specifies as much or less than this + * {@code Style}, and nothing it specifies contradicts this {@code Style}. * - * @param style The <code>Style</code> to check. + * @param style The {@code Style} to check. * - * @return true if <code>style</code> is a subset, false - * otherwise. + * @return {@code true} if {@code style} is a subset, {@code false} + * otherwise. */ @Override public boolean isSubset(Style style) { @@ -365,13 +358,11 @@ public class CellStyle extends Style implements Cloneable { return true; } - /** - * Write this <code>Style</code> object's attributes to a - * <code>Node</code> in the <code>Document</code>. + * Write this {@code Style} object's attributes to a {@code Node} in the + * {@code Document}. * - * @param node The <code>Node</code> to add <code>Style</code> - * attributes. + * @param node The {@code Node} to add {@code Style} attributes. */ private void writeAttributes(Element node) { @@ -442,14 +433,12 @@ public class CellStyle extends Style implements Cloneable { } - /** - * Given a <code>Color</code>, return a string of the form - * <i>#rrggbb</i>. + * Given a {@code Color}, return a string of the form <i>{@literal #rrggbb}</i>. * - * @param c The <code>Color</code> value. + * @param c The {@code Color} value. * - * @return The <code>Color</code> value in the form <i>#rrggbb</i>. + * @return The {@code Color} value in the form <i>{@literal #rrggbb}</i>. */ private String buildColorString(Color c) { int v[] = new int[3]; @@ -466,7 +455,6 @@ public class CellStyle extends Style implements Cloneable { return colorString; } - private static String[] ignored = { "style:text-autospace", "style:text-underline-color", "fo:margin-left", "fo:margin-right", "fo:text-indent", @@ -480,15 +468,13 @@ public class CellStyle extends Style implements Cloneable { "style:line-break", "fo:keep-with-next" }; - - /* - * This code checks whether an attribute is one that we - * intentionally ignore. + /** + * This code checks whether an attribute is one that we intentionally ignore. * - * @param attribute The attribute to check. + * @param attribute The attribute to check. * - * @return true if <code>attribute</code> can be ignored, - * otherwise false. + * @return {@code true} if {@code attribute} can be ignored, otherwise + * {@code false}. */ private boolean isIgnored(String attribute) { for (int i = 0; i < ignored.length; i++) { @@ -497,5 +483,4 @@ public class CellStyle extends Style implements Cloneable { } return false; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/ColumnRowInfo.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/ColumnRowInfo.java index 2577096ce038..d8e2caea05b4 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/ColumnRowInfo.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/ColumnRowInfo.java @@ -19,9 +19,10 @@ package org.openoffice.xmerge.converter.xml.sxc; /** - * This is a class to define a table-column structure. This can then be - * used by plugins to write or read their own column types. + * This is a class to define a table-column structure. * + * <p>This can then be used by plug-ins to write or read their own column types. + * </p> */ public class ColumnRowInfo { @@ -38,9 +39,9 @@ public class ColumnRowInfo { private Format fmt = new Format(); /** - * Constructor for a <code>ColumnRowInfo</code> + * Constructor for a {@code ColumnRowInfo}. * - * @param type whether ROW or COLUMN record . + * @param type whether {@code ROW} or {@code COLUMN} record. */ public ColumnRowInfo(int type) { @@ -48,11 +49,11 @@ public class ColumnRowInfo { } /** - * Constructor for a <code>ColumnRowInfo</code> + * Constructor for a {@code ColumnRowInfo}. * - * @param dimension if it's a row the height, a column the width. - * @param repeated how many times it is repeated. - * @param type whether ROW or COLUMN record. + * @param dimension if it's a row the height, a column the width. + * @param repeated how many times it is repeated. + * @param type whether {@code ROW} or {@code COLUMN} record. */ private ColumnRowInfo(int dimension, int repeated, int type) { @@ -62,13 +63,12 @@ public class ColumnRowInfo { } /** - * Constructor for a <code>ColumnRowInfo</code> that includes userDefined - * field. + * Constructor for a {@code ColumnRowInfo} that includes userDefined field. * - * @param dimension if it's a row the height, a column the width. - * @param repeated how many times it is repeated. - * @param type whether ROW or COLUMN record. - * @param userDefined whether the record is manually set. + * @param dimension if it's a row the height, a column the width. + * @param repeated how many times it is repeated. + * @param type whether {@code ROW} or {@code COLUMN} record. + * @param userDefined whether the record is manually set. */ public ColumnRowInfo(int dimension, int repeated, int type, boolean userDefined) { @@ -87,9 +87,9 @@ public class ColumnRowInfo { } /** - * Get the current format. + * Get the current {@code Format}. * - * @return The current format. + * @return The current {@code Format}. */ public Format getFormat() { @@ -137,9 +137,9 @@ public class ColumnRowInfo { } /** - * Does this <code>ColumnRowInfo</code> represent a row? + * Does this {@code ColumnRowInfo} represent a row? * - * @return True if a row, false if not. + * @return {@code true} if a row, {@code false} if not. */ public boolean isRow() { @@ -147,9 +147,9 @@ public class ColumnRowInfo { } /** - * Does this <code>ColumnRowInfo</code> represent a column? + * Does this {@code ColumnRowInfo} represent a column? * - * @return True if a column, false if not. + * @return {@code true} if a column, {@code false} if not. */ public boolean isColumn() { @@ -157,9 +157,9 @@ public class ColumnRowInfo { } /** - * Test if the row height as been set manually + * Test if the row height as been set manually. * - * @return true if user defined otherwise false + * @return {@code true} if user defined otherwise {@code false}. */ public boolean isUserDefined() { @@ -167,9 +167,9 @@ public class ColumnRowInfo { } /** - * Test if the row height is default + * Test if the row height is default. * - * @return true if default otherwise false + * @return {@code true} if default otherwise {@code false}. */ public boolean isDefaultSize() { diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/ColumnStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/ColumnStyle.java index 0adb79bd46c2..d2ce990d554b 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/ColumnStyle.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/ColumnStyle.java @@ -29,19 +29,19 @@ import org.openoffice.xmerge.util.Debug; import org.openoffice.xmerge.util.TwipsConverter; /** - * Represents a text <code>Style</code> in an OpenOffice document. + * Represents a text {@code Style} in an OpenOffice document. */ public class ColumnStyle extends Style implements Cloneable { private int colWidth = 0; /** - * Constructor for use when going from DOM to client device format. + * Constructor for use when going from DOM to client device format. * - * @param node The <i>style:style</i> <code>Node</code> containing - * the <code>Style</code>. (This <code>Node</code> is - * assumed have a <i>family</i> attribute of <i>text</i>). - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param node The <i>style:style</i> {@code Node} containing the + * {@code Style}. (This {@code Node} is assumed have a + * <i>family</i> attribute of <i>text</i>). + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ public ColumnStyle(Node node, StyleCatalog sc) { super(node, sc); @@ -82,16 +82,16 @@ public class ColumnStyle extends Style implements Cloneable { } /** - * Constructor for use when going from client device format to DOM + * Constructor for use when going from client device format to DOM. * - * @param name Name of text <code>Style</code>. Can be null. - * @param family Family of text <code>Style</code> (usually - * <i>text</i>). Can be null. - * @param parent Name of parent text <code>Style</code>, or null - * for none. - * @param colWidth the width of this column - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param name Name of text {@code Style}. Can be {@code null}. + * @param family Family of text {@code Style} (usually <i>text</i>). + * Can be {@code null}. + * @param parent Name of parent text {@code Style}, or {@code null} for + * none. + * @param colWidth the width of this column. + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ public ColumnStyle(String name, String family, String parent, int colWidth, StyleCatalog sc) { super(name, family, parent, sc); @@ -99,7 +99,7 @@ public class ColumnStyle extends Style implements Cloneable { } /** - * Returns the width of this column + * Returns the width of this column. * * @return The width of this column. */ @@ -108,7 +108,7 @@ public class ColumnStyle extends Style implements Cloneable { } /** - * Sets the width of this column + * Sets the width of this column. * * @param colWidth The width of this column. */ @@ -118,11 +118,11 @@ public class ColumnStyle extends Style implements Cloneable { } /** - * Parse a colwidth in the form "1.234cm" to twips + * Parse a colwidth in the form {@literal "1.234cm"} to twips. * - * @param value <code>String</code> specification to parse. + * @param value {@code String} specification to parse. * - * @return The twips equivalent. + * @return The twips equivalent. */ private int parseColWidth(String value) { @@ -140,10 +140,10 @@ public class ColumnStyle extends Style implements Cloneable { } /** - * Set an attribute. + * Set an attribute. * - * @param attr The attribute to set. - * @param value The attribute value to set. + * @param attr The attribute to set. + * @param value The attribute value to set. */ private void handleAttribute(String attr, String value) { @@ -156,14 +156,13 @@ public class ColumnStyle extends Style implements Cloneable { } /** - * Return a <code>Style</code> object corresponding to this one, - * but with all of the inherited information from parent - * <code>Style</code> objects filled in. The object returned will - * be a new object, not a reference to this object, even if it does - * not need any information added. + * Return a {@code Style} object corresponding to this one, but with all of + * the inherited information from parent {@code Style} objects filled in. * - * @return The <code>Style</code> in which to look up - * ancestors. + * <p>The object returned will be a new object, not a reference to this + * object, even if it does not need any information added.</p> + * + * @return The {@code Style} in which to look up ancestors. */ @Override public Style getResolved() { @@ -206,15 +205,14 @@ public class ColumnStyle extends Style implements Cloneable { } /** - * Create a new <code>Node</code> in the <code>Document</code>, and - * write this <code>Style</code> to it. + * Create a new {@code Node} in the <code>Document</code>, and write this + * {@code Style} to it. * - * @param parentDoc Parent <code>Document</code> of the - * <code>Node</code> to create. - * @param name Name to use for the new <code>Node</code> (e.g. - * <i>style:style</i>) + * @param parentDoc Parent {@code Document} of the {@code Node} to create. + * @param name Name to use for the new {@code Node} (e.g. + * <i>style:style</i>) * - * @return Created <code>Node</code>. + * @return Created {@code Node}. */ @Override public Node createNode(org.w3c.dom.Document parentDoc, String name) { @@ -224,14 +222,13 @@ public class ColumnStyle extends Style implements Cloneable { } /** - * Return true if <code>style</code> specifies as much or less - * than this <code>Style</code>, and nothing it specifies - * contradicts this <code>Style</code>. + * Return {@code true} if {@code style} specifies as much or less than this + * {@code Style}, and nothing it specifies contradicts this {@code Style}. * - * @param style The <code>Style</code> to check. + * @param style The {@code Style} to check. * - * @return true if <code>style</code> is a subset, false - * otherwise. + * @return {@code true} if <code>style</code> is a subset, {@code false} + * otherwise. */ @Override public boolean isSubset(Style style) { @@ -246,11 +243,10 @@ public class ColumnStyle extends Style implements Cloneable { } /** - * Write this <code>Style</code> object's attributes to a - * <code>Node</code> in the <code>Document</code>. + * Write this {@code Style} object's attributes to a {@code Node} in the + * {@code Document}. * - * @param node The <code>Node</code> to add <code>Style</code> - * attributes. + * @param node The {@code Node} to add {@code Style} attributes. */ private void writeAttributes(Element node) { @@ -259,5 +255,4 @@ public class ColumnStyle extends Style implements Cloneable { node.setAttribute("style:column-width", width); } } - -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/DocumentMergerImpl.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/DocumentMergerImpl.java index ef427c8bc35c..04eebc081663 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/DocumentMergerImpl.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/DocumentMergerImpl.java @@ -39,14 +39,12 @@ import org.openoffice.xmerge.merger.MergeAlgorithm; import org.openoffice.xmerge.util.XmlUtil; import org.openoffice.xmerge.util.Debug; - /** - * Generic small device implementation of <code>DocumentMerger</code> for - * the {@link - * org.openoffice.xmerge.converter.xml.sxc.SxcPluginFactory - * SxcPluginFactory}. + * Generic small device implementation of {@code DocumentMerger} for + * the {@link org.openoffice.xmerge.converter.xml.sxc.SxcPluginFactory + * SxcPluginFactory}. * - * <p>Used with SXC <code>Document</code> objects.</p> + * <p>Used with SXC {@code Document} objects.</p> */ public class DocumentMergerImpl implements DocumentMerger { @@ -54,13 +52,13 @@ public class DocumentMergerImpl implements DocumentMerger { private org.openoffice.xmerge.Document orig = null; /** - * Constructor + * Constructor. * - * @param doc The original "Office" <code>Document</code> - * to merge. - * @param cc The <code>ConverterCapabilities</code>. + * @param doc The original "Office" {@code Document} to merge. + * @param cc The {@code ConverterCapabilities}. */ - public DocumentMergerImpl(org.openoffice.xmerge.Document doc, ConverterCapabilities cc) { + public DocumentMergerImpl(org.openoffice.xmerge.Document doc, + ConverterCapabilities cc) { cc_ = cc; this.orig = doc; } @@ -121,8 +119,8 @@ public class DocumentMergerImpl implements DocumentMerger { numOfWorkSheet = workSheetList2.getLength(); - // for those workSheet from target don't have a matching one - // in the original workSheet list, we add it + // for those workSheet from target don't have a matching one in the + // original workSheet list, we add it // find out the office body node first NodeList officeBodyList = @@ -135,12 +133,9 @@ public class DocumentMergerImpl implements DocumentMerger { Node workSheet= workSheetList2.item(j); // try to match the workSheet - Node matchingWorkSheet = matchWorkSheet(workSheet, workSheetList1); - // add the new WorkSheet to the original document iff match not - // found - + // add the new WorkSheet to the original document iff match not found if (matchingWorkSheet == null) { Node cloneNode = XmlUtil.deepClone(officeBody, workSheet); officeBody.appendChild(cloneNode); @@ -149,13 +144,13 @@ public class DocumentMergerImpl implements DocumentMerger { } /** - * Try to find a WorkSheet from the modified WorkSheetList that - * has a matching table name from the original WorkSheet. + * Try to find a WorkSheet from the modified WorkSheetList that has a + * matching table name from the original WorkSheet. * - * @param orgSheet The original WorkSheet. - * @param modSheetList The modified WorkSheet. + * @param orgSheet The original WorkSheet. + * @param modSheetList The modified WorkSheet. * - * @return The Node in modSheetList that matches the orgSheet. + * @return The {@code Node} in modSheetList that matches the {@code orgSheet}. */ private Node matchWorkSheet(Node orgSheet, NodeList modSheetList) { @@ -185,5 +180,4 @@ public class DocumentMergerImpl implements DocumentMerger { return matchSheet; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java index 8be897c47e9e..f6d6cf22a000 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java @@ -21,34 +21,32 @@ package org.openoffice.xmerge.converter.xml.sxc; import java.awt.Color; /** - * This class specifies the format for a given spreadsheet cell. - * + * This class specifies the format for a given spreadsheet cell. */ public class Format implements Cloneable { - /** Horizontal Alignment Constants. */ + /** Horizontal Alignment Constants. */ final public static int RIGHT_ALIGN = 0x01; final public static int CENTER_ALIGN = 0x02; final public static int LEFT_ALIGN = 0x03; - - /** Vertical Alignment Constants. */ + /** Vertical Alignment Constants. */ final public static int TOP_ALIGN = 0x01; final public static int MIDDLE_ALIGN = 0x02; final public static int BOTTOM_ALIGN = 0x03; /** Indicates <i>bold</i> text. */ - final public static int BOLD = 0x01; + final public static int BOLD = 0x01; /** Indicates <i>italic</i> text. */ - final public static int ITALIC = 0x02; + final public static int ITALIC = 0x02; /** Indicates <i>underlined</i> text. */ - final public static int UNDERLINE = 0x04; + final public static int UNDERLINE = 0x04; /** Indicates <i>strike-through</i> in the text. */ - final public static int STRIKETHRU = 0x08; + final public static int STRIKETHRU = 0x08; /** Indicates <i>superscripted</i> text. */ - final public static int SUPERSCRIPT = 0x10; + final public static int SUPERSCRIPT = 0x10; /** Indicates <i>subscripted</i> text. */ - final public static int SUBSCRIPT = 0x20; + final public static int SUBSCRIPT = 0x20; final public static int LEFT_BORDER = 0x40; final public static int RIGHT_BORDER = 0x80; @@ -77,19 +75,19 @@ public class Format implements Cloneable { private int mask = 0; /** - * Constructor for creating a new <code>Format</code>. + * Constructor for creating a new {@code Format}. */ public Format() { clearFormatting(); } /** - * Constructor that creates a new <code>Format</code> object - * by setting all the format attributes. + * Constructor that creates a new {@code Format} object by setting all the + * format attributes. * - * @param attributes Attributes flags (alignment, bold, etc.) - * @param fontSize Size of the font in points. - * @param fontName Name of the font to use. + * @param attributes Attributes flags (alignment, bold, etc.) + * @param fontSize Size of the font in points. + * @param fontName Name of the font to use. */ public Format(int attributes, int fontSize, String fontName) { @@ -99,10 +97,10 @@ public class Format implements Cloneable { } /** - * Constructor for creating a new <code>Format</code> object - * based on an existing one. + * Constructor for creating a new {@code Format} object based on an existing + * one. * - * @param fmt <code>Format</code> to copy. + * @param fmt {@code Format} to copy. */ public Format(Format fmt) { category = fmt.getCategory(); @@ -122,7 +120,7 @@ public class Format implements Cloneable { } /** - * Reset this <code>Format</code> description. + * Reset this {@code Format} description. */ public void clearFormatting() { category = ""; @@ -140,10 +138,10 @@ public class Format implements Cloneable { } /** - * Set one or more text attributes. + * Set one or more text attributes. * - * @param flags Flag attributes to set. - * @param toggle True to set flags, false to clear them. + * @param flags Flag attributes to set. + * @param toggle {@code true} to set flags, {@code false} to clear them. */ public void setAttribute(int flags, boolean toggle) { mask |= flags; @@ -155,13 +153,13 @@ public class Format implements Cloneable { } /** - * Return true if the <code>attribute</code> is set to <i>on</i> + * Return {@code true} if the {@code attribute} is set to <i>on</i>. * - * @param attribute Attribute to check ({@link #BOLD}, - * {@link #ITALIC}, etc.) + * @param attribute Attribute to check ({@link #BOLD}, {@link #ITALIC}, + * etc.). * - * @return true if <code>attribute</code> is set to <i>on</i>, - * otherwise false. + * @return {@code true} if {@code attribute} is set to <i>on</i>, otherwise + * {@code false}. */ public boolean getAttribute(int attribute) { if ((mask & attribute) == 0) @@ -169,145 +167,144 @@ public class Format implements Cloneable { return (!((attributes & attribute) == 0)); } - - /** - * Set the formatting category of this object, ie number, date, - * currency.The <code>OfficeConstants</code> class contains string - * constants for the category types. + * Set the formatting category of this object, ie number, date, currency. + * + * <p>The <code>OfficeConstants</code> class contains string constants for + * the category types.</p> * - * @see org.openoffice.xmerge.converter.xml.OfficeConstants + * @see org.openoffice.xmerge.converter.xml.OfficeConstants * - * @param newCategory The name of the category to be set. + * @param newCategory The name of the category to be set. */ public void setCategory(String newCategory) { category = newCategory; } /** - * Return the formatting category of the object. + * Return the formatting category of the object. * - * @see org.openoffice.xmerge.converter.xml.OfficeConstants + * @see org.openoffice.xmerge.converter.xml.OfficeConstants * - * @return The formatting category of the object. + * @return The formatting category of the object. */ public String getCategory() { return category; } /** - * In the case of Formula returns the value of the formula. + * In the case of Formula returns the value of the formula. * - * @return The value of the formula + * @return The value of the formula. */ public String getValue() { return value; } - /** - * In the case of formula the contents are set as the formula string and - * the value of the formula is a formatting attribute. + /** + * In the case of formula the contents are set as the formula string and + * the value of the formula is a formatting attribute. * - * @param newValue the formuala value + * @param newValue the formula value. */ public void setValue(String newValue) { value = newValue; } /** - * Set the <code>Format</code> specifier for this category. + * Set the {@code Format} specifier for this category. * - * @param formatString The new <code>Format</code> specifier. + * @param formatString The new {@code Format} specifier. */ public void setFormatSpecifier(String formatString) { formatSpecifier = formatString; } /** - * Get the <code>Format</code> specifier for this category. + * Get the {@code Format} specifier for this category. * - * @return <code>Format</code> specifier for this category. + * @return {@code Format} specifier for this category. */ public String getFormatSpecifier() { return formatSpecifier; } /** - * Set the precision of the number to be displayed. + * Set the precision of the number to be displayed. * - * @param precision The number of decimal places to display. + * @param precision The number of decimal places to display. */ public void setDecimalPlaces(int precision) { decimalPlaces = precision; } /** - * Get the number of decimal places displayed. + * Get the number of decimal places displayed. * - * @return Number of decimal places. + * @return Number of decimal places. */ public int getDecimalPlaces() { return decimalPlaces; } /** - * Set the font used for this cell. + * Set the font used for this cell. * - * @param fontName The name of the font. + * @param fontName The name of the font. */ public void setFontName(String fontName) { this.fontName = fontName; } /** - * Get the font used for this cell. + * Get the font used for this cell. * - * @return The font name. + * @return The font name. */ public String getFontName() { return fontName; } /** - * Set the font size (in points) used for this cell. + * Set the font size (in points) used for this cell. * - * @param fontSize The font size in points. + * @param fontSize The font size in points. */ public void setFontSize(int fontSize) { sizeInPoints = fontSize; } /** - * Get the font size (in points) used for this cell. + * Get the font size (in points) used for this cell. * - * @return The font size in points. + * @return The font size in points. */ public int getFontSize() { return sizeInPoints; } - /** - * Set the vertical alignment used for this cell. + /** + * Set the vertical alignment used for this cell. * - * @param vertAlign The vertical alignment. + * @param vertAlign The vertical alignment. */ public void setVertAlign(int vertAlign) { this.vertAlign = vertAlign; } /** - * Get the vertical alignment used for this cell. + * Get the vertical alignment used for this cell. * - * @return The vertical alignment. + * @return The vertical alignment. */ public int getVertAlign() { return vertAlign; } - /** - * Set the alignment used for this cell. + /** + * Set the alignment used for this cell. * - * @param align The alignment to use. + * @param align The alignment to use. */ public void setAlign(int align) { this.align = align; @@ -323,10 +320,9 @@ public class Format implements Cloneable { } /** - * Set the Foreground <code>Color</code> for this cell. + * Set the Foreground {@code Color} for this cell. * - * @param c A <code>Color</code> object representing the - * foreground color. + * @param c A {@code Color} object representing the foreground color. */ public void setForeground(Color c) { if(c!=null) @@ -334,19 +330,18 @@ public class Format implements Cloneable { } /** - * Get the Foreground <code>Color</code> for this cell. + * Get the Foreground {@code Color} for this cell. * - * @return Foreground <code>Color</code> value. + * @return Foreground {@code Color} value. */ public Color getForeground() { return foreground; } /** - * Set the Background <code>Color</code> for this cell + * Set the Background {@code Color} for this cell. * - * @param c A <code>Color</code> object representing - * the background color. + * @param c A {@code Color} object representing the background color. */ public void setBackground(Color c) { if(c!=null) @@ -354,18 +349,18 @@ public class Format implements Cloneable { } /** - * Get the Background <code>Color</code> for this cell + * Get the Background {@code Color} for this cell. * - * @return Background <code>Color</code> value + * @return Background {@code Color} value. */ public Color getBackground() { return background; } /** - * Get a string representation of this <code>Format</code> + * Get a {@code String} representation of this {@code Format}. * - * @return A string indicating the value and category. + * @return A {@code String} indicating the value and category. */ @Override public String toString() { @@ -373,10 +368,9 @@ public class Format implements Cloneable { } /** - * Tests if the current <code>Format</code> object has default attribute - * values. + * Tests if the current {@code Format} object has default attribute values. * - * @return true if it contains default value + * @return {@code true} if it contains default value. */ public boolean isDefault() { @@ -401,14 +395,12 @@ public class Format implements Cloneable { } /** - * Return true if passed <code>Format</code> specifies as much or less - * than this <code>Format</code>, and nothing it specifies - * contradicts this <code>Format</code>. + * Return true if passed {@code Format} specifies as much or less than this + * {@code Format}, and nothing it specifies contradicts this {@code Format}. * - * @param rhs The <code>Format</code> to check. + * @param rhs The {@code Format} to check. * - * @return true if <code>rhs</code> is a subset, false - * otherwise. + * @return {@code true} if {@code rhs} is a subset, {@code false} otherwise. */ public boolean isSubset(Format rhs) { if (rhs.getClass() != this.getClass()) @@ -439,4 +431,4 @@ public class Format implements Cloneable { return true; } -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/NameDefinition.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/NameDefinition.java index 7589143cc57f..051236d4fe4d 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/NameDefinition.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/NameDefinition.java @@ -27,43 +27,42 @@ import org.openoffice.xmerge.util.Debug; import org.openoffice.xmerge.util.XmlUtil; /** - * This is a class to define a Name Definition structure. This can then be - * used by plugins to write or read their own definition types. + * This is a class to define a Name Definition structure. + * + * <p>This can then be used by plug-ins to write or read their own definition + * types.</p> */ public class NameDefinition implements OfficeConstants { - private String name; // name which identifies the definition - private String definition; // the definition itself - private String baseCellAddress; // the basecelladdress - private boolean rangeType = false; // true if definition of type range - private boolean expressionType = false; // true if definition of type expression + private String name; // name which identifies the definition + private String definition; // the definition itself + private String baseCellAddress; // the basecelladdress + private boolean rangeType = false; // true if definition of type range + private boolean expressionType = false; // true if definition of type expression /** - * Default Constructor for a <code>NameDefinition</code> - * + * Default Constructor for a {@code NameDefinition}. */ public NameDefinition() { - } /** - * Constructor that takes a <code>Node</code> to build a - * <code>NameDefinition</code> + * Constructor that takes a {@code Node} to build a {@code NameDefinition}. * - * @param root XML Node to read from + * @param root XML {@code Node} to read from. */ public NameDefinition(Node root) { readNode(root); } /** - * Constructor for a <code>NameDefinition</code> + * Constructor for a {@code NameDefinition}. * - * @param name Name that identifies the definition - * @param definition The definition itself - * @param baseCellAddress The base cell address - * @param rangeType True if definition of range type - * @param expressionType True if definition of expression type + * @param name Name that identifies the definition. + * @param definition The definition itself. + * @param baseCellAddress The base cell address. + * @param rangeType {@code true} if definition of range type. + * @param expressionType {@code true} if definition of expression type. */ public NameDefinition(String name, String definition, String baseCellAddress, boolean rangeType, boolean expressionType ) { @@ -75,66 +74,64 @@ public class NameDefinition implements OfficeConstants { } /** - * returns Name of the definition + * Returns Name of the definition. * - * @return the name which identifies the definition + * @return the name which identifies the definition. */ public String getName() { - return name; } + /** - * sets the definition + * Sets the definition. * - * @param newDefinition sets the definition + * @param newDefinition sets the definition. */ public void setDefinition(String newDefinition) { - definition = newDefinition; } + /** - * Returns the definition itself + * Returns the definition itself. * - * @return the definition + * @return the definition. */ public String getDefinition() { - return definition; } /** - * Returns the base Cell address + * Returns the base Cell address. * - * @return the base cell address + * @return the base cell address. */ public String getBaseCellAddress() { - return baseCellAddress; } /** - * Tests if definition is of type expression + * Tests if definition is of type expression. * - * @return whether or not this name definition is of type expression + * @return whether or not this name definition is of type expression. */ public boolean isExpressionType() { return expressionType; } /** - * Tests if definition is of type range + * Tests if definition is of type range. * - * @return whether or not this name definition is of type range + * @return whether or not this name definition is of type range. */ public boolean isRangeType() { return rangeType; } /** - * Writes out a content.xml entry for this NameDefinition object + * Writes out a content.xml entry for this NameDefinition object. * - * @param doc A <code>Document</code> object representing the settings.xml - * @param root The root xml node to add to + * @param doc A {@code Document} object representing the settings.xml + * @param root The root xml {@code Node} to add to. */ public void writeNode(org.w3c.dom.Document doc, Node root) { @@ -161,9 +158,9 @@ public class NameDefinition implements OfficeConstants { } /** - * Reads document settings from xml and inits Settings variables + * Reads document settings from xml and inits Settings variables. * - * @param root XML Node to read from + * @param root XML {@code Node} to read from. */ private void readNode(Node root) { @@ -205,5 +202,4 @@ public class NameDefinition implements OfficeConstants { Debug.log(Debug.TRACE, "<OTHERS " + XmlUtil.getNodeInfo(root) + " />"); } } - -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/RowStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/RowStyle.java index bae24b5a8d4c..343a4df96cfd 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/RowStyle.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/RowStyle.java @@ -29,19 +29,19 @@ import org.openoffice.xmerge.util.Debug; import org.openoffice.xmerge.util.TwipsConverter; /** - * Represents a text <code>Style</code> in an OpenOffice document. + * Represents a text {@code Style} in an OpenOffice document. */ public class RowStyle extends Style implements Cloneable { private int rowHeight = 255; /** - * Constructor for use when going from DOM to client device format. + * Constructor for use when going from DOM to client device format. * - * @param node The <i>style:style</i> <code>Node</code> containing - * the <code>Style</code>. (This <code>Node</code> is - * assumed have a <i>family</i> attribute of <i>text</i>). - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param node The <i>style:style</i> {@code Node} containing the + * {@code Style}. (This {@code Node} is assumed have a + * <i>family</i> attribute of <i>text</i>). + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ public RowStyle(Node node, StyleCatalog sc) { super(node, sc); @@ -82,16 +82,16 @@ public class RowStyle extends Style implements Cloneable { } /** - * Constructor for use when going from client device format to DOM + * Constructor for use when going from client device format to DOM. * - * @param name Name of text <code>Style</code>. Can be null. - * @param family Family of text <code>Style</code> (usually - * <i>text</i>). Can be null. - * @param parent Name of parent text <code>Style</code>, or null - * for none. - * @param rowHeight The height of this row - * @param sc The <code>StyleCatalog</code>, which is used for - * looking up ancestor <code>Style</code> objects. + * @param name Name of text {@code Style}. Can be {@code null}. + * @param family Family of text {@code Style} (usually <i>text</i>). + * Can be {@code null}. + * @param parent Name of parent text {@code Style}, or {@code null} + * for none. + * @param rowHeight The height of this row. + * @param sc The {@code StyleCatalog}, which is used for looking up + * ancestor {@code Style} objects. */ public RowStyle(String name, String family, String parent,int rowHeight, StyleCatalog sc) { super(name, family, parent, sc); @@ -99,7 +99,7 @@ public class RowStyle extends Style implements Cloneable { } /** - * Returns the height of this row + * Returns the height of this row. * * @return The height of this row. */ @@ -108,20 +108,20 @@ public class RowStyle extends Style implements Cloneable { } /** - * Sets the height of this row + * Sets the height of this row. * - * @param RowHeight The height of this row. + * @param RowHeight The height of this row. */ public void setRowHeight(int RowHeight) { this.rowHeight = RowHeight; } /** - * Parse a rowheight in the form "1.234cm" to twips + * Parse a rowheight in the form {@literal "1.234cm"} to twips. * - * @param value <code>String</code> specification to parse. + * @param value {@code String} specification to parse. * - * @return The twips equivalent. + * @return The twips equivalent. */ private int parseRowHeight(String value) { @@ -140,10 +140,10 @@ public class RowStyle extends Style implements Cloneable { } /** - * Set an attribute. + * Set an attribute. * - * @param attr The attribute to set. - * @param value The attribute value to set. + * @param attr The attribute to set. + * @param value The attribute value to set. */ private void handleAttribute(String attr, String value) { @@ -156,14 +156,13 @@ public class RowStyle extends Style implements Cloneable { } /** - * Return a <code>Style</code> object corresponding to this one, - * but with all of the inherited information from parent - * <code>Style</code> objects filled in. The object returned will - * be a new object, not a reference to this object, even if it does - * not need any information added. + * Return a {@code Style} object corresponding to this one, but with all of + * the inherited information from parent {@code Style} objects filled in. * - * @return The <code>StyleCatalog</code> in which to look up - * ancestors. + * <p>The object returned will be a new object, not a reference to this + * object, even if it does not need any information added.</p> + * + * @return The {@code StyleCatalog} in which to look up ancestors. */ @Override public Style getResolved() { @@ -206,15 +205,14 @@ public class RowStyle extends Style implements Cloneable { } /** - * Create a new <code>Node</code> in the <code>Document</code>, and - * write this <code>Style</code> to it. + * Create a new {@code Node} in the {@code Document}, and write this + * {@code Style} to it. * - * @param parentDoc Parent <code>Document</code> of the - * <code>Node</code> to create. - * @param name Name to use for the new <code>Node</code> (e.g. - * <i>style:style</i>) + * @param parentDoc Parent {@code Document} of the {@code Node} to create. + * @param name Name to use for the new {@code Node} (e.g. + * <i>style:style</i>) * - * @return Created <code>Node</code>. + * @return Created {@code Node}. */ @Override public Node createNode(org.w3c.dom.Document parentDoc, String name) { @@ -224,14 +222,13 @@ public class RowStyle extends Style implements Cloneable { } /** - * Return true if <code>style</code> specifies as much or less - * than this <code>Style</code>, and nothing it specifies - * contradicts this <code>Style</code>. + * Return true if {@code style} specifies as much or less than this + * {@code Style}, and nothing it specifies contradicts this {@code Style}. * - * @param style The <code>Style</code> to check. + * @param style The {@code Style} to check. * - * @return true if <code>style</code> is a subset, false - * otherwise. + * @return {@code true} if {@code style} is a subset, {@code false} + * otherwise. */ @Override public boolean isSubset(Style style) { @@ -246,11 +243,10 @@ public class RowStyle extends Style implements Cloneable { } /** - * Write this <code>Style</code> object's attributes to a - * <code>Node</code> in the <code>Document</code>. + * Write this {@code Style} object's attributes to a {@code Node} in the + * {@code Document}. * - * @param node The <code>Node</code> to add <code>Style</code> - * attributes. + * @param node The {@code Node} to add {@code Style} attributes. */ private void writeAttributes(Element node) { @@ -259,5 +255,4 @@ public class RowStyle extends Style implements Cloneable { node.setAttribute("style:row-height", height); } } - -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SheetSettings.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SheetSettings.java index be2b5ccc3db5..d3ce082bc925 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SheetSettings.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SheetSettings.java @@ -32,7 +32,7 @@ import org.openoffice.xmerge.converter.xml.OfficeConstants; */ public class SheetSettings implements OfficeConstants { - /** A w3c <code>Document</code>. */ + /** A w3c {@code Document}. */ private org.w3c.dom.Document settings = null; private String sheetName; @@ -46,63 +46,58 @@ public class SheetSettings implements OfficeConstants { private int posTop = 0; private int paneNumber = 2; - final private static int SPLIT = 0x01; final private static int FREEZE = 0x02; /** - * Default Constructor for a <code>SheetSettings</code> - * + * Default Constructor for a {@code SheetSettings}. */ public SheetSettings() { } /** - * Constructor that takes a <code>Node</code> to build a <code>SheetSettings</code> + * Constructor that takes a {@code Node} to build a {@code SheetSettings}. * - * @param root XML Node to read from + * @param root XML {@code Node} to read from. */ public SheetSettings(Node root) { readNode(root); } /** - * Constructor for a <code>SheetSettings</code> + * Constructor for a {@code SheetSettings}. * - * @param name The name for the new sheet + * @param name The name for the new sheet. */ public SheetSettings(String name) { sheetName = name; } /** - * sets the position of the acitve cell + * Sets the position of the active cell. * - * @param activeCell the current curor position + * @param activeCell the current cursor position. */ public void setCursor(Point activeCell) { - cursorX = (int) activeCell.getX(); cursorY = (int) activeCell.getY(); } /** - * Gets the position of the acitve cell + * Gets the position of the active cell. * - * @return The position as a <code>Point</code> + * @return The position as a {@code Point}. */ public Point getCursor() { - return (new Point(cursorX, cursorY)); } /** - * Sets the position of the freeze + * Sets the position of the freeze. * - * @param splitPoint the point at where the split occurs + * @param splitPoint the point at where the split occurs. */ public void setFreeze(Point splitPoint) { - splitTypeX = FREEZE; splitTypeY = FREEZE; splitPointX = (int) splitPoint.getX(); @@ -110,9 +105,9 @@ public class SheetSettings implements OfficeConstants { } /** - * Sets the position of the split + * Sets the position of the split. * - * @param splitPoint the point at where the split occurs + * @param splitPoint the point at where the split occurs. */ public void setSplit(Point splitPoint) { @@ -123,9 +118,9 @@ public class SheetSettings implements OfficeConstants { } /** - * gets the position of the split + * Gets the position of the split. * - * @return The position as a <code>Point</code> where the split occurs + * @return The position as a {@code Point} where the split occurs. */ public Point getSplit() { @@ -133,88 +128,94 @@ public class SheetSettings implements OfficeConstants { } /** - * gets the type of the split + * Gets the type of the split. * - * @return The split type as a <code>Point</code> + * @return The split type as a {@code Point}. */ public Point getSplitType() { return (new Point(splitTypeX, splitTypeY)); } - - /** - * Gets the leftmost column visibile in the right pane. + * Gets the leftmost column visible in the right pane. * - * @return the 0-based index to the column + * @return the 0-based index to the column. */ public int getLeft() { - return posLeft; } + /** * Gets the top row visible in the lower pane. * - * @return The top row visible in the lower pane + * @return The top row visible in the lower pane. */ public int getTop() { - return posTop; } /** - * Gets the active Panel - * 0 - Bottom Right, 1 - Top Right - * 2 - Bottom Left, 3 - Top Left + * Gets the active Panel. + * + * <blockquote><table summary="Table with all values for an active panel" + * border="1" cellpadding="3" cellspacing="0"> + * <tr><th>Value</th><th>Meaning</th></tr> + * <tr><td align="center">0</td><td>Bottom Right</td></tr> + * <tr><td align="center">1</td><td>Top Right</td></tr> + * <tr><td align="center">2</td><td>Bottom Left</td></tr> + * <tr><td align="center">3</td><td>Top Left</td></tr> + * </table></blockquote> * - * @return int representing the active panel + * @return {@code int} representing the active panel. */ public int getPaneNumber() { - return paneNumber; } /** - * Sets the sheetname this settings object applies to + * Sets the {@code sheetName} this settings object applies to. * - * @param sheetName the name of the worksheet + * @param sheetName the name of the worksheet. */ public void setSheetName(String sheetName) { - this.sheetName = sheetName; - } /** - * Sets the active pane number - * 0 - Bottom Right, 1 - Top Right - * 2 - Bottom Left, 3 - Top Left + * Sets the active pane number. + * + * <blockquote><table summary="Table with all values for an active panel" + * border="1" cellpadding="3" cellspacing="0"> + * <tr><th>Value</th><th>Meaning</th></tr> + * <tr><td align="center">0</td><td>Bottom Right</td></tr> + * <tr><td align="center">1</td><td>Top Right</td></tr> + * <tr><td align="center">2</td><td>Bottom Left</td></tr> + * <tr><td align="center">3</td><td>Top Left</td></tr> + * </table></blockquote> * - * @param paneNumber the pane number + * @param paneNumber the pane number. */ public void setPaneNumber(int paneNumber) { - this.paneNumber = paneNumber; } /** - * Gets the name of the worksheet these <code>Settings</code> apply to + * Gets the name of the worksheet these {@code Settings} apply to. * - * @return the name of the worksheet + * @return the name of the worksheet. */ public String getSheetName() { - return sheetName; } /** - * Adds an XML entry for a particular setting + * Adds an XML entry for a particular setting. * - * @param root the root node at which to add the xml entry - * @param attribute the name of the attribute to add - * @param type the attribute type (int, short etc) - * @param value the value of the attribute + * @param root the root {@code Node} at which to add the xml entry. + * @param attribute the name of the attribute to add. + * @param type the attribute type ({@code int}, {@code short} etc). + * @param value the value of the attribute. */ private void addConfigItem(Node root, String attribute, String type, String value) { @@ -228,10 +229,10 @@ public class SheetSettings implements OfficeConstants { } /** - * Writes out a settings.xml entry for this SheetSettings object + * Writes out a settings.xml entry for this {@code SheetSettings} object. * - * @param settings a <code>Document</code> object representing the settings.xml - * @param root the root xml node to add to + * @param settings a {@code Document} object representing the settings.xml + * @param root the root xml node to add to. */ public void writeNode(org.w3c.dom.Document settings, Node root) { @@ -265,10 +266,10 @@ public class SheetSettings implements OfficeConstants { } /** - * Sets a variable based on a String value read from XML + * Sets a variable based on a {@code String} value read from XML. * - * @param name xml name of the attribute to set - * @param value String value fo the attribute + * @param name xml name of the attribute to set. + * @param value {@code String} value for the attribute. */ private void addAttribute(String name, String value) { @@ -297,9 +298,9 @@ public class SheetSettings implements OfficeConstants { } /** - * Reads document settings from xml and inits SheetSettings variables + * Reads document settings from xml and inits {@code SheetSettings} variables. * - * @param root XML Node to read from + * @param root XML {@code Node} to read from. */ private void readNode(Node root) { @@ -342,4 +343,4 @@ public class SheetSettings implements OfficeConstants { } } } -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetDecoder.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetDecoder.java index d49f5a6b4fa3..4ad1080daa02 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetDecoder.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetDecoder.java @@ -24,140 +24,129 @@ import java.util.Iterator; import org.openoffice.xmerge.ConvertData; /** - * This class is a abstract class for encoding a "Device" - * <code>Document</code> format into an alternative spreadsheet format. - * + * This {@code class} is a {@code abstract class} for encoding a "Device" + * {@code Document} format into an alternative spreadsheet format. */ public abstract class SpreadsheetDecoder { /** - * Returns the total number of sheets in the WorkBook. + * Returns the total number of sheets in the WorkBook. * - * @return The number of sheets in the WorkBook. + * @return The number of sheets in the WorkBook. */ public abstract int getNumberOfSheets(); /** - * Returns an Enumeration to a Vector of <code>NameDefinition</code>. + * Returns an Enumeration to a Vector of {@code NameDefinition}. * - * @return The Enumeration + * @return The Enumeration. */ public abstract Iterator<NameDefinition> getNameDefinitions(); /** - * Returns an <code>BookSettings</code> + * Returns the {@code BookSettings}. * - * @return The Enumeration + * @return The Enumeration. */ public abstract BookSettings getSettings(); - /** - * Returns an Enumeration to a Vector of <code>ColumnRowInfo</code>. + /** + * Returns an Enumeration to a Vector of {@code ColumnRowInfo}. * - * @return The Enumeration + * @return The Enumeration. */ public abstract Iterator<ColumnRowInfo> getColumnRowInfos(); /** - * Returns the number of populated rows in the current WorkSheet. + * Returns the number of populated rows in the current WorkSheet. * - * @return the number of populated rows in the current WorkSheet. + * @return the number of populated rows in the current WorkSheet. */ public abstract int getNumberOfRows(); - /** - * Returns the number of populated columns in the current WorkSheet. + * Returns the number of populated columns in the current WorkSheet. * - * @return The number of populated columns in the current WorkSheet. + * @return The number of populated columns in the current WorkSheet. */ public abstract int getNumberOfColumns(); - /** - * Returns the name of the current WorkSheet. + * Returns the name of the current WorkSheet. * - * @return Name of the current WorkSheet. + * @return Name of the current WorkSheet. */ public abstract String getSheetName(); - /** - * Returns the number of the active column. + * Returns the number of the active column. * - * @return The number of the active column. + * @return The number of the active column. */ public abstract int getColNumber(); - /** - * Returns the number of the active row. + * Returns the number of the active row. * - * @return The number of the active row. + * @return The number of the active row. */ public abstract int getRowNumber(); - /** - * Sets the active WorkSheet. + * Sets the active WorkSheet. * - * @param sheetIndex The index of the sheet to be made active. + * @param sheetIndex The index of the sheet to be made active. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public abstract void setWorksheet(int sheetIndex) throws IOException; - /** - * Move on the next populated cell in the current WorkSheet. + * Move on the next populated cell in the current WorkSheet. * - * @return true if successful, false otherwise. + * @return {@code true} if successful, {@code false} otherwise. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public abstract boolean goToNextCell() throws IOException; - /** - * Return the contents of the active cell. + * Return the contents of the active cell. * - * @return The cell contents. + * @return The cell contents. */ public abstract String getCellContents(); /** - * Return the value of the active cell. Used in the case of Formula where - * the cell contents and the cell value are not the same thing. + * Return the value of the active cell. + * + * <p>Used in the case of Formula where the cell contents and the cell + * value are not the same thing.</p> * * @return The cell value. */ public abstract String getCellValue(); /** - * Return the data type of the active cell. + * Return the data type of the active cell. * - * @return The cell data type. + * @return The cell data type. */ public abstract String getCellDataType(); - /** - * Return a <code>Format</code> object describing the active cells - * formatting. + * Return a {@code Format} object describing the active cells formatting. * - * @return <code>Format</code> object for the cell. + * @return {@code Format} object for the cell. */ public abstract Format getCellFormat(); - /** - * Add the contents of a <code>ConvertData</code> to the workbook. + * Add the contents of a {@code ConvertData} to the workbook. * - * @param cd The <code>ConvertData</code> containing the - * content. + * @param cd The {@code ConvertData} containing the content. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public abstract void addDeviceContent(ConvertData cd) throws IOException; -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetEncoder.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetEncoder.java index 3b79122f32f6..e87748773fc6 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetEncoder.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetEncoder.java @@ -22,72 +22,60 @@ import java.io.IOException; import java.util.ArrayList; /** - * <p>This class is a abstract class for encoding an SXC into an - * alternative spreadsheet format.</p> + * This {@code class} is an {@code abstract class} for encoding an SXC into an + * alternative spreadsheet format. * - * <p>TODO - Add appropriate exceptions to each of the methods.</p> + * <p>ToDo - Add appropriate exceptions to each of the methods.</p> * */ public abstract class SpreadsheetEncoder { - /** - * Create a new WorkSheet within the WorkBook. + * Create a new WorkSheet within the WorkBook. * - * @param sheetName The name of the WorkSheet. + * @param sheetName The name of the WorkSheet. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public abstract void createWorksheet(String sheetName) throws IOException; - - - - /** - * Add a cell to the current WorkSheet. + * Add a cell to the current WorkSheet. * - * @param row The row number of the cell - * @param column The column number of the cell - * @param fmt The <code>Format</code> object describing the - * appearance of this cell. - * @param cellContents The text or formula of the cell's contents. + * @param row The row number of the cell + * @param column The column number of the cell + * @param fmt The {@code Format} object describing the appearance + * of this cell. + * @param cellContents The text or formula of the cell's contents. */ - public abstract void addCell(int row, int column, - Format fmt, String cellContents) throws IOException; - + public abstract void addCell(int row, int column, Format fmt, + String cellContents) throws IOException; /** - * Get the number of sheets in the WorkBook. + * Get the number of sheets in the WorkBook. * - * @return The number of sheets in the WorkBook. + * @return The number of sheets in the WorkBook. */ public abstract int getNumberOfSheets(); - - - - /** - * Set the width of the columns in the WorkBook. + * Set the width of the columns in the WorkBook. * - * @param columnRows An <code>IntArrayList</code> of column - * widths. + * @param columnRows An {@code IntArrayList} of column widths. */ public abstract void setColumnRows(ArrayList<ColumnRowInfo> columnRows) throws IOException; /** - * Set the name definition of this spreadsheet + * Set the name definition of this spreadsheet. * - * @param nd The <code>NameDefinition</code> to use. + * @param nd The {@code NameDefinition} to use. */ public abstract void setNameDefinition(NameDefinition nd) throws IOException; /** - * Adds settings to the WorkBook. + * Adds settings to the WorkBook. * - * @param s The <code>BookSettings</code> to add. + * @param s The {@code BookSettings} to add. */ public abstract void addSettings(BookSettings s) throws IOException; -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcConstants.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcConstants.java index dbf26291296d..00a59d5d2a07 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcConstants.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcConstants.java @@ -18,10 +18,8 @@ package org.openoffice.xmerge.converter.xml.sxc; - /** * Interface defining constants for Sxc attributes. - * */ public interface SxcConstants { @@ -36,4 +34,4 @@ public interface SxcConstants { /** Name of the default style. */ String DEFAULT_STYLE = "Default"; -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocument.java index fe977d8fa482..91a6ec3492bb 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocument.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocument.java @@ -22,30 +22,26 @@ import org.openoffice.xmerge.converter.xml.OfficeDocument; import org.openoffice.xmerge.converter.xml.OfficeConstants; /** - * This class is an implementation of <code>OfficeDocument</code> for - * the SXC format. + * This class is an implementation of {@code OfficeDocument} for the SXC format. */ public class SxcDocument extends OfficeDocument { /** - * Constructor with arguments to set <code>name</code>. + * Constructor with arguments to set {@code name}. * - * @param name The name of the <code>Document</code> + * @param name The name of the {@code Document}. */ public SxcDocument(String name) { super(name); } - /** - * Constructor with arguments to set <code>name</code>, the - * <code>namespaceAware</code> flag, and the <code>validating</code> - * flag. + * Constructor with arguments to set {@code name}, the {@code namespaceAware} + * flag, and the {@code validating} flag. * - * @param name The name of the <code>Document</code>. - * @param namespaceAware The value of the <code>namespaceAware</code> - * flag. - * @param validating The value of the <code>validating</code> flag. + * @param name The name of the {@code Document}. + * @param namespaceAware The value of the {@code namespaceAware} flag. + * @param validating The value of the {@code validating} flag. */ public SxcDocument(String name, boolean namespaceAware, boolean validating) { @@ -53,9 +49,9 @@ public class SxcDocument extends OfficeDocument { } /** - * Returns the Office file extension for the SXC format. + * Returns the Office file extension for the SXC format. * - * @return The Office file extension for the SXC format. + * @return The Office file extension for the SXC format. */ @Override protected String getFileExtension() { @@ -63,9 +59,9 @@ public class SxcDocument extends OfficeDocument { } /** - * Returns the Office attribute for the SXC format. + * Returns the Office attribute for the SXC format. * - * @return The Office attribute for the SXC format. + * @return The Office attribute for the SXC format. */ @Override protected String getOfficeClassAttribute() { @@ -81,6 +77,4 @@ public class SxcDocument extends OfficeDocument { protected final String getDocumentMimeType() { return OfficeConstants.SXC_MIME_TYPE; } - -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentDeserializer.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentDeserializer.java index 55f9c3917a23..0675e5805102 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentDeserializer.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentDeserializer.java @@ -34,36 +34,34 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** - * <p>General spreadsheet implementation of <code>DocumentDeserializer</code> - * for the {@link - * org.openoffice.xmerge.converter.xml.sxc.SxcPluginFactory - * SxcPluginFactory}. Used with SXC <code>Document</code> objects.</p> + * General spreadsheet implementation of {@code DocumentDeserializer} for the + * {@link org.openoffice.xmerge.converter.xml.sxc.SxcPluginFactory + * SxcPluginFactory}. * - * <p>The <code>deserialize</code> method uses a <code>DocDecoder</code> - * to read the device spreadsheet format into a <code>String</code> - * object, then it calls <code>buildDocument</code> to create a - * <code>SxcDocument</code> object from it.</p> + * <p>Used with SXC {@code Document} objects.</p> * + * <p>The {@code deserialize} method uses a {@code DocDecoder} to read the device + * spreadsheet format into a {@code String} object, then it calls + * {@code buildDocument} to create a {@code SxcDocument} object from it.</p> */ public abstract class SxcDocumentDeserializer implements OfficeConstants, DocumentDeserializer { /** - * A <code>SpreadsheetDecoder</code> object for decoding from - * device formats. + * A {@code SpreadsheetDecoder} object for decoding from device formats. */ private SpreadsheetDecoder decoder = null; - /** A w3c <code>Document</code>. */ + /** A w3c {@code Document}. */ private org.w3c.dom.Document settings = null; - /** A w3c <code>Document</code>. */ + /** A w3c {@code Document}. */ private org.w3c.dom.Document doc = null; - /** An <code>ConvertData</code> object assigned to this object. */ + /** A {@code ConvertData} object assigned to this object. */ private ConvertData cd = null; - /** A style catalog for the workbook */ + /** A {@code StyleCatalog} for the workbook. */ private StyleCatalog styleCat = null; private int textStyles = 1; @@ -71,75 +69,67 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, private int rowStyles = 1; /** - * Constructor. + * Constructor. * - * @param cd <code>ConvertData</code> consisting of a - * device content object. + * @param cd {@code ConvertData} consisting of a device content object. */ public SxcDocumentDeserializer(ConvertData cd) { this.cd = cd; } - /** - * This abstract method will be implemented by concrete subclasses - * and will return an application-specific Decoder. + * This {@code abstract} method will be implemented by concrete subclasses + * and will return an application-specific Decoder. * - * @param workbook The WorkBook to read. - * @param password The WorkBook password. + * @param workbook The WorkBook to read. + * @param password The WorkBook password. * - * @return The appropriate <code>SpreadSheetDecoder</code>. + * @return The appropriate {@code SpreadSheetDecoder}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public abstract SpreadsheetDecoder createDecoder(String workbook, String[] worksheetNames, String password) throws IOException; - /** - * <p>This method will return the name of the WorkBook from the - * <code>ConvertData</code>. Allows for situations where the - * WorkBook name differs from the Device Content name.</p> + * This method will return the name of the WorkBook from the + * {@code ConvertData}. + * + * <p>Allows for situations where the WorkBook name differs from the Device + * Content name.</p> * - * <p>Implemented in the Deserializer as the Decoder's constructor requires - * a name.</p> + * <p>Implemented in the Deserializer as the Decoder's constructor requires + * a name.</p> * - * @param cd The <code>ConvertData</code> containing the Device - * content. + * @param cd The {@code ConvertData} containing the Device content. * - * @return The WorkBook name. + * @return The WorkBook name. */ protected abstract String getWorkbookName(ConvertData cd) throws IOException; - /** - * This method will return the name of the WorkSheet from the - * <code>ConvertData</code>. + * This method will return the name of the WorkSheet from the + * {@code ConvertData}. * - * @param cd The <code>ConvertData</code> containing the Device - * content. + * @param cd The {@code ConvertData} containing the Device content. * - * @return The WorkSheet names. + * @return The WorkSheet names. */ protected abstract String[] getWorksheetNames(ConvertData cd) throws IOException; - /** - * <p>Method to convert a set of "Device" - * <code>Document</code> objects into a <code>SxcDocument</code> - * object and returns it as a <code>Document</code>.</p> + * Method to convert a set of "Device" {@code Document} objects + * into a {@code SxcDocument} object and returns it as a {@code Document}. * - * <p>This method is not thread safe for performance reasons. - * This method should not be called from within two threads. - * It would be best to call this method only once per object - * instance.</p> + * <p>This method is not thread safe for performance reasons. This method + * should not be called from within two threads. It would be best to call + * this method only once per object instance.</p> * - * @return document An <code>SxcDocument</code> consisting - * of the data converted from the input - * stream. + * @return document A {@code SxcDocument} consisting of the data converted + * from the input stream. * - * @throws ConvertException If any conversion error occurs. - * @throws IOException If any I/O error occurs. + * @throws ConvertException If any conversion error occurs. + * @throws IOException If any I/O error occurs. */ public Document deserialize() throws ConvertException, IOException { @@ -163,7 +153,7 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, // be the name of the StarCalc file minus the file extension suffix. // Create a Decoder to decode the DeviceContent to a spreadsheet document - // TODO - we aren't using a password in StarCalc, so we can + // ToDo - we aren't using a password in StarCalc, so we can // use any value for password here. If StarCalc XML supports // passwords in the future, we should try to get the correct // password value here. @@ -182,14 +172,14 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, } /** - * This initializes a font table so we can include some basic font - * support for spreadsheets. - * + * This initializes a font table so we can include some basic font support + * for spreadsheets. */ private void initFontTable() { - String fontTable[]= new String[] { "Tahoma", "Tahoma", "swiss", "variable", - "Courier New", "'Courier New'", "modern", "fixed"}; + String fontTable[]= new String[] { "Tahoma", "Tahoma", "swiss", "variable", + "Courier New", "'Courier New'", + "modern", "fixed" }; // Traverse to the office:body element. // There should only be one. NodeList list = doc.getElementsByTagName(TAG_OFFICE_FONT_DECLS); @@ -211,10 +201,9 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, } /** - * Outer level method used to decode a WorkBook - * into a <code>Document</code>. + * Outer level method used to decode a WorkBook into a {@code Document}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ protected void decode() throws IOException { @@ -259,16 +248,12 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, } - - /** - * This method process the settings portion - * of the <code>Document</code>. + * This method process the settings portion of the {@code Document}. * - * @param root The root <code>Node</code> of the - * <code>Document</code> we are building. This - * <code>Node</code> should be a TAG_OFFICE_SETTINGS - * tag. + * @param root The root {@code Node} of the {@code Document} we are + * building. This {@code Node} should be a + * {@code TAG_OFFICE_SETTINGS} tag. */ protected void processSettings(Node root) { @@ -286,15 +271,14 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, } /** - * This method process a Name Definition Table and generates a portion - * of the <code>Document</code>. + * This method process a Name Definition Table and generates a portion of + * the {@code Document}. * - * @param root The root <code>Node</code> of the - * <code>Document</code> we are building. This - * <code>Node</code> should be a TAG_OFFICE_BODY - * tag. + * @param root The root {@code Node} of the {@code Document} we are + * building. This {@code Node} should be a + * {@code TAG_OFFICE_BODY} tag. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ protected void processNameDefinition(Node root, Iterator<NameDefinition> eNameDefinitions) throws IOException { @@ -314,16 +298,16 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, } /** - * This method process a WorkSheet and generates a portion - * of the <code>Document</code>. A spreadsheet is represented - * as a table Node in StarOffice XML format. + * This method process a WorkSheet and generates a portion of the + * {@code Document}. + * + * <p>A spreadsheet is represented as a table Node in StarOffice XML format.</p> * - * @param root The root <code>Node</code> of the - * <code>Document</code> we are building. This - * <code>Node</code> should be a TAG_OFFICE_BODY - * tag. + * @param root The root {@code Node} of the {@code Document} we are + * building. This {@code Node} should be a + * {@code TAG_OFFICE_BODY} tag. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ protected void processTable(Node root) throws IOException { @@ -338,7 +322,7 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, // Set the table name attribute tableElement.setAttribute(ATTRIBUTE_TABLE_NAME, sheetName); - // TODO - style currently hardcoded - get real value + // ToDo - style currently hardcoded - get real value // Set table style-name attribute tableElement.setAttribute(ATTRIBUTE_TABLE_STYLE_NAME, "Default"); @@ -347,7 +331,7 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, Debug.log(Debug.TRACE, "<SheetName>" + sheetName + "</SheetName>"); - // add the various different table-columns + // Add the various different table-columns processColumns(tableElement); // Get each cell and add to doc @@ -357,18 +341,16 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, } /** - * <p>This method process the cells in a <code>Document</code> - * and generates a portion of the <code>Document</code>.</p> + * This method process the cells in a {@code Document} and generates a + * portion of the {@code Document}. * - * <p>This method assumes that records are sorted by - * row and then column.</p> + * <p>This method assumes that records are sorted by row and then column.</p> * - * @param root The <code>Node</code> of the <code>Document</code> - * we are building that we will append our cell - * <code>Node</code> objects. This <code>Node</code> - * should be a TAG_TABLE tag. + * @param root The {@code Node} of the {@code Document} we are building + * that we will append our cell {@code Node} objects. This + * {@code Node} should be a {@code TAG_TABLE} tag. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ protected void processColumns(Node root) throws IOException { @@ -406,18 +388,16 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, } /** - * <p>This method process the cells in a <code>Document</code> - * and generates a portion of the <code>Document</code>.</p> + * This method process the cells in a {@code Document} and generates a + * portion of the {@code Document}. * - * <p>This method assumes that records are sorted by - * row and then column.</p> + * <p>This method assumes that records are sorted by row and then column.</p> * - * @param root The <code>Node</code> of the <code>Document</code> - * we are building that we will append our cell - * <code>Node</code> objects. This <code>Node</code> - * should be a TAG_TABLE tag. + * @param root The {@code Node} of the {@code Document} we are building + * that we will append our cell {@code Node} objects. This + * {@code Node} should be a {@code TAG_TABLE} tag. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ protected void processCells(Node root) throws IOException { @@ -438,7 +418,6 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, // The number of columns in the spreadsheet int lastColumn = decoder.getNumberOfColumns(); - Node autoStylesNode = null; // Loop over all cells in the spreadsheet @@ -477,7 +456,6 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, // Create an element node for the new row rowElement = doc.createElement(TAG_TABLE_ROW); - for(Iterator<ColumnRowInfo> e = decoder.getColumnRowInfos();e.hasNext();) { ColumnRowInfo cri = e.next(); if(cri.isRow() && cri.getRepeated()==newRow-1) { @@ -552,7 +530,7 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, if (autoStylesNode == null) { autoStylesNode = doc.createElement(TAG_OFFICE_AUTOMATIC_STYLES); doc.insertBefore(autoStylesNode, bodyNode); - } + } CellStyle tStyle = new CellStyle( "Default",SxcConstants.TABLE_CELL_STYLE_FAMILY, @@ -599,44 +577,40 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, // Now write the style catalog to the document if(autoStylesNode!=null) { - Debug.log(Debug.TRACE,"Well the autostyle node was found!!!"); + Debug.log(Debug.TRACE, "Well the autostyle node was found!!!"); NodeList nl = styleCat.writeNode(doc, "dummy").getChildNodes(); int nlLen = nl.getLength(); // nl.item reduces the length - for (int i = 0; i < nlLen; i++) { - autoStylesNode.appendChild(nl.item(0)); - } + for (int i = 0; i < nlLen; i++) { + autoStylesNode.appendChild(nl.item(0)); + } } if (row != 0) { - // The sheet does have rows, so write out a /tr Debug.log(Debug.TRACE, "</tr>"); } } - /** - * This method will add empty rows to the <code>Document</code>. - * It is called when the conversion process encounters - * a row (or rows) that do not contain any data in its cells. + * This method will add empty rows to the {@code Document}. + * + * <p>It is called when the conversion process encounters a row (or rows) + * that do not contain any data in its cells.</p> * - * @param numEmptyRows The number of empty rows that we - * need to add to the <code>Document</code>. - * @param root The <code>Node</code> of the - * <code>Document</code> we are building - * that we will append our empty row - * <code>Node</code> objects. This - * <code>Node</code> should be a TAG_TABLE - * tag. - * @param numEmptyCells The number of empty cells in the - * empty row. + * @param numEmptyRows The number of empty rows that we need to add to + * the {@code Document}. + * @param root The {@code Node} of the {@code Document} we are + * building that we will append our empty row + * {@code Node} objects. This {@code Node} should + * be a {@code TAG_TABLE} tag. + * @param numEmptyCells The number of empty cells in the empty row. */ protected void addEmptyRows(int numEmptyRows, Node root, int numEmptyCells) { // Create an element node for the row Element rowElement = doc.createElement(TAG_TABLE_ROW); - // TODO - style currently hardcoded - get real value + // ToDo - style currently hardcoded - get real value // Set row style-name attribute rowElement.setAttribute(ATTRIBUTE_TABLE_STYLE_NAME, "Default"); @@ -657,29 +631,25 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, } - /** - * This method will add empty cells to the <code>Document</code>. - * It is called when the conversion process encounters a row - * that contains some cells without data. + * This method will add empty cells to the {@code Document}. + * + * <p>It is called when the conversion process encounters a row that + * contains some cells without data.</p> * - * @param numColsSkipped The number of empty cells - * that we need to add to the - * current row. - * @param row The <code>Node</code> of the - * <code>Document</code> we - * are building that we will - * append our empty cell - * <code>Node</code> objects. - * This <code>Node</code> should - * be a TAG_TABLE_ROW tag. + * @param numColsSkipped The number of empty cells that we need to add to + * the current row. + * @param row The {@code Node} of the {@code Document} we are + * building that we will append our empty cell + * {@code Node} objects. This {@code Node} should + * be a {@code TAG_TABLE_ROW} tag. */ protected void addEmptyCells(int numColsSkipped, Node row) { // Create an empty cellElement Element cellElement = doc.createElement(TAG_TABLE_CELL); - // TODO - style currently hardcoded - get real value + // ToDo - style currently hardcoded - get real value // Set cell style-name attribute cellElement.setAttribute(ATTRIBUTE_TABLE_STYLE_NAME, "Default"); @@ -701,17 +671,15 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, } } - /** - * This method process the data in a cell and sets - * the appropriate attributes on the cell <code>Element</code>. + * This method process the data in a cell and sets the appropriate attributes + * on the cell {@code Element}. * - * @param cellElement A TAG_TABLE_CELL <code>Element</code> - * that we will be adding attributes to - * based on the type of data in the cell. - * @param type The type of data contained in the cell. - * @param contents The contents of the data contained in - * the cell. + * @param cellElement A {@code TAG_TABLE_CELL} {@code Element} that we + * will be adding attributes to based on the type of + * data in the cell. + * @param type The type of data contained in the cell. + * @param contents The contents of the data contained in the cell. */ protected void processCellData(Element cellElement, String type, String contents) { @@ -770,6 +738,4 @@ public abstract class SxcDocumentDeserializer implements OfficeConstants, } } } - -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java index ba060cbf3e4b..bf6d2dc7f9f4 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java @@ -36,90 +36,84 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** - * <p>General spreadsheet implementation of <code>DocumentSerializer</code> - * for the {@link - * org.openoffice.xmerge.converter.xml.sxc.SxcPluginFactory - * SxcPluginFactory}. Used with SXC <code>Document</code> objects.</p> + * General spreadsheet implementation of {@code DocumentSerializer} for the + * {@link org.openoffice.xmerge.converter.xml.sxc.SxcPluginFactory + * SxcPluginFactory}. * - * <p>The <code>serialize</code> method traverses the DOM - * <code>Document</code> from the given <code>Document</code> object. - * It uses a <code>DocEncoder</code> object for the actual conversion - * of contents to the device spreadsheet format.</p> + * <p>Used with SXC {@code Document} objects.</p> * + * <p>The {@code serialize} method traverses the DOM {@code Document} from the + * given {@code Document} object. It uses a {@code DocEncoder} object for the + * actual conversion of contents to the device spreadsheet format.</p> */ public abstract class SxcDocumentSerializer implements OfficeConstants, DocumentSerializer { - /** <code>Format</code> object describing the cell. */ + /** {@code Format} object describing the cell. */ private Format fmt = null; - /** The row number. */ + /** The row number. */ private int rowID = 1; - /** The column number. */ + /** The column number. */ private int colID = 1; - /** The number of times the current row is repeated. */ + /** The number of times the current row is repeated. */ private int rowsRepeated = 1; - /** The number of times the current column is repeated. */ + /** The number of times the current column is repeated. */ private int colsRepeated = 1; - /** The number of times the current column is repeated. */ + /** The number of times the current column is repeated. */ private StyleCatalog styleCat = null; + /** - * An array of column widths of the current worksheet. Width is - * measured in number of characters. + * An array of column widths of the current worksheet. + * Width is measured in number of characters. */ private ArrayList<ColumnRowInfo> ColumnRowList; /** - * A <code>SpreadsheetEncoder</code> object for encoding to - * appropriate format. + * A {@code SpreadsheetEncoder} object for encoding to appropriate format. */ protected SpreadsheetEncoder encoder = null; - /** <code>SxcDocument</code> object that this converter processes. */ + /** {@code SxcDocument} object that this converter processes. */ protected SxcDocument sxcDoc = null; - /** - * Constructor. + * Constructor. * - * @param document Input <code>SxcDocument</code> - * <code>Document</code>. + * @param document Input {@code SxcDocument} {@code Document}. */ public SxcDocumentSerializer(Document document) { fmt = new Format(); sxcDoc = (SxcDocument) document; } - /** - * <p>Method to convert a DOM <code>Document</code> into - * "Device" <code>Document</code> objects.</p> + * Method to convert a DOM {@code Document} into "Device" + * {@code Document} objects. * - * <p>This method is not thread safe for performance reasons. - * This method should not be called from within two threads. - * It would be best to call this method only once per object - * instance.</p> + * <p>This method is not thread safe for performance reasons. This method + * should not be called from within two threads. It would be best to call + * this method only once per object instance.</p> * - * @return <code>ConvertData</code> containing "Device" - * <code>Document</code> objects. + * @return {@code ConvertData} containing "Device" + * {@code Document}objects. * - * @throws ConvertException If any conversion error occurs. - * @throws IOException If any I/O error occurs. + * @throws ConvertException If any conversion error occurs. + * @throws IOException If any I/O error occurs. */ public abstract ConvertData serialize() throws ConvertException, IOException; - /** - * This method traverses <i>office:settings</i> <code>Element</code>. + * This method traverses <i>office:settings</i> {@code Element}. * - * @param node <i>office:settings</i> <code>Node</code>. + * @param node <i>office:settings</i> {@code Node}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public void traverseSettings(Node node) throws IOException { if (node.hasChildNodes()) { @@ -154,12 +148,12 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, } } - /* - * Handles the loading of defined styles from the style.xml file as well - * as automatic styles from the content.xml file. + /** + * Handles the loading of defined styles from the style.xml file as well as + * automatic styles from the content.xml file. * - * Any change to a defined style, such as a short bold section, falls into - * the latter category. + * <p>Any change to a defined style, such as a short bold section, falls + * into the latter category. */ protected void loadStyles(SxcDocument sxcDoc) { @@ -188,11 +182,11 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, } /** - * This method traverses <i>office:body</i> <code>Element</code>. + * This method traverses <i>office:body</i> {@code Element}. * - * @param node <i>office:body</i> <code>Node</code>. + * @param node <i>office:body</i> {@code Node}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ protected void traverseBody(Node node) throws IOException { @@ -242,14 +236,12 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, Debug.log(Debug.TRACE, "</DEBUGLOG>"); } - /** - * This method traverses the <i>table:table</i> element - * <code>Node</code>. + * This method traverses the <i>table:table</i> element {@code Node}. * - * @param node A <i>table:table</i> <code>Node</code>. + * @param node A <i>table:table</i> {@code Node}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ protected void traverseNamedExpressions(Node node) throws IOException { @@ -274,12 +266,11 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, } /** - * This method traverses the <i>table:table</i> element - * <code>Node</code>. + * This method traverses the <i>table:table</i> element {@code Node}. * - * @param node A <i>table:table</i> <code>Node</code>. + * @param node A <i>table:table</i> {@code Node}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ protected void traverseTable(Node node) throws IOException { @@ -288,7 +279,7 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, ColumnRowList = new ArrayList<ColumnRowInfo>(); // Get table attributes - // TODO - extract style from attribute + // ToDo - extract style from attribute NamedNodeMap att = node.getAttributes(); @@ -339,12 +330,11 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, } /** - * This method traverses the <i>table:table-row</i> element - * <code>Node</code>. + * This method traverses the <i>table:table-row</i> element {@code Node}. * - * @param node A <i>table:table-row</i> <code>Node</code>. + * @param node A <i>table:table-row</i> {@code Node}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ protected void traverseTableRow(Node node) throws IOException { @@ -454,12 +444,12 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, Debug.log(Debug.TRACE, "</TR>"); } - /** - * This method traverses the <i>table:table-column</i> - * <code>Node</code>. Not yet implemented. + * This method traverses the <i>table:table-column</i> {@code Node}. + * + * <p>Not yet implemented.</p> * - * @param node A <i>table:table-column</i> <code>Node</code>. + * @param node A <i>table:table-column</i> {@code Node}. * * @throws IOException If any I/O error occurs. */ @@ -527,12 +517,11 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, } /** - * This method traverses a <i>table:table-cell</i> element - * <code>Node</code>. + * This method traverses a <i>table:table-cell</i> element {@code Node}. * - * @param node a <i>table:table-cell</i> <code>Node</code>. + * @param node a <i>table:table-cell</i> {@code Node}. * - * @throws IOException if any I/O error occurs. + * @throws IOException if any I/O error occurs. */ protected void traverseCell(Node node) throws IOException { @@ -541,15 +530,11 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, int debug_i=0; Node debug_attrib = null; fmt.clearFormatting(); - if (cellAtt == null || cellAtt.item(0) == null) - { + if (cellAtt == null || cellAtt.item(0) == null) { Debug.log(Debug.INFO, "No Cell Attributes\n"); // return; - } - else - { - while ((debug_attrib = cellAtt.item(debug_i++)) != null) - { + } else { + while ((debug_attrib = cellAtt.item(debug_i++)) != null) { Debug.log(Debug.INFO, "Cell Attribute " + debug_i + ": " + debug_attrib.getNodeName() + " : " + debug_attrib.getNodeValue() + "\n"); @@ -749,13 +734,12 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, } - /** - * This method traverses the <i>text:p</i> element <code>Node</code>. + * This method traverses the <i>text:p</i> element {@code Node}. * - * @param node A <i>text:p</i> <code>Node</code>. + * @param node A <i>text:p</i> {@code Node}. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ protected void traverseParagraph(Node node) throws IOException { @@ -763,14 +747,10 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, int debug_i=0; Node debug_attrib = null; - if (cellAtt == null || cellAtt.item(0) == null) - { + if (cellAtt == null || cellAtt.item(0) == null) { Debug.log(Debug.INFO, "No Paragraph Attributes\n"); - } - else - { - while ((debug_attrib = cellAtt.item(debug_i++)) != null) - { + } else { + while ((debug_attrib = cellAtt.item(debug_i++)) != null) { Debug.log(Debug.INFO, "Paragraph Attribute " + debug_i + ": " + debug_attrib.getNodeName() + " : " + debug_attrib.getNodeValue() + "\n"); @@ -821,17 +801,17 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, } } - /** - * This method will take the input cell value and add - * it to the spreadsheet <code>Document</code> we are currently - * encoding. This method correctly handles cells that are - * repeated in either the row, cell, or both directions. + * This method will take the input cell value and add it to the spreadsheet + * {@code Document} we are currently encoding. * - * @param cellValue The contents of the cell we want to add - * to the spreadsheet <code>Document</code>. + * <p>This method correctly handles cells that are repeated in either the + * row, cell, or both directions.</p> * - * @throws IOException If any I/O error occurs. + * @param cellValue The contents of the cell we want to add to the + * spreadsheet {@code Document}. + * + * @throws IOException If any I/O error occurs. */ protected void addCell(String cellValue) throws IOException { @@ -852,7 +832,6 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, Debug.log(Debug.TRACE, "<TD>"); - // Add the cell data to the encoded spreadsheet document encoder.addCell(row, col, fmt, cellValue); @@ -868,23 +847,21 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, } - - /** - * This method takes a <i>table:table-cell</i> <code>Node</code> - * and traverses down to the <i>text:p</i> tag. The value is - * extracted from the <i>text:p</i> tag and the number of decimal - * places is calculated. + * This method takes a <i>table:table-cell</i> {@code Node} and traverses + * down to the <i>text:p</i> tag. * - * @param node A <i>table:table-cell</i> <code>Node</code>. + * <p>The value is extracted from the <i>text:p</i> tag and the number of + * decimal places is calculated.</p> * - * @return The number of decimal places in the display - * string of the data in the input <code>Node</code>. + * @param node A <i>table:table-cell</i> {@code Node}. + * + * @return The number of decimal places in the display string of the data + * in the input {@code Node}. */ protected int getDecimalPlaces(Node node) { int decimals = 0; - Element element = null; // cast org.w3c.dom.Node to org.w3c.dom.Element @@ -902,21 +879,16 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, } Node paragraph = list.item(0); - if (paragraph.hasChildNodes()) { NodeList nodeList = paragraph.getChildNodes(); - int len = nodeList.getLength(); - for (int j = 0; j < len; j++) { Node child = nodeList.item(j); - if (child.getNodeType() == Node.TEXT_NODE) { String s = child.getNodeValue(); - int k = s.lastIndexOf("."); if (k > 0) { s = s.substring(k+1); @@ -928,6 +900,4 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, return decimals; } - -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcPluginFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcPluginFactory.java index b034dcab2dda..1b3008c637bd 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcPluginFactory.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcPluginFactory.java @@ -26,50 +26,44 @@ import org.openoffice.xmerge.PluginFactory; import org.openoffice.xmerge.Document; import org.openoffice.xmerge.DocumentMergerFactory; - /** - * General implementation of the <code>PluginFactory</code> interface - * for SXC <code>Document</code> objects. + * General implementation of the {@code PluginFactory} interface for SXC + * {@code Document} objects. * - * @see org.openoffice.xmerge.DocumentDeserializer - * @see org.openoffice.xmerge.DocumentMerger - * @see org.openoffice.xmerge.DocumentSerializer + * @see org.openoffice.xmerge.DocumentDeserializer + * @see org.openoffice.xmerge.DocumentMerger + * @see org.openoffice.xmerge.DocumentSerializer */ public abstract class SxcPluginFactory extends PluginFactory implements DocumentMergerFactory { - /** - * Constructor that caches the <code>ConvertInfo</code> that - * corresponds to the registry information for this plug-in. + * Constructor that caches the {@code ConvertInfo} that corresponds to the + * registry information for this plug-in. * - * @param ci <code>ConvertInfo</code> object. + * @param ci {@code ConvertInfo} object. */ public SxcPluginFactory(ConverterInfo ci) { super(ci); } - @Override public Document createOfficeDocument(String name, InputStream is) throws IOException { - // read zipped XML stream - + // Read zipped XML stream SxcDocument doc = new SxcDocument(name); doc.read(is); return doc; } - @Override + @Override public Document createOfficeDocument(String name, InputStream is,boolean isZip) throws IOException { - // read zipped XML stream - + // Read zipped XML stream SxcDocument doc = new SxcDocument(name); doc.read(is,isZip); return doc; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxw/SxwDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxw/SxwDocument.java index 8728319d953e..37cf99699064 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxw/SxwDocument.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxw/SxwDocument.java @@ -22,52 +22,46 @@ import org.openoffice.xmerge.converter.xml.OfficeDocument; import org.openoffice.xmerge.converter.xml.OfficeConstants; /** - * This class is an implementation of <code>OfficeDocument</code> for - * the SXW format. + * This class is an implementation of {@code OfficeDocument} for the SXW format. */ public class SxwDocument extends OfficeDocument { - /** - * Constructor with arguments to set <code>name</code>. + * Constructor with arguments to set {@code name}. * - * @param name The name of the <code>Document</code> + * @param name The name of the {@code Document}. */ public SxwDocument(String name) { super(name); } - /** - * Constructor with arguments to set <code>name</code>, the - * <code>namespaceAware</code> flag, and the <code>validating</code> - * flag. + * Constructor with arguments to set {@code name}, the {@code namespaceAware} + * flag, and the {@code validating} flag. * - * @param name The name of the <code>Document</code>. - * @param namespaceAware The value of the namespaceAware flag. - * @param validating The value of the validating flag. + * @param name The name of the {@code Document}. + * @param namespaceAware The value of the {@code namespaceAware} flag. + * @param validating The value of the {@code validating} flag. */ public SxwDocument(String name, boolean namespaceAware, boolean validating) { super(name, namespaceAware, validating); } - /** - * Returns the Office file extension for the SXW format. + * Returns the Office file extension for the SXW format. * - * @return The Office file extension for the SXW format. + * @return The Office file extension for the SXW format. */ @Override protected String getFileExtension() { return OfficeConstants.SXW_FILE_EXTENSION; } - /** - * Returns the Office attribute for the SXW format. + * Returns the Office attribute for the SXW format. * - * @return The Office attribute for the SXW format. + * @return The Office attribute for the SXW format. */ @Override protected String getOfficeClassAttribute() { @@ -77,12 +71,10 @@ public class SxwDocument extends OfficeDocument { /** * Method to return the MIME type of the document. * - * @return String The document's MIME type. + * @return The document's MIME type. */ @Override protected final String getDocumentMimeType() { return OfficeConstants.SXW_MIME_TYPE; } - -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxw/SxwPluginFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxw/SxwPluginFactory.java index c0cb42d1a122..c529a3126bd1 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxw/SxwPluginFactory.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxw/SxwPluginFactory.java @@ -26,44 +26,42 @@ import org.openoffice.xmerge.Document; import org.openoffice.xmerge.util.registry.ConverterInfo; /** - * General implementation of the <code>PluginFactory</code> interface - * for SXW documents. + * General implementation of the {@code PluginFactory} interface for SXW + * documents. * - * @see org.openoffice.xmerge.DocumentDeserializer - * @see org.openoffice.xmerge.DocumentMerger - * @see org.openoffice.xmerge.DocumentSerializer + * @see org.openoffice.xmerge.DocumentDeserializer + * @see org.openoffice.xmerge.DocumentMerger + * @see org.openoffice.xmerge.DocumentSerializer */ public abstract class SxwPluginFactory extends PluginFactory { /** - * Constructor that caches the <code>ConvertInfo</code> that - * corresponds to the registry information for this plug-in. + * Constructor that caches the {@code ConvertInfo} that corresponds to the + * registry information for this plug-in. * - * @param ci <code>ConvertInfo</code> object. + * @param ci {@code ConvertInfo} object. */ public SxwPluginFactory (ConverterInfo ci) { super(ci); } - @Override public Document createOfficeDocument(String name, InputStream is) throws IOException { - // read zipped XML stream + // Read zipped XML stream SxwDocument doc = new SxwDocument(name); doc.read(is); return doc; } - @Override + @Override public Document createOfficeDocument(String name, InputStream is,boolean isZip) throws IOException { - // read XML stream + // Read XML stream SxwDocument doc = new SxwDocument(name); doc.read(is,isZip); return doc; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/ConverterCapabilitiesImpl.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/ConverterCapabilitiesImpl.java index 31600c70113f..5569af0a8c33 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/ConverterCapabilitiesImpl.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/ConverterCapabilitiesImpl.java @@ -22,15 +22,13 @@ import org.openoffice.xmerge.ConverterCapabilities; import org.openoffice.xmerge.converter.xml.OfficeConstants; /** - * <p>Xslt implementation of <code>ConverterCapabilities</code> for - * the {@link - * org.openoffice.xmerge.converter.xml.xslt.PluginFactoryImpl - * PluginFactoryImpl}.</p> + * Xslt implementation of {@code ConverterCapabilities} for the {@link + * org.openoffice.xmerge.converter.xml.xslt.PluginFactoryImpl PluginFactoryImpl}. * - * <p>Used with StarWriter XML to/from XSLT supported formats conversions. The - * <code>ConverterCapibilies</code> specify which "Office" - * <code>Document</code> tags and attributes are supported on the - * "Device" <code>Document</code> format.</p> + * <p>Used with StarWriter XML to/from XSLT supported formats conversions. The + * {@code ConverterCapibilies} specify which "Office" {@code Document} + * tags and attributes are supported on the "Device" {@code Document} + * format.</p> */ public final class ConverterCapabilitiesImpl implements ConverterCapabilities { @@ -69,16 +67,13 @@ public final class ConverterCapabilitiesImpl return false; } - public boolean canConvertAttribute(String tag, - String attribute) { + public boolean canConvertAttribute(String tag, String attribute) { if (OfficeConstants.TAG_SPACE.equals(tag)) { - if (OfficeConstants.ATTRIBUTE_SPACE_COUNT.equals(attribute)) return true; } return false; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java index 2d3bf4551607..434d60c4f2f3 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java @@ -42,108 +42,92 @@ import org.openoffice.xmerge.converter.dom.DOMDocument; import org.openoffice.xmerge.util.Debug; import org.openoffice.xmerge.util.registry.ConverterInfo; - /** - * <p>Xslt implementation of - * org.openoffice.xmerge.DocumentSerializer - * for the {@link - * org.openoffice.xmerge.converter.xml.xslt.PluginFactoryImpl - * PluginFactoryImpl}.</p> + * Xslt implementation of {@code org.openoffice.xmerge.DocumentSerializer} + * for the {@link org.openoffice.xmerge.converter.xml.xslt.PluginFactoryImpl + * PluginFactoryImpl}. * - * <p>The <code>serialize</code> method transforms the DOM - * document from the given <code>Document</code> object by - * means of a supplied Xsl Stylesheet.</p> + * <p>The {@code serialize} method transforms the DOM document from the given + * {@code Document} object by means of a supplied Xsl Stylesheet.</p> */ public final class DocumentDeserializerImpl implements DocumentDeserializer,URIResolver { - /** A <code>ConvertData</code> object assigned to this object. */ + /** A {@code ConvertData} object assigned to this object. */ private ConvertData cd = null; private PluginFactoryImpl pluginFactory = null; /** - * Constructor that assigns the given <code>ConvertData</code> - * to this object. - * - * @param pf A <code>PluginFactoryImpl</code> object. + * Constructor that assigns the given {@code ConvertData} to this object. * - * @param cd A <code>ConvertData</code> object to read data for - * the conversion process by the <code>deserialize</code> - * method. + * @param pf A {@code PluginFactoryImpl} object. + * @param cd A {@code ConvertData} object to read data for the conversion + * process by the {@code deserialize} method. */ public DocumentDeserializerImpl(PluginFactoryImpl pf,ConvertData cd) { this.cd = cd; - pluginFactory = pf; + pluginFactory = pf; } - - - /* - * This method performs the xslt transformation on the supplied <code> - * Document</code> and returns a <code>ByteArrayOutputStream</code> object. - * - * Xslt transformation code + /** + * This method performs the xslt transformation on the supplied + * {@code Document} and returns a {@code ByteArrayOutputStream} object. * - * @return baos A <code>ByteArrayOutputStream</code> object containing - * the result of the Xslt transformation. - * @throws TransformerException,TransformerConfigurationException - * , FileNotFoundException,IOException + * <p>Xslt transformation code.</p> * + * @return A {@code ByteArrayOutputStream} object containing the result + * of the Xslt transformation. */ public Document deserialize() throws ConvertException, IOException { - log("\nFound the XSLT deserializer"); - Iterator<Object> enumerate = cd.getDocumentEnumeration(); - org.w3c.dom.Document domDoc=null; - DOMDocument docOut=null; - ByteArrayOutputStream baos =null; - GenericOfficeDocument sxwDoc = new GenericOfficeDocument("output"); - while (enumerate.hasNext()) { - docOut = (DOMDocument) enumerate.next(); - } - domDoc = docOut.getContentDOM(); - try{ - baos = transform(domDoc); - sxwDoc.initContentDOM(); - DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance(); - dFactory.setNamespaceAware(true); - DocumentBuilder dBuilder = dFactory.newDocumentBuilder(); - sxwDoc.setContentDOM(dBuilder.parse(new ByteArrayInputStream(baos.toByteArray()))); - - } - catch(Exception e){ - System.out.println("The following error occurred:"+e); - } - return sxwDoc; + log("\nFound the XSLT deserializer"); + Iterator<Object> enumerate = cd.getDocumentEnumeration(); + org.w3c.dom.Document domDoc = null; + DOMDocument docOut = null; + ByteArrayOutputStream baos = null; + GenericOfficeDocument sxwDoc = new GenericOfficeDocument("output"); + while (enumerate.hasNext()) { + docOut = (DOMDocument) enumerate.next(); + } + domDoc = docOut.getContentDOM(); + try { + baos = transform(domDoc); + sxwDoc.initContentDOM(); + DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance(); + dFactory.setNamespaceAware(true); + DocumentBuilder dBuilder = dFactory.newDocumentBuilder(); + sxwDoc.setContentDOM(dBuilder.parse(new ByteArrayInputStream(baos.toByteArray()))); + + } catch (Exception e) { + System.out.println("The following error occurred:" + e); + } + return sxwDoc; } - public Source resolve(String href,String base) - throws TransformerException{ - if (href !=null){ - if(href.equals("javax.xml.transform.dom.DOMSource")|| href.equals("")) + public Source resolve(String href, String base) throws TransformerException { + if (href != null) { + if (href.equals("javax.xml.transform.dom.DOMSource") || href.equals("")) { + return null; + } + try { + ConverterInfo ci = pluginFactory.getConverterInfo(); + String newhRef = "jar:" + ci.getJarName() + "!/" + href; + StreamSource sheetFile = new StreamSource(newhRef); + return sheetFile; + } catch (Exception e) { + System.out.println("\nException in Xslt Resolver " + e); + return null; + } + } else { return null; - try{ - ConverterInfo ci = pluginFactory.getConverterInfo(); - String newhRef ="jar:"+ci.getJarName()+"!/"+href; - StreamSource sheetFile= new StreamSource(newhRef); - return sheetFile; - } - catch (Exception e){ - System.out.println("\nException in Xslt Resolver " +e); - return null; - } } - else - return null; } - /** + /** * This method performs the xslt transformation on the supplied Dom Tree. * - * Xslt transformation code - * + * <p>Xslt transformation code.</p> */ - private ByteArrayOutputStream transform(org.w3c.dom.Document xmlDoc) - { + private ByteArrayOutputStream transform(org.w3c.dom.Document xmlDoc){ log("\nTransforming..."); ConverterInfo ci = pluginFactory.getConverterInfo(); @@ -191,7 +175,7 @@ public final class DocumentDeserializerImpl return baos; } - /** + /** * Sends message to the log object. * * @param str Debug message. @@ -200,6 +184,4 @@ public final class DocumentDeserializerImpl Debug.log(Debug.TRACE, str); } - -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentMergerImpl.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentMergerImpl.java index da0f71e4f4d1..da0d308d463b 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentMergerImpl.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentMergerImpl.java @@ -33,12 +33,9 @@ import org.openoffice.xmerge.merger.merge.DocumentMerge; import org.openoffice.xmerge.merger.merge.CharacterBaseParagraphMerge; import org.openoffice.xmerge.util.Debug; - /** - * Xslt implementation of <code>DocumentMerger</code> - * for the {@link - * org.openoffice.xmerge.converter.xml.xslt.PluginFactoryImpl - * PluginFactoryImpl}. + * Xslt implementation of {@code DocumentMerger} for the {@link + * org.openoffice.xmerge.converter.xml.xslt.PluginFactoryImpl PluginFactoryImpl}. */ public class DocumentMergerImpl implements DocumentMerger { @@ -80,6 +77,4 @@ public class DocumentMergerImpl implements DocumentMerger { docMerge.applyDifference(i1, i2, diffTable); } -} - - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentSerializerImpl.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentSerializerImpl.java index b010c1a6f668..25131cb03184 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentSerializerImpl.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentSerializerImpl.java @@ -49,48 +49,43 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; /** - * <p>Xslt implementation of - * org.openoffice.xmerge.DocumentSerializer - * for the {@link - * org.openoffice.xmerge.converter.xml.xslt.PluginFactoryImpl - * PluginFactoryImpl}.</p> + * Xslt implementation of {@code org.openoffice.xmerge.DocumentSerializer} + * for the {@link org.openoffice.xmerge.converter.xml.xslt.PluginFactoryImpl + * PluginFactoryImpl}. * - * <p>The <code>serialize</code> method transforms the DOM - * document from the given <code>Document</code> object by - * means of a supplied Xsl Stylesheet.</p> + * <p>The {@code serialize} method transforms the DOM document from the given + * {@code Document} object by means of a supplied Xsl Stylesheet.</p> */ - public final class DocumentSerializerImpl implements DocumentSerializer,OfficeConstants,URIResolver { - - /** SXW <code>Document</code> object that this converter processes. */ + /** SXW {@code Document} object that this converter processes. */ private GenericOfficeDocument sxwDoc = null; private PluginFactoryImpl pluginFactory = null; /** - * Constructor. + * Constructor. * - * @param pf A <code>PluginFactoryImpl</code> - * @param doc A SXW <code>Document</code> to be converted. + * @param pf A {@code PluginFactoryImpl}. + * @param doc A SXW {@code Document} to be converted. */ public DocumentSerializerImpl(PluginFactoryImpl pf,Document doc) { pluginFactory=pf; sxwDoc = (GenericOfficeDocument) doc; } - /** - * Method to convert a <code>Document</code> with an xsl stylesheet. - * It creates a <code>Document</code> object, which is then transformed - * with the Xslt processor. A <code>ConvertData </code> object is - * constructed and returned. + * Method to convert a {@code Document} with an xsl stylesheet. * - * @return cd A <code>ConvertData</code> object. - * @throws ConvertException If any I/O error occurs. - * @throws IOException If any I/O error occurs. + * <p>It creates a {@code Document} object, which is then transformed with the + * Xslt processor. A {@code ConvertData} object is constructed and returned.</p> + * + * @return A {@code ConvertData} object. + * + * @throws ConvertException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public ConvertData serialize() throws ConvertException, IOException { String docName = sxwDoc.getName(); @@ -202,77 +197,70 @@ public final class DocumentSerializerImpl return cd; } - public Source resolve(String href,String base) - throws TransformerException{ - if (href !=null){ - if(href.equals("javax.xml.transform.dom.DOMSource")|| href.equals("")) - return null; - try{ - ConverterInfo ci = pluginFactory.getConverterInfo(); - String newhRef ="jar:"+ci.getJarName()+"!/"+href; - StreamSource sheetFile= new StreamSource(newhRef); - return sheetFile; - } - catch (Exception e){ - System.out.println("\nException in Xslt Resolver " +e); + public Source resolve(String href, String base) + throws TransformerException { + if (href != null) { + if (href.equals("javax.xml.transform.dom.DOMSource") || href.equals("")) { + return null; + } + try { + ConverterInfo ci = pluginFactory.getConverterInfo(); + String newhRef = "jar:" + ci.getJarName() + "!/" + href; + StreamSource sheetFile = new StreamSource(newhRef); + return sheetFile; + } catch (Exception e) { + System.out.println("\nException in Xslt Resolver " + e); + return null; + } + } else { return null; } - } - else - return null; } - /** - * This method performs the sxl transformation on the supplied <code> - * Document</code> and returns a <code>DOMResult</code> object. + * This method performs the sxl transformation on the supplied + * {@code Document} and returns a {@code DOMResult} object. * - * Xslt transformation code + * <p>Xslt transformation code.</p> * - * @return baos A <code>ByteArrayOutputStream</code> object containing - * the result of the Xslt transformation. + * @return A {@code ByteArrayOutputStream} object containing the result + * of the Xslt transformation. */ - private ByteArrayOutputStream transform(org.w3c.dom.Document domDoc) - { - ConverterInfo ci = pluginFactory.getConverterInfo(); - ByteArrayOutputStream baos= new ByteArrayOutputStream(); - try{ - - DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance(); - dFactory.setNamespaceAware(true); - - DocumentBuilder dBuilder = dFactory.newDocumentBuilder(); - String teststr = ci.getXsltSerial(); + private ByteArrayOutputStream transform(org.w3c.dom.Document domDoc) { + ConverterInfo ci = pluginFactory.getConverterInfo(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try { - teststr= teststr.substring(0,6); - org.w3c.dom.Document xslDoc=null; - if ((teststr.equals("http:/"))||(teststr.equals("file:/")) - ||(teststr.equals("jar://"))){ - System.out.println(ci.getXsltSerial()); - xslDoc= dBuilder.parse(ci.getXsltSerial()); + DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance(); + dFactory.setNamespaceAware(true); - } - else{ - xslDoc = dBuilder.parse( - "jar:"+ci.getJarName()+"!/"+ci.getXsltSerial()); - } + DocumentBuilder dBuilder = dFactory.newDocumentBuilder(); + String teststr = ci.getXsltSerial(); - DOMSource xslDomSource = new DOMSource(xslDoc); - DOMSource xmlDomSource = new DOMSource(domDoc); + teststr = teststr.substring(0, 6); + org.w3c.dom.Document xslDoc = null; + if ((teststr.equals("http:/")) || (teststr.equals("file:/")) + || (teststr.equals("jar://"))) { + System.out.println(ci.getXsltSerial()); + xslDoc = dBuilder.parse(ci.getXsltSerial()); - //call the tranformer using the XSL, Source and Result. - TransformerFactory tFactory = TransformerFactory.newInstance(); - tFactory.setURIResolver(this); - Transformer transformer = tFactory.newTransformer(xslDomSource); + } else { + xslDoc = dBuilder.parse( + "jar:" + ci.getJarName() + "!/" + ci.getXsltSerial()); + } - transformer.transform(xmlDomSource, new StreamResult(baos)); - } - catch(Exception e){ - System.out.println("An error occurred in the transformation : "+e); - } - return baos; - } + DOMSource xslDomSource = new DOMSource(xslDoc); + DOMSource xmlDomSource = new DOMSource(domDoc); + //call the tranformer using the XSL, Source and Result. + TransformerFactory tFactory = TransformerFactory.newInstance(); + tFactory.setURIResolver(this); + Transformer transformer = tFactory.newTransformer(xslDomSource); + transformer.transform(xmlDomSource, new StreamResult(baos)); + } catch (Exception e) { + System.out.println("An error occurred in the transformation : " + e); + } + return baos; + } } - diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/GenericOfficeDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/GenericOfficeDocument.java index f06f90ec4c32..1552780169be 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/GenericOfficeDocument.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/GenericOfficeDocument.java @@ -21,30 +21,27 @@ package org.openoffice.xmerge.converter.xml.xslt; import org.openoffice.xmerge.converter.xml.OfficeDocument; /** - * This class is an implementation of <code>OfficeDocument</code> for - * the generic office format. + * This class is an implementation of {@code OfficeDocument} for the generic + * office format. */ public class GenericOfficeDocument extends OfficeDocument { /** - * Constructor with arguments to set <code>name</code>. + * Constructor with arguments to set {@code name}. * - * @param name The name of the <code>Document</code> + * @param name The name of the {@code Document}. */ public GenericOfficeDocument(String name) { super(name); } - /** - * Constructor with arguments to set <code>name</code>, the - * <code>namespaceAware</code> flag, and the <code>validating</code> - * flag. + * Constructor with arguments to set {@code name}, the {@code namespaceAware} + * flag, and the {@code validating} flag. * - * @param name The name of the <code>Document</code>. - * @param namespaceAware The value of the <code>namespaceAware</code> - * flag. - * @param validating The value of the <code>validating</code> flag. + * @param name The name of the {@code Document}. + * @param namespaceAware The value of the {@code namespaceAware} flag. + * @param validating The value of the {@code validating} flag. */ public GenericOfficeDocument(String name, boolean namespaceAware, boolean validating) { @@ -52,9 +49,9 @@ public class GenericOfficeDocument extends OfficeDocument { } /** - * Returns the Office file extension for the generic format. + * Returns the Office file extension for the generic format. * - * @return The Office file extension for the generic format. + * @return The Office file extension for the generic format. */ @Override protected String getFileExtension() { @@ -62,26 +59,23 @@ public class GenericOfficeDocument extends OfficeDocument { } /** - * Returns the Office attribute for the generic format. + * Returns the Office attribute for the generic format. * - * @return The Office attribute for the generic format. + * @return The Office attribute for the generic format. */ @Override protected String getOfficeClassAttribute() { - - return ""; + return ""; } /** * Method to return the MIME type of the document. * - * @return String The document's MIME type. + * @return The document's MIME type. */ @Override protected String getDocumentMimeType() { /* TODO: Determine the MIME-type from the input. */ return ""; } - -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java index 593ed3402c5c..c89fb72329aa 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java @@ -37,21 +37,18 @@ import org.openoffice.xmerge.converter.dom.DOMDocument; import org.openoffice.xmerge.util.registry.ConverterInfo; /** - * <p>Xslt implementation of the <code>PluginFactory</code>. - * This encapsulates conversion of StarWriter XML format to and from - * a supported format.</p> + * Xslt implementation of the {@code PluginFactory}. * - * <p>The superclass produces a particular - * {@link org.openoffice.xmerge.Document Document} - * object, i.e. {@link - * org.openoffice.xmerge.converter.xml.sxw.SxwDocument - * SxwDocument} that the converters in this class work with. Thus, - * this class only implements the methods that produces the converters, - * i.e. {@link - * org.openoffice.xmerge.DocumentSerializer - * DocumentSerializer} and {@link - * org.openoffice.xmerge.DocumentDeserializer - * DocumentDeserializer}</p> + * <p>This encapsulates conversion of StarWriter XML format to and from a + * supported format.</p> + * + * <p>The superclass produces a particular {@link org.openoffice.xmerge.Document + * Document} object, i.e. {@link + * org.openoffice.xmerge.converter.xml.sxw.SxwDocument xwDocument} that the + * converters in this class work with. Thus, this class only implements the + * methods that produces the converters, i.e. {@link + * org.openoffice.xmerge.DocumentSerializer DocumentSerializer} and {@link + * org.openoffice.xmerge.DocumentDeserializer DocumentDeserializer}</p> */ public final class PluginFactoryImpl extends PluginFactory implements DocumentDeserializerFactory, DocumentSerializerFactory, DocumentMergerFactory @@ -65,46 +62,41 @@ public final class PluginFactoryImpl extends PluginFactory private final static ConverterCapabilities converterCap = new ConverterCapabilitiesImpl(); - /** - * Returns an instance of <code>DocumentSerializerImpl</code>, - * which is an implementation of the <code>DocumentSerializer</code> - * interface. + * Returns an instance of {@code DocumentSerializerImpl}, which is an + * implementation of the {@code DocumentSerializer} interface. * - * @param doc <code>Document</code> object to be - * converted/serialized. + * @param doc {@code Document} object to be converted/serialized. * - * @return A <code>DocumentSerializerImpl</code> object. + * @return A {@code DocumentSerializerImpl} object. */ public DocumentSerializer createDocumentSerializer(Document doc) { return new DocumentSerializerImpl(this,doc); } - /** - * Returns an instance of <code>DocumentDeserializerImpl</code>, - * which is an implementation of the <code>DocumentDeserializer</code> - * interface. + * Returns an instance of <code>DocumentDeserializerImpl</code>, + * which is an implementation of the <code>DocumentDeserializer</code> + * interface. * - * @param cd <code>ConvertData</code> object. + * @param cd {@code ConvertData} object. * - * @return A DocumentDeserializerImpl object. + * @return A {@code DocumentDeserializerImpl} object. */ public DocumentDeserializer createDocumentDeserializer(ConvertData cd) { - return new DocumentDeserializerImpl(this,cd); } - @Override - public org.openoffice.xmerge.Document createDeviceDocument(String str, java.io.InputStream inputStream) throws java.io.IOException { + @Override + public org.openoffice.xmerge.Document createDeviceDocument(String str, + java.io.InputStream inputStream) throws java.io.IOException { String ext = this.getDeviceFileExtension(); DOMDocument domDoc = new DOMDocument(str,ext); domDoc.read(inputStream); return domDoc; } - - @Override + @Override public Document createOfficeDocument(String name, InputStream is) throws IOException { @@ -114,8 +106,8 @@ public final class PluginFactoryImpl extends PluginFactory return doc; } - @Override - public Document createOfficeDocument(String name, InputStream is,boolean isZip) + @Override + public Document createOfficeDocument(String name, InputStream is, boolean isZip) throws IOException { // read zipped XML stream @@ -125,67 +117,51 @@ public final class PluginFactoryImpl extends PluginFactory } /** - * Returns a <code>String</code> containing the file extension of a - * <code>Document</code>. This method uses a properties file to determine - * a mapping from the device mime in the <code>ConverterInfo</code> to a - * particular file extension. If a mapping is not specified, the default - * is ".txt". + * Returns a {@code String} containing the file extension of a + * {@code Document}. + * + * <p>This method uses a properties file to determine a mapping from the + * device mime in the {@code ConverterInfo} to a particular file extension. + * If a mapping is not specified, the default is ".txt".</p> * - * @return <code>String</code>. + * @return The file extension of a {@code Document}. */ - - - public String getDeviceFileExtension(){ - Class<? extends PluginFactoryImpl> c = this.getClass(); - InputStream is = c.getResourceAsStream("XsltPlugin.properties"); - Properties props = new Properties(); - String ext= ".txt"; - String mimeType = null; - ConverterInfo ci = this.getConverterInfo(); - Iterator<String> enumerate = ci.getDeviceMime(); - while (enumerate.hasNext()) { - mimeType= enumerate.next(); - } - try { - props.load(is); - - String info = props.getProperty(mimeType); - if (info != null) { - ext = info; - } - } catch (Exception e) { + public String getDeviceFileExtension() { + Class<? extends PluginFactoryImpl> c = this.getClass(); + InputStream is = c.getResourceAsStream("XsltPlugin.properties"); + Properties props = new Properties(); + String ext = ".txt"; + String mimeType = null; + ConverterInfo ci = this.getConverterInfo(); + Iterator<String> enumerate = ci.getDeviceMime(); + while (enumerate.hasNext()) { + mimeType = enumerate.next(); + } + try { + props.load(is); + + String info = props.getProperty(mimeType); + if (info != null) { + ext = info; + } + } catch (Exception e) { // It is okay for the property file to not exist. - - } - return ext; + } + return ext; } /** - * Returns an instance of <code>DocumentMergerImpl</code>, - * which is an implementation of the <code>DocumentMerger</code> - * interface. + * Returns an instance of {@code DocumentMergerImpl}, which is an + * implementation of the {@code DocumentMerger} interface. * - * @param doc <code>Document</code> to merge. + * @param doc {@code Document} to merge. * - * @return A DocumentMergerImpl object. + * @return A {@code DocumentMergerImpl} object. */ public DocumentMerger createDocumentMerger(Document doc) { - ConverterCapabilities cc = converterCap; + ConverterCapabilities cc = converterCap; DocumentMergerImpl merger = new DocumentMergerImpl(doc, cc); return merger; - } - -} - - - - - - - - - - - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/DiffAlgorithm.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/DiffAlgorithm.java index 00969b038e1d..a39649b03a91 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/DiffAlgorithm.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/DiffAlgorithm.java @@ -19,24 +19,25 @@ package org.openoffice.xmerge.merger; /** - * This is the difference algorithm interface. It is an interface so - * that different algorithms may be plugged-in to actually compute - * the differences. + * This is the difference algorithm interface. * - * NOTE: this code may not be thread safe. + * <p>It is an interface so that different algorithms may be plugged-in to + * actually compute the differences.</p> + * + * <p>NOTE: this code may not be thread safe.</p> */ public interface DiffAlgorithm { /** - * Returns a <code>Difference</code> array. This method finds out - * the difference between two sequences. + * Returns a {@code Difference} array. + * + * <p>This method finds out the difference between two sequences.</p> * - * @param orgSeq The original sequence of object. - * @param modSeq The modified (or changed) sequence to - * compare against with the origial. + * @param orgSeq The original sequence of object. + * @param modSeq The modified (or changed) sequence to compare against + * with the original. * - * @return A <code>Difference</code> array. + * @return A {@code Difference} array. */ Difference[] computeDiffs(Iterator orgSeq, Iterator modSeq); -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Difference.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Difference.java index feccb757a085..b24c2c78379d 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Difference.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Difference.java @@ -18,118 +18,104 @@ package org.openoffice.xmerge.merger; - /** - * This is the <code>Difference</code> basic unit. Used by the - * <code>DiffAlgorithm</code> as a set of difference between two - * <code>Iterators</code> (the original and modified - * <code>Iterators</code>). + * This is the {@code Difference} basic unit. + * + * Used by the {@code DiffAlgorithm} as a set of difference between two + * {@code Iterators} (the original and modified {@code Iterators}). */ public final class Difference { - /** - * Add operation. - */ + /** Add operation. */ public static final int ADD = 1; - /** - * Delete operation. - */ + /** Delete operation. */ public static final int DELETE = 2; - /** - * Change operation. - */ + /** Change operation. */ public static final int CHANGE = 3; - /** - * Unchange operation (i.e. no change). - */ + /** Unchange operation (i.e. no change). */ public static final int UNCHANGE = 4; - /** - * The action of the diff - either {@link #ADD} or {@link #DELETE}. - */ + /** The action of the diff - either {@link #ADD} or {@link #DELETE} */ private int operation; /** - * <p>The position of the content that should be operated on (original - * iterator).</p> - * - * <p>For ADD, the orgPosition is the position of the original sequence - * where the diff will insert (the element count is starting from 0, and - * always insert before the element). The modPosition is the position - * of the diff in the modified sequence (also starting from 0).</p> - * - * <blockquote><pre> - * example: - * - * diff - <B D>and <A B C D E F> - * note: <B D>is original sequence and <A B C D E F> - * is the modified one. - * - * and here is the position of those sequence: - * <B D> <A B C D E F> - * 0 1 0 1 2 3 4 5 - * - * result: - * <diff orgPos=0 modPos=0 operation=ADD> <-- element A - * <diff orgPos=1 modPos=2 operation=ADD> <-- element C - * <diff orgPos=2 modPos=4 operation=ADD> <-- element E - * <diff orgPos=2 modPos=5 operation=ADD> <-- element F - * - * </pre> </blockquote> - * <p>One can notice the add operation is inserted before the position. - * Hence, in order to append an element, we will have a position of - * original sequence length + 1 to denote an append.</p> - * - * <p>For DELETE, orgPosition is the position that the element - * will be deleted (starting from 0) and modPosition is the position - * where the deleted element should be (consider as an ADD).</p> - * - * <p>The modPosition is less useful and it is difficult to understand - * how the position is calculated. One can just skip this piece of - * information. It is useful if one wants to reverse the role - * of original sequence and modified sequence and find out the diff - * easily (just change add to delete and delete to add for operation - * and swap the orgPosition and modPosition).</p> - * - * <blockquote><pre> - * example: - * - * diff - <A B C D E F> and < B D> - * note: <A B C D E F> is original sequence and <B D> - * is the modified one. - * - * and here is the position of those sequence: - * <A B C D E F> <B D> - * 0 1 2 3 4 5 0 1 - * - * result: - * <diff orgPos=0 modPos=0 operation=DELETE> <-- element A - * <diff orgPos=2 modPos=1 operation=DELETE> <-- element C - * <diff orgPos=4 modPos=2 operation=DELETE> <-- element E - * <diff orgPos=5 modPos=2 operation=DELETE> <-- element F - * </pre></blockquote> + * The position of the content that should be operated on (original + * {@code iterator}). + * + * <p>For {@code ADD}, the {@code orgPosition} is the position of the + * original sequence where the diff will insert (the element count is + * starting from 0, and always insert before the element). The + * {@code modPosition} is the position of the diff in the modified sequence + * (also starting from 0).</p> + * + * <blockquote><pre>{@literal example: + * + * diff - <B D> and <A B C D E F> + * note: <B D> is original sequence and <A B C D E F> + * is the modified one. + * + * and here is the position of those sequence: + * <B D> <A B C D E F> + * 0 1 0 1 2 3 4 5 + * + * result: + * <diff orgPos=0 modPos=0 operation=ADD> <-- element A + * <diff orgPos=1 modPos=2 operation=ADD> <-- element C + * <diff orgPos=2 modPos=4 operation=ADD> <-- element E + * <diff orgPos=2 modPos=5 operation=ADD> <-- element F}</pre></blockquote> + * + * <p>One can notice the add operation is inserted before the position. + * Hence, in order to append an element, we will have a position of original + * sequence length + 1 to denote an append.</p> + * + * <p>For {@code DELETE}, {@code orgPosition} is the position that the + * element will be deleted (starting from 0) and {@code modPosition} is the + * position where the deleted element should be (consider as an {@code ADD}). + * </p> + * + * <p>The {@code modPosition} is less useful and it is difficult to + * understand how the position is calculated. One can just skip this piece + * of information. It is useful if one wants to reverse the role of original + * sequence and modified sequence and find out the diff easily (just change + * add to delete and delete to add for operation and swap the + * {@code orgPosition} and {@code modPosition}).</p> + * + * <blockquote><pre>{@literal example: + * + * diff - <A B C D E F> and <B D> + * note: <A B C D E F> is original sequence and <B D> + * is the modified one. + * + * and here is the position of those sequence: + * <A B C D E F> <B D> + * 0 1 2 3 4 5 0 1 + * + * result: + * <diff orgPos=0 modPos=0 operation=DELETE> <-- element A + * <diff orgPos=2 modPos=1 operation=DELETE> <-- element C + * <diff orgPos=4 modPos=2 operation=DELETE> <-- element E + * <diff orgPos=5 modPos=2 operation=DELETE> <-- element F}</pre></blockquote> */ private int orgPosition; /** - * The position of the content that should be operated (modified iterator). - * For explanation and examples, see {@link #orgPosition}. + * The position of the content that should be operated (modified iterator). + * + * <p>For explanation and examples, see {@link #orgPosition}</p>. */ private int modPosition; - /** - * Constructor. This is the standard way to create a - * <code>Difference</code> object. - * - * @param operation Either {@link #ADD} or {@link #DELETE}. - * @param orgPosition The position in the original (first) - * <code>Iterator</code>. - * @param modPosition The position in the modified (second) - * <code>Iterator</code>. + * Constructor. + * + * This is the standard way to create a {@code Difference} object. + * + * @param operation Either {@link #ADD} or {@link #DELETE}. + * @param orgPosition The position in the original (first) {@code Iterator}. + * @param modPosition The position in the modified (second) {@code Iterator}. */ public Difference(int operation, int orgPosition, int modPosition) { @@ -138,43 +124,42 @@ public final class Difference { this.modPosition = modPosition; } - /** - * Get the operation of the <code>Difference</code>. + * Get the operation of the {@code Difference}. * - * @return the operation of the <code>Difference</code>, - * either {@link #ADD} or {@link #DELETE} + * @return the operation of the {@code Difference}, either {@link #ADD} or + * {@link #DELETE}. */ public int getOperation() { return operation; } /** - * Get the original <code>Iterator</code> position. + * Get the original {@code Iterator} position. * - * @return The position in the original (first) <code>Iterator</code> + * @return The position in the original (first) {@code Iterator}. */ public int getOrgPosition() { return orgPosition; } /** - * Get the modified <code>Iterator</code> position. + * Get the modified {@code Iterator} position. * - * @return The position in the modified (second) <code>Iterator</code> + * @return The position in the modified (second) {@code Iterator}. */ public int getModPosition() { return modPosition; } - /** - * Two <code>Difference</code> objects will equal if and only if - * all operation, orgPosition, modPosition and content are equal. + * Two {@code Difference} objects will equal if and only if all + * {@code operation}, {@code orgPosition}, {@code modPosition} and + * {@code content} are equal. * - * @param obj Object to compare. + * @param obj {@code Object} to compare. * - * @return true if equal, false otherwise. + * @return {@code true} if equal, {@code false} otherwise. */ @Override public boolean equals(Object obj) { @@ -191,9 +176,9 @@ public final class Difference { } /** - * Display debug information. + * Display debug information. * - * @return Debug string. + * @return Debug string. */ public String debug() { @@ -220,14 +205,14 @@ public final class Difference { } /** - * Returns position and operation values as a single string. + * Returns position and operation values as a single string. * - * @return orgPosition, modPosition and operation as a single string. + * @return {@code orgPosition}, {@code modPosition} and {@code operation} + * as a single {@code String}. */ @Override public String toString() { return orgPosition + " " + modPosition + " " + operation; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Iterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Iterator.java index a2f05f7e37df..c6698283f980 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Iterator.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Iterator.java @@ -19,35 +19,33 @@ package org.openoffice.xmerge.merger; /** - * This is an interface used by the {@link - * org.openoffice.xmerge.merger.DiffAlgorithm - * DiffAlgorithm} and {@link - * org.openoffice.xmerge.merger.MergeAlgorithm - * MergeAlgorithm} to access a <code>Document</code>. + * This is an interface used by the {@link + * org.openoffice.xmerge.merger.DiffAlgorithm DiffAlgorithm} and {@link + * org.openoffice.xmerge.merger.MergeAlgorithm MergeAlgorithm} to access a + * {@code Document}. */ public interface Iterator { - /** - * Move to next element in the sequence. + * Move to next element in the sequence. * - * @return The <code>Object</code> of the next element in the sequence. - * If there is no next element, then return null. + * @return The {@code Object} of the next element in the sequence. If there + * is no next element, then return {@code null}. */ Object next(); /** * Move to the beginning of the sequence. * - * @return The <code>Object</code> of the first element in the sequence. - * If it is empty, then return null. + * @return The {@code Object} of the first element in the sequence. If it + * is empty, then return {@code null}. */ Object start(); /** - * Return the current element <code>Object</code> content. + * Return the current element {@code Object} content. * - * @return The <code>Object</code> at current position. + * @return The {@code Object} at current position. */ Object currentElement(); @@ -59,32 +57,29 @@ public interface Iterator { int elementCount(); /** - * A method to allow the difference algorithm to test whether the - * <code>obj1</code> and <code>obj2</code> in the - * <code>Iterator</code> are considered equal. As not every - * <code>Object</code> in the <code>Iterator</code> can implement its - * own equal method, with this equivalent method, we can allow - * flexibility for the <code>Iterator</code> to choose a custom way - * to compare two objects. Two objects can even be compared based on - * the position in the <code>Iterator</code> rather than by - * the content via this option. + * A method to allow the difference algorithm to test whether the {@code obj1} + * and {@code obj2} in the {@code Iterator} are considered equal. + * + * <p>As not every {@code Object} in the {@code Iterator} can implement its + * own equal method, with this equivalent method, we can allow flexibility + * for the {@code Iterator} to choose a custom way to compare two objects. + * Two objects can even be compared based on the position in the + * {@code Iterator} rather than by the content via this option. * - * @param obj1 The first <code>Object</code>. - * @param obj2 The second <code>Object</code>. + * @param obj1 The first {@code Object} + * @param obj2 The second {@code Object}. * - * @return true if equal, false otherwise. + * @return {@code true} if equal, {@code false} otherwise. */ boolean equivalent(Object obj1, Object obj2); - /** - * <p>A method to force the <code>Iterator</code> to transverse the tree - * again to refresh the content.</p> + * A method to force the {@code Iterator} to transverse the tree again to + * refresh the content. * - * <p>It is used mainly for <code>Iterator</code> objects which take a snap - * shot instead of dynamically transversing the tree. The current - * position will be set to the beginning.</p> + * <p>It is used mainly for {@code Iterator} objects which take a snap shot + * instead of dynamically transversing the tree. The current position will + * be set to the beginning.</p> */ void refresh(); -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/MergeAlgorithm.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/MergeAlgorithm.java index e4164da4b611..f74a9992b7ff 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/MergeAlgorithm.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/MergeAlgorithm.java @@ -23,25 +23,26 @@ import org.openoffice.xmerge.merger.Iterator; import org.openoffice.xmerge.merger.Difference; /** - * This is the <code>MergeAlgorithm</code> interface. It is an - * interface so that different merge algorithms may be plugged-in - * to actually merge the diffs back to an original document. + * This is the {@code MergeAlgorithm} interface. + * + * <p>It is an interface so that different merge algorithms may be plugged-in + * to actually merge the diffs back to an original document.</p> */ public interface MergeAlgorithm { /** - * This method is to merge the difference to an <code>Iterator</code>. - * The original <code>Iterator</code> will be modified after the call. + * This method is to merge the difference to an {@code Iterator}. + * + * <p>The original {@code Iterator} will be modified after the call.</p> * - * @param orgSeq The original sequence which the difference - * will be applied. It will be modified. - * @param modSeq The modified sequence where the difference - * content will be extracted. - * @param differences The <code>Difference</code> array. + * @param orgSeq The original sequence which the difference will be + * applied. It will be modified. + * @param modSeq The modified sequence where the difference content + * will be extracted. + * @param differences The {@code Difference} array. * - * @throws MergeException If an error occurs during the merge. + * @throws MergeException If an error occurs during the merge. */ void applyDifference(Iterator orgSeq, Iterator modSeq, - Difference[] differences) throws MergeException; -} - + Difference[] differences) throws MergeException; +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/NodeMergeAlgorithm.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/NodeMergeAlgorithm.java index 0cf32b2a9e2a..98a9a8bd10be 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/NodeMergeAlgorithm.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/NodeMergeAlgorithm.java @@ -21,21 +21,20 @@ package org.openoffice.xmerge.merger; import org.w3c.dom.Node; /** - * This is an interface for a {@link - * org.openoffice.xmerge.merger.MergeAlgorithm - * MergeAlgorithm} to merge two <code>Node</code> objects. It is an - * interface so that different merge algorithms may be plugged-in. + * This is an interface for a {@link org.openoffice.xmerge.merger.MergeAlgorithm + * MergeAlgorithm} to merge two {@code Node} objects. + * + * <p>It is an interface so that different merge algorithms may be plugged-in.</p> */ public interface NodeMergeAlgorithm { /** - * This method is used to merge two given <code>Node</code> - * objects. Note: the original <code>Node</code> may be modified. + * This method is used to merge two given {@code Node} objects. + * + * <p>Note: the original {@code Node} may be modified.</p> * - * @param originalNode The original <code>Node</code>. - * @param modifyNode The <code>Node</code> to be merged. It may - * be modified. + * @param originalNode The original {@code Node}. + * @param modifyNode The {@code Node} to be merged. It may be modified. */ void merge(Node originalNode, Node modifyNode); -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CellNodeIterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CellNodeIterator.java index 9e7eb332d6a5..3d2dfc144d77 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CellNodeIterator.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CellNodeIterator.java @@ -24,18 +24,17 @@ import org.w3c.dom.Element; import org.openoffice.xmerge.ConverterCapabilities; import org.openoffice.xmerge.converter.xml.OfficeConstants; - /** - * <p>This is an implementations of the <code>Iterator</code> interface. - * It will traverse the tree and find cell <code>Node</code> sequences.</p> + * This is an implementations of the {@code Iterator} interface. + * + * <p>It will traverse the tree and find cell {@code Node} sequences.</p> * - * <p>Note: Once the XML Tree is parsed, then the <code>Iterator</code> - * will be a snap shot of that tree. That means even the tree is - * modified later, than the cached paragraph <code>Node</code> list will - * not be updated accordingly. For this reason and for performance reasons - * this <code>Iterator</code> does not support any operation methods such - * as insert, remove or replace. The main purpose of this - * <code>Iterator</code> is to be used with difference, not with merge.</p> + * <p>Note: Once the XML Tree is parsed, then the {@code Iterator} will be a + * snap shot of that tree. That means even the tree is modified later, than the + * cached paragraph {@code Node} list will not be updated accordingly. For this + * reason and for performance reasons this {@code Iterator} does not support any + * operation methods such as insert, remove or replace. The main purpose of this + * {@code Iterator} is to be used with difference, not with merge.</p> */ public final class CellNodeIterator extends NodeIterator { @@ -43,23 +42,24 @@ public final class CellNodeIterator extends NodeIterator { private static final String SUPPORTED_TAG1 = OfficeConstants.TAG_TABLE_CELL; /** - * The standard constructor. + * The standard constructor. * - * @param cc The <code>ConverterCapabilities</code>. - * @param node The initial root <code>Node</code>. + * @param cc The {@code ConverterCapabilities}. + * @param node The initial root {@code Node}. */ public CellNodeIterator(ConverterCapabilities cc, Node node) { super(cc, node); } - /** - * Overwrite the parent <code>nodeSupported</code> method. Only cell - * <code>Node</code> objects are supported. + * Overwrite the parent {@code nodeSupported} method. * - * @param node The <code>Node</code> to check. + * <p>Only cell {@code Node} objects are supported.</p> * - * @return true if the <code>Node</code> is supported, false otherwise. + * @param node The {@code Node} to check. + * + * @return {@code true} if the {@code Node} is supported, {@code false} + * otherwise. */ @Override protected boolean nodeSupported(Node node) { @@ -70,7 +70,6 @@ public final class CellNodeIterator extends NodeIterator { node.getNodeName().equals(SUPPORTED_TAG1); } - @Override protected boolean childrenEqual(Node node1, Node node2) { @@ -94,5 +93,4 @@ public final class CellNodeIterator extends NodeIterator { return equal; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharArrayLCSAlgorithm.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharArrayLCSAlgorithm.java index 6f558e00bf84..1501bd3f3556 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharArrayLCSAlgorithm.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharArrayLCSAlgorithm.java @@ -22,24 +22,25 @@ import java.util.ArrayList; import org.openoffice.xmerge.merger.Difference; /** - * <p>This is an implementations of <code>DiffAlgorithm</code> interface - * which will difference char arrays.</p> + * This is an implementations of {@code DiffAlgorithm} interface which will + * difference char arrays. * - * <p>It also use Longest Common Subsequence (LCS). The algorithm is based - * on the book "Introduction to Algorithms" by Thomas H.Cormen, - * Charles E.Leiserson, and Ronald L.Riverst (MIT Press 1990) page 314.</p> + * <p>It also use Longest Common Subsequence (LCS). The algorithm is based on + * the book "Introduction to Algorithms" by Thomas H.Cormen, Charles E.Leiserson, + * and Ronald L.Riverst (MIT Press 1990) page 314.</p> */ public class CharArrayLCSAlgorithm { /** - * Return an <code>Difference</code> array. This method finds out - * the difference between two sequences. + * Return an {@code Difference} array. * - * @param orgSeq The original sequence. - * @param modSeq The modified (or changed) sequence to - * compare against the origial. + * <p>This method finds out the difference between two sequences.</p> * - * @return A <code>Difference</code> array. + * @param orgSeq The original sequence. + * @param modSeq The modified (or changed) sequence to compare against + * the original. + * + * @return A {@code Difference} array. */ public Difference[] computeDiffs(char[] orgSeq, char[] modSeq) { @@ -72,15 +73,15 @@ public class CharArrayLCSAlgorithm { } /** - * Create the difference table. - * The difference table is used internal to keep track what - * elements are common or different in the two sequences. + * Create the difference table. + * + * <p>The difference table is used internal to keep track what elements are + * common or different in the two sequences.</p> * - * @param orgSeq The original sequence to be used as a base. - * @param modSeq The modified sequence to compare. + * @param orgSeq The original sequence to be used as a base. + * @param modSeq The modified sequence to compare. * - * @return A difference table as a two-dimensional array of - * integers. + * @return A difference table as a two-dimensional array of integers. */ private int[][] createDiffTable(char[] orgSeq, char[] modSeq) { int orgSeqlen = orgSeq.length + 1; @@ -114,27 +115,25 @@ public class CharArrayLCSAlgorithm { return diffTable; } - /** - * Generate the <code>Difference</code> result vector. - * This method will be called recursively to backtrack the difference - * table to get the difference result (and also the LCS). + * Generate the {@code Difference} result vector. * - * @param diffTable The difference table containing the - * <code>Difference</code> result. - * @param i The nth element in original sequence to - * compare. This method is called recursively - * with i and j decreased until 0. - * @param j The nth element in modified sequence to - * compare. - * @param diffVector A vector to output the <code>Difference</code> - * result. Can not use a return variable as it - * is a recursive method. The vector will contain - * <code>Difference</code> objects with operation - * and positions filled in. + * <p>This method will be called recursively to backtrack the difference + * table to get the difference result (and also the LCS).</p> + * + * @param diffTable The difference table containing the {@code Difference} + * result. + * @param i The nth element in original sequence to compare. This + * method is called recursively with {@code i} and + * {@code j} decreased until {@code 0}. + * @param j The nth element in modified sequence to compare. + * @param diffVector A vector to output the {@code Difference} result. + * Can not use a return variable as it is a recursive + * method. The vector will contain {@code Difference} + * objects with operation and positions filled in. */ - private void generateResult(int[][] diffTable, - int i, int j, ArrayList<Difference> diffVector) { + private void generateResult(int[][] diffTable, int i, int j, + ArrayList<Difference> diffVector) { // handle the first element if (i == 0 || j == 0) { @@ -195,5 +194,4 @@ public class CharArrayLCSAlgorithm { } } } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharacterParser.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharacterParser.java index 258401e4135b..8b634ae821c1 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharacterParser.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharacterParser.java @@ -25,20 +25,20 @@ import org.openoffice.xmerge.converter.xml.OfficeConstants; import java.util.ArrayList; import java.util.List; - /** - * <p>This is a parser to return a character array for difference purpose. - * It will use depth first search to traverse all the characters inside the - * text <code>Node</code> under a given <code>Node</code> (most likely to be - * a paragraph <code>Node</code>).</p> + * This is a parser to return a character array for difference purpose. + * + * <p>It will use depth first search to traverse all the characters inside the + * text {@code Node} under a given {@code Node} (most likely to be a paragraph + * {@code Node}).</p> * - * <p>Note: Once the XML Tree is parsed, then the <code>Iterator</code> will be - * a snap shot of that tree. That means even the tree is modified later, than - * the cached paragraph <code>Node</code> list will not be updated accordingly. - * For this reason and for performance reasons this <code>Iterator</code> does - * not support any operation methods such as insert, remove or replace. The - * main purpose of this <code>Iterator</code> is to be used with difference, - * not with merge.</p> + * <p>Note: Once the XML Tree is parsed, then the {@code Iterator} will be a + * snap shot of that tree. That means even the tree is modified later, than + * the cached paragraph {@code Node} list will not be updated accordingly. For + * this reason and for performance reasons this {@code Iterator} does not + * support any operation methods such as insert, remove or replace. The main + * purpose of this {@code Iterator} is to be used with difference, not with + * merge.</p> */ public class CharacterParser { @@ -47,11 +47,10 @@ public class CharacterParser { private List<TextNodeEntry> nodeList_ = null; private char[] charArray; - /** - * Standard constructor. + * Standard constructor. * - * @param node The initial root <code>Node</code>. + * @param node The initial root {@code Node}. */ public CharacterParser(Node node) { textNodes = new TextNodeIterator(node); @@ -60,11 +59,10 @@ public class CharacterParser { parseNodes(); } - /** - * Returns the <code>Node</code> pointer with the given character position. + * Returns the {@code Node} pointer with the given character position. * - * @return The <code>Node</code> pointer with the given character position. + * @return The {@code Node} pointer with the given character position. */ public List<TextNodeEntry> getNodeList() { // will go through the nodeList to find the corresponding node @@ -112,20 +110,18 @@ public class CharacterParser { charArray = strBuf.toString().toCharArray(); } - /** - * Adds a new <code>Node</code> entry. + * Adds a new {@code Node} entry. * - * @param textLen The text length. - * @param node The <code>Node</code>. + * @param textLen The text length. + * @param node The {@code Node}. */ private void addNewNodeEntry(int textLen, Node node) { TextNodeEntry nodeEntry = new TextNodeEntry(currentPosition, currentPosition + textLen - 1, node); - currentPosition = currentPosition + textLen; + currentPosition = currentPosition + textLen; nodeList_.add(nodeEntry); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorLCSAlgorithm.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorLCSAlgorithm.java index c7959be59225..909b6f50d4b2 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorLCSAlgorithm.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorLCSAlgorithm.java @@ -25,10 +25,11 @@ import org.openoffice.xmerge.merger.Iterator; import org.openoffice.xmerge.util.Debug; /** - * This is one of the implementations of <code>DiffAlgorithm</code> interface. - * Using Longest Common Subsequence (LCS). The algorithm here is based - * on the book "Introduction to Algorithms" by Thomas H.Cormen, - * Charles E.Leiserson and Ronald L.Riverst (MIT Press 1990) page 314. + * This is one of the implementations of {@code DiffAlgorithm} interface. + * + * <p>Using Longest Common Subsequence (LCS). The algorithm here is based on the + * book "Introduction to Algorithms" by Thomas H.Cormen, Charles E.Leiserson and + * Ronald L.Riverst (MIT Press 1990) page 314.</p> */ public class IteratorLCSAlgorithm implements DiffAlgorithm { @@ -67,12 +68,10 @@ public class IteratorLCSAlgorithm implements DiffAlgorithm { return diffArray; } - /** - * Debug function used to print out the nicely formatted - * difference table. + * Debug function used to print out the nicely formatted difference table. * - * @param diffTable The difference table to display. + * @param diffTable The difference table to display. */ private void printDiffTable(int[][] diffTable) { @@ -88,15 +87,15 @@ public class IteratorLCSAlgorithm implements DiffAlgorithm { } /** - * Create the difference table. - * The difference table is used internal to keep track what - * elements are common or different in the two sequences. + * Create the difference table. + * + * <p>The difference table is used internal to keep track what elements are + * common or different in the two sequences.</p> * - * @param orgSeq The original sequence to be used as a base. - * @param modSeq The modified sequence to compare. + * @param orgSeq The original sequence to be used as a base. + * @param modSeq The modified sequence to compare. * - * @return A difference table as a two-dimensional array of - * integers. + * @return A difference table as a two-dimensional array of integers. */ private int[][] createDiffTable(Iterator orgSeq, Iterator modSeq) { int orgSeqlen = orgSeq.elementCount() + 1; @@ -139,24 +138,22 @@ public class IteratorLCSAlgorithm implements DiffAlgorithm { return diffTable; } - /** - * Generate the <code>Difference</code> object result vector. - * This method will be called recursively to backtrack the difference - * table to get the difference result (and also the LCS). + * Generate the {@code Difference} object result vector. + * + * <p>This method will be called recursively to backtrack the difference + * table to get the difference result (and also the LCS).</p> * - * @param diffTable The difference table containing the - * <code>Difference</code> result. - * @param i The nth element in original sequence to - * compare. This method is called recursively - * with i and j decreased until 0. - * @param j The nth element in modified sequence to - * compare. - * @param diffVector A vector to output the <code>Difference</code> - * result. Can not use a return variable as it - * is a recursive method. The vector will contain - * <code>Difference</code> objects with operation - * and positions fill in. + * @param diffTable The difference table containing the {@code Difference} + * result. + * @param i The nth element in original sequence to compare. This + * method is called recursively with {@code i} and + * {@code j} decreased until {@code 0}. + * @param j The nth element in modified sequence to compare. + * @param diffVector A vector to output the {@code Difference} result. + * Can not use a return variable as it is a recursive + * method. The vector will contain {@code Difference} + * objects with operation and positions fill in. */ private void generateResult(int[][] diffTable, int i, int j, ArrayList<Difference> diffVector) { @@ -221,5 +218,4 @@ public class IteratorLCSAlgorithm implements DiffAlgorithm { } } } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorRowCompare.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorRowCompare.java index 746709840e28..f2689d1d83a4 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorRowCompare.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorRowCompare.java @@ -28,30 +28,30 @@ import org.openoffice.xmerge.merger.Iterator; import org.openoffice.xmerge.converter.xml.OfficeConstants; /** - * A very simple and direct difference algorithm for row - * <code>Node</code> objects in a spreadsheet. + * A very simple and direct difference algorithm for row {@code Node} objects in + * a spreadsheet. * - * <p>Basically, it will compare objects in sequence and does not look ahead - * (unlike LCS).</p> + * <p>Basically, it will compare objects in sequence and does not look ahead + * (unlike LCS).</p> * - * <ol> - * <li> - * If two objects are the same, skip to next one. - * </li><li> - * Otherwise check whether the row repeated attribute is the same. - * </li><li> - * If the row repeated attribute is the same, then compare two rows - * and mark it as <i>change</i> if those rows are different. - * </li><li> - * If the row repeated attribute is different, then split the rows and - * continue to compare. - * </li><li> - * If there are more objects in the modseq than the original sequence, - * then all of the extra ones in the modified sequence are marked as add. + * <ol> + * <li> + * If two objects are the same, skip to next one. + * </li><li> + * Otherwise check whether the row repeated attribute is the same. + * </li><li> + * If the row repeated attribute is the same, then compare two rows and mark + * it as <i>change</i> if those rows are different. + * </li><li> + * If the row repeated attribute is different, then split the rows and + * continue to compare. + * </li><li> + * If there are more objects in the modseq than the original sequence, then + * all of the extra ones in the modified sequence are marked as add. * </li><li> * If there are more objects in the original sequence than the modified - * sequence, then all the extra one in the modified sequence are marked - * as delete. + * sequence, then all the extra one in the modified sequence are marked as + * delete. * </li> * </ol> * @@ -61,17 +61,18 @@ import org.openoffice.xmerge.converter.xml.OfficeConstants; public class IteratorRowCompare implements DiffAlgorithm { /** - * Compute the differences of the given two sequences. - * Refer to the class description. + * Compute the differences of the given two sequences. * - * Return an array of <code>Difference</code> objects. This method finds - * out the difference between two sequences. + * <p>Refer to the class description.</p> * - * @param orgSeq The original sequence. - * @param modSeq The modified (or changed) sequence to - * compare against with the origial. + * <p>Return an array of {@code Difference} objects. This method finds out + * the difference between two sequences.</p> * - * @return An array of Difference objects. + * @param orgSeq The original sequence. + * @param modSeq The modified (or changed) sequence to compare against + * with the original. + * + * @return An array of Difference objects. */ public Difference[] computeDiffs(Iterator orgSeq, Iterator modSeq) { @@ -190,7 +191,6 @@ public class IteratorRowCompare implements DiffAlgorithm { modSeq.refresh(); } - // convert the vector to array Difference[] diffArray = new Difference[diffVector.size()]; diffVector.toArray(diffArray); @@ -198,7 +198,6 @@ public class IteratorRowCompare implements DiffAlgorithm { return diffArray; } - private Element splitRepeatedRow(Element orgRow, int splitNum, int orgNum) { // NOTE: should we really want to do deep clone? // in most the case, it is an empty Row, but the @@ -229,5 +228,4 @@ public class IteratorRowCompare implements DiffAlgorithm { return splitRow; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/NodeIterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/NodeIterator.java index 5a27ff05fa71..ed34c337f1ac 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/NodeIterator.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/NodeIterator.java @@ -29,18 +29,17 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; - /** - * <p>This is an implementation of the <code>Iterator</code> interface. - * It will traverse the tree and find <code>Node</code> sequences.</p> + * This is an implementation of the {@code Iterator} interface. + * + * <p>It will traverse the tree and find {@code Node} sequences.</p> * - * <p>Note: Once the XML Tree is parsed, then the <code>Iterator</code> will - * be a snap shot of that tree. That means even the tree is modified later, - * than the cached paragraph <code>Node</code> list will not be updated - * accordingly. For this reason and for performance reasons this - * <code>Iterator</code> does not support any operation methods such as - * insert, remove or replace. The main purpose of this - * <code>Iterator</code> is to be used with difference, not with merge.</p> + * <p>Note: Once the XML Tree is parsed, then the {@code Iterator} will be a + * snap shot of that tree. That means even the tree is modified later, than the + * cached paragraph {@code Node} list will not be updated accordingly. For this + * reason and for performance reasons this {@code Iterator} does not support any + * operation methods such as insert, remove or replace. The main purpose of this + * {@code Iterator} is to be used with difference, not with merge.</p> */ public abstract class NodeIterator implements Iterator { @@ -49,12 +48,11 @@ public abstract class NodeIterator implements Iterator { private Node root; private ConverterCapabilities cc_ = null; - /** - * Standard constructor. + * Standard constructor. * - * @param cc The <code>ConverterCapabilities</code>. - * @param node The initial root <code>Node</code>. + * @param cc The {@code ConverterCapabilities}. + * @param node The initial root {@code Node}. */ public NodeIterator(ConverterCapabilities cc, Node node) { cc_ = cc; @@ -63,7 +61,6 @@ public abstract class NodeIterator implements Iterator { markTree(node); } - public Object next() { if (currentPosition < nodeList.size() - 1) { currentPosition++; @@ -73,7 +70,6 @@ public abstract class NodeIterator implements Iterator { } } - public Object previous() { if (currentPosition > 0) { currentPosition--; @@ -83,13 +79,11 @@ public abstract class NodeIterator implements Iterator { } } - public Object start() { currentPosition = 0; return currentElement(); } - public Object end() { int size = nodeList.size(); @@ -101,22 +95,17 @@ public abstract class NodeIterator implements Iterator { } } - public Object currentElement() { - if (currentPosition < 0 || currentPosition >= nodeList.size()) { return null; } - return nodeList.get(currentPosition); } - public int elementCount() { return nodeList.size(); } - public boolean equivalent(Object obj1, Object obj2) { boolean equal = false; if (!(obj1 instanceof Node && obj2 instanceof Node)) { @@ -131,22 +120,20 @@ public abstract class NodeIterator implements Iterator { return equal; } - public void refresh() { nodeList = new ArrayList<Node>(); markTree(root); currentPosition = 0; } - /** - * Used to compare two <code>Node</code> objects (type/name/value) - * and all their children <code>Node</code> objects. + * Used to compare two {@code Node} objects (type/name/value) and all their + * children {@code Node} objects. * - * @param node1 The first <code>Node</code> to compare. - * @param node2 The second <code>Node</code> to compare. + * @param node1 The first {@code Node} to compare. + * @param node2 The second {@code Node} to compare. * - * @return true if <code>Node</code> is equal, false otherwise. + * @return {@code true} if {@code Node} is equal, {@code false} otherwise. */ protected boolean compareNode(Node node1, Node node2) { boolean equal = false; @@ -201,17 +188,17 @@ public abstract class NodeIterator implements Iterator { return equal; } - /** - * Compare the children of two <code>Node</code> objects. This - * method can be intentionally overridden by any class that - * extend from <code>NodeIterator</code> so that it can have - * its own children comparison if necessary. + * Compare the children of two {@code Node} objects. + * + * <p>This method can be intentionally overridden by any class that extend + * from {@code NodeIterator} so that it can have its own children comparison + * if necessary.</p> * - * @param node1 The first <code>Node</code> to compare. - * @param node2 The second <code>Node</code> to compare. + * @param node1 The first {@code Node} to compare. + * @param node2 The second {@code Node} to compare. * - * @return true if children are equal, false otherwise. + * @return {@code true} if children are equal, {@code false} otherwise. */ protected boolean childrenEqual(Node node1, Node node2) { @@ -244,17 +231,17 @@ public abstract class NodeIterator implements Iterator { return equal; } - /** - * Compare attributes of two <code>Node</code> objects. This - * method can be intentionally overridden by any class that - * extends from <code>NodeIterator</code> so that it can have - * its own attribute comparison. + * Compare attributes of two {@code Node} objects. + * + * <p>This method can be intentionally overridden by any class that extends + * from {@code NodeIterator} so that it can have its own attribute comparison. + * </p> * - * @param node1 The first <code>Node</code> to compare. - * @param node2 The second <code>Node</code> to compare. + * @param node1 The first {@code Node} to compare. + * @param node2 The second {@code Node} to compare. * - * @return true if attributes are equal, false otherwise. + * @return {@code true} if attributes are equal, {@code false} otherwise. */ private boolean attributesEqual(Node node1, Node node2) { @@ -264,7 +251,7 @@ public abstract class NodeIterator implements Iterator { attrNode[0] = node1.getAttributes(); attrNode[1] = node2.getAttributes(); - // attribute node will be null if node is not an element node + // Attribute node will be null if node is not an element node // and attribute nodes are equal if both are not element node if (attrNode[0] == null || attrNode[1] == null) { if (attrNode[0] == null && attrNode[1] == null) { @@ -273,7 +260,7 @@ public abstract class NodeIterator implements Iterator { return equal; } - // compare the attributes from node1 vs node2 and node2 vs node1 + // Compare the attributes from node1 vs node2 and node2 vs node1 // though it's a little inefficient for the duplication of comparison // as the number of attributes is not so many, it should not be // a big problem. @@ -331,16 +318,17 @@ public abstract class NodeIterator implements Iterator { return equal; } - /** - * Check whether a <code>Node</code> is supported. This method - * can be intentionally overridden by any class that extends from - * <code>NodeIterator</code> so that it can specify which - * <code>Node</code> to support. + * Check whether a {@code Node} is supported. * - * @param node <code>Node</code> to check. + * <p>This method can be intentionally overridden by any class that extends + * from {@code NodeIterator} so that it can specify which {@code Node} to + * support.</p> * - * @return true if <code>Node</code> is supported, false otherwise. + * @param node {@code Node} to check. + * + * @return {@code true} if <code>Node</code> is supported, {@code false} + * otherwise. */ protected abstract boolean nodeSupported(Node node); @@ -367,5 +355,4 @@ public abstract class NodeIterator implements Iterator { } } } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ObjectArrayIterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ObjectArrayIterator.java index 9854d16a0b8a..ecfe89786c0d 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ObjectArrayIterator.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ObjectArrayIterator.java @@ -21,25 +21,22 @@ package org.openoffice.xmerge.merger.diff; import org.openoffice.xmerge.merger.Iterator; /** - * <p>This is an implementation of the <code>Iterator</code> interface. - * It is based upon a simple <code>Object</code> array.</p> + * This is an implementation of the {@code Iterator} interface. + * + * <p>It is based upon a simple {@code Object} array.</p> * * <p>Note: this class is not thread safe for performance reasons.</p> */ public final class ObjectArrayIterator implements Iterator { - - /** - * The <code>Object</code> array. - */ + /** The {@code Object} array. */ private Object [] objArray; private int currentPosition; - /** - * Standard constructor. + * Standard constructor. * - * @param objArray The <code>Object</code> array. + * @param objArray The {@code Object} array. */ public ObjectArrayIterator(Object [] objArray) { if (objArray != null) { @@ -51,7 +48,6 @@ public final class ObjectArrayIterator implements Iterator { } } - public Object next() { if (currentPosition < objArray.length - 1) { currentPosition++; @@ -59,10 +55,8 @@ public final class ObjectArrayIterator implements Iterator { } else { return null; } - } - public Object previous() { if (currentPosition > 0) { currentPosition--; @@ -72,13 +66,11 @@ public final class ObjectArrayIterator implements Iterator { } } - public Object start() { currentPosition = 0; return currentElement(); } - public Object end() { if (objArray.length > 0) { currentPosition = objArray.length - 1; @@ -86,7 +78,6 @@ public final class ObjectArrayIterator implements Iterator { return currentElement(); } - public Object currentElement() { if (objArray.length > 0) { return objArray[currentPosition]; @@ -95,21 +86,19 @@ public final class ObjectArrayIterator implements Iterator { } } - /** - * Replace current <code>Object</code>. + * Replace current {@code Object}. * - * @param object <code>Object</code> to replace. + * @param object {@code Object} to replace. */ public void replace(Object object) { objArray[currentPosition] = object; } - /** - * Insert <code>Object</code> after current <code>Object</code>. + * Insert {@code Object} after current {@code Object}. * - * @param object <code>Object</code> to insert. + * @param object {@code Object} to insert. */ public void insert(Object object) { Object [] objArray2 = new Object[objArray.length+1]; @@ -130,9 +119,9 @@ public final class ObjectArrayIterator implements Iterator { } /** - * Append <code>Object</code> after current <code>Object</code>. + * Append {@code Object} after current {@code Object}. * - * @param object <code>Object</code> to append. + * @param object {@code Object} to append. */ public void append(Object object) { Object [] objArray2 = new Object[objArray.length + 1]; @@ -154,7 +143,7 @@ public final class ObjectArrayIterator implements Iterator { } /** - * Remove current <code>Object</code>. + * Remove current {@code Object}. */ public void remove() { Object [] objArray2 = new Object[objArray.length - 1]; @@ -187,5 +176,4 @@ public final class ObjectArrayIterator implements Iterator { public void refresh() { // do nothing } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ParaNodeIterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ParaNodeIterator.java index a5e8b9e6ff7e..2a1b4d22cb32 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ParaNodeIterator.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ParaNodeIterator.java @@ -23,19 +23,18 @@ import org.w3c.dom.Node; import org.openoffice.xmerge.ConverterCapabilities; import org.openoffice.xmerge.converter.xml.OfficeConstants; - /** - * <p>This is an implementation of the <code>Iterator</code> interface. - * It will traverse the tree and find the Paragraph/Heading <code>Node</code> - * sequences.</p> + * This is an implementation of the {@code Iterator} interface. + * + * <p>It will traverse the tree and find the Paragraph/Heading {@code Node} + * sequences.</p> * - * <p>Note: Once the XML Tree is parsed, then the <code>Iterator</code> will - * be a snap shot of that tree. That means even the tree is modified later, - * than the cached paragraph <code>Node</code> list will not be updated - * accordingly. For this reason and for performance reasons this - * <code>Iterator</code> does not support any operation methods such as - * insert, remove or replace. The main purpose of this - * <code>Iterator</code> is to be used with difference, not with merge.</p> + * <p>Note: Once the XML Tree is parsed, then the {@code Iterator} will be a + * snap shot of that tree. That means even the tree is modified later, than the + * cached paragraph {@code Node} list will not be updated accordingly. For this + * reason and for performance reasons this {@code Iterator} does not support any + * operation methods such as insert, remove or replace. The main purpose of this + * {@code Iterator} is to be used with difference, not with merge.</p> */ public final class ParaNodeIterator extends NodeIterator { @@ -44,33 +43,30 @@ public final class ParaNodeIterator extends NodeIterator { private static final String SUPPORTED_TAG2 = OfficeConstants.TAG_HEADING; /** - * Standard constructor. + * Standard constructor. * - * @param cc The <code>ConverterCapabilities</code>. - * @param node The initial root <code>Node</code>. + * @param cc The {@code ConverterCapabilities}. + * @param node The initial root {@code Node}. */ public ParaNodeIterator(ConverterCapabilities cc, Node node) { // not using convertercapabilities unless it's needed in future. super(cc, node); } - /** - * Overwrite the parent <code>nodeSupported</code> method. + * Overwrite the parent <code>nodeSupported</code> method. * - * @param node <code>Node</code> to check. + * @param node {@code Node} to check. * - * @return true if the <code>Node</code> is supported, false - * otherwise. + * @return {@code true} if the {@code Node} is supported, {@code false} + * otherwise. */ @Override protected boolean nodeSupported(Node node) { - // can use an array later to check all possible tags for // future expansion return node.getNodeType() == Node.ELEMENT_NODE && (node.getNodeName().equals(SUPPORTED_TAG1) || node.getNodeName().equals(SUPPORTED_TAG2)); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/RowIterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/RowIterator.java index 9425d4c1bb70..7d84f7a7812b 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/RowIterator.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/RowIterator.java @@ -23,10 +23,11 @@ import org.w3c.dom.Node; import org.openoffice.xmerge.ConverterCapabilities; import org.openoffice.xmerge.converter.xml.OfficeConstants; - /** - * This is an implementation of the <code>Iterator</code> interface and extends - * <code>NodeIterator</code>. It will traverse the tree and find row sequences. + * This is an implementation of the {@code Iterator} interface and extends + * {@code NodeIterator}. + * + * <p>It will traverse the tree and find row sequences.</p> */ public final class RowIterator extends NodeIterator { @@ -35,22 +36,24 @@ public final class RowIterator extends NodeIterator { // considered to be not equivalent. /** - * Standard constructor. + * Standard constructor. * - * @param cc The <code>ConverterCapabilities</code>. - * @param node The initial root <code>Node</code>. + * @param cc The {@code ConverterCapabilities}. + * @param node The initial root {@code Node}. */ public RowIterator(ConverterCapabilities cc, Node node) { super(cc, node); } /** - * Overwrite the parent <code>nodeSupported</code> method. Only - * row <code>Node</code> objects are supported. + * Overwrite the parent {@code nodeSupported} method. * - * @param node <code>Node</code> to check. + * <p>Only row {@code Node} objects are supported.</p> * - * @return true if the <code>Node</code> is supported, false otherwise. + * @param node {@code Node} to check. + * + * @return {@code true} if the {@code Node} is supported, {@code false} + * otherwise. */ @Override protected boolean nodeSupported(Node node) { @@ -60,5 +63,4 @@ public final class RowIterator extends NodeIterator { return node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals(OfficeConstants.TAG_TABLE_ROW); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeEntry.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeEntry.java index d20a0055e9c3..ebe234fdadf7 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeEntry.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeEntry.java @@ -21,10 +21,11 @@ package org.openoffice.xmerge.merger.diff; import org.w3c.dom.Node; /** - * A small class to hold the start/end character position and the - * <code>Node</code> pointer in a text <code>Node</code>. It is - * mainly used for character parser to make a list of text - * <code>Node</code> cache entries. + * A small class to hold the start/end character position and the {@code Node} + * pointer in a text {@code Node}. + * + * <p>It is mainly used for character parser to make a list of text {@code Node} + * cache entries.</p> */ public class TextNodeEntry { @@ -33,11 +34,11 @@ public class TextNodeEntry { private Node node_; /** - * Constructor + * Constructor * - * @param startChar The start character position. - * @param endChar The end character position. - * @param node The text <code>Node</code>. + * @param startChar The start character position. + * @param endChar The end character position. + * @param node The text {@code Node}. */ public TextNodeEntry(int startChar, int endChar, Node node) { startChar_ = startChar; @@ -46,32 +47,29 @@ public class TextNodeEntry { } /** - * Returns the start character. + * Returns the start character. * - * @return The start character. + * @return The start character. */ public int startChar() { return startChar_; } - /** - * Returns the end character. + * Returns the end character. * - * @return The end character. + * @return The end character. */ public int endChar() { return endChar_; } - /** - * Returns the <code>Node</code>. + * Returns the {@code Node}. * - * @return The <code>Node</code>. + * @return The {@code Node}. */ public Node node() { return node_; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeIterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeIterator.java index 791122c398dc..fa7c6086c36b 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeIterator.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeIterator.java @@ -22,43 +22,42 @@ import org.w3c.dom.Node; import org.openoffice.xmerge.converter.xml.OfficeConstants; - /** - * <p>This is an implementation of the <code>Iterator</code> interface. - * It will traverse the tree and find text/space/tab <code>Node</code> - * sequences.</p> + * This is an implementation of the {@code Iterator} interface. + * + * <p>It will traverse the tree and find text/space/tab {@code Node} sequences. + * </p> * - * <p>Note: Once the XML Tree is parsed, then the <code>Iterator</code> - * will be a snap shot of that tree. That means even the tree is modified - * later, than the cached paragraph <code>Node</code> list will not be - * updated accordingly. For this reason and for performance reasons - * this <code>Iterator</code> does not support any operation methods - * such as insert, remove or replace. The main purpose of this - * <code>Iterator</code> is to be used with difference, not with merge.</p> + * <p>Note: Once the XML Tree is parsed, then the {@code Iterator} will be a + * snap shot of that tree. That means even the tree is modified later, than the + * cached paragraph {@code Node} list will not be updated accordingly. For this + * reason and for performance reasons this {@code Iterator} does not support + * any operation methods such as insert, remove or replace. The main purpose of + * this {@code Iterator} is to be used with difference, not with merge.</p> */ public final class TextNodeIterator extends NodeIterator { /** - * Standard constructor. + * Standard constructor. * - * @param node The initial root <code>Node</code>. + * @param node The initial root {@code Node}. */ public TextNodeIterator(Node node) { super(null, node); } /** - * Overwrite the parent <code>nodeSupported</code> method. Only text - * <code>Node</code> objects are supported. + * Overwrite the parent {@code nodeSupported} method. + * + * <p>Only text {@code Node} objects are supported.</p> * - * @param node <code>Node</code> to check. + * @param node {@code Node} to check. * - * @return true if the <code>Node</code> is supported, false - * otherwise. + * @return {@code true} if the {@code Node} is supported, {@code false} + * otherwise. */ @Override protected boolean nodeSupported(Node node) { - // can use an array later to check all possible tags for // future expansion return node.getNodeType() == Node.TEXT_NODE || @@ -66,5 +65,4 @@ public final class TextNodeIterator extends NodeIterator { node.getNodeName().equals(OfficeConstants.TAG_TAB_STOP) || node.getNodeName().equals(OfficeConstants.TAG_LINE_BREAK); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/CharacterBaseParagraphMerge.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/CharacterBaseParagraphMerge.java index 0b48d7a78655..8f656337e635 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/CharacterBaseParagraphMerge.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/CharacterBaseParagraphMerge.java @@ -28,23 +28,21 @@ import org.openoffice.xmerge.merger.diff.TextNodeEntry; import org.openoffice.xmerge.util.Debug; /** - * This is an implementation of the <code>NodeMergeAlgorithm</code> - * interface. It is used to merge two paragraph <code>Node</code> - * objects based on character comparisons. + * This is an implementation of the {@code NodeMergeAlgorithm} interface. + * + * <p>It is used to merge two paragraph {@code Node} objects based on character + * comparisons.</p> */ -public final class CharacterBaseParagraphMerge - implements NodeMergeAlgorithm { - - +public final class CharacterBaseParagraphMerge implements NodeMergeAlgorithm { /** - * Merge two paragraph <code>Node</code> by using Longest Common - * Subsequence (LCS) character algorithm defined in {@link - * org.openoffice.xmerge.merger.diff.CharArrayLCSAlgorithm - * CharArrayLCSAlgorithm} + * Merge two paragraph {@code Node} by using Longest Common Subsequence + * (LCS) character algorithm defined in {@link + * org.openoffice.xmerge.merger.diff.CharArrayLCSAlgorithm + * CharArrayLCSAlgorithm}. * - * @param orgPara The original paragraph <code>Node</code>. - * @param modPara The modified paragraph <code>Node</code>. + * @param orgPara The original paragraph {@code Node}. + * @param modPara The modified paragraph {@code Node}. */ public void merge(Node orgPara, Node modPara) { CharacterParser orgParser = new CharacterParser(orgPara); @@ -66,7 +64,6 @@ public final class CharacterBaseParagraphMerge applyDifference(orgParser, modParser, diffResult); } - private void applyDifference(CharacterParser orgParser, CharacterParser modParser, Difference[] diffs) { @@ -135,15 +132,14 @@ public final class CharacterBaseParagraphMerge } private void coreMerge(int startDiffNum, int endDiffNum, Difference[] diffs, - CharacterParser modParser, - TextNodeEntry orgTextNode, int extraChar) { + CharacterParser modParser, + TextNodeEntry orgTextNode, int extraChar) { Node orgNode = orgTextNode.node(); char[] modTextArray = modParser.getCharArray(); String tmpString; // Handle situation where getNodeValue returns null - if (orgNode.getNodeValue() != null) tmpString = orgNode.getNodeValue(); else @@ -167,11 +163,9 @@ public final class CharacterBaseParagraphMerge int lastDiffPosition = -1; // starting to diff - for (int j = startDiffNum; j < endDiffNum; j++) { // copy any contents before the diff - if (diffs[j].getOrgPosition() > orgTextPosition) { // need to flush first if (cacheLength > 0) { @@ -199,7 +193,6 @@ public final class CharacterBaseParagraphMerge // for any deleted characters, just skip without copy // but still need to take care the cached characters - if (diffs[j].getOperation() == Difference.DELETE) { orgTextPosition++; @@ -217,7 +210,6 @@ public final class CharacterBaseParagraphMerge continue; - // check whether we should flush the cache. // For changed diffs, only continuous changes can be cached // For Add diffs, only same insertion point can be cached @@ -288,5 +280,4 @@ public final class CharacterBaseParagraphMerge orgNode.setNodeValue(newString); } } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/DocumentMerge.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/DocumentMerge.java index a17aae751087..1d37e4cabd5f 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/DocumentMerge.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/DocumentMerge.java @@ -30,11 +30,12 @@ import org.openoffice.xmerge.merger.Difference; import org.openoffice.xmerge.util.XmlUtil; /** - * This is an implementation of the <code>MergeAlgorithm</code> interface. - * This class will merge two <code>Document</code> classes. It utilizes the + * This is an implementation of the {@code MergeAlgorithm} interface. + * + * <p>This class will merge two {@code Document} classes. It utilizes the * appropriate class which implements {@link - * org.openoffice.xmerge.merger.NodeMergeAlgorithm - * NodeMergeAlgorithm} to perform the merge. + * org.openoffice.xmerge.merger.NodeMergeAlgorithm NodeMergeAlgorithm} to + * perform the merge.</p> */ public class DocumentMerge implements MergeAlgorithm { @@ -43,23 +44,20 @@ public class DocumentMerge implements MergeAlgorithm { /** The capabilities of this converter. */ protected ConverterCapabilities cc_; - /** - * Constructor + * Constructor. * - * @param cc The <code>ConverterCapabilities</code>. - * @param merge The <code>NodeMergeAlgorithm</code>. + * @param cc The {@code ConverterCapabilities}. + * @param merge The {@code NodeMergeAlgorithm}. */ public DocumentMerge(ConverterCapabilities cc, NodeMergeAlgorithm merge) { cc_ = cc; subDocumentMerge = merge; } - public void applyDifference(Iterator orgSeq, Iterator modSeq, Difference[] differences) throws MergeException { - // a quick test whether the differences array is in ascending order int currentPosition = -1; boolean haveDeleteOperation = false; @@ -170,11 +168,10 @@ public class DocumentMerge implements MergeAlgorithm { } } - /** - * Removes the specified <code>Node</code>. + * Removes the specified {@code Node}. * - * @param node <code>Node</code> to remove. + * @param node {@code Node} to remove. */ protected void removeNode(Node node) { @@ -183,10 +180,10 @@ public class DocumentMerge implements MergeAlgorithm { } /** - * Appends <code>Node</code> after the specified <code>Node</code>. + * Appends {@code Node} after the specified {@code Node}. * - * @param oldNode <code>Node</code> to append after. - * @param newNode <code>Node</code> to append. + * @param oldNode {@code Node} to append after. + * @param newNode {@code Node} to append. */ private void appendNode(Node oldNode, Node newNode) { Node clonedNode = XmlUtil.deepClone(oldNode, newNode); @@ -194,12 +191,11 @@ public class DocumentMerge implements MergeAlgorithm { parent.appendChild(clonedNode); } - /** - * Insert <code>Node</code> before the specified <code>Node</code>. + * Insert {@code Node} before the specified {@code Node}. * - * @param oldNode <code>Node</code> to insert before. - * @param newNode <code>Node</code> to insert. + * @param oldNode {@code Node} to insert before. + * @param newNode {@code Node} to insert. */ private void insertNode(Node oldNode, Node newNode) { Node clonedNode = XmlUtil.deepClone(oldNode, newNode); @@ -207,12 +203,11 @@ public class DocumentMerge implements MergeAlgorithm { parent.insertBefore(clonedNode, oldNode); } - /** - * Replace <code>Element</code>. + * Replace <code>Element</code>. * - * @param currElem <code>Element</code> to be replaced. - * @param newElem <code>Element</code> to replace. + * @param currElem {@code Element} to be replaced. + * @param newElem {@code Element} to replace. */ private void replaceElement(Element currElem, Element newElem) { @@ -220,5 +215,4 @@ public class DocumentMerge implements MergeAlgorithm { Node parent = currElem.getParentNode(); parent.replaceChild(clonedNode, currElem); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/PositionBaseRowMerge.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/PositionBaseRowMerge.java index 144c658a2dca..b3bff5b1d81b 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/PositionBaseRowMerge.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/PositionBaseRowMerge.java @@ -30,28 +30,26 @@ import org.openoffice.xmerge.merger.diff.CellNodeIterator; import org.openoffice.xmerge.converter.xml.OfficeConstants; import org.openoffice.xmerge.util.XmlUtil; - /** - * This is an implementation of the <code>NodeMergeAlgorithm</code> - * interface. It is used to merge two rows using a positional - * comparison base method. + * This is an implementation of the {@code NodeMergeAlgorithm} interface. + * + * <p>It is used to merge two rows using a positional comparison base method. + * </p> */ public final class PositionBaseRowMerge implements NodeMergeAlgorithm { - /** The capabilities of this converter. */ + /** The capabilities of this converter. */ private ConverterCapabilities cc_; - /** - * Constructor. + * Constructor. * - * @param cc The <code>ConverterCapabilities</code>. + * @param cc The {@code ConverterCapabilities}. */ public PositionBaseRowMerge(ConverterCapabilities cc) { cc_ = cc; } - public void merge(Node orgRow, Node modRow) { Iterator orgCells = new CellNodeIterator(cc_, orgRow); @@ -60,7 +58,6 @@ public final class PositionBaseRowMerge implements NodeMergeAlgorithm { mergeCellSequences(orgCells, modCells); } - // used to compare the cell 1 by 1 private void mergeCellSequences(Iterator orgSeq, Iterator modSeq) { @@ -72,7 +69,6 @@ public final class PositionBaseRowMerge implements NodeMergeAlgorithm { while (orgSeqObject != null) { - needMerge = true; if (modSeqObject == null) { @@ -163,9 +159,8 @@ public final class PositionBaseRowMerge implements NodeMergeAlgorithm { } } - - private Element splitColRepeatedCell(Element orgCell, - int splitNum, int orgNum) { + private Element splitColRepeatedCell(Element orgCell, int splitNum, + int orgNum) { // NOTE: should we really want to do deep clone? // in most the case, it is an empty cell, but the // specification didn't forbid any node to use multiple @@ -196,7 +191,6 @@ public final class PositionBaseRowMerge implements NodeMergeAlgorithm { return splitCell; } - private void mergeCells(Element orgCell, Element modCell) { // remove all the supported attributes and possible text child for @@ -247,5 +241,4 @@ public final class PositionBaseRowMerge implements NodeMergeAlgorithm { } } } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/SheetMerge.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/SheetMerge.java index 60e19e3d6712..f21be1591543 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/SheetMerge.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/SheetMerge.java @@ -25,43 +25,41 @@ import org.openoffice.xmerge.ConverterCapabilities; import org.openoffice.xmerge.merger.NodeMergeAlgorithm; /** - * This class extends the <code>DocumentMerge</code> class. - * This class will merge two spreadsheet documents. - * The main difference between this implementation and - * <code>DocumentMerge</code> - * is that this merge will try to maintain unsupported features by - * examining the cell <code>node</code> objects one by one when it - * removes a node from the original <code>Iterator</code>. + * This class extends the {@code DocumentMerge} class. + * + * <p>This class will merge two spreadsheet documents.</p> + * + * <p>The main difference between this implementation and {@code DocumentMerge} + * is that this merge will try to maintain unsupported features by examining the + * cell {@code node} objects one by one when it removes a node from the original + * {@code Iterator}.</p> */ public final class SheetMerge extends DocumentMerge { /** - * Constructor. + * Constructor. * - * @param cc The <code>ConverterCapabilities</code>. - * @param merge The <code>NodeMergeAlgorithm</code>. + * @param cc The {@code ConverterCapabilities}. + * @param merge The {@code NodeMergeAlgorithm}. */ public SheetMerge(ConverterCapabilities cc, NodeMergeAlgorithm merge) { super(cc, merge); } - /** - * Remove specified <code>Node</code>. + * Remove specified {@code Node}. * - * @param node <code>Node</code> to remove. + * @param node {@code Node} to remove. */ @Override protected void removeNode(Node node) { - clearRow(node); } - /** - * Clear the row corresponding to the <code>Node</code> + * Clear the row corresponding to the {@code Node}. * - * @param node <code>Node</code> containing the row to clear. + * @param node {@code Node} containing the row to clear. */ private void clearRow(Node node) { NodeList children = node.getChildNodes(); @@ -75,5 +73,4 @@ public final class SheetMerge extends DocumentMerge { SheetUtil.emptyCell(cc_, children.item(i)); } } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/SheetUtil.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/SheetUtil.java index cbad7ccfdb61..2f5a8ebe9bb8 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/SheetUtil.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/SheetUtil.java @@ -26,27 +26,26 @@ import org.w3c.dom.NamedNodeMap; import org.openoffice.xmerge.ConverterCapabilities; import org.openoffice.xmerge.converter.xml.OfficeConstants; - /** - * Utility methods to handle sheet XML tree. + * Utility methods to handle sheet XML tree. */ public class SheetUtil { /** - * Empty the content of a cell value. + * Empty the content of a cell value. * - * <p>This includes the following:</p> + * <p>This includes the following:</p> * - * <ul> - * <li> - * Remove all of the supported attributes. - * </li><li> - * Remove the first <i>text:p</i> <code>Node</code> for most of the cells. - * </li> - * </ul> + * <ul> + * <li> + * Remove all of the supported attributes. + * </li><li> + * Remove the first <i>text:p</i> {@code Node} for most of the cells. + * </li> + * </ul> * - * @param cc The <code>ConverterCapabilities</code>. - * @param node The <code>Node</code>. + * @param cc The {@code ConverterCapabilities}. + * @param node The {@code Node}. */ public static void emptyCell(ConverterCapabilities cc, Node node) { @@ -97,5 +96,4 @@ public class SheetUtil { } } } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/ConverterInfoList.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/ConverterInfoList.java index f71dbe5bc80a..a68fa4666e02 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/ConverterInfoList.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/ConverterInfoList.java @@ -26,22 +26,20 @@ import java.util.Iterator; import java.util.Properties; /** - * Loads a properties file so that registry knows which plug-ins - * it needs to load. - * + * Loads a properties file so that registry knows which plug-ins it needs to + * load. */ public class ConverterInfoList { - private static String defaultPropsFile = "ConverterInfoList.properties"; - - private ArrayList<String> jars; - private Properties props = null; - + private static String defaultPropsFile = "ConverterInfoList.properties"; + private ArrayList<String> jars; + private Properties props = null; /** - * This constructor loads and reads the default properties file. - * The default property file name is: - * "ConverterInfoList.properties". + * This constructor loads and reads the default properties file. + * + * <p>The default property file name is: + * {@literal "ConverterInfoList.properties"}. * * @throws IOException If any I/O error occurs. */ @@ -50,15 +48,15 @@ public class ConverterInfoList { } /** - * This constructor loads and reads the properties file. + * This constructor loads and reads the properties file. * - * @param propsFile The properties file to load. + * @param propsFile The properties file to load. * - * @throws IOException If any I/O error occurs. + * @throws IOException If any I/O error occurs. */ public ConverterInfoList(String propsFile) throws IOException { - Class<? extends ConverterInfoList> c = this.getClass(); + Class<? extends ConverterInfoList> c = this.getClass(); InputStream is = c.getResourceAsStream(propsFile); BufferedInputStream bis = new BufferedInputStream(is); props = new Properties(); @@ -75,21 +73,17 @@ public class ConverterInfoList { } } - /** - * Returns a <code>Vector</code> containing a list of - * <code>String</code> objects. Each <code>String</code> - * describes a plug-in to be loaded into the registry. + * Returns an {@code Iterator} of {@code String} objects. * + * <p>Each {@code String} describes a plug-in to be loaded into the registry. * - * @return A <code>Vector</code> containing a list of - * <code>String</code> objects. Each - * <code>String</code> describes a plug-in to be - * loaded into the registry. + * @return An {@code Iterator} of {@code String} objects. + * Each {@code String} describes a plug-in to be loaded into the + * registry. */ public Iterator<String> getJarFileEnum() { return jars.iterator(); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java index a527556a288c..c90e5ea5df40 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java @@ -34,41 +34,39 @@ import org.openoffice.xmerge.util.registry.ConverterInfoMgr; import org.openoffice.xmerge.util.registry.ConverterInfoReader; /** - * This class is a command-line driver for the converter framework. - * It is expected that this code will be later called by the device - * server. It does some basic validation of the command-line - * parameters. + * This class is a command-line driver for the converter framework. + * + * <p>It is expected that this code will be later called by the device server. + * It does some basic validation of the command-line parameters.</p> */ public final class Driver { - /** Command-line parameter. */ + /** Command-line parameter. */ private String fromMime = null; - /** Command-line parameter. */ + /** Command-line parameter. */ private String toMime = null; - /** mergeFile name. */ + /** {@code mergeFile} name. */ private String mergeFile = null; - /** Command-line parmeter. */ + /** Command-line parmeter. */ private ArrayList<String> deviceFiles = new ArrayList<String>(); - /** Command-line parmeter shortcuts. */ + /** Command-line parmeter shortcuts. */ private String mimeTypes[] = { "sxc", "staroffice/sxc", "sxw","staroffice/sxw" }; - /** - * Main. + * Main. * - * @param args The argument passed on the command line. + * @param args The argument passed on the command line. */ public static void main(String args[]) { // Register jarfiles - String propFile = "ConverterInfoList.properties"; ConverterInfoList cil = null; try { @@ -113,13 +111,11 @@ public final class Driver { } } - /** - * Gets a <code>Convert</code> object using the - * <code>ConverterFactory</code> and does the conversion using - * this object. + * Gets a {@code Convert} object using the {@code ConverterFactory} and does + * the conversion using this object. * - * @throws IllegalArgumentException If an argument is invalid. + * @throws IllegalArgumentException If an argument is invalid. */ private void doConversion() throws IllegalArgumentException { @@ -203,25 +199,22 @@ public final class Driver { } } - /** - * Display usage. + * Display usage. */ private static void showUsage() { - System.out.println("\nUsage:"); System.out.println("\n java org.openoffice.xmerge.test.Driver <args>"); System.out.println("\n where <args> is as follows:"); System.out.println(" -from <MIMETYPE> -to <MIMETYPE> [ -merge <OrigDoc ] <document>\n"); } - /** - * Parse command-line arguments. + * Parse command-line arguments. * - * @param args Array of command line arguments. + * @param args Array of command line arguments. * - * @throws IllegalArgumentException If an argument is invalid. + * @throws IllegalArgumentException If an argument is invalid. */ private void parseCommandLine(String args[]) throws IllegalArgumentException { @@ -265,18 +258,19 @@ public final class Driver { ((mergeFile != null) ? " with merge " : " ")); } - /** - * Extract the next argument from the array, while checking to see - * that the array size is not exceeded. Throw a friendly error - * message in case the arg is missing. + * Extract the next argument from the array, while checking to see that the + * array size is not exceeded. + * + * <p>Throw a friendly error message in case the {@code args[i+1]} is + * missing.</p> * - * @param i Argument index. - * @param args Array of command line arguments. + * @param i Argument index. + * @param args Array of command line arguments. * - * @return The argument with the specified index. + * @return The argument with the specified index. * - * @throws IllegalArgumentException If an argument is invalid. + * @throws IllegalArgumentException If an argument is invalid. */ private String extractArg(int i, String args[]) throws IllegalArgumentException { @@ -288,13 +282,12 @@ public final class Driver { ": expected arg for " + args[i]); } - /** - * Simple validation for Office ZIP files. + * Simple validation for Office ZIP files. * - * @param zipName The name of the ZIP file. + * @param zipName The name of the ZIP file. * - * @return true if zipName is valid, false otherwise. + * @return {@code true} if {@code zipName} is valid, {@code false} otherwise. */ private boolean isZip(String zipName) { @@ -305,5 +298,4 @@ public final class Driver { return false; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java index 7c543f19c1e5..e10702a7de67 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java @@ -47,8 +47,8 @@ public class ActiveSyncDriver { } } - - private boolean Convert(String srcMime, String dstMime, String srcFile, String dstFile) throws Exception { + private boolean Convert(String srcMime, String dstMime, String srcFile, + String dstFile) throws Exception { /* * The classpath passed in by XMergeSync.dll should contain all of the * jar files, but at the least it will contain xmerge.jar, so strip off @@ -73,7 +73,6 @@ public class ActiveSyncDriver { return true; } - /* * The XMergeSync.dll should will have checked for the presence of the * jars at the same location already. @@ -136,4 +135,4 @@ public class ActiveSyncDriver { return true; } -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ColourConverter.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ColourConverter.java index 60b2590de3f5..7254ed0937ce 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ColourConverter.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ColourConverter.java @@ -18,24 +18,24 @@ package org.openoffice.xmerge.util; - import java.awt.Color; /** * Utility class mapping RGB colour specifications to the colour indices used - * in the Pocket PC. The original converter was written for use with Pocket - * Word it was later put into the utils so Pocket excel could use this code - * also. For this reason the default values are those used by Pocket Word but - * a colour table can be passed in through the constructor to map the 16 - * values to a colour table. + * in the Pocket PC. + * + * <p>The original converter was written for use with Pocket Word it was later + * put into the utils so Pocket excel could use this code also. For this reason + * the default values are those used by Pocket Word but a colour table can be + * passed in through the constructor to map the 16 values to a colour table.</p> * - * These colour indices are based on the Windows VGA 16 colour palette, which + * <p>These colour indices are based on the Windows VGA 16 colour palette, which * later was used as the basis for the named colours in the HTML 3.2 - * specification. + * specification.</p> * - * In Pocket Word's case, the match to the VGA 16 palette is not exact as it + * <p>In Pocket Word's case, the match to the VGA 16 palette is not exact as it * swaps Grey and Silver, with Silver being the darker colour (i.e. having the - * lower RGB value). + * lower RGB value).</p> */ public class ColourConverter { @@ -91,31 +91,29 @@ public class ColourConverter { private short tableLookup[] = null; /** - * Default constructor used in the case where a lookup table is not - * required + * Default constructor used in the case where a lookup table is not required. */ public ColourConverter() { } /** - * Constructor that passes in the colour lookup table. This is required in - * cases where the 16 colour values are something other than there default - * values (e.g. in the case of pocket Excel) + * Constructor that passes in the colour lookup table. * - * @param lookup a 16 bit array mapping the 16 colours to their values + * <p>This is required in cases where the 16 colour values are something + * other than there default values (e.g. in the case of pocket Excel).</p> + * + * @param lookup a 16 bit array mapping the 16 colours to their values. */ public ColourConverter(short lookup[]) { - tableLookup = lookup; } /** - * Uses the colour table if it exists to translate default values to - * values in the colorTable + * Uses the colour table if it exists to translate default values to values + * in the colorTable. */ private short colourLookup(short colour) { - if(tableLookup!=null) { return tableLookup[colour]; } else { @@ -124,8 +122,8 @@ public class ColourConverter { } /** - * Uses the colour table if it exists to translate default values to - * values in the colorTable + * Uses the colour table if it exists to translate default values to values + * in the colorTable. */ private short indexLookup(short index) { @@ -143,13 +141,13 @@ public class ColourConverter { return result; } /** - * This method maps a Pocket Word colour index value to an RGB value as - * used by OpenOffice. + * This method maps a Pocket Word colour index value to an RGB value as used + * by OpenOffice. * - * @param colour The index into Pocket Word's colour table. + * @param colour The index into Pocket Word's colour table. * - * @return A Color object representing the RGB value of the Pocket Word - * colour. + * @return A {@code Color} object representing the RGB value of the Pocket + * Word colour. */ public Color convertToRGB (short colour) { @@ -229,15 +227,15 @@ public class ColourConverter { return new Color(r, g, b); } - /** * This method approximates an RGB value (as used by Writer) to one of the - * 16 available colours + * 16 available colours. * - * Most of the supported colours have their components set to either 0, 128 - * or 255. The exception is 'Grey' which is 0xC0C0C0. + * <p>Most of the supported colours have their components set to either 0, + * 128 or 255. The exception is 'Grey' which is {@literal 0xC0C0C0}.</p> * - * @param colour Color object representing the RGB value of the colour. + * @param colour {@code Color} object representing the RGB value of the + * colour. * * @return Index into the Pocket Word colour table which represents the * closest match to the specified colour. @@ -251,9 +249,8 @@ public class ColourConverter { int green = colour.getGreen(); int blue = colour.getBlue(); - // We need to convert the pale colors to their base color rather than - // white so we modify the rgb values if the colour is sufficiently - // white + // We need to convert the pale colours to their base color rather than + // white so we modify the rgb values if the colour is sufficiently white. if(red>0xC0 && green>0xC0 && blue>0xC0) { if(red!=0xFF) @@ -264,21 +261,17 @@ public class ColourConverter { blue = getClosest(blue, reducedMap); } - /* - * Need to derive an RGB value that has been rounded to match the ones - * Pocket Word knows about. - */ + // Need to derive an RGB value that has been rounded to match the ones + // Pocket Word knows about. matchedRGB += getClosest(red) << 16; matchedRGB += getClosest(green) << 8; matchedRGB += getClosest(blue); - /* - * The colour map used by Pocket Word doesn't have any combinations of - * values beyond 0 and any other value. A value of 255 in any RGB - * code indicates a dominant colour. Other colours are only modifiers - * to the principal colour(s). Thus, for this conversion, modifiers - * can be dropped. - */ + // The colour map used by Pocket Word doesn't have any combinations of + // values beyond 0 and any other value. A value of 255 in any RGB code + // indicates a dominant colour. Other colours are only modifiers to the + // principal colour(s). Thus, for this conversion, modifiers can be + // dropped. if ((matchedRGB & 0xFF0000) == 0xFF0000 || (matchedRGB & 0xFF00) == 0xFF00 || (matchedRGB & 0xFF) == 0xFF) { if ((matchedRGB & 0xFF0000) == 0x800000) { @@ -292,7 +285,6 @@ public class ColourConverter { } } - /* * And now for the actual matching ... * @@ -384,8 +376,7 @@ public class ColourConverter { return colourLookup(indexColour); } - - /* + /** * Default implementation, checks for the closest of value to 0, 128 or 255. */ private int getClosest(int value) { @@ -394,8 +385,7 @@ public class ColourConverter { return getClosest(value, points); } - - /* + /** * Utility method that returns the closest of the three points to the value * supplied. */ @@ -415,8 +405,7 @@ public class ColourConverter { } } - - /* + /** * Checks to see if the supplied colour can be considered to be grey. */ private boolean isGrey(Color c) { @@ -433,5 +422,4 @@ public class ColourConverter { return false; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug.java index e4a7276ece24..fe0429ea6ebd 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug.java @@ -29,27 +29,25 @@ import java.io.Writer; import java.util.Properties; /** - * This class is used for logging debug messages. - * Currently, there are three types of logging: {@link #INFO}, - * {@link #TRACE} & {@link #ERROR}. Use the Debug.properties - * file to set or unset each type. Also use Debug.properties - * to set the writer to either <code>System.out</code>, - * <code>System.err</code>, or to a file. + * This class is used for logging debug messages. * + * <p>Currently, there are three types of logging: {@link #INFO}, {@link #TRACE} + * {@literal &} {@link #ERROR}. Use the {@code Debug.properties} file to set or + * unset each type. Also use {@code Debug.properties} to set the writer to + * either {@code System.out}, {@code System.err}, or to a file.</p> */ public final class Debug { - /** Informational messages. */ + /** Informational messages. */ public final static int INFO = 0x0001; - /** Error messages. */ + /** Error messages. */ public final static int ERROR = 0x0002; - /** Trace messages. */ + /** Trace messages. */ public final static int TRACE = 0x0004; - /** To set a flag. */ + /** To set a flag. */ private final static boolean SET = true; - private static int flags = 0; private static PrintWriter writer = null; @@ -91,95 +89,74 @@ public final class Debug { } } - /** - * Private constructor so as not to allow any instances - * of this class. This serves as a singleton class. + * Private constructor so as not to allow any instances of this class. + * + * <p>This serves as a singleton class.</p> */ private Debug() { } - /** - * Set the output to the specified argument. - * This method is only used internally to prevent - * invalid string parameters. + * Set the output to the specified argument. + * + * <p>This method is only used internally to prevent invalid string + * parameters.</p> * * @param str Output specifier. */ private static void setOutput(String str) { - if (writer == null) { - if (str.equals("System.out")) { - setOutput(System.out); - } else if (str.equals("System.err")) { - setOutput(System.err); - } else { - try { - setOutput(new FileWriter(str)); - } catch (IOException e) { - e.printStackTrace(System.err); } } } } - /** - * Set the output to an <code>OutputStream</code> object. + * Set the output to an {@code OutputStream} object. * - * @param stream OutputStream object. + * @param stream {@code OutputStream} object. */ private static void setOutput(OutputStream stream) { - setOutput(new OutputStreamWriter(stream)); } - /** - * Set the <code>Writer</code> object to manage the output. + * Set the {@code Writer} object to manage the output. * - * @param w <code>Writer</code> object to write out. + * @param w {@code Writer} object to write out. */ private static void setOutput(Writer w) { - if (writer != null) { - writer.close(); } - writer = new PrintWriter(new BufferedWriter(w), true); } - /** - * <p> - * This method sets the levels for debugging logs. - * Example calls: - * </p> + * This method sets the levels for debugging logs. + * + * <p>Example calls:</p> * - * <blockquote><pre><code> - * Debug.setFlags( Debug.INFO, Debug.SET ) - * Debug.setFlags( Debug.TRACE, Debug.SET ) - * Debug.setFlags( Debug.INFO | Debug.TRACE, Debug.SET ) - * Debug.setFlags( Debug.ERROR, Debug.UNSET ) - * </code></pre></blockquote> + * <blockquote><pre>{@code Debug.setFlags( Debug.INFO, Debug.SET ) + * Debug.setFlags( Debug.TRACE, Debug.SET ) + * Debug.setFlags( Debug.INFO | Debug.TRACE, Debug.SET ) + * Debug.setFlags( Debug.ERROR, Debug.UNSET )}</pre></blockquote> * - * @param f Debug flag - * @param set Use Debug.SET to set, and Debug.UNSET to unset - * the given flag. + * @param f Debug flag + * @param set Use {@code Debug.SET} to set, and {@code Debug.UNSET} to + * unset the given flag. */ private static void setFlags(int f, boolean set) { - if (set) { flags |= f; } else { @@ -187,88 +164,67 @@ public final class Debug { } } - - - - - - - /** - * Checks if flag is set. + * Checks if flag is set. * - * @return true if info logging is on, otherwise false + * @return {@code true} if info logging is on, otherwise {@code false}. */ public static boolean isFlagSet(int f) { - return ((flags & f) != 0); } - /** - * <p>Log message based on the flag type.</p> + * Log message based on the flag type. * - * <p>Example 1:</p> + * <p>Example 1:</p> * - * <blockquote><pre><code> - * Debug.log(Debug.INFO, "info string here"); - * </code></pre></blockquote> + * <blockquote><pre>{@code Debug.log(Debug.INFO, "info string here");}</pre> + * </blockquote> * - * <p>This logs the message during runtime if - * <code>debug.info</code> in the properties file is - * set to true.</p> + * <p>This logs the message during runtime if {@code debug.info} in the + * properties file is set to true.</p> * - * <p>Example 2:</p> + * <p>Example 2:</p> * - * <blockquote><pre><code> - * Debug.log(Debug.INFO | Debug.TRACE, "info string here"); - * </code></pre></blockquote> + * <blockquote> + * <pre>{@code Debug.log(Debug.INFO | Debug.TRACE, "info string here");}</pre> + * </blockquote> * - * <p>This logs the message during runtime if debug.info or debug.trace - * in the properties file is set to true.</p> + * <p>This logs the message during runtime if debug.info or debug.trace in + * the properties file is set to true.</p> * - * @param flag Log type, one of the Debug constants - * {@link #INFO}, {@link #TRACE}, {@link #ERROR} - * or a combination of which or'ed together. - * @param msg The message. + * @param flag Log type, one of the Debug constants {@link #INFO}, + * {@link #TRACE}, {@link #ERROR} or a combination of which + * or'ed together. + * @param msg The message. */ public static void log(int flag, String msg) { - if (isFlagSet(flag)) { - if (writer != null) { - writer.println(msg); } } } - /** - * Log message based on flag type plus print out stack trace - * of the exception passed in. Refer to the other log method - * for description. + * Log message based on flag type plus print out stack trace of the + * exception passed in. * - * @param flag Log type, one of the Debug constants - * {@link #INFO}, {@link #TRACE}, {@link #ERROR} - * or a combination of which or'ed together. - * @param msg The message. - * @param e Throwable object. + * <p>Refer to the other log method for description.</p> + * + * @param flag Log type, one of the Debug constants {@link #INFO}, + * {@link #TRACE}, {@link #ERROR} or a combination of which + * or'ed together. + * @param msg The message. + * @param e Throwable object. */ public static void log(int flag, String msg, Throwable e) { - if (isFlagSet(flag)) { - if (writer != null) { - writer.println(msg); if (e != null) e.printStackTrace(writer); } } } - - - -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/EndianConverter.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/EndianConverter.java index b7054e108976..352be2be7cd5 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/EndianConverter.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/EndianConverter.java @@ -18,26 +18,24 @@ package org.openoffice.xmerge.util; - /** - * <p>Helper class providing static methods to convert data to/from - * Network Byte Order (Big Endian).</p> + * Helper class providing static methods to convert data to/from Network Byte + * Order (Big Endian). * - * <p>With the introduction of <code>java.nio.ByteOrder</code> and - * <code>java.nio.ByteBuffer</code> in Java 1.4, it may no longer be - * necessary to use this class in the future.</p> + * <p>With the introduction of {@code java.nio.ByteOrder} and + * {@code java.nio.ByteBuffer} in Java 1.4, it may no longer be necessary to use + * this class in the future.</p> * * @version 1.1 */ public class EndianConverter { /** - * <p>Convert a <code>short</code> to a Little Endian representation.</p> + * Convert a {@code short} to a Little Endian representation. * - * @param value The <code>short</code> to be converted. + * @param value The {@code short} to be converted. * - * @return Two element <code>byte</code> array containing the converted - * value. + * @return Two element {@code byte} array containing the converted value. */ public static byte[] writeShort (short value) { byte[] leShort = new byte[2]; @@ -48,14 +46,12 @@ public class EndianConverter { return leShort; } - /** - * <p>Convert an integer to a Little Endian representation.</p> + * Convert an integer to a Little Endian representation. * - * @param value The <code>int</code> to be converted. + * @param value The {@code int} to be converted. * - * @return Four element <code>byte</code> array containing the converted - * value. + * @return Four element {@code byte} array containing the converted value. */ public static byte[] writeInt (int value) { byte[] leInt = new byte[4]; @@ -69,15 +65,16 @@ public class EndianConverter { } /** - * <p>Converts a <code>double</code> to a Little Endian representation - * of a float in IEEE-754 format. + * Converts a {@code double} to a Little Endian representation of a float in + * IEEE-754 format. * * <p>An array with more than eight elements can be used, but only the first * eight elements will be read.</p> * - * @param value <code>double</code> containing the value to be converted + * @param value {@code double} containing the value to be converted. * - * @return <code>byte</code> array containing the LE representation of a IEEE-754 float + * @return {@code byte} array containing the LE representation of a + * IEEE-754 float. */ public static byte[] writeDouble(double value) { @@ -97,16 +94,16 @@ public class EndianConverter { } /** - * <p>Convert a Little Endian representation of a short to a Java - * <code>short</code> (Network Byte Order).</p> + * Convert a Little Endian representation of a short to a Java {@code short} + * (Network Byte Order). * * <p>An array with more than two elements can be used, but only the first - * two elements will be read.</p> + * two elements will be read.</p> * - * @param value <code>byte</code> array containing the LE representation - * of the value. + * @param value {@code byte} array containing the LE representation of + * the value. * - * @return <code>short</code> containing the converted value. + * @return {@code short} containing the converted value. */ public static short readShort (byte[] value) { int high, low; @@ -117,18 +114,17 @@ public class EndianConverter { return (short)(high << 8 | low); } - /** - * <p>Convert a Little Endian representation of an integer to a Java - * <code>int</code> (Network Byte Order).</p> + * Convert a Little Endian representation of an integer to a Java {@code int} + * (Network Byte Order). * * <p>An array with more than four elements can be used, but only the first * four elements will be read.</p> * - * @param value <code>byte</code> array containing the LE representation - * of the value. + * @param value {@code byte} array containing the LE representation of + * the value. * - * @return <code>int</code> containing the converted value. + * @return {@code int} containing the converted value. */ public static int readInt(byte[] value) { int number = 0; @@ -141,16 +137,16 @@ public class EndianConverter { } /** - * <p>Convert a Little Endian representation of a float in IEEE-754 Little - * Endian to a Java <code>double</code> (Network Byte Order).</p> + * Convert a Little Endian representation of a float in IEEE-754 Little + * Endian to a Java {@code double} (Network Byte Order). * * <p>An array with more than eight elements can be used, but only the first * eight elements will be read.</p> * - * @param value <code>byte</code> array containing the LE representation - * of a IEEE-754 float. + * @param value {@code byte} array containing the LE representation of an + * IEEE-754 float. * - * @return <code>double</code> containing the converted value. + * @return {@code double} containing the converted value. */ public static double readDouble(byte[] value) { @@ -165,4 +161,4 @@ public class EndianConverter { return Double.longBitsToDouble(lvalue); } -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/IntArrayList.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/IntArrayList.java index ba76967ea63f..eb2388a9440d 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/IntArrayList.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/IntArrayList.java @@ -21,58 +21,53 @@ package org.openoffice.xmerge.util; import java.util.ArrayList; /** - * This is a convenience class used to create an - * <code>ArrayList</code> of integers. + * This is a convenience class used to create an {@code ArrayList} of integers. */ public class IntArrayList { - /** The list to hold our integers. */ + /** The list to hold our integers. */ private ArrayList<Integer> list; /** - * Constructor. - * Creates the list with 0 length. + * Constructor. + * + * <p>Creates the list with 0 length.</p> */ public IntArrayList() { list = new ArrayList<Integer>(); } - /** - * Constructor. + * Constructor. * - * @param initialCapacity Initial capacity of the list. + * @param initialCapacity Initial capacity of the list. */ public IntArrayList(int initialCapacity) { list = new ArrayList<Integer>(initialCapacity); } - /** - * This method ensures that the list is large enough for - * <code>minCapacity</code> elements. + * This method ensures that the list is large enough for {@code minCapacity} + * elements. * - * @param minCapacity The minimum capacity of the list. + * @param minCapacity The minimum capacity of the list. */ public void ensureCapacity(int minCapacity) { - list.ensureCapacity(minCapacity); } - /** - * This method ensures that the list is large enough for - * <code>minCapacity</code> elements. It also fills in the - * new slots in the list with the integer value input as - * <code>fillValue</code>. + * This method ensures that the list is large enough for {@code minCapacity} + * elements. + * + * <p>It also fills in the new slots in the list with the integer value + * input as {@code fillValue}.</p> * - * @param minCapacity The minimum capacity of the list. - * @param fillValue This method adds in a integer for each - * slot that was added to ensure that the - * list meets the minimum capacity. - * <code>fillValue</code> is the value - * used as the initial value of these - * added elements. + * @param minCapacity The minimum capacity of the list. + * @param fillValue This method adds in a integer for each slot that was + * added to ensure that the list meets the minimum + * capacity. {@code fillValue} is the value used as the + * initial value of these added elements. */ public void ensureCapacityAndFill(int minCapacity, int fillValue) { @@ -86,52 +81,45 @@ public class IntArrayList { } } - /** - * This method sets an element of the list to the input - * integer value. + * This method sets an element of the list to the input integer value. * - * @param index The index in the list of the element - * we wish to set. - * @param value The integer value that we assign to the - * selected element of the list. + * @param index The index in the list of the element we wish to set. + * @param value The integer value that we assign to the selected element + * of the list. */ public void set(int index, int value) { list.set(index, Integer.valueOf(value)); } - /** - * This method appends an element to the list. + * This method appends an element to the list. * - * @param value The integer value that we assign to the - * element that we are appending to the list. + * @param value The integer value that we assign to the element that we + * are appending to the list. */ public void add(int value) { list.add(Integer.valueOf(value)); } - /** - * This method gets the integer value stored in element index. + * This method gets the integer value stored in element index. * - * @param index The index in the list of the element - * we wish to get the value from. + * @param index The index in the list of the element we wish to get the + * value from. * - * @return The value of the data stored in element index. + * @return The value of the data stored in element index. */ public int get(int index) { return list.get(index).intValue(); } - /** - * This method gets the size of the list. + * This method gets the size of the list. * - * @return The size of the list. + * @return The size of the list. */ public int size() { return list.size(); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/OfficeUtil.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/OfficeUtil.java index eef2ded2e76f..949565d5af88 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/OfficeUtil.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/OfficeUtil.java @@ -27,22 +27,21 @@ import org.openoffice.xmerge.converter.xml.OfficeConstants; import java.util.ArrayList; - /** - * Class providing utility methods for OpenOffice plugins. + * Class providing utility methods for OpenOffice plug-ins. * * @version 1.1 */ public class OfficeUtil implements OfficeConstants { /** - * <p>Method to replace whitespace character within text with appropriate - * OpenOffice tags.</p> + * Method to replace whitespace character within text with appropriate + * OpenOffice tags. * - * @param text The text to parse for whitespace. + * @param text The text to parse for whitespace. * - * @return <code>Node</code> array containing OpenOffice XML nodes - * representing the text. + * @return {@code Node} array containing OpenOffice XML nodes representing + * the text. */ public static Node[] parseText(String text, Document parentDoc) { ArrayList<Node> nodeVec = new ArrayList<Node>(); @@ -122,4 +121,4 @@ public class OfficeUtil implements OfficeConstants { nodes[i] = nodeVec.get(i); return nodes; } -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Resources.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Resources.java index 091dda7807f5..ddcdb148579d 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Resources.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Resources.java @@ -21,69 +21,54 @@ package org.openoffice.xmerge.util; import java.util.ResourceBundle; /** - * <p>Provides a singleton resource class for converter messages.</p> + * Provides a singleton resource class for converter messages. * - * <p>By default, this class will search for a - * <code>ResourceBundle</code> class file or properties file based - * on the default locale.</p> + * <p>By default, this class will search for a {@code ResourceBundle} class file + * or properties file based on the default locale.</p> * - * <p>A properties file resources.properties will be provided.</p> - * - * <p>Note that if the resource bundle object is not loaded, the - * construction of the singleton object will throw a - * <code>MissingResourceException</code>, which is a - * <code>RuntimeException</code>, thus I opted to not explicitly - * declare it. If it does throw <code>MissingResourceException</code>, - * it may be due to a packaging problem.</p> + * <p>A properties file resources.properties will be provided.</p> * + * <p>Note that if the resource bundle object is not loaded, the construction of + * the singleton object will throw a {@code MissingResourceException}, which is + * a {@code RuntimeException}, thus I opted to not explicitly declare it. If it + * does throw {@code MissingResourceException}, it may be due to a packaging + * problem.</p> */ public final class Resources { private ResourceBundle rb = null; - private static Resources instance = null; - /** - * This method returns the singleton instance - * of this class. + * This method returns the singleton instance of this class. * - * @return The singleton <code>Resources</code> - * instance. + * @return The singleton {@code Resources} instance. */ - public synchronized static Resources getInstance() - { - if (instance == null) - { + public synchronized static Resources getInstance() { + if (instance == null) { instance = new Resources(); } return instance; } - /** - * Default constructor is only accessible within this class. - * Load the resource bundle that contains the resource - * <code>String</code> values. + * Default constructor is only accessible within this class. + * + * <p>Load the resource bundle that contains the resource {@code String} + * values.</p> */ - private Resources() - { + private Resources() { rb = ResourceBundle.getBundle("org.openoffice.xmerge.util.resources"); } - /** - * This method returns the corresponding <code>String</code> given - * the key. + * This method returns the corresponding {@code String} given the key. * - * @param key Key string for getting the message - * <code>String</code>. - * @return Message <code>String</code> corresponding to the key. + * @param key Key string for getting the message {@code String}. + * @return Message {@code String} corresponding to the key. */ - public String getString(String key) - { + public String getString(String key) { return rb.getString(key); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/TwipsConverter.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/TwipsConverter.java index 854be77254b7..5ae1139aead0 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/TwipsConverter.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/TwipsConverter.java @@ -18,62 +18,46 @@ package org.openoffice.xmerge.util; - /** - * <p>Helper class providing static methods to convert data to/from - * twips</p> - * + * Helper class providing static methods to convert data to/from twips. */ public class TwipsConverter { /** - * <p>Convert from twips to cm's</p> + * Convert from twips to cm's. * - * @param value The <code>short</code> to be converted. + * @param value The {@code short} to be converted. * - * @return float containing the converted + * @return {@code float} containing the converted. */ public static float twips2cm(int value) { - float inches = (float) value/1440; float cm = inches*(float)2.54; - return cm; } - - /** - * <p>Convert from cm's to twips</p> + * Convert from cm's to twips. * - * @param value <code>byte</code> array containing the LE representation - * of the value. + * @param value {@code byte} array containing the LE representation of + * the value. * - * @return int containing the converted value. + * @return {@code int} containing the converted value. */ public static int cm2twips(float value) { - int twips = (int) ((value/2.54)*1440); - return twips; } - - - - /** - * <p>Convert from cm's to twips</p> + * Convert from cm's to twips. * - * @param value <code>byte</code> array containing the LE representation - * of the value. + * @param value {@code byte} array containing the LE representation of + * the value. * - * @return int containing the converted value. + * @return {@code int} containing the converted value. */ public static int inches2twips(float value) { - return (int) (value*1440); } - - -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/XmlUtil.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/XmlUtil.java index 939a8675a52a..71e68f342a66 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/XmlUtil.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/XmlUtil.java @@ -25,22 +25,19 @@ import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** - * Class containing static util methods for handling XML trees. + * Class containing static utility methods for handling XML trees. */ public final class XmlUtil { - /** - * Perform a deep clone of certain <code>Node</code> which - * will base on the document <code>Node</code> of the old - * <code>Node</code>. + * Perform a deep clone of certain {@code Node} which will base on the + * document {@code Node} of the old {@code Node}. * - * @param oldNode The <code>Document</code> of this - * <code>Node</code> is used to clone - * the <code>Node</code> - * @param newNode The <code>Node</code> to clone. + * @param oldNode The {@code Document} of this {@code Node} is used to + * clone the {@code Node}. + * @param newNode The <code>Node</code> to clone. * - * @return The cloned <code>Node</code>. + * @return The cloned {@code Node}. */ public static Node deepClone(Node oldNode, Node newNode) { Document docNode = oldNode.getOwnerDocument(); @@ -54,14 +51,12 @@ public final class XmlUtil { return clonedNode; } - /** - * Clone the sub-tree under certain given <code>Node</code> + * Clone the sub-tree under certain given {@code Node}. * - * @param docNode The <code>Document</code> used to clone - * the <code>Node</code>. - * @param oldNode The <code>Node</code> to clone. - * @param newNode The destination <code>Node</code>. + * @param docNode The {@code Document} used to clone the {@code Node}. + * @param oldNode The {@code Node} to clone. + * @param newNode The destination {@code Node}. */ private static void cloneTree(Document docNode, Node oldNode, Node newNode) { @@ -77,15 +72,13 @@ public final class XmlUtil { } } - /** - * Clone a <code>Node</code> (either text or element). + * Clone a {@code Node} (either text or element). * - * @param docNode The <code>Document</code> used to - * clone the <code>Node</code>. - * @param newNode The <code>Node</code> to clone. + * @param docNode The {@code Document} used to clone the {@code Node}. + * @param newNode The {@code Node}to clone. * - * @return The cloned <code>Node</code>. + * @return The cloned {@code Node}. */ private static Node cloneNode(Document docNode, Node newNode) { @@ -115,13 +108,12 @@ public final class XmlUtil { return clonedNode; } - /** - * Returns the name and type of an XML DOM <code>Node</code>. + * Returns the name and type of an XML DOM {@code Node}. * - * @param node <code>Node</code> to query. + * @param node {@code Node} to query. * - * @return Name and type of XML DOM <code>Node</code>. + * @return Name and type of XML DOM {@code Node}. */ public static String getNodeInfo(Node node) { @@ -174,5 +166,4 @@ public final class XmlUtil { return buffer.toString(); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java index 693b7babdb93..5f09b628788b 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java @@ -30,64 +30,59 @@ import org.openoffice.xmerge.DocumentSerializerFactory; import org.openoffice.xmerge.PluginFactory; /** - * Class for storing the information about a converter plugin. + * Class for storing the information about a converter plug-in. */ public class ConverterInfo { - /** - * Keep track of the valid Office mime types - */ + /** Keep track of the valid Office mime types. */ private static final String[] validOfficeTypes = new String[] { // This needs to be updated to reflect all valid office types. "staroffice/sxw", "staroffice/sxc" }; - - private String piJarName; - private String piOfficeMime; - private ArrayList<String> piDeviceMime; - private String piDisplayName; - private String piDescription; - private String piVersion; - private String piVendor; - private String piClassImpl; - private String piXsltSerial; - private String piXsltDeserial; - private boolean piCanSerialize = false; - private boolean piCanDeserialize = false; - private boolean piCanMerge = false; - private ClassLoader piClassLoader = null; - private PluginFactory piPluginFactory; + private String piJarName; + private String piOfficeMime; + private ArrayList<String> piDeviceMime; + private String piDisplayName; + private String piDescription; + private String piVersion; + private String piVendor; + private String piClassImpl; + private String piXsltSerial; + private String piXsltDeserial; + private boolean piCanSerialize = false; + private boolean piCanDeserialize = false; + private boolean piCanMerge = false; + private ClassLoader piClassLoader = null; + private PluginFactory piPluginFactory; /** - * The constructor builds a ConverterInfo structure. + * The constructor builds a ConverterInfo structure. * - * @param jarName The URL of the jarfile. - * @param officeMime The office mime-type. - * @param deviceMime The device mime-type. - * @param displayName The display name. - * @param description The description. - * @param version The version. - * @param vendor The vendor name. - * @param impl The implementation class name of - * PluginFactory. - * @param xsltSerial The url of the serializer xsl stylesheet - * @param xsltDeserial The url of the deserializer xsl stylesheet + * @param jarName The URL of the jarfile. + * @param officeMime The office mime-type. + * @param deviceMime The device mime-type. + * @param displayName The display name. + * @param description The description. + * @param version The version. + * @param vendor The vendor name. + * @param impl The implementation class name of + * {@code PluginFactory}. + * @param xsltSerial The URL of the serializer XSL stylesheet + * @param xsltDeserial The URL of the deserializer XSL stylesheet * - * @throws RegistryException If <code>ci</code> cannot - * be loaded. + * @throws RegistryException If {@code ci} cannot be loaded. */ public ConverterInfo(String jarName, String officeMime, - ArrayList<String> deviceMime, String displayName, String description, - String version, String vendor, String impl,String xsltSerial, - String xsltDeserial) - throws RegistryException { + ArrayList<String> deviceMime, String displayName, + String description, String version, String vendor, + String impl,String xsltSerial, String xsltDeserial) + throws RegistryException { if (!isValidOfficeType(officeMime.trim())) { - RegistryException re = new RegistryException( - "Invalid office type"); + RegistryException re = new RegistryException( "Invalid office type"); throw re; } @@ -98,8 +93,8 @@ public class ConverterInfo { piDescription = description.trim(); piVersion = version.trim(); piVendor = vendor.trim(); - piXsltSerial = xsltSerial.trim(); - piXsltDeserial= xsltDeserial.trim(); + piXsltSerial = xsltSerial.trim(); + piXsltDeserial= xsltDeserial.trim(); piClassImpl = impl.trim(); piClassLoader = this.getClass().getClassLoader(); @@ -139,24 +134,21 @@ public class ConverterInfo { } } - /** - * The constructor builds a ConverterInfo structure. + /** + * The constructor builds a ConverterInfo structure. * - * @param jarName The URL of the jarfile. - * @param officeMime The office mime-type. - * @param deviceMime The device mime-type. - * @param displayName The display name. - * @param description The description. - * @param version The version. - * @param vendor The vendor name. - * @param impl The implementation class name of - * PluginFactory. + * @param jarName The URL of the jarfile. + * @param officeMime The office mime-type. + * @param deviceMime The device mime-type. + * @param displayName The display name. + * @param description The description. + * @param version The version. + * @param vendor The vendor name. + * @param impl The implementation class name of + * {@code PluginFactory}. * - * @throws RegistryException If <code>ci</code> cannot - * be loaded. + * @throws RegistryException If {@code ci} cannot be loaded. */ - - public ConverterInfo(String jarName, String officeMime, ArrayList<String> deviceMime, String displayName, String description, String version, String vendor, String impl) @@ -214,166 +206,157 @@ public class ConverterInfo { } } - - - /** - * Returns an instance of the DocumentDeserializerFactory interface. + * Returns an instance of the {@code DocumentDeserializerFactory} interface. * - * @return instance of the DocumentDeserializer for this ConverterInfo. + * @return instance of the {@code DocumentDeserializer} for this + * {@code ConverterInfo}. */ public DocumentSerializerFactory getDocSerializerFactory() { return (DocumentSerializerFactory)piPluginFactory; } - /** - * Returns an instance of the DocumentSerializerFactory interface. + * Returns an instance of the {@code DocumentSerializerFactory} interface. * - * @return instance of the DocumentSerializer for this ConverterInfo. + * @return instance of the {@code DocumentSerializer} for this + * {@code ConverterInfo}. */ public DocumentDeserializerFactory getDocDeserializerFactory() { return (DocumentDeserializerFactory)piPluginFactory; } - /** - * Returns an instance of the DocumentMergerFactory interface. + * Returns an instance of the DocumentMergerFactory interface. * - * @return instance of the DocumentMergerFactory for this ConverterInfo. + * @return instance of the {@code DocumentMergerFactory} for this + * {@code ConverterInfo}. */ public DocumentMergerFactory getDocMergerFactory() { return (DocumentMergerFactory)piPluginFactory; } - /** - * Returns the jar file name. + * Returns the jar file name. * - * @return The jar file name, null if none exists. + * @return The jar file name, {@code null} if none exists. */ public String getJarName() { return piJarName; } - /** - * Returns the office mime-type. + * Returns the office mime-type. * - * @return The office mime-type, null if none exists. + * @return The office mime-type, {@code null} if none exists. */ public String getOfficeMime() { return piOfficeMime; } - /** - * Returns an <code>Enumeration</code> of <code>String</code> - * objects indicating the device mime-type. + * Returns an {@code Enumeration} of {@code String} objects indicating the + * device mime-type. * - * @return An <code>Enumeration</code> of <code>String</code> - * objects indicating the device mime-type. + * @return An {@code Enumeration} of {@code String} objects indicating the + * device mime-type. */ public Iterator<String> getDeviceMime() { return(piDeviceMime.iterator()); } - /** - * Returns the display name. + * Returns the display name. * - * @return The display name, null if none exists. + * @return The display name, {@code null} if none exists. */ public String getDisplayName() { return piDisplayName; } - /** - * Returns the description. + * Returns the description. * - * @return The description, null if none exists. + * @return The description, {@code null} if none exists. */ public String getDescription() { return piDescription; } - /** - * Returns the version. + * Returns the version. * - * @return The version, null if none exists. + * @return The version, {@code null} if none exists. */ public String getVersion() { return piVersion; } - /** - * Returns the vendor name. + * Returns the vendor name. * - * @return The vendor name, null if none exists. + * @return The vendor name, {@code null} if none exists. */ public String getVendor() { return piVendor; } - /** - * Returns the implementation class name of PluginFactory. + * Returns the implementation class name of PluginFactory. * - * @return The implementation class name of PluginFactory, - * null if none exists. + * @return The implementation class name of {@code PluginFactory}, + * {@code null} if none exists. */ public String getClassImpl() { return piClassImpl; } - /** - * Returns the PluginFactory instance for this plug-in. + * Returns the {@code PluginFactory} instance for this plug-in. * - * @return The PluginFactory instance for this plug-in. + * @return The {@code PluginFactory} instance for this plug-in. */ public PluginFactory getPluginFactory() { return piPluginFactory; } - /** - * Returns true if this plug-in has a serializier, false otherwise. + * Returns {@code true} if this plug-in has a serializer, {@code false} + * otherwise. * - * @return true if this plug-in has a serializier, false otherwise. + * @return {@code true} if this plug-in has a serializer, {@code false} + * otherwise. */ public boolean canSerialize() { return piCanSerialize; } - /** - * Returns true if this plug-in has a deserializier, false otherwise. + * Returns {@code true} if this plug-in has a deserializer, {@code false} + * otherwise. * - * @return true if this plug-in has a deserializier, false otherwise. + * @return {@code true} if this plug-in has a deserializer, {@code false} + * otherwise. */ public boolean canDeserialize() { return piCanDeserialize; } - /** - * Returns true if this plug-in has a merger, false otherwise. + * Returns {@code true} if this plug-in has a merger, {@code false} + * otherwise. * - * @return true if this plug-in has a merger, false otherwise. + * @return {@code true} if this plug-in has a merger, {@code false} + * otherwise. */ public boolean canMerge() { return piCanMerge; } - /** - * Returns true if the officeMime is a valid Office mime type. + * Returns {@code true} if the officeMime is a valid Office mime type. * - * @return true if the officeMime is a valid Office mime type. + * @return {@code true} if the officeMime is a valid Office mime type. */ public static boolean isValidOfficeType(String officeMime) { @@ -384,29 +367,26 @@ public class ConverterInfo { } } - return rc; + return rc; } /** - * Returns a <code>String</code> containing the Xslt stylesheet url that - * is to be used by the Xslt Plugin Serializer. + * Returns a {@code String} containing the Xslt stylesheet URL that is to be + * used by the Xslt Plug-in Serializer. * - * @return <code>String</code> + * @return {@code String}. */ - - public String getXsltSerial() { + public String getXsltSerial() { return piXsltSerial; } /** - * Returns a <code>String</code> containing the xslt stylesheet url that - * is to be used by the Xslt Plugin Deserializer. + * Returns a {@code String} containing the xslt stylesheet URL that is to be + * used by the Xslt Plug-in Deserializer. * - * @return <code>String</code> + * @return {@code String}. */ - public String getXsltDeserial() { return piXsltDeserial; } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java index 2087ce80086b..d1c9b1c12470 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java @@ -22,32 +22,30 @@ import java.util.*; import java.io.*; /** - * Manages the converter plug-ins that are currently active. - * This class allows plug-ins to be added or removed dynamically. - * This class is a singleton (static) class, so that only one - * manager can exist at a time. It is final, so it may not be - * subclassed. + * Manages the converter plug-ins that are currently active. * + * <p>This class allows plug-ins to be added or removed dynamically.</p> + * + * <p>This class is a singleton (static) class, so that only one manager can + * exist at a time. It is final, so it may not be sub-classed.</p> */ public final class ConverterInfoMgr { private static final ArrayList<ConverterInfo> converterInfoList = new ArrayList<ConverterInfo>(); /** - * Adds a converter plug-in to the registry. The - * <code>ConverterInfo</code> must have a unique DisplayName - * and must have non-null values for DisplayName, ClassImpl, - * OfficeMime, and DeviceMime. + * Adds a converter plug-in to the registry. + * + * <p>The {@code ConverterInfo} must have a unique DisplayName and must have + * non-null values for DisplayName, ClassImpl, OfficeMime, and DeviceMime.</p> * - * @param ci A <code>ConverterInfo</code> object describing a plug-in. + * @param ci A {@code ConverterInfo} object describing a plug-in. * - * @throws RegistryException If the <code>ConverterInfo</code> - * is not valid. + * @throws RegistryException If the {@code ConverterInfo} is not valid. */ private static void addPlugIn(ConverterInfo ci) throws RegistryException { // Validate - if (ci.getDisplayName() == null) { RegistryException re = new RegistryException( "Converter must have valid name."); @@ -69,8 +67,8 @@ public final class ConverterInfoMgr { throw re; } - // Verify there is no converter with the same Display Name in - // the registry. + // Verify there is no converter with the same Display Name in the + // registry. for (ConverterInfo converterInfo : converterInfoList) { if (ci.getDisplayName().equals(converterInfo.getDisplayName())) { RegistryException re = new RegistryException( @@ -79,27 +77,28 @@ public final class ConverterInfoMgr { } } - // Since this is a adding to a static Vector, make sure this - // add method call is synchronized. - + // Since this is a adding to a static Vector, make sure this add method + // call is synchronized. synchronized (converterInfoList) { converterInfoList.add(ci); } } /** - * Adds a list of converter plug-ins to the registry. - * Each <code>ConverterInfo</code> in the list must have - * a unique DisplayName and must have non-null values for DisplayName, - * ClassImpl, OfficeMime, and DeviceMime. + * Adds a list of converter plug-ins to the registry. + * + * <p>Each {@code ConverterInfo} in the list must have a unique DisplayName + * and must have non-null values for DisplayName, ClassImpl, OfficeMime, and + * DeviceMime.</p> * - * @param jarEnum An <code>Enumeration</code> of <code>ConverterInfo</code> - * objects describing one or more plug-in(s). + * @param jarEnum An {@code Enumeration} of {@code ConverterInfo} objects + * describing one or more plug-in(s). * - * @throws RegistryException If a <code>ConverterInfo</code> in the - * <code>Vector</code> is not valid. + * @throws RegistryException If a {@code ConverterInfo} in the + * {@code Vector} is not valid. */ - public static void addPlugIn(Iterator<ConverterInfo> jarEnum) throws RegistryException { + public static void addPlugIn(Iterator<ConverterInfo> jarEnum) + throws RegistryException { while (jarEnum.hasNext()) { ConverterInfo converterInfo = jarEnum.next(); @@ -108,25 +107,24 @@ public final class ConverterInfoMgr { } /** - * Returns an <code>Enumeration</code> of registered - * <code>ConverterInfo</code> objects. + * Returns an {@code Enumeration} of registered {@code ConverterInfo} objects. * - * @return An <code>Enumeration</code> containing the currently registered - * <code>ConverterInfo</code> objects, an empty - * <code>Vector</code> if none exist. + * @return An {@code Enumeration} containing the currently registered + * {@code ConverterInfo} objects, an empty {@code Vector} if none + * exist. */ private static Iterator<ConverterInfo> getConverterInfoEnumeration() { return (converterInfoList.iterator()); } /** - * Removes any <code>ConverterInfo</code> object from the registry - * that have the specified jar name value. + * Removes any {@code ConverterInfo} object from the registry that have the + * specified jar name value. * - * @param jar The name of the jarfile. + * @param jar The name of the jarfile. * - * @return True if a <code>ConverterInfo</code> object was - * removed, false otherwise. + * @return {@code true} if a {@code ConverterInfo} object was removed, + * {@code false} otherwise. */ public static boolean removeByJar(String jar) { @@ -143,13 +141,13 @@ public final class ConverterInfoMgr { } /** - * Removes any <code>ConverterInfo</code> object from the registry - * that have the specified display name value. + * Removes any {@code ConverterInfo} object from the registry that have the + * specified display name value. * - * @param name The display name. + * @param name The display name. * - * @return True if a <code>ConverterInfo</code> object was - * removed, false otherwise. + * @return {@code true} if a {@code ConverterInfo} object was removed, + * {@code false} otherwise. */ private static boolean removeByName(String name) { @@ -166,16 +164,16 @@ public final class ConverterInfoMgr { } /** - * Returns the <code>ConverterInfo</code> object that supports - * the specified device/office mime type conversion. If there - * are multiple <code>ConverterInfo</code> objects registered - * that support this conversion, only the first is returned. + * Returns the {@code ConverterInfo} object that supports the specified + * device/office mime type conversion. * - * @param deviceMime The device mime. - * @param officeMime The office mime. + * <p>If there are multiple {@code ConverterInfo} objects registered that + * support this conversion, only the first is returned.</p> * - * @return The first plug-in that supports the specified - * conversion. + * @param deviceMime The device mime. + * @param officeMime The office mime. + * + * @return The first plug-in that supports the specified conversion. */ public static ConverterInfo findConverterInfo(String deviceMime, String officeMime) { @@ -190,7 +188,6 @@ public final class ConverterInfoMgr { Iterator<String> fromEnum = converterInfo.getDeviceMime(); // Loop over the deviceMime types. - while (fromEnum.hasNext()) { String fromDeviceInfo = fromEnum.next(); if (deviceMime.trim().equals(fromDeviceInfo) && @@ -203,17 +200,17 @@ public final class ConverterInfoMgr { } /** - * Returns an array of two <code>ConverterInfo</code> objects that - * can be chained to perform the specified mime type conversion. - * If there are multiple <code>ConverterInfo</code> objects that - * support this conversion, only the first is returned. + * Returns an array of two {@code ConverterInfo} objects that can be chained + * to perform the specified mime type conversion. * - * @param deviceFromMime The device from mime. - * @param deviceToMime The device to mime. + * <p>If there are multiple {@code ConverterInfo} objects that support this + * conversion, only the first is returned.</p> * - * @return An array of two <code>ConverterInfo</code> objects - * that can be chained to perform the specified - * conversion. + * @param deviceFromMime The device from mime. + * @param deviceToMime The device to mime. + * + * @return An array of two {@code ConverterInfo} objects that can be chained + * to perform the specified conversion. */ private static ConverterInfo[] findConverterInfoChain(String deviceFromMime, String deviceToMime) { @@ -224,7 +221,6 @@ public final class ConverterInfoMgr { ConverterInfo[] converterInfo = new ConverterInfo[2]; // Loop over elements comparing with deviceFromMime - Iterator<ConverterInfo> cifEnum = converterInfoList.iterator(); while (cifEnum.hasNext()) { @@ -234,7 +230,6 @@ public final class ConverterInfoMgr { // Loop over the deviceMime types looking for a deviceFromMime // match. - while (fromEnum.hasNext()) { String fromDeviceInfo = fromEnum.next(); @@ -242,7 +237,6 @@ public final class ConverterInfoMgr { // Found a a match for deviceFrom. Now loop over the // elements comparing with deviceToMime - Iterator<ConverterInfo> citEnum = converterInfoList.iterator(); while (citEnum.hasNext()) { @@ -252,7 +246,6 @@ public final class ConverterInfoMgr { // Loop over deviceMime types looking for a // deviceToMime match. - while (toEnum.hasNext()) { String toDeviceInfo = toEnum.next(); if (deviceToMime.trim().equals(toDeviceInfo) && @@ -270,10 +263,10 @@ public final class ConverterInfoMgr { } /** - * main to let the user specify what plug-ins to register from - * jarfiles and to display the currently registered plug-ins. + * Main to let the user specify what plug-ins to register from jarfiles and + * to display the currently registered plug-ins. * - * @param args Not used. + * @param args Not used. */ public static void main(String args[]) { @@ -307,12 +300,10 @@ public final class ConverterInfoMgr { System.out.println(""); // Quit - if (c == 'Q') { exitFlag = true; // Load by Jarfile - } else if (c == 'L') { System.out.println("Enter path to jarfile: "); @@ -338,7 +329,6 @@ public final class ConverterInfoMgr { } // Unload by Display Name or Jarfile - } else if (c == 'T') { if (validate){ System.out.println("Validation switched off"); @@ -355,8 +345,7 @@ public final class ConverterInfoMgr { System.out.println("Enter path to jarfile: "); } - try - { + try { String name = br.readLine().trim(); boolean rc = false; @@ -477,4 +466,4 @@ public final class ConverterInfoMgr { } } } -} +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoReader.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoReader.java index caaffd614f8c..411b5b005560 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoReader.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoReader.java @@ -28,10 +28,9 @@ import java.net.URL; import java.net.JarURLConnection; /** - * The <code>ConverterInfoReader</code> pulls a META-INF/converter.xml - * file out of a jar file and parses it, providing access to this - * information in a <code>Vector</code> of <code>ConverterInfo</code> - * objects. + * The {@code ConverterInfoReader} pulls a {@code META-INF/converter.xml} file + * out of a jar file and parses it, providing access to this information in a + * {@code Vector} of {@code ConverterInfo} objects. */ public class ConverterInfoReader { @@ -44,33 +43,31 @@ public class ConverterInfoReader { private final static String TAG_CLASS_IMPL = "converter-class-impl"; private final static String TAG_TARGET = "converter-target"; private final static String ATTRIB_DEVICE_TYPE = "type"; - private final static String TAG_XSLT_DESERIAL = "converter-xslt-deserialize"; - private final static String TAG_XSLT_SERIAL = "converter-xslt-serialize"; + private final static String TAG_XSLT_DESERIAL = "converter-xslt-deserialize"; + private final static String TAG_XSLT_SERIAL = "converter-xslt-serialize"; private String jarfilename; private Document document; private ArrayList<ConverterInfo> converterInfoList; - /** - * Constructor. A jar file is passed in. The jar file is - * parsed and the <code>Vector</code> of <code>ConverterInfo</code> - * objects is built. + * Constructor. + * + * <p>A jar file is passed in. The jar file is parsed and the {@code Vector} + * of {@code ConverterInfo} objects is built.</p> * - * @param jar The URL of the jar file to process. - * @param shouldvalidate Boolean to enable or disable xml validation. + * @param jar The URL of the jar file to process. + * @param shouldvalidate Boolean to enable or disable xml validation. * - * @throws IOException If the jar file cannot - * be read or if the - * META-INF/converter.xml - * can not be read in the - * jar file. - * @throws ParserConfigurationException If the DocumentBuilder - * can not be built. - * @throws org.xml.sax.SAXException If the converter.xml - * file can not be parsed. - * @throws RegistryException If the ConverterFactory - * implementation of a - * plug-in cannot be loaded. + * @throws IOException If the jar file cannot be read or + * if the META-INF/converter.xml can + * not be read in the jar file. + * @throws ParserConfigurationException If the {@code DocumentBuilder} + * can not be built. + * @throws org.xml.sax.SAXException If the converter.xml file can not + * be parsed. + * @throws RegistryException If the {@code ConverterFactory} + * implementation of a plug-in cannot + * be loaded. */ public ConverterInfoReader(String jar,boolean shouldvalidate) throws IOException, ParserConfigurationException, org.xml.sax.SAXException, @@ -104,28 +101,28 @@ public class ConverterInfoReader { builderFactory = DocumentBuilderFactory.newInstance(); - //DTD validation - if (shouldvalidate){ - System.out.println("Validating xml..."); - builderFactory.setValidating(true); + //DTD validation + + if (shouldvalidate) { + System.out.println("Validating xml..."); + builderFactory.setValidating(true); } - builder = builderFactory.newDocumentBuilder(); - document = builder.parse(isource); + builder = builderFactory.newDocumentBuilder(); + document = builder.parse(isource); // Parse the document. parseDocument(); } - /** - * Loops over the <i>converter</i> <code>Node</code> in the converter.xml - * file and processes them. + * Loops over the <i>converter</i> {@code Node} in the converter.xml file + * and processes them. * - * @throws RegistryException If the plug-in associated with a - * specific <i>converter</i> <code>Node</code> - * cannot be loaded. + * @throws RegistryException If the plug-in associated with a specific + * <i>converter</i> {@code Node} cannot be + * loaded. */ private void parseDocument() throws RegistryException { @@ -140,16 +137,13 @@ public class ConverterInfoReader { } } - /** - * Parses a <i>converter</i> node, pulling the information out of - * the <code>Node</code> and placing it in a <code>ConverterInfo</code> - * object, and adds that object to a <code>Vector</code> of - * <code>ConverterInfo</code> objects. - * - * @param e The <code>Element</code> corresponding to the - * <i>converter</i> XML tag. + * Parses a <i>converter</i> node, pulling the information out of the + * {@code Node} and placing it in a {@code ConverterInfo} object, and adds + * that object to a {@code Vector} of {@code ConverterInfo} objects. * + * @param e The {@code Element} corresponding to the <i>converter</i> + * XML tag. * * @throws RegistryException If the plug-in cannot be loaded. */ @@ -158,15 +152,15 @@ public class ConverterInfoReader { Element detailElement; Node detailNode; String elementTagName; - String officeMime = null; + String officeMime = null; ArrayList<String> deviceMime = new ArrayList<String>(); - String name = null; - String desc = null; - String version = null; - String vendor = null; - String classImpl = null; - String xsltSerial = null; - String xsltDeserial= null; + String name = null; + String desc = null; + String version = null; + String vendor = null; + String classImpl = null; + String xsltSerial = null; + String xsltDeserial = null; String temp; temp = e.getAttribute(ATTRIB_OFFICE_TYPE); @@ -194,14 +188,13 @@ public class ConverterInfoReader { desc = getTextValue(detailElement); } else if (TAG_VENDOR.equalsIgnoreCase(elementTagName)) { vendor = getTextValue(detailElement); - } else if (TAG_XSLT_SERIAL.equalsIgnoreCase(elementTagName)) { + } else if (TAG_XSLT_SERIAL.equalsIgnoreCase(elementTagName)) { xsltSerial = getTextValue(detailElement); } else if (TAG_XSLT_DESERIAL.equalsIgnoreCase(elementTagName)) { xsltDeserial = getTextValue(detailElement); } else if (TAG_CLASS_IMPL.equalsIgnoreCase(elementTagName)) { classImpl = getTextValue(detailElement); } else if (TAG_TARGET.equalsIgnoreCase(elementTagName)) { - temp = detailElement.getAttribute(ATTRIB_DEVICE_TYPE); if (temp.length() != 0) { deviceMime.add(temp); @@ -209,29 +202,27 @@ public class ConverterInfoReader { } } } - ConverterInfo converterInfo; - if ((xsltSerial==null) || (xsltDeserial==null)){ - converterInfo = new ConverterInfo(jarfilename, - officeMime, deviceMime, name, - desc, version, vendor,classImpl); - } - else{ - converterInfo = new ConverterInfo(jarfilename, - officeMime, deviceMime, name, - desc, version, vendor,classImpl, - xsltSerial,xsltDeserial); + + ConverterInfo converterInfo; + if ((xsltSerial == null) || (xsltDeserial == null)) { + converterInfo = new ConverterInfo(jarfilename, + officeMime, deviceMime, name, + desc, version, vendor, classImpl); + } else { + converterInfo = new ConverterInfo(jarfilename, + officeMime, deviceMime, name, + desc, version, vendor, classImpl, + xsltSerial, xsltDeserial); } converterInfoList.add(converterInfo); } - /** - * Helper function to get the text value of an - * <code>Element</code>. + * Helper function to get the text value of an {@code Element}. * - * @param e The <code>Element</code> to process. + * @param e The {@code Element} to process. * - * @return The text value of the <code>Element</code>. + * @return The text value of the {@code Element}. */ private String getTextValue(Element e) { @@ -250,16 +241,12 @@ public class ConverterInfoReader { return text; } - /** - * Returns an <code>Enumeration</code> of <code>ConverterInfo</code> - * objects. + * Returns an {@code Enumeration} of {@code ConverterInfo} objects. * - * @return An <code>Enumeration</code> of <code>ConverterInfo</code> - * objects. + * @return An {@code Enumeration} of {@code ConverterInfo} objects. */ public Iterator<ConverterInfo> getConverterInfoEnumeration() { return (converterInfoList.iterator()); } -} - +}
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java index 3072f2e0e748..3630ed9c2d1d 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java @@ -19,20 +19,16 @@ package org.openoffice.xmerge.util.registry; /** - * This <code>Exception</code> is thrown by converter registry - * algorithms. + * This {@code Exception} is thrown by converter registry algorithms. */ public class RegistryException extends Exception { - /** - * Exception thrown by merge algorithms. + * Exception thrown by merge algorithms. * - * @param message Message to be included in the - * <code>Exception</code>. + * @param message Message to be included in the {@code Exception}. */ public RegistryException(String message) { super(message); } -} - +}
\ No newline at end of file |