summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/viewsh.hxx3
-rw-r--r--sw/source/core/inc/pagefrm.hxx2
-rw-r--r--sw/source/core/layout/pagechg.cxx27
-rwxr-xr-xsw/source/core/layout/paintfrm.cxx4
-rw-r--r--sw/source/core/view/viewsh.cxx1
-rw-r--r--sw/source/core/view/vnew.cxx1
-rw-r--r--sw/source/ui/docvw/edtwin.cxx40
-rw-r--r--sw/source/ui/inc/edtwin.hxx8
8 files changed, 81 insertions, 5 deletions
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 3f95de7ac0d5..3cb4748bc96c 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -156,6 +156,7 @@ class SW_DLLPUBLIC ViewShell : public Ring
sal_Bool bEnableSmooth :1; // Disable SmoothScroll, e.g. for drag
// of scrollbars.
sal_Bool bEndActionByVirDev:1; // Paints from EndAction always via virtual device
+ sal_Bool bShowHeaderFooterSeparator;
sal_Bool bHeaderFooterEdit;
// (e.g. when browsing).
@@ -566,6 +567,8 @@ public:
virtual void ToggleHeaderFooterEdit( );
sal_Bool IsHeaderFooterEdit( ) const { return bHeaderFooterEdit; }
+ sal_Bool IsShowHeaderFooterSeparator( ) { return bShowHeaderFooterSeparator; }
+ void SetShowHeaderFooterSeparator( sal_Bool bShow ) { bShowHeaderFooterSeparator = bShow; }
};
//---- class CurrShell manages global ShellPointer -------------------
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index d45d4beeb518..e2e7ef5a6e45 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -374,6 +374,8 @@ public:
// in case this is am empty page, this function returns the 'reference' page
const SwPageFrm& GetFormatPage() const;
+ bool IsOverHeaderFooterArea( const Point& rPt ) const;
+
// return font used to paint the "empty page" string
static const Font& GetEmptyPageFont();
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 263facb9c8c2..e028d277a2b6 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -2451,4 +2451,31 @@ const SwPageFrm& SwPageFrm::GetFormatPage() const
return *pRet;
}
+bool SwPageFrm::IsOverHeaderFooterArea( const Point& rPt ) const
+{
+ long nUpperLimit = 0;
+ long nLowerLimit = 0;
+ const SwFrm* pFrm = Lower();
+ while ( pFrm )
+ {
+ if ( pFrm->IsBodyFrm() )
+ {
+ nUpperLimit = pFrm->Frm().Top();
+ nLowerLimit = pFrm->Frm().Bottom();
+ }
+ else if ( pFrm->IsFtnContFrm() )
+ nLowerLimit = pFrm->Frm().Bottom();
+
+ pFrm = pFrm->GetNext();
+ }
+
+ SwRect aHeaderArea( Frm().TopLeft(),
+ Size( Frm().Width(), nUpperLimit - Frm().Top() ) );
+
+ SwRect aFooterArea( Point( Frm().Left(), nLowerLimit ),
+ Size( Frm().Width(), Frm().Bottom() - nLowerLimit ) );
+
+ return aHeaderArea.IsInside( rPt ) || aFooterArea.IsInside( rPt );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index e868cba5ddf9..f384bcca827b 100755
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3333,7 +3333,7 @@ void SwPageFrm::PaintBreak( ) const
// header/footer marker
// * Non-printing characters are shown, as this is more consistent
// with other formatting marks
- if ( !pGlobalShell->IsHeaderFooterEdit() &&
+ if ( !pGlobalShell->IsShowHeaderFooterSeparator() &&
pGlobalShell->GetViewOptions()->IsShowHiddenChar( ) )
{
SwRect aRect( pCnt->Prt() );
@@ -3404,7 +3404,7 @@ void SwPageFrm::PaintDecorators( ) const
if ( !pGlobalShell->GetViewOptions()->IsPrinting() &&
!pGlobalShell->GetViewOptions()->IsPDFExport() &&
!pGlobalShell->IsPreView() &&
- pGlobalShell->IsHeaderFooterEdit( ) )
+ pGlobalShell->IsShowHeaderFooterSeparator( ) )
{
drawinglayer::processor2d::BaseProcessor2D* pProcessor = CreateProcessor2D();
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 912a327e6d06..c831abbfeaee 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -98,6 +98,7 @@ using namespace ::com::sun::star;
void ViewShell::ToggleHeaderFooterEdit( ) {
bHeaderFooterEdit = !bHeaderFooterEdit;
+ SetShowHeaderFooterSeparator( bHeaderFooterEdit );
// Repaint everything to update the colors of the selected area
Paint( VisArea().SVRect() );
}
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 3bc3012ca4b5..5b4708e7125c 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -153,6 +153,7 @@ ViewShell::ViewShell( SwDoc& rDocument, Window *pWindow,
mpTmpRef( 0 ),
pOpt( 0 ),
pAccOptions( new SwAccessibilityOptions ),
+ bShowHeaderFooterSeparator( sal_False ),
bHeaderFooterEdit( sal_False ),
mpTargetPaintWindow(0),
mpBufferedOut(0),
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 034b0631ec5b..e7aa37db3dab 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -3410,6 +3410,10 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
{
MouseEvent rMEvt(_rMEvt);
+ // Mouse went out of the edit window: don't show the header/footer marker
+ if ( rMEvt.IsLeaveWindow() )
+ aOverHeaderFooterTimer.Stop();
+
//ignore key modifiers for format paintbrush
{
sal_Bool bExecFormatPaintbrush = pApplyTempl && pApplyTempl->pFormatClipboard
@@ -3775,10 +3779,10 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
case 0:
{
if ( pApplyTempl )
- {
+ {
UpdatePointer(aDocPt, 0); // maybe a frame has to be marked here
- break;
- }
+ break;
+ }
// change ui if mouse is over SwPostItField
// TODO: do the same thing for redlines SW_REDLINE
SwRect aFldRect;
@@ -3796,6 +3800,21 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
else
rView.GetPostItMgr()->SetShadowState(0,false);
// no break;
+
+ // Are we over a header or footer area?
+ const SwPageFrm* pPageFrm = rSh.GetLayout()->GetPageAtPos( aDocPt );
+ if ( pPageFrm )
+ {
+ bool bOverHeadFoot = pPageFrm->IsOverHeaderFooterArea( aDocPt );
+ if ( bOverHeadFoot )
+ aOverHeaderFooterTimer.Start();
+ else
+ {
+ aOverHeaderFooterTimer.Stop();
+ if ( !rSh.IsHeaderFooterEdit() && rSh.IsShowHeaderFooterSeparator() )
+ aOverHeaderFooterTimer.Start();
+ }
+ }
}
case KEY_SHIFT:
case KEY_MOD2:
@@ -4555,6 +4574,9 @@ SwEditWin::SwEditWin(Window *pParent, SwView &rMyView):
aKeyInputFlushTimer.SetTimeout( 200 );
aKeyInputFlushTimer.SetTimeoutHdl(LINK(this, SwEditWin, KeyInputFlushHandler));
+ aOverHeaderFooterTimer.SetTimeout( 2000 );
+ aOverHeaderFooterTimer.SetTimeoutHdl(LINK(this, SwEditWin, OverHeaderFooterHandler));
+
// TemplatePointer for colors should be resetted without
// selection after single click
aTemplateTimer.SetTimeout(400);
@@ -5376,6 +5398,18 @@ IMPL_LINK( SwEditWin, KeyInputTimerHandler, Timer *, EMPTYARG )
return 0;
}
+IMPL_LINK( SwEditWin, OverHeaderFooterHandler, Timer *, EMPTYARG )
+{
+ if ( !GetView().GetWrtShell().IsHeaderFooterEdit() )
+ {
+ // Toggle the Header/Footer separator
+ sal_Bool bShown = GetView().GetWrtShell().IsShowHeaderFooterSeparator( );
+ GetView().GetWrtShell().SetShowHeaderFooterSeparator( !bShown );
+ Invalidate();
+ }
+ return 0;
+}
+
void SwEditWin::_InitStaticData()
{
pQuickHlpData = new QuickHelpData();
diff --git a/sw/source/ui/inc/edtwin.hxx b/sw/source/ui/inc/edtwin.hxx
index 6468f5122a79..f85b2f11b2bc 100644
--- a/sw/source/ui/inc/edtwin.hxx
+++ b/sw/source/ui/inc/edtwin.hxx
@@ -102,6 +102,11 @@ friend void PageNumNotify( ViewShell* pVwSh,
Timer aKeyInputTimer;
// timer for ANY-KeyInut question without a following KeyInputEvent
Timer aKeyInputFlushTimer;
+ /*
+ * timer for showing the Header/Footer separators when the mouse
+ * stays over a header or footer area for several seconds.
+ */
+ Timer aOverHeaderFooterTimer;
String aInBuffer;
LanguageType eBufferLanguage;
@@ -196,6 +201,9 @@ friend void PageNumNotify( ViewShell* pVwSh,
// timer for overlapping KeyInputs (e.g. for tables)
DECL_LINK( KeyInputTimerHandler, Timer * );
+ // timer for hovering header/footer areas
+ DECL_LINK( OverHeaderFooterHandler, Timer * );
+
// timer for ApplyTemplates via mouse (in disguise Drag&Drop)
DECL_LINK( TemplateTimerHdl, Timer* );