Thanks Miklos,

Actually, what I find odd is that I don’t see any `text.HyperLinkURL` 
attributes with internal references—all text portions in paragraphs of the ToC 
are empty strings.

Yet, the document does have a ToC index object, but I somehow I can’t associate 
that object with the text paragraphs of the ToC lines, nor with the bookmarks 
scattered throughout the document. Or vice versa…

Cheers,
Jens


> On Dec 7, 2017, at 18:58, Miklos Vajna <vmik...@collabora.co.uk> wrote:
> Let's say you have a ToC, then a Heading 1 paragraphs, Foo.
> 
> Then the ToC refers to hidden RefHeading bookmark for Foo. You can see
> this reference at an UNO API level. Basic code for this:
> 
> oParas = ThisComponent.Text.createEnumeration
> oPara = oParas.nextElement ' Table of Contents
> oPara = oParas.nextElement ' Foo
> oPortions = oPara.createEnumeration
> oPortion = oPortions.nextElement
> xray oPortion.HyperlinkURL ' gives #__RefHeading___Toc...
> 
> If you want to see the bookmarks the ToC refers to, it's similar:
> 
> ...
> oPara = oParas.nextElement ' Foo
> oPortions = oPara.createEnumeration
> oPortion = oPortions.nextElement
> xray oPortion.TextPortionType ' gives Bookmark
> xray oPortion.Bookmark.Name ' gives #__RefHeading___Toc...
> 
> In most cases if you see some information serialized into ODT, then you
> can assume the same information is available via the UNO API. You can
> always read (most of) the ODT filter in xmloff/ to see what exact UNO
> API is used to write a given ODT markup.
> 
> Regards,
> Miklos

--
Jens Tröger
http://savage.light-speed.de/

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to