[dev] How to scroll view to make a certain location visible?

2005-12-29 Thread Matthias Benkmann
I'd like to scroll the view of a writer document so that a given
bookmark will be visible or at least that the page the bookmark is on
is visible. Can someone give me a clue how to achieve that?
The interface XPageCursor allows me to jump to a given page number,
but how do I get the page number of my bookmark? Or is there another
way to achieve my goal? All ideas and pointers to relevant interfaces
are appreciated.

Ciao

Matthias

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [dev] How to scroll view to make a certain location visible?

2005-12-29 Thread Oliver Brinzing
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Matthias,

Am 29.12.2005 09:56 schrieb Matthias Benkmann:
 I'd like to scroll the view of a writer document so that a given
 bookmark will be visible or at least that the page the bookmark is on

this should bei possible with the following code snippet:

OPTION EXPLICIT

Sub Main

Dim oDoc as Object
Dim oBook as Object
Dim oView as Object
Dim oCursor as Object
Dim sMark as String

oDoc = ThisComponent
sMark = MyBookmark

oView = oDoc.getCurrentController()

if oDoc.Bookmarks.hasByName(sMark) then
oBook = oDoc.Bookmarks.getByName(sMark)
' get the Textcursor ...
oCursor = 
oBook.Anchor.Text.createTextCursorByRange(oBook.Anchor)
' set view to current cursor position ...
oView.getViewCursor().gotoRange(oCursor, false)
end if

End Sub


regards

Oliver

- --

GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C AB40 CFD0 4A45
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFDs61+TiyrQM/QSkURAjsGAJwLyryK9hrXYsswHwHHqx6zqT6ppACgq/oL
D1325Fu7ZFM/C8+/ZyB9INQ=
=3UwK
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]