[Libreoffice-commits] .: 3 commits - sw/inc sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Fri Sep 16 08:07:48 PDT 2011


 sw/inc/viewsh.hxx                  |    2 +-
 sw/source/core/layout/paintfrm.cxx |    8 --------
 sw/source/ui/docvw/edtwin.cxx      |   29 +++++++++++++++++++++++++++--
 sw/source/ui/inc/wrtsh.hxx         |    1 +
 sw/source/ui/wrtsh/wrtsh1.cxx      |    7 +++++++
 5 files changed, 36 insertions(+), 11 deletions(-)

New commits:
commit 403305d593f98ea3af26dd48b3f342044efe9454
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Fri Sep 16 17:03:35 2011 +0200

    Header/Footer: Don't hide & show the separator windows all the time
    
    This avoids permanent calls to the SwHeaderFooterWin::Paint method. The
    loop is now broken and the cursor doesn't blink anymore.

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 8c2cab8..241fb17 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -568,7 +568,7 @@ public:
     void ToggleHeaderFooterEdit( );
     sal_Bool IsHeaderFooterEdit( ) const { return bHeaderFooterEdit; }
     sal_Bool IsShowHeaderFooterSeparator( ) { return bShowHeaderFooterSeparator; }
-    void SetShowHeaderFooterSeparator( sal_Bool bShow ) { bShowHeaderFooterSeparator = bShow; }
+    virtual void SetShowHeaderFooterSeparator( sal_Bool bShow ) { bShowHeaderFooterSeparator = bShow; }
 };
 
 //---- class CurrShell manages global ShellPointer -------------------
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 9fa4aae..d923b55 100755
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2782,14 +2782,6 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
     else
         SwRootFrm::bInPaint = bResetRootPaint = sal_True;
 
-    SwWrtShell* pWrtSh = dynamic_cast< SwWrtShell* >( pSh );
-    if ( pWrtSh )
-    {
-        SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
-        rEditWin.HideHeaderFooterControls( );
-    }
-
-
     SwSavePaintStatics *pStatics = 0;
     if ( pGlobalShell )
         pStatics = new SwSavePaintStatics();
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 50f7f05..f2e2e89 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -5779,7 +5779,8 @@ void SwEditWin::SetHeaderFooterControl( const SwPageFrm* pPageFrm, bool bHeader,
     }
     pControl->SetOffset( aOffset );
 
-    pControl->Show( );
+    if ( !pControl->IsVisible() )
+        pControl->Show( );
 }
 
 void SwEditWin::RemoveHeaderFooterControls( const SwPageFrm* pPageFrm )
diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx
index 735848f..7d0bbfd 100644
--- a/sw/source/ui/inc/wrtsh.hxx
+++ b/sw/source/ui/inc/wrtsh.hxx
@@ -486,6 +486,7 @@ typedef sal_Bool (SwWrtShell:: *FNSimpleMove)();
     const SwRedline* GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect = sal_False);
 
     void ChangeHeaderOrFooter(const String& rStyleName, sal_Bool bHeader, sal_Bool bOn, sal_Bool bShowWarning);
+    virtual void SetShowHeaderFooterSeparator( sal_Bool bShow );
 
 private:
 
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index ec03fe4..ec54dc2 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -1890,4 +1890,11 @@ void SwWrtShell::ChangeHeaderOrFooter(
     EndAllAction();
 }
 
+void SwWrtShell::SetShowHeaderFooterSeparator( sal_Bool bShow )
+{
+    ViewShell::SetShowHeaderFooterSeparator( bShow );
+    if ( !bShow )
+        GetView().GetEditWin().HideHeaderFooterControls( );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 363591e7542232088606b8da6e55850b6c84c079
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Fri Sep 16 11:37:02 2011 +0200

    Header/Footer: mouse-over timer set down to 1s instead of 2s.

diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index f69d2a8..50f7f05 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -4603,7 +4603,7 @@ SwEditWin::SwEditWin(Window *pParent, SwView &rMyView):
     aKeyInputFlushTimer.SetTimeout( 200 );
     aKeyInputFlushTimer.SetTimeoutHdl(LINK(this, SwEditWin, KeyInputFlushHandler));
 
-    aOverHeaderFooterTimer.SetTimeout( 2000 );
+    aOverHeaderFooterTimer.SetTimeout( 1000 );
     aOverHeaderFooterTimer.SetTimeoutHdl(LINK(this, SwEditWin, OverHeaderFooterHandler));
 
     // TemplatePointer for colors should be resetted without
commit a9904f07de04dbfb2f81ac44ebb4caa88c16c6c1
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Fri Sep 16 10:03:22 2011 +0200

    Header/Footer: enable quickly hiding the separators
    
    After having triggered the separators using a mouse-over, hide the
    separator when clicking in the main body or typing.

diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 5ea839e..f69d2a8 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -1302,6 +1302,13 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
 {
     SwWrtShell &rSh = rView.GetWrtShell();
 
+    // Hide the header/footer separator if not editing a header of footer
+    if ( rSh.IsShowHeaderFooterSeparator( ) && !rSh.IsHeaderFooterEdit() )
+    {
+        rSh.SetShowHeaderFooterSeparator( sal_False );
+        aOverHeaderFooterTimer.Stop();
+    }
+
     if( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE &&
         pApplyTempl && pApplyTempl->pFormatClipboard )
     {
@@ -2619,6 +2626,23 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
 {
     SwWrtShell &rSh = rView.GetWrtShell();
 
+    // Hide the header/footer separator if not editing a header of footer
+    if ( rSh.IsShowHeaderFooterSeparator( ) && !rSh.IsHeaderFooterEdit() )
+    {
+        const Point aDocPt( PixelToLogic( _rMEvt.GetPosPixel() ) );
+        const SwPageFrm* pPageFrm = rSh.GetLayout()->GetPageAtPos( aDocPt );
+        if ( pPageFrm )
+        {
+            bool bOverHeadFoot = pPageFrm->IsOverHeaderFooterArea( aDocPt );
+
+            if ( !bOverHeadFoot )
+            {
+                rSh.SetShowHeaderFooterSeparator( sal_False );
+                aOverHeaderFooterTimer.Stop();
+            }
+        }
+    }
+
     // We have to check if a context menu is shown and we have an UI
     // active inplace client. In that case we have to ignore the mouse
     // button down event. Otherwise we would crash (context menu has been


More information about the Libreoffice-commits mailing list