We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

Writer: scroll entire pages in a readonly document with API (C++) [closed]

asked 2015-07-02 14:19:36 +0200

urbanhusky gravatar image

updated 2020-10-12 16:26:57 +0200

Alex Kemp gravatar image

How can I scroll entire pages, regardless of current zoom setting, in writer via C++?

The document is readonly, so XPageCursor->jumpToPreviousPage() does seem to do nothing. This also only would set the cursor, if I scroll in smaller increments then this would not move the cursor.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2020-08-22 21:00:11.105433


Toggling readonly before and after moving the cursor with .uno:EditDoc works in theory, but causes flickering. Cursor position is also not updated when doing .uno:GoUp or .uno:GoDown in readonly.

urbanhusky gravatar imageurbanhusky ( 2015-07-10 10:08:38 +0200 )edit

3 Answers

Sort by » oldest newest most voted

answered 2015-07-02 14:48:28 +0200

vmiklos gravatar image

updated 2015-07-02 14:50:10 +0200

You can use the command dispatch framework, then .uno:PageUp can jump pages up/down, exactly as if you would hit the page up / page down keys. Hopefully that does what you need.

(You can use the macro recorder to find out exact uno command names / parameters, then the generated basic code can be re-written in C++, since it uses the same UNO API.)

edit flag offensive delete link more


Unfortunately, .uno:PageUp only scrolls roughly in screen sizes, not page sizes. This is more apparent at higher or low zoom levels

urbanhusky gravatar imageurbanhusky ( 2015-07-02 14:53:25 +0200 )edit

answered 2015-07-04 19:52:03 +0200

pierre-yves samyn gravatar image


You can also try .uno:GoToStartOfPrevPage but I think the read only opening mode also blocks the functionning.

Sub PysJumpNext

Dim oCurseurVisible as object

oCurseurVisible = ThisComponent.CurrentController.ViewCursor

End Sub    

sub PysJumpPrevious

dim document   as object
dim dispatcher as object

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:GoToStartOfPrevPage", "", 0, Array())

end sub


edit flag offensive delete link more


Sadly doesn't work in readonly mode. Also shows the next page in the middle of the screen instead of on top (but tbh that was not something I actually asked for)

urbanhusky gravatar imageurbanhusky ( 2015-07-10 09:04:00 +0200 )edit

answered 2015-08-05 15:59:52 +0200

urbanhusky gravatar image

Since 4.4 the commands seem to be uno:ScrollToPrevious and .uno:ScrollToNext - this works almost perfectly (it is at least as buggy as when using the navigator).

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-07-02 14:19:36 +0200

Seen: 262 times

Last updated: Jul 04 '15