sc/source/ui/view/prevwsh.cxx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
New commits: commit 78e0626bc7bf37d1eda2e3151dd1a44056f92032 Author: Rafał Dobrakowski <[email protected]> AuthorDate: Thu May 9 18:18:43 2024 +0200 Commit: Ilmari Lauhakangas <[email protected]> CommitDate: Mon May 13 10:41:43 2024 +0200 tdf#45705 Integrate zoom UI commands into Calc This patch uses basegfx::zoomtools to zoom in and out, making it smoother. Similar to commit c96e1ec61835bc01e2969ec97fce9a1674fbf6d7 done for Writer view shell, this patch makes zoom in and zoom out commands functional for Calc the preview shell. Change-Id: I1612f51d39c507d192237bf2361b91e6e5723c4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167389 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <[email protected]> Reviewed-by: Ilmari Lauhakangas <[email protected]> diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 9d33bdaf626a..a0dd401b97b2 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -668,19 +668,16 @@ void ScPreviewShell::Execute( SfxRequest& rReq ) } break; case SID_ZOOM_IN: - { - sal_uInt16 nNew = pPreview->GetZoom() + 20 ; - nNew -= nNew % 20; - pPreview->SetZoom( nNew ); - eZoom = SvxZoomType::PERCENT; - rReq.Done(); - } - break; case SID_ZOOM_OUT: { - sal_uInt16 nNew = pPreview->GetZoom() - 1; - nNew -= nNew % 20; - pPreview->SetZoom( nNew ); + sal_uInt16 nNewZoom; + const sal_uInt16 nOldZoom {pPreview->GetZoom()}; + if(SID_ZOOM_OUT == nSlot) + nNewZoom = basegfx::zoomtools::zoomOut(nOldZoom); + else + nNewZoom = basegfx::zoomtools::zoomIn(nOldZoom); + + pPreview->SetZoom(nNewZoom); eZoom = SvxZoomType::PERCENT; rReq.Done(); }
