[Libreoffice-commits] core.git: include/svx svx/source svx/uiconfig vcl/jsdialog

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 20 07:31:17 UTC 2021


 include/svx/sidebar/AreaPropertyPanelBase.hxx             |    2 
 include/svx/sidebar/AreaTransparencyGradientPopup.hxx     |   11 ++--
 svx/source/sidebar/area/AreaPropertyPanelBase.cxx         |    3 -
 svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx |   31 ++++++--------
 svx/uiconfig/ui/floatingareastyle.ui                      |    2 
 vcl/jsdialog/enabled.cxx                                  |    3 -
 6 files changed, 27 insertions(+), 25 deletions(-)

New commits:
commit e5a7a65e59fcd300834e5a7d20b797dedbeb6b69
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jul 6 11:40:07 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Aug 20 09:30:38 2021 +0200

    Convert AreaTransparencyGradientPopup to WeldToolbarPopup
    
    Change-Id: I3cbb17de9953281e884f6c1b2984bc4865a56227
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118471
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120700
    Tested-by: Jenkins

diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx b/include/svx/sidebar/AreaPropertyPanelBase.hxx
index 4885810fa623..802ac2857d28 100644
--- a/include/svx/sidebar/AreaPropertyPanelBase.hxx
+++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx
@@ -97,6 +97,8 @@ private:
     void Initialize();
 
 protected:
+    const css::uno::Reference<css::frame::XFrame>&      mxFrame;
+
     sal_uInt16                                          meLastXFS;
 
     sal_Int32                                           mnLastPosHatch;
diff --git a/include/svx/sidebar/AreaTransparencyGradientPopup.hxx b/include/svx/sidebar/AreaTransparencyGradientPopup.hxx
index 2f5dcedec5c6..04b8fa91a8b6 100644
--- a/include/svx/sidebar/AreaTransparencyGradientPopup.hxx
+++ b/include/svx/sidebar/AreaTransparencyGradientPopup.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTPOPUP_HXX
 
 #include <vcl/weld.hxx>
+#include <svtools/toolbarmenu.hxx>
 
 class XFillFloatTransparenceItem;
 
@@ -28,12 +29,10 @@ namespace svx::sidebar
 class AreaTransparencyGradientControl;
 class AreaPropertyPanelBase;
 
-class AreaTransparencyGradientPopup final
+class AreaTransparencyGradientPopup final : public WeldToolbarPopup
 {
 private:
     AreaPropertyPanelBase& mrAreaPropertyPanel;
-    std::unique_ptr<weld::Builder> mxBuilder;
-    std::unique_ptr<weld::Container> mxTopLevel;
     std::unique_ptr<weld::Widget> mxCenterGrid;
     std::unique_ptr<weld::Widget> mxAngleGrid;
     std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrCenterX;
@@ -53,12 +52,12 @@ private:
     DECL_LINK(FocusHdl, weld::Widget&, void);
 
 public:
-    AreaTransparencyGradientPopup(AreaPropertyPanelBase& rPanel, weld::Widget* pParent);
+    AreaTransparencyGradientPopup(const css::uno::Reference<css::frame::XFrame>& rFrame,
+                                  AreaPropertyPanelBase& rPanel, weld::Widget* pParent);
     ~AreaTransparencyGradientPopup();
 
-    weld::Container* getTopLevel() const { return mxTopLevel.get(); }
-
     void Rearrange(XFillFloatTransparenceItem const* pItem);
+    virtual void GrabFocus() override;
 };
 
 } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index c04eb8cc8ebe..da8eba0a49e7 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -65,6 +65,7 @@ AreaPropertyPanelBase::AreaPropertyPanelBase(
     weld::Widget* pParent,
     const css::uno::Reference<css::frame::XFrame>& rxFrame)
     : PanelLayout(pParent, "AreaPropertyPanel", "svx/ui/sidebararea.ui"),
+      mxFrame(rxFrame),
       meLastXFS(static_cast<sal_uInt16>(-1)),
       mnLastPosHatch(0),
       mnLastPosBitmap(0),
@@ -179,7 +180,7 @@ void AreaPropertyPanelBase::Initialize()
     mxMTRTransparent->connect_value_changed(LINK(this, AreaPropertyPanelBase, ModifyTransparentHdl_Impl));
     mxSldTransparent->connect_value_changed(LINK(this, AreaPropertyPanelBase, ModifyTransSliderHdl));
 
-    mxTrGrPopup = std::make_unique<AreaTransparencyGradientPopup>(*this, mxBTNGradient.get());
+    mxTrGrPopup = std::make_unique<AreaTransparencyGradientPopup>(mxFrame, *this, mxBTNGradient.get());
 
     mxBTNGradient->set_item_popover(SIDEBARGRADIENT, mxTrGrPopup->getTopLevel());
     mxBTNGradient->connect_clicked(LINK(this, AreaPropertyPanelBase, ToolbarHdl_Impl));
diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
index 7c4a8dc59962..581d302a9d7d 100644
--- a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
+++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
@@ -25,20 +25,20 @@
 
 namespace svx::sidebar {
 
-AreaTransparencyGradientPopup::AreaTransparencyGradientPopup(AreaPropertyPanelBase& rPanel, weld::Widget* pParent)
-    : mrAreaPropertyPanel(rPanel)
-    , mxBuilder(Application::CreateBuilder(pParent, "svx/ui/floatingareastyle.ui"))
-    , mxTopLevel(mxBuilder->weld_container("FloatingAreaStyle"))
-    , mxCenterGrid(mxBuilder->weld_widget("centergrid"))
-    , mxAngleGrid(mxBuilder->weld_widget("anglegrid"))
-    , mxMtrTrgrCenterX(mxBuilder->weld_metric_spin_button("centerx", FieldUnit::PERCENT))
-    , mxMtrTrgrCenterY(mxBuilder->weld_metric_spin_button("centery", FieldUnit::PERCENT))
-    , mxMtrTrgrAngle(mxBuilder->weld_metric_spin_button("angle", FieldUnit::DEGREE))
-    , mxBtnLeft45(mxBuilder->weld_toolbar("lefttoolbox"))
-    , mxBtnRight45(mxBuilder->weld_toolbar("righttoolbox"))
-    , mxMtrTrgrStartValue(mxBuilder->weld_metric_spin_button("start", FieldUnit::PERCENT))
-    , mxMtrTrgrEndValue(mxBuilder->weld_metric_spin_button("end", FieldUnit::PERCENT))
-    , mxMtrTrgrBorder(mxBuilder->weld_metric_spin_button("border", FieldUnit::PERCENT))
+AreaTransparencyGradientPopup::AreaTransparencyGradientPopup(const css::uno::Reference<css::frame::XFrame>& rFrame,
+                                            AreaPropertyPanelBase& rPanel, weld::Widget* pParent)
+    : WeldToolbarPopup(rFrame, pParent, "svx/ui/floatingareastyle.ui", "FloatingAreaStyle")
+    , mrAreaPropertyPanel(rPanel)
+    , mxCenterGrid(m_xBuilder->weld_widget("centergrid"))
+    , mxAngleGrid(m_xBuilder->weld_widget("anglegrid"))
+    , mxMtrTrgrCenterX(m_xBuilder->weld_metric_spin_button("centerx", FieldUnit::PERCENT))
+    , mxMtrTrgrCenterY(m_xBuilder->weld_metric_spin_button("centery", FieldUnit::PERCENT))
+    , mxMtrTrgrAngle(m_xBuilder->weld_metric_spin_button("angle", FieldUnit::DEGREE))
+    , mxBtnLeft45(m_xBuilder->weld_toolbar("lefttoolbox"))
+    , mxBtnRight45(m_xBuilder->weld_toolbar("righttoolbox"))
+    , mxMtrTrgrStartValue(m_xBuilder->weld_metric_spin_button("start", FieldUnit::PERCENT))
+    , mxMtrTrgrEndValue(m_xBuilder->weld_metric_spin_button("end", FieldUnit::PERCENT))
+    , mxMtrTrgrBorder(m_xBuilder->weld_metric_spin_button("border", FieldUnit::PERCENT))
 {
     Link<weld::MetricSpinButton&,void> aLink = LINK(this, AreaTransparencyGradientPopup, ModifiedTrgrHdl_Impl);
     mxMtrTrgrCenterX->connect_value_changed(aLink);
@@ -49,7 +49,6 @@ AreaTransparencyGradientPopup::AreaTransparencyGradientPopup(AreaPropertyPanelBa
     mxMtrTrgrEndValue->connect_value_changed(aLink);
     mxBtnLeft45->connect_clicked(LINK(this, AreaTransparencyGradientPopup, Left_Click45_Impl));
     mxBtnRight45->connect_clicked(LINK(this, AreaTransparencyGradientPopup, Right_Click45_Impl));
-    mxTopLevel->connect_focus_in(LINK(this, AreaTransparencyGradientPopup, FocusHdl));
 }
 
 AreaTransparencyGradientPopup::~AreaTransparencyGradientPopup()
@@ -171,7 +170,7 @@ IMPL_LINK_NOARG(AreaTransparencyGradientPopup, Right_Click45_Impl, const OString
     ExecuteValueModify(nStartCol, nEndCol);
 }
 
-IMPL_LINK_NOARG(AreaTransparencyGradientPopup, FocusHdl, weld::Widget&, void)
+void AreaTransparencyGradientPopup::GrabFocus()
 {
     mxMtrTrgrCenterX->grab_focus();
 }
diff --git a/svx/uiconfig/ui/floatingareastyle.ui b/svx/uiconfig/ui/floatingareastyle.ui
index dd28a22180e0..3e59313ef137 100644
--- a/svx/uiconfig/ui/floatingareastyle.ui
+++ b/svx/uiconfig/ui/floatingareastyle.ui
@@ -38,7 +38,7 @@
     <property name="border_width">4</property>
     <child>
       <!-- n-columns=1 n-rows=1 -->
-      <object class="GtkGrid">
+      <object class="GtkGrid" id="container">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="hexpand">True</property>
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index e7afb364c24d..b32f9a01d672 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -70,7 +70,8 @@ bool isBuilderEnabledForPopup(std::u16string_view rUIFile)
         || rUIFile == u"svx/ui/floatinglineproperty.ui" || rUIFile == u"svx/ui/floatinglinestyle.ui"
         || rUIFile == u"svx/ui/floatinglineend.ui"
         || rUIFile == u"svx/ui/fontworkalignmentcontrol.ui"
-        || rUIFile == u"svx/ui/fontworkcharacterspacingcontrol.ui")
+        || rUIFile == u"svx/ui/fontworkcharacterspacingcontrol.ui"
+        || rUIFile == u"svx/ui/floatingareastyle.ui")
         return true;
 
     return false;


More information about the Libreoffice-commits mailing list