[Libreoffice-commits] core.git: sd/source sfx2/sdi sw/source

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 7 06:51:39 UTC 2021


 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(-)

New commits:
commit ec629c5ee22d02f99d66a5cf975ce239876b7f4d
Author:     Jim Raykowski <raykowj at gmail.com>
AuthorDate: Thu May 27 19:21:11 2021 -0800
Commit:     Jim Raykowski <raykowj at gmail.com>
CommitDate: Mon Jun 7 08:51:02 2021 +0200

    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 <raykowj at gmail.com>

diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 6e695b1d4f06..141910870d63 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -985,11 +985,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 2247294cfaba..9fb69869a0da 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -1179,7 +1179,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() ) );
@@ -1193,7 +1193,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() ) );
@@ -1201,6 +1201,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 5e9caef9e395..a1b2c9382663 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 b18a0460b4e9..ed810ca0f4fe 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -738,9 +738,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 7ce13e9f7b50..90ed30a62f92 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -4735,7 +4735,7 @@ SfxBoolItem ViewDataSourceBrowser SID_VIEW_DATA_SOURCE_BROWSER
     GroupId = SfxGroupId::View;
 ]
 
-SfxVoidItem ZoomMinus SID_ZOOM_IN
+SfxVoidItem ZoomPlus SID_ZOOM_IN
 ()
 [
     AutoUpdate = FALSE,
@@ -4771,7 +4771,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 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<int>(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);
                 }


More information about the Libreoffice-commits mailing list