You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ug...@apache.org on 2008/01/24 11:53:53 UTC

svn commit: r614838 - in /poi/branches/ooxml/src: java/org/apache/poi/hssf/usermodel/ ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/

Author: ugo
Date: Thu Jan 24 02:53:39 2008
New Revision: 614838

URL: http://svn.apache.org/viewvc?rev=614838&view=rev
Log:
Make HSSF* classes compile with JDK 1.4 interfaces.

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

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java?rev=614838&r1=614837&r2=614838&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java Thu Jan 24 02:53:39 2008
@@ -880,7 +880,7 @@
 
     public void setCellStyle(CellStyle style)
     {
-        record.setXFIndex(style.getIndex());
+        record.setXFIndex(((HSSFCellStyle) style).getIndex());
     }
 
     /**
@@ -1006,9 +1006,9 @@
      * @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());
     }
 
     /**

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java?rev=614838&r1=614837&r2=614838&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java Thu Jan 24 02:53:39 2008
@@ -291,7 +291,7 @@
     public void setFont(Font font)
     {
         format.setIndentNotParentFont(true);
-        short fontindex = font.getIndex();
+        short fontindex = ((HSSFFont) font).getIndex();
         format.setFontIndex(fontindex);
     }
 
@@ -310,8 +310,8 @@
      * @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());
     }
 
     /**

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java?rev=614838&r1=614837&r2=614838&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java Thu Jan 24 02:53:39 2008
@@ -144,14 +144,15 @@
      * @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);
     }

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java?rev=614838&r1=614837&r2=614838&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java Thu Jan 24 02:53:39 2008
@@ -39,100 +39,6 @@
 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;

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java?rev=614838&r1=614837&r2=614838&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java Thu Jan 24 02:53:39 2008
@@ -140,7 +140,7 @@
      */
     public void applyFont(int startIndex, int endIndex, Font font)
     {
-        applyFont(startIndex, endIndex, font.getIndex());
+        applyFont(startIndex, endIndex, ((HSSFFont) font).getIndex());
     }
 
     /**

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java?rev=614838&r1=614837&r2=614838&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java Thu Jan 24 02:53:39 2008
@@ -242,28 +242,29 @@
 
     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 @@
      * @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);
     }
 
     /**

Modified: poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java?rev=614838&r1=614837&r2=614838&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java (original)
+++ poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java Thu Jan 24 02:53:39 2008
@@ -17,4 +17,54 @@
 
 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;
+
+}

Modified: poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Font.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Font.java?rev=614838&r1=614837&r2=614838&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Font.java (original)
+++ poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Font.java Thu Jan 24 02:53:39 2008
@@ -17,4 +17,100 @@
 
 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;
+
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org