There is currently no support for adding links to a slide show with the HSLF library. Doing a dump of a slide show with the SlideShowDumper class before and after adding a link showed records added in three sections after the addition of the link. Text files containing the results of the two dumps are attached and the three sections containing the additional records are shown below for easy reference. At position 56 (0038): Type is 1033 (0409), len is 72 (0048) That's a ExObjList At position 64 (0040): Type is 1034 (040A), len is 4 (0004) That's a ExObjListAtom At position 76 (004C): Type is 4055 (0FD7), len is 52 (0034) That's a ExHyperlink At position 84 (0054): Type is 4051 (0FD3), len is 4 (0004) That's a ExHyperlinkAtom At position 96 (0060): Type is 4026 (0FBA), len is 8 (0008) That's a CString At position 112 (0070): Type is 4026 (0FBA), len is 16 (0010) That's a CString At position 823 (0337): Type is 1023 (03FF), len is 20 (0014) That's a VBAInfo At position 831 (033F): Type is 1024 (0400), len is 12 (000C) That's a VBAInfoAtom At position 915 (0393): Type is 5002 (138A), len is 62 (003E) That's a ProgBinaryTag At position 923 (039B): Type is 4026 (0FBA), len is 14 (000E) That's a CString At position 945 (03B1): Type is 5003 (138B), len is 32 (0020) That's a BinaryTagData At position 953 (03B9): Type is 4068 (0FE4), len is 24 (0018) That's a Unknown4068 At position 961 (03C1): Type is 4051 (0FD3), len is 4 (0004) That's a ExHyperlinkAtom At position 973 (03CD): Type is 4120 (1018), len is 4 (0004) That's a Unknown4120
Created attachment 19180 [details] text file contain results of dump with link added
Created attachment 19181 [details] text file contain results of dump before the link was added
It's a pain that there's not just one simple record added, but instead lots of little ones. (That means it'll take a while to add in) OOI, did you figure out which record actually contained the url of your link? I'd guess at the CString at 112 (0070), but it'd be good to know.
I did some investigation into it. There are two places with link-related records. (a) Links are defined globally on the Document level. Document.ExObjList.ExHyperlink container holds the actual link properties - url, path to a file, internal link to a ppt slide, etc. Strings are stored in the CString container. (b) Inside a text run there can be EscherClientData.InteractiveInfo.InteractiveInfoAtom which describes general link properties (type, is it a link to OLE object or just a url?). Also InteractiveInfoAtom holds a reference to (a). I don't think we will support OLE, it's beyond POI. Plain links to slides, files and URL will be OK. Any objections? Yegor
If you're happy to add it, go for it! :) I guess we'll want something on a slideshow to get the links, then alter richtextruns stuff to pull out any links?
The first step is to implement link records: InteractiveInfoAtom and ExHyperlinkAtom. As for API it should be simple. Link is an attribute of a text run. A sample use case may look as follows: TextRun run = ..; Hyperlink link = run.getHyperlink(); String href = link.getAddress(); String title = link.getTitle(); //setting a link: Hyperlink link = new Hyperlink(); link.setAddress("jakarta.apache.org"); link.setTitle("Jakarta Apache"); run.setHyperlink(link); or run.setHyperlink(link, startIdx, endIdx); Let's start with the atoms. Yegor
I've written support for most of the records: * InteractiveInfo + Atom * ExHyperlink + Atom * ExObjList + Atom Just needs some nice model/usermodel wrappers around it, and then hook it up with the RichTextrun Stuff
The low level support is in HSLF. Yegor has not yet had the time to do model/usermodel wrapping. If anyone is interested we can provide guidance or sample code. This might be a focus in the next few months along with PresentationML and moving HSLF out of scratchpad, but after 3.5-FINAL.
Reset assignee
added/fixed via r1726458