]> source.dussan.org Git - poi.git/commitdiff
Make HSSF* classes compile with JDK 1.4 interfaces.
authorUgo Cei <ugo@apache.org>
Thu, 24 Jan 2008 10:53:39 +0000 (10:53 +0000)
committerUgo Cei <ugo@apache.org>
Thu, 24 Jan 2008 10:53:39 +0000 (10:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@614838 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
src/java/org/apache/poi/hssf/usermodel/HSSFComment.java
src/java/org/apache/poi/hssf/usermodel/HSSFFont.java
src/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java
src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java
src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Font.java

index e076047c5efccd35afb1d0734188a39966ca40a4..f7e90d0ce4ebaf3f77712ee93dfc16d39abf486d 100644 (file)
@@ -880,7 +880,7 @@ public class HSSFCell implements Cell
 
     public void setCellStyle(CellStyle style)
     {
-        record.setXFIndex(style.getIndex());
+        record.setXFIndex(((HSSFCellStyle) style).getIndex());
     }
 
     /**
@@ -1006,9 +1006,9 @@ public class HSSFCell implements Cell
      * @param comment comment associated with this cell
      */
     public void setCellComment(Comment comment){
-        comment.setRow((short)record.getRow());
-        comment.setColumn(record.getColumn());
         this.comment = (HSSFComment) comment;
+        this.comment.setRow((short)record.getRow());
+        this.comment.setColumn(record.getColumn());
     }
 
     /**
index fa8489cbaba8190acb9193e4cb5575c99b81122d..a0837cdd01f3cb5e6fb773065bbff14913cfa129 100644 (file)
@@ -291,7 +291,7 @@ public class HSSFCellStyle implements CellStyle
     public void setFont(Font font)
     {
         format.setIndentNotParentFont(true);
-        short fontindex = font.getIndex();
+        short fontindex = ((HSSFFont) font).getIndex();
         format.setFontIndex(fontindex);
     }
 
@@ -310,8 +310,8 @@ public class HSSFCellStyle implements CellStyle
      * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndex()
      * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
      */
-    public Font getFont(org.apache.poi.ss.usermodel.Workbook parentWorkbook) {
-       return parentWorkbook.getFontAt(getFontIndex());
+    public HSSFFont getFont(org.apache.poi.ss.usermodel.Workbook parentWorkbook) {
+       return ((HSSFWorkbook) parentWorkbook).getFontAt(getFontIndex());
     }
 
     /**
index 08d209a2723df5fe20a7eed8561c1cabf9f9baf1..8ae4fb8926a85e8f605591cb057d1d9ecc417fa2 100644 (file)
@@ -144,14 +144,15 @@ public class HSSFComment extends HSSFTextbox implements Comment {
      * @param string    Sets the rich text string used by this object.
      */
     public void setString( RichTextString string )  {
+        HSSFRichTextString hstring = (HSSFRichTextString) string;
         //if font is not set we must set the default one
-        if (string.numFormattingRuns() == 0) string.applyFont((short)0);
+        if (hstring.numFormattingRuns() == 0) hstring.applyFont((short)0);
 
         if (txo != null) {
-            int frLength = ( string.numFormattingRuns() + 1 ) * 8;
+            int frLength = ( hstring.numFormattingRuns() + 1 ) * 8;
             txo.setFormattingRunLength( (short) frLength );
-            txo.setTextLength( (short) string.length() );
-            txo.setStr( (HSSFRichTextString) string );
+            txo.setTextLength( (short) hstring.length() );
+            txo.setStr( hstring );
         }
         super.setString(string);
     }
index 282704357539146df7318d547fbcef644417e0f5..5c1d4dd8c450140045c320d0428025eba05663df 100644 (file)
@@ -39,100 +39,6 @@ import org.apache.poi.ss.usermodel.Font;
 public class HSSFFont implements Font
 {
 
-    /**
-     * Arial font
-     */
-
-    public final static String FONT_ARIAL          = "Arial";
-
-    /**
-     * Normal boldness (not bold)
-     */
-
-    public final static short  BOLDWEIGHT_NORMAL   = 0x190;
-
-    /**
-     * Bold boldness (bold)
-     */
-
-    public final static short  BOLDWEIGHT_BOLD     = 0x2bc;
-
-    /**
-     * normal type of black color.
-     */
-
-    public final static short  COLOR_NORMAL        = 0x7fff;
-
-    /**
-     * Dark Red color
-     */
-
-    public final static short  COLOR_RED           = 0xa;
-
-    /**
-     * no type offsetting (not super or subscript)
-     */
-
-    public final static short  SS_NONE             = 0;
-
-    /**
-     * superscript
-     */
-
-    public final static short  SS_SUPER            = 1;
-
-    /**
-     * subscript
-     */
-
-    public final static short  SS_SUB              = 2;
-
-    /**
-     * not underlined
-     */
-
-    public final static byte   U_NONE              = 0;
-
-    /**
-     * single (normal) underline
-     */
-
-    public final static byte   U_SINGLE            = 1;
-
-    /**
-     * double underlined
-     */
-
-    public final static byte   U_DOUBLE            = 2;
-
-    /**
-     * accounting style single underline
-     */
-
-    public final static byte   U_SINGLE_ACCOUNTING = 0x21;
-
-    /**
-     * accounting style double underline
-     */
-
-    public final static byte   U_DOUBLE_ACCOUNTING = 0x22;
-
-    /**
-     * ANSI character set
-     */
-    public final static byte ANSI_CHARSET = 0;
-
-    /**
-     * Default character set.
-     */
-    public final static byte DEFAULT_CHARSET = 1;
-
-    /**
-     * Symbol character set
-     */
-    public final static byte SYMBOL_CHARSET = 2;
-
-
 
     private FontRecord         font;
     private short              index;
index bd9a4cd7929fa42a2f3275ea2899b8636d1e589f..526925a024b2e56544a2190c8d97562180e6f032 100644 (file)
@@ -140,7 +140,7 @@ public class HSSFRichTextString
      */
     public void applyFont(int startIndex, int endIndex, Font font)
     {
-        applyFont(startIndex, endIndex, font.getIndex());
+        applyFont(startIndex, endIndex, ((HSSFFont) font).getIndex());
     }
 
     /**
index aa7ea2db480c0b31056b77118722062893888ba6..9fc0091ec47d744b9e6ecf27d98912995acf07f1 100644 (file)
@@ -242,28 +242,29 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
 
     public void removeRow(Row row)
     {
+        HSSFRow hrow = (HSSFRow) row;
         sheet.setLoc(sheet.getDimsLoc());
         if (rows.size() > 0)
         {
             rows.remove(row);
-            if (row.getRowNum() == getLastRowNum())
+            if (hrow.getRowNum() == getLastRowNum())
             {
                 lastrow = findLastRow(lastrow);
             }
-            if (row.getRowNum() == getFirstRowNum())
+            if (hrow.getRowNum() == getFirstRowNum())
             {
                 firstrow = findFirstRow(firstrow);
             }
-            Iterator iter = row.cellIterator();
+            Iterator iter = hrow.cellIterator();
 
             while (iter.hasNext())
             {
                 HSSFCell cell = (HSSFCell) iter.next();
 
-                sheet.removeValueRecord(row.getRowNum(),
+                sheet.removeValueRecord(hrow.getRowNum(),
                         cell.getCellValueRecord());
             }
-            sheet.removeRow(((HSSFRow) row).getRowRecord());
+            sheet.removeRow(hrow.getRowRecord());
         }
     }
 
@@ -1650,7 +1651,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
      * @param style the style to set
      */
     public void setDefaultColumnStyle(short column, CellStyle style) {
-       sheet.setColumn(column, new Short(style.getIndex()), null, null, null, null);
+       sheet.setColumn(column, new Short(((HSSFCellStyle) style).getIndex()), null, null, null, null);
     }
 
     /**
index 805a6b1c83ea7b9a87c6c8afcc21c9d9fee0e587..65f6447203a7200099b142effec678e2bff49916 100644 (file)
 
 package org.apache.poi.ss.usermodel;
 
-public interface Cell {}
+public interface Cell {
+
+    /**
+     * Numeric Cell type (0)
+     * @see #setCellType(int)
+     * @see #getCellType()
+     */
+
+    public final static int CELL_TYPE_NUMERIC = 0;
+
+    /**
+     * String Cell type (1)
+     * @see #setCellType(int)
+     * @see #getCellType()
+     */
+
+    public final static int CELL_TYPE_STRING = 1;
+
+    /**
+     * Formula Cell type (2)
+     * @see #setCellType(int)
+     * @see #getCellType()
+     */
+
+    public final static int CELL_TYPE_FORMULA = 2;
+
+    /**
+     * Blank Cell type (3)
+     * @see #setCellType(int)
+     * @see #getCellType()
+     */
+
+    public final static int CELL_TYPE_BLANK = 3;
+
+    /**
+     * Boolean Cell type (4)
+     * @see #setCellType(int)
+     * @see #getCellType()
+     */
+
+    public final static int CELL_TYPE_BOOLEAN = 4;
+
+    /**
+     * Error Cell type (5)
+     * @see #setCellType(int)
+     * @see #getCellType()
+     */
+
+    public final static int CELL_TYPE_ERROR = 5;
+
+}
index aad44e30c89fa1b2df86ac45463f4e8bd31ab869..f19bac4cc2ea2128dc8361b6b0d0723bfa768607 100644 (file)
 
 package org.apache.poi.ss.usermodel;
 
-public interface Font {}
+public interface Font {
+
+    /**
+     * Arial font
+     */
+
+    public final static String FONT_ARIAL          = "Arial";
+
+    /**
+     * Normal boldness (not bold)
+     */
+
+    public final static short  BOLDWEIGHT_NORMAL   = 0x190;
+
+    /**
+     * Bold boldness (bold)
+     */
+
+    public final static short  BOLDWEIGHT_BOLD     = 0x2bc;
+
+    /**
+     * normal type of black color.
+     */
+
+    public final static short  COLOR_NORMAL        = 0x7fff;
+
+    /**
+     * Dark Red color
+     */
+
+    public final static short  COLOR_RED           = 0xa;
+
+    /**
+     * no type offsetting (not super or subscript)
+     */
+
+    public final static short  SS_NONE             = 0;
+
+    /**
+     * superscript
+     */
+
+    public final static short  SS_SUPER            = 1;
+
+    /**
+     * subscript
+     */
+
+    public final static short  SS_SUB              = 2;
+
+    /**
+     * not underlined
+     */
+
+    public final static byte   U_NONE              = 0;
+
+    /**
+     * single (normal) underline
+     */
+
+    public final static byte   U_SINGLE            = 1;
+
+    /**
+     * double underlined
+     */
+
+    public final static byte   U_DOUBLE            = 2;
+
+    /**
+     * accounting style single underline
+     */
+
+    public final static byte   U_SINGLE_ACCOUNTING = 0x21;
+
+    /**
+     * accounting style double underline
+     */
+
+    public final static byte   U_DOUBLE_ACCOUNTING = 0x22;
+
+    /**
+     * ANSI character set
+     */
+    public final static byte ANSI_CHARSET = 0;
+
+    /**
+     * Default character set.
+     */
+    public final static byte DEFAULT_CHARSET = 1;
+
+    /**
+     * Symbol character set
+     */
+    public final static byte SYMBOL_CHARSET = 2;
+
+
+}