Some reformatting only.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352964 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Glen Stampoultzis 2002-12-26 22:55:26 +00:00
parent 2eb1a142ca
commit 6d73597035

View File

@ -772,59 +772,66 @@ public class HSSFSheet
* @param newPrintGridlines boolean to turn on or off the printing of * @param newPrintGridlines boolean to turn on or off the printing of
* gridlines * gridlines
*/ */
public void setPrintGridlines(boolean newPrintGridlines) { public void setPrintGridlines( boolean newPrintGridlines )
getSheet().getPrintGridlines().setPrintGridlines(newPrintGridlines); {
getSheet().getPrintGridlines().setPrintGridlines( newPrintGridlines );
} }
/** /**
* Gets the print setup object. * Gets the print setup object.
* @return The user model for the print setup object. * @return The user model for the print setup object.
*/ */
public HSSFPrintSetup getPrintSetup() { public HSSFPrintSetup getPrintSetup()
return new HSSFPrintSetup(getSheet().getPrintSetup()); {
return new HSSFPrintSetup( getSheet().getPrintSetup() );
} }
/** /**
* Gets the user model for the document header. * Gets the user model for the document header.
* @return The Document header. * @return The Document header.
*/ */
public HSSFHeader getHeader() { public HSSFHeader getHeader()
return new HSSFHeader(getSheet().getHeader()); {
return new HSSFHeader( getSheet().getHeader() );
} }
/** /**
* Gets the user model for the document footer. * Gets the user model for the document footer.
* @return The Document footer. * @return The Document footer.
*/ */
public HSSFFooter getFooter() { public HSSFFooter getFooter()
return new HSSFFooter(getSheet().getFooter()); {
} return new HSSFFooter( getSheet().getFooter() );
}
/** /**
* Sets whether sheet is selected. * Sets whether sheet is selected.
* @param sel Whether to select the sheet or deselect the sheet. * @param sel Whether to select the sheet or deselect the sheet.
*/ */
public void setSelected(boolean sel) { public void setSelected( boolean sel )
getSheet().setSelected(sel); {
} getSheet().setSelected( sel );
}
/** /**
* Gets the size of the margin in inches. * Gets the size of the margin in inches.
* @param margin which margin to get * @param margin which margin to get
* @return the size of the margin * @return the size of the margin
*/ */
public double getMargin(short margin) { public double getMargin( short margin )
return getSheet().getMargin(margin); {
} return getSheet().getMargin( margin );
}
/** /**
* Sets the size of the margin in inches. * Sets the size of the margin in inches.
* @param margin which margin to get * @param margin which margin to get
* @param size the size of the margin * @param size the size of the margin
*/ */
public void setMargin(short margin, double size) { public void setMargin( short margin, double size )
getSheet().setMargin(margin, size); {
} getSheet().setMargin( margin, size );
}
/** /**
* Shifts rows between startRow and endRow n number of rows. * Shifts rows between startRow and endRow n number of rows.
@ -835,47 +842,55 @@ public class HSSFSheet
* @param endRow the row to end shifting * @param endRow the row to end shifting
* @param n the number of rows to shift * @param n the number of rows to shift
*/ */
public void shiftRows(int startRow, int endRow, int n) { public void shiftRows( int startRow, int endRow, int n )
int s, e, inc; {
if (n < 0) { int s, e, inc;
s = startRow; if ( n < 0 )
e = endRow; {
inc = 1; s = startRow;
} else { e = endRow;
s = endRow; inc = 1;
e = startRow; }
inc = -1; else
} {
for (int rowNum = s; rowNum >= startRow && rowNum <= endRow && rowNum >= 0 && rowNum < 65536; rowNum+=inc) { s = endRow;
HSSFRow row = getRow(rowNum); e = startRow;
HSSFRow row2Replace = getRow(rowNum + n); inc = -1;
if (row2Replace == null) }
row2Replace = createRow(rowNum + n); for ( int rowNum = s; rowNum >= startRow && rowNum <= endRow && rowNum >= 0 && rowNum < 65536; rowNum += inc )
{
HSSFRow row = getRow( rowNum );
HSSFRow row2Replace = getRow( rowNum + n );
if ( row2Replace == null )
row2Replace = createRow( rowNum + n );
HSSFCell cell; HSSFCell cell;
for (short col = row2Replace.getFirstCellNum(); col <= row2Replace.getLastCellNum(); col++) { for ( short col = row2Replace.getFirstCellNum(); col <= row2Replace.getLastCellNum(); col++ )
cell = row2Replace.getCell(col); {
if (cell != null) cell = row2Replace.getCell( col );
row2Replace.removeCell(cell); if ( cell != null )
} row2Replace.removeCell( cell );
for (short col = row.getFirstCellNum(); col <= row.getLastCellNum(); col++) { }
cell = row.getCell(col); for ( short col = row.getFirstCellNum(); col <= row.getLastCellNum(); col++ )
if (cell != null) { {
row.removeCell(cell); cell = row.getCell( col );
CellValueRecordInterface cellRecord = cell.getCellValueRecord(); if ( cell != null )
cellRecord.setRow(rowNum + n); {
row2Replace.createCellFromRecord(cellRecord); row.removeCell( cell );
sheet.addValueRecord(rowNum + n, cellRecord); CellValueRecordInterface cellRecord = cell.getCellValueRecord();
} cellRecord.setRow( rowNum + n );
} row2Replace.createCellFromRecord( cellRecord );
} sheet.addValueRecord( rowNum + n, cellRecord );
if (endRow == lastrow || endRow + n > lastrow) lastrow = Math.min(endRow + n, 65535); }
if (startRow == firstrow || startRow + n < firstrow) firstrow = Math.max(startRow + n, 0); }
}
if ( endRow == lastrow || endRow + n > lastrow ) lastrow = Math.min( endRow + n, 65535 );
if ( startRow == firstrow || startRow + n < firstrow ) firstrow = Math.max( startRow + n, 0 );
} }
protected void insertChartRecords( List records ) protected void insertChartRecords( List records )
{ {
int window2Loc = sheet.findFirstRecordLocBySid(WindowTwoRecord.sid); int window2Loc = sheet.findFirstRecordLocBySid( WindowTwoRecord.sid );
sheet.getRecords().addAll(window2Loc, records ); sheet.getRecords().addAll( window2Loc, records );
} }
} }