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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 6 10:24:59 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/inc/jsdialog/jsdialogbuilder.hxx                      |    1 
 vcl/jsdialog/enabled.cxx                                  |    3 -
 vcl/jsdialog/jsdialogbuilder.cxx                          |    6 ++
 vcl/source/window/toolbox2.cxx                            |   15 ++++++
 9 files changed, 49 insertions(+), 25 deletions(-)

New commits:
commit bf9e72399e65ec6fc2a9149fa2ba884732362bd8
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: Tue Jul 6 12:24:31 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>

diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx b/include/svx/sidebar/AreaPropertyPanelBase.hxx
index 434a6397d4e2..aad33abdcc72 100644
--- a/include/svx/sidebar/AreaPropertyPanelBase.hxx
+++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx
@@ -98,6 +98,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 ffcaf142d012..a52dfd10d245 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -64,6 +64,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),
@@ -178,7 +179,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 38bee8043cd6..0d0e0813c758 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -70,7 +70,8 @@ bool isBuilderEnabledForPopup(const OUString& rUIFile)
         || rUIFile == "svx/ui/paralinespacingcontrol.ui"
         || rUIFile == "svx/ui/floatinglineproperty.ui" || rUIFile == "svx/ui/floatinglinestyle.ui"
         || rUIFile == "svx/ui/floatinglineend.ui" || rUIFile == "svx/ui/fontworkalignmentcontrol.ui"
-        || rUIFile == "svx/ui/fontworkcharacterspacingcontrol.ui")
+        || rUIFile == "svx/ui/fontworkcharacterspacingcontrol.ui"
+        || rUIFile == "svx/ui/floatingareastyle.ui")
         return true;
 
     return false;
commit 19fd857529a5be4d983a1dfca63a2f6d5bce592f
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jul 6 11:50:38 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jul 6 12:24:20 2021 +0200

    jsdialog: dump image for toolitems
    
    Change-Id: If47eb57cc18c6f04e5b2e3a14a6bcea657e03df8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118472
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index f80d8fad9f1a..2bcee8777ea0 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -566,6 +566,7 @@ public:
 
     virtual void set_menu_item_active(const OString& rIdent, bool bActive) override;
     virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override;
+    virtual void set_item_icon_name(const OString& rIdent, const OUString& rIconName) override;
 };
 
 class JSTextView : public JSWidget<SalInstanceTextView, ::VclMultiLineEdit>
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 023ed09f81f6..4b19764d8031 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1388,6 +1388,12 @@ void JSToolbar::set_item_sensitive(const OString& rIdent, bool bSensitive)
     sendUpdate();
 }
 
+void JSToolbar::set_item_icon_name(const OString& rIdent, const OUString& rIconName)
+{
+    SalInstanceToolbar::set_item_icon_name(rIdent, rIconName);
+    sendUpdate();
+}
+
 JSTextView::JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView,
                        SalInstanceBuilder* pBuilder, bool bTakeOwnership)
     : JSWidget<SalInstanceTextView, ::VclMultiLineEdit>(pSender, pTextView, pBuilder,
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index cee2d7dfadbf..2781c3897063 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -21,9 +21,11 @@
 #include <vcl/uitest/logger.hxx>
 #include <sal/log.hxx>
 
+#include <comphelper/base64.hxx>
 #include <comphelper/processfactory.hxx>
 #include <boost/property_tree/ptree.hpp>
 
+#include <vcl/cvtgrf.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/idle.hxx>
 #include <vcl/bitmap.hxx>
@@ -1756,6 +1758,19 @@ void ToolBox::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
                     rJsonWriter.put("dropdown", true);
                 if (!IsItemEnabled(nId))
                     rJsonWriter.put("enabled", false);
+
+                Image aImage = GetItemImage(nId);
+                if (!!aImage)
+                {
+                    SvMemoryStream aOStm(6535, 6535);
+                    if(GraphicConverter::Export(aOStm, aImage.GetBitmapEx(), ConvertDataFormat::PNG) == ERRCODE_NONE)
+                    {
+                        css::uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aOStm.GetData()), aOStm.Tell());
+                        OUStringBuffer aBuffer("data:image/png;base64,");
+                        ::comphelper::Base64::encode(aBuffer, aSeq);
+                        rJsonWriter.put("image", aBuffer.makeStringAndClear());
+                    }
+                }
             }
         }
     }


More information about the Libreoffice-commits mailing list