diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2014-09-14 15:06:27 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2014-09-14 16:42:00 +0300 |
commit | dffe40bc4e8be7c845d66a8118248d02dd70a707 (patch) | |
tree | a4d337884b88415d1e93c0d62dd13f8dd529a6ed | |
parent | f5129ca7610ec4ec20ed1c00e5c94bf51d5de2cc (diff) |
Related: fdo#83572 Improve zoom mode
Make this mode permanent, and add also zoom out/pan
functionality. Hold Ctrl for zoom out, Shift for pan.
Change-Id: I5bd8adfcc4d403c35b33185e5894a2b020d604d0
-rw-r--r-- | sd/source/ui/func/fuzoom.cxx | 30 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 1 |
2 files changed, 22 insertions, 9 deletions
diff --git a/sd/source/ui/func/fuzoom.cxx b/sd/source/ui/func/fuzoom.cxx index f3bda04bfdaa..daf1f168cb93 100644 --- a/sd/source/ui/func/fuzoom.cxx +++ b/sd/source/ui/func/fuzoom.cxx @@ -82,12 +82,19 @@ bool FuZoom::MouseButtonDown(const MouseEvent& rMEvt) aBeginPosPix = rMEvt.GetPosPixel(); aBeginPos = mpWindow->PixelToLogic(aBeginPosPix); + aZoomRect.SetSize( Size( 0, 0 ) ); + aZoomRect.SetPos( aBeginPos ); return true; } bool FuZoom::MouseMove(const MouseEvent& rMEvt) { + if (rMEvt.IsShift()) + mpWindow->SetPointer(Pointer(POINTER_HAND)); + else if (nSlotId != SID_ZOOM_PANNING) + mpWindow->SetPointer(Pointer(POINTER_MAGNIFY)); + if (bStartDrag) { if (bVisible) @@ -101,7 +108,7 @@ bool FuZoom::MouseMove(const MouseEvent& rMEvt) aEndPos = mpWindow->PixelToLogic(aPosPix); aBeginPos = mpWindow->PixelToLogic(aBeginPosPix); - if (nSlotId == SID_ZOOM_PANNING) + if (nSlotId == SID_ZOOM_PANNING || (rMEvt.IsShift() && !bVisible) ) { // Panning @@ -123,9 +130,8 @@ bool FuZoom::MouseMove(const MouseEvent& rMEvt) aZoomRect = aRect; aZoomRect.Justify(); mpViewShell->DrawMarkRect(aZoomRect); + bVisible = true; } - - bVisible = true; } return bStartDrag; @@ -145,19 +151,27 @@ bool FuZoom::MouseButtonUp(const MouseEvent& rMEvt) Point aPosPix = rMEvt.GetPosPixel(); - if(SID_ZOOM_PANNING != nSlotId) + if(SID_ZOOM_PANNING != nSlotId && !rMEvt.IsShift()) { // Zoom Size aZoomSizePixel = mpWindow->LogicToPixel(aZoomRect).GetSize(); sal_uLong nTol = DRGPIX + DRGPIX; - if ( aZoomSizePixel.Width() < (long) nTol && aZoomSizePixel.Height() < (long) nTol ) + if ( ( aZoomSizePixel.Width() < (long) nTol && aZoomSizePixel.Height() < (long) nTol ) || rMEvt.IsMod1() ) { // click at place: double zoom factor Point aPos = mpWindow->PixelToLogic(aPosPix); Size aSize = mpWindow->PixelToLogic(mpWindow->GetOutputSizePixel()); - aSize.Width() /= 2; - aSize.Height() /= 2; + if ( rMEvt.IsMod1() ) + { + aSize.Width() *= 2; + aSize.Height() *= 2; + } + else + { + aSize.Width() /= 2; + aSize.Height() /= 2; + } aPos.X() -= aSize.Width() / 2; aPos.Y() -= aSize.Height() / 2; aZoomRect.SetPos(aPos); @@ -165,6 +179,7 @@ bool FuZoom::MouseButtonUp(const MouseEvent& rMEvt) } mpViewShell->SetZoomRect(aZoomRect); + mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom ); } Rectangle aVisAreaWin = mpWindow->PixelToLogic(Rectangle(Point(0,0), @@ -173,7 +188,6 @@ bool FuZoom::MouseButtonUp(const MouseEvent& rMEvt) bStartDrag = false; mpWindow->ReleaseMouse(); - mpViewShell->Cancel(); return true; } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 8a21b68812f1..59ece90fb2d7 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1227,7 +1227,6 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { mbZoomOnPage = false; SetCurrentFunction( FuZoom::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) ); - // finishes itself, no Cancel() needed! Invalidate( SID_ZOOM_TOOLBOX ); rReq.Ignore (); } |