From c96e1ec61835bc01e2969ec97fce9a1674fbf6d7 Mon Sep 17 00:00:00 2001 From: Rafael Lima Date: Sat, 11 Feb 2023 16:36:00 -0300 Subject: tdf#45705 Make SID_ZOOM_IN and SID_ZOOM_OUT smoother in Impress As reported in the bug ticket, the commands SID_ZOOM_IN and SID_ZOOM_OUT are not smooth and increase/decrease zoom at too big steps. This patch uses basegfx::zoomtools to zoom in and out, making it smoother. Change-Id: I801fa6123bf0696046e5d45c7a6b309e7cc3312e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146825 Tested-by: Jenkins Reviewed-by: Jim Raykowski --- sd/source/ui/view/drviewse.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'sd') diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index b3183397a084..5a6a7577951e 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -95,6 +95,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -1189,8 +1190,11 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) case SID_ZOOM_OUT: // BASIC { + const sal_uInt16 nOldZoom = GetActiveWindow()->GetZoom(); + const sal_uInt16 nNewZoom = basegfx::zoomtools::zoomOut(nOldZoom); + SetZoom(nNewZoom); + mbZoomOnPage = false; - SetZoom( std::max<::tools::Long>( GetActiveWindow()->GetZoom() / 2, GetActiveWindow()->GetMinZoom() ) ); ::tools::Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0), GetActiveWindow()->GetOutputSizePixel()) ); mpZoomList->InsertZoomRect(aVisAreaWin); @@ -1203,8 +1207,11 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) case SID_ZOOM_IN: { + const sal_uInt16 nOldZoom = GetActiveWindow()->GetZoom(); + const sal_uInt16 nNewZoom = basegfx::zoomtools::zoomIn(nOldZoom); + SetZoom(nNewZoom); + mbZoomOnPage = false; - SetZoom( std::min<::tools::Long>( GetActiveWindow()->GetZoom() * 2, GetActiveWindow()->GetMaxZoom() ) ); ::tools::Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0), GetActiveWindow()->GetOutputSizePixel()) ); mpZoomList->InsertZoomRect(aVisAreaWin); -- cgit