Remove more deprecated code

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1813085 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2017-10-23 20:27:47 +00:00
parent 5ecf32781d
commit 707f266eef
9 changed files with 35 additions and 159 deletions

View File

@ -69,9 +69,4 @@ public final class TempFile {
public static File createTempDirectory(String name) throws IOException {
return strategy.createTempDirectory(name);
}
/**
* @deprecated POI 3.15 beta 3. Moved to {@link org.apache.poi.util.DefaultTempFileCreationStrategy}.
*/
public static class DefaultTempFileCreationStrategy extends org.apache.poi.util.DefaultTempFileCreationStrategy {}
}

View File

@ -571,6 +571,7 @@ public class TestXSSFCellStyle {
}
@Test
@SuppressWarnings("deprecation")
public void testGetFillForegroundColor() throws IOException {
XSSFWorkbook wb = new XSSFWorkbook();
StylesTable styles = wb.getStylesSource();
@ -581,11 +582,13 @@ public class TestXSSFCellStyle {
assertEquals(IndexedColors.AUTOMATIC.getIndex(), defaultStyle.getFillForegroundColor());
assertEquals(null, defaultStyle.getFillForegroundXSSFColor());
assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPattern());
assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPatternEnum());
XSSFCellStyle customStyle = wb.createCellStyle();
customStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
assertEquals(FillPatternType.SOLID_FOREGROUND, customStyle.getFillPattern());
assertEquals(FillPatternType.SOLID_FOREGROUND, customStyle.getFillPatternEnum());
assertEquals(3, styles.getFills().size());
customStyle.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());

View File

