summaryrefslogtreecommitdiff
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
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>
-rw-r--r--sc/sdi/drawsh.sdi2
-rw-r--r--sd/sdi/_drvwsh.sdi5
-rw-r--r--sd/source/ui/view/drviews2.cxx2
-rw-r--r--sd/source/ui/view/drviewsf.cxx1
-rw-r--r--svx/sdi/svx.sdi17
-rw-r--r--svx/source/sidebar/shadow/ShadowPropertyPanel.cxx35
-rw-r--r--svx/source/sidebar/shadow/ShadowPropertyPanel.hxx4
-rw-r--r--svx/uiconfig/ui/sidebarshadow.ui33
8 files changed, 96 insertions, 3 deletions
diff --git a/sc/sdi/drawsh.sdi b/sc/sdi/drawsh.sdi
index b29cf20da73f..9abf9618681a 100644
--- a/sc/sdi/drawsh.sdi
+++ b/sc/sdi/drawsh.sdi
@@ -75,6 +75,8 @@ interface TableDraw
[ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
SID_ATTR_SHADOW_TRANSPARENCE
[ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
+ SID_ATTR_SHADOW_BLUR
+ [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
SID_ATTR_SHADOW_XDISTANCE
[ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
SID_ATTR_SHADOW_YDISTANCE
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 6d5d5740a8ed..63f956e55591 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -1829,6 +1829,11 @@ interface DrawView
ExecMethod = FuTemporary ;
StateMethod = GetAttrState ;
]
+ SID_ATTR_SHADOW_BLUR
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
SID_ATTR_SHADOW_XDISTANCE
[
ExecMethod = FuTemporary;
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 16a31a5f9ebe..322829ac152a 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -666,6 +666,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
case SID_ATTR_FILL_SHADOW:
case SID_ATTR_SHADOW_COLOR:
case SID_ATTR_SHADOW_TRANSPARENCE:
+ case SID_ATTR_SHADOW_BLUR:
case SID_ATTR_SHADOW_XDISTANCE:
case SID_ATTR_SHADOW_YDISTANCE:
case SID_ATTR_FILL_TRANSPARENCE:
@@ -698,6 +699,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
case SID_ATTR_FILL_SHADOW:
case SID_ATTR_SHADOW_COLOR:
case SID_ATTR_SHADOW_TRANSPARENCE:
+ case SID_ATTR_SHADOW_BLUR:
case SID_ATTR_SHADOW_XDISTANCE:
case SID_ATTR_SHADOW_YDISTANCE:
case SID_ATTR_FILL_STYLE:
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index bcaea408d937..4446bb657fa1 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -413,6 +413,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
case SID_ATTR_FILL_SHADOW:
case SID_ATTR_SHADOW_COLOR:
case SID_ATTR_SHADOW_TRANSPARENCE:
+ case SID_ATTR_SHADOW_BLUR:
case SID_ATTR_SHADOW_XDISTANCE:
case SID_ATTR_SHADOW_YDISTANCE:
case SID_ATTR_FILL_TRANSPARENCE:
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index b7d5283fcb86..b647dbeb3676 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -7708,6 +7708,23 @@ SdrPercentItem FillShadowTransparency SID_ATTR_SHADOW_TRANSPARENCE
GroupId = SfxGroupId::Document;
]
+SdrMetricItem ShadowBlur SID_ATTR_SHADOW_BLUR
+
+[
+ AutoUpdate = TRUE,
+ FastCall = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = SfxGroupId::Document;
+]
+
SdrMetricItem FillShadowXDistance SID_ATTR_SHADOW_XDISTANCE
[
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);
};
}
diff --git a/svx/uiconfig/ui/sidebarshadow.ui b/svx/uiconfig/ui/sidebarshadow.ui
index ad0d3fcd81fb..1369e0d5784c 100644
--- a/svx/uiconfig/ui/sidebarshadow.ui
+++ b/svx/uiconfig/ui/sidebarshadow.ui
@@ -16,6 +16,11 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkAdjustment" id="adjustment4">
+ <property name="lower">0</property>
+ <property name="upper">150</property>
+ <property name="step_increment">1</property>
+ </object>
<object class="GtkGrid" id="ShadowPropertyPanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -112,6 +117,32 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="blur_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="sidebarshadow|blur_label">Blur:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">LB_SHADOW_BLUR</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="LB_SHADOW_BLUR">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="adjustment">adjustment4</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="transparency_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -120,7 +151,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
</packing>
</child>
<child>