Is the view-cursor in the table of contents?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Is the view-cursor in the table of contents?

Jörg Schmidt-2
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Is the view-cursor in the table of contents?

Bernard Marcelly
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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

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

Reply | Threaded
Open this post in threaded view
|

Re: Is the view-cursor in the table of contents?

Jörg Schmidt-2
> From: Bernard Marcelly [mailto:[hidden email]]
> Sent: Tuesday, July 28, 2015 6:59 PM
> To: [hidden email]
> Subject: Re: Is the view-cursor in the table of contents?
>
> 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.

Thank you, works just fine.


Greetings,
Jörg


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