sd/source/ui/view/drviewse.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit c96e1ec61835bc01e2969ec97fce9a1674fbf6d7
Author:     Rafael Lima <rafael.palma.l...@gmail.com>
AuthorDate: Sat Feb 11 16:36:00 2023 -0300
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Sat Feb 11 21:07:31 2023 +0000

    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 <rayk...@gmail.com>

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 <fuformatpaintbrush.hxx>
 #include <fuzoom.hxx>
 #include <sdmod.hxx>
+#include <basegfx/utils/zoomtools.hxx>
 
 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);

Reply via email to