sd/source/ui/inc/DrawViewShell.hxx | 4 ++++ sd/source/ui/inc/ViewShell.hxx | 2 ++ sd/source/ui/unoidl/unomodel.cxx | 3 +++ sd/source/ui/view/drviews1.cxx | 17 +++++++++++++++++ sd/source/ui/view/drviews3.cxx | 7 +++++++ 5 files changed, 33 insertions(+)
New commits: commit 4db199dc16dbef908d2a0a316b7e6d40f7b4f0b8 Author: Mohit Marathe <[email protected]> AuthorDate: Wed Nov 12 17:54:26 2025 +0530 Commit: Mohit Marathe <[email protected]> CommitDate: Wed Nov 19 04:37:55 2025 +0100 sd: remember last client visible area of canvas page and send that to the client Signed-off-by: Mohit Marathe <[email protected]> Change-Id: Ibd65498c980ebdb93f125904f80e5e78e0b6b172 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193862 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Michael Stahl <[email protected]> diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index a28ea2ba61fd..51daeeaab074 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -394,6 +394,8 @@ public: DECL_LINK(SearchDialogHdl, SfxRequest&, void); + virtual void RememberCanvasPageVisArea(const ::tools::Rectangle &aRect) override; + protected: DECL_DLLPRIVATE_LINK( ClipboardChanged, TransferableDataHelper*, void ); DECL_DLLPRIVATE_LINK( TabSplitHdl, TabBar *, void ); @@ -514,6 +516,8 @@ private: std::vector<std::unique_ptr<SdrExternalToolEdit>> m_ExternalEdits; css::uno::Reference<css::presentation::XSlideShow> mxSlideShow; + + ::tools::Rectangle maCanvasPageVisArea; }; /// Merge the background properties together and deposit the result in rMergeAttr diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 76de1b1b9f7d..a89126f4af97 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -427,6 +427,8 @@ public: */ virtual void onGrabFocus(){}; + virtual void RememberCanvasPageVisArea(const ::tools::Rectangle & /*aRect*/) {}; + /// Allows adjusting the point or mark of the selection to a document coordinate. void SetCursorMm100Position(const Point& rPosition, bool bPoint, bool bClearMark); /// Gets the current selection diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index bac8bb3f1f19..e3181e3a3197 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -4493,6 +4493,9 @@ void SdXImpressDocument::setClientVisibleArea(const ::tools::Rectangle& rRectang return; pViewShell->GetViewShellBase().setLOKVisibleArea(rRectangle); + + if (pViewShell->getCurrentPage()->IsCanvasPage()) + pViewShell->RememberCanvasPageVisArea(rRectangle); } void SdXImpressDocument::setClipboard(const uno::Reference<datatransfer::clipboard::XClipboard>& xClipboard) diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 23bbd397494d..dbcb265aa1ab 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -1112,6 +1112,23 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage, bool bAllowChangeFocus) pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload); } } + if (GetDoc()->HasCanvasPage() && getCurrentPage()->IsCanvasPage() && bAllowChangeFocus) + { + ::tools::JsonWriter aJsonWriter; + aJsonWriter.put("commandName", "CanvasPageVisArea"); + { + auto jsonState = aJsonWriter.startNode("state"); + aJsonWriter.put("x", maCanvasPageVisArea.Left()); + aJsonWriter.put("y", maCanvasPageVisArea.Top()); + aJsonWriter.put("width", maCanvasPageVisArea.GetWidth()); + aJsonWriter.put("height", maCanvasPageVisArea.GetHeight()); + } + OString aPayload = aJsonWriter.finishAndGetAsOString(); + if (SfxViewShell* pViewShell = GetViewShell()) + { + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload); + } + } } else { diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 422ebaaa9828..2a15325f9ed2 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -1113,6 +1113,13 @@ void DrawViewShell::GetSnapItemState( SfxItemSet &rSet ) } } +void DrawViewShell::RememberCanvasPageVisArea(const ::tools::Rectangle &aRect) +{ + if (!GetDoc()->HasCanvasPage()) + return; + maCanvasPageVisArea = aRect; +} + } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
