diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-12-06 11:22:47 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-12-06 12:00:42 +0000 |
commit | 834f49b7e30ec9cc9bd050079b23995ad514b40c (patch) | |
tree | bd0421a9f51034b08b06550052dcd9eb8d9383e8 /starmath | |
parent | e0066326f76e734e7b9a0f344afcadb40ef9ed64 (diff) |
tdf#150940: Store frame reference in the panel
It is needed to properly dispatch the commands in case of embedded
objects, otherwise they are dispatched to the top-level frame.
Change-Id: Ia5fadf7c35bded75f1ca20a682dc6c9f14548990
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143693
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/SmPanelFactory.cxx | 2 | ||||
-rw-r--r-- | starmath/source/SmPropertiesPanel.cxx | 12 | ||||
-rw-r--r-- | starmath/source/SmPropertiesPanel.hxx | 7 |
3 files changed, 14 insertions, 7 deletions
diff --git a/starmath/source/SmPanelFactory.cxx b/starmath/source/SmPanelFactory.cxx index 8e9f146a1959..df35dcadffbc 100644 --- a/starmath/source/SmPanelFactory.cxx +++ b/starmath/source/SmPanelFactory.cxx @@ -83,7 +83,7 @@ css::uno::Reference<css::ui::XUIElement> SAL_CALL SmPanelFactory::createUIElemen css::ui::LayoutSize aLayoutSize{ -1, -1, -1 }; if (ResourceURL.endsWith("/MathPropertiesPanel")) { - pPanel = sm::sidebar::SmPropertiesPanel::Create(*pParent); + pPanel = sm::sidebar::SmPropertiesPanel::Create(*pParent, xFrame); } else if (ResourceURL.endsWith("/MathElementsPanel")) { diff --git a/starmath/source/SmPropertiesPanel.cxx b/starmath/source/SmPropertiesPanel.cxx index 3ffd25c40e79..48f2c6897cd1 100644 --- a/starmath/source/SmPropertiesPanel.cxx +++ b/starmath/source/SmPropertiesPanel.cxx @@ -32,13 +32,17 @@ namespace sm::sidebar { // static -std::unique_ptr<PanelLayout> SmPropertiesPanel::Create(weld::Widget& rParent) +std::unique_ptr<PanelLayout> +SmPropertiesPanel::Create(weld::Widget& rParent, + const css::uno::Reference<css::frame::XFrame>& xFrame) { - return std::make_unique<SmPropertiesPanel>(rParent); + return std::make_unique<SmPropertiesPanel>(rParent, xFrame); } -SmPropertiesPanel::SmPropertiesPanel(weld::Widget& rParent) +SmPropertiesPanel::SmPropertiesPanel(weld::Widget& rParent, + const css::uno::Reference<css::frame::XFrame>& xFrame) : PanelLayout(&rParent, "MathPropertiesPanel", "modules/smath/ui/sidebarproperties_math.ui") + , mxFrame(xFrame) , mpFormatFontsButton(m_xBuilder->weld_button("btnFormatFonts")) , mpFormatFontSizeButton(m_xBuilder->weld_button("btnFormatFontSize")) , mpFormatSpacingButton(m_xBuilder->weld_button("btnFormatSpacing")) @@ -80,7 +84,7 @@ SmPropertiesPanel::~SmPropertiesPanel() IMPL_LINK(SmPropertiesPanel, ButtonClickHandler, weld::Button&, rButton, void) { if (OUString command = maButtonCommands[&rButton]; !command.isEmpty()) - comphelper::dispatchCommand(command, {}); + comphelper::dispatchCommand(command, mxFrame, {}); } } // end of namespace sm::sidebar diff --git a/starmath/source/SmPropertiesPanel.hxx b/starmath/source/SmPropertiesPanel.hxx index e81463f37022..f19316e3fac1 100644 --- a/starmath/source/SmPropertiesPanel.hxx +++ b/starmath/source/SmPropertiesPanel.hxx @@ -31,13 +31,16 @@ namespace sm::sidebar class SmPropertiesPanel : public PanelLayout { public: - static std::unique_ptr<PanelLayout> Create(weld::Widget& rParent); - SmPropertiesPanel(weld::Widget& rParent); + static std::unique_ptr<PanelLayout> + Create(weld::Widget& rParent, const css::uno::Reference<css::frame::XFrame>& xFrame); + SmPropertiesPanel(weld::Widget& rParent, const css::uno::Reference<css::frame::XFrame>& xFrame); ~SmPropertiesPanel(); private: DECL_LINK(ButtonClickHandler, weld::Button&, void); + css::uno::Reference<css::frame::XFrame> mxFrame; + std::unique_ptr<weld::Button> mpFormatFontsButton; std::unique_ptr<weld::Button> mpFormatFontSizeButton; std::unique_ptr<weld::Button> mpFormatSpacingButton; |