starmath/source/SmPanelFactory.cxx    |    2 +-
 starmath/source/SmPropertiesPanel.cxx |   12 ++++++++----
 starmath/source/SmPropertiesPanel.hxx |    7 +++++--
 3 files changed, 14 insertions(+), 7 deletions(-)

New commits:
commit 689eb4a2e0890183b6ec2c54ccc07ba3c0d5c36b
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Dec 6 11:22:47 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Dec 6 17:18:49 2022 +0000

    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.kagan...@collabora.com>
    (cherry picked from commit 834f49b7e30ec9cc9bd050079b23995ad514b40c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143714
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/starmath/source/SmPanelFactory.cxx 
b/starmath/source/SmPanelFactory.cxx
index 664adbcb3bcb..f14081e87bf3 100644
--- a/starmath/source/SmPanelFactory.cxx
+++ b/starmath/source/SmPanelFactory.cxx
@@ -88,7 +88,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;

Reply via email to