diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-17 14:14:26 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-23 09:19:00 +0100 |
commit | 82bc3505a05ce087ebfbd932e039ee5f14c777d5 (patch) | |
tree | 5facfb4eb4f0994fcc07f95562c0307477798141 /editeng/source/editeng/editview.cxx | |
parent | c4f3d69dcf98e223cdc95abf8419f7ab96812387 (diff) |
editeng tiled rendering: implement drag of start/end selection handle
With this, it's possible to drag the handle of not only the normal
cursor, but also the start/end handle of a range selection in editeng
text, e.g. Writer shape text.
Change-Id: I5b9f548fb6365ecb499c68cef0d89f7f8ff3a11d
Diffstat (limited to 'editeng/source/editeng/editview.cxx')
-rw-r--r-- | editeng/source/editeng/editview.cxx | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index db3b6cf643ff..e9ec245c51ea 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1320,9 +1320,29 @@ Selection EditView::GetSurroundingTextSelection() const } } -void EditView::SetCursorLogicPosition(const Point& rPosition, bool /*bPoint*/, bool /*bClearMark*/) +void EditView::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark) { - pImpEditView->SetCursorAtPoint(rPosition); + Point aDocPos(pImpEditView->GetDocPos(rPosition)); + EditPaM aPaM = pImpEditView->pEditEngine->GetPaM(aDocPos); + EditSelection aSelection(pImpEditView->GetEditSelection()); + + // Explicitly create or delete the selection. + if (bClearMark) + pImpEditView->DeselectAll(); + else + pImpEditView->CreateAnchor(); + + if (bPoint) + aSelection.Max() = aPaM; + else + aSelection.Min() = aPaM; + + if (pImpEditView->GetEditSelection().Min() != aSelection.Min()) + pImpEditView->pEditEngine->CursorMoved(pImpEditView->GetEditSelection().Min().GetNode()); + pImpEditView->DrawSelection(aSelection); + if (pImpEditView->GetEditSelection() != aSelection) + pImpEditView->SetEditSelection(aSelection); + ShowCursor(/*bGotoCursor=*/false, /*bForceCursor=*/true); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |