[Libreoffice-commits] core.git: officecfg/registry sc/sdi sc/source sd/sdi sd/source svx/Library_svx.mk svx/sdi svx/source svx/uiconfig svx/UIConfig_svx.mk sw/sdi

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Thu May 14 06:13:28 UTC 2020


 officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu |   26 ++
 sc/sdi/drawsh.sdi                                            |    2 
 sc/source/ui/drawfunc/drawsh.cxx                             |    2 
 sd/sdi/_drvwsh.sdi                                           |    5 
 sd/source/ui/view/drviews2.cxx                               |    1 
 sd/source/ui/view/drviewsf.cxx                               |    1 
 svx/Library_svx.mk                                           |    1 
 svx/UIConfig_svx.mk                                          |    1 
 svx/sdi/svx.sdi                                              |   17 +
 svx/source/sidebar/PanelFactory.cxx                          |    5 
 svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx        |   96 +++++++++++
 svx/source/sidebar/softedge/SoftEdgePropertyPanel.hxx        |   56 ++++++
 svx/uiconfig/ui/sidebarsoftedge.ui                           |   82 +++++++++
 sw/sdi/drawsh.sdi                                            |    8 
 14 files changed, 303 insertions(+)

New commits:
commit fcb945e37dc31c11bcc3195fcbe835a63bb5bf5f
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu May 14 00:45:28 2020 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu May 14 08:12:51 2020 +0200

    tdf#49247: add sidebar panel for soft edges effect
    
    Shapes are handled in all modules; images only in draw/impress (TODO).
    
    Change-Id: Ib96eb4c36fdb69dd605f9b5a507f67a279797286
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94162
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index ddf07b32f5a2..af6acf5218a9 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -561,6 +561,32 @@
         </prop>
       </node>
 
+      <node oor:name="SoftEdgePropertyPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Soft Edge</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>SoftEdgePropertyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc,           Draw,       hidden  ;
+            DrawImpress,    Draw,       hidden  ;
+            DrawImpress,    Graphic,    hidden  ;
+            WriterVariants, Draw,       hidden  ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SvxPanelFactory/SoftEdgePropertyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>300</value>
+        </prop>
+      </node>
+
       <node oor:name="ShadowPropertyPanel" oor:op="replace">
         <prop oor:name="Title" oor:type="xs:string">
           <value xml:lang="en-US">Shadow</value>
diff --git a/sc/sdi/drawsh.sdi b/sc/sdi/drawsh.sdi
index 2a9981aa6e6f..29585cf19e69 100644
--- a/sc/sdi/drawsh.sdi
+++ b/sc/sdi/drawsh.sdi
@@ -230,6 +230,8 @@ interface TableDraw
     SID_ATTR_GLOW_RADIUS            [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
     SID_ATTR_GLOW_TRANSPARENCY      [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
 
+    SID_ATTR_SOFTEDGE_RADIUS        [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
+
 }
 
 
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index e83c87ff7e50..b8438a782758 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -392,6 +392,8 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
         case SID_ATTR_GLOW:
         case SID_ATTR_GLOW_COLOR:
         case SID_ATTR_GLOW_RADIUS:
+        case SID_ATTR_GLOW_TRANSPARENCY:
+        case SID_ATTR_SOFTEDGE_RADIUS:
             if (const SfxItemSet* pNewArgs = rReq.GetArgs())
                 pView->SetAttrToMarked(*pNewArgs, false);
             rReq.Done();
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index b1a6f641fbc8..0f155bee6b8c 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -2880,5 +2880,10 @@ interface DrawView
         ExecMethod = FuTemporary;
         StateMethod = GetAttrState;
     ]
+    SID_ATTR_SOFTEDGE_RADIUS
+    [
+        ExecMethod = FuTemporary;
+        StateMethod = GetAttrState;
+    ]
 
 }
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index d0629139d280..9fbd603f69ac 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -3474,6 +3474,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         case SID_ATTR_GLOW_COLOR:
         case SID_ATTR_GLOW_RADIUS:
         case SID_ATTR_GLOW_TRANSPARENCY:
+        case SID_ATTR_SOFTEDGE_RADIUS:
             if (const SfxItemSet* pNewArgs = rReq.GetArgs())
                 mpDrawView->SetAttributes(*pNewArgs);
             rReq.Done();
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index b58d7f344b0a..f506119ad607 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -441,6 +441,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
             case SID_ATTR_GLOW_COLOR:
             case SID_ATTR_GLOW_RADIUS:
             case SID_ATTR_GLOW_TRANSPARENCY:
