API,

I hope you don't mind the duplication.  The question below seems to have
stumped the forum and I'm about to conclude that there's no good way to do
this.

Keith


by kwalcock ยป Thu Aug 20, 2015 2:43 am

For a watermarking application I need to figure out what portion of a
Writer document the user can see so that I can watermark other portions
without disturbing the user. I can even assume a simple document with no
frames or tables, etc.

So far the closest I have found is to use an XTextViewCursor, do a
screenUp(), and then take the range from there to the beginning of the
document. Likewise, I can do a screenDown() and then take the range to the
end of the document. The part in between, approximately, is to be avoided.

Unfortunately, with the XTextViewCursor, the results of screenUp() and
screenDown() are actually visible, which won't be good for the user trying
to type. I can use lockControllers() to prevent some screen updates, but
the page margins and the window background still show the flicker of the
text scrolling up and down.

Does anyone else know of a better way to get the range(s) of text showing
on the screen or of a way to prevent the flicker? Are there other
controllers than need to be locked?

The current code is something like

ThisComponent.lockControllers()
viewCursor = ThisComponent.getCurrentController().getViewCursor()
viewCursor.screenDown()
MsgBox("Check for flicker in case it doesn't show")
viewCursor.screenUp()
ThisComponent.unlockControllers()

Thanks

Reply via email to