diff options
author | A_GAN <ganzouri97@gmail.com> | 2020-07-27 20:28:53 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-07-28 17:38:53 +0200 |
commit | 6dbfbebad37fd84208e4c336f0864d26019db153 (patch) | |
tree | 0bf185cdf95ee5383b3bc0b45ecb05aff944bf05 /cui | |
parent | 30598199272db107c5dc863707685e4019ad471e (diff) |
Add spin button for shadow blur radius in area dialog
Update shadow tab in area dialog with spin button to control blur radius of the shadow.
Change-Id: I41f072ef10d280df4b118afae7a7c058eb975417
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99557
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/cuitabarea.hxx | 1 | ||||
-rw-r--r-- | cui/source/tabpages/tpshadow.cxx | 25 | ||||
-rw-r--r-- | cui/uiconfig/ui/shadowtabpage.ui | 37 |
3 files changed, 61 insertions, 2 deletions
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 849b009c35df..fe16ad2c3bf2 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -312,6 +312,7 @@ private: std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance; std::unique_ptr<ColorListBox> m_xLbShadowColor; std::unique_ptr<weld::MetricSpinButton> m_xMtrTransparent; + std::unique_ptr<weld::MetricSpinButton> m_xLbShadowBlurMetric; std::unique_ptr<weld::CustomWeld> m_xCtlPosition; std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview; diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx index de448b197fd4..a02d7d6b92b8 100644 --- a/cui/source/tabpages/tpshadow.cxx +++ b/cui/source/tabpages/tpshadow.cxx @@ -45,9 +45,11 @@ const sal_uInt16 SvxShadowTabPage::pShadowRanges[] = { SDRATTR_SHADOWCOLOR, SDRATTR_SHADOWTRANSPARENCE, + SDRATTR_SHADOWBLUR, SID_ATTR_FILL_SHADOW, SID_ATTR_FILL_SHADOW, SID_ATTR_SHADOW_TRANSPARENCE, + SID_ATTR_SHADOW_BLUR, SID_ATTR_SHADOW_YDISTANCE, 0 }; @@ -66,6 +68,7 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogControlle , m_xMtrDistance(m_xBuilder->weld_metric_spin_button("MTR_FLD_DISTANCE", FieldUnit::CM)) , m_xLbShadowColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_SHADOW_COLOR"), pController->getDialog())) , m_xMtrTransparent(m_xBuilder->weld_metric_spin_button("MTR_SHADOW_TRANSPARENT", FieldUnit::PERCENT)) + , m_xLbShadowBlurMetric(m_xBuilder->weld_metric_spin_button("LB_SHADOW_BLUR", FieldUnit::POINT)) , m_xCtlPosition(new weld::CustomWeld(*m_xBuilder, "CTL_POSITION", m_aCtlPosition)) , m_xCtlXRectPreview(new weld::CustomWeld(*m_xBuilder, "CTL_COLOR_PREVIEW", m_aCtlXRectPreview)) { @@ -151,6 +154,7 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogControlle m_xTsbShowShadow->connect_toggled(LINK( this, SvxShadowTabPage, ClickShadowHdl_Impl)); m_xLbShadowColor->SetSelectHdl( LINK( this, SvxShadowTabPage, SelectShadowHdl_Impl ) ); Link<weld::MetricSpinButton&,void> aLink = LINK( this, SvxShadowTabPage, ModifyShadowHdl_Impl ); + m_xLbShadowBlurMetric->connect_value_changed(aLink); m_xMtrTransparent->connect_value_changed(aLink); m_xMtrDistance->connect_value_changed(aLink); } @@ -160,6 +164,7 @@ SvxShadowTabPage::~SvxShadowTabPage() m_xCtlXRectPreview.reset(); m_xLbShadowColor.reset(); m_xCtlPosition.reset(); + m_xLbShadowBlurMetric.reset(); } void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet ) @@ -315,6 +320,17 @@ bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs ) } } + if (m_xLbShadowBlurMetric->get_value_changed_from_saved()) + { + SdrMetricItem aItem(SDRATTR_SHADOWBLUR, m_xLbShadowBlurMetric->get_value(FieldUnit::MM_100TH)); + pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWBLUR ); + if ( !pOld || !( *static_cast<const SdrMetricItem*>(pOld) == aItem ) ) + { + rAttrs->Put( aItem ); + bModified = true; + } + } + rAttrs->Put (CntUInt16Item(SID_PAGE_TYPE, static_cast<sal_uInt16>(m_nPageType))); return bModified; @@ -398,10 +414,19 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs ) else m_xMtrTransparent->set_text(""); + if( rAttrs->GetItemState( SDRATTR_SHADOWBLUR ) != SfxItemState::DONTCARE ) + { + sal_uInt16 nBlur = rAttrs->Get( SDRATTR_SHADOWBLUR ).GetValue(); + m_xLbShadowBlurMetric->set_value(nBlur, FieldUnit::MM_100TH); + } + else + m_xLbShadowBlurMetric->set_text(""); + //aCtlPosition m_xMtrDistance->save_value(); m_xLbShadowColor->SaveValue(); m_xTsbShowShadow->save_state(); + m_xLbShadowBlurMetric->save_value(); // #66832# This field was not saved, but used to determine changes. // Why? Seems to be the error. diff --git a/cui/uiconfig/ui/shadowtabpage.ui b/cui/uiconfig/ui/shadowtabpage.ui index f5e674d99c72..2cb49674b9e5 100644 --- a/cui/uiconfig/ui/shadowtabpage.ui +++ b/cui/uiconfig/ui/shadowtabpage.ui @@ -12,6 +12,11 @@ <property name="step_increment">5</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustmentPoint"> + <property name="upper">150</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkBox" id="ShadowTabPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -61,7 +66,7 @@ <object class="GtkGrid" id="gridSHADOW"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="row_spacing">3</property> + <property name="row_spacing">4</property> <property name="column_spacing">6</property> <child> <object class="GtkSpinButton" id="MTR_SHADOW_TRANSPARENT"> @@ -73,6 +78,19 @@ </object> <packing> <property name="left_attach">1</property> + <property name="top_attach">4</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="LB_SHADOW_BLUR"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="halign">start</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustmentPoint</property> + </object> + <packing> + <property name="left_attach">1</property> <property name="top_attach">3</property> </packing> </child> @@ -161,6 +179,20 @@ </packing> </child> <child> + <object class="GtkLabel" id="FT_SHADOW_BLUR"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="shadowtabpage|FT_SHADOW_BLUR">_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="GtkLabel" id="FT_TRANSPARENT"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -171,7 +203,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="top_attach">4</property> </packing> </child> <child> @@ -284,6 +316,7 @@ <widget name="MTR_SHADOW_TRANSPARENT"/> <widget name="MTR_FLD_DISTANCE"/> <widget name="LB_SHADOW_COLOR"/> + <widget name="LB_SHADOW_BLUR"/> </widgets> </object> <object class="GtkSizeGroup" id="sizegroup2"> |