Ask Your Question
0

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

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

urbanhusky gravatar image

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

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

Comments

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 +0100 )edit

3 Answers

Sort by » oldest newest most voted
1

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

vmiklos gravatar image

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

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

Comments

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 +0100 )edit
0

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

pierre-yves samyn gravatar image

Hi

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
oCurseurVisible.jumpToNextPage

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

Regards

edit flag offensive delete link more

Comments

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 +0100 )edit
0

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

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

Stats

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

Seen: 239 times

Last updated: Jul 04 '15