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.
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 1f4a398..9be716f 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())
{