[Libreoffice-commits] core.git: include/sfx2 include/svx svx/source

Rodolfo Ribeiro Gomes libo at rodolfo.eng.br
Mon Feb 9 06:58:46 PST 2015


 include/sfx2/stbitem.hxx               |    2 +-
 include/svx/zoomsliderctrl.hxx         |    1 +
 svx/source/stbctrls/zoomsliderctrl.cxx |   15 +++++++++++++--
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 53740bd71a0ae569da36b9293ef22842a0b53f1e
Author: Rodolfo Ribeiro Gomes <libo at rodolfo.eng.br>
Date:   Sat Jan 31 19:08:05 2015 -0200

    tdf#47577  Zoom slider should only react to full click
    
    Change-Id: If859754c956a634a96066ac407b70d6dd2759d53
    Signed-off-by: Rodolfo Ribeiro Gomes <libo at rodolfo.eng.br>
    Reviewed-on: https://gerrit.libreoffice.org/14265
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/include/sfx2/stbitem.hxx b/include/sfx2/stbitem.hxx
index 07121f8..f5e146c 100644
--- a/include/sfx2/stbitem.hxx
+++ b/include/sfx2/stbitem.hxx
@@ -102,7 +102,7 @@ protected:
     virtual void    Command( const CommandEvent& rCEvt );
     virtual bool    MouseButtonDown( const MouseEvent & );
     virtual bool    MouseMove( const MouseEvent & );
-    bool            MouseButtonUp( const MouseEvent & );
+    virtual bool    MouseButtonUp( const MouseEvent & );
     virtual void    Paint( const UserDrawEvent &rUDEvt );
 
     static sal_uInt16   convertAwtToVCLMouseButtons( sal_Int16 nAwtMouseButtons );
diff --git a/include/svx/zoomsliderctrl.hxx b/include/svx/zoomsliderctrl.hxx
index 7af69db..f35f825 100644
--- a/include/svx/zoomsliderctrl.hxx
+++ b/include/svx/zoomsliderctrl.hxx
@@ -49,6 +49,7 @@ public:
     virtual void  StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
     virtual void  Paint( const UserDrawEvent& rEvt ) SAL_OVERRIDE;
     virtual bool  MouseButtonDown( const MouseEvent & ) SAL_OVERRIDE;
+    virtual bool  MouseButtonUp( const MouseEvent & ) SAL_OVERRIDE;
     virtual bool  MouseMove( const MouseEvent & rEvt ) SAL_OVERRIDE;
 };
 
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index dcb0c55..c2e0f21 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -45,6 +45,7 @@ struct SvxZoomSliderControl::SvxZoomSliderControl_Impl
     Image                    maDecreaseButton;
     bool                     mbValuesSet;
     bool                     mbOmitPaint;
+    bool                     mbDraggingStarted;
 
     SvxZoomSliderControl_Impl() :
         mnCurrentZoom( 0 ),
@@ -57,7 +58,8 @@ struct SvxZoomSliderControl::SvxZoomSliderControl_Impl
         maIncreaseButton(),
         maDecreaseButton(),
         mbValuesSet( false ),
-        mbOmitPaint( false ) {}
+        mbOmitPaint( false ),
+        mbDraggingStarted( false ) {}
 };
 
 const long nSliderXOffset = 20;
@@ -331,7 +333,10 @@ bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt )
         mpImpl->mnCurrentZoom = basegfx::zoomtools::zoomIn( static_cast<int>(mpImpl->mnCurrentZoom) );
     // click to slider
     else if( nXDiff >= nSliderXOffset && nXDiff <= aControlRect.GetWidth() - nSliderXOffset )
+    {
         mpImpl->mnCurrentZoom = Offset2Zoom( nXDiff );
+        mpImpl->mbDraggingStarted = true;
+    }
 
     if ( mpImpl->mnCurrentZoom < mpImpl->mnMinZoom )
         mpImpl->mnCurrentZoom = mpImpl->mnMinZoom;
@@ -346,6 +351,12 @@ bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt )
     return true;
 }
 
+bool SvxZoomSliderControl::MouseButtonUp( const MouseEvent & )
+{
+    mpImpl->mbDraggingStarted = false;
+    return true;
+}
+
 bool SvxZoomSliderControl::MouseMove( const MouseEvent & rEvt )
 {
     if ( !mpImpl->mbValuesSet )
@@ -357,7 +368,7 @@ bool SvxZoomSliderControl::MouseMove( const MouseEvent & rEvt )
     const sal_Int32 nXDiff = aPoint.X() - aControlRect.Left();
 
     // check mouse move with button pressed
-    if ( 1 == nButtons )
+    if ( 1 == nButtons && mpImpl->mbDraggingStarted )
     {
         if ( nXDiff >= nSliderXOffset && nXDiff <= aControlRect.GetWidth() - nSliderXOffset )
         {


More information about the Libreoffice-commits mailing list