Using Bibliography (Index)

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
SNM90
Posts: 21
Joined: Fri Mar 01, 2013 6:56 am

Using Bibliography (Index)

Post by SNM90 »

Hello,

I'm trying to insert different types of Indexes available in LibreOffice through the API but only the TOC (through css::text::ContentIndex service) has been successfully done. For the others, like DocumentIndex (alphabetical index), Bibliography, etc. I'm not able to figure out how to enable them to create an index using outlines (Heading styles like for TOC).

Second of all, there is a property called SortAlgorithm which holds a string describing the sorting algorithm in these indexes. Where can I find a list of the available parameters for this property? Can not find it anywhere in the API reference! :(
OpenOffice 3.1 on Windows Vista
(Libreoffice 4.0.0 on Windows 7)
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Using Bibliography (Index)

Post by hanya »

There is not difference to insert these contents index from inserting the TOC. The services of them inherits css.text.BaseIndex service, so you can find the list of services inherits it: http://www.openoffice.org/api/docs/comm ... -xref.html
Instantiate one of them through service manager of the document and insert the instance to your document with css.text.XText interface.
SNM90 wrote:Second of all, there is a property called SortAlgorithm which holds a string describing the sorting algorithm in these indexes. Where can I find a list of the available parameters for this property? Can not find it anywhere in the API reference!
The office uses collators defined in css.i18n module for each language to sort elements and they knows algorithms that they provide.

Code: Select all

Sub GetCollatorAlgorithms
  aLocale = CreateUnoStruct("com.sun.star.lang.Locale")
  aLocale.Language = "en"
  aLocale.Country = "US"
  
  collator = CreateUnoService("com.sun.star.i18n.Collator")
  names = collator.listCollatorAlgorithms(aLocale)
  s = "Algorithms: " & chr(10)
  for i = 0 To ubound(names) step 1
    s = s & names(i) & chr(10)
  next
  msgbox s
End Sub
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
SNM90
Posts: 21
Joined: Fri Mar 01, 2013 6:56 am

Re: Using Bibliography (Index)

Post by SNM90 »

Thank you for your reply...

The thing is, I have already tried what you said. It still doesn't work with the assigning headings (tried a lot of them). I think the problem is that a method similar to 'createFromOutlines()' of css:text::ContentIndex is missing from the rest of the services like css::text::DocumentIndex or css::text::Bibliography or others which inherit from service BaseIndex. So, the headings don't come through that way.

I will try your solution for my second problem.
EDIT: I tried your solution to my second problem, and it worked. Thanks for that! :) Can you please look into the first one again though?
OpenOffice 3.1 on Windows Vista
(Libreoffice 4.0.0 on Windows 7)
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Using Bibliography (Index)

Post by hanya »

It still doesn't work with the assigning headings
Wonder that function is provided by these indexes? Can you use such function through the UI?
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
SNM90
Posts: 21
Joined: Fri Mar 01, 2013 6:56 am

Re: Using Bibliography (Index)

Post by SNM90 »

Hmm... I guess you can't. I reckon one can only build these indexes through entries. The problem is that the index marks are not given the capability to hyperlink to their position in text by the API. :( Anyway, I'll see what I can do.

Also, is there any way to insert text INSIDE the index mark? If so, how? I see that through the UI it is possible.
OpenOffice 3.1 on Windows Vista
(Libreoffice 4.0.0 on Windows 7)
Post Reply