From ec629c5ee22d02f99d66a5cf975ce239876b7f4d Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Thu, 27 May 2021 19:21:11 -0800 Subject: Resolves tdf#142513 fix zoom caller handling Calling ZoomPlus has always executed shell SID_ZOOM_OUT case handling. ZoomMinus, which replaced ZoomIn, does SID_ZOOM_IN case handling. This patch changes ZoomPlus to do SID_ZOOM_IN case handling and ZoomMinus to do SID_ZOOM_OUT case handling and makes appropriate changes required by these name changes to provide expected zoom results in all module shells that have handling for these calls. Change-Id: If148f4f7866bfc8fc6452ad1c1dace723a125ef6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116287 Tested-by: Jenkins Reviewed-by: Jim Raykowski --- sw/source/uibase/uiview/pview.cxx | 16 ++++++++-------- sw/source/uibase/uiview/view2.cxx | 2 +- sw/source/uibase/uiview/viewstat.cxx | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'sw/source') diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 9ca718e016f6..a432a4de8948 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -103,18 +103,18 @@ static sal_uInt16 lcl_GetNextZoomStep(sal_uInt16 nCurrentZoom, bool bZoomIn) const int nZoomArrSize = static_cast(SAL_N_ELEMENTS(aZoomArr)); if (bZoomIn) { - for(int i = nZoomArrSize - 1; i >= 0; --i) + for(sal_uInt16 i : aZoomArr) { - if(nCurrentZoom > aZoomArr[i] || !i) - return aZoomArr[i]; + if(nCurrentZoom < i) + return i; } } else { - for(sal_uInt16 i : aZoomArr) + for(int i = nZoomArrSize - 1; i >= 0; --i) { - if(nCurrentZoom < i) - return i; + if(nCurrentZoom > aZoomArr[i] || !i) + return aZoomArr[i]; } } return bZoomIn ? MAX_PREVIEW_ZOOM : MIN_PREVIEW_ZOOM; @@ -1006,8 +1006,8 @@ void SwPagePreview::GetState( SfxItemSet& rSet ) case SID_ZOOM_OUT: { const SwViewOption* pVOpt = GetViewShell()->GetViewOptions(); - if((SID_ZOOM_OUT == nWhich && pVOpt->GetZoom() >= MAX_PREVIEW_ZOOM)|| - (SID_ZOOM_IN == nWhich && pVOpt->GetZoom() <= MIN_PREVIEW_ZOOM)) + if((SID_ZOOM_IN == nWhich && pVOpt->GetZoom() >= MAX_PREVIEW_ZOOM) || + (SID_ZOOM_OUT == nWhich && pVOpt->GetZoom() <= MIN_PREVIEW_ZOOM)) { rSet.DisableItem(nWhich); } diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index a9e71660dd10..0e9694534c44 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -583,7 +583,7 @@ void SwView::Execute(SfxRequest &rReq) case SID_ZOOM_OUT: { tools::Long nFact = m_pWrtShell->GetViewOptions()->GetZoom(); - if (SID_ZOOM_OUT == nSlot) + if (SID_ZOOM_IN == nSlot) nFact = basegfx::zoomtools::zoomIn(nFact); else nFact = basegfx::zoomtools::zoomOut(nFact); diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index e2606091bb72..bacc2f395583 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -77,8 +77,8 @@ void SwView::GetState(SfxItemSet &rSet) case SID_ZOOM_OUT: { tools::Long nFact = m_pWrtShell->GetViewOptions()->GetZoom(); - if ((SID_ZOOM_OUT == nWhich && nFact >= tools::Long(600)) || - (SID_ZOOM_IN == nWhich && nFact <= tools::Long(20))) + if ((SID_ZOOM_IN == nWhich && nFact >= tools::Long(600)) || + (SID_ZOOM_OUT == nWhich && nFact <= tools::Long(20))) { rSet.DisableItem(nWhich); } -- cgit v1.2.3