Search in sources :

Example 1 with InteractiveInfo

use of org.apache.poi.hslf.record.InteractiveInfo in project poi by apache.

the class MovieShape method createSpContainer.

/**
     * Create a new Placeholder and initialize internal structures
     *
     * @return the created <code>EscherContainerRecord</code> which holds shape data
     */
@Override
protected EscherContainerRecord createSpContainer(int idx, boolean isChild) {
    EscherContainerRecord ecr = super.createSpContainer(idx, isChild);
    setEscherProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x1000100);
    setEscherProperty(EscherProperties.FILL__NOFILLHITTEST, 0x10001);
    ExObjRefAtom oe = new ExObjRefAtom();
    InteractiveInfo info = new InteractiveInfo();
    InteractiveInfoAtom infoAtom = info.getInteractiveInfoAtom();
    infoAtom.setAction(InteractiveInfoAtom.ACTION_MEDIA);
    infoAtom.setHyperlinkType(InteractiveInfoAtom.LINK_NULL);
    AnimationInfo an = new AnimationInfo();
    AnimationInfoAtom anAtom = an.getAnimationInfoAtom();
    anAtom.setFlag(AnimationInfoAtom.Automatic, true);
    HSLFEscherClientDataRecord cldata = getClientData(true);
    cldata.addChild(oe);
    cldata.addChild(an);
    cldata.addChild(info);
    return ecr;
}
Also used : ExObjRefAtom(org.apache.poi.hslf.record.ExObjRefAtom) HSLFEscherClientDataRecord(org.apache.poi.hslf.record.HSLFEscherClientDataRecord) InteractiveInfoAtom(org.apache.poi.hslf.record.InteractiveInfoAtom) AnimationInfo(org.apache.poi.hslf.record.AnimationInfo) AnimationInfoAtom(org.apache.poi.hslf.record.AnimationInfoAtom) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) InteractiveInfo(org.apache.poi.hslf.record.InteractiveInfo)

Example 2 with InteractiveInfo

use of org.apache.poi.hslf.record.InteractiveInfo in project poi by apache.

the class HSLFHyperlink method createHyperlink.

/**
     * Creates a new Hyperlink and assign it to a shape
     * This is only a helper method - use {@link HSLFSimpleShape#createHyperlink()} instead!
     *
     * @param shape the shape which receives the hyperlink
     * @return the new hyperlink
     * 
     * @see HSLFSimpleShape#createHyperlink()
     */
/* package */
static HSLFHyperlink createHyperlink(HSLFSimpleShape shape) {
    // TODO: check if a hyperlink already exists
    ExHyperlink exHyper = new ExHyperlink();
    int linkId = shape.getSheet().getSlideShow().addToObjListAtom(exHyper);
    ExHyperlinkAtom obj = exHyper.getExHyperlinkAtom();
    obj.setNumber(linkId);
    InteractiveInfo info = new InteractiveInfo();
    info.getInteractiveInfoAtom().setHyperlinkID(linkId);
    HSLFEscherClientDataRecord cldata = shape.getClientData(true);
    cldata.addChild(info);
    HSLFHyperlink hyper = new HSLFHyperlink(exHyper, info);
    hyper.linkToNextSlide();
    shape.setHyperlink(hyper);
    return hyper;
}
Also used : ExHyperlinkAtom(org.apache.poi.hslf.record.ExHyperlinkAtom) HSLFEscherClientDataRecord(org.apache.poi.hslf.record.HSLFEscherClientDataRecord) ExHyperlink(org.apache.poi.hslf.record.ExHyperlink) InteractiveInfo(org.apache.poi.hslf.record.InteractiveInfo)

Example 3 with InteractiveInfo

use of org.apache.poi.hslf.record.InteractiveInfo in project poi by apache.

the class HSLFHyperlink method createHyperlink.

/**
     * Creates a new Hyperlink for a textrun.
     * This is only a helper method - use {@link HSLFTextRun#createHyperlink()} instead!
     *
     * @param run the run which receives the hyperlink
     * @return the new hyperlink
     * 
     * @see HSLFTextRun#createHyperlink()
     */
/* package */
static HSLFHyperlink createHyperlink(HSLFTextRun run) {
    // TODO: check if a hyperlink already exists
    ExHyperlink exHyper = new ExHyperlink();
    int linkId = run.getTextParagraph().getSheet().getSlideShow().addToObjListAtom(exHyper);
    ExHyperlinkAtom obj = exHyper.getExHyperlinkAtom();
    obj.setNumber(linkId);
    InteractiveInfo info = new InteractiveInfo();
    info.getInteractiveInfoAtom().setHyperlinkID(linkId);
    // don't add the hyperlink now to text paragraph records
    // this will be done, when the paragraph is saved
    HSLFHyperlink hyper = new HSLFHyperlink(exHyper, info);
    hyper.linkToNextSlide();
    TxInteractiveInfoAtom txinfo = new TxInteractiveInfoAtom();
    int startIdx = run.getTextParagraph().getStartIdxOfTextRun(run);
    int endIdx = startIdx + run.getLength();
    txinfo.setStartIndex(startIdx);
    txinfo.setEndIndex(endIdx);
    hyper.setTextRunInfo(txinfo);
    run.setHyperlink(hyper);
    return hyper;
}
Also used : ExHyperlinkAtom(org.apache.poi.hslf.record.ExHyperlinkAtom) ExHyperlink(org.apache.poi.hslf.record.ExHyperlink) TxInteractiveInfoAtom(org.apache.poi.hslf.record.TxInteractiveInfoAtom) InteractiveInfo(org.apache.poi.hslf.record.InteractiveInfo)

