From 3d4c284f087010e9590460f98052438526e14c00 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 (cherry picked from commit ec629c5ee22d02f99d66a5cf975ce239876b7f4d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116702 Reviewed-by: Xisco Fauli --- sd/source/ui/view/drviews7.cxx | 4 ++-- sd/source/ui/view/drviewse.cxx | 5 +++-- sd/source/ui/view/outlnvs2.cxx | 5 +++-- sd/source/ui/view/outlnvsh.cxx | 4 ++-- sfx2/sdi/sfx.sdi | 4 ++-- sw/source/uibase/uiview/pview.cxx | 16 ++++++++-------- sw/source/uibase/uiview/view2.cxx | 2 +- sw/source/uibase/uiview/viewstat.cxx | 4 ++-- 8 files changed, 23 insertions(+), 21 deletions(-) diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index baac52ee46e1..4e6d10ede19d 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -988,11 +988,11 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() ) { - rSet.DisableItem( SID_ZOOM_IN ); + rSet.DisableItem( SID_ZOOM_OUT ); rSet.DisableItem( SID_ZOOM_PANNING ); } if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() ) - rSet.DisableItem( SID_ZOOM_OUT ); + rSet.DisableItem( SID_ZOOM_IN ); } if (!mpZoomList->IsNextPossible()) diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index db9662bb7650..03a033585883 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -1176,7 +1176,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) } break; - case SID_ZOOM_IN: // BASIC + case SID_ZOOM_OUT: // BASIC { mbZoomOnPage = false; SetZoom( std::max<::tools::Long>( GetActiveWindow()->GetZoom() / 2, GetActiveWindow()->GetMinZoom() ) ); @@ -1190,7 +1190,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) } break; - case SID_ZOOM_OUT: + case SID_ZOOM_IN: { mbZoomOnPage = false; SetZoom( std::min<::tools::Long>( GetActiveWindow()->GetZoom() * 2, GetActiveWindow()->GetMaxZoom() ) ); @@ -1198,6 +1198,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) GetActiveWindow()->GetOutputSizePixel()) ); mpZoomList->InsertZoomRect(aVisAreaWin); Invalidate( SID_ZOOM_IN ); + Invalidate(SID_ZOOM_OUT); Invalidate( SID_ZOOM_PANNING ); rReq.Done (); } diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index 4acabdf2dbf7..94e1d90e8656 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -125,7 +125,7 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq) break; } - case SID_ZOOM_OUT: + case SID_ZOOM_IN: { SetZoom( std::min<::tools::Long>( GetActiveWindow()->GetZoom() * 2, GetActiveWindow()->GetMaxZoom() ) ); ::tools::Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0), @@ -133,6 +133,7 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq) mpZoomList->InsertZoomRect(aVisAreaWin); Invalidate( SID_ATTR_ZOOM ); Invalidate( SID_ZOOM_IN ); + Invalidate(SID_ZOOM_OUT); Invalidate( SID_ATTR_ZOOMSLIDER ); Cancel(); rReq.Done(); @@ -152,7 +153,7 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq) } break; - case SID_ZOOM_IN: + case SID_ZOOM_OUT: { SetZoom( std::max<::tools::Long>( GetActiveWindow()->GetZoom() / 2, GetActiveWindow()->GetMinZoom() ) ); ::tools::Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0), diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index ce1cb0ceeee3..7bd920d931fc 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -736,9 +736,9 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) SfxItemState::DEFAULT == rSet.GetItemState( SID_ZOOM_OUT ) ) { if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() ) - rSet.DisableItem( SID_ZOOM_IN ); - if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() ) rSet.DisableItem( SID_ZOOM_OUT ); + if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() ) + rSet.DisableItem( SID_ZOOM_IN ); } ::Outliner& rOutl = pOlView->GetOutliner(); diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 6cdad85a8d53..c94b4ab2f292 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -4670,7 +4670,7 @@ SfxBoolItem ViewDataSourceBrowser SID_VIEW_DATA_SOURCE_BROWSER GroupId = SfxGroupId::View; ] -SfxVoidItem ZoomMinus SID_ZOOM_IN +SfxVoidItem ZoomPlus SID_ZOOM_IN () [ AutoUpdate = FALSE, @@ -4706,7 +4706,7 @@ SfxVoidItem ZoomNext SID_ZOOM_NEXT ] -SfxVoidItem ZoomPlus SID_ZOOM_OUT +SfxVoidItem ZoomMinus SID_ZOOM_OUT () [ AutoUpdate = TRUE, diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 87d04bebed90..1ad4e32a9c55 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -102,18 +102,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 da05a1cd6794..dfa8678cc548 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -588,7 +588,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 82b1159952fb..59b8dfa1a214 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -74,8 +74,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