summaryrefslogtreecommitdiff
path: root/sw/source/ui/docvw/edtwin.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-09-11 11:02:22 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-09-11 11:10:49 +0200
commit3925a10d4784cf5966c5ee182dd64296b1cfba21 (patch)
treefa3d95ff3f7bfccf42f4c635d5fe26743599b23e /sw/source/ui/docvw/edtwin.cxx
parent3b333819a335a6c734eba26a7ff4ff87c3cffbd9 (diff)
n#778148 SwEditWin::MouseButtonDown: prefer url over hell frames on ctrl-click
This reverts commit 549da29af80c9d5b64b4c1bcec40b9c81f471a4f and fixes the problem without breaking text selection in front of background images. To reproduce, create a large XShape, put it to the background, set wrap style to 'through', then add some text, including a hyperlink. Click should select text, ctrl-click should select the hyperlink, or in case the text is normal, the shape. Change-Id: I6cd62af30b58555f8b58c7db4648444fceba83dc
Diffstat (limited to 'sw/source/ui/docvw/edtwin.cxx')
-rw-r--r--sw/source/ui/docvw/edtwin.cxx27
1 files changed, 20 insertions, 7 deletions
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 1188c61d2639..ad26ab30681b 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -492,12 +492,10 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
}
else
{
- // Background images don't count.
- SdrObject* pSelectableObj = rSh.GetObjAt(rLPt);
// dvo: IsObjSelectable() eventually calls SdrView::PickObj, so
// apparently this is used to determine whether this is a
// drawling layer object or not.
- if ( rSh.IsObjSelectable( rLPt ) && pSelectableObj->GetLayer() != rSh.GetDoc()->GetHellId())
+ if ( rSh.IsObjSelectable( rLPt ) )
{
if (pSdrView->IsTextEdit())
{
@@ -525,7 +523,10 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
(rSh.IsObjSelected() || rSh.IsFrmSelected()) &&
(!rSh.IsSelObjProtected(FLYPROTECT_POS));
- eStyle = bMovable ? POINTER_MOVE : POINTER_ARROW;
+ SdrObject* pSelectableObj = rSh.GetObjAt(rLPt);
+ // Don't update pointer if this is a background image only.
+ if (pSelectableObj->GetLayer() != rSh.GetDoc()->GetHellId())
+ eStyle = bMovable ? POINTER_MOVE : POINTER_ARROW;
aActHitType = SDRHIT_OBJECT;
}
}
@@ -2750,6 +2751,18 @@ void SwEditWin::RstMBDownFlags()
ReleaseMouse();
}
+/**
+ * Determines if the current position has a clickable url over a background
+ * frame. In that case, ctrl-click should select the url, not the frame.
+ */
+bool lcl_urlOverBackground(SwWrtShell& rSh, const Point& rDocPos)
+{
+ SwContentAtPos aSwContentAtPos(SwContentAtPos::SW_INETATTR);
+ SdrObject* pSelectableObj = rSh.GetObjAt(rDocPos);
+
+ return rSh.GetContentAtPos(rDocPos, aSwContentAtPos) && pSelectableObj->GetLayer() == rSh.GetDoc()->GetHellId();
+}
+
void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
{
SwWrtShell &rSh = rView.GetWrtShell();
@@ -3370,7 +3383,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
case KEY_MOD1:
if ( !bExecDrawTextLink )
{
- if ( !bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) )
+ if ( !bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) && !lcl_urlOverBackground( rSh, aDocPos ) )
{
rView.NoRotate();
rSh.HideCrsr();
@@ -3566,9 +3579,9 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
const int nSelType = rSh.GetSelectionType();
// Check in general, if an object is selectable at given position.
// Thus, also text fly frames in background become selectable via Ctrl-Click.
- if ( nSelType & nsSelectionType::SEL_OLE ||
+ if ( ( nSelType & nsSelectionType::SEL_OLE ||
nSelType & nsSelectionType::SEL_GRF ||
- rSh.IsObjSelectable( aDocPos ) )
+ rSh.IsObjSelectable( aDocPos ) ) && !lcl_urlOverBackground( rSh, aDocPos ) )
{
SwMvContext aMvContext( &rSh );
if( !rSh.IsFrmSelected() )