Ask Your Question
0

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

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

urbanhusky gravatar image

updated 2015-07-02 14:47:20 +0200

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 close merge delete

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

3 Answers

Sort by » oldest newest most voted
1

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

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

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

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

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
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 165 times

Last updated: Jul 04 '15