Tweak constructor to be more open, and fix some generics warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@995429 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2010-09-09 13:57:05 +00:00
parent 63beafeb10
commit 60ff5c056d
2 changed files with 14 additions and 22 deletions

View File

@ -50,7 +50,7 @@ public class HSSFPictureData implements PictureData
* *
* @param blip the underlying blip record containing the bitmap data. * @param blip the underlying blip record containing the bitmap data.
*/ */
HSSFPictureData( EscherBlipRecord blip ) public HSSFPictureData( EscherBlipRecord blip )
{ {
this.blip = blip; this.blip = blip;
} }

View File

@ -1581,29 +1581,21 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
* @param escherRecords the escher records. * @param escherRecords the escher records.
* @param pictures the list to populate with the pictures. * @param pictures the list to populate with the pictures.
*/ */
private void searchForPictures(List escherRecords, List<HSSFPictureData> pictures) private void searchForPictures(List<EscherRecord> escherRecords, List<HSSFPictureData> pictures)
{ {
Iterator recordIter = escherRecords.iterator(); for(EscherRecord escherRecord : escherRecords) {
while (recordIter.hasNext()) if (escherRecord instanceof EscherBSERecord)
{ {
Object obj = recordIter.next(); EscherBlipRecord blip = ((EscherBSERecord) escherRecord).getBlipRecord();
if (obj instanceof EscherRecord) if (blip != null)
{ {
EscherRecord escherRecord = (EscherRecord) obj; // TODO: Some kind of structure.
pictures.add(new HSSFPictureData(blip));
}
}
if (escherRecord instanceof EscherBSERecord) // Recursive call.
{ searchForPictures(escherRecord.getChildRecords(), pictures);
EscherBlipRecord blip = ((EscherBSERecord) escherRecord).getBlipRecord();
if (blip != null)
{
// TODO: Some kind of structure.
pictures.add(new HSSFPictureData(blip));
}
}
// Recursive call.
searchForPictures(escherRecord.getChildRecords(), pictures);
}
} }
} }