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 <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index 9d33bda..a0dd401 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();
}