starmath/source/SmElementsPanel.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
New commits: commit 04684eff465ba4287613294eaa34dd2659fbafcf Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue Sep 27 14:05:19 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Sep 28 20:22:33 2022 +0200 lok: find active SmViewShell reliably in Elements panel It is needed in 22.05, unlike master Change-Id: I76265888e7814f47b09c405dc1e907aa0dfbc743 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140646 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/starmath/source/SmElementsPanel.cxx b/starmath/source/SmElementsPanel.cxx index 08ff6af95ab9..51c07356be1a 100644 --- a/starmath/source/SmElementsPanel.cxx +++ b/starmath/source/SmElementsPanel.cxx @@ -19,7 +19,9 @@ #include <sal/config.h> +#include <comphelper/lok.hxx> #include <sfx2/dispatch.hxx> +#include <sfx2/lokcomponenthelpers.hxx> #include <svl/stritem.hxx> #include "SmElementsPanel.hxx" @@ -84,7 +86,14 @@ IMPL_LINK(SmElementsPanel, ElementClickHandler, OUString, ElementSource, void) SmViewShell* SmElementsPanel::GetView() const { SfxViewShell* pView = mrBindings.GetDispatcher()->GetFrame()->GetViewShell(); - return dynamic_cast<SmViewShell*>(pView); + SmViewShell* pSmViewShell = dynamic_cast<SmViewShell*>(pView); + if (!pSmViewShell && comphelper::LibreOfficeKit::isActive()) + { + auto* pWindow = static_cast<SmGraphicWindow*>(LokStarMathHelper(pView).GetGraphicWindow()); + if (pWindow) + pSmViewShell = &pWindow->GetGraphicWidget().GetView(); + } + return pSmViewShell; } } // end of namespace sm::sidebar