Hi Jörg,

Dim v_cur As Object, dix As Object

v_cur = ThisComponent.CurrentController.ViewCursor
dix = nothing
On Error Resume Next
dix = v_cur.DocumentIndex
On Error GoTo 0
if IsNull(dix)  then
  MsgBox("Not in an index")
else
  MsgBox("Index, service : " & dix.ServiceName)
end if

The error handling is necessary because outside of an index, property DocumentIndex does not exist.

Reminder: a Table of Contents is a particular type of document index.


Regards
  Bernard


Jörg Schmidt a écrit le 2015-07-28 08:56 :
Hello,

in a text document is my view-cursor:

v_cur = ThisComponent.CurrentController.ViewCursor


How can I reliably(!) test whether this view-cursor currently located in the 
table of contents?


note:
Ok, I can, for example, check:

Msgbox v_cur.Textsection.LinkDisplayName

but I think this is not reliable because ".LinkDisplayName" is just a name that 
can be changed.



Greetings,
Jörg



---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org

Reply via email to