summaryrefslogtreecommitdiff
path: root/svx/source/sidebar/shadow
diff options
context:
space:
mode:
authorA_GAN <ganzouri97@gmail.com>2020-07-14 12:42:30 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-07-17 10:19:07 +0200
commit710edb329fe73433f17e81839313ac9551a4aec4 (patch)
tree85669e9d007c33e27a853091cbeb6e77df8cd6e2 /svx/source/sidebar/shadow
parent457ffe960dfdbd0200292ad9c9835d947dd35c73 (diff)
Add UI for blur radius in shadow panel
Update shadow property panel with spin button to control blur radius of the shadow. Change-Id: I5856e86a7963682c81d9e53a1bef857aba2f3c21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98718 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx/source/sidebar/shadow')
-rw-r--r--svx/source/sidebar/shadow/ShadowPropertyPanel.cxx35
-rw-r--r--svx/source/sidebar/shadow/ShadowPropertyPanel.hxx4
2 files changed, 37 insertions, 2 deletions
diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx
index 4fec06b5bcc5..0d69afa1520e 100644
--- a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx
+++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx
@@ -34,6 +34,7 @@ ShadowPropertyPanel::ShadowPropertyPanel(
: PanelLayout(pParent, "ShadowPropertyPanel", "svx/ui/sidebarshadow.ui", rxFrame),
maShadowController(SID_ATTR_FILL_SHADOW, *pBindings, *this),
maShadowTransController(SID_ATTR_SHADOW_TRANSPARENCE, *pBindings, *this),
+ maShadowBlurController(SID_ATTR_SHADOW_BLUR, *pBindings, *this),
maShadowColorController(SID_ATTR_SHADOW_COLOR, *pBindings, *this),
maShadowXDistanceController(SID_ATTR_SHADOW_XDISTANCE, *pBindings, *this),
maShadowYDistanceController(SID_ATTR_SHADOW_YDISTANCE, *pBindings, *this),
@@ -48,9 +49,11 @@ ShadowPropertyPanel::ShadowPropertyPanel(
mxFTAngle(m_xBuilder->weld_label("angle")),
mxFTDistance(m_xBuilder->weld_label("distance")),
mxFTTransparency(m_xBuilder->weld_label("transparency_label")),
+ mxFTBlur(m_xBuilder->weld_label("blur_label")),
mxFTColor(m_xBuilder->weld_label("color")),
mxShadowTransSlider(m_xBuilder->weld_scale("transparency_slider")),
- mxShadowTransMetric(m_xBuilder->weld_metric_spin_button("FIELD_TRANSPARENCY", FieldUnit::PERCENT))
+ mxShadowTransMetric(m_xBuilder->weld_metric_spin_button("FIELD_TRANSPARENCY", FieldUnit::PERCENT)),
+ mxShadowBlurMetric(m_xBuilder->weld_metric_spin_button("LB_SHADOW_BLUR", FieldUnit::POINT))
{
Initialize();
}
@@ -70,11 +73,14 @@ void ShadowPropertyPanel::dispose()
mxFTTransparency.reset();
mxShadowTransSlider.reset();
mxShadowTransMetric.reset();
+ mxShadowBlurMetric.reset();
+ mxFTBlur.reset();
mxFTColor.reset();
mxLBShadowColor.reset();
maShadowController.dispose();
maShadowTransController.dispose();
+ maShadowBlurController.dispose();
maShadowColorController.dispose();
maShadowXDistanceController.dispose();
maShadowYDistanceController.dispose();
@@ -91,6 +97,8 @@ void ShadowPropertyPanel::Initialize()
mxShadowDistance->connect_value_changed( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) );
mxShadowTransSlider->set_range(0, 100);
mxShadowTransSlider->connect_value_changed( LINK(this, ShadowPropertyPanel, ModifyShadowTransSliderHdl) );
+ mxShadowBlurMetric->set_range(0, 150, FieldUnit::POINT);
+ mxShadowBlurMetric->connect_value_changed(LINK(this, ShadowPropertyPanel, ModifyShadowBlurMetricHdl));
InsertAngleValues();
}
@@ -126,6 +134,13 @@ IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowTransMetricHdl, weld::MetricSpi
SfxCallMode::RECORD, { &aItem });
}
+IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowBlurMetricHdl, weld::MetricSpinButton&, void)
+{
+ SdrMetricItem aItem(SDRATTR_SHADOWBLUR, mxShadowBlurMetric->get_value(FieldUnit::MM_100TH));
+
+ mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_SHADOW_BLUR, SfxCallMode::RECORD, { &aItem });
+}
+
IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowTransSliderHdl, weld::Scale&, void)
{
sal_uInt16 nVal = mxShadowTransSlider->get_value();
@@ -178,9 +193,12 @@ void ShadowPropertyPanel::UpdateControls()
mxFTAngle->set_sensitive(false);
mxFTDistance->set_sensitive(false);
mxFTTransparency->set_sensitive(false);
+ mxFTBlur->set_sensitive(false);
mxFTColor->set_sensitive(false);
mxShadowTransSlider->set_sensitive(false);
mxShadowTransMetric->set_sensitive(false);
+ mxShadowBlurMetric->set_sensitive(false);
+
return;
}
else
@@ -191,9 +209,11 @@ void ShadowPropertyPanel::UpdateControls()
mxFTAngle->set_sensitive(true);
mxFTDistance->set_sensitive(true);
mxFTTransparency->set_sensitive(true);
+ mxFTBlur->set_sensitive(true);
mxFTColor->set_sensitive(true);
mxShadowTransSlider->set_sensitive(true);
mxShadowTransMetric->set_sensitive(true);
+ mxShadowBlurMetric->set_sensitive(true);
}
if(nX > 0 && nY == 0) { mxShadowAngle->set_active(0); nXY = nX; }
@@ -274,7 +294,18 @@ void ShadowPropertyPanel::NotifyItemUpdate(
}
}
break;
-
+ case SID_ATTR_SHADOW_BLUR:
+ {
+ if (eState >= SfxItemState::DEFAULT)
+ {
+ const SdrMetricItem* pRadiusItem = dynamic_cast<const SdrMetricItem*>(pState);
+ if (pRadiusItem)
+ {
+ mxShadowBlurMetric->set_value(pRadiusItem->GetValue(), FieldUnit::MM_100TH);
+ }
+ }
+ }
+ break;
case SID_ATTR_SHADOW_COLOR:
{
if(eState >= SfxItemState::DEFAULT)
diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx
index 89260581d4e1..e2540ac5012f 100644
--- a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx
+++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx
@@ -54,6 +54,7 @@ public:
private:
::sfx2::sidebar::ControllerItem maShadowController;
::sfx2::sidebar::ControllerItem maShadowTransController;
+ ::sfx2::sidebar::ControllerItem maShadowBlurController;
::sfx2::sidebar::ControllerItem maShadowColorController;
::sfx2::sidebar::ControllerItem maShadowXDistanceController;
::sfx2::sidebar::ControllerItem maShadowYDistanceController;
@@ -68,9 +69,11 @@ private:
std::unique_ptr<weld::Label> mxFTAngle;
std::unique_ptr<weld::Label> mxFTDistance;
std::unique_ptr<weld::Label> mxFTTransparency;
+ std::unique_ptr<weld::Label> mxFTBlur;
std::unique_ptr<weld::Label> mxFTColor;
std::unique_ptr<weld::Scale> mxShadowTransSlider;
std::unique_ptr<weld::MetricSpinButton> mxShadowTransMetric;
+ std::unique_ptr<weld::MetricSpinButton> mxShadowBlurMetric;
void InsertAngleValues();
void SetTransparencyValue(long);
@@ -83,6 +86,7 @@ private:
DECL_LINK(ModifyShadowAngleHdl, weld::ComboBox&, void);
DECL_LINK(ModifyShadowDistanceHdl, weld::MetricSpinButton&, void);
DECL_LINK(ModifyShadowTransSliderHdl, weld::Scale&, void);
+ DECL_LINK(ModifyShadowBlurMetricHdl, weld::MetricSpinButton&, void);
};
}