openoffice-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Alcock <>
Subject How to get XTextRange showing on the screen
Date Fri, 21 Aug 2015 21:02:33 GMT

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


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

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


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message