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 14:58:18 +0000
commit53740bd71a0ae569da36b9293ef22842a0b53f1e (patch)
treeeb6e64aa83e92047ff9ee01a75804f3ac17ae1e4
parentfab828d1a144b70a75e90e2bac484bc409b1e4e4 (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>
-rw-r--r--include/sfx2/stbitem.hxx2
-rw-r--r--include/svx/zoomsliderctrl.hxx1
-rw-r--r--svx/source/stbctrls/zoomsliderctrl.cxx15
3 files changed, 15 insertions, 3 deletions
diff --git a/include/sfx2/stbitem.hxx b/include/sfx2/stbitem.hxx
index 07121f89fa00..f5e146c64dc8 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 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 dcb0c556f448..c2e0f218c6e9 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 )
{