+            case SID_ATTR_SOFTEDGE_RADIUS:
             case SID_SET_SUB_SCRIPT:
             case SID_SET_SUPER_SCRIPT:
             {
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index d3eff20b6769..8f8dd0c7020f 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -198,6 +198,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
     svx/source/sidebar/area/AreaPropertyPanelBase \
     svx/source/sidebar/area/AreaTransparencyGradientPopup \
     svx/source/sidebar/glow/GlowPropertyPanel \
+    svx/source/sidebar/softedge/SoftEdgePropertyPanel \
     svx/source/sidebar/shadow/ShadowPropertyPanel \
     svx/source/sidebar/graphic/GraphicPropertyPanel \
     svx/source/sidebar/line/LinePropertyPanel \
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index baec32d30a94..1a6a87cca4de 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -119,6 +119,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
 	svx/uiconfig/ui/sidebarempty \
 	svx/uiconfig/ui/sidebarglow \
 	svx/uiconfig/ui/sidebarshadow \
+	svx/uiconfig/ui/sidebarsoftedge \
 	svx/uiconfig/ui/sidebargallery \
 	svx/uiconfig/ui/sidebargraphic \
 	svx/uiconfig/ui/sidebarline \
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index e8d6cf705b71..9fdca1087273 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -12321,3 +12321,20 @@ SdrPercentItem GlowTransparency SID_ATTR_GLOW_TRANSPARENCY
     ToolBoxConfig = FALSE,
     GroupId = SfxGroupId::Document;
 ]
+
+SdrMetricItem SoftEdgeRad SID_ATTR_SOFTEDGE_RADIUS
+
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = SfxGroupId::Document;
+]
diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx
index 38e252c9b820..e37648b38c25 100644
--- a/svx/source/sidebar/PanelFactory.cxx
+++ b/svx/source/sidebar/PanelFactory.cxx
@@ -26,6 +26,7 @@
 #include "area/AreaPropertyPanel.hxx"
 #include "glow/GlowPropertyPanel.hxx"
 #include "shadow/ShadowPropertyPanel.hxx"
+#include "softedge/SoftEdgePropertyPanel.hxx"
 #include "graphic/GraphicPropertyPanel.hxx"
 #include "line/LinePropertyPanel.hxx"
 #include "possize/PosSizePropertyPanel.hxx"
@@ -147,6 +148,10 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
     {
         pControl = ShadowPropertyPanel::Create(pParentWindow, xFrame, pBindings);
     }
