I'm working on that macro: Set and retrieve last cursor position (with a bookmark).
The issue is when a picture is selected.
I've slightly changed the code and switched to a ViewCursor (oVC) and get the position with collapseToEnd. As a dirty workaround, if the selection is a picture, then I just leave it as it is (meaning: I don't insert the bookmark where the pic is):
Code: Select all
if oDoc.CurrentController.Selection.supportsService("com.sun.star.text.TextGraphicObject") then exit sub
insPos =oVC.collapseToEnd
My question is: if the current selection is a picture, how can I deselect it so that I fall back on the text view cursor?
I've done some extensive search and not found relevant code. I admit I'm a poor coder and merely adapt what I find, thus, there may be some trivial trick or command in the API that I don't know.