2009/3/2 Peter Eberlein <[email protected]>:
> Hi Morten,
> Morten Omholt Alver schrieb:
>>
>> 2009/2/26 Peter Eberlein <[email protected]>:
>
>>> I got a similar problem some time ago and solved it as follows (in Java):
>>> The XTextViewCursor jumps to all relevant XTextRanges. The found
>>> positions(X,Y) and the page number can you store in a new class, which
>>> implements the Comparable Interface. So, after adding all this new
>>> objects
>>> to an ArrayList you can sort them with Collections.sort(arrayList).
>>
>> Peter,
>>
>> thanks for this advice - it works great! I didn't know there was a way
>> to get absolute positions from a document, but I suspected thee had to
>> be.
>>
>> Only one problem remains - I think citations in footnotes should be
>> sorted based on the location of the footnote marker in the text,
>> rather than the footnote itself (if citation [2] is in a footnote
>> linked from the top of a page, citations further down on the page
>> should be numbered [3] and further, but with the current technique
>> they will be put before it because the footnote body is at the bottom
>> of the page). To solve this, I suppose I need to find which citations
>> are in footnotes, and then find the footnote reference in the text,
>> and finally take the location of that reference. I can probably figure
>> out how to do this, but I'd be happy to get any pointers!
>>
> You can can query for the XText of the XTextRange of your citation. If
> xText.supportsService("com.sun.star.text.FootNote") then you're in a footer.
> The field has a property "SourceName" which gives you the ReferenceMark name
> it is linked to.
> If the property "ReferenceFieldSource" is of type
> com.sun.star.text.ReferenceFieldSource.REFERENCE_MARK, then you can find the
> location with (simplified)
> document.getReferenceMarks().getByName(sourceName).

Peter,

thanks again! I managed to find out whether a citation was in a
footnote or not this way, but I have problems finding the "SourceName"
property. Which object's properties should I query? I tried looking at
the properties of the XFootnote object (which I acquired using
UnoRuntime.queryInterface() on the XText of the citation), but
couldn't find that one.


-- 
Morten

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to