You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/06/18 01:21:08 UTC

svn commit: r1748898 - in /poi/trunk/src: java/org/apache/poi/hssf/usermodel/ java/org/apache/poi/ss/usermodel/ ooxml/java/org/apache/poi/xssf/model/ ooxml/java/org/apache/poi/xssf/streaming/ ooxml/java/org/apache/poi/xssf/usermodel/

Author: onealj
Date: Sat Jun 18 01:21:08 2016
New Revision: 1748898

URL: http://svn.apache.org/viewvc?rev=1748898&view=rev
Log:
bug 59718: deprecate get/setBoldweight. Use get/setBold

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/Workbook.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java?rev=1748898&r1=1748897&r2=1748898&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java Sat Jun 18 01:21:08 2016
@@ -1114,13 +1114,15 @@ public final class HSSFWorkbook extends
 
     /**
      * Finds a font that matches the one with the supplied attributes
+     * @deprecated 3.15 beta 2. Use {@link #findFont(boolean, short, short, String, boolean, boolean, short, byte)} instead.
      */
     @Override
     public HSSFFont findFont(short boldWeight, short color, short fontHeight,
                              String name, boolean italic, boolean strikeout,
                              short typeOffset, byte underline)
     {
-        for (short i=0; i<=getNumberOfFonts(); i++) {
+        short numberOfFonts = getNumberOfFonts();
+        for (short i=0; i<=numberOfFonts; i++) {
             // Remember - there is no 4!
             if(i == 4) continue;
 
@@ -1129,6 +1131,34 @@ public final class HSSFWorkbook extends
                     && hssfFont.getColor() == color
                     && hssfFont.getFontHeight() == fontHeight
                     && hssfFont.getFontName().equals(name)
+                    && hssfFont.getItalic() == italic
+                    && hssfFont.getStrikeout() == strikeout
+                    && hssfFont.getTypeOffset() == typeOffset
+                    && hssfFont.getUnderline() == underline)
+            {
+                return hssfFont;
+            }
+        }
+
+        return null;
+    }
+    /**
+     * Finds a font that matches the one with the supplied attributes
+     */
+    public HSSFFont findFont(boolean bold, short color, short fontHeight,
+                             String name, boolean italic, boolean strikeout,
+                             short typeOffset, byte underline)
+    {
+        short numberOfFonts = getNumberOfFonts();
+        for (short i=0; i<=numberOfFonts; i++) {
+            // Remember - there is no 4!
+            if(i == 4) continue;
+
+            HSSFFont hssfFont = getFontAt(i);
+            if (hssfFont.getBold() == bold
+                    && hssfFont.getColor() == color
+                    && hssfFont.getFontHeight() == fontHeight
+                    && hssfFont.getFontName().equals(name)
                     && hssfFont.getItalic() == italic
                     && hssfFont.getStrikeout() == strikeout
                     && hssfFont.getTypeOffset() == typeOffset

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/Workbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/Workbook.java?rev=1748898&r1=1748897&r2=1748898&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/Workbook.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/Workbook.java Sat Jun 18 01:21:08 2016
@@ -26,7 +26,6 @@ import java.util.List;
 import org.apache.poi.ss.SpreadsheetVersion;
 import org.apache.poi.ss.formula.udf.UDFFinder;
 import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
-import org.apache.poi.ss.util.CellRangeAddress;
 
 /**
  * High level representation of a Excel workbook.  This is the first object most users
@@ -283,8 +282,16 @@ public interface Workbook extends Closea
      * Finds a font that matches the one with the supplied attributes
      *
      * @return the font with the matched attributes or <code>null</code>
+     * @deprecated POI 3.15 beta 2. Use {@link #findFont(boolean, short, short, String, boolean, boolean, short, byte)} instead.
      */
     Font findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline);
+    
+    /**
+     * Finds a font that matches the one with the supplied attributes
+     *
+     * @return the font with the matched attributes or <code>null</code>
+     */
+    Font findFont(boolean bold, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline);
 
     /**
      * Get the number of fonts in the font table

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java?rev=1748898&r1=1748897&r2=1748898&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java Sat Jun 18 01:21:08 2016
@@ -803,6 +803,7 @@ public class StylesTable extends POIXMLD
 
     /**
      * Finds a font that matches the one with the supplied attributes
+     * @deprecated POI 3.15 beta 2. Use {@link #findFont(boolean, short, short, String, boolean, boolean, short, byte)} instead.
      */
     public XSSFFont findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) {
         for (XSSFFont font : fonts) {
@@ -810,6 +811,26 @@ public class StylesTable extends POIXMLD
                     && font.getColor() == color
                     && font.getFontHeight() == fontHeight
                     && font.getFontName().equals(name)
+                    && font.getItalic() == italic
+                    && font.getStrikeout() == strikeout
+                    && font.getTypeOffset() == typeOffset
+                    && font.getUnderline() == underline)
+            {
+                return font;
+            }
+        }
+        return null;
+    }
+    
+    /**
+     * Finds a font that matches the one with the supplied attributes
+     */
+    public XSSFFont findFont(boolean bold, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) {
+        for (XSSFFont font : fonts) {
+            if (    (font.getBold() == bold)
+                    && font.getColor() == color
+                    && font.getFontHeight() == fontHeight
+                    && font.getFontName().equals(name)
                     && font.getItalic() == italic
                     && font.getStrikeout() == strikeout
                     && font.getTypeOffset() == typeOffset

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java?rev=1748898&r1=1748897&r2=1748898&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java Sat Jun 18 01:21:08 2016
@@ -813,12 +813,24 @@ public class SXSSFWorkbook implements Wo
      * Finds a font that matches the one with the supplied attributes
      *
      * @return the font with the matched attributes or <code>null</code>
+     * @deprecated POI 3.15 beta 2. Use {@link #findFont(boolean, short, short, String, boolean, boolean, short, byte)} instead.
      */
     @Override
     public Font findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline)
     {
         return _wb.findFont(boldWeight, color, fontHeight, name, italic, strikeout, typeOffset, underline);
     }
+    
+    /**
+     * Finds a font that matches the one with the supplied attributes
+     *
+     * @return the font with the matched attributes or <code>null</code>
+     */
+    @Override
+    public Font findFont(boolean bold, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline)
+    {
+        return _wb.findFont(bold, color, fontHeight, name, italic, strikeout, typeOffset, underline);
+    }
    
 
     /**

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java?rev=1748898&r1=1748897&r2=1748898&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java Sat Jun 18 01:21:08 2016
@@ -870,11 +870,20 @@ public class XSSFWorkbook extends POIXML
 
     /**
      * Finds a font that matches the one with the supplied attributes
+     * @deprecated POI 3.15. Use {@link #findFont(boolean, short, short, String, boolean, boolean, short, byte)} instead.
      */
     @Override
     public XSSFFont findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) {
         return stylesSource.findFont(boldWeight, color, fontHeight, name, italic, strikeout, typeOffset, underline);
     }
+    
+    /**
+     * Finds a font that matches the one with the supplied attributes
+     */
+    @Override
+    public XSSFFont findFont(boolean bold, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) {
+        return stylesSource.findFont(bold, color, fontHeight, name, italic, strikeout, typeOffset, underline);
+    }
 
     /**
      * Convenience method to get the active sheet.  The active sheet is is the sheet



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