diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-11-23 17:51:16 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-11-23 20:21:23 +0100 |
commit | e8fbe97900f13305b17015d9044993bde4adab36 (patch) | |
tree | da16e4486ce75a24b768b316ca4e7abb1f697245 /sw/source/ui/docvw/edtwin.cxx | |
parent | 7d43a3b02fee1c89cf706e7f917ae5d462974fe5 (diff) |
fdo#52182: Fixed click in frames located in header/footer
Using a distance to click to select the best object to select between
normal text and background object.
Change-Id: Ib5b53161c7af2c16f4df379382f2e53fc6d8092b
Diffstat (limited to 'sw/source/ui/docvw/edtwin.cxx')
-rw-r--r-- | sw/source/ui/docvw/edtwin.cxx | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index e28afb12b3e2..99c4fbffc5f8 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -2779,11 +2779,12 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) // How many clicks do we need to select a fly frame? FrameControlType eControl; bool bOverFly = false; - bool bOverHeaderFooterFly = IsOverHeaderFooterFly( aDocPos, eControl, bOverFly ); + bool bPageAnchored = false; + bool bOverHeaderFooterFly = IsOverHeaderFooterFly( aDocPos, eControl, bOverFly, bPageAnchored ); int nNbFlyClicks = 1; // !bOverHeaderFooterFly doesn't mean we have a frame to select - if ( ( rSh.IsHeaderFooterEdit( ) && !bOverHeaderFooterFly && bOverFly ) || - ( !rSh.IsHeaderFooterEdit( ) && bOverHeaderFooterFly ) ) + if ( !bPageAnchored && ( ( rSh.IsHeaderFooterEdit( ) && !bOverHeaderFooterFly && bOverFly ) || + ( !rSh.IsHeaderFooterEdit( ) && bOverHeaderFooterFly ) ) ) { nNbFlyClicks = 2; if ( _rMEvt.GetClicks( ) < nNbFlyClicks ) @@ -4964,9 +4965,10 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) // Don't trigger the command on a frame anchored to header/footer is not editing it FrameControlType eControl; bool bOverFly = false; - bool bOverHeaderFooterFly = IsOverHeaderFooterFly( aDocPos, eControl, bOverFly ); + bool bPageAnchored = false; + bool bOverHeaderFooterFly = IsOverHeaderFooterFly( aDocPos, eControl, bOverFly, bPageAnchored ); // !bOverHeaderFooterFly doesn't mean we have a frame to select - if ( rCEvt.IsMouseEvent( ) && + if ( !bPageAnchored && rCEvt.IsMouseEvent( ) && ( ( rSh.IsHeaderFooterEdit( ) && !bOverHeaderFooterFly && bOverFly ) || ( !rSh.IsHeaderFooterEdit( ) && bOverHeaderFooterFly ) ) ) { @@ -5950,13 +5952,13 @@ bool SwEditWin::IsInHeaderFooter( const Point &rDocPt, FrameControlType &rContro return false; } -bool SwEditWin::IsOverHeaderFooterFly( const Point& rDocPos, FrameControlType& rControl, bool& bOverFly ) const +bool SwEditWin::IsOverHeaderFooterFly( const Point& rDocPos, FrameControlType& rControl, bool& bOverFly, bool& bPageAnchored ) const { bool bRet = false; Point aPt( rDocPos ); SwWrtShell &rSh = rView.GetWrtShell(); SwPaM aPam( *rSh.GetCurrentShellCursor().GetPoint() ); - rSh.GetLayout()->GetCrsrOfst( aPam.GetPoint(), aPt ); + rSh.GetLayout()->GetCrsrOfst( aPam.GetPoint(), aPt, NULL, true ); const SwStartNode* pStartFly = aPam.GetPoint()->nNode.GetNode().FindFlyStartNode(); if ( pStartFly ) @@ -5977,6 +5979,8 @@ bool SwEditWin::IsOverHeaderFooterFly( const Point& rDocPos, FrameControlType& r else if ( bInFooter ) rControl = Footer; } + else + bPageAnchored = pFlyFmt->GetAnchor( ).GetAnchorId( ) == FLY_AT_PAGE; } } else |