summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodolfo Ribeiro Gomes <libo@rodolfo.eng.br>2015-01-31 19:08:05 -0200
committerMichael Stahl <mstahl@redhat.com>2015-02-09 16:09:20 +0100
commit0bc37cf20044fe8fee0cc7dd5af3ee58304a3a0f (patch)
tree516aa1a78179a1c68114d083ccf28338543c985f
parent3d106972014ba9e00126a077ed62b351518c2afa (diff)
tdf#47577 Zoom slider should only react to full click
Change-Id: If859754c956a634a96066ac407b70d6dd2759d53 Signed-off-by: Rodolfo Ribeiro Gomes <libo@rodolfo.eng.br> Reviewed-on: https://gerrit.libreoffice.org/14265 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 53740bd71a0ae569da36b9293ef22842a0b53f1e) Signed-off-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--include/svx/zoomsliderctrl.hxx1
-rw-r--r--svx/source/stbctrls/zoomsliderctrl.cxx15
2 files changed, 14 insertions, 2 deletions
diff --git a/include/svx/zoomsliderctrl.hxx b/include/svx/zoomsliderctrl.hxx
index 7af69db82c7c..f35f825383a4 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 8ea241bbdc82..137932181f39 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 )
{