summaryrefslogtreecommitdiffstats
path: root/src/ooxml
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2020-12-09 18:04:56 +0000
committerPJ Fanning <fanningpj@apache.org>2020-12-09 18:04:56 +0000
commit8d54ec7cc7b485fd8866b8612b07beab455a5018 (patch)
treeaef3cad7f6c64c2ec35cb38da76323ec40967fe6 /src/ooxml
parent78596d7891bfb8a524fe9991c2ab3b3e6d66a2ad (diff)
downloadpoi-8d54ec7cc7b485fd8866b8612b07beab455a5018.tar.gz
poi-8d54ec7cc7b485fd8866b8612b07beab455a5018.zip
remove more deprecated code
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884263 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml')
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java40
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java4
2 files changed, 33 insertions, 11 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java
index be7be6cb39..ddd278eb8e 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java
@@ -18,14 +18,15 @@ package org.apache.poi.xssf.usermodel;
import java.util.Objects;
+import org.apache.poi.common.usermodel.fonts.FontCharset;
import org.apache.poi.ooxml.POIXMLException;
import org.apache.poi.ss.usermodel.Font;
-import org.apache.poi.ss.usermodel.FontCharset;
import org.apache.poi.ss.usermodel.FontFamily;
import org.apache.poi.ss.usermodel.FontScheme;
import org.apache.poi.ss.usermodel.FontUnderline;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.util.Internal;
+import org.apache.poi.util.Removal;
import org.apache.poi.xssf.model.StylesTable;
import org.apache.poi.xssf.model.ThemesTable;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty;
@@ -126,7 +127,8 @@ public class XSSFFont implements Font {
*/
public int getCharSet() {
CTIntProperty charset = _ctFont.sizeOfCharsetArray() == 0 ? null : _ctFont.getCharsetArray(0);
- return charset == null ? FontCharset.ANSI.getValue() : FontCharset.valueOf(charset.getVal()).getValue();
+ return charset == null ? org.apache.poi.ss.usermodel.FontCharset.ANSI.getValue() :
+ org.apache.poi.ss.usermodel.FontCharset.valueOf(charset.getVal()).getValue();
}
@@ -311,20 +313,21 @@ public class XSSFFont implements Font {
* set character-set to use.
*
* @param charset - charset
- * @see FontCharset
+ * @see org.apache.poi.ss.usermodel.FontCharset
*/
public void setCharSet(byte charset) {
int cs = charset & 0xff;
setCharSet(cs);
}
+
/**
* set character-set to use.
*
* @param charset - charset
- * @see FontCharset
+ * @see org.apache.poi.ss.usermodel.FontCharset
*/
public void setCharSet(int charset) {
- FontCharset fontCharset = FontCharset.valueOf(charset);
+ org.apache.poi.ss.usermodel.FontCharset fontCharset = org.apache.poi.ss.usermodel.FontCharset.valueOf(charset);
if(fontCharset != null) {
setCharSet(fontCharset);
} else {
@@ -337,7 +340,7 @@ public class XSSFFont implements Font {
*
* @param charSet
*/
- public void setCharSet(FontCharset charSet) {
+ public void setCharSet(org.apache.poi.ss.usermodel.FontCharset charSet) {
CTIntProperty charsetProperty;
if(_ctFont.sizeOfCharsetArray() == 0) {
charsetProperty = _ctFont.addNewCharset();
@@ -350,6 +353,24 @@ public class XSSFFont implements Font {
}
/**
+ * set character-set to use.
+ *
+ * @param charSet
+ * @since 5.0.0
+ */
+ public void setCharSet(FontCharset charSet) {
+ CTIntProperty charsetProperty;
+ if(_ctFont.sizeOfCharsetArray() == 0) {
+ charsetProperty = _ctFont.addNewCharset();
+ } else {
+ charsetProperty = _ctFont.getCharsetArray(0);
+ }
+ // We know that FontCharset only has valid entries in it,
+ // so we can just set the int value from it
+ charsetProperty.setVal( charSet.getNativeId() );
+ }
+
+ /**
* set the indexed color for the font
*
* @param color - color to use
@@ -624,11 +645,12 @@ public class XSSFFont implements Font {
}
@Override
- @Deprecated
- public short getIndex() {
- return (short)getIndexAsInt();
+ public int getIndex() {
+ return _index;
}
+ @Deprecated
+ @Removal(version = "6.0.0")
@Override
public int getIndexAsInt()
{
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java
index 8547b29511..bce40f0707 100644
--- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java
+++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java
@@ -384,7 +384,7 @@ public final class TestXSSFFont extends BaseTestFont{
XSSFFont nf = wb.createFont();
assertEquals(2, wb.getNumberOfFonts());
- assertEquals(1, nf.getIndexAsInt());
+ assertEquals(1, nf.getIndex());
assertEquals(nf, wb.getFontAt(1));
nf.setBold(false);
@@ -422,7 +422,7 @@ public final class TestXSSFFont extends BaseTestFont{
assertNotNull(font);
assertEquals(
1,
- font.getIndexAsInt()
+ font.getIndex()
);
assertEquals(nf,
wb.findFont(