import org.apache.poi.hssf.record.UnicodeString;
import org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate;
import org.apache.poi.hssf.record.formula.Ptg;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Comment;
+import org.apache.poi.ss.usermodel.RichTextString;
/**
* High level representation of a cell in a row of a spreadsheet.
* @version 1.0-pre
*/
-public class HSSFCell
+public class HSSFCell implements Cell
{
/**
* If value is null then we will change the cell to a Blank cell.
*/
- public void setCellValue(HSSFRichTextString value)
+ public void setCellValue(RichTextString value)
{
+ HSSFRichTextString hvalue = (HSSFRichTextString) value;
int row=record.getRow();
short col=record.getColumn();
short styleIndex=record.getXFIndex();
- if (value == null)
+ if (hvalue == null)
{
setCellType(CELL_TYPE_BLANK, false, row, col, styleIndex);
}
}
int index = 0;
- UnicodeString str = value.getUnicodeString();
+ UnicodeString str = hvalue.getUnicodeString();
// jmh if (encoding == ENCODING_COMPRESSED_UNICODE)
// jmh {
// jmh str.setCompressedUnicode();
// jmh }
index = book.addSSTString(str);
(( LabelSSTRecord ) record).setSSTIndex(index);
- stringValue = value;
+ stringValue = hvalue;
stringValue.setWorkbookReferences(book, (( LabelSSTRecord ) record));
stringValue.setUnicodeString(book.getSSTString(index));
}
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getCellStyleAt(short)
*/
- public void setCellStyle(HSSFCellStyle style)
+ public void setCellStyle(CellStyle style)
{
record.setXFIndex(style.getIndex());
}
*
* @param comment comment associated with this cell
*/
- public void setCellComment(HSSFComment comment){
+ public void setCellComment(Comment comment){
comment.setRow((short)record.getRow());
comment.setColumn(record.getColumn());
- this.comment = comment;
+ this.comment = (HSSFComment) comment;
}
/**
import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.hssf.record.ExtendedFormatRecord;
-import org.apache.poi.hssf.record.FormatRecord;
-import org.apache.poi.hssf.util.*;
+import org.apache.poi.hssf.util.HSSFColor;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Font;
/**
* High level representation of the style of a cell in a sheet of a workbook.
* @see org.apache.poi.hssf.usermodel.HSSFCell#setCellStyle(HSSFCellStyle)
*/
-public class HSSFCellStyle
+public class HSSFCellStyle implements CellStyle
{
private ExtendedFormatRecord format = null;
private short index = 0;
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
*/
- public void setFont(HSSFFont font)
+ public void setFont(Font font)
{
format.setIndentNotParentFont(true);
short fontindex = font.getIndex();
* @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndex()
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
*/
- public HSSFFont getFont(HSSFWorkbook parentWorkbook) {
+ public Font getFont(org.apache.poi.ss.usermodel.Workbook parentWorkbook) {
return parentWorkbook.getFontAt(getFontIndex());
}
==================================================================== */
package org.apache.poi.hssf.usermodel;
-import org.apache.poi.hssf.record.EscherAggregate;
import org.apache.poi.hssf.record.NoteRecord;
import org.apache.poi.hssf.record.TextObjectRecord;
-import org.apache.poi.ddf.*;
-
-import java.util.Map;
-import java.util.List;
-import java.util.Iterator;
+import org.apache.poi.ss.usermodel.Comment;
+import org.apache.poi.ss.usermodel.RichTextString;
/**
* Represents a cell comment - a sticky note associated with a cell.
*
* @author Yegor Kozlov
*/
-public class HSSFComment extends HSSFTextbox {
+public class HSSFComment extends HSSFTextbox implements Comment {
private boolean visible;
private short col, row;
*
* @param string Sets the rich text string used by this object.
*/
- public void setString( HSSFRichTextString string ) {
+ public void setString( RichTextString string ) {
//if font is not set we must set the default one
if (string.numFormattingRuns() == 0) string.applyFont((short)0);
int frLength = ( string.numFormattingRuns() + 1 ) * 8;
txo.setFormattingRunLength( (short) frLength );
txo.setTextLength( (short) string.length() );
- txo.setStr( string );
+ txo.setStr( (HSSFRichTextString) string );
}
super.setString(string);
}
*/
package org.apache.poi.hssf.usermodel;
-import org.apache.poi.hssf.model.Workbook;
-import org.apache.poi.hssf.record.FormatRecord;
-
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Vector;
+import org.apache.poi.hssf.model.Workbook;
+import org.apache.poi.hssf.record.FormatRecord;
+import org.apache.poi.ss.usermodel.DataFormat;
+
/**
* Utility to identify builtin formats. Now can handle user defined data formats also. The following is a list of the formats as
* returned by this class.<P>
* @author Shawn M. Laubach (slaubach at apache dot org)
*/
-public class HSSFDataFormat
+public class HSSFDataFormat implements DataFormat
{
private static List builtinFormats = createBuiltinFormats();
package org.apache.poi.hssf.usermodel;
import org.apache.poi.hssf.record.FontRecord;
+import org.apache.poi.ss.usermodel.Font;
/**
* Represents a Font used in a workbook.
* @see org.apache.poi.hssf.usermodel.HSSFCellStyle#setFont(HSSFFont)
*/
-public class HSSFFont
+public class HSSFFont implements Font
{
/**
package org.apache.poi.hssf.usermodel;
import org.apache.poi.hssf.record.FooterRecord;
+import org.apache.poi.ss.usermodel.Footer;
/**
* Class to read and manipulate the footer.
* <P>
* @author Shawn Laubach (slaubach at apache dot org)
*/
-public class HSSFFooter extends Object {
+public class HSSFFooter implements Footer {
FooterRecord footerRecord;
String left;
package org.apache.poi.hssf.usermodel;
import org.apache.poi.hssf.record.HeaderRecord;
+import org.apache.poi.ss.usermodel.Header;
/**
* Class to read and manipulate the header.
*
* @author Shawn Laubach (slaubach at apache dot org)
*/
-public class HSSFHeader
+public class HSSFHeader implements Header
{
HeaderRecord headerRecord;
package org.apache.poi.hssf.usermodel;
import org.apache.poi.hssf.model.Workbook;
-import org.apache.poi.hssf.record.BoundSheetRecord;
import org.apache.poi.hssf.record.NameRecord;
import org.apache.poi.hssf.util.RangeAddress;
+import org.apache.poi.ss.usermodel.Name;
/**
* Title: High Level Represantion of Named Range <P>
* @author Libin Roman (Vista Portal LDT. Developer)
*/
-public class HSSFName {
+public class HSSFName implements Name {
private Workbook book;
private NameRecord name;
import org.apache.poi.hssf.record.PaletteRecord;
import org.apache.poi.hssf.util.HSSFColor;
+import org.apache.poi.ss.usermodel.Palette;
/**
* Represents a workbook color palette.
*
* @author Brian Sanders (bsanders at risklabs dot com)
*/
-public class HSSFPalette
+public class HSSFPalette implements Palette
{
private PaletteRecord palette;
import org.apache.poi.ddf.EscherOptRecord;
import org.apache.poi.ddf.EscherProperty;
import org.apache.poi.hssf.record.EscherAggregate;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.ss.usermodel.Patriarch;
import org.apache.poi.util.StringUtil;
/**
* @author Glen Stampoultzis (glens at apache.org)
*/
public class HSSFPatriarch
- implements HSSFShapeContainer
+ implements HSSFShapeContainer, Patriarch
{
List shapes = new ArrayList();
HSSFSheet sheet;
package org.apache.poi.hssf.usermodel;
import org.apache.poi.hssf.record.PrintSetupRecord;
+import org.apache.poi.ss.usermodel.PrintSetup;
/**
* Used to modify the print setup.
* public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;<br>
* <P>
* @author Shawn Laubach (slaubach at apache dot org) */
-public class HSSFPrintSetup extends Object {
- public static final short LETTER_PAPERSIZE = 1;
- public static final short LEGAL_PAPERSIZE = 5;
- public static final short EXECUTIVE_PAPERSIZE = 7;
- public static final short A4_PAPERSIZE = 9;
- public static final short A5_PAPERSIZE = 11;
- public static final short ENVELOPE_10_PAPERSIZE = 20;
- public static final short ENVELOPE_DL_PAPERSIZE = 27;
- public static final short ENVELOPE_CS_PAPERSIZE = 28;
- public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;
+public class HSSFPrintSetup implements PrintSetup {
PrintSetupRecord printSetupRecord;
/**
package org.apache.poi.hssf.usermodel;
+import java.util.Iterator;
+
import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.hssf.record.LabelSSTRecord;
import org.apache.poi.hssf.record.UnicodeString;
-
-import java.util.Iterator;
+import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.RichTextString;
/**
* Rich text unicode string. These strings can have fonts applied to
* arbitary parts of the string.
* @author Jason Height (jheight at apache.org)
*/
public class HSSFRichTextString
- implements Comparable
+ implements Comparable, RichTextString
{
/** Place holder for indicating that NO_FONT has been applied here */
public static final short NO_FONT = 0;
* @param endIndex The end index to apply to font to (exclusive)
* @param font The index of the font to use.
*/
- public void applyFont(int startIndex, int endIndex, HSSFFont font)
+ public void applyFont(int startIndex, int endIndex, Font font)
{
applyFont(startIndex, endIndex, font.getIndex());
}
* Sets the font of the entire string.
* @param font The font to use.
*/
- public void applyFont(HSSFFont font)
+ public void applyFont(Font font)
{
applyFont(0, string.getCharCount(), font);
}
import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.hssf.record.CellValueRecordInterface;
import org.apache.poi.hssf.record.RowRecord;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
/**
* High level representation of a row of a spreadsheet.
*/
public class HSSFRow
- implements Comparable
+ implements Comparable, Row
{
// used for collections
* remove the HSSFCell from this row.
* @param cell to remove
*/
- public void removeCell(HSSFCell cell) {
+ public void removeCell(Cell cell) {
removeCell(cell, true);
}
- private void removeCell(HSSFCell cell, boolean alsoRemoveRecords) {
+
+ private void removeCell(Cell cell, boolean alsoRemoveRecords) {
+
+ HSSFCell hcell = (HSSFCell) cell;
if(alsoRemoveRecords) {
- CellValueRecordInterface cval = cell.getCellValueRecord();
+ CellValueRecordInterface cval = hcell.getCellValueRecord();
sheet.removeValueRecord(getRowNum(), cval);
}
- short column=cell.getCellNum();
- if(cell!=null && column<cells.length)
+ short column=hcell.getCellNum();
+ if(hcell!=null && column<cells.length)
{
cells[column]=null;
}
- if (cell.getCellNum() == row.getLastCol())
+ if (hcell.getCellNum() == row.getLastCol())
{
row.setLastCol(findLastCell(row.getLastCol()));
}
- if (cell.getCellNum() == row.getFirstCol())
+ if (hcell.getCellNum() == row.getFirstCol())
{
row.setFirstCol(findFirstCell(row.getFirstCol()));
}
*/
package org.apache.poi.hssf.usermodel;
+import java.awt.font.FontRenderContext;
+import java.awt.font.TextAttribute;
+import java.awt.font.TextLayout;
+import java.awt.geom.AffineTransform;
+import java.io.PrintWriter;
+import java.text.AttributedString;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Stack;
+import java.util.TreeMap;
+
import org.apache.poi.ddf.EscherRecord;
import org.apache.poi.hssf.model.FormulaParser;
import org.apache.poi.hssf.model.Sheet;
import org.apache.poi.hssf.model.Workbook;
-import org.apache.poi.hssf.record.*;
+import org.apache.poi.hssf.record.CellValueRecordInterface;
+import org.apache.poi.hssf.record.DVALRecord;
+import org.apache.poi.hssf.record.DVRecord;
+import org.apache.poi.hssf.record.EOFRecord;
+import org.apache.poi.hssf.record.EscherAggregate;
+import org.apache.poi.hssf.record.HCenterRecord;
+import org.apache.poi.hssf.record.PageBreakRecord;
+import org.apache.poi.hssf.record.Record;
+import org.apache.poi.hssf.record.RowRecord;
+import org.apache.poi.hssf.record.SCLRecord;
+import org.apache.poi.hssf.record.VCenterRecord;
+import org.apache.poi.hssf.record.WSBoolRecord;
+import org.apache.poi.hssf.record.WindowTwoRecord;
import org.apache.poi.hssf.record.formula.Ptg;
import org.apache.poi.hssf.record.formula.ReferencePtg;
import org.apache.poi.hssf.util.HSSFCellRangeAddress;
import org.apache.poi.hssf.util.HSSFDataValidation;
-import org.apache.poi.hssf.util.Region;
import org.apache.poi.hssf.util.PaneInformation;
+import org.apache.poi.hssf.util.Region;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Stack;
-import java.util.TreeMap;
-import java.text.AttributedString;
-import java.text.NumberFormat;
-import java.text.DecimalFormat;
-import java.awt.font.TextLayout;
-import java.awt.font.FontRenderContext;
-import java.awt.font.TextAttribute;
-
-import java.awt.geom.AffineTransform;
-
/**
* High level representation of a worksheet.
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Yegor Kozlov (yegor at apache.org) (Autosizing columns)
*/
-public class HSSFSheet
+public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
{
private static final int DEBUG = POILogger.DEBUG;
* @param row representing a row to remove.
*/
- public void removeRow(HSSFRow row)
+ public void removeRow(Row row)
{
sheet.setLoc(sheet.getDimsLoc());
if (rows.size() > 0)
sheet.removeValueRecord(row.getRowNum(),
cell.getCellValueRecord());
}
- sheet.removeRow(row.getRowRecord());
+ sheet.removeRow(((HSSFRow) row).getRowRecord());
}
}
* @param column the column index
* @param style the style to set
*/
- public void setDefaultColumnStyle(short column, HSSFCellStyle style) {
+ public void setDefaultColumnStyle(short column, CellStyle style) {
sheet.setColumn(column, new Short(style.getIndex()), null, null, null, null);
}
package org.apache.poi.hssf.usermodel;
+import org.apache.poi.ss.usermodel.RichTextString;
+
/**
* A textbox is a shape that may hold a rich text string.
*
/**
* @param string Sets the rich text string used by this object.
*/
- public void setString( HSSFRichTextString string )
+ public void setString( RichTextString string )
{
- this.string = string;
+ this.string = (HSSFRichTextString) string;
}
/**
*/
package org.apache.poi.hssf.usermodel;
+import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Stack;
+
import org.apache.poi.POIDocument;
import org.apache.poi.ddf.EscherBSERecord;
import org.apache.poi.ddf.EscherBitmapBlip;
-import org.apache.poi.ddf.EscherRecord;
import org.apache.poi.ddf.EscherBlipRecord;
+import org.apache.poi.ddf.EscherRecord;
import org.apache.poi.hssf.eventmodel.EventRecordFactory;
import org.apache.poi.hssf.model.Sheet;
import org.apache.poi.hssf.model.Workbook;
-import org.apache.poi.hssf.record.*;
+import org.apache.poi.hssf.record.AbstractEscherHolderRecord;
+import org.apache.poi.hssf.record.BackupRecord;
+import org.apache.poi.hssf.record.DrawingGroupRecord;
+import org.apache.poi.hssf.record.EmbeddedObjectRefSubRecord;
+import org.apache.poi.hssf.record.ExtendedFormatRecord;
+import org.apache.poi.hssf.record.FontRecord;
+import org.apache.poi.hssf.record.LabelRecord;
+import org.apache.poi.hssf.record.LabelSSTRecord;
+import org.apache.poi.hssf.record.NameRecord;
+import org.apache.poi.hssf.record.ObjRecord;
+import org.apache.poi.hssf.record.Record;
+import org.apache.poi.hssf.record.RecordFactory;
+import org.apache.poi.hssf.record.SSTRecord;
+import org.apache.poi.hssf.record.UnicodeString;
+import org.apache.poi.hssf.record.UnknownRecord;
+import org.apache.poi.hssf.record.WindowTwoRecord;
import org.apache.poi.hssf.record.formula.Area3DPtg;
import org.apache.poi.hssf.record.formula.MemFuncPtg;
import org.apache.poi.hssf.record.formula.UnionPtg;
import org.apache.poi.hssf.util.CellReference;
-import org.apache.poi.poifs.filesystem.*;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
-import java.io.ByteArrayInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Stack;
-
/**
* High level representation of a workbook. This is the first object most users
* will construct whether they are reading or writing a workbook. It is also the
* @version 2.0-pre
*/
-public class HSSFWorkbook extends POIDocument
+public class HSSFWorkbook extends POIDocument implements org.apache.poi.ss.usermodel.Workbook
{
private static final int DEBUG = POILogger.DEBUG;
* @param sheet the sheet to look up
* @return index of the sheet (0 based)
*/
- public int getSheetIndex(HSSFSheet sheet)
+ public int getSheetIndex(org.apache.poi.ss.usermodel.Sheet sheet)
{
for(int i=0; i<sheets.size(); i++) {
if(sheets.get(i) == sheet) {
package org.apache.poi.hssf.util;
-import java.util.*;
+import java.util.Hashtable;
+
+import org.apache.poi.ss.usermodel.Color;
/**
* Intends to provide support for the very evil index to triplet issue and
* @author Brian Sanders (bsanders at risklabs dot com) - full default color palette
*/
-public class HSSFColor
+public class HSSFColor implements Color
{
private final static int PALETTE_SIZE = 56;
private final static int DISTINCT_COLOR_COUNT = 46;