Bug 41047 - Support hyperlinks in HSLF shapes and textruns
Summary: Support hyperlinks in HSLF shapes and textruns
Alias: None
Product: POI
Classification: Unclassified
Component: HSLF (show other bugs)
Version: 3.7-dev
Hardware: All All
: P4 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Blocks: 47291
  Show dependency tree
Reported: 2006-11-27 11:18 UTC by Matthew Ouellette
Modified: 2016-01-24 00:14 UTC (History)
0 users

text file contain results of dump with link added (8.95 KB, text/plain)
2006-11-27 11:19 UTC, Matthew Ouellette
text file contain results of dump before the link was added (7.47 KB, text/plain)
2006-11-27 11:21 UTC, Matthew Ouellette

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Ouellette 2006-11-27 11:18:59 UTC
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

  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
Comment 1 Matthew Ouellette 2006-11-27 11:19:58 UTC
Created attachment 19180 [details]
text file contain results of dump with link added
Comment 2 Matthew Ouellette 2006-11-27 11:21:12 UTC
Created attachment 19181 [details]
text file contain results of dump before the link was added
Comment 3 Nick Burch 2006-11-28 08:02:55 UTC
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.
Comment 4 Yegor Kozlov 2006-11-28 08:14:46 UTC
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?  

Comment 5 Nick Burch 2006-11-28 08:38:03 UTC
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?
Comment 6 Yegor Kozlov 2006-11-28 08:49:16 UTC
The first step is to implement link records: InteractiveInfoAtom and

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.setTitle("Jakarta Apache");

run.setHyperlink(link, startIdx, endIdx); 

Let's start with the atoms. 

Comment 7 Nick Burch 2007-01-17 10:09:02 UTC
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
Comment 8 David Fisher 2009-02-18 11:05:54 UTC
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.

Comment 9 Mark Thomas 2009-06-10 13:29:02 UTC
Reset assignee
Comment 10 Andreas Beeker 2016-01-24 00:14:55 UTC
added/fixed via r1726458