sd/source/ui/view/drviews1.cxx |   12 ++++++++----
 sd/source/ui/view/drviews2.cxx |    1 -
 sd/source/ui/view/outlnvs2.cxx |    2 --
 sd/source/ui/view/outlnvsh.cxx |    2 ++
 sd/source/ui/view/viewshe2.cxx |    1 +
 5 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 6b579b358e94d09d87c3d65bcfc7e8a9a3797c16
Author:     Mohit Marathe <[email protected]>
AuthorDate: Wed Jan 28 12:16:04 2026 +0530
Commit:     Mohit Marathe <[email protected]>
CommitDate: Wed Jan 28 15:02:59 2026 +0100

    tdf#170324 sd: only trigger auto zoom change when switching to or from
    
    canvas page.
    Also, call RememberPageZoom from a more general place i.e.
    *ViewShell::SetZoom, so that page zoom is remembered when zoom is
    changed via any method.
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: Ib9a4efc6b641b1f52d263f4cc903ebc90630340b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198253
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit e2e70915c59c1540160c1608d964af0c760c3ee0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198293
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 0f2102119901..dbf8c9c82de5 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -266,6 +266,7 @@ void DrawViewShell::SetZoom( ::tools::Long nZoom )
     GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
     mpViewOverlayManager->onZoomChanged();
     collectUIInformation(OUString::number(nZoom));
+    RememberPageZoom(nZoom);
 }
 
 /**
@@ -1149,11 +1150,14 @@ bool DrawViewShell::SwitchPage(sal_uInt16 
nSelectedPage, bool bAllowChangeFocus,
             }
             else
             {
-                const sal_uInt16 nZoom = GetPageZoom();
-                if (nZoom)
+                if (bChangeZoom && bAllowChangeFocus)
                 {
-                    const SvxZoomItem aZoomItem(SvxZoomType::PERCENT, nZoom, 
SID_ATTR_ZOOM);
-                    
GetViewFrame()->GetDispatcher()->ExecuteList(SID_ATTR_ZOOM, SfxCallMode::SLOT, 
{&aZoomItem});
+                    const sal_uInt16 nZoom = GetPageZoom();
+                    if (nZoom)
+                    {
+                        const SvxZoomItem aZoomItem(SvxZoomType::PERCENT, 
nZoom, SID_ATTR_ZOOM);
+                        
GetViewFrame()->GetDispatcher()->ExecuteList(SID_ATTR_ZOOM, SfxCallMode::SLOT, 
{&aZoomItem});
+                    }
                 }
             }
 
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 67bdb1c564c4..c8e3c18a774a 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1654,7 +1654,6 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                     {
                         sal_uInt16 nZoom = pArgs->Get( SID_ATTR_ZOOM 
).GetValue();
                         SetZoom( static_cast<::tools::Long>( nZoom ) );
-                        RememberPageZoom(nZoom);
                     }
                         break;
 
diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx
index 6bfa2d9dc179..9aaa16557a5a 100644
--- a/sd/source/ui/view/outlnvs2.cxx
+++ b/sd/source/ui/view/outlnvs2.cxx
@@ -88,8 +88,6 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq)
                         SetZoom( static_cast<::tools::Long>( pArgs->Get( 
SID_ATTR_ZOOM ).GetValue()) );
                         Invalidate( SID_ATTR_ZOOM );
                         Invalidate( SID_ATTR_ZOOMSLIDER );
-                        sal_uInt16 nZoom = aZoom.GetValue();
-                        RememberPageZoom(nZoom);
                     }
                     break;
 
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 1803297eae4d..248187745b53 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -1126,6 +1126,8 @@ void OutlineViewShell::SetZoom(::tools::Long nZoom)
 
     GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
     GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
+
+    RememberPageZoom(nZoom);
 }
 
 /**
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index b264bb89121a..aeee29008f2b 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -405,6 +405,7 @@ void ViewShell::SetZoom(::tools::Long nZoom)
     }
 
     UpdateScrollBars();
+    RememberPageZoom(nZoom);
 }
 
 ::tools::Long ViewShell::GetZoom() const

Reply via email to