diff --git a/src/java/org/apache/poi/ss/formula/ptg/Area3DPxg.java b/src/java/org/apache/poi/ss/formula/ptg/Area3DPxg.java index 665ac98cf..2916211b6 100644 --- a/src/java/org/apache/poi/ss/formula/ptg/Area3DPxg.java +++ b/src/java/org/apache/poi/ss/formula/ptg/Area3DPxg.java @@ -36,9 +36,9 @@ public final class Area3DPxg extends AreaPtgBase implements Pxg3D { private String firstSheetName; private String lastSheetName; - public Area3DPxg(int externalWorkbookNumber, SheetIdentifier sheetName, String arearef) { - this(externalWorkbookNumber, sheetName, new AreaReference(arearef)); - } + public Area3DPxg(int externalWorkbookNumber, SheetIdentifier sheetName, String arearef) { + this(externalWorkbookNumber, sheetName, new AreaReference(arearef)); + } public Area3DPxg(int externalWorkbookNumber, SheetIdentifier sheetName, AreaReference arearef) { super(arearef); this.externalWorkbookNumber = externalWorkbookNumber; @@ -57,8 +57,8 @@ public final class Area3DPxg extends AreaPtgBase implements Pxg3D { this(-1, sheetName, arearef); } - @Override - public String toString() { + @Override + public String toString() { StringBuffer sb = new StringBuffer(); sb.append(getClass().getName()); sb.append(" ["); @@ -76,8 +76,8 @@ public final class Area3DPxg extends AreaPtgBase implements Pxg3D { sb.append(formatReferenceAsString()); sb.append("]"); return sb.toString(); - } - + } + public int getExternalWorkbookNumber() { return externalWorkbookNumber; } diff --git a/src/java/org/apache/poi/ss/formula/ptg/AreaPtgBase.java b/src/java/org/apache/poi/ss/formula/ptg/AreaPtgBase.java index bc808b0f0..816287620 100644 --- a/src/java/org/apache/poi/ss/formula/ptg/AreaPtgBase.java +++ b/src/java/org/apache/poi/ss/formula/ptg/AreaPtgBase.java @@ -31,272 +31,272 @@ import org.apache.poi.util.LittleEndianOutput; * @author Jason Height (jheight at chariot dot net dot au) */ public abstract class AreaPtgBase extends OperandPtg implements AreaI { - /** - * TODO - (May-2008) fix subclasses of AreaPtg 'AreaN~' which are used in shared formulas. - * see similar comment in ReferencePtg - */ - protected final RuntimeException notImplemented() { - return new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); - } + /** + * TODO - (May-2008) fix subclasses of AreaPtg 'AreaN~' which are used in shared formulas. + * see similar comment in ReferencePtg + */ + protected final RuntimeException notImplemented() { + return new RuntimeException("Coding Error: This method should never be called. This ptg should be converted"); + } - /** zero based, unsigned 16 bit */ - private int field_1_first_row; - /** zero based, unsigned 16 bit */ - private int field_2_last_row; - /** zero based, unsigned 8 bit */ - private int field_3_first_column; //BitFields: (first row relative, first col relative, first column number) - /** zero based, unsigned 8 bit */ - private int field_4_last_column; //BitFields: (last row relative, last col relative, last column number) + /** zero based, unsigned 16 bit */ + private int field_1_first_row; + /** zero based, unsigned 16 bit */ + private int field_2_last_row; + /** zero based, unsigned 8 bit */ + private int field_3_first_column; //BitFields: (first row relative, first col relative, first column number) + /** zero based, unsigned 8 bit */ + private int field_4_last_column; //BitFields: (last row relative, last col relative, last column number) - private final static BitField rowRelative = BitFieldFactory.getInstance(0x8000); - private final static BitField colRelative = BitFieldFactory.getInstance(0x4000); - private final static BitField columnMask = BitFieldFactory.getInstance(0x3FFF); + private final static BitField rowRelative = BitFieldFactory.getInstance(0x8000); + private final static BitField colRelative = BitFieldFactory.getInstance(0x4000); + private final static BitField columnMask = BitFieldFactory.getInstance(0x3FFF); - protected AreaPtgBase() { - // do nothing - } + protected AreaPtgBase() { + // do nothing + } - protected AreaPtgBase(AreaReference ar) { - CellReference firstCell = ar.getFirstCell(); - CellReference lastCell = ar.getLastCell(); - setFirstRow(firstCell.getRow()); - setFirstColumn(firstCell.getCol() == -1 ? 0 : firstCell.getCol()); - setLastRow(lastCell.getRow()); - setLastColumn(lastCell.getCol() == -1 ? 0xFF : lastCell.getCol()); - setFirstColRelative(!firstCell.isColAbsolute()); - setLastColRelative(!lastCell.isColAbsolute()); - setFirstRowRelative(!firstCell.isRowAbsolute()); - setLastRowRelative(!lastCell.isRowAbsolute()); - } + protected AreaPtgBase(AreaReference ar) { + CellReference firstCell = ar.getFirstCell(); + CellReference lastCell = ar.getLastCell(); + setFirstRow(firstCell.getRow()); + setFirstColumn(firstCell.getCol() == -1 ? 0 : firstCell.getCol()); + setLastRow(lastCell.getRow()); + setLastColumn(lastCell.getCol() == -1 ? 0xFF : lastCell.getCol()); + setFirstColRelative(!firstCell.isColAbsolute()); + setLastColRelative(!lastCell.isColAbsolute()); + setFirstRowRelative(!firstCell.isRowAbsolute()); + setLastRowRelative(!lastCell.isRowAbsolute()); + } - protected AreaPtgBase(int firstRow, int lastRow, int firstColumn, int lastColumn, - boolean firstRowRelative, boolean lastRowRelative, boolean firstColRelative, boolean lastColRelative) { + protected AreaPtgBase(int firstRow, int lastRow, int firstColumn, int lastColumn, + boolean firstRowRelative, boolean lastRowRelative, boolean firstColRelative, boolean lastColRelative) { - if (lastRow >= firstRow) { - setFirstRow(firstRow); - setLastRow(lastRow); - setFirstRowRelative(firstRowRelative); - setLastRowRelative(lastRowRelative); - } else { - setFirstRow(lastRow); - setLastRow(firstRow); - setFirstRowRelative(lastRowRelative); - setLastRowRelative(firstRowRelative); - } + if (lastRow >= firstRow) { + setFirstRow(firstRow); + setLastRow(lastRow); + setFirstRowRelative(firstRowRelative); + setLastRowRelative(lastRowRelative); + } else { + setFirstRow(lastRow); + setLastRow(firstRow); + setFirstRowRelative(lastRowRelative); + setLastRowRelative(firstRowRelative); + } - if (lastColumn >= firstColumn) { - setFirstColumn(firstColumn); - setLastColumn(lastColumn); - setFirstColRelative(firstColRelative); - setLastColRelative(lastColRelative); - } else { - setFirstColumn(lastColumn); - setLastColumn(firstColumn); - setFirstColRelative(lastColRelative); - setLastColRelative(firstColRelative); - } - } - - /** - * Sort the first and last row and columns in-place to the preferred (top left:bottom right) order - * Note: Sort only occurs when an instance is constructed or when this method is called. - * - *
For example, $E5:B$10
becomes B5:$E$10
For example, $E5:B$10
becomes B5:$E$10
true
if the last row relative, else
- * false
- */
- public final void setLastRowRelative(boolean rel) {
- field_4_last_column=rowRelative.setBoolean(field_4_last_column,rel);
- }
+ /**
+ * set whether the last row is relative or not
+ * @param rel true
if the last row relative, else
+ * false
+ */
+ public final void setLastRowRelative(boolean rel) {
+ field_4_last_column=rowRelative.setBoolean(field_4_last_column,rel);
+ }
- /**
- * @return lastcol relative or not
- */
- public final boolean isLastColRelative() {
- return colRelative.isSet(field_4_last_column);
- }
+ /**
+ * @return lastcol relative or not
+ */
+ public final boolean isLastColRelative() {
+ return colRelative.isSet(field_4_last_column);
+ }
- /**
- * set whether the last column should be relative or not
- */
- public final void setLastColRelative(boolean rel) {
- field_4_last_column=colRelative.setBoolean(field_4_last_column,rel);
- }
+ /**
+ * set whether the last column should be relative or not
+ */
+ public final void setLastColRelative(boolean rel) {
+ field_4_last_column=colRelative.setBoolean(field_4_last_column,rel);
+ }
- /**
- * set the last column in the area
- */
- public final void setLastColumn(int colIx) {
- field_4_last_column=columnMask.setValue(field_4_last_column, colIx);
- }
+ /**
+ * set the last column in the area
+ */
+ public final void setLastColumn(int colIx) {
+ field_4_last_column=columnMask.setValue(field_4_last_column, colIx);
+ }
- /**
- * set the last column irrespective of the bitmasks
- */
- public final void setLastColumnRaw(short column) {
- field_4_last_column = column;
- }
- protected final String formatReferenceAsString() {
- CellReference topLeft = new CellReference(getFirstRow(),getFirstColumn(),!isFirstRowRelative(),!isFirstColRelative());
- CellReference botRight = new CellReference(getLastRow(),getLastColumn(),!isLastRowRelative(),!isLastColRelative());
+ /**
+ * set the last column irrespective of the bitmasks
+ */
+ public final void setLastColumnRaw(short column) {
+ field_4_last_column = column;
+ }
+ protected final String formatReferenceAsString() {
+ CellReference topLeft = new CellReference(getFirstRow(),getFirstColumn(),!isFirstRowRelative(),!isFirstColRelative());
+ CellReference botRight = new CellReference(getLastRow(),getLastColumn(),!isLastRowRelative(),!isLastColRelative());
- if(AreaReference.isWholeColumnReference(SpreadsheetVersion.EXCEL97, topLeft, botRight)) {
- return (new AreaReference(topLeft, botRight)).formatAsString();
- }
- return topLeft.formatAsString() + ":" + botRight.formatAsString();
- }
+ if(AreaReference.isWholeColumnReference(SpreadsheetVersion.EXCEL97, topLeft, botRight)) {
+ return (new AreaReference(topLeft, botRight)).formatAsString();
+ }
+ return topLeft.formatAsString() + ":" + botRight.formatAsString();
+ }
- public String toFormulaString() {
- return formatReferenceAsString();
- }
+ public String toFormulaString() {
+ return formatReferenceAsString();
+ }
- public byte getDefaultOperandClass() {
- return Ptg.CLASS_REF;
- }
+ public byte getDefaultOperandClass() {
+ return Ptg.CLASS_REF;
+ }
}
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTable.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTable.java
index f6d3d9163..03e461422 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTable.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTable.java
@@ -113,7 +113,7 @@ public class XSSFTable extends POIXMLDocumentPart implements Table {
out.close();
}
- public CTTable getCTTable(){
+ public CTTable getCTTable() {
return ctTable;
}