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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180287
Tested-by: Jenkins
This commit is contained in:
Pranam Lashkari
2025-01-10 02:11:10 +05:30
committed by Caolán McNamara
parent 9d4e8447a1
commit 1de4b9ae2b
5 changed files with 26 additions and 10 deletions

View File

@@ -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();

View File

@@ -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)
{

View File

@@ -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>(

View File

@@ -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:

View File

@@ -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 };
}