aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2018-02-22 22:32:25 +0000
committerPJ Fanning <fanningpj@apache.org>2018-02-22 22:32:25 +0000
commit7019178203de8909bf74f409e1dfcf2d461e7811 (patch)
treeb466f2f699c45c36bbe91126271f02948bc238b9 /src
parent05b0de574cce4c56fc862737242846df4abc2e6e (diff)
downloadpoi-7019178203de8909bf74f409e1dfcf2d461e7811.tar.gz
poi-7019178203de8909bf74f409e1dfcf2d461e7811.zip
further uptake of int methods for font lookups
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1825103 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java2
-rw-r--r--src/java/org/apache/poi/ss/util/CellUtil.java2
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java2
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheetAutoSizeColumn.java2
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java2
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java34
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java28
7 files changed, 36 insertions, 36 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
index a2169018cb..fde539c6ef 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
@@ -849,7 +849,7 @@ public final class HSSFCellStyle implements CellStyle {
FontRecord fr = _workbook.createNewFont();
fr.cloneStyleFrom(
source._workbook.getFontRecordAt(
- source.getFontIndex()
+ source.getFontIntIndex()
)
);
diff --git a/src/java/org/apache/poi/ss/util/CellUtil.java b/src/java/org/apache/poi/ss/util/CellUtil.java
index 15036761a7..ce72bd88e7 100644
--- a/src/java/org/apache/poi/ss/util/CellUtil.java
+++ b/src/java/org/apache/poi/ss/util/CellUtil.java
@@ -346,7 +346,7 @@ public final class CellUtil {
put(properties, FILL_PATTERN, style.getFillPattern());
put(properties, FILL_FOREGROUND_COLOR, style.getFillForegroundColor());
put(properties, FILL_BACKGROUND_COLOR, style.getFillBackgroundColor());
- put(properties, FONT, style.getFontIndex());
+ put(properties, FONT, style.getFontIntIndex());
put(properties, HIDDEN, style.getHidden());
put(properties, INDENTION, style.getIndention());
put(properties, LEFT_BORDER_COLOR, style.getLeftBorderColor());
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java
index 02a0a33344..6afcdd8d95 100644
--- a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java
+++ b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java
@@ -210,7 +210,7 @@ public class TestAutoSizeColumnTracker {
private static void assumeRequiredFontsAreInstalled(final Workbook workbook, final Cell cell) {
// autoSize will fail if required fonts are not installed, skip this test then
- Font font = workbook.getFontAt(cell.getCellStyle().getFontIndex());
+ Font font = workbook.getFontAt(cell.getCellStyle().getFontIntIndex());
Assume.assumeTrue("Cannot verify autoSizeColumn() because the necessary Fonts are not installed on this machine: " + font,
SheetUtil.canComputeColumnWidth(font));
}
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheetAutoSizeColumn.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheetAutoSizeColumn.java
index 8a82e8d4c3..04dd83ed57 100644
--- a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheetAutoSizeColumn.java
+++ b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheetAutoSizeColumn.java
@@ -350,7 +350,7 @@ public class TestSXSSFSheetAutoSizeColumn {
private static void assumeRequiredFontsAreInstalled(final Workbook workbook, final Cell cell) {
// autoSize will fail if required fonts are not installed, skip this test then
- Font font = workbook.getFontAt(cell.getCellStyle().getFontIndex());
+ Font font = workbook.getFontAt(cell.getCellStyle().getFontIntIndex());
Assume.assumeTrue("Cannot verify autoSizeColumn() because the necessary Fonts are not installed on this machine: " + font,
SheetUtil.canComputeColumnWidth(font));
}
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
index c8b5821c4e..b26d177df6 100644
--- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
+++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
@@ -324,7 +324,7 @@ public final class TestXSSFSheet extends BaseTestXSheet {
cellXf.setXfId(1);
stylesTable.putCellXf(cellXf);
XSSFCellStyle cellStyle = new XSSFCellStyle(1, 1, stylesTable, null);
- assertEquals(1, cellStyle.getFontIndex());
+ assertEquals(1, cellStyle.getFontIntIndex());
sheet.setDefaultColumnStyle(3, cellStyle);
assertEquals(1, ctWorksheet.getColsArray(0).getColArray(0).getStyle());
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
index 52a6c1d22b..ca96f0d7c4 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
@@ -1017,7 +1017,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
@Test
public void bug45338() throws IOException {
HSSFWorkbook wb = new HSSFWorkbook();
- assertEquals(4, wb.getNumberOfFonts());
+ assertEquals(4, wb.getNumberOfFontsAsInt());
HSSFSheet s = wb.createSheet();
s.createRow(0);
@@ -1025,7 +1025,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
s.getRow(0).createCell(0);
s.getRow(1).createCell(0);
- assertEquals(4, wb.getNumberOfFonts());
+ assertEquals(4, wb.getNumberOfFontsAsInt());
HSSFFont f1 = wb.getFontAt((short) 0);
assertFalse(f1.getBold());
@@ -1033,19 +1033,19 @@ public final class TestBugs extends BaseTestBugzillaIssues {
// Check that asking for the same font
// multiple times gives you the same thing.
// Otherwise, our tests wouldn't work!
- assertSame(wb.getFontAt((short) 0), wb.getFontAt((short) 0));
+ assertSame(wb.getFontAt(0), wb.getFontAt(0));
assertEquals(
- wb.getFontAt((short) 0),
- wb.getFontAt((short) 0)
+ wb.getFontAt(0),
+ wb.getFontAt(0)
);
assertEquals(
- wb.getFontAt((short) 2),
- wb.getFontAt((short) 2)
+ wb.getFontAt(2),
+ wb.getFontAt(2)
);
assertTrue(
- wb.getFontAt((short) 0)
+ wb.getFontAt(0)
!=
- wb.getFontAt((short) 2)
+ wb.getFontAt(2)
);
// Look for a new font we have
@@ -1058,10 +1058,10 @@ public final class TestBugs extends BaseTestBugzillaIssues {
);
HSSFFont nf = wb.createFont();
- assertEquals(5, wb.getNumberOfFonts());
+ assertEquals(5, wb.getNumberOfFontsAsInt());
assertEquals(5, nf.getIndex());
- assertEquals(nf, wb.getFontAt((short) 5));
+ assertEquals(nf, wb.getFontAt(5));
nf.setBold(false);
nf.setColor((short) 123);
@@ -1072,8 +1072,8 @@ public final class TestBugs extends BaseTestBugzillaIssues {
nf.setTypeOffset((short) 2);
nf.setUnderline((byte) 2);
- assertEquals(5, wb.getNumberOfFonts());
- assertEquals(nf, wb.getFontAt((short) 5));
+ assertEquals(5, wb.getNumberOfFontsAsInt());
+ assertEquals(nf, wb.getFontAt(5));
// Find it now
assertNotNull(
@@ -3130,20 +3130,20 @@ public final class TestBugs extends BaseTestBugzillaIssues {
Cell cell = row.getCell(1);
CellStyle style = cell.getCellStyle();
- assertEquals(26, style.getFontIndex());
+ assertEquals(26, style.getFontIntIndex());
row = sheet.getRow(3);
cell = row.getCell(1);
style = cell.getCellStyle();
- assertEquals(28, style.getFontIndex());
+ assertEquals(28, style.getFontIntIndex());
// check the two fonts
- HSSFFont font = wb.getFontAt((short) 26);
+ HSSFFont font = wb.getFontAt(26);
assertTrue(font.getBold());
assertEquals(10, font.getFontHeightInPoints());
assertEquals("\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF", font.getFontName());
- font = wb.getFontAt((short) 28);
+ font = wb.getFontAt(28);
assertTrue(font.getBold());
assertEquals(10, font.getFontHeightInPoints());
assertEquals("\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF", font.getFontName());
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java
index 30756ab609..889b72caf2 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java
@@ -101,9 +101,9 @@ public abstract class BaseTestFont {
font.setStrikeout(true);
font.setColor(IndexedColors.YELLOW.getIndex());
font.setFontName("Courier");
- short font1Idx = font.getIndex();
+ int font1Idx = font.getIndexAsInt();
wb1.createCellStyle().setFont(font);
- assertEquals(num0 + 1, wb1.getNumberOfFonts());
+ assertEquals(num0 + 1, wb1.getNumberOfFontsAsInt());
CellStyle cellStyleTitle=wb1.createCellStyle();
cellStyleTitle.setFont(font);
@@ -114,8 +114,8 @@ public abstract class BaseTestFont {
wb1.close();
s1 = wb2.getSheetAt(0);
- assertEquals(num0 + 1, wb2.getNumberOfFonts());
- short idx = s1.getRow(0).getCell(0).getCellStyle().getFontIndex();
+ assertEquals(num0 + 1, wb2.getNumberOfFontsAsInt());
+ int idx = s1.getRow(0).getCell(0).getCellStyle().getFontIntIndex();
Font fnt = wb2.getFontAt(idx);
assertNotNull(fnt);
assertEquals(IndexedColors.YELLOW.getIndex(), fnt.getColor());
@@ -125,9 +125,9 @@ public abstract class BaseTestFont {
Font font2 = wb2.createFont();
font2.setItalic(true);
font2.setFontHeightInPoints((short)15);
- short font2Idx = font2.getIndex();
+ int font2Idx = font2.getIndexAsInt();
wb2.createCellStyle().setFont(font2);
- assertEquals(num0 + 2, wb2.getNumberOfFonts());
+ assertEquals(num0 + 2, wb2.getNumberOfFontsAsInt());
// Save and re-load
Workbook wb3 = _testDataProvider.writeOutAndReadBack(wb2);
@@ -135,7 +135,7 @@ public abstract class BaseTestFont {
s1 = wb3.getSheetAt(0);
assertNotNull(s1);
- assertEquals(num0 + 2, wb3.getNumberOfFonts());
+ assertEquals(num0 + 2, wb3.getNumberOfFontsAsInt());
assertNotNull(wb3.getFontAt(font1Idx));
assertNotNull(wb3.getFontAt(font2Idx));
@@ -150,7 +150,7 @@ public abstract class BaseTestFont {
@Test
public final void test45338() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
- int num0 = wb.getNumberOfFonts();
+ int num0 = wb.getNumberOfFontsAsInt();
Sheet s = wb.createSheet();
s.createRow(0);
@@ -159,13 +159,13 @@ public abstract class BaseTestFont {
s.getRow(1).createCell(0);
//default font
- Font f1 = wb.getFontAt((short)0);
+ Font f1 = wb.getFontAt(0);
assertFalse(f1.getBold());
// Check that asking for the same font
// multiple times gives you the same thing.
// Otherwise, our tests wouldn't work!
- assertSame(wb.getFontAt((short)0), wb.getFontAt((short)0));
+ assertSame(wb.getFontAt(0), wb.getFontAt(0));
// Look for a new font we have
// yet to add
@@ -177,8 +177,8 @@ public abstract class BaseTestFont {
);
Font nf = wb.createFont();
- short nfIdx = nf.getIndex();
- assertEquals(num0 + 1, wb.getNumberOfFonts());
+ int nfIdx = nf.getIndexAsInt();
+ assertEquals(num0 + 1, wb.getNumberOfFontsAsInt());
assertSame(nf, wb.getFontAt(nfIdx));
@@ -191,11 +191,11 @@ public abstract class BaseTestFont {
nf.setTypeOffset((short)2);
nf.setUnderline((byte)2);
- assertEquals(num0 + 1, wb.getNumberOfFonts());
+ assertEquals(num0 + 1, wb.getNumberOfFontsAsInt());
assertEquals(nf, wb.getFontAt(nfIdx));
assertEquals(wb.getFontAt(nfIdx), wb.getFontAt(nfIdx));
- assertTrue(wb.getFontAt((short)0) != wb.getFontAt(nfIdx));
+ assertTrue(wb.getFontAt(0) != wb.getFontAt(nfIdx));
// Find it now
assertNotNull(