@ -30,28 +30,8 @@ package org.apache.poi.hwpf.model;
public abstract class BytePropertyNode<T extends BytePropertyNode<T>> extends
PropertyNode<T>
{
private final int startBytes;
private final int endBytes;
/**
* @param fcStart The start of the text for this property, in _bytes_
* @param fcEnd The end of the text for this property, in _bytes_
* @deprecated
*/
public BytePropertyNode(int fcStart, int fcEnd, CharIndexTranslator translator, Object buf) {
super(
translator.getCharIndex(fcStart),
translator.getCharIndex(fcEnd, translator.getCharIndex(fcStart)),
buf
);
if ( fcStart > fcEnd )
throw new IllegalArgumentException( "fcStart (" + fcStart
+ ") > fcEnd (" + fcEnd + ")" );
this.startBytes = fcStart;
this.endBytes = fcEnd;
}
private final int startBytes;
private final int endBytes;
public BytePropertyNode( int charStart, int charEnd, Object buf )
{

View File

@ -24,60 +24,42 @@ import org.apache.poi.util.Internal;
/**
* DANGER - works in bytes!
*
* <p>
* Make sure you call getStart() / getEnd() when you want characters
* (normal use), but getStartByte() / getEndByte() when you're
* reading in / writing out!
* (normal use), but getStartByte() / getEndByte() when you're
* reading in / writing out!
*
* @author Ryan Ackley
*/
@Internal
@SuppressWarnings( "deprecation" )
public final class CHPX extends BytePropertyNode<CHPX>
{
@SuppressWarnings("deprecation")
public final class CHPX extends BytePropertyNode<CHPX> {
@Deprecated
public CHPX(int fcStart, int fcEnd, CharIndexTranslator translator, byte[] grpprl)
{
super(fcStart, translator.lookIndexBackward(fcEnd), translator, new SprmBuffer(grpprl, 0));
}
@Deprecated
public CHPX(int fcStart, int fcEnd, CharIndexTranslator translator, SprmBuffer buf)
{
super(fcStart, translator.lookIndexBackward(fcEnd), translator ,buf);
}
CHPX( int charStart, int charEnd, SprmBuffer buf )
{
super( charStart, charEnd, buf );
CHPX(int charStart, int charEnd, SprmBuffer buf) {
super(charStart, charEnd, buf);
}
public byte[] getGrpprl()
{
return ((SprmBuffer)_buf).toByteArray();
}
public byte[] getGrpprl() {
return ((SprmBuffer) _buf).toByteArray();
}
public SprmBuffer getSprmBuf()
{
return (SprmBuffer)_buf;
}
public SprmBuffer getSprmBuf() {
return (SprmBuffer) _buf;
}
public CharacterProperties getCharacterProperties( StyleSheet ss, short istd )
{
if ( ss == null )
{
public CharacterProperties getCharacterProperties(StyleSheet ss, short istd) {
if (ss == null) {
// TODO Fix up for Word 6/95
return new CharacterProperties();
}
CharacterProperties baseStyle = ss.getCharacterStyle( istd );
CharacterProperties baseStyle = ss.getCharacterStyle(istd);
return CharacterSprmUncompressor.uncompressCHP(
ss, baseStyle, getGrpprl(), 0 );
ss, baseStyle, getGrpprl(), 0);
}
public String toString() {
return "CHPX from " + getStart() + " to " + getEnd() +
" (in bytes " + getStartBytes() + " to " + getEndBytes() + ")";
}
public String toString() {
return "CHPX from " + getStart() + " to " + getEnd() +
" (in bytes " + getStartBytes() + " to " + getEndBytes() + ")";
}
}

View File

@ -30,32 +30,6 @@ public interface CharIndexTranslator {
*/
int getByteIndex( int charPos );
/**
* Calculates the char index of the given byte index. Look forward if index
* is not in table
*
* @param bytePos
* The character offset to check
* @return the char index
* @deprecated This API were based on incorrect assumption that single byte
* offset corresponds to single char offset
*/
@Deprecated
int getCharIndex(int bytePos);
/**
* Calculates the char index of the given byte index.
* Look forward if index is not in table
*
* @param bytePos The character offset to check
* @param startCP look from this characted position
* @return the char index
* @deprecated This API were based on incorrect assumption that single byte
* offset corresponds to single char offset
*/
@Deprecated
int getCharIndex(int bytePos, int startCP);
/**
* Finds character ranges that includes specified byte range.
*

View File

@ -52,37 +52,15 @@ public final class PAPFormattedDiskPage extends FormattedDiskPage {
private ArrayList<PAPX> _papxList = new ArrayList<>();
private ArrayList<PAPX> _overFlow;
/**
* @deprecated Use {@link #PAPFormattedDiskPage()} instead
*/
public PAPFormattedDiskPage( byte[] dataStream )
{
this();
}
public PAPFormattedDiskPage()
{
}
/**
* Creates a PAPFormattedDiskPage from a 512 byte array
*
* @deprecated Use
* {@link #PAPFormattedDiskPage(byte[], byte[], int, CharIndexTranslator)}
* instead
*/
public PAPFormattedDiskPage( byte[] documentStream, byte[] dataStream,
int offset, int fcMin, TextPieceTable tpt )
{
this( documentStream, dataStream, offset, tpt );
}
public PAPFormattedDiskPage() { }
/**
* Creates a PAPFormattedDiskPage from a 512 byte array
*/
public PAPFormattedDiskPage( byte[] documentStream, byte[] dataStream,
int offset, CharIndexTranslator translator )
{
int offset, CharIndexTranslator translator ) {
super( documentStream, offset );
for ( int x = 0; x < _crun; x++ )
{

View File

@ -40,15 +40,6 @@ public final class PAPX extends BytePropertyNode<PAPX> {
private ParagraphHeight _phe;
public PAPX(int fcStart, int fcEnd, CharIndexTranslator translator, byte[] papx, ParagraphHeight phe, byte[] dataStream)
{
super(fcStart, fcEnd, translator, new SprmBuffer(papx, 2));
_phe = phe;
SprmBuffer buf = findHuge(new SprmBuffer(papx, 2), dataStream);
if(buf != null)
_buf = buf;
}
public PAPX( int charStart, int charEnd, byte[] papx, ParagraphHeight phe,
byte[] dataStream )
{
@ -59,16 +50,6 @@ public final class PAPX extends BytePropertyNode<PAPX> {
_buf = buf;
}
@Deprecated
public PAPX(int fcStart, int fcEnd, CharIndexTranslator translator, SprmBuffer buf, byte[] dataStream)
{
super(fcStart, fcEnd, translator, buf);
_phe = new ParagraphHeight();
buf = findHuge(buf, dataStream);
if(buf != null)
_buf = buf;
}
public PAPX( int charStart, int charEnd, SprmBuffer buf )
{
super( charStart, charEnd, buf );

View File

@ -86,6 +86,7 @@ public final class TestHSSFPalette {
/**
* Uses the palette from cell stylings
*/
@SuppressWarnings("deprecation")
@Test
public void testPaletteFromCellColours() {
HSSFWorkbook book = HSSFTestDataSamples.openSampleWorkbook("SimpleWithColours.xls");
@ -104,6 +105,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellA.getCellStyle().getFillBackgroundColor());
assertEquals(Font.COLOR_NORMAL, cellA.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.NO_FILL, cellA.getCellStyle().getFillPattern());
assertEquals(FillPatternType.NO_FILL, cellA.getCellStyle().getFillPatternEnum());
assertEquals("0:0:0", p.getColor((short)64).getHexString());
assertEquals(null, p.getColor((short)32767));
@ -113,6 +115,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellB.getCellStyle().getFillBackgroundColor());
assertEquals(10, cellB.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.NO_FILL, cellB.getCellStyle().getFillPattern());
assertEquals(FillPatternType.NO_FILL, cellB.getCellStyle().getFillPatternEnum());
assertEquals("0:0:0", p.getColor((short)64).getHexString());
assertEquals("FFFF:0:0", p.getColor((short)10).getHexString());
@ -122,6 +125,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellC.getCellStyle().getFillBackgroundColor());
assertEquals(10, cellC.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.SOLID_FOREGROUND, cellC.getCellStyle().getFillPattern());
assertEquals(FillPatternType.SOLID_FOREGROUND, cellC.getCellStyle().getFillPatternEnum());
assertEquals("0:FFFF:0", p.getColor((short)11).getHexString());
assertEquals("FFFF:0:0", p.getColor((short)10).getHexString());
@ -131,6 +135,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellD.getCellStyle().getFillBackgroundColor());
assertEquals(14, cellD.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.NO_FILL, cellD.getCellStyle().getFillPattern());
assertEquals(FillPatternType.NO_FILL, cellD.getCellStyle().getFillPatternEnum());
assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString());
assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString());
@ -140,6 +145,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellE.getCellStyle().getFillBackgroundColor());
assertEquals(14, cellE.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.NO_FILL, cellE.getCellStyle().getFillPattern());
assertEquals(FillPatternType.NO_FILL, cellE.getCellStyle().getFillPatternEnum());
assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString());
assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString());
}

View File

@ -356,30 +356,7 @@ public class BaseTestCellUtil {
wb2.close();
}
}
/**
* bug 55555
* @deprecated Replaced by {@link #setFillForegroundColorBeforeFillBackgroundColorEnum()}
* @since POI 3.15 beta 3
*/
@Deprecated
// bug 55555
@Test
public void setFillForegroundColorBeforeFillBackgroundColor() throws IOException {
Workbook wb1 = _testDataProvider.createWorkbook();
Cell A1 = wb1.createSheet().createRow(0).createCell(0);
Map<String, Object> properties = new HashMap<>();
properties.put(CellUtil.FILL_PATTERN, FillPatternType.BRICKS);
properties.put(CellUtil.FILL_FOREGROUND_COLOR, IndexedColors.BLUE.index);
properties.put(CellUtil.FILL_BACKGROUND_COLOR, IndexedColors.RED.index);
CellUtil.setCellStyleProperties(A1, properties);
CellStyle style = A1.getCellStyle();
assertEquals("fill pattern", FillPatternType.BRICKS, style.getFillPattern());
assertEquals("fill foreground color", IndexedColors.BLUE, IndexedColors.fromInt(style.getFillForegroundColor()));
assertEquals("fill background color", IndexedColors.RED, IndexedColors.fromInt(style.getFillBackgroundColor()));
wb1.close();
}
/**
* bug 55555
* @since POI 3.15 beta 3