summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2022-06-13 17:20:15 +1000
committerThorsten Behrens <thorsten.behrens@allotropia.de>2022-07-13 18:54:28 +0200
commitac2a6ee9618e377806e529ed641f67e88684f7e7 (patch)
tree1572db055b02358bba8e666d87ea418b66398206 /sc
parentd818c341206895a6dda1c19fc8b32f04b5b7c520 (diff)
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 <thorsten.behrens@allotropia.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/global.hxx4
-rw-r--r--sc/source/ui/view/prevwsh.cxx10
-rw-r--r--sc/source/ui/view/tabview.cxx8
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx8
4 files changed, 15 insertions, 15 deletions
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<sal_uInt16>(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<tools::Long>( rOldY * 100 );
- tools::Long nNew;
+ sal_uInt16 nOld = static_cast<tools::Long>( 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();