diff options
author | andreas kainz <kainz.a@gmail.com> | 2020-10-02 13:24:17 +0200 |
---|---|---|
committer | Andreas Kainz <kainz.a@gmail.com> | 2020-10-19 13:06:01 +0200 |
commit | 55281fe6d3cda23d37b0b0c368786c9fc4c5abe9 (patch) | |
tree | 663de5f00969585fa42b8caaed2f74b147d2ed59 /svx/source | |
parent | 657ea0d1250624312e104f9acfb6a04a3ba4cce3 (diff) |
tdf#136073 combine glow and softedge sidebar section
Change-Id: I19381009f5b286b051ae0cb90a794ed51a413a7a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103835
Tested-by: Jenkins
Reviewed-by: Andreas Kainz <kainz.a@gmail.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/sidebar/PanelFactory.cxx | 11 | ||||
-rw-r--r-- | svx/source/sidebar/effect/EffectPropertyPanel.cxx (renamed from svx/source/sidebar/glow/GlowPropertyPanel.cxx) | 87 | ||||
-rw-r--r-- | svx/source/sidebar/effect/EffectPropertyPanel.hxx (renamed from svx/source/sidebar/glow/GlowPropertyPanel.hxx) | 23 | ||||
-rw-r--r-- | svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx | 96 | ||||
-rw-r--r-- | svx/source/sidebar/softedge/SoftEdgePropertyPanel.hxx | 56 |
5 files changed, 74 insertions, 199 deletions
diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx index 8f5c4d8ec4ea..1b93e207afda 100644 --- a/svx/source/sidebar/PanelFactory.cxx +++ b/svx/source/sidebar/PanelFactory.cxx @@ -24,9 +24,8 @@ #include "paragraph/ParaPropertyPanel.hxx" #include "lists/ListsPropertyPanel.hxx" #include "area/AreaPropertyPanel.hxx" -#include "glow/GlowPropertyPanel.hxx" #include "shadow/ShadowPropertyPanel.hxx" -#include "softedge/SoftEdgePropertyPanel.hxx" +#include "effect/EffectPropertyPanel.hxx" #include "graphic/GraphicPropertyPanel.hxx" #include "line/LinePropertyPanel.hxx" #include "possize/PosSizePropertyPanel.hxx" @@ -141,17 +140,13 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( { pControl = AreaPropertyPanel::Create(pParentWindow, xFrame, pBindings); } - else if (rsResourceURL.endsWith("/GlowPropertyPanel")) - { - pControl = GlowPropertyPanel::Create(pParentWindow, xFrame, pBindings); - } else if (rsResourceURL.endsWith("/ShadowPropertyPanel")) { pControl = ShadowPropertyPanel::Create(pParentWindow, xFrame, pBindings); } - else if (rsResourceURL.endsWith("/SoftEdgePropertyPanel")) + else if (rsResourceURL.endsWith("/EffectPropertyPanel")) { - pControl = SoftEdgePropertyPanel::Create(pParentWindow, xFrame, pBindings); + pControl = EffectPropertyPanel::Create(pParentWindow, xFrame, pBindings); } else if (rsResourceURL.endsWith("/GraphicPropertyPanel")) { diff --git a/svx/source/sidebar/glow/GlowPropertyPanel.cxx b/svx/source/sidebar/effect/EffectPropertyPanel.cxx index acb63e090acc..6e0ade4095cd 100644 --- a/svx/source/sidebar/glow/GlowPropertyPanel.cxx +++ b/svx/source/sidebar/effect/EffectPropertyPanel.cxx @@ -9,7 +9,7 @@ #include <sal/config.h> -#include "GlowPropertyPanel.hxx" +#include "EffectPropertyPanel.hxx" #include <sfx2/dispatch.hxx> #include <svx/colorbox.hxx> @@ -23,63 +23,78 @@ namespace svx::sidebar { -GlowPropertyPanel::GlowPropertyPanel(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings) - : PanelLayout(pParent, "GlowPropertyPanel", "svx/ui/sidebarglow.ui", rxFrame) +EffectPropertyPanel::EffectPropertyPanel(vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) + : PanelLayout(pParent, "EffectPropertyPanel", "svx/ui/sidebareffect.ui", rxFrame) , maGlowColorController(SID_ATTR_GLOW_COLOR, *pBindings, *this) , maGlowRadiusController(SID_ATTR_GLOW_RADIUS, *pBindings, *this) , maGlowTransparencyController(SID_ATTR_GLOW_TRANSPARENCY, *pBindings, *this) + , mxFTTransparency(m_xBuilder->weld_label("transparency")) + , maSoftEdgeRadiusController(SID_ATTR_SOFTEDGE_RADIUS, *pBindings, *this) , mpBindings(pBindings) , mxGlowRadius(m_xBuilder->weld_metric_spin_button("LB_GLOW_RADIUS", FieldUnit::POINT)) , mxLBGlowColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_GLOW_COLOR"), GetFrameWeld())) , mxGlowTransparency( m_xBuilder->weld_metric_spin_button("LB_GLOW_TRANSPARENCY", FieldUnit::PERCENT)) - , mxFTRadius(m_xBuilder->weld_label("radius")) + , mxFTRadiusSoftEdge(m_xBuilder->weld_label("radiussoftedge")) + , mxFTRadiusGlow(m_xBuilder->weld_label("radiusglow")) , mxFTColor(m_xBuilder->weld_label("color")) - , mxFTTransparency(m_xBuilder->weld_label("transparency")) + , mxSoftEdgeRadius(m_xBuilder->weld_metric_spin_button("SB_SOFTEDGE_RADIUS", FieldUnit::POINT)) { Initialize(); } -GlowPropertyPanel::~GlowPropertyPanel() { disposeOnce(); } +EffectPropertyPanel::~EffectPropertyPanel() { disposeOnce(); } -void GlowPropertyPanel::dispose() +void EffectPropertyPanel::dispose() { - mxFTRadius.reset(); mxGlowRadius.reset(); - mxFTColor.reset(); mxLBGlowColor.reset(); - mxFTTransparency.reset(); mxGlowTransparency.reset(); + mxFTRadiusSoftEdge.reset(); + mxFTColor.reset(); + mxFTTransparency.reset(); + mxSoftEdgeRadius.reset(); + mxFTRadiusGlow.reset(); + PanelLayout::dispose(); maGlowColorController.dispose(); maGlowRadiusController.dispose(); maGlowTransparencyController.dispose(); - PanelLayout::dispose(); + maSoftEdgeRadiusController.dispose(); } -void GlowPropertyPanel::Initialize() +void EffectPropertyPanel::Initialize() { - mxLBGlowColor->SetSelectHdl(LINK(this, GlowPropertyPanel, ModifyGlowColorHdl)); - mxGlowRadius->connect_value_changed(LINK(this, GlowPropertyPanel, ModifyGlowRadiusHdl)); + mxGlowRadius->connect_value_changed(LINK(this, EffectPropertyPanel, ModifyGlowRadiusHdl)); + mxLBGlowColor->SetSelectHdl(LINK(this, EffectPropertyPanel, ModifyGlowColorHdl)); mxGlowTransparency->connect_value_changed( - LINK(this, GlowPropertyPanel, ModifyGlowTransparencyHdl)); + LINK(this, EffectPropertyPanel, ModifyGlowTransparencyHdl)); + mxSoftEdgeRadius->connect_value_changed( + LINK(this, EffectPropertyPanel, ModifySoftEdgeRadiusHdl)); +} + +IMPL_LINK_NOARG(EffectPropertyPanel, ModifySoftEdgeRadiusHdl, weld::MetricSpinButton&, void) +{ + SdrMetricItem aItem(SDRATTR_SOFTEDGE_RADIUS, mxSoftEdgeRadius->get_value(FieldUnit::MM_100TH)); + mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_SOFTEDGE_RADIUS, SfxCallMode::RECORD, + { &aItem }); } -IMPL_LINK_NOARG(GlowPropertyPanel, ModifyGlowColorHdl, ColorListBox&, void) +IMPL_LINK_NOARG(EffectPropertyPanel, ModifyGlowColorHdl, ColorListBox&, void) { XColorItem aItem(SDRATTR_GLOW_COLOR, mxLBGlowColor->GetSelectEntryColor()); mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_GLOW_COLOR, SfxCallMode::RECORD, { &aItem }); } -IMPL_LINK_NOARG(GlowPropertyPanel, ModifyGlowRadiusHdl, weld::MetricSpinButton&, void) +IMPL_LINK_NOARG(EffectPropertyPanel, ModifyGlowRadiusHdl, weld::MetricSpinButton&, void) { SdrMetricItem aItem(SDRATTR_GLOW_RADIUS, mxGlowRadius->get_value(FieldUnit::MM_100TH)); mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_GLOW_RADIUS, SfxCallMode::RECORD, { &aItem }); } -IMPL_LINK_NOARG(GlowPropertyPanel, ModifyGlowTransparencyHdl, weld::MetricSpinButton&, void) +IMPL_LINK_NOARG(EffectPropertyPanel, ModifyGlowTransparencyHdl, weld::MetricSpinButton&, void) { SdrPercentItem aItem(SDRATTR_GLOW_TRANSPARENCY, mxGlowTransparency->get_value(FieldUnit::PERCENT)); @@ -87,7 +102,7 @@ IMPL_LINK_NOARG(GlowPropertyPanel, ModifyGlowTransparencyHdl, weld::MetricSpinBu { &aItem }); } -void GlowPropertyPanel::UpdateControls() +void EffectPropertyPanel::UpdateControls() { const bool bEnabled = mxGlowRadius->get_value(FieldUnit::MM_100TH) != 0; mxLBGlowColor->set_sensitive(bEnabled); @@ -96,11 +111,23 @@ void GlowPropertyPanel::UpdateControls() mxFTTransparency->set_sensitive(bEnabled); } -void GlowPropertyPanel::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState) +void EffectPropertyPanel::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; case SID_ATTR_GLOW_COLOR: { if (eState >= SfxItemState::DEFAULT) @@ -141,21 +168,21 @@ void GlowPropertyPanel::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState eState, } VclPtr<vcl::Window> -GlowPropertyPanel::Create(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings) +EffectPropertyPanel::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 GlowPropertyPanel::Create", nullptr, 0); + "no parent Window given to EffectPropertyPanel::Create", nullptr, 0); if (!rxFrame.is()) - throw css::lang::IllegalArgumentException("no XFrame given to GlowPropertyPanel::Create", + throw css::lang::IllegalArgumentException("no XFrame given to EffectPropertyPanel::Create", nullptr, 1); if (pBindings == nullptr) throw css::lang::IllegalArgumentException( - "no SfxBindings given to GlowPropertyPanel::Create", nullptr, 2); + "no SfxBindings given to EffectPropertyPanel::Create", nullptr, 2); - return VclPtr<GlowPropertyPanel>::Create(pParent, rxFrame, pBindings); + return VclPtr<EffectPropertyPanel>::Create(pParent, rxFrame, pBindings); } } diff --git a/svx/source/sidebar/glow/GlowPropertyPanel.hxx b/svx/source/sidebar/effect/EffectPropertyPanel.hxx index aaffa44e4b20..771c642f99a2 100644 --- a/svx/source/sidebar/glow/GlowPropertyPanel.hxx +++ b/svx/source/sidebar/effect/EffectPropertyPanel.hxx @@ -6,8 +6,8 @@ * 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_GLOW_GLOWPROPERTYPANEL_HXX -#define INCLUDED_SVX_SOURCE_SIDEBAR_GLOW_GLOWPROPERTYPANEL_HXX +#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_EFFECT_EFFECTPROPERTYPANEL_HXX +#define INCLUDED_SVX_SOURCE_SIDEBAR_EFFECT_EFFECTPROPERTYPANEL_HXX #include <vcl/vclptr.hxx> #include <sfx2/sidebar/ControllerItem.hxx> @@ -17,13 +17,14 @@ class ColorListBox; namespace svx::sidebar { -class GlowPropertyPanel : public PanelLayout, - public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +class EffectPropertyPanel : public PanelLayout, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - GlowPropertyPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings); - virtual ~GlowPropertyPanel() override; + EffectPropertyPanel(vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~EffectPropertyPanel() override; virtual void dispose() override; static VclPtr<vcl::Window> Create(vcl::Window* pParent, @@ -40,15 +41,18 @@ private: sfx2::sidebar::ControllerItem maGlowColorController; sfx2::sidebar::ControllerItem maGlowRadiusController; sfx2::sidebar::ControllerItem maGlowTransparencyController; + std::unique_ptr<weld::Label> mxFTTransparency; + sfx2::sidebar::ControllerItem maSoftEdgeRadiusController; SfxBindings* mpBindings; std::unique_ptr<weld::MetricSpinButton> mxGlowRadius; std::unique_ptr<ColorListBox> mxLBGlowColor; std::unique_ptr<weld::MetricSpinButton> mxGlowTransparency; - std::unique_ptr<weld::Label> mxFTRadius; + std::unique_ptr<weld::Label> mxFTRadiusSoftEdge; + std::unique_ptr<weld::Label> mxFTRadiusGlow; std::unique_ptr<weld::Label> mxFTColor; - std::unique_ptr<weld::Label> mxFTTransparency; + std::unique_ptr<weld::MetricSpinButton> mxSoftEdgeRadius; void Initialize(); void UpdateControls(); @@ -56,6 +60,7 @@ private: DECL_LINK(ModifyGlowColorHdl, ColorListBox&, void); DECL_LINK(ModifyGlowRadiusHdl, weld::MetricSpinButton&, void); DECL_LINK(ModifyGlowTransparencyHdl, weld::MetricSpinButton&, void); + DECL_LINK(ModifySoftEdgeRadiusHdl, weld::MetricSpinButton&, void); }; } diff --git a/svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx b/svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx deleted file mode 100644 index 35511498fe44..000000000000 --- a/svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- 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_RADIUS, 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 deleted file mode 100644 index c7f3b698c0fb..000000000000 --- a/svx/source/sidebar/softedge/SoftEdgePropertyPanel.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- 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: */ |