summaryrefslogtreecommitdiff
path: root/svx/source/sidebar
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-05-14 00:45:28 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-05-14 08:12:51 +0200
commitfcb945e37dc31c11bcc3195fcbe835a63bb5bf5f (patch)
treef72b906d55ef58bfe4d448479c81f23393fff316 /svx/source/sidebar
parent188aa42a252beced65c2157e344b64b9657f6eda (diff)
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@collabora.com>
Diffstat (limited to 'svx/source/sidebar')
-rw-r--r--svx/source/sidebar/PanelFactory.cxx5
-rw-r--r--svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx96
-rw-r--r--svx/source/sidebar/softedge/SoftEdgePropertyPanel.hxx56
3 files changed, 157 insertions, 0 deletions
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: */