Example 4 with InteractiveInfo

use of org.apache.poi.hslf.record.InteractiveInfo in project poi by apache.

the class HSLFShapeFactory method createFrame.

private static HSLFShape createFrame(EscherContainerRecord spContainer, ShapeContainer<HSLFShape, HSLFTextParagraph> parent) {
    InteractiveInfo info = getClientDataRecord(spContainer, RecordTypes.InteractiveInfo.typeID);
    if (info != null && info.getInteractiveInfoAtom() != null) {
        switch(info.getInteractiveInfoAtom().getAction()) {
            case InteractiveInfoAtom.ACTION_OLE:
                return new OLEShape(spContainer, parent);
            case InteractiveInfoAtom.ACTION_MEDIA:
                return new MovieShape(spContainer, parent);
            default:
                break;
        }
    }
    ExObjRefAtom oes = getClientDataRecord(spContainer, RecordTypes.ExObjRefAtom.typeID);
    return (oes != null) ? new OLEShape(spContainer, parent) : new HSLFPictureShape(spContainer, parent);
}
Also used : ExObjRefAtom(org.apache.poi.hslf.record.ExObjRefAtom) MovieShape(org.apache.poi.hslf.model.MovieShape) InteractiveInfo(org.apache.poi.hslf.record.InteractiveInfo) OLEShape(org.apache.poi.hslf.model.OLEShape)

Example 5 with InteractiveInfo

use of org.apache.poi.hslf.record.InteractiveInfo in project poi by apache.

the class HSLFHyperlink method find.

private static void find(List<? extends Record> records, ExObjList exobj, List<HSLFHyperlink> out) {
    ListIterator<? extends Record> iter = records.listIterator();
    while (iter.hasNext()) {
        Record r = iter.next();
        // see if we have InteractiveInfo in the textrun's records
        if (!(r instanceof InteractiveInfo)) {
            continue;
        }
        InteractiveInfo hldr = (InteractiveInfo) r;
        InteractiveInfoAtom info = hldr.getInteractiveInfoAtom();
        if (info == null) {
            continue;
        }
        int id = info.getHyperlinkID();
        ExHyperlink exHyper = exobj.get(id);
        if (exHyper == null) {
            continue;
        }
        HSLFHyperlink link = new HSLFHyperlink(exHyper, hldr);
        out.add(link);
        if (iter.hasNext()) {
            r = iter.next();
            if (!(r instanceof TxInteractiveInfoAtom)) {
                iter.previous();
                continue;
            }
            link.setTextRunInfo((TxInteractiveInfoAtom) r);
        }
    }
}
Also used : InteractiveInfoAtom(org.apache.poi.hslf.record.InteractiveInfoAtom) TxInteractiveInfoAtom(org.apache.poi.hslf.record.TxInteractiveInfoAtom) ExHyperlink(org.apache.poi.hslf.record.ExHyperlink) TxInteractiveInfoAtom(org.apache.poi.hslf.record.TxInteractiveInfoAtom) HSLFEscherClientDataRecord(org.apache.poi.hslf.record.HSLFEscherClientDataRecord) Record(org.apache.poi.hslf.record.Record) InteractiveInfo(org.apache.poi.hslf.record.InteractiveInfo)

Aggregations

InteractiveInfo (org.apache.poi.hslf.record.InteractiveInfo)6 ExHyperlink (org.apache.poi.hslf.record.ExHyperlink)3 HSLFEscherClientDataRecord (org.apache.poi.hslf.record.HSLFEscherClientDataRecord)3 TxInteractiveInfoAtom (org.apache.poi.hslf.record.TxInteractiveInfoAtom)3 ExHyperlinkAtom (org.apache.poi.hslf.record.ExHyperlinkAtom)2 ExObjRefAtom (org.apache.poi.hslf.record.ExObjRefAtom)2 InteractiveInfoAtom (org.apache.poi.hslf.record.InteractiveInfoAtom)2 Record (org.apache.poi.hslf.record.Record)2 EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)1 MovieShape (org.apache.poi.hslf.model.MovieShape)1 OLEShape (org.apache.poi.hslf.model.OLEShape)1 AnimationInfo (org.apache.poi.hslf.record.AnimationInfo)1 AnimationInfoAtom (org.apache.poi.hslf.record.AnimationInfoAtom)1 RecordContainer (org.apache.poi.hslf.record.RecordContainer)1 TextHeaderAtom (org.apache.poi.hslf.record.TextHeaderAtom)1