summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2013-10-24 17:21:31 +0300
committerTor Lillqvist <tml@collabora.com>2013-10-24 17:22:11 +0300
commit8e1bafcc37742073edacf53508057034a0e534ca (patch)
treede42103e456357a4439fbf6f7bee03d3880a810a /sw
parenta2c9eaee63cd71c78cf57c590583e9e9d80edece (diff)
Don't allow selection handle movement to wrap
Change-Id: Idc189a84da1aa0ac510e003134580eafc03b4b9a
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/docvw/edtwin.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 3a71de77941f..ffbd5f63aefa 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -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 );
{