diff options
author | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2011-08-26 17:11:10 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2011-08-26 17:13:53 +0200 |
commit | a6176612ff1a6a142a68964b2c0834d28125fc45 (patch) | |
tree | d7e124ffb85c8dae372af10cb387e59fe1eb9a68 /sw/source/ui/docvw | |
parent | 89aaee9adad9d0ceac5a6a422b415152abe74e8c (diff) |
Header/Footer: Change the edition mode entering
Single click on header / footer changes the edit mode. But double click
is still needed to enter header / footer mode on objects flying on the
main body to avoid mistakenly selecting them.
Diffstat (limited to 'sw/source/ui/docvw')
-rw-r--r-- | sw/source/ui/docvw/edtwin.cxx | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 1f4a398b7f1f..9be716fa83ba 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -179,6 +179,37 @@ SfxShell* lcl_GetShellFromDispatcher( SwView& rView, TypeId nType ); DBG_NAME(edithdl) +namespace +{ + bool lcl_CheckHeaderFooterClick( SwWrtShell& rSh, const Point aDocPos, sal_uInt16 nClicks ) + { + bool bRet = false; + + sal_Bool bOverHdrFtr = rSh.IsOverHeaderFooterPos( aDocPos ); + if ( ( rSh.IsHeaderFooterEdit( ) && !bOverHdrFtr ) || + ( !rSh.IsHeaderFooterEdit() && bOverHdrFtr ) ) + { + bRet = true; + // Check if there we are in a FlyFrm + Point aPt( aDocPos ); + SwPaM aPam( *rSh.GetCurrentShellCursor().GetPoint() ); + rSh.GetLayout()->GetCrsrOfst( aPam.GetPoint(), aPt ); + + const SwStartNode* pStartFly = aPam.GetPoint()->nNode.GetNode().FindFlyStartNode(); + int nNbClicks = 1; + if ( pStartFly && !rSh.IsHeaderFooterEdit() ) + nNbClicks = 2; + + if ( nClicks == nNbClicks ) + { + rSh.SwCrsrShell::SetCrsr( aDocPos ); + bRet = false; + } + } + return bRet; + } +} + class SwAnchorMarker { SdrHdl* pHdl; @@ -2602,15 +2633,8 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) ); - sal_Bool bOverHdrFtr = rSh.IsOverHeaderFooterPos( aDocPos ); - if ( ( rSh.IsHeaderFooterEdit( ) && !bOverHdrFtr ) || - ( !rSh.IsHeaderFooterEdit() && bOverHdrFtr ) ) - { - if ( rMEvt.GetButtons() == MOUSE_LEFT && rMEvt.GetClicks( ) == 2 ) - rSh.SwCrsrShell::SetCrsr( aDocPos ); - + if ( lcl_CheckHeaderFooterClick( rSh, aDocPos, rMEvt.GetClicks() ) ) return; - } if ( IsChainMode() ) { @@ -4673,6 +4697,11 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) if (rView.GetPostItMgr()->IsHit(rCEvt.GetMousePosPixel())) return; + if ( lcl_CheckHeaderFooterClick( rSh, + PixelToLogic( rCEvt.GetMousePosPixel() ), 1 ) ) + return; + + if((!pChildWin || pChildWin->GetView() != &rView) && !rSh.IsDrawCreate() && !IsDrawAction()) { |