Kaydet (Commit) 8e1bafcc authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Don't allow selection handle movement to wrap

Change-Id: Idc189a84da1aa0ac510e003134580eafc03b4b9a
üst a2c9eaee
......@@ -2671,6 +2671,11 @@ static bool lcl_urlOverBackground(SwWrtShell& rSh, const Point& rDocPos)
#if !HAVE_FEATURE_DESKTOP
// As such these two functions could be more or less anywhere, I have
// them now in this source file because the act of moving a selection
// end point is somewhat the same as what happens when one
// shift-clicks on either side of an existing selection.
void touch_lo_selection_start_move_impl(const void *documentHandle,
int x,
int y)
......@@ -2686,6 +2691,17 @@ void touch_lo_selection_start_move_impl(const void *documentHandle,
const Point aDocPos( pOut->PixelToLogic( Point(x, y) ) );
// Don't allow moving the start of the selection beyond the end
// (point) of the selection.
SwRect startCharRect;
pWrtShell->GetCharRectAt(startCharRect, pWrtShell->GetCrsr()->GetPoint());
const Point startCharPos = startCharRect.Center();
if (startCharPos.Y() < aDocPos.Y() ||
(startCharPos.Y() == aDocPos.Y() && startCharPos.X() - startCharRect.Width() <= aDocPos.X()))
return;
pWrtShell->ChgCurrPam( aDocPos );
// Keep mark normally at the start and point at the end,
......@@ -2713,6 +2729,17 @@ void touch_lo_selection_end_move_impl(const void *documentHandle,
const Point aDocPos( pOut->PixelToLogic( Point(x, y) ) );
// Don't allow moving the end of the selection beyond the start
// (mark) of the selection.
SwRect endCharRect;
pWrtShell->GetCharRectAt(endCharRect, pWrtShell->GetCrsr()->GetMark());
const Point endCharPos = endCharRect.Center();
if (endCharPos.Y() > aDocPos.Y() ||
(endCharPos.Y() == aDocPos.Y() && endCharPos.X() + endCharRect.Width() >= aDocPos.X()))
return;
pWrtShell->ChgCurrPam( aDocPos );
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment