Header/Footer: fixed click on frames over the header/footer area.

The main problem here was due to the click to show the separator when
there is no header or footer under the frame. That code was just exiting
MouseButtonDown too early, which isn't good.

Moved the seperators showing code out of the SwCrsrShell as it has no
clue about the document-position and may lead to problems.

Change-Id: Ia62333b52c5d0659bbe7ec4fcfe6e664db132435
This commit is contained in:
Cédric Bosdonnat
2012-11-21 16:07:34 +01:00
parent e1b59fc0c4
commit 289185fd02
3 changed files with 45 additions and 35 deletions

View File

@@ -675,22 +675,6 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, sal_Bool bOnlyText, bool bBlock )
// same table column and not in header/footer -> back
return bRet;
// toggle the header/footer mode if needed
bool bInHeaderFooter = pFrm && ( pFrm->IsHeaderFrm() || pFrm->IsFooterFrm() );
if ( bInHeaderFooter != IsHeaderFooterEdit() )
ToggleHeaderFooterEdit();
else
{
// Make sure we have the proper Header/Footer separators shown
// as these may be changed if clicking on an empty Header/Footer
SetShowHeaderFooterSeparator( Header, pFrm != NULL && pFrm->IsHeaderFrm( ) );
SetShowHeaderFooterSeparator( Footer, pFrm != NULL && pFrm->IsFooterFrm( ) );
// Repaint everything
GetWin()->Invalidate();
}
if( pBlockCrsr && bBlock )
{
pBlockCrsr->setEndPoint( rLPt );
@@ -1314,24 +1298,6 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, sal_Bool bIdleEnd )
return; // if not then no update
}
sal_Bool bInHeader= sal_True;
if ( IsInHeaderFooter( &bInHeader ) )
{
if ( !bInHeader )
{
SetShowHeaderFooterSeparator( Footer, true );
SetShowHeaderFooterSeparator( Header, false );
}
else
{
SetShowHeaderFooterSeparator( Header, true );
SetShowHeaderFooterSeparator( Footer, false );
}
}
if ( IsInHeaderFooter() != IsHeaderFooterEdit() )
ToggleHeaderFooterEdit();
// #i27301#
SwNotifyAccAboutInvalidTextSelections aInvalidateTextSelections( *this );

View File

@@ -2848,8 +2848,33 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
// Repaint everything
Invalidate();
}
else
{
// Make sure we have the proper Header/Footer separators shown
// as these may be changed if clicking on an empty Header/Footer
rSh.SetShowHeaderFooterSeparator( Header, eControl == Header );
rSh.SetShowHeaderFooterSeparator( Footer, eControl == Footer );
return;
if ( !rSh.IsHeaderFooterEdit() )
rSh.ToggleHeaderFooterEdit();
// Repaint everything
rSh.GetWin()->Invalidate();
}
}
else
{
if ( rSh.IsHeaderFooterEdit( ) )
rSh.ToggleHeaderFooterEdit( );
else
{
// Make sure that the separators are hidden
rSh.SetShowHeaderFooterSeparator( Header, false );
rSh.SetShowHeaderFooterSeparator( Footer, false );
// Repaint everything
rSh.GetWin()->Invalidate();
}
}

View File

@@ -360,6 +360,25 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq)
rReq.SetReturnValue(SfxBoolItem( nSlot, bRet ));
rReq.Done();
sal_Bool bInHeader = sal_True;
if ( rSh.IsInHeaderFooter( &bInHeader ) )
{
if ( !bInHeader )
{
rSh.SetShowHeaderFooterSeparator( Footer, true );
rSh.SetShowHeaderFooterSeparator( Header, false );
}
else
{
rSh.SetShowHeaderFooterSeparator( Header, true );
rSh.SetShowHeaderFooterSeparator( Footer, false );
}
// Force repaint
rSh.GetWin()->Invalidate();
}
if ( rSh.IsInHeaderFooter() != rSh.IsHeaderFooterEdit() )
rSh.ToggleHeaderFooterEdit();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */