Methods Summary |
---|
public org.apache.poi.hwpf.usermodel.Picture | extractPicture(org.apache.poi.hwpf.usermodel.CharacterRun run, boolean fillBytes)Returns picture object tied to specified CharacterRun
if (hasPicture(run)) {
return new Picture(run.getPicOffset(), _dataStream, fillBytes);
}
return null;
|
public java.util.List | getAllPictures()
ArrayList pictures = new ArrayList();
int pos = 0;
boolean atEnd = false;
while(pos<_dataStream.length && !atEnd) {
if (isBlockContainsImage(pos)) {
pictures.add(new Picture(pos, _dataStream, false));
}
int skipOn = LittleEndian.getInt(_dataStream, pos);
if(skipOn <= 0) { atEnd = true; }
pos += skipOn;
}
return pictures;
|
private static short | getBlockType(byte[] dataStream, int pictOffset)
return LittleEndian.getShort(dataStream, pictOffset + BLOCK_TYPE_OFFSET);
|
private static short | getMmMode(byte[] dataStream, int pictOffset)
return LittleEndian.getShort(dataStream, pictOffset + MM_MODE_TYPE_OFFSET);
|
public boolean | hasHorizontalLine(org.apache.poi.hwpf.usermodel.CharacterRun run)determines whether specified CharacterRun contains reference to a picture
if (run.isSpecialCharacter() && "\u0001".equals(run.text())) {
return isBlockContainsHorizontalLine(run.getPicOffset());
}
return false;
|
public boolean | hasPicture(org.apache.poi.hwpf.usermodel.CharacterRun run)determines whether specified CharacterRun contains reference to a picture
if (run.isSpecialCharacter() && !run.isObj() && !run.isOle2() && !run.isData() && "\u0001".equals(run.text())) {
return isBlockContainsImage(run.getPicOffset());
}
return false;
|
private boolean | isBlockContainsHorizontalLine(int i)
return getBlockType(_dataStream, i)==TYPE_HORIZONTAL_LINE && getMmMode(_dataStream, i)==0x64;
|
private boolean | isBlockContainsImage(int i)
return isPictureRecognized(getBlockType(_dataStream, i), getMmMode(_dataStream, i));
|
private boolean | isPictureRecognized(short blockType, short mappingModeOfMETAFILEPICT)
return (blockType == TYPE_IMAGE || blockType == TYPE_IMAGE_PASTED_FROM_CLIPBOARD || (blockType==TYPE_IMAGE_WORD2000 && mappingModeOfMETAFILEPICT==0x64) || (blockType==TYPE_IMAGE_PASTED_FROM_CLIPBOARD_WORD2000 && mappingModeOfMETAFILEPICT==0x64));
|