From ac2a6ee9618e377806e529ed641f67e88684f7e7 Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Mon, 13 Jun 2022 17:20:15 +1000 Subject: basegfx: zoomIn() and zoomOut() should be sal_uInt16 All zoom functions use sal_uInt16 values. For some reason, basegfx used long when zoomIn and zoomOut were created in 2012 (see commit 315d2ddc16: "optimized zoom to use more common intervals"), this then got mass converted to tools::Long in commit 387a88fa25: "use tools::Long in basegfx..chart2". So fix is to change zoomIn/Out() to use sal_uInt16. Change-Id: I2a56d6f58e14f77aeb8741d332fe9bc282eb969f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135715 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- sc/inc/global.hxx | 4 ++-- sc/source/ui/view/prevwsh.cxx | 10 +++++----- sc/source/ui/view/tabview.cxx | 8 ++++---- sc/source/ui/view/tabvwsh3.cxx | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'sc') diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 47b93c845296..8401ca4c6f7e 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -75,8 +75,8 @@ const sal_Unicode CHAR_NNBSP = 0x202F; //NARROW NO-BREAK SPACE #define MINDOUBLE 1.7e-307 #define MAXDOUBLE 1.7e307 -#define MINZOOM 20 -#define MAXZOOM 400 +const sal_uInt16 MINZOOM = 20; +const sal_uInt16 MAXZOOM = 400; const SCSIZE MAXSUBTOTAL = 3; diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index d38b4311f143..4552062b624a 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -478,17 +478,17 @@ bool ScPreviewShell::ScrollCommand( const CommandEvent& rCEvt ) const CommandWheelData* pData = rCEvt.GetWheelData(); if ( pData && pData->GetMode() == CommandWheelMode::ZOOM ) { - tools::Long nOld = pPreview->GetZoom(); - tools::Long nNew; + sal_uInt16 nOld = pPreview->GetZoom(); + sal_uInt16 nNew; if ( pData->GetDelta() < 0 ) - nNew = std::max( tools::Long(MINZOOM), basegfx::zoomtools::zoomOut( nOld )); + nNew = std::max( MINZOOM, basegfx::zoomtools::zoomOut( nOld )); else - nNew = std::min( tools::Long(MAXZOOM), basegfx::zoomtools::zoomIn( nOld )); + nNew = std::min( MAXZOOM, basegfx::zoomtools::zoomIn( nOld )); if ( nNew != nOld ) { eZoom = SvxZoomType::PERCENT; - pPreview->SetZoom( static_cast(nNew) ); + pPreview->SetZoom( nNew ); } bDone = true; diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 4e66be551f8b..898181c49f6e 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -959,12 +959,12 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos ) // and can't be changed directly const Fraction& rOldY = aViewData.GetZoomY(); - tools::Long nOld = static_cast( rOldY * 100 ); - tools::Long nNew; + sal_uInt16 nOld = static_cast( rOldY * 100 ); + sal_uInt16 nNew; if ( pData->GetDelta() < 0 ) - nNew = std::max( tools::Long(MINZOOM), basegfx::zoomtools::zoomOut( nOld )); + nNew = std::max( MINZOOM, basegfx::zoomtools::zoomOut( nOld )); else - nNew = std::min( tools::Long(MAXZOOM), basegfx::zoomtools::zoomIn( nOld )); + nNew = std::min( MAXZOOM, basegfx::zoomtools::zoomIn( nOld )); if ( nNew != nOld ) { // scroll wheel doesn't set the AppOptions default diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 766f6c7621d4..ec19d4c1d4a6 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -754,12 +754,12 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) // and can't be changed directly const Fraction& rOldY = GetViewData().GetZoomY(); - tools::Long nOld = tools::Long(rOldY * 100); - tools::Long nNew; + sal_uInt16 nOld = tools::Long(rOldY * 100); + sal_uInt16 nNew; if (SID_ZOOM_OUT == nSlot) - nNew = std::max(tools::Long(MINZOOM), basegfx::zoomtools::zoomOut(nOld)); + nNew = std::max(MINZOOM, basegfx::zoomtools::zoomOut(nOld)); else - nNew = std::min(tools::Long(MAXZOOM), basegfx::zoomtools::zoomIn(nOld)); + nNew = std::min(MAXZOOM, basegfx::zoomtools::zoomIn(nOld)); if ( nNew != nOld) { bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom(); -- cgit