[PATCH 2/7] Fix javadoc comments in filters/xmerge/pexcel
Nigel Hawkins
n.hawkins at gmx.com
Tue Nov 2 05:47:52 PDT 2010
---
.../xml/sxc/pexcel/records/BeginningOfFile.java | 3 +-
.../xml/sxc/pexcel/records/BlankCell.java | 51 +++---
.../xml/sxc/pexcel/records/BoolErrCell.java | 49 +++---
.../xml/sxc/pexcel/records/BoundSheet.java | 48 +++---
.../xml/sxc/pexcel/records/CellValue.java | 54 +++---
.../converter/xml/sxc/pexcel/records/ColInfo.java | 54 +++---
.../xml/sxc/pexcel/records/DefColWidth.java | 15 +-
.../xml/sxc/pexcel/records/DefRowHeight.java | 5 +-
.../xml/sxc/pexcel/records/DefinedName.java | 94 ++++++------
.../xml/sxc/pexcel/records/ExtendedFormat.java | 4 +-
.../xml/sxc/pexcel/records/FloatNumber.java | 40 ++---
.../xml/sxc/pexcel/records/FontDescription.java | 81 +++++-----
.../converter/xml/sxc/pexcel/records/Formula.java | 84 +++++-----
.../xml/sxc/pexcel/records/LabelCell.java | 48 +++---
.../converter/xml/sxc/pexcel/records/Pane.java | 6 +-
.../converter/xml/sxc/pexcel/records/Row.java | 49 +++---
.../xml/sxc/pexcel/records/Selection.java | 55 +++---
.../xml/sxc/pexcel/records/StringValue.java | 37 ++--
.../converter/xml/sxc/pexcel/records/Window1.java | 43 +++---
.../converter/xml/sxc/pexcel/records/Window2.java | 41 +++---
.../converter/xml/sxc/pexcel/records/Workbook.java | 175 ++++++++++----------
.../xml/sxc/pexcel/records/Worksheet.java | 110 ++++++-------
22 files changed, 566 insertions(+), 580 deletions(-)
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BeginningOfFile.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BeginningOfFile.java
index a58635b..e5d74dc 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BeginningOfFile.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BeginningOfFile.java
@@ -49,8 +49,7 @@ public class BeginningOfFile implements BIFFRecord {
/**
* Constructor that initializes the member values.
*
- * @param ver Version Number
- * Substream type (workbook = 0x05, worksheet = 0x10)
+ * @param global True for a workbook, false for a worksheet
*/
public BeginningOfFile(boolean global) {
setVersion((short) 271);
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BlankCell.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BlankCell.java
index 767a24c..e1970b4 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BlankCell.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BlankCell.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
@@ -26,7 +26,7 @@
************************************************************************/
package org.openoffice.xmerge.converter.xml.sxc.pexcel.records;
-
+
import java.io.OutputStream;
import java.io.InputStream;
import java.io.IOException;
@@ -36,36 +36,35 @@ import org.openoffice.xmerge.util.EndianConverter;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
/**
- * Represents a BIFF Record that describes a blank cell
+ * Represents a BIFF Record that describes a blank cell
*/
public class BlankCell extends CellValue {
-
+
/**
- * Constructs a BlankCell <code>InputStream</code>
+ * Constructs a BlankCell <code>InputStream</code>
*
* @param is InputStream containing a BlankCell.
*/
public BlankCell(InputStream is) throws IOException {
- read(is);
+ read(is);
}
-
+
/**
* Constructs a <code>BlankCell</code> using specified attributes
- *
- * @param row row number
- * @param col column number
- * @param cellContents contents of the cell
- * @param ixfe font index
- */
+ *
+ * @param row row number
+ * @param column column number
+ * @param ixfe font index
+ */
public BlankCell(int row, int column, int ixfe) throws IOException {
setRow(row);
setCol(column);
setIxfe(ixfe);
}
-
+
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>BlankCell</code>
*/
@@ -81,35 +80,35 @@ public class BlankCell extends CellValue {
output.write(ixfe);
Debug.log(Debug.TRACE, "Writing BlankCell record");
-
+
}
-
+
/**
- * Reads a BlankCell <code>InputStream</code>
+ * Reads a BlankCell <code>InputStream</code>
*
- * @param is InputStream containing a BlankCell.
+ * @param input InputStream containing a BlankCell.
*/
public int read(InputStream input) throws IOException {
int numOfBytesRead = input.read(rw);
- numOfBytesRead++;
+ numOfBytesRead++;
col += input.read();
numOfBytesRead += input.read(ixfe);
- Debug.log(Debug.TRACE, "\tRow : "+ EndianConverter.readShort(rw) +
+ Debug.log(Debug.TRACE, "\tRow : "+ EndianConverter.readShort(rw) +
" Column : " + col +
- " ixfe : " + EndianConverter.readShort(ixfe));
-
+ " ixfe : " + EndianConverter.readShort(ixfe));
+
return numOfBytesRead;
}
-
+
/**
- * Gets the <code>String</code> representing the cells contents
+ * Gets the <code>String</code> representing the cells contents
*
* @return the <code>String</code> representing the cells contents
*/
public String getString() throws IOException {
return (new String(""));
- }
+ }
}
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BoolErrCell.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BoolErrCell.java
index f07212f..1cb78a7 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BoolErrCell.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BoolErrCell.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
@@ -31,26 +31,25 @@ import java.io.OutputStream;
import java.io.InputStream;
import java.io.IOException;
-
import org.openoffice.xmerge.util.Debug;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
/**
- * Represents a BIFF Record that describes a Boolean or Error value
+ * Represents a BIFF Record that describes a Boolean or Error value
*/
public class BoolErrCell extends CellValue {
private byte bBoolErr;
private byte fError;
-
+
/**
* Constructs a BoolErrCell from arguments
*
- * @param row row number
- * @param col column number
- * @param ixfe font index
- * @param bBoolErr Boolean value or error value
- * @param fError Boolean error flag
+ * @param row row number
+ * @param column column number
+ * @param ixfe font index
+ * @param bBoolErr Boolean value or error value
+ * @param fError Boolean error flag
*/
public BoolErrCell(int row, int column, int ixfe, int bBoolErr, int fError) throws IOException {
@@ -59,35 +58,35 @@ public class BoolErrCell extends CellValue {
this.fError = (byte)fError;
setRow(row);
setCol(column);
- }
-
+ }
+
/**
- * Constructs a BoolErrCell from the <code>InputStream</code>
+ * Constructs a BoolErrCell from the <code>InputStream</code>
*
- * @param is InputStream containing a BoolErrCell
+ * @param is InputStream containing a BoolErrCell
*/
public BoolErrCell(InputStream is) throws IOException {
- read(is);
+ read(is);
}
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>BoolErrCEll</code>
*/
public short getBiffType() {
return PocketExcelConstants.BOOLERR_CELL;
- }
+ }
/**
* Writes a <code>BoolErrCell</code> to the specified <code>Outputstream</code>
*
- * @param os the <code>OutputStream</code> to write to
- */
+ * @param output the <code>OutputStream</code> to write to
+ */
public void write(OutputStream output) throws IOException {
output.write(getBiffType());
-
+
super.write(output);
output.write(bBoolErr);
@@ -95,11 +94,11 @@ public class BoolErrCell extends CellValue {
Debug.log(Debug.TRACE,"Writing BoolErrCell record");
}
-
+
/**
- * Reads a BoolErrCell from the <code>InputStream</code>
+ * Reads a BoolErrCell from the <code>InputStream</code>
*
- * @param is InputStream containing a BoolErrCell
+ * @param input InputStream containing a BoolErrCell
*/
public int read(InputStream input) throws IOException {
@@ -107,15 +106,15 @@ public class BoolErrCell extends CellValue {
bBoolErr = (byte) input.read();
fError = (byte) input.read();
- numOfBytesRead += 2;
+ numOfBytesRead += 2;
Debug.log(Debug.TRACE, " bBoolErr : " + bBoolErr +
- " fError : " + fError);
+ " fError : " + fError);
return numOfBytesRead;
}
/**
- * Gets the <code>String</code> representing the cells contents
+ * Gets the <code>String</code> representing the cells contents
*
* @return the <code>String</code> representing the cells contents
*/
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BoundSheet.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BoundSheet.java
index 4056808..ac081af 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BoundSheet.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/BoundSheet.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
@@ -36,21 +36,21 @@ import org.openoffice.xmerge.util.Debug;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
/**
- * Represents a BoundSheet Record which describes the name of a worksheet
+ * Represents a BoundSheet Record which describes the name of a worksheet
*/
public class BoundSheet implements BIFFRecord {
private byte reserved;
- private byte cch;
+ private byte cch;
private byte[] sheetName;
-
+
/**
* Constructs a pocket Excel Document assigns it the document name passed in
*
- * @param name name of the worksheet represented
+ * @param name name of the worksheet represented
*/
public BoundSheet(String name) throws IOException {
- setSheetName(name);
+ setSheetName(name);
reserved = 0;
}
@@ -61,21 +61,21 @@ public class BoundSheet implements BIFFRecord {
* @param is InputStream containing a Pocket Excel Data file.
*/
public BoundSheet(InputStream is) throws IOException {
- read(is);
+ read(is);
}
/**
* Sets the worksheet name. The sheetname length must be doubled as the
- * String is stored in unicode format.
+ * String is stored in unicode format.
*
- * @param sheetname worksheet name
+ * @param sheetname worksheet name
*/
void setSheetName(String sheetName) throws IOException {
this.cch = (byte) sheetName.length();
this.sheetName = new byte[cch*2];
this.sheetName = sheetName.getBytes("UTF-16LE");
}
-
+
public String getSheetName() {
String name;
@@ -86,21 +86,21 @@ public class BoundSheet implements BIFFRecord {
}
return name;
}
-
+
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>BoundSheet</code>
*/
public short getBiffType() {
return PocketExcelConstants.BOUND_SHEET;
- }
-
+ }
+
/**
* Write this particular <code>BIFFRecord</code> to the <code>OutputStream</code>
*
- * @param ouput the <code>OutputStream</code>
- */
+ * @param output the <code>OutputStream</code>
+ */
public void write(OutputStream output) throws IOException {
output.write(getBiffType());
@@ -110,27 +110,27 @@ public class BoundSheet implements BIFFRecord {
Debug.log(Debug.TRACE,"Writing BoundSheet record");
}
-
+
/**
* Reads a BoundSheet from the <code>InputStream</code> The byte array
* must be twice the size of the String as it uses unicode.
*
- * @param is InputStream containing the record data
+ * @param input InputStream containing the record data
*/
public int read(InputStream input) throws IOException {
-
+
reserved = (byte) input.read();
cch = (byte) input.read();
int numOfBytesRead = 2;
int strLen = cch*2;
sheetName = new byte[strLen];
- numOfBytesRead += input.read(sheetName, 0, strLen);
-
- Debug.log(Debug.TRACE,"\tReserved : "+ reserved +
+ numOfBytesRead += input.read(sheetName, 0, strLen);
+
+ Debug.log(Debug.TRACE,"\tReserved : "+ reserved +
" cch : " + cch +
- " sheetName : " + new String(sheetName,"UTF-16LE"));
+ " sheetName : " + new String(sheetName,"UTF-16LE"));
return numOfBytesRead;
}
-
+
}
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/CellValue.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/CellValue.java
index cdfb47e..bc4d427 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/CellValue.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/CellValue.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
@@ -39,28 +39,28 @@ public abstract class CellValue implements BIFFRecord {
protected byte[] rw = new byte[2];
protected byte col;
protected byte[] ixfe = new byte[2];
-
- /**
- * Get the row number of this cell
+
+ /**
+ * Get the row number of this cell
*
- * @return the row number of this cell
+ * @return the row number of this cell
*/
public int getRow() {
return EndianConverter.readShort(rw) + 1;
}
/**
- * Set the row number of this cell
+ * Set the row number of this cell
*
- * @param row sets the row number for this cell
+ * @param row sets the row number for this cell
*/
public void setRow(int row) {
this.rw = EndianConverter.writeShort((short) (row - 1));
}
/**
- * Get the Index to the <code>ExtendedFormat</code>
+ * Get the Index to the <code>ExtendedFormat</code>
*
- * @return the index number of this cell's <code>ExtendedFormat</code>
+ * @return the index number of this cell's <code>ExtendedFormat</code>
*/
public int getIxfe() {
return EndianConverter.readShort(ixfe);
@@ -76,18 +76,18 @@ public abstract class CellValue implements BIFFRecord {
}
/**
- * Get the column number of this cell
+ * Get the column number of this cell
*
- * @return the column number of this cell
+ * @return the column number of this cell
*/
public int getCol() {
- return col + 1; // The cols start at 1
+ return col + 1; // The cols start at 1
}
/**
- * Set the row number of this cell
+ * Set the column number of this cell
*
- * @param col sets the row number for this cell
+ * @param col sets the column number for this cell
*/
public void setCol(int col) {
this.col = (byte) (col - 1); // The cols start at 1
@@ -96,7 +96,7 @@ public abstract class CellValue implements BIFFRecord {
/**
* Writes basic cell value attributes to the specified <code>Outputstream</code>
*
- * @param os the <code>OutputStream</code> to write to
+ * @param output the <code>OutputStream</code> to write to
*/
public void write(OutputStream output) throws IOException {
@@ -106,31 +106,29 @@ public abstract class CellValue implements BIFFRecord {
}
/**
- * Writes a<code>LabelCell</code> to the specified <code>Outputstream</code>
+ * Reads a <code>LabelCell</code> from the specified <code>Inputstream</code>
*
- * @param os the <code>OutputStream</code> to write to
+ * @param input the <code>InputStream</code> to read from
*/
public int read(InputStream input) throws IOException {
int numOfBytesRead = input.read(rw);
- col += input.read();
+ col += input.read();
numOfBytesRead++;
numOfBytesRead += input.read(ixfe);
-
- Debug.log(Debug.TRACE, "\tRow : "+ EndianConverter.readShort(rw) +
+
+ Debug.log(Debug.TRACE, "\tRow : "+ EndianConverter.readShort(rw) +
" Column : " + col +
- " ixfe : " + EndianConverter.readShort(ixfe));
-
- return numOfBytesRead;
+ " ixfe : " + EndianConverter.readShort(ixfe));
+
+ return numOfBytesRead;
}
-
-
+
/**
* Returns the contents of the cell as a String
*
- * @return the contents of the cell
+ * @return the contents of the cell
*/
abstract public String getString() throws IOException;
-
-}
+}
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/ColInfo.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/ColInfo.java
index ea6b472..97cb5ad 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/ColInfo.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/ColInfo.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
@@ -36,7 +36,7 @@ import org.openoffice.xmerge.util.EndianConverter;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
/**
- * ColInfo describes the formatting for a column
+ * ColInfo describes the formatting for a column
*
*/
public class ColInfo implements BIFFRecord {
@@ -45,17 +45,17 @@ public class ColInfo implements BIFFRecord {
private byte[] colLast = new byte[2]; // last column this formatting applies to
private byte[] colDX = new byte[2]; // column width
private byte[] ixfe = new byte[2]; // index for formatting
- private byte grbit; // options flags
+ private byte grbit; // options flags
private float scale = (float) 2.5; // 1.798;
-
+
/**
* Constructs a pocket Excel Document from the
* <code>InputStream</code> and assigns it the document name passed in
*
- * @param colFirst the first column this formatting applies to
- * @param colLast last column this formatting applies to
- * @param coldx column width
- * @param grbit options flags
+ * @param colFirst the first column this formatting applies to
+ * @param colLast last column this formatting applies to
+ * @param colDX column width
+ * @param ixfe index for formatting
*/
public ColInfo(int colFirst, int colLast, int colDX, int ixfe) {
this.colFirst = EndianConverter.writeShort((short)colFirst);
@@ -78,7 +78,7 @@ public class ColInfo implements BIFFRecord {
/**
* Reads ColInfo record from the InputStream
*
- * @param input the InputStream to read from
+ * @param input the InputStream to read from
* @return the number of bytes read
*/
public int read(InputStream input) throws IOException {
@@ -91,46 +91,46 @@ public class ColInfo implements BIFFRecord {
numOfBytesRead += input.read(ixfe);
grbit = (byte) input.read();
numOfBytesRead ++;
-
- Debug.log(Debug.TRACE,"\tcolFirst : "+ EndianConverter.readShort(colFirst) +
+
+ Debug.log(Debug.TRACE,"\tcolFirst : "+ EndianConverter.readShort(colFirst) +
" colLast : " + EndianConverter.readShort(colLast) +
" colDX : " + EndianConverter.readShort(colDX) +
" ixfe : " + EndianConverter.readShort(ixfe) +
" grbit : " + grbit);
-
+
return numOfBytesRead;
}
-
+
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
- * @return the hex code for <code>ColInfo</code>
+ * @return the hex code for <code>ColInfo</code>
*/
public short getBiffType() {
return PocketExcelConstants.COLINFO;
}
/**
- * Get the width of this column
+ * Get the width of this column
*
- * @return the width of this column
+ * @return the width of this column
*/
public short getColWidth() {
return EndianConverter.readShort(colDX);
- }
-
+ }
+
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the first column that this formatting applies to.
*
- * @return the hex code for <code>ColInfo</code>
+ * @return The first column.
*/
public short getFirst() {
return EndianConverter.readShort(colFirst);
}
-
+
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the last column that this formatting applies to.
*
- * @return the hex code for <code>ColInfo</code>
+ * @return The last column.
*/
public short getLast() {
return EndianConverter.readShort(colLast);
@@ -139,10 +139,10 @@ public class ColInfo implements BIFFRecord {
/**
* Writes a ColInfo to the specified <code>Outputstream</code>
*
- * @param os the <code>OutputStream</code> to write to
+ * @param output the <code>OutputStream</code> to write to
*/
public void write(OutputStream output) throws IOException {
-
+
output.write(getBiffType());
output.write(colFirst);
output.write(colLast);
@@ -153,5 +153,5 @@ public class ColInfo implements BIFFRecord {
Debug.log(Debug.TRACE,"Writing ColInfo record");
}
-
+
}
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefColWidth.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefColWidth.java
index 24acb37..bb2f2af 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefColWidth.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefColWidth.java
@@ -44,18 +44,21 @@ public class DefColWidth implements BIFFRecord {
private byte[] coldx = new byte[2];
private byte[] ixfe = new byte[2];
-/**
- * Constructs a pocket Excel Document from the
- * <code>InputStream</code> and assigns it the document name passed in
- *
- * @param is InputStream containing a Pocket Excel Data file.
- */
+ /**
+ * Default constructor. Sets width to 9.
+ */
public DefColWidth() {
grbit = new byte[] {0x00, 0x00};
coldx = new byte[] {0x00, 0x09};
ixfe = new byte[] {0x00, 0x00};
}
+ /**
+ * Constructs a pocket Excel Document from the
+ * <code>InputStream</code> and assigns it the document name passed in
+ *
+ * @param is InputStream containing a Pocket Excel Data file.
+ */
public DefColWidth(InputStream is) throws IOException {
read(is);
}
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefRowHeight.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefRowHeight.java
index a4cfb84..43f980f 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefRowHeight.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefRowHeight.java
@@ -44,10 +44,7 @@ public class DefRowHeight implements BIFFRecord {
private byte[] unknown2 = new byte[2];
/**
- * Constructs a pocket Excel Document from the
- * <code>InputStream</code> and assigns it the document name passed in
- *
- * @param is InputStream containing a Pocket Excel Data file.
+ * Default constructor. Sets something unknown to 255.
*/
public DefRowHeight() {
unknown1 = new byte[] {(byte)0x00, (byte)0x00};
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefinedName.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefinedName.java
index 8613771..f252564 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefinedName.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefinedName.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
@@ -50,23 +50,24 @@ public class DefinedName implements BIFFRecord {
private byte[] ixals = new byte[2];
private byte[] rgch;
private byte[] rgce;
- private FormulaHelper fh = new FormulaHelper();
+ private FormulaHelper fh = new FormulaHelper();
private String definition = new String("");
private Workbook wb;
/**
- * Constructs a Defined Name from the <code>InputStream</code>
+ * Constructs a Defined Name from an existing <code>NameDefinition</code>
*
- * @param is InputStream containing the record data
+ * @param nd The name definition.
+ * @param wb The workbook we are defined in.
*/
public DefinedName(NameDefinition nd, Workbook wb) throws IOException {
-
+
fh.setWorkbook(wb);
this.wb = wb;
String name = nd.getName();
-
+
// we have to insert an = to stop the formulaParser throwing an exception
- definition = "=" + nd.getDefinition();
+ definition = "=" + nd.getDefinition();
cch = (byte)name.length();
rgch = new byte[cch*2];
@@ -74,10 +75,12 @@ public class DefinedName implements BIFFRecord {
grbit = EndianConverter.writeShort((short)0);
ixals[0] = (byte)0xFF;ixals[1] = (byte)0xFF;
}
+
/**
- * Constructs a Defined Name from the <code>InputStream</code>
+ * Constructs a Defined Name from the <code>InputStream</code>
*
- * @param is InputStream containing the record data
+ * @param is InputStream containing the record data
+ * @param wb The workbook we are defined in.
*/
public DefinedName(InputStream is, Workbook wb) throws IOException {
@@ -87,51 +90,49 @@ public class DefinedName implements BIFFRecord {
}
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>DefinedName</code>
*/
public short getBiffType() {
return PocketExcelConstants.DEFINED_NAME;
}
-
+
/**
* Reads a Defined Name from the <code>InputStream</code> The byte array
* must be twice the size of the String as it uses unicode.
*
- * @param is InputStream containing the record data
+ * @param input InputStream containing the record data
*/
public int read(InputStream input) throws IOException {
-
- int numOfBytesRead = input.read(grbit);
+
+ int numOfBytesRead = input.read(grbit);
cch = (byte) input.read();
numOfBytesRead++;
numOfBytesRead += input.read(cce);
- numOfBytesRead += input.read(ixals);
-
+ numOfBytesRead += input.read(ixals);
+
rgch = new byte[cch*2];
- input.read(rgch, 0, cch*2);
-
- rgce = new byte[EndianConverter.readShort(cce)];
- input.read(rgce, 0, EndianConverter.readShort(cce));
-
+ input.read(rgch, 0, cch*2);
+ rgce = new byte[EndianConverter.readShort(cce)];
+ input.read(rgce, 0, EndianConverter.readShort(cce));
- Debug.log(Debug.TRACE, "\tgrbit : "+ EndianConverter.readShort(grbit) +
+ Debug.log(Debug.TRACE, "\tgrbit : "+ EndianConverter.readShort(grbit) +
" cch : " + cch +
" cce : " + EndianConverter.readShort(cce) +
" ixals : " + EndianConverter.readShort(ixals) +
- "\n\trgch : " + rgch +
+ "\n\trgch : " + rgch +
" rgce : " + rgce);
-
+
return numOfBytesRead;
}
-
+
/**
* Write this particular <code>BIFFRecord</code> to the <code>OutputStream</code>
*
- * @param ouput the <code>OutputStream</code>
- */
+ * @param output the <code>OutputStream</code>
+ */
public void write(OutputStream output) throws IOException {
try {
@@ -142,7 +143,6 @@ public class DefinedName implements BIFFRecord {
Debug.log(Debug.TRACE,"Error in Parsing Name Definition");
cce = EndianConverter.writeShort((short) 0);
}
-
output.write(getBiffType());
output.write(grbit);
@@ -171,56 +171,56 @@ public class DefinedName implements BIFFRecord {
} catch (UnsupportedEncodingException e){
name = "unknown";
}
- return name;
+ return name;
}
/**
* Returns a definition table which can be used by the pocket excel
* decoder to build a complete definitions table for writing to the sxc
- * document
+ * document
*/
public NameDefinition getNameDefinition() {
-
+
String baseCellAddress;
getDefinition(); // This must be called first so we know the type
baseCellAddress = "$" + wb.getSheetName(0) + ".A1";
-
+
NameDefinition nd = new NameDefinition(getName(),definition, baseCellAddress, isRangeType(), isExpressionType());
return nd;
}
-
+
/**
- * Returns the definition
+ * Returns the definition
*
- * @return the <code>String</code> containing the definition
+ * @return the <code>String</code> containing the definition
*/
private String getDefinition() {
// pexcel sometimes creates Name definition with no defintion, bug??
- if(EndianConverter.readShort(cce)!=0) {
- definition = fh.convertPXLToCalc(rgce);
+ if(EndianConverter.readShort(cce)!=0) {
+ definition = fh.convertPXLToCalc(rgce);
definition = definition.substring(1); // remove the '='
definition = definition.replace(',', ';');
- }
- return definition;
+ }
+ return definition;
}
-
+
/**
- * Returns the defintion
+ * Returns the defintion
*
- * @return the <code>String</code> containing the definition
+ * @return the <code>String</code> containing the definition
*/
private boolean isRangeType() {
-
- return fh.isRangeType();
+
+ return fh.isRangeType();
}
/**
- * Returns the defintion
+ * Returns the defintion
*
- * @return the <code>String</code> containing the definition
+ * @return the <code>String</code> containing the definition
*/
private boolean isExpressionType() {
- return fh.isExpressionType();
+ return fh.isExpressionType();
}
}
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/ExtendedFormat.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/ExtendedFormat.java
index 30fdfb0..67f3ae3 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/ExtendedFormat.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/ExtendedFormat.java
@@ -280,8 +280,8 @@ org.openoffice.xmerge.converter.xml.OfficeConstants {
/**
* Compare two ExtendedFormat to see if the font index is the same
*
- * @param the ExtendedFormat to be used in the comaprison
- * @return boolean if the two are the same otherwise false
+ * @param rhs The ExtendedFormat to be used in the comaprison
+ * @return True if the two are the same otherwise false
*/
public boolean compareTo(ExtendedFormat rhs) {
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/FloatNumber.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/FloatNumber.java
index 902feef..a088bc2 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/FloatNumber.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/FloatNumber.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
@@ -41,10 +41,9 @@ import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
public class FloatNumber extends CellValue {
protected byte[] num = new byte[8];
-
+
/**
- * Constructs a pocket Excel Document from the
- * <code>InputStream</code> and assigns it the document name passed in
+ * Constructs a FloatNumber by reading from an InputStream.
*
* @param is InputStream containing a Pocket Excel Data file.
*/
@@ -53,12 +52,12 @@ public class FloatNumber extends CellValue {
}
/**
- * Constructs a <code>FloatNumber</code> using specified attributes
+ * Constructs a <code>FloatNumber</code> using specified attributes
*
- * @param row row number
- * @param col column number
- * @param cellContents contents of the cell
- * @param ixfe font index
+ * @param row row number
+ * @param column column number
+ * @param cellContents contents of the cell
+ * @param ixfe font index
*/
public FloatNumber(int row, int column, String cellContents, int ixfe) throws IOException {
@@ -70,7 +69,7 @@ public class FloatNumber extends CellValue {
}
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>FloatNumber</code>
*/
@@ -81,40 +80,39 @@ public class FloatNumber extends CellValue {
/**
* Reads a<code>FloatNumber</code> from the specified <code>InputStream</code>
*
- * @param input the <code>InputStram</code> to read from
- */
+ * @param input the <code>InputStram</code> to read from
+ */
public int read(InputStream input) throws IOException {
-
+
int numOfBytesRead = super.read(input);
- numOfBytesRead += input.read(num);
-
+ numOfBytesRead += input.read(num);
+
Debug.log(Debug.TRACE," num : " + getString());
return numOfBytesRead;
}
-
+
public void write(OutputStream output) throws IOException {
output.write(getBiffType());
-
+
super.write(output);
output.write(num);
Debug.log(Debug.TRACE,"Writing FloatNumber record");
}
-
/**
- * Gets the numerical value the cell represents
+ * Gets the numerical value the cell represents
*
- * @return the <code>String</code> representing a double value
+ * @return the <code>String</code> representing a double value
*/
public String getString() throws IOException {
double value = EndianConverter.readDouble(num);
Double myDo = new Double(value);
- return myDo.toString();
+ return myDo.toString();
}
}
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/FontDescription.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/FontDescription.java
index d555c06..21440ae 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/FontDescription.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/FontDescription.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
@@ -39,9 +39,8 @@ import org.openoffice.xmerge.util.EndianConverter;
import org.openoffice.xmerge.util.ColourConverter;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
-
/**
- * Represents a BIFF Record descibing a font used
+ * Represents a BIFF Record descibing a font used
*/
public class FontDescription implements BIFFRecord {
@@ -61,22 +60,20 @@ public class FontDescription implements BIFFRecord {
public static final int ITALIC = 0x02;
/**
- * Constructs a FontDescription from the bold italic and undelrine attributes
+ * Constructs a FontDescription from a Format.
*
- * @param italic Italic attribute
- * @param bold Bold attribute
- * @param underline Underline attribute
+ * @param fmt The <code>Format</code> to use as source.
*/
public FontDescription(Format fmt) throws IOException {
Debug.log(Debug.TRACE,"Building FontDescriptor based on Format : " + fmt);
- this.dwHeight = EndianConverter.writeShort((short) (fmt.getFontSize()*20));
-
+ this.dwHeight = EndianConverter.writeShort((short) (fmt.getFontSize()*20));
+
grbit = new byte[] {(byte)0x00, (byte)0x00};
bls = EndianConverter.writeShort((short) 400);
uls = 0;
-
+
if (fmt.getAttribute(Format.ITALIC))
grbit[0] |= ITALIC;
@@ -86,13 +83,12 @@ public class FontDescription implements BIFFRecord {
if (fmt.getAttribute(Format.UNDERLINE))
uls |= UNDERLINE;
-
bFamily = 0;
bCharSet = 0;
String fontName = fmt.getFontName();
- if( !fontName.equals("Tahoma") &&
- !fontName.equals("Courier New")) {
+ if( !fontName.equals("Tahoma") &&
+ !fontName.equals("Courier New")) {
// We will set our default font to be Tahoma
fontName = new String("Tahoma");
}
@@ -119,12 +115,12 @@ public class FontDescription implements BIFFRecord {
* @return true if italic otherwise false
*/
public boolean isItalic() {
-
+
return (EndianConverter.readShort(grbit) == 2);
}
/**
- * Tests if this font descriptor defines underline
+ * Tests if this font descriptor defines underline
*
* @return true if underline otherwise false
*/
@@ -134,7 +130,7 @@ public class FontDescription implements BIFFRecord {
}
/**
- * Tests if this font descriptor defines bold
+ * Tests if this font descriptor defines bold
*
* @return true if bold otherwise false
*/
@@ -144,7 +140,7 @@ public class FontDescription implements BIFFRecord {
}
/**
- * Get the background color this format uses
+ * Get the background color this format uses
*
* @return the background color
*/
@@ -154,21 +150,21 @@ public class FontDescription implements BIFFRecord {
if(rgb!=0xFF) {
ColourConverter cc = new ColourConverter(PocketExcelConstants.cLookup);
c = cc.convertToRGB(rgb);
- }
+ }
return c;
}
-
+
/**
* Compares current font descriptor against one passed in
*
- * @return true if attrbitues are the same
+ * @return true if attrbitues are the same
*/
public boolean compareTo(FontDescription rhs) {
if(EndianConverter.readShort(icvFore) !=
- EndianConverter.readShort(rhs.icvFore))
+ EndianConverter.readShort(rhs.icvFore))
return false;
-
+
if (EndianConverter.readShort(dwHeight) !=
EndianConverter.readShort(dwHeight))
return false;
@@ -187,26 +183,25 @@ public class FontDescription implements BIFFRecord {
return true;
}
-
/**
- * Constructs a Font Description from the <code>InputStream</code>
+ * Constructs a Font Description from the <code>InputStream</code>
*
- * @param is InputStream containing a <code>FontDescription</code>
+ * @param is InputStream containing a <code>FontDescription</code>
*/
public FontDescription(InputStream is) throws IOException {
read(is);
}
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>FontDescription</code>
*/
public short getBiffType() {
return PocketExcelConstants.FONT_DESCRIPTION;
}
-
+
/**
* Get the Font size
*
@@ -220,7 +215,7 @@ public class FontDescription implements BIFFRecord {
*
*/
public String getFont() {
-
+
String name;
try {
@@ -230,43 +225,43 @@ public class FontDescription implements BIFFRecord {
}
return name;
}
-
+
/**
- * Constructs a Font Description from the <code>InputStream</code>
+ * Constructs a Font Description from the <code>InputStream</code>
*
- * @param is InputStream containing a <code>FontDescription</code>
+ * @param input InputStream containing a <code>FontDescription</code>
*/
public int read(InputStream input) throws IOException {
int numOfBytesRead = input.read(dwHeight);
- numOfBytesRead += input.read(grbit);
- numOfBytesRead += input.read(icvFore);
+ numOfBytesRead += input.read(grbit);
+ numOfBytesRead += input.read(icvFore);
numOfBytesRead += input.read(bls);
numOfBytesRead += input.read(Reserved2);
uls = (byte) input.read();
bFamily = (byte) input.read();
- bCharSet = (byte) input.read();
+ bCharSet = (byte) input.read();
Reserved3 = (byte) input.read();
cch = (byte) input.read();
numOfBytesRead += 5;
-
+
rgch = new byte[cch*2];
- input.read(rgch, 0, cch*2);
-
- Debug.log(Debug.TRACE,"\tdwHeight : "+ EndianConverter.readShort(dwHeight) +
+ input.read(rgch, 0, cch*2);
+
+ Debug.log(Debug.TRACE,"\tdwHeight : "+ EndianConverter.readShort(dwHeight) +
" grbit : " + EndianConverter.readShort(grbit) +
" bls : " + EndianConverter.readShort(bls) +
" uls : " + uls +
- "\n\tFamily : " + bFamily +
+ "\n\tFamily : " + bFamily +
" bCharSet : " + bCharSet +
" cch : " + cch +
" rgch : " + new String(rgch,"UTF-16LE"));
-
+
return numOfBytesRead;
}
-
+
public void write(OutputStream output) throws IOException {
-
+
output.write(getBiffType());
output.write(dwHeight);
output.write(grbit);
@@ -282,5 +277,5 @@ public class FontDescription implements BIFFRecord {
Debug.log(Debug.TRACE,"Writing FontDescription record");
}
-
+
}
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Formula.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Formula.java
index e78645a..9f5a16c 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Formula.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Formula.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
@@ -39,9 +39,8 @@ import org.openoffice.xmerge.converter.xml.sxc.pexcel.records.formula.FormulaHel
import org.openoffice.xmerge.converter.xml.sxc.pexcel.records.Workbook;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
-
/**
- * Represents a BIFF Record describing a formula
+ * Represents a BIFF Record describing a formula
*/
public class Formula extends CellValue implements OfficeConstants {
@@ -50,16 +49,17 @@ public class Formula extends CellValue implements OfficeConstants {
private byte[] cce = new byte[2];
private byte[] rgce;
private FormulaHelper fh = new FormulaHelper();
-
+
/**
- * Constructs a <code>Formula</code> using specified attributes
- *
- * @param row row number
- * @param col column number
- * @param cellContents contents of the cell
- * @param ixfe font index
- * @param value the value of the cell
- */
+ * Constructs a <code>Formula</code> using specified attributes
+ *
+ * @param row row number
+ * @param column column number
+ * @param cellContents contents of the cell
+ * @param ixfe font index
+ * @param fmt cell format description.
+ * @param wb the workbook we are defined in.
+ */
public Formula(int row, int column, String cellContents, int ixfe, Format fmt, Workbook wb)
throws Exception {
@@ -69,10 +69,10 @@ public class Formula extends CellValue implements OfficeConstants {
setCol(column);
setIxfe(ixfe);
setFormula(cellContents);
-
+
String category = fmt.getCategory();
String value = fmt.getValue();
-
+
if(category.equalsIgnoreCase(CELLTYPE_BOOLEAN)) {
num[0]=(byte)0x01;
num[1]=(byte)0x00;
@@ -111,24 +111,25 @@ public class Formula extends CellValue implements OfficeConstants {
num = EndianConverter.writeDouble(cellLong);
}
}
-
+
/**
* Translates a <code>String</code> written in infix which represents a
* formula into a byte[] what can be written to pocket excel file.
*
- * @param formula string
+ * @param inFormula formula string
*/
public void setFormula(String inFormula) throws Exception {
rgce = fh.convertCalcToPXL(inFormula);
cce = EndianConverter.writeShort((short) rgce.length);
}
-
+
/**
* Constructs a pocket Excel formula from the
- * <code>InputStream</code>
+ * <code>InputStream</code>
*
* @param is InputStream containing a Pocket Excel Data file.
+ * @param wb The workbook we are defined in.
*/
public Formula(InputStream is, Workbook wb) throws IOException {
read(is);
@@ -136,51 +137,52 @@ public class Formula extends CellValue implements OfficeConstants {
}
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>Formula</code>
*/
public short getBiffType() {
return PocketExcelConstants.FORMULA_CELL;
}
-
+
/**
* Reads the formula data members from the stream. Byte arrays for Strings
* are doubled as they are stored as unicode
*
- * @return total number of bytes read
+ * @param input the input stream to read from.
+ * @return total number of bytes read
*/
public int read(InputStream input) throws IOException {
int numOfBytesRead = super.read(input);
numOfBytesRead += input.read(num);
- grbit = (byte) input.read();
+ grbit = (byte) input.read();
numOfBytesRead ++;
numOfBytesRead += input.read(cce);
-
+
int strLen = EndianConverter.readShort(cce);
rgce = new byte[strLen];
- input.read(rgce, 0, strLen);
-
+ input.read(rgce, 0, strLen);
+
Debug.log(Debug.TRACE, " num : " + num +
- "\n\tgrbit : " + grbit +
+ "\n\tgrbit : " + grbit +
" cce : " + EndianConverter.readShort(cce) +
- " rgce : " + new String(rgce,"UTF-16LE") +
+ " rgce : " + new String(rgce,"UTF-16LE") +
"\n" + numOfBytesRead + " Bytes Read");
-
+
return numOfBytesRead;
}
/**
- * Writes the Formula record to the <code>OutputStream</code>
+ * Writes the Formula record to the <code>OutputStream</code>
*
- * @param the <code>OutputStream</code> being written to
- */
+ * @param output The <code>OutputStream</code> being written to
+ */
public void write(OutputStream output) throws IOException {
output.write(getBiffType());
-
+
super.write(output);
output.write(num);
@@ -204,7 +206,7 @@ public class Formula extends CellValue implements OfficeConstants {
}
/**
- * Gets the <code>String</code> representing the cells contents
+ * Gets the <code>String</code> representing the cells contents
*
* @return the <code>String</code> representing the cells contents
*/
@@ -212,13 +214,13 @@ public class Formula extends CellValue implements OfficeConstants {
return fh.convertPXLToCalc(rgce);
}
-
+
/**
* Excel dates are the number of days since 1/1/1900. This method converts
* to this date.
*
- * @param s String representing a date in the form YYYY-MM-DD
- * @return The excel serial date
+ * @param s String representing a date in the form YYYY-MM-DD
+ * @return The excel serial date
*/
public long toExcelSerialDate(String s) throws IOException {
@@ -229,17 +231,17 @@ public class Formula extends CellValue implements OfficeConstants {
long serialDate = (1461 * (year + 4800 + (month - 14) / 12)) / 4 +
(367 * (month - 2 - 12 * ((month - 14) / 12))) / 12 -
(3 * ((year + 4900 + (month - 14) / 12)) / 100) / 4 +
- day - 2415019 - 32075;
+ day - 2415019 - 32075;
return serialDate;
}
-
+
/**
* Excel times are a fraction of a 24 hour day expressed in seconds. This method converts
* to this time.
*
- * @param s String representing a time in the form ??HH?MM?SS?
- * @return The excel serial time
+ * @param s String representing a time in the form ??HH?MM?SS?
+ * @return The excel serial time
*/
public double toExcelSerialTime(String s) throws IOException {
@@ -249,7 +251,7 @@ public class Formula extends CellValue implements OfficeConstants {
int timeSecs = (hours*3600) + (mins*60) + (secs);
- double d = (double) timeSecs / (24 * 3600);
+ double d = (double) timeSecs / (24 * 3600);
return d;
}
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/LabelCell.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/LabelCell.java
index 879c187..9506ed1 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/LabelCell.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/LabelCell.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
@@ -35,7 +35,6 @@ import org.openoffice.xmerge.util.Debug;
import org.openoffice.xmerge.util.EndianConverter;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
-
/**
* Reperesent a BIFF Record descibing a cell containing a string
*/
@@ -43,19 +42,19 @@ public class LabelCell extends CellValue {
private byte[] cch = new byte[2];
private byte[] rgch;
-
+
/**
* Constructs a <code>LabelCell</code> using specified attributes
- *
- * @param row row number
- * @param col column number
- * @param cellContents contents of the cell
- * @param ixfe font index
+ *
+ * @param row row number
+ * @param column column number
+ * @param cellContents contents of the cell
+ * @param ixfe font index
*/
public LabelCell(int row, int column, String cellContents, int ixfe)
throws IOException {
- setLabel(cellContents);
+ setLabel(cellContents);
setRow(row);
setCol(column);
setIxfe(ixfe);
@@ -67,18 +66,18 @@ public class LabelCell extends CellValue {
* @param is the <code>Inputstream</code> to read from
*/
public LabelCell(InputStream is) throws IOException {
- read(is);
+ read(is);
}
/**
* Writes a <code>LabelCell</code> to the specified <code>Outputstream</code>
*
- * @param os the <code>OutputStream</code> to write to
+ * @param output The <code>OutputStream</code> to write to
*/
public void write(OutputStream output) throws IOException {
output.write(getBiffType());
-
+
super.write(output);
output.write(cch);
@@ -86,40 +85,39 @@ public class LabelCell extends CellValue {
Debug.log(Debug.TRACE,"Writing Label record");
}
-
+
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>LabelCell</code>
*/
public short getBiffType() {
return PocketExcelConstants.LABEL_CELL;
}
-
+
/**
* Reads a<code>LabelCell</code> from the specified <code>InputStream</code>
*
- * @param input the <code>InputStram</code> to read from
+ * @param input the <code>InputStram</code> to read from
*/
public int read(InputStream input) throws IOException {
int numOfBytesRead = super.read(input);
numOfBytesRead += input.read(cch);
-
+
int strLen = EndianConverter.readShort(cch)*2;
rgch = new byte[strLen];
- input.read(rgch, 0, strLen);
-
+ input.read(rgch, 0, strLen);
+
Debug.log(Debug.TRACE, " cch : " + EndianConverter.readShort(cch) +
- " rgch : " + new String(rgch, "UTF-16LE"));
-
- return numOfBytesRead;
- }
+ " rgch : " + new String(rgch, "UTF-16LE"));
+ return numOfBytesRead;
+ }
/**
- * Gets the <code>String</code> representing the cells contents
+ * Gets the <code>String</code> representing the cells contents
*
* @return the <code>String</code> representing the cells contents
*/
@@ -128,7 +126,7 @@ public class LabelCell extends CellValue {
}
/**
- * Sets the <code>String</code> representing the cells contents
+ * Sets the <code>String</code> representing the cells contents
*
* @return the <code>String</code> representing the cells contents
*/
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Pane.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Pane.java
index b57135a..bf5e796 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Pane.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Pane.java
@@ -124,9 +124,11 @@ public class Pane implements BIFFRecord {
}
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Set the pane number
+ * 0 - bottom right, 1 - top right
+ * 2 - bottom left, 3 - top left
*
- * @return the hex code for <code>Pane</code>
+ * @param paneNumber the pane number
*/
public void setPaneNumber(int paneNumber) {
pnnAcct = (byte) paneNumber;
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Row.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Row.java
index e0e00f6..44bc16d 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Row.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Row.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
@@ -26,7 +26,7 @@
************************************************************************/
package org.openoffice.xmerge.converter.xml.sxc.pexcel.records;
-
+
import java.io.OutputStream;
import java.io.InputStream;
import java.io.IOException;
@@ -35,7 +35,6 @@ import org.openoffice.xmerge.util.Debug;
import org.openoffice.xmerge.util.EndianConverter;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
-
/**
* Represents s BIFF Record that describes the format of a column
*/
@@ -46,12 +45,12 @@ public class Row implements BIFFRecord {
private byte[] grbit = new byte[2];
private byte[] ixfe = new byte[2];
private float scale = (float) 1;
-
+
/**
* Constructs a pocket Excel Document from the
* <code>InputStream</code> and assigns it the document name passed in
*
- * @param rw Zero based row number
+ * @param rw Zero based row number
* @param miyRw row height
*/
public Row(int rw, int miyRw, boolean userDefined) {
@@ -67,62 +66,62 @@ public class Row implements BIFFRecord {
}
/**
- * Constructs a Row fro man <code>InputStream</code>
+ * Constructs a Row fro man <code>InputStream</code>
*
- * @param is InputStream containing a Pane Record
+ * @param is InputStream containing a Pane Record
*/
public Row(InputStream is) throws IOException {
- read(is);
+ read(is);
}
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>Row</code>
*/
public short getBiffType() {
return PocketExcelConstants.ROW_DESCRIPTION;
}
-
+
/**
- * Get the height of this row
+ * Get the height of this row
*
- * @return the height of this row
+ * @return the height of this row
*/
public short getRowHeight() {
return EndianConverter.readShort(miyRw);
}
-
+
/**
- * Get the rown number for this style
+ * Get the row number
*
- * @return the row this style applies to
+ * @return the row this style applies to
*/
public short getRowNumber() {
return EndianConverter.readShort(rw);
- }
+ }
/**
- * Reads a Row from an <code>InputStream</code>
+ * Reads a Row from an <code>InputStream</code>
*
- * @param is InputStream containing a Pane Record
+ * @param input InputStream containing a Row Record
*/
public int read(InputStream input) throws IOException {
-
+
int numOfBytesRead = input.read(rw);
numOfBytesRead += input.read(miyRw);
short scaledHeight = (short) (EndianConverter.readShort(miyRw) / scale);
- miyRw = EndianConverter.writeShort(scaledHeight);
+ miyRw = EndianConverter.writeShort(scaledHeight);
numOfBytesRead += input.read(grbit);
numOfBytesRead += input.read(ixfe);
-
- Debug.log(Debug.TRACE,"\trw : "+ EndianConverter.readShort(rw) +
+
+ Debug.log(Debug.TRACE,"\trw : "+ EndianConverter.readShort(rw) +
" miyRw : " + EndianConverter.readShort(miyRw) +
" grbit : " + EndianConverter.readShort(grbit) +
- " ixfe : " + EndianConverter.readShort(ixfe));
+ " ixfe : " + EndianConverter.readShort(ixfe));
return numOfBytesRead;
}
-
+
public void write(OutputStream output) throws IOException {
output.write(getBiffType());
@@ -134,5 +133,5 @@ public class Row implements BIFFRecord {
Debug.log(Debug.TRACE,"Writing Row record");
}
-
+
}
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Selection.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Selection.java
index effa109..191a0e9 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Selection.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Selection.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
@@ -36,7 +36,6 @@ import org.openoffice.xmerge.util.Debug;
import org.openoffice.xmerge.util.EndianConverter;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
-
/**
* Represents a BIFF Record that describes the selected area of a worksheet
*/
@@ -48,66 +47,66 @@ public class Selection implements BIFFRecord {
private byte colRight;
private byte[] rwActive = new byte[2];
private byte colActive;
-
+
/**
* Default Constructor
*/
public Selection() {
this.rwTop = EndianConverter.writeShort((short) 0);
- this.colLeft = 0;
+ this.colLeft = 0;
this.rwBottom = EndianConverter.writeShort((short) 0);
- this.colRight = 0;
+ this.colRight = 0;
this.rwActive = EndianConverter.writeShort((short) 0);
- this.colActive = 0;
-
+ this.colActive = 0;
+
}
/**
- * Constructs a Selection Record from the <code>InputStream</code>
+ * Constructs a Selection Record from the <code>InputStream</code>
*
* @param is InputStream containing a Pocket Excel Data file.
*/
public Selection(InputStream is) throws IOException {
- read(is);
+ read(is);
}
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>Selection</code>
*/
public short getBiffType() {
return PocketExcelConstants.CURRENT_SELECTION;
}
-
+
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the active cell for this particular <code>BIFFRecord</code>
*
- * @return the hex code for <code>Selection</code>
+ * @return the cell position
*/
public Point getActiveCell() {
Point p = new Point(colActive, EndianConverter.readShort(rwActive));
return p;
- }
-
+ }
+
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Set the active cell position for this particular <code>BIFFRecord</code>
*
- * @return the hex code for <code>Selection</code>
+ * @param p The active cell position
*/
public void setActiveCell(Point p) {
colActive = (byte) p.getX();
rwActive = EndianConverter.writeShort((short) p.getY());
}
-
+
/**
- * Reads a Selection Record from the <code>InputStream</code>
+ * Reads a Selection Record from the <code>InputStream</code>
*
- * @param is InputStream containing a Pocket Excel Data file.
+ * @param input InputStream containing a Pocket Excel Data file.
*/
public int read(InputStream input) throws IOException {
-
+
int numOfBytesRead = input.read(rwTop);
colLeft += (byte) input.read();
numOfBytesRead += input.read(rwBottom);
@@ -115,17 +114,17 @@ public class Selection implements BIFFRecord {
numOfBytesRead += input.read(rwActive);
colActive += (byte) input.read();
numOfBytesRead += 3;
-
- Debug.log(Debug.TRACE,"\trwTop : "+ EndianConverter.readShort(rwTop) +
+
+ Debug.log(Debug.TRACE,"\trwTop : "+ EndianConverter.readShort(rwTop) +
" colLeft : " + colLeft +
" rwBottom : " + EndianConverter.readShort(rwBottom) +
- " colRight : "+ colRight +
+ " colRight : "+ colRight +
" rwActive : " + EndianConverter.readShort(rwActive) +
" colActive : " + colActive);
-
- return numOfBytesRead;
+
+ return numOfBytesRead;
}
-
+
public void write(OutputStream output) throws IOException {
output.write(getBiffType());
@@ -138,5 +137,5 @@ public class Selection implements BIFFRecord {
Debug.log(Debug.TRACE,"Writing Selection record");
}
-
+
}
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/StringValue.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/StringValue.java
index f2fa163..1a98c67 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/StringValue.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/StringValue.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
@@ -36,7 +36,6 @@ import org.openoffice.xmerge.util.Debug;
import org.openoffice.xmerge.util.EndianConverter;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
-
/**
* Represents a BIFF Record that describes the value of a formula that
* evaluates to a string
@@ -47,55 +46,55 @@ public class StringValue implements BIFFRecord {
private byte[] rgch;
/**
- * Constructs a StringValue Record from an <code>InputStream</code>
+ * Constructs a StringValue Record from a string
*
- * @param is InputStream containing a StringValue Record
+ * @param str String containing value
*/
public StringValue(String str) throws IOException {
cch = EndianConverter.writeShort((short) str.length());
rgch = new byte[str.length()];
rgch = str.getBytes("UTF-16LE");
}
-
+
/**
- * Constructs a StringValue Record from an <code>InputStream</code>
+ * Constructs a StringValue Record from an <code>InputStream</code>
*
- * @param is InputStream containing a StringValue Record
+ * @param is InputStream containing a StringValue Record
*/
public StringValue(InputStream is) throws IOException {
read(is);
}
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>StringValue</code>
*/
public short getBiffType() {
return PocketExcelConstants.FORMULA_STRING;
}
-
+
/**
- * Reads a StringVlaue Record from an <code>InputStream</code>
+ * Reads a StringVlaue Record from an <code>InputStream</code>
*
- * @param is InputStream containing a StringValue Record
+ * @param input InputStream containing a StringValue Record
*/
public int read(InputStream input) throws IOException {
-
+
cch[0] = (byte) input.read();
cch[1] = (byte) input.read();
int numOfBytesRead = 1;
-
+
int strlen = EndianConverter.readShort(cch)*2;
rgch = new byte[strlen];
- numOfBytesRead += input.read(rgch, 0, strlen);
-
- Debug.log(Debug.TRACE,"\tcch : "+ cch +
+ numOfBytesRead += input.read(rgch, 0, strlen);
+
+ Debug.log(Debug.TRACE,"\tcch : "+ cch +
" rgch : " + rgch);
-
+
return numOfBytesRead;
}
-
+
public void write(OutputStream output) throws IOException {
output.write(getBiffType());
@@ -106,7 +105,7 @@ public class StringValue implements BIFFRecord {
}
/**
- * Gets the <code>String</code> representing the cells contents
+ * Gets the <code>String</code> representing the cells contents
*
* @return the <code>String</code> representing the cells contents
*/
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Window1.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Window1.java
index 428de2a..576ed9e 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Window1.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Window1.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
@@ -35,15 +35,14 @@ import org.openoffice.xmerge.util.Debug;
import org.openoffice.xmerge.util.EndianConverter;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
-
/**
- * Represents a BIFF REcord that describes workbook window attributes
+ * Represents a BIFF REcord that describes workbook window attributes
*/
public class Window1 implements BIFFRecord {
private byte[] grbit = new byte[2];
private byte[] itabCur = new byte[2]; // index of selected worksheet
-
+
/**
* Constructor
*/
@@ -53,57 +52,57 @@ public class Window1 implements BIFFRecord {
}
/**
- * Constructs a Window1 Record from an <code>InputStream</code>
+ * Constructs a Window1 Record from an <code>InputStream</code>
*
- * @param is InputStream containing a Window1 Record
+ * @param is InputStream containing a Window1 Record
*/
public Window1(InputStream is) throws IOException{
- read(is);
+ read(is);
}
-
+
/**
* Set the number of the active sheet
*
- * @param activeSheet number of the active sheet
+ * @param activeSheet number of the active sheet
*/
public void setActiveSheet(int activeSheet) {
itabCur = EndianConverter.writeShort((short) activeSheet);
}
-
+
/**
- * Get the number of the active sheet
+ * Get the number of the active sheet
*
* @return number of the active sheet
*/
public int getActiveSheet() {
return EndianConverter.readShort(itabCur);
- }
+ }
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>Window1</code>
*/
public short getBiffType() {
return PocketExcelConstants.WINDOW_INFO;
}
-
+
/**
- * Reads a Window1 Record from an <code>InputStream</code>
+ * Reads a Window1 Record from an <code>InputStream</code>
*
- * @param is InputStream containing a Window1 Record
+ * @param input InputStream containing a Window1 Record
*/
public int read(InputStream input) throws IOException {
-
+
int numOfBytesRead = input.read(grbit);
numOfBytesRead += input.read(itabCur);
-
- Debug.log(Debug.TRACE,"\tgrbit : "+ EndianConverter.readShort(grbit) +
+
+ Debug.log(Debug.TRACE,"\tgrbit : "+ EndianConverter.readShort(grbit) +
" itabCur : " + EndianConverter.readShort(itabCur));
-
- return numOfBytesRead;
+
+ return numOfBytesRead;
}
-
+
public void write(OutputStream output) throws IOException {
output.write(getBiffType());
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Window2.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Window2.java
index 8557b9c..7069cd3 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Window2.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Window2.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
@@ -37,7 +37,6 @@ import org.openoffice.xmerge.util.EndianConverter;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
import org.openoffice.xmerge.converter.xml.sxc.SheetSettings;
-
/**
* Represents a BIFF Record that describes worksheet window attributes
*/
@@ -49,27 +48,27 @@ public class Window2 implements BIFFRecord {
private byte[] rwTop = new byte[2];
private byte colLeft;
private byte[] grbit = new byte[2];
-
+
/**
- * Constructor
+ * Constructor
*/
public Window2() {
this.rwTop = EndianConverter.writeShort((short) 0);
- this.colLeft = 0;
+ this.colLeft = 0;
this.grbit = EndianConverter.writeShort((short) 0);
}
-
+
/**
- * Constructs a Window2 Record from an <code>InputStream</code>
+ * Constructs a Window2 Record from an <code>InputStream</code>
*
- * @param is InputStream containing a Window2 Record
+ * @param is InputStream containing a Window2 Record
*/
public Window2(InputStream is) throws IOException {
- read(is);
+ read(is);
}
/**
- * Get the hex code for this particular <code>BIFFRecord</code>
+ * Get the hex code for this particular <code>BIFFRecord</code>
*
* @return the hex code for <code>Window2</code>
*/
@@ -94,8 +93,8 @@ public class Window2 implements BIFFRecord {
}
}
- /**
- * This method tests if this object describes a freeze
+ /**
+ * This method tests if this object describes a freeze
*
* @return true if freeze otherwise false
*/
@@ -109,7 +108,7 @@ public class Window2 implements BIFFRecord {
return true;
}
- /**
+ /**
* This method tests if this object describes a split
*
* @return true if split otherwise false
@@ -123,25 +122,25 @@ public class Window2 implements BIFFRecord {
return true;
}
-
+
/**
- * Reads a Window2 Record from an <code>InputStream</code>
+ * Reads a Window2 Record from an <code>InputStream</code>
*
- * @param is InputStream containing a Window2 Record
+ * @param input InputStream containing a Window2 Record
*/
public int read(InputStream input) throws IOException {
-
+
int numOfBytesRead = input.read(rwTop);
colLeft = (byte) input.read();
numOfBytesRead++;
numOfBytesRead += input.read(grbit);
-
- Debug.log(Debug.TRACE,"\trwTop : "+ EndianConverter.readShort(rwTop) +
+
+ Debug.log(Debug.TRACE,"\trwTop : "+ EndianConverter.readShort(rwTop) +
" colLeft : " + colLeft +
" grbit : " + EndianConverter.readShort(grbit));
- return numOfBytesRead;
+ return numOfBytesRead;
}
-
+
public void write(OutputStream output) throws IOException {
output.write(getBiffType());
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Workbook.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Workbook.java
index b6c7e78..4360db7 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Workbook.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Workbook.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
@@ -44,9 +44,9 @@ import org.openoffice.xmerge.converter.xml.sxc.ColumnRowInfo;
/**
* This class is used by <code> PxlDocument</code> to maintain pexcel
- * workbooks.
+ * workbooks.
*
- * @author Martin Maher
+ * @author Martin Maher
*/
public class Workbook implements org.openoffice.xmerge.Document,
OfficeConstants {
@@ -69,7 +69,6 @@ OfficeConstants {
eof = new Eof();
}
-
/**
* Constructs a pocket Excel Workbook with the name of the file passed in
* as an argument. Also fills out a basic header block containing the
@@ -91,7 +90,9 @@ OfficeConstants {
* Constructs a pocket Excel Workbook from the
* <code>InputStream</code> and assigns it the document name passed in
*
- * @param is InputStream containing a Pocket Excel Data file.
+ * @param name Name of the Pocket Excel Data file. (including the file
+ * extension)
+ * @param is InputStream containing a Pocket Excel Data file.
*/
public Workbook(String name, InputStream is) throws IOException {
read(is);
@@ -99,9 +100,9 @@ OfficeConstants {
}
/**
- * Writes the current workbook to the <code>Outputstream</code>
- *
- * @param os The destination outputstream
+ * Writes the current workbook to the <code>Outputstream</code>
+ *
+ * @param os The destination outputstream
*/
public void write(OutputStream os) throws IOException {
bof.write(os);
@@ -133,7 +134,7 @@ OfficeConstants {
/**
* Reads a workbook from the <code>InputStream</code> and contructs a
- * workbook object from it
+ * workbook object from it
*
* @param is InputStream containing a Pocket Excel Data file.
*/
@@ -150,7 +151,7 @@ OfficeConstants {
Debug.log(Debug.TRACE,"End of file reached");
break;
}
-
+
switch (b)
{
case PocketExcelConstants.DEFINED_NAME:
@@ -158,12 +159,12 @@ OfficeConstants {
DefinedName dn = new DefinedName(is, this);
definedNames.add(dn);
break;
-
+
case PocketExcelConstants.BOF_RECORD:
Debug.log(Debug.TRACE,"BOF Record");
bof.read(is);
break;
-
+
case PocketExcelConstants.EOF_MARKER:
Debug.log(Debug.TRACE,"EOF Marker");
eof.read(is);
@@ -173,7 +174,7 @@ OfficeConstants {
ws = new Worksheet(this);
}
break;
-
+
case PocketExcelConstants.FONT_DESCRIPTION:
Debug.log(Debug.TRACE,"FONT: Font Description (31h)");
FontDescription fd = new FontDescription(is);
@@ -184,7 +185,7 @@ OfficeConstants {
Debug.log(Debug.TRACE,"WINDOW1: Window Information (3Dh) [PXL 2.0]");
win1.read(is);
break;
-
+
case PocketExcelConstants.CODEPAGE:
Debug.log(Debug.TRACE,"CODEPAGE : Codepage and unknown fields (42h)");
cp.read(is);
@@ -195,32 +196,32 @@ OfficeConstants {
BoundSheet bs = new BoundSheet(is);
boundsheets.add(bs);
break;
-
+
case PocketExcelConstants.EXTENDED_FORMAT:
Debug.log(Debug.TRACE,"XF: Extended Format (E0h) [PXL 2.0]");
ExtendedFormat xf = new ExtendedFormat(is);
extendedFormats.add(xf);
break;
-
+
default:
b = is.read();
break;
}
-
+
}
is.close();
}
-
+
/**
- * Adds a font recrod to the workbook
+ * Adds a font recrod to the workbook
*
- * @param f the font record to add
- */
+ * @param f the font record to add
+ */
public int addFont(FontDescription f) {
boolean alreadyExists = false;
int i = 0;
-
+
for(Enumeration e = fonts.elements();e.hasMoreElements();) {
FontDescription fd = (FontDescription) e.nextElement();
if(fd.compareTo(f)) {
@@ -230,18 +231,18 @@ OfficeConstants {
i++;
}
}
-
- if(!alreadyExists)
+
+ if(!alreadyExists)
fonts.add(f);
- return i;
+ return i;
}
/**
- * Adds a ExtendedFormat record to the workbook
+ * Adds a ExtendedFormat record to the workbook
*
- * @param f the font recrod to add
- */
+ * @param fmt the font record to add
+ */
public int addExtendedFormat(Format fmt) throws IOException {
FontDescription fd = new FontDescription(fmt);
@@ -250,7 +251,7 @@ OfficeConstants {
boolean alreadyExists = false;
int i = 0;
-
+
for(Enumeration e = extendedFormats.elements();e.hasMoreElements();) {
ExtendedFormat currentXF = (ExtendedFormat) e.nextElement();
if(xf.compareTo(currentXF)) {
@@ -263,30 +264,30 @@ OfficeConstants {
if(!alreadyExists)
extendedFormats.add(xf);
-
- return i;
+
+ return i;
}
-
+
/**
- * Gets a worksheet at a particular index from mthe current workbook.
+ * Gets a worksheet at a particular index from mthe current workbook.
*
- * @param index the index of the worksheet to retrieve
+ * @param index the index of the worksheet to retrieve
*/
public Worksheet getWorksheet(int index) {
return ((Worksheet) worksheets.elementAt(index));
}
-
+
/**
* Returns a FontDescription indictated by the
* index parameter passed in to the method
*
* @param ixfnt index to the FontDescriptions, this is a 0 based index
- * @return FontDescription indexed by ixfe
+ * @return FontDescription indexed by ixfe
*/
public FontDescription getFontDescription(int ixfnt) {
- return (FontDescription) fonts.elementAt(ixfnt);
+ return (FontDescription) fonts.elementAt(ixfnt);
}
/**
@@ -294,15 +295,15 @@ OfficeConstants {
* index parameter passed in to the method
*
* @param ixfe index to the FontDescriptions, this is a 0 based index
- * @return FontDescription indexed by ixfe
+ * @return FontDescription indexed by ixfe
*/
public ExtendedFormat getExtendedFormat(int ixfe) {
- return (ExtendedFormat) extendedFormats.elementAt(ixfe);
- }
+ return (ExtendedFormat) extendedFormats.elementAt(ixfe);
+ }
/**
- * Returns an enumeration of DefinedNames for this workbook
+ * Returns an enumeration of DefinedNames for this workbook
*
* @return Enumeration for the DefinedNames
*/
@@ -310,9 +311,9 @@ OfficeConstants {
return definedNames.elements();
}
-
+
/**
- * Returns an enumeration of <code>Settings</code> for this workbook
+ * Returns an enumeration of <code>Settings</code> for this workbook
*
* @return Enumeration of <code>Settings</code>
*/
@@ -333,39 +334,39 @@ OfficeConstants {
}
/**
- * Returns a <code>Vector</code> containing all the worksheet Names
+ * Returns a <code>Vector</code> containing all the worksheet Names
*
- * @return a <code>Vector</code> containing all the worksheet Names
- */
+ * @return a <code>Vector</code> containing all the worksheet Names
+ */
public Vector getWorksheetNames() {
Vector wsNames = new Vector();
for(int i = 0;i < boundsheets.size();i++) {
wsNames.add(getSheetName(i));
- }
+ }
return wsNames;
}
/**
- * Returns the name of the worksheet at the specified index
+ * Returns the name of the worksheet at the specified index
*
- * @return a <code>String</code> containing the name of the worksheet
- */
+ * @return a <code>String</code> containing the name of the worksheet
+ */
public String getSheetName(int index) {
- BoundSheet bs = (BoundSheet) boundsheets.elementAt(index);
+ BoundSheet bs = (BoundSheet) boundsheets.elementAt(index);
return bs.getSheetName();
}
/**
- * Adds a <code>Worksheet</code> to the workbook.
+ * Adds a <code>Worksheet</code> to the workbook.
*
- * @return name the name of the <code>Worksheet</code> to be added
- */
+ * @param name the name of the <code>Worksheet</code> to be added
+ */
public void addWorksheet(String name) throws IOException {
-
+
BoundSheet bs = new BoundSheet(name);
boundsheets.add(bs);
@@ -374,13 +375,16 @@ OfficeConstants {
}
/**
- * Adds a cell to the current worksheet.
+ * Adds a cell to the current worksheet.
*
- * @return the name of the <code>Worksheet</code> to be added
+ * @param row Row index for the new cell.
+ * @param col Column index for the new cell.
+ * @param fmt Format description for the new cell.
+ * @param cellContents Contents for the new cell.
*/
public void addCell(int row,int col, Format fmt, String cellContents)
throws IOException {
-
+
Worksheet currentWS = (Worksheet) worksheets.elementAt(worksheets.size()-1);
int ixfe = addExtendedFormat(fmt);
@@ -410,31 +414,31 @@ OfficeConstants {
} catch(Exception e) {
Debug.log(Debug.TRACE,"Error could not parse Float " + cellContents);
LabelCell lc = new LabelCell(row, col, cellContents, ixfe);
- currentWS.addCell(lc);
+ currentWS.addCell(lc);
}
} else {
if(cellContents.length()==0) {
Debug.log(Debug.TRACE, "Blank Cell");
BlankCell b = new BlankCell(row, col, ixfe);
- currentWS.addCell(b);
+ currentWS.addCell(b);
} else {
Debug.log(Debug.TRACE, "Label Cell : " + cellContents);
LabelCell lc = new LabelCell(row, col, cellContents, ixfe);
- currentWS.addCell(lc); // three because we assume the last three
- // Records in any worksheet is the selection,
- // window2 and eof Records
+ currentWS.addCell(lc); // three because we assume the last three
+ // Records in any worksheet is the selection,
+ // window2 and eof Records
}
}
}
/**
* Will create a number of ColInfo records based on the column widths
- * based in.
+ * passed in.
*
* @param columnRows <code>Vector</code> of <code>ColumnRowInfo</code>
*/
public void addColInfo(Vector columnRows) throws IOException {
-
+
Worksheet currentWS = (Worksheet) worksheets.elementAt(worksheets.size()-1);
int nCols = 0;
@@ -449,14 +453,14 @@ OfficeConstants {
if(cri.isColumn()) {
Debug.log(Debug.TRACE,"Workbook: adding ColInfo width = " + size);
ColInfo newColInfo = new ColInfo( nCols,
- nCols+repeated-1,
+ nCols+repeated-1,
size, ixfe);
currentWS.addCol(newColInfo);
nCols += repeated;
} else if(cri.isRow()) {
-
+
Debug.log(Debug.TRACE,"Workbook: adding Row Height = " + size);
- if(!cri.isDefaultSize()) {
+ if(!cri.isDefaultSize()) {
for(int i=0;i<repeated;i++) {
Row newRow = new Row(nRows++, size, cri.isUserDefined());
currentWS.addRow(newRow);
@@ -465,26 +469,25 @@ OfficeConstants {
// If it is the Default Row we don't need to add it
nRows += repeated;
}
-
- }
+
+ }
}
}
- /**
- * Will create a number of ColInfo recrods based on the column widths
- * based in.
- *
- * @param an integer list representing the column widths
- */
+ /**
+ * Add a name definition to the workbook.
+ *
+ * @param nameDefinition The name definition to add.
+ */
public void addNameDefinition(NameDefinition nameDefinition) throws IOException {
DefinedName dn = new DefinedName(nameDefinition, this);
definedNames.add(dn);
}
-
+
/**
* Adds the <code>BookSettings</code> for this workbook.
- *
+ *
* @param book the <code>BookSettings</code> to add
*/
public void addSettings(BookSettings book) throws IOException {
@@ -492,7 +495,7 @@ OfficeConstants {
int index = 0;
Vector sheetSettings = book.getSheetSettings();
String activeSheetName = book.getActiveSheet();
-
+
for(Enumeration e = worksheets.elements();e.hasMoreElements();) {
Worksheet ws = (Worksheet) e.nextElement();
String name = getSheetName(index++);
@@ -507,11 +510,11 @@ OfficeConstants {
}
}
}
-
+
/**
- * Return the filename of the pxl document without the file extension
+ * Return the filename of the pxl document without the file extension
*
- * @return filename without the file extension
+ * @return filename without the file extension
*/
public String getName() {
@@ -525,15 +528,15 @@ OfficeConstants {
return name;
}
-
+
/**
- * Returns the filename of the pxl document with the file extension
+ * Returns the filename of the pxl document with the file extension
*
- * @return filename with the file extension
+ * @return filename with the file extension
*/
public String getFileName() {
return fileName;
}
-
+
}
diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Worksheet.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Worksheet.java
index 7b681af..34cefbc 100644
--- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Worksheet.java
+++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Worksheet.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
@@ -38,12 +38,11 @@ import org.openoffice.xmerge.util.Debug;
import org.openoffice.xmerge.converter.xml.sxc.SheetSettings;
import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
-
/**
* This class is used by <code>PxlDocument</code> to maintain pexcel
- * worksheets.
+ * worksheets.
*
- * @author Martin Maher
+ * @author Martin Maher
*/
public class Worksheet {
@@ -59,31 +58,29 @@ public class Worksheet {
private Pane p = new Pane();
private BeginningOfFile bof;
private Eof eof;
-
+
/**
- * Writes the current workbook to the <code>Outputstream</code>
- *
- * @param os The destination outputstream
+ * Creates a worksheet in a given workbook.
+ *
+ * @param wb The destination workbook.
*/
public Worksheet(Workbook wb) {
this.wb = wb;
}
-
+
/**
- * Default Contructor
- *
- * @param os The destination outputstream
+ * Default Contructor. Creates a worksheet not attached to any workbook.
*/
public Worksheet() {
- }
+ }
/**
- * Writes the current workbook to the <code>Outputstream</code>
- *
- * @param os The destination outputstream
+ * Writes the current workbook to the <code>Outputstream</code>
+ *
+ * @param os The destination outputstream
*/
public void write(OutputStream os) throws IOException {
-
+
bof = new BeginningOfFile(false);
bof.write(os);
dcw.write(os);
@@ -108,11 +105,12 @@ public class Worksheet {
}
/**
- * Reads a worksheet from the <code>InputStream</code> and contructs a
- * workbook object from it
+ * Reads a worksheet from the <code>InputStream</code> and contructs a
+ * workbook object from it
*
- * @param is InputStream containing a Pocket Excel Data file.
- */
+ * @param is InputStream containing a Pocket Excel Data file.
+ * @return True if we read anything. False if not.
+ */
public boolean read(InputStream is) throws IOException {
int b = is.read();
@@ -128,13 +126,13 @@ public class Worksheet {
BlankCell bc = new BlankCell(is);
cells.add(bc);
break;
-
+
case PocketExcelConstants.NUMBER_CELL:
Debug.log(Debug.TRACE,"NUMBER: Cell Value, Floating-Point Number (03h)");
- FloatNumber fn = new FloatNumber(is);
+ FloatNumber fn = new FloatNumber(is);
cells.add(fn);
break;
-
+
case PocketExcelConstants.LABEL_CELL:
Debug.log(Debug.TRACE,"LABEL: Cell Value, String Constant (04h)");
LabelCell lc = new LabelCell(is);
@@ -149,14 +147,14 @@ public class Worksheet {
case PocketExcelConstants.FORMULA_CELL:
Debug.log(Debug.TRACE,"FORMULA: Cell Formula (06h)");
Formula f = new Formula(is, wb);
- cells.add(f);
+ cells.add(f);
break;
-
+
case PocketExcelConstants.FORMULA_STRING:
Debug.log(Debug.TRACE,"String Value of a Formula (07h)");
StringValue sv = new StringValue(is);
break;
-
+
case PocketExcelConstants.ROW_DESCRIPTION:
Debug.log(Debug.TRACE,"ROW: Describes a Row (08h)");
Row rw = new Row(is);
@@ -167,7 +165,7 @@ public class Worksheet {
Debug.log(Debug.TRACE,"BOF Record");
bof = new BeginningOfFile(is);
break;
-
+
case PocketExcelConstants.EOF_MARKER:
Debug.log(Debug.TRACE,"EOF Marker");
eof = new Eof();
@@ -177,7 +175,7 @@ public class Worksheet {
Debug.log(Debug.TRACE,"SELECTION: Current Selection (1Dh)");
sel = new Selection(is);
break;
-
+
case PocketExcelConstants.NUMBER_FORMAT:
Debug.log(Debug.TRACE,"FORMAT: Number Format (1Eh)");
NumberFormat nf = new NumberFormat(is);
@@ -187,22 +185,22 @@ public class Worksheet {
Debug.log(Debug.TRACE,"DEFAULTROWHEIGHT: Default Row Height (25h)");
drh = new DefRowHeight(is);
break;
-
+
case PocketExcelConstants.SHEET_WINDOW_INFO:
Debug.log(Debug.TRACE,"WINDOW2: Sheet Window Information (3Eh) [PXL 2.0]");
win2 = new Window2(is);
break;
-
+
case PocketExcelConstants.PANE_INFO:
Debug.log(Debug.TRACE,"PANE: Number of Panes and their Position (41h) [PXL 2.0]");
p = new Pane(is);
break;
-
+
case PocketExcelConstants.DEF_COL_WIDTH:
Debug.log(Debug.TRACE,"DEFCOLWIDTH: Default Column Width (55h) [PXL 2.0]");
dcw = new DefColWidth(is);
break;
-
+
case PocketExcelConstants.COLINFO:
Debug.log(Debug.TRACE,"COLINFO: Column Formatting Information (7Dh) [PXL 2.0]");
ColInfo ci = new ColInfo(is);
@@ -213,7 +211,7 @@ public class Worksheet {
break;
}
b = is.read();
-
+
}
Debug.log(Debug.TRACE,"Leaving Worksheet:");
@@ -221,47 +219,47 @@ public class Worksheet {
}
/**
- * Returns an enumerator which will be used to access individual cells
+ * Returns an enumerator which will be used to access individual cells
*
- * @return an enumerator to the worksheet cells
+ * @return an enumerator to the worksheet cells
*/
public Enumeration getCellEnumerator() throws IOException {
return (cells.elements());
}
/**
- * Adds a cell to this worksheet. Current valdid celltypes are
- * <code>FloatNumber</code>, <code>LabelCell</code> or <code>Formula</code>
+ * Adds a cell to this worksheet based on a <code>BIFFRecord</code>.
+ * Current valdid celltypes are <code>FloatNumber</code>,
+ * <code>LabelCell</code> or <code>Formula</code>
*
- * @param f the font recrod to add
- */
+ * @param br The <code>BIFFRecord</code> to read from.
+ */
public void addCell(BIFFRecord br) {
cells.add(br);
}
/**
- * Adds a number of ColInfo Records to the worksheet base on a list of
- * clumnwidths passed in
+ * Adds a row to the worksheet.
*
- * @param list of column widths
- */
+ * @param r The row to add.
+ */
public void addRow(Row r) {
rows.add(r);
}
/**
- * Adds a number of ColInfo Records to the worksheet base on a list of
- * clumnwidths passed in
+ * Adds a ColInfo record to the worksheet. This may effec more than one column.
*
- * @param list of column widths
- */
+ * @param c ColInfo structure defining widths, format etc.
+ */
public void addCol(ColInfo c) {
colInfo.add(c);
}
+
/**
- * Returns an <code>Enumeration</code> to the ColInfo's for this worksheet
+ * Add various settings to this worksheet.
*
- * @return an <code>Enumeration</code> to the ColInfo's
+ * @param s SheetSettings object defining pane number, splits etc.
*/
public void addSettings(SheetSettings s) {
@@ -275,17 +273,17 @@ public class Worksheet {
win2.setSplitType(s.getSplitType());
}
}
-
+
/**
* Returns an <code>Enumeration</code> to the ColInfo's for this worksheet
*
- * @return an <code>Enumeration</code> to the ColInfo's
+ * @return an <code>Enumeration</code> to the ColInfo's
*/
public Enumeration getColInfos() {
return (colInfo.elements());
}
-
+
/**
* Returns a <code>SheetSettings</code> object containing a collection of data
* contained in <code>Pane</code>, <code>Window2</code> and
@@ -305,15 +303,15 @@ public class Worksheet {
s.setPaneNumber(p.getPaneNumber());
s.setTopLeft(p.getTop(), p.getLeft());
return s;
- }
+ }
/**
* Returns an <code>Enumeration</code> to the Rows for this worksheet
*
- * @return an <code>Enumeration</code> to the Rows
+ * @return an <code>Enumeration</code> to the Rows
*/
public Enumeration getRows() {
return (rows.elements());
}
-
+
}
--
1.7.0.4
--=-r9HQZWKbe5d9ZLbtzsqO
Content-Disposition: attachment; filename*0=0003-Fix-javadoc-comments-in-filters-xmerge-Converterinfo.pat; filename*1=ch
Content-Type: text/x-patch; name="0003-Fix-javadoc-comments-in-filters-xmerge-Converterinfo.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit
More information about the LibreOffice
mailing list