[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - include/svx svx/source

Rodolfo Ribeiro Gomes libo at rodolfo.eng.br
Mon Feb 9 07:14:35 PST 2015


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

New commits:
commit 0bc37cf20044fe8fee0cc7dd5af3ee58304a3a0f
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>
    (cherry picked from commit 53740bd71a0ae569da36b9293ef22842a0b53f1e)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>

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 8ea241b..1379321 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;
@@ -330,7 +332,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;
@@ -345,6 +350,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 )
@@ -356,7 +367,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