include/sfx2/sidebar/PanelLayout.hxx | 3 +++ sfx2/source/sidebar/PanelLayout.cxx | 12 ++++++++++-- starmath/source/SmElementsPanel.cxx | 12 +++++++----- starmath/source/SmElementsPanel.hxx | 6 ++++-- starmath/source/SmPanelFactory.cxx | 5 ++++- 5 files changed, 28 insertions(+), 10 deletions(-)
New commits: commit d05b0fa1e53b7b5fa3b8bb1c8c28c13b9760c107 Author: Pranam Lashkari <[email protected]> AuthorDate: Fri Jan 10 02:11:10 2025 +0530 Commit: Pranam Lashkari <[email protected]> CommitDate: Fri Jan 10 13:00:52 2025 +0100 math: store main viewshell id in math view shell problem: when we enter to edit a formula a new view shell is created. In LOK all the JSwidgets would be mapped to this window id. But when LOK requests widgets we get the requests from the main viewshell and we can't find any widgets mapped to the main viewshell which means LOK can't load any widgets. Currently there's no mechanism to find the sub viewshell Change-Id: I4f9ce161101ef6815f4d9e712d9bd42f0dc83ea3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180038 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/include/sfx2/sidebar/PanelLayout.hxx b/include/sfx2/sidebar/PanelLayout.hxx index 3058c9d514dd..d4f17ebd108e 100644 --- a/include/sfx2/sidebar/PanelLayout.hxx +++ b/include/sfx2/sidebar/PanelLayout.hxx @@ -37,6 +37,9 @@ private: public: PanelLayout(weld::Widget* pParent, const OUString& rID, const OUString& rUIXMLDescription); + PanelLayout(weld::Widget* pParent, const OUString& rID, const OUString& rUIXMLDescription, + sal_uInt64 nWindowId); + void SetPanel(sfx2::sidebar::Panel* pPanel); virtual ~PanelLayout(); diff --git a/sfx2/source/sidebar/PanelLayout.cxx b/sfx2/source/sidebar/PanelLayout.cxx index afe018db8a93..d741106369a4 100644 --- a/sfx2/source/sidebar/PanelLayout.cxx +++ b/sfx2/source/sidebar/PanelLayout.cxx @@ -17,8 +17,16 @@ using namespace sfx2::sidebar; -PanelLayout::PanelLayout(weld::Widget* pParent, const OUString& rID, const OUString& rUIXMLDescription) - : m_xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription, false, reinterpret_cast<sal_uInt64>(SfxViewShell::Current()))) +PanelLayout::PanelLayout(weld::Widget* pParent, const OUString& rID, + const OUString& rUIXMLDescription) + : PanelLayout(pParent, rID, rUIXMLDescription, + reinterpret_cast<sal_uInt64>(SfxViewShell::Current())) +{ +} + +PanelLayout::PanelLayout(weld::Widget* pParent, const OUString& rID, + const OUString& rUIXMLDescription, sal_uInt64 nWindowId) + : m_xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription, false, nWindowId)) , m_xContainer(m_xBuilder->weld_container(rID)) , m_pPanel(nullptr) { diff --git a/starmath/source/SmElementsPanel.cxx b/starmath/source/SmElementsPanel.cxx index 3abc02555578..c461a8242e9c 100644 --- a/starmath/source/SmElementsPanel.cxx +++ b/starmath/source/SmElementsPanel.cxx @@ -34,14 +34,16 @@ namespace sm::sidebar { // static -std::unique_ptr<PanelLayout> SmElementsPanel::Create(weld::Widget& rParent, - const SfxBindings& rBindings) +std::unique_ptr<PanelLayout> +SmElementsPanel::Create(weld::Widget& rParent, const SfxBindings& rBindings, sal_uInt64 nWindowId) { - return std::make_unique<SmElementsPanel>(rParent, rBindings); + return std::make_unique<SmElementsPanel>(rParent, rBindings, nWindowId); } -SmElementsPanel::SmElementsPanel(weld::Widget& rParent, const SfxBindings& rBindings) - : PanelLayout(&rParent, "MathElementsPanel", "modules/smath/ui/sidebarelements_math.ui") +SmElementsPanel::SmElementsPanel(weld::Widget& rParent, const SfxBindings& rBindings, + sal_uInt64 nWindowId) + : PanelLayout(&rParent, "MathElementsPanel", "modules/smath/ui/sidebarelements_math.ui", + nWindowId) , mrBindings(rBindings) , mxCategoryList(m_xBuilder->weld_combo_box("categorylist")) , mxElementsControl(std::make_unique<SmElementsControl>(m_xBuilder->weld_icon_view("elements"))) diff --git a/starmath/source/SmElementsPanel.hxx b/starmath/source/SmElementsPanel.hxx index d7e4609a4246..4c6f4a0cb104 100644 --- a/starmath/source/SmElementsPanel.hxx +++ b/starmath/source/SmElementsPanel.hxx @@ -35,8 +35,10 @@ namespace sm::sidebar class SmElementsPanel : public PanelLayout { public: - static std::unique_ptr<PanelLayout> Create(weld::Widget& rParent, const SfxBindings& rBindings); - SmElementsPanel(weld::Widget& rParent, const SfxBindings& rBindings); + static std::unique_ptr<PanelLayout> Create(weld::Widget& rParent, const SfxBindings& rBindings, + sal_uInt64 nWindowId); + + SmElementsPanel(weld::Widget& rParent, const SfxBindings& rBindings, sal_uInt64 nWindowId); ~SmElementsPanel(); private: diff --git a/starmath/source/SmPanelFactory.cxx b/starmath/source/SmPanelFactory.cxx index df35dcadffbc..6eff0d2009dd 100644 --- a/starmath/source/SmPanelFactory.cxx +++ b/starmath/source/SmPanelFactory.cxx @@ -28,6 +28,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <sfx2/sidebar/SidebarPanelBase.hxx> #include <vcl/weldutils.hxx> +#include <view.hxx> #include "SmElementsPanel.hxx" #include "SmPropertiesPanel.hxx" @@ -87,7 +88,9 @@ css::uno::Reference<css::ui::XUIElement> SAL_CALL SmPanelFactory::createUIElemen } else if (ResourceURL.endsWith("/MathElementsPanel")) { - pPanel = sm::sidebar::SmElementsPanel::Create(*pParent, *pBindings); + SfxViewShell* pViewShell = SfxViewShell::Get(xFrame->getController()); + pPanel = sm::sidebar::SmElementsPanel::Create(*pParent, *pBindings, + reinterpret_cast<sal_uInt64>(pViewShell)); aLayoutSize = { 300, -1, -1 }; }
