[PATCH 4/9] Fix javadoc comments in ColumnStyle.java
Nigel Hawkins
n.hawkins at gmx.com
Thu Oct 28 01:13:57 PDT 2010
---
.../xmerge/converter/xml/sxc/ColumnStyle.java | 73 +++++++++-----------
1 files changed, 32 insertions(+), 41 deletions(-)
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 cee83b5..5a35b02 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
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -40,15 +40,15 @@ import org.openoffice.xmerge.util.TwipsConverter;
/**
* Represents a text <code>Style</code> in an OpenOffice document.
*
- * @author Martin Maher
+ * @author Martin Maher
*/
public class ColumnStyle extends Style implements Cloneable {
- private int colWidth = 0;
+ private int colWidth = 0;
/**
* Constructor for use when going from DOM to client device format.
*
- * @param Node The <i>style:style</i> <code>Node</code> containing
+ * @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
@@ -56,7 +56,7 @@ public class ColumnStyle extends Style implements Cloneable {
*/
public ColumnStyle(Node node, StyleCatalog sc) {
super(node, sc);
-
+
// Run through the attributes of this node, saving
// the ones we're interested in.
NamedNodeMap attrNodes = node.getAttributes();
@@ -67,7 +67,7 @@ public class ColumnStyle extends Style implements Cloneable {
handleAttribute(attr.getNodeName(), attr.getNodeValue());
}
}
-
+
// Look for children. Only ones we care about are "style:properties"
// nodes. If any are found, recursively traverse them, passing
// along the style element to add properties to.
@@ -91,8 +91,7 @@ public class ColumnStyle extends Style implements Cloneable {
}
}
}
-
-
+
/**
* Constructor for use when going from client device format to DOM
*
@@ -101,11 +100,11 @@ public class ColumnStyle extends Style implements Cloneable {
* <i>text</i>). Can be null.
* @param parent Name of parent text <code>Style</code>, or null
* for none.
- * @param mask the width of this column
- * @param sc The <code>StyleCatalog</code>, which is used for
+ * @param colWidth the width of this column
+ * @param sc The <code>StyleCatalog</code>, which is used for
* looking up ancestor <code>Style</code> objects.
*/
- public ColumnStyle(String name, String family, String parent,int colWidth, StyleCatalog sc) {
+ public ColumnStyle(String name, String family, String parent, int colWidth, StyleCatalog sc) {
super(name, family, parent, sc);
this.colWidth = colWidth;
}
@@ -113,24 +112,24 @@ public class ColumnStyle extends Style implements Cloneable {
/**
* Returns the width of this column
*
- * @return the <code>Format</code> object
+ * @return The width of this column.
*/
public int getColWidth() {
return colWidth;
}
-
+
/**
* Sets the width of this column
*
- * @return the <code>Format</code> object
+ * @param colWidth The width of this column.
*/
public void setColWidth(int colWidth) {
this.colWidth = colWidth;
}
-
+
/**
- * Parse a colwidth in the form "1.234cm" to twips
+ * Parse a colwidth in the form "1.234cm" to twips
*
* @param value <code>String</code> specification to parse.
*
@@ -139,7 +138,7 @@ public class ColumnStyle extends Style implements Cloneable {
private int parseColWidth(String value) {
int width = 255; // Default value
-
+
if(value.indexOf("cm")!=-1) {
float widthCM = Float.parseFloat(value.substring(0,value.indexOf("c")));
width = TwipsConverter.cm2twips(widthCM);
@@ -147,10 +146,9 @@ public class ColumnStyle extends Style implements Cloneable {
float widthInch = Float.parseFloat(value.substring(0,value.indexOf("i")));
width = TwipsConverter.inches2twips(widthInch);
}
-
+
return (width);
}
-
/**
* Set an attribute.
@@ -159,7 +157,7 @@ public class ColumnStyle extends Style implements Cloneable {
* @param value The attribute value to set.
*/
private void handleAttribute(String attr, String value) {
-
+
if (attr.equals("style:column-width")) {
colWidth = parseColWidth(value);
}
@@ -167,16 +165,15 @@ public class ColumnStyle extends Style implements Cloneable {
Debug.log(Debug.INFO, "ColumnStyle Unhandled: " + attr + "=" + value);
}
}
-
-
+
/**
- * Return a <code>Style</code> object corresponding to this one,
+ * 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 The <code>StyleCatalog</code> in which to look up
+ * @return The <code>Style</code> in which to look up
* ancestors.
*/
public Style getResolved() {
@@ -187,7 +184,7 @@ public class ColumnStyle extends Style implements Cloneable {
} catch (Exception e) {
Debug.log(Debug.ERROR, "Can't clone", e);
}
-
+
// Look up the parentStyle. (If there is no style catalog
// specified, we can't do any lookups.)
ColumnStyle parentStyle = null;
@@ -206,19 +203,18 @@ public class ColumnStyle extends Style implements Cloneable {
null, this.getClass());
}
}
-
+
// If we found a parent, for any attributes which we don't have
// set, try to get the values from the parent.
if (parentStyle != null) {
parentStyle = (ColumnStyle)parentStyle.getResolved();
-
+
if ((colWidth == 0) && (parentStyle.getColWidth() != 0))
resolved.setColWidth(parentStyle.getColWidth());
}
return resolved;
}
-
-
+
/**
* Create a new <code>Node</code> in the <code>Document</code>, and
* write this <code>Style</code> to it.
@@ -235,10 +231,9 @@ public class ColumnStyle extends Style implements Cloneable {
writeAttributes(node);
return node;
}
-
-
+
/**
- * Return true if <code>style</code> specifies as much or less
+ * 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>.
*
@@ -248,17 +243,16 @@ public class ColumnStyle extends Style implements Cloneable {
* otherwise.
*/
public boolean isSubset(Style style) {
- if (style.getClass() != this.getClass())
+ if (style.getClass() != this.getClass())
return false;
ColumnStyle tStyle = (ColumnStyle)style;
-
+
if(colWidth!=tStyle.getColWidth())
return false;
return true;
}
-
-
+
/**
* Write this <code>Style</code> object's attributes to a
* <code>Node</code> in the <code>Document</code>.
@@ -269,17 +263,15 @@ public class ColumnStyle extends Style implements Cloneable {
public void writeAttributes(Element node) {
if(colWidth!=0) {
- String width = TwipsConverter.twips2cm(colWidth) + "cm";
+ String width = TwipsConverter.twips2cm(colWidth) + "cm";
node.setAttribute("style:column-width", width);
}
}
-
private static String[] ignored = {
"fo:break-before", "fo:keep-with-next"
};
-
/*
* This code checks whether an attribute is one that we
* intentionally ignore.
@@ -291,10 +283,9 @@ public class ColumnStyle extends Style implements Cloneable {
*/
private boolean isIgnored(String attribute) {
for (int i = 0; i < ignored.length; i++) {
- if (ignored[i].equals(attribute))
+ if (ignored[i].equals(attribute))
return true;
}
return false;
}
}
-
--
1.7.0.4
--=-yxF8B8fCXhdiVRLw7V8t
Content-Disposition: attachment; filename="0005-Fix-javadoc-comments-in-Format.java.patch"
Content-Type: text/x-patch; name="0005-Fix-javadoc-comments-in-Format.java.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit
More information about the LibreOffice
mailing list