[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - include/svx svx/source vcl/jsdialog

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 29 09:13:56 UTC 2021


 include/svx/sidebar/LineWidthPopup.hxx     |    8 ++++----
 svx/source/sidebar/line/LineWidthPopup.cxx |    9 +++------
 vcl/jsdialog/jsdialogbuilder.cxx           |    5 ++++-
 3 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 226501218cbb91ec0d262b190e0d2e5d873aa6bc
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jun 28 15:38:32 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jun 29 11:13:21 2021 +0200

    sidebar: unify LineWidthPopup with other WeldToolbarPopups
    
    Change-Id: I9dd0d2b223972683a9066f0069e055175349526f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118023
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/svx/sidebar/LineWidthPopup.hxx b/include/svx/sidebar/LineWidthPopup.hxx
index d16f49b60389..262f3540941b 100644
--- a/include/svx/sidebar/LineWidthPopup.hxx
+++ b/include/svx/sidebar/LineWidthPopup.hxx
@@ -23,6 +23,7 @@
 #include <vcl/customweld.hxx>
 #include <vcl/image.hxx>
 #include <vcl/weld.hxx>
+#include <svtools/toolbarmenu.hxx>
 #include <array>
 
 class ValueSet;
@@ -32,7 +33,7 @@ namespace svx::sidebar
 class LinePropertyPanelBase;
 class LineWidthValueSet;
 
-class LineWidthPopup final
+class LineWidthPopup final : public WeldToolbarPopup
 {
 public:
     LineWidthPopup(weld::Widget* pParent, LinePropertyPanelBase& rParent);
@@ -42,6 +43,8 @@ public:
 
     weld::Container* getTopLevel() const { return m_xTopLevel.get(); }
 
+    virtual void GrabFocus() override;
+
 private:
     LinePropertyPanelBase& m_rParent;
     std::array<OUString, 9> maStrUnits;
@@ -53,15 +56,12 @@ private:
     Image m_aIMGCus;
     Image m_aIMGCusGray;
 
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Container> m_xTopLevel;
     std::unique_ptr<weld::MetricSpinButton> m_xMFWidth;
     std::unique_ptr<LineWidthValueSet> m_xVSWidth;
     std::unique_ptr<weld::CustomWeld> m_xVSWidthWin;
 
     DECL_LINK(VSSelectHdl, ValueSet*, void);
     DECL_LINK(MFModifyHdl, weld::MetricSpinButton&, void);
-    DECL_LINK(FocusHdl, weld::Widget&, void);
 };
 
 } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx b/svx/source/sidebar/line/LineWidthPopup.cxx
index 6cd19ce7305c..347bb2a3bb8d 100644
--- a/svx/source/sidebar/line/LineWidthPopup.cxx
+++ b/svx/source/sidebar/line/LineWidthPopup.cxx
@@ -32,7 +32,8 @@
 namespace svx::sidebar
 {
 LineWidthPopup::LineWidthPopup(weld::Widget* pParent, LinePropertyPanelBase& rParent)
-    : m_rParent(rParent)
+    : WeldToolbarPopup(nullptr, pParent, "svx/ui/floatinglineproperty.ui", "FloatingLineProperty")
+    , m_rParent(rParent)
     , m_sPt(SvxResId(RID_SVXSTR_PT))
     , m_eMapUnit(MapUnit::MapTwip)
     , m_bVSFocus(true)
@@ -40,14 +41,10 @@ LineWidthPopup::LineWidthPopup(weld::Widget* pParent, LinePropertyPanelBase& rPa
     , m_nCustomWidth(0)
     , m_aIMGCus(StockImage::Yes, RID_SVXBMP_WIDTH_CUSTOM)
     , m_aIMGCusGray(StockImage::Yes, RID_SVXBMP_WIDTH_CUSTOM_GRAY)
-    , m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/floatinglineproperty.ui"))
-    , m_xTopLevel(m_xBuilder->weld_container("FloatingLineProperty"))
     , m_xMFWidth(m_xBuilder->weld_metric_spin_button("spin", FieldUnit::POINT))
     , m_xVSWidth(new LineWidthValueSet())
     , m_xVSWidthWin(new weld::CustomWeld(*m_xBuilder, "lineset", *m_xVSWidth))
 {
-    m_xTopLevel->connect_focus_in(LINK(this, LineWidthPopup, FocusHdl));
-
     m_xVSWidth->SetStyle(m_xVSWidth->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT);
 
     maStrUnits[0] = "0.5";
@@ -213,7 +210,7 @@ void LineWidthPopup::SetWidthSelect(tools::Long lValue, bool bValuable, MapUnit
     m_xVSWidth->Invalidate();
 }
 
-IMPL_LINK_NOARG(LineWidthPopup, FocusHdl, weld::Widget&, void)
+void LineWidthPopup::GrabFocus()
 {
     if (m_bVSFocus)
         m_xVSWidth->GrabFocus();
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 7e42f40f421c..610f24045a33 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -223,6 +223,9 @@ JSDialogNotifyIdle::generatePopupMessage(VclPtr<vcl::Window> pWindow, OUString s
     if (!pWindow || !m_aNotifierWindow)
         return aJsonWriter;
 
+    if (!pWindow->GetParentWithLOKNotifier())
+        return aJsonWriter;
+
     pWindow->DumpAsPropertyTree(*aJsonWriter);
 
     aJsonWriter->put("jsontype", "dialog");
@@ -230,7 +233,7 @@ JSDialogNotifyIdle::generatePopupMessage(VclPtr<vcl::Window> pWindow, OUString s
     aJsonWriter->put("cancellable", true);
     aJsonWriter->put("popupParent", sParentId);
     aJsonWriter->put("clickToClose", sCloseId);
-    aJsonWriter->put("id", pWindow->GetLOKWindowId());
+    aJsonWriter->put("id", pWindow->GetParentWithLOKNotifier()->GetLOKWindowId());
 
     return aJsonWriter;
 }


More information about the Libreoffice-commits mailing list