+    else if (rsResourceURL.endsWith("/SoftEdgePropertyPanel"))
+    {
+        pControl = SoftEdgePropertyPanel::Create(pParentWindow, xFrame, pBindings);
+    }
     else if (rsResourceURL.endsWith("/GraphicPropertyPanel"))
     {
         pControl = GraphicPropertyPanel::Create(pParentWindow, xFrame, pBindings);
diff --git a/svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx b/svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx
new file mode 100644
index 000000000000..66faf7815cca
--- /dev/null
+++ b/svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+
+#include "SoftEdgePropertyPanel.hxx"
+
+#include <sfx2/dispatch.hxx>
+#include <svx/sdmetitm.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxids.hrc>
+#include <svx/xcolit.hxx>
+
+namespace svx::sidebar
+{
+SoftEdgePropertyPanel::SoftEdgePropertyPanel(vcl::Window* pParent,
+                                             const css::uno::Reference<css::frame::XFrame>& rxFrame,
+                                             SfxBindings* pBindings)
+    : PanelLayout(pParent, "SoftEdgePropertyPanel", "svx/ui/sidebarsoftedge.ui", rxFrame)
+    , maSoftEdgeRadiusController(SID_ATTR_SOFTEDGE_RADIUS, *pBindings, *this)
+    , mpBindings(pBindings)
+    , mxSoftEdgeRadius(m_xBuilder->weld_metric_spin_button("SB_SOFTEDGE_RADIUS", FieldUnit::POINT))
+    , mxFTRadius(m_xBuilder->weld_label("radius"))
+{
+    Initialize();
+}
+
+SoftEdgePropertyPanel::~SoftEdgePropertyPanel() { disposeOnce(); }
+
+void SoftEdgePropertyPanel::dispose()
+{
+    mxFTRadius.reset();
+    mxSoftEdgeRadius.reset();
+    maSoftEdgeRadiusController.dispose();
+    PanelLayout::dispose();
+}
+
+void SoftEdgePropertyPanel::Initialize()
+{
+    mxSoftEdgeRadius->connect_value_changed(
+        LINK(this, SoftEdgePropertyPanel, ModifySoftEdgeRadiusHdl));
+}
+
+IMPL_LINK_NOARG(SoftEdgePropertyPanel, ModifySoftEdgeRadiusHdl, weld::MetricSpinButton&, void)
+{
+    SdrMetricItem aItem(SDRATTR_SOFTEDGE_RAD, mxSoftEdgeRadius->get_value(FieldUnit::MM_100TH));
+    mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_SOFTEDGE_RADIUS, SfxCallMode::RECORD,
+                                             { &aItem });
+}
+
+void SoftEdgePropertyPanel::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState eState,
+                                             const SfxPoolItem* pState)
+{
+    switch (nSID)
+    {
+        case SID_ATTR_SOFTEDGE_RADIUS:
+        {
+            if (eState >= SfxItemState::DEFAULT)
+            {
+                const SdrMetricItem* pRadiusItem = dynamic_cast<const SdrMetricItem*>(pState);
+                if (pRadiusItem)
+                {
+                    mxSoftEdgeRadius->set_value(pRadiusItem->GetValue(), FieldUnit::MM_100TH);
+                }
+            }
+        }
+        break;
+    }
+}
+
+VclPtr<vcl::Window>
+SoftEdgePropertyPanel::Create(vcl::Window* pParent,
+                              const css::uno::Reference<css::frame::XFrame>& rxFrame,
+                              SfxBindings* pBindings)
+{
+    if (pParent == nullptr)
+        throw css::lang::IllegalArgumentException(
+            "no parent Window given to SoftEdgePropertyPanel::Create", nullptr, 0);
+    if (!rxFrame.is())
+        throw css::lang::IllegalArgumentException(
+            "no XFrame given to SoftEdgePropertyPanel::Create", nullptr, 1);
+    if (pBindings == nullptr)
+        throw css::lang::IllegalArgumentException(
+            "no SfxBindings given to SoftEdgePropertyPanel::Create", nullptr, 2);
+
+    return VclPtr<SoftEdgePropertyPanel>::Create(pParent, rxFrame, pBindings);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/softedge/SoftEdgePropertyPanel.hxx b/svx/source/sidebar/softedge/SoftEdgePropertyPanel.hxx
new file mode 100644
index 000000000000..c7f3b698c0fb
--- /dev/null
+++ b/svx/source/sidebar/softedge/SoftEdgePropertyPanel.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_SOFTEDGE_SOFTEDGEPROPERTYPANEL_HXX
+#define INCLUDED_SVX_SOURCE_SIDEBAR_SOFTEDGE_SOFTEDGEPROPERTYPANEL_HXX
+
+#include <vcl/vclptr.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/PanelLayout.hxx>
+
+class ColorListBox;
+
+namespace svx::sidebar
+{
+class SoftEdgePropertyPanel : public PanelLayout,
+                              public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+public:
+    SoftEdgePropertyPanel(vcl::Window* pParent,
+                          const css::uno::Reference<css::frame::XFrame>& rxFrame,
+                          SfxBindings* pBindings);
+    virtual ~SoftEdgePropertyPanel() override;
+    virtual void dispose() override;
+
+    static VclPtr<vcl::Window> Create(vcl::Window* pParent,
+                                      const css::uno::Reference<css::frame::XFrame>& rxFrame,
+                                      SfxBindings* pBindings);
+
+    virtual void NotifyItemUpdate(const sal_uInt16 nSId, const SfxItemState eState,
+                                  const SfxPoolItem* pState) override;
+
+    virtual void GetControlState(const sal_uInt16 /*nSId*/,
+                                 boost::property_tree::ptree& /*rState*/) override{};
+
+private:
+    sfx2::sidebar::ControllerItem maSoftEdgeRadiusController;
+
+    SfxBindings* mpBindings;
+
+    std::unique_ptr<weld::MetricSpinButton> mxSoftEdgeRadius;
+    std::unique_ptr<weld::Label> mxFTRadius;
+
+    void Initialize();
+
+    DECL_LINK(ModifySoftEdgeRadiusHdl, weld::MetricSpinButton&, void);
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/uiconfig/ui/sidebarsoftedge.ui b/svx/uiconfig/ui/sidebarsoftedge.ui
new file mode 100644
index 000000000000..29b42e1bc259
--- /dev/null
+++ b/svx/uiconfig/ui/sidebarsoftedge.ui
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="svx">
+  <requires lib="gtk+" version="3.18"/>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkGrid" id="SoftEdgePropertyPanel">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkGrid" id="grid3">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="border_width">6</property>
+        <child>
+          <object class="GtkBox" id="box2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkGrid" id="grid1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <property name="row_spacing">6</property>
+                <property name="column_spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="radius">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes" context="sidebarsoftedge|radius">Radius:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">SB_SOFTEDGE_RADIUS</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="SB_SOFTEDGE_RADIUS">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="adjustment">adjustment1</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/sw/sdi/drawsh.sdi b/sw/sdi/drawsh.sdi
index 77fb87fd6e30..620227abad2d 100644
--- a/sw/sdi/drawsh.sdi
+++ b/sw/sdi/drawsh.sdi
@@ -216,6 +216,14 @@ interface TextDraw : TextDrawBase
         DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
     ]
 
+    SID_ATTR_SOFTEDGE_RADIUS
+    [
+        Export = FALSE;
+        ExecMethod = ExecDrawAttrArgs ;
+        StateMethod = GetDrawAttrState ;
+        DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+    ]
+
     SID_ATTRIBUTES_LINE
     [
         ExecMethod = ExecDrawDlg ;


More information about the Libreoffice-commits mailing list