@@ -, +, @@ Working revision: 1.21 Repository revision: 1.21 /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hssf/model/Sheet.java,v Sticky Tag: (none) Sticky Date: (none) Sticky Options: (none) Index: org/apache/poi/hssf/model/Sheet.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hssf/model/Sheet.java,v --- org/apache/poi/hssf/model/Sheet.java 1.21 +++ org/apache/poi/hssf/model/Sheet.java @@ -84,0 +84,1 @@ + * @author Brian Sanders (kestrel at burdell dot org) Active Cell support @@ -111,0 +112,1 @@ + protected SelectionRecord selection = null; @@ -255,0 +257,4 @@ + else if ( rec.getSid() == SelectionRecord.sid ) + { + retval.selection = (SelectionRecord) rec; + } @@ -379,1 +385,3 @@ - records.add(retval.createSelection()); --- + retval.selection = + (SelectionRecord) retval.createSelection(); + records.add(retval.selection); @@ -1937,0 +1945,60 @@ + } + + /** + * Returns the active row + * + * @see org.apache.poi.hssf.record.SelectionRecord + * @return row the active row index + */ + public int getActiveCellRow() + { + if (selection == null) + { + return 0; + } + return selection.getActiveCellRow(); + } + + /** + * Sets the active row + * + * @param row the row index + * @see org.apache.poi.hssf.record.SelectionRecord + */ + public void setActiveCellRow(int row) + { + //shouldn't have a sheet w/o a SelectionRecord, but best to guard anyway + if (selection != null) + { + selection.setActiveCellRow(row); + } + } + + /** + * Returns the active column + * + * @see org.apache.poi.hssf.record.SelectionRecord + * @return row the active column index + */ + public short getActiveCellCol() + { + if (selection == null) + { + return (short) 0; + } + return selection.getActiveCellCol(); + } + + /** + * Sets the active column + * + * @param col the column index + * @see org.apache.poi.hssf.record.SelectionRecord + */ + public void setActiveCellCol(short col) + { + //shouldn't have a sheet w/o a SelectionRecord, but best to guard anyway + if (selection != null) + { + selection.setActiveCellCol(col); + }