include/sfx2/sidebar/PanelLayout.hxx |    3 +++
 sfx2/source/sidebar/PanelLayout.cxx  |   12 ++++++++++--
 starmath/source/SmElementsPanel.cxx  |   11 ++++++-----
 starmath/source/SmElementsPanel.hxx  |    5 +++--
 starmath/source/SmPanelFactory.cxx   |    5 ++++-
 5 files changed, 26 insertions(+), 10 deletions(-)

New commits:
commit 1de4b9ae2b43c5f3818cc146ab1f46d3da2edf03
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Fri Jan 10 02:11:10 2025 +0530
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Jan 16 15:44:08 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 <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180287
    Tested-by: Jenkins

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 afe27a80fc50..f6826f8df31f 100644
--- a/starmath/source/SmElementsPanel.cxx
+++ b/starmath/source/SmElementsPanel.cxx
@@ -35,15 +35,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)
+SmElementsPanel::SmElementsPanel(weld::Widget& rParent, const SfxBindings& 
rBindings,
+                                 sal_uInt64 nWindowId)
     : PanelLayout(&rParent, u"MathElementsPanel"_ustr,
-                  u"modules/smath/ui/sidebarelements_math.ui"_ustr)
+                  u"modules/smath/ui/sidebarelements_math.ui"_ustr, nWindowId)
     , mrBindings(rBindings)
     , mxCategoryList(m_xBuilder->weld_combo_box(u"categorylist"_ustr))
     , mxElementsControl(std::make_unique<SmElementsControl>(
diff --git a/starmath/source/SmElementsPanel.hxx 
b/starmath/source/SmElementsPanel.hxx
index c1f4b2ab31f3..d77518630505 100644
--- a/starmath/source/SmElementsPanel.hxx
+++ b/starmath/source/SmElementsPanel.hxx
@@ -36,11 +36,12 @@ namespace sm::sidebar
 class SmElementsPanel : public PanelLayout, public SfxListener
 {
 public:
-    static std::unique_ptr<PanelLayout> Create(weld::Widget& rParent, const 
SfxBindings& rBindings);
+    static std::unique_ptr<PanelLayout> Create(weld::Widget& rParent, const 
SfxBindings& rBindings,
+                                               sal_uInt64 nWindowId);
 
     void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
 
-    SmElementsPanel(weld::Widget& rParent, const SfxBindings& rBindings);
+    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 833530ace90d..644e9ca6c6a3 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"
@@ -91,7 +92,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 };
         }
 

Reply via email to