Files
loongoffice/offapi/com/sun/star/text
Miklos Vajna 8e7dc248f2 sw: add UNO API to find the closest doc model position based on pixel position
The use-case is drag&drop: if an UNO API client registers its drag&drop
listener, then it gets a DropTargetDropEvent and has to decide if it
wants to handle that event or allow Writer to handle it. In case it
decides to handle the event, it would be good to able to e.g. insert a
string at the point where the Writer UI indicates it to the user. But
DropTargetDropEvent only exposes a pixel position and Writer requires
you to have an XTextRange when inserting content.

Fix the problem by introducing a new createTextRangeByPixelPosition()
which first does a pixel -> logic coordinate conversion (this is
window-specific, in case you have multiple windows), then picks the doc
model position which is the closest to a logic coordinate.

Change-Id: I6a8e69e3c39b9d99209342469653c0e0bd99bf53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112201
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2021-03-09 20:12:24 +01:00
..