summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-02-15 11:06:33 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-02-15 15:07:34 +0100
commit5c89695f3885ec2e7cd00eaf56a46a7f00c44883 (patch)
treedd9e584c20959d567e74a2caa8077cbe722fef47 /editeng
parent760100d1dfe0df3e67227618013297e5f1f419aa (diff)
tdf#140414 add getting mouse pos to EditViewCallbacks
Change-Id: I09172e0cb24f5c45d2837cf2f2fc7cc4baa456a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110932 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editview.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 1a3f17e61d34..4849b81b6898 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1322,11 +1322,13 @@ const SvxFieldItem* EditView::GetField( const Point& rPos, sal_Int32* pPara, sal
const SvxFieldItem* EditView::GetFieldUnderMousePointer( sal_Int32& nPara, sal_Int32& nPos ) const
{
- auto pWin = pImpEditView->GetWindow();
- if (!pWin)
- return nullptr;
- Point aPos = pWin->GetPointerPosPixel();
- aPos = pImpEditView->GetWindow()->PixelToLogic( aPos );
+ Point aPos;
+ if (EditViewCallbacks* pEditViewCallbacks = pImpEditView->getEditViewCallbacks())
+ aPos = pEditViewCallbacks->EditViewPointerPosPixel();
+ else
+ aPos = pImpEditView->GetWindow()->GetPointerPosPixel();
+ OutputDevice& rDevice = pImpEditView->GetOutputDevice();
+ aPos = rDevice.PixelToLogic(aPos);
return GetField( aPos, &nPara, &nPos );
}