diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-11-21 16:07:34 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-11-23 20:21:22 +0100 |
commit | 289185fd02d6d9734b6dbde01f15c4e6c5beacbb (patch) | |
tree | 56b8aafcfdd3ddf0ff431252a4a5559219cf3649 /sw | |
parent | e1b59fc0c4124457d4a1d29c6c4cc222ef665518 (diff) |
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
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 34 | ||||
-rw-r--r-- | sw/source/ui/docvw/edtwin.cxx | 27 | ||||
-rw-r--r-- | sw/source/ui/shells/txtcrsr.cxx | 19 |
3 files changed, 45 insertions, 35 deletions
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 0b78ab99c144..191d02a81807 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -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 ); diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 1565d13aff4e..ab08495c07e1 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -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(); } } diff --git a/sw/source/ui/shells/txtcrsr.cxx b/sw/source/ui/shells/txtcrsr.cxx index eb1683d9a391..d6837d4e731a 100644 --- a/sw/source/ui/shells/txtcrsr.cxx +++ b/sw/source/ui/shells/txtcrsr.cxx @@ -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: */ |