Date: prev next · Thread: first prev next last
2017 Archives by date, by thread · List index


Two things.  First, I had to call update() on the ToC document index
object in order to get all links in the document.  Second, calling
update() _duplicated_ each and every entry in the ToC which looks like a
bug to me (LO 5.3.6.1)…

I’m still curious though: iterating over the paragraphs, is there any
other indication than the par’s name that the par is in fact part of the
ToC index object?  

Cheers,
Jens


On Thu, Dec 07, 2017 at 07:40:35PM +1000, Jens Tröger wrote:
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 <vmiklos@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/

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.