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(SfxViewShell::Current()))) +PanelLayout::PanelLayout(weld::Widget* pParent, const OUString& rID, + const OUString& rUIXMLDescription) + : PanelLayout(pParent, rID, rUIXMLDescription, + reinterpret_cast(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 SmElementsPanel::Create(weld::Widget& rParent, - const SfxBindings& rBindings) +std::unique_ptr +SmElementsPanel::Create(weld::Widget& rParent, const SfxBindings& rBindings, sal_uInt64 nWindowId) { - return std::make_unique(rParent, rBindings); + return std::make_unique(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( 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 Create(weld::Widget& rParent, const SfxBindings& rBindings); + static std::unique_ptr 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 #include #include +#include #include "SmElementsPanel.hxx" #include "SmPropertiesPanel.hxx" @@ -91,7 +92,9 @@ css::uno::Reference 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(pViewShell)); aLayoutSize = { 300, -1, -1 }; }