Package org.apache.poi.hslf.exceptions

Examples of org.apache.poi.hslf.exceptions.HSLFException


        try {
            FileInputStream is = new FileInputStream(pict);
            is.read(data);
            is.close();
        } catch (IOException e){
            throw new HSLFException(e);
        }
        return addPicture(data, format);
    }
View Full Code Here


                pict = read(rawdata, pos + 16);
            }
            out.write(pict);
            return out.toByteArray();
        } catch (IOException e){
            throw new HSLFException(e);
        }
    }
View Full Code Here

                  byte[] png = new byte[data.length-16];
                  System.arraycopy(data, 16, png, 0, png.length);
                  data = png;
              }
          } catch (IOException e){
              throw new HSLFException(e);
          }
         return data;
     }
View Full Code Here

                out.write(chunk,0,count);
            }
            inflater.close();
            return out.toByteArray();
        } catch (IOException e){
            throw new HSLFException(e);
        }
    }
View Full Code Here

        public int checksum;

        public void read(byte[] data, int offset){
            int pos = offset;
            int key = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE; //header key
            if (key != APMHEADER_KEY) throw new HSLFException("Not a valid WMF file");

            handle = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
            left = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
            top = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
            right = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
            bottom = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;

            inch = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
            reserved = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;

            checksum = LittleEndian.getShort(data, pos); pos += LittleEndian.SHORT_SIZE;
            if (checksum != getChecksum())
                throw new HSLFException("WMF checksum does not match the header data");
        }
View Full Code Here

                out.write(chunk,0,count);
            }
            inflater.close();
            return out.toByteArray();
        } catch (IOException e){
            throw new HSLFException(e);
        }
    }
View Full Code Here

        // Update and write out the Current User atom
        int oldLastUserEditAtomPos = (int)currentUser.getCurrentEditOffset();
        Integer newLastUserEditAtomPos = (Integer)oldToNewPositions.get(new Integer(oldLastUserEditAtomPos));
        if(newLastUserEditAtomPos == null) {
            throw new HSLFException("Couldn't find the new location of the UserEditAtom that used to be at " + oldLastUserEditAtomPos);
        }
        currentUser.setCurrentEditOffset(newLastUserEditAtomPos.intValue());
        currentUser.writeToFS(outFS);
        writtenEntries.add("Current User");
View Full Code Here

            try {
                for (int i = 0; i < _clientRecords.length; i++) {
                    _clientRecords[i].writeOut(out);
                }
            } catch(Exception e){
                throw new HSLFException(e);
            }
            _clientData.setRemainingData(out.toByteArray());
        }
    }
View Full Code Here

        }
    }

    public void setHyperlink(Hyperlink link){
        if(link.getId() == -1){
            throw new HSLFException("You must call SlideShow.addHyperlink(Hyperlink link) first");
        }

        EscherClientDataRecord cldata = new EscherClientDataRecord();
        cldata.setOptions((short)0xF);
        getSpContainer().addChildRecord(cldata); // TODO - junit to prove getChildRecords().add is wrong

        InteractiveInfo info = new InteractiveInfo();
        InteractiveInfoAtom infoAtom = info.getInteractiveInfoAtom();

        switch(link.getType()){
            case Hyperlink.LINK_FIRSTSLIDE:
                infoAtom.setAction(InteractiveInfoAtom.ACTION_JUMP);
                infoAtom.setJump(InteractiveInfoAtom.JUMP_FIRSTSLIDE);
                infoAtom.setHyperlinkType(InteractiveInfoAtom.LINK_FirstSlide);
                break;
            case Hyperlink.LINK_LASTSLIDE:
                infoAtom.setAction(InteractiveInfoAtom.ACTION_JUMP);
                infoAtom.setJump(InteractiveInfoAtom.JUMP_LASTSLIDE);
                infoAtom.setHyperlinkType(InteractiveInfoAtom.LINK_LastSlide);
                break;
            case Hyperlink.LINK_NEXTSLIDE:
                infoAtom.setAction(InteractiveInfoAtom.ACTION_JUMP);
                infoAtom.setJump(InteractiveInfoAtom.JUMP_NEXTSLIDE);
                infoAtom.setHyperlinkType(InteractiveInfoAtom.LINK_NextSlide);
                break;
            case Hyperlink.LINK_PREVIOUSSLIDE:
                infoAtom.setAction(InteractiveInfoAtom.ACTION_JUMP);
                infoAtom.setJump(InteractiveInfoAtom.JUMP_PREVIOUSSLIDE);
                infoAtom.setHyperlinkType(InteractiveInfoAtom.LINK_PreviousSlide);
                break;
            case Hyperlink.LINK_URL:
                infoAtom.setAction(InteractiveInfoAtom.ACTION_HYPERLINK);
                infoAtom.setJump(InteractiveInfoAtom.JUMP_NONE);
                infoAtom.setHyperlinkType(InteractiveInfoAtom.LINK_Url);
                break;
          }

        infoAtom.setHyperlinkID(link.getId());

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            info.writeOut(out);
        } catch(Exception e){
            throw new HSLFException(e);
        }
        cldata.setRemainingData(out.toByteArray());

    }
View Full Code Here

        try {
            FileInputStream is = new FileInputStream(pict);
            is.read(data);
            is.close();
        } catch (IOException e){
            throw new HSLFException(e);
        }
        return addPicture(data, format);
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.hslf.exceptions.HSLFException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.