/** * Gets the type of the hyperlink action. * Must be a <code>LINK_*</code> constant</code> * * @return the hyperlink URL * @see InteractiveInfoAtom */ @Override public HyperlinkType getType() { switch (info.getInteractiveInfoAtom().getHyperlinkType()) { case InteractiveInfoAtom.LINK_Url: return (exHyper.getLinkURL().startsWith("mailto:")) ? HyperlinkType.EMAIL : HyperlinkType.URL; case InteractiveInfoAtom.LINK_NextSlide: case InteractiveInfoAtom.LINK_PreviousSlide: case InteractiveInfoAtom.LINK_FirstSlide: case InteractiveInfoAtom.LINK_LastSlide: case InteractiveInfoAtom.LINK_SlideNumber: return HyperlinkType.DOCUMENT; case InteractiveInfoAtom.LINK_CustomShow: case InteractiveInfoAtom.LINK_OtherPresentation: case InteractiveInfoAtom.LINK_OtherFile: return HyperlinkType.FILE; default: case InteractiveInfoAtom.LINK_NULL: return HyperlinkType.NONE; } }
InteractiveInfoAtom info = hldr.getInteractiveInfoAtom(); if (info == null) { continue;
@Override public void linkToNextSlide() { InteractiveInfoAtom iia = info.getInteractiveInfoAtom(); iia.setAction(InteractiveInfoAtom.ACTION_JUMP); iia.setJump(InteractiveInfoAtom.JUMP_NEXTSLIDE); iia.setHyperlinkType(InteractiveInfoAtom.LINK_NextSlide); linkToDocument(1,-1,"NEXT",0x10); }
@Override public void linkToPreviousSlide() { InteractiveInfoAtom iia = info.getInteractiveInfoAtom(); iia.setAction(InteractiveInfoAtom.ACTION_JUMP); iia.setJump(InteractiveInfoAtom.JUMP_PREVIOUSSLIDE); iia.setHyperlinkType(InteractiveInfoAtom.LINK_PreviousSlide); linkToDocument(1,-1,"PREV",0x10); }
@Override public void linkToFirstSlide() { InteractiveInfoAtom iia = info.getInteractiveInfoAtom(); iia.setAction(InteractiveInfoAtom.ACTION_JUMP); iia.setJump(InteractiveInfoAtom.JUMP_FIRSTSLIDE); iia.setHyperlinkType(InteractiveInfoAtom.LINK_FirstSlide); linkToDocument(1,-1,"FIRST",0x10); }
@Override public void linkToLastSlide() { InteractiveInfoAtom iia = info.getInteractiveInfoAtom(); iia.setAction(InteractiveInfoAtom.ACTION_JUMP); iia.setJump(InteractiveInfoAtom.JUMP_LASTSLIDE); iia.setHyperlinkType(InteractiveInfoAtom.LINK_LastSlide); linkToDocument(1,-1,"LAST",0x10); }
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 HSLFObjectShape(spContainer, parent); case InteractiveInfoAtom.ACTION_MEDIA: return new MovieShape(spContainer, parent); default: break; } } ExObjRefAtom oes = getClientDataRecord(spContainer, RecordTypes.ExObjRefAtom.typeID); return (oes != null) ? new HSLFObjectShape(spContainer, parent) : new HSLFPictureShape(spContainer, parent); }
@Override public void linkToEmail(String emailAddress) { InteractiveInfoAtom iia = info.getInteractiveInfoAtom(); iia.setAction(InteractiveInfoAtom.ACTION_HYPERLINK); iia.setJump(InteractiveInfoAtom.JUMP_NONE); iia.setHyperlinkType(InteractiveInfoAtom.LINK_Url); exHyper.setLinkURL("mailto:"+emailAddress); exHyper.setLinkTitle(emailAddress); exHyper.setLinkOptions(0x10); }
@Override public void linkToUrl(String url) { InteractiveInfoAtom iia = info.getInteractiveInfoAtom(); iia.setAction(InteractiveInfoAtom.ACTION_HYPERLINK); iia.setJump(InteractiveInfoAtom.JUMP_NONE); iia.setHyperlinkType(InteractiveInfoAtom.LINK_Url); exHyper.setLinkURL(url); exHyper.setLinkTitle(url); exHyper.setLinkOptions(0x10); }
@Override public void linkToSlide(Slide<HSLFShape,HSLFTextParagraph> slide) { assert(slide instanceof HSLFSlide); HSLFSlide sl = (HSLFSlide)slide; int slideNum = slide.getSlideNumber(); String alias = "Slide "+slideNum; InteractiveInfoAtom iia = info.getInteractiveInfoAtom(); iia.setAction(InteractiveInfoAtom.ACTION_HYPERLINK); iia.setJump(InteractiveInfoAtom.JUMP_NONE); iia.setHyperlinkType(InteractiveInfoAtom.LINK_SlideNumber); linkToDocument(sl._getSheetNumber(),slideNum,alias,0x30); }
private static void find(Record[] records, ExObjList exobj, List out){ for (int i = 0; i < records.length; i++) { //see if we have InteractiveInfo in the textrun's records if( records[i] instanceof InteractiveInfo){ InteractiveInfo hldr = (InteractiveInfo)records[i]; InteractiveInfoAtom info = hldr.getInteractiveInfoAtom(); int id = info.getHyperlinkID(); ExHyperlink linkRecord = exobj.get(id); if (linkRecord != null){ Hyperlink link = new Hyperlink(); link.title = linkRecord.getLinkTitle(); link.address = linkRecord.getLinkURL(); link.type = info.getAction(); if (++i < records.length && records[i] instanceof TxInteractiveInfoAtom){ TxInteractiveInfoAtom txinfo = (TxInteractiveInfoAtom)records[i]; link.startIndex = txinfo.getStartIndex(); link.endIndex = txinfo.getEndIndex(); } out.add(link); } } } } }
/** * * Assigns a hyperlink to this text shape * * @param linkId id of the hyperlink, @see org.apache.poi.hslf.usermodel.SlideShow#addHyperlink(Hyperlink) * @param beginIndex the beginning index, inclusive. * @param endIndex the ending index, exclusive. * @see org.apache.poi.hslf.usermodel.SlideShow#addHyperlink(Hyperlink) */ public void setHyperlink(int linkId, int beginIndex, int endIndex){ //TODO validate beginIndex and endIndex and throw IllegalArgumentException InteractiveInfo info = new InteractiveInfo(); InteractiveInfoAtom infoAtom = info.getInteractiveInfoAtom(); infoAtom.setAction(InteractiveInfoAtom.ACTION_HYPERLINK); infoAtom.setHyperlinkType(InteractiveInfoAtom.LINK_Url); infoAtom.setHyperlinkID(linkId); _txtbox.appendChildRecord(info); TxInteractiveInfoAtom txiatom = new TxInteractiveInfoAtom(); txiatom.setStartIndex(beginIndex); txiatom.setEndIndex(endIndex); _txtbox.appendChildRecord(txiatom); }
InteractiveInfoAtom infoAtom = info.getInteractiveInfoAtom(); infoAtom.setAction(InteractiveInfoAtom.ACTION_MEDIA); infoAtom.setHyperlinkType(InteractiveInfoAtom.LINK_NULL);
InteractiveInfo info = (InteractiveInfo)getClientDataRecord(spContainer, RecordTypes.InteractiveInfo.typeID); OEShapeAtom oes = (OEShapeAtom)getClientDataRecord(spContainer, RecordTypes.OEShapeAtom.typeID); if(info != null && info.getInteractiveInfoAtom() != null){ switch(info.getInteractiveInfoAtom().getAction()){ case InteractiveInfoAtom.ACTION_OLE: shape = new OLEShape(spContainer, parent);
/** * 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; }
/** * 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; }
InteractiveInfoAtom infoAtom = info.getInteractiveInfoAtom();
obj.setNumber(linkId); InteractiveInfo info = new InteractiveInfo(); info.getInteractiveInfoAtom().setHyperlinkID(linkId);