if (rec.getSid() == LabelRecord.sid)
{
- log.log(POILogger.DEBUG, "Hit label record.");
+ if (log.check( POILogger.DEBUG ))
+ log.log(POILogger.DEBUG, "Hit label record.");
retval.containsLabels = true;
}
else if (rec.getSid() == BOFRecord.sid)
{
bofEofNestingLevel++;
- log.log(POILogger.DEBUG, "Hit BOF record. Nesting increased to " + bofEofNestingLevel);
+ if (log.check( POILogger.DEBUG ))
+ log.log(POILogger.DEBUG, "Hit BOF record. Nesting increased to " + bofEofNestingLevel);
}
else if (rec.getSid() == EOFRecord.sid)
{
--bofEofNestingLevel;
- log.log(POILogger.DEBUG, "Hit EOF record. Nesting decreased to " + bofEofNestingLevel);
+ if (log.check( POILogger.DEBUG ))
+ log.log(POILogger.DEBUG, "Hit EOF record. Nesting decreased to " + bofEofNestingLevel);
if (bofEofNestingLevel == 0) {
records.add(rec);
retval.eofLoc = k;
{
retval.cells = new ValueRecordsAggregate();
}
- log.log(POILogger.DEBUG, "sheet createSheet (existing file) exited");
+ if (log.check( POILogger.DEBUG ))
+ log.log(POILogger.DEBUG, "sheet createSheet (existing file) exited");
return retval;
}
public static Sheet createSheet(List records, int sheetnum)
{
- log.log(POILogger.DEBUG,
+ if (log.check( POILogger.DEBUG ))
+ log.log(POILogger.DEBUG,
"Sheet createSheet (exisiting file) assumed offset 0");
return createSheet(records, sheetnum, 0);
}
public static Sheet createSheet()
{
- log.log(POILogger.DEBUG, "Sheet createsheet from scratch called");
+ if (log.check( POILogger.DEBUG ))
+ log.log(POILogger.DEBUG, "Sheet createsheet from scratch called");
Sheet retval = new Sheet();
ArrayList records = new ArrayList(30);
records.add(retval.protect);
records.add(retval.createEOF());
retval.records = records;
- log.log(POILogger.DEBUG, "Sheet createsheet from scratch exit");
+ if (log.check( POILogger.DEBUG ))
+ log.log(POILogger.DEBUG, "Sheet createsheet from scratch exit");
return retval;
}
public void convertLabelRecords(Workbook wb)
{
- log.log(POILogger.DEBUG, "convertLabelRecords called");
+ if (log.check( POILogger.DEBUG ))
+ log.log(POILogger.DEBUG, "convertLabelRecords called");
if (containsLabels)
{
for (int k = 0; k < records.size(); k++)
}
}
}
- log.log(POILogger.DEBUG, "convertLabelRecords exit");
+ if (log.check( POILogger.DEBUG ))
+ log.log(POILogger.DEBUG, "convertLabelRecords exit");
}
/**
{
checkCells();
checkRows();
- log.log(POILogger.DEBUG, "Sheet.getNumRecords");
- log.logFormatted(POILogger.DEBUG, "returning % + % + % - 2 = %", new int[]
+ if (log.check( POILogger.DEBUG ))
{
- records.size(), cells.getPhysicalNumberOfCells(),
- rows.getPhysicalNumberOfRows(),
- records.size() + cells.getPhysicalNumberOfCells()
- + rows.getPhysicalNumberOfRows() - 2
- });
+ log.log(POILogger.DEBUG, "Sheet.getNumRecords");
+ log.logFormatted(POILogger.DEBUG, "returning % + % + % - 2 = %", new int[]
+ {
+ records.size(), cells.getPhysicalNumberOfCells(),
+ rows.getPhysicalNumberOfRows(),
+ records.size() + cells.getPhysicalNumberOfCells()
+ + rows.getPhysicalNumberOfRows() - 2
+ });
+ }
return records.size() + cells.getPhysicalNumberOfCells()
+ rows.getPhysicalNumberOfRows() - 2;
}
public void setDimensions(int firstrow, short firstcol, int lastrow,
short lastcol)
{
- log.log(POILogger.DEBUG, "Sheet.setDimensions");
- log.log(POILogger.DEBUG,
- (new StringBuffer("firstrow")).append(firstrow)
- .append("firstcol").append(firstcol).append("lastrow")
- .append(lastrow).append("lastcol").append(lastcol)
- .toString());
+ if (log.check( POILogger.DEBUG ))
+ {
+ log.log(POILogger.DEBUG, "Sheet.setDimensions");
+ log.log(POILogger.DEBUG,
+ (new StringBuffer("firstrow")).append(firstrow)
+ .append("firstcol").append(firstcol).append("lastrow")
+ .append(lastrow).append("lastcol").append(lastcol)
+ .toString());
+ }
dims.setFirstCol(firstcol);
dims.setFirstRow(firstrow);
dims.setLastCol(lastcol);
dims.setLastRow(lastrow);
- log.log(log.DEBUG, "Sheet.setDimensions exiting");
+ if (log.check( POILogger.DEBUG ))
+ {
+ log.log(POILogger.DEBUG, "Sheet.setDimensions exiting");
+ }
}
/**
public void setLoc(int loc)
{
valueRecIterator = null;
- log.log(log.DEBUG, "sheet.setLoc(): " + loc);
+ if (log.check( POILogger.DEBUG ))
+ log.log(POILogger.DEBUG, "sheet.setLoc(): " + loc);
this.loc = loc;
}
public int getLoc()
{
- log.log(log.DEBUG, "sheet.getLoc():" + loc);
+ if (log.check( POILogger.DEBUG ))
+ log.log(POILogger.DEBUG, "sheet.getLoc():" + loc);
return loc;
}
public int serialize(int offset, byte [] data)
{
- log.log(log.DEBUG, "Sheet.serialize using offsets");
+ if (log.check( POILogger.DEBUG ))
+ log.log(log.DEBUG, "Sheet.serialize using offsets");
int pos = offset;
boolean haveSerializedIndex = false;
}
}
}
- log.log(log.DEBUG, "Sheet.serialize returning ");
+ if (log.check( POILogger.DEBUG ))
+ log.log(log.DEBUG, "Sheet.serialize returning ");
return pos-offset;
}
public RowRecord createRow(int row)
{
- log.log(log.DEBUG, "create row number " + row);
+ if (log.check( POILogger.DEBUG ))
+ log.log(log.DEBUG, "create row number " + row);
RowRecord rowrec = new RowRecord();
//rowrec.setRowNumber(( short ) row);
{
checkCells();
setLoc(dimsloc);
- log.log(log.DEBUG, "replaceValueRecord ");
+ if (log.check( POILogger.DEBUG ))
+ log.log(log.DEBUG, "replaceValueRecord ");
cells.insertCell(newval);
/*
public void addRow(RowRecord row)
{
checkRows();
- log.log(log.DEBUG, "addRow ");
+ if (log.check( POILogger.DEBUG ))
+ log.log(log.DEBUG, "addRow ");
DimensionsRecord d = ( DimensionsRecord ) records.get(getDimsLoc());
if (row.getRowNumber() > d.getLastRow())
* }
* }
*/
- log.log(log.DEBUG, "exit addRow");
+ if (log.check( POILogger.DEBUG ))
+ log.log(log.DEBUG, "exit addRow");
}
/**
public CellValueRecordInterface getNextValueRecord()
{
- log.log(log.DEBUG, "getNextValue loc= " + loc);
+ if (log.check( POILogger.DEBUG ))
+ log.log(log.DEBUG, "getNextValue loc= " + loc);
if (valueRecIterator == null)
{
valueRecIterator = cells.getIterator();
public RowRecord getNextRow()
{
- log.log(log.DEBUG, "getNextRow loc= " + loc);
+ if (log.check( POILogger.DEBUG ))
+ log.log(log.DEBUG, "getNextRow loc= " + loc);
if (rowRecIterator == null)
{
rowRecIterator = rows.getIterator();
//public RowRecord getRow(short rownum)
public RowRecord getRow(int rownum)
{
- log.log(log.DEBUG, "getNextRow loc= " + loc);
+ if (log.check( POILogger.DEBUG ))
+ log.log(log.DEBUG, "getNextRow loc= " + loc);
if (rows == null) {
return null;
}
public int getDimsLoc()
{
- log.log(log.DEBUG, "getDimsLoc dimsloc= " + dimsloc);
+ if (log.check( POILogger.DEBUG ))
+ log.log(log.DEBUG, "getDimsLoc dimsloc= " + dimsloc);
return dimsloc;
}
protected Record createProtect()
{
- log.log(log.DEBUG, "create protect record with protection disabled");
+ if (log.check( POILogger.DEBUG ))
+ log.log(log.DEBUG, "create protect record with protection disabled");
ProtectRecord retval = new ProtectRecord();
retval.setProtect(false);
* @return Workbook object
*/
public static Workbook createWorkbook(List recs) {
- log.log(DEBUG, "Workbook (readfile) created with reclen=",
- new Integer(recs.size()));
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "Workbook (readfile) created with reclen=",
+ new Integer(recs.size()));
Workbook retval = new Workbook();
ArrayList records = new ArrayList(recs.size() / 3);
if (rec.getSid() == EOFRecord.sid) {
records.add(rec);
- log.log(DEBUG, "found workbook eof record at " + k);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found workbook eof record at " + k);
break;
}
switch (rec.getSid()) {
case BoundSheetRecord.sid :
- log.log(DEBUG, "found boundsheet record at " + k);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found boundsheet record at " + k);
retval.boundsheets.add(rec);
retval.records.setBspos( k );
break;
case SSTRecord.sid :
- log.log(DEBUG, "found sst record at " + k);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found sst record at " + k);
retval.sst = ( SSTRecord ) rec;
break;
case FontRecord.sid :
- log.log(DEBUG, "found font record at " + k);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found font record at " + k);
retval.records.setFontpos( k );
retval.numfonts++;
break;
case ExtendedFormatRecord.sid :
- log.log(DEBUG, "found XF record at " + k);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found XF record at " + k);
retval.records.setXfpos( k );
retval.numxfs++;
break;
case TabIdRecord.sid :
- log.log(DEBUG, "found tabid record at " + k);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found tabid record at " + k);
retval.records.setTabpos( k );
break;
case ProtectRecord.sid :
- log.log(DEBUG, "found protect record at " + k);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found protect record at " + k);
retval.records.setProtpos( k );
break;
case BackupRecord.sid :
- log.log(DEBUG, "found backup record at " + k);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found backup record at " + k);
retval.records.setBackuppos( k );
break;
case ExternSheetRecord.sid :
- log.log(DEBUG, "found extern sheet record at " + k);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found extern sheet record at " + k);
retval.externSheet = ( ExternSheetRecord ) rec;
break;
case NameRecord.sid :
- log.log(DEBUG, "found name record at " + k);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found name record at " + k);
retval.names.add(rec);
-// retval.records.namepos = k;
+ // retval.records.namepos = k;
break;
case SupBookRecord.sid :
- log.log(DEBUG, "found SupBook record at " + k);
-// retval.records.supbookpos = k;
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found SupBook record at " + k);
+ // retval.records.supbookpos = k;
+ break;
+ case FormatRecord.sid :
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found format record at " + k);
+ retval.formats.add(rec);
+ retval.maxformatid = retval.maxformatid >= ((FormatRecord)rec).getIndexCode() ? retval.maxformatid : ((FormatRecord)rec).getIndexCode();
break;
- case FormatRecord.sid :
- log.log(DEBUG, "found format record at " + k);
- retval.formats.add(rec);
- retval.maxformatid = retval.maxformatid >= ((FormatRecord)rec).getIndexCode() ? retval.maxformatid : ((FormatRecord)rec).getIndexCode();
- break;
case DateWindow1904Record.sid :
- log.log(DEBUG, "found datewindow1904 record at " + k);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found datewindow1904 record at " + k);
retval.uses1904datewindowing = ((DateWindow1904Record)rec).getWindowing() == 1;
break;
case PaletteRecord.sid:
- log.log(DEBUG, "found palette record at " + k);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "found palette record at " + k);
retval.records.setPalettepos( k );
default :
}
records.add(rec);
}
//What if we dont have any ranges and supbooks
-// if (retval.records.supbookpos == 0) {
-// retval.records.supbookpos = retval.records.bspos + 1;
-// retval.records.namepos = retval.records.supbookpos + 1;
-// }
+ // if (retval.records.supbookpos == 0) {
+ // retval.records.supbookpos = retval.records.bspos + 1;
+ // retval.records.namepos = retval.records.supbookpos + 1;
+ // }
retval.records.setRecords(records);
- log.log(DEBUG, "exit create workbook from existing file function");
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "exit create workbook from existing file function");
return retval;
}
*/
public static Workbook createWorkbook()
{
- log.log( DEBUG, "creating new workbook from scratch" );
+ if (log.check( POILogger.DEBUG ))
+ log.log( DEBUG, "creating new workbook from scratch" );
Workbook retval = new Workbook();
ArrayList records = new ArrayList( 30 );
ArrayList formats = new ArrayList( 8 );
records.add( retval.createEOF() );
retval.records.setRecords(records);
- log.log( DEBUG, "exit create new workbook from scratch" );
+ if (log.check( POILogger.DEBUG ))
+ log.log( DEBUG, "exit create new workbook from scratch" );
return retval;
}
*/
public void setSheetBof(int sheetnum, int pos) {
- log.log(DEBUG, "setting bof for sheetnum =", new Integer(sheetnum),
- " at pos=", new Integer(pos));
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "setting bof for sheetnum =", new Integer(sheetnum),
+ " at pos=", new Integer(pos));
checkSheets(sheetnum);
(( BoundSheetRecord ) boundsheets.get(sheetnum))
.setPositionOfBof(pos);
*/
public int getNumSheets() {
- log.log(DEBUG, "getNumSheets=", new Integer(boundsheets.size()));
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "getNumSheets=", new Integer(boundsheets.size()));
return boundsheets.size();
}
*/
public int getNumExFormats() {
- log.log(DEBUG, "getXF=", new Integer(numxfs));
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "getXF=", new Integer(numxfs));
return numxfs;
}
*/
public int addSSTString(String string, boolean use16bits) {
- log.log(DEBUG, "insert to sst string='", string, "' and use16bits= ",
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "insert to sst string='", string, "' and use16bits= ",
new Boolean(use16bits));
if (sst == null) {
insertSST();
}
String retval = sst.getString(str);
- log.log(DEBUG, "Returning SST for index=", new Integer(str),
- " String= ", retval);
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "Returning SST for index=", new Integer(str),
+ " String= ", retval);
return retval;
}
*/
public void insertSST() {
- log.log(DEBUG, "creating new SST via insertSST!");
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "creating new SST via insertSST!");
sst = ( SSTRecord ) createSST();
records.add(records.size() - 1, createExtendedSST());
records.add(records.size() - 2, sst);
public int serialize( int offset, byte[] data )
{
- log.log( DEBUG, "Serializing Workbook with offsets" );
+ if (log.check( POILogger.DEBUG ))
+ log.log( DEBUG, "Serializing Workbook with offsets" );
int pos = 0;
pos += record.serialize( pos + offset, data ); // rec.length;
}
}
- log.log( DEBUG, "Exiting serialize workbook" );
+ if (log.check( POILogger.DEBUG ))
+ log.log( DEBUG, "Exiting serialize workbook" );
return pos;
}
public void clipRect(int x, int y, int width, int height)
{
- logger.log(POILogger.WARN,"clipRect not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"clipRect not supported");
}
public void copyArea(int x, int y, int width, int height, int dx, int dy)
{
- logger.log(POILogger.WARN,"copyArea not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"copyArea not supported");
}
public Graphics create()
public void drawArc(int x, int y, int width, int height,
int startAngle, int arcAngle)
{
- logger.log(POILogger.WARN,"drawArc not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"drawArc not supported");
}
public boolean drawImage(Image img,
Color bgcolor,
ImageObserver observer)
{
- logger.log(POILogger.WARN,"drawImage not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"drawImage not supported");
return true;
}
int sx1, int sy1, int sx2, int sy2,
ImageObserver observer)
{
- logger.log(POILogger.WARN,"drawImage not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"drawImage not supported");
return true;
}
public void drawPolyline(int xPoints[], int yPoints[],
int nPoints)
{
- logger.log(POILogger.WARN,"drawPolyline not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"drawPolyline not supported");
}
public void drawRect(int x, int y, int width, int height)
{
- logger.log(POILogger.WARN,"drawRect not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"drawRect not supported");
}
public void drawRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight)
{
- logger.log(POILogger.WARN,"drawRoundRect not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"drawRoundRect not supported");
}
public void drawString(String str, int x, int y)
public void drawString(AttributedCharacterIterator iterator,
int x, int y)
{
- logger.log(POILogger.WARN,"drawString not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"drawString not supported");
}
public void fillArc(int x, int y, int width, int height,
int startAngle, int arcAngle)
{
- logger.log(POILogger.WARN,"fillArc not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"fillArc not supported");
}
public void fillOval(int x, int y, int width, int height)
public void fillRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight)
{
- logger.log(POILogger.WARN,"fillRoundRect not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"fillRoundRect not supported");
}
public Shape getClip()
public void setPaintMode()
{
- logger.log(POILogger.WARN,"setPaintMode not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"setPaintMode not supported");
}
public void setXORMode(Color color)
{
- logger.log(POILogger.WARN,"setXORMode not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"setXORMode not supported");
}
public void translate(int x, int y)
{
- logger.log(POILogger.WARN,"translate not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"translate not supported");
}
public Color getBackground()
public void draw(Shape shape)
{
- logger.log(POILogger.WARN,"copyArea not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"copyArea not supported");
}
public void drawArc(int x, int y, int width, int height,
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
int sx2, int sy2, Color bgColor, ImageObserver imageobserver)
{
- logger.log(POILogger.WARN,"drawImage() not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"drawImage() not supported");
return true;
}
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
int sx2, int sy2, ImageObserver imageobserver)
{
- logger.log(POILogger.WARN,"drawImage() not supported");
return drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null, imageobserver);
}
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, Color bgColor, ImageObserver imageobserver)
{
- logger.log(POILogger.WARN,"drawImage() not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"drawImage() not supported");
return true;
}
public void fill(Shape shape)
{
- logger.log(POILogger.WARN,"fill(Shape) not supported");
+ if (logger.check( POILogger.WARN ))
+ logger.log(POILogger.WARN,"fill(Shape) not supported");
}
public void fillArc(int i, int j, int k, int l, int i1, int j1)
public byte[] getBytes()
{
- log.log(DEBUG, "HSSFWorkbook.getBytes()");
+ if (log.check( POILogger.DEBUG ))
+ log.log(DEBUG, "HSSFWorkbook.getBytes()");
int wbsize = workbook.getSize();
// log.debug("REMOVEME: old sizing method "+workbook.serialize().length);