svx/source/sidebar/area/AreaPropertyPanel.cxx | 16 ++++- svx/source/sidebar/area/AreaPropertyPanelBase.cxx | 65 +++++++++++++++++----- 2 files changed, 64 insertions(+), 17 deletions(-)
New commits: commit 088cd9dc35b01dc5e8a7a7eedf5f52bcfc4c8001 Author: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> AuthorDate: Mon Sep 19 13:24:05 2022 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Tue Sep 20 17:31:26 2022 +0200 tdf#150650 Fix changing fill style to None via Sidebar Regression from 5491a82854e3e6dd2dbb4b0012cb4bbeb4ee22e0 Change-Id: I17cfb037f2064a508317090e6b66f20e253a9436 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140150 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> (cherry picked from commit 6238758d80e170cdb586df2b34d479499574cb72) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140161 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx index 1bcbdac19e1e..fa634ee4499b 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -90,9 +90,19 @@ void AreaPropertyPanel::setFillTransparence(const XFillTransparenceItem& rItem) void AreaPropertyPanel::setFillUseBackground(const XFillStyleItem* pStyleItem, const XFillUseSlideBackgroundItem& rItem) { - GetBindings()->GetDispatcher()->ExecuteList( - SID_ATTR_FILL_USE_SLIDE_BACKGROUND, SfxCallMode::RECORD, - std::initializer_list<SfxPoolItem const*>{ &rItem, pStyleItem }); + const SfxPoolItem* pItem = nullptr; + auto pDispatcher = GetBindings()->GetDispatcher(); + auto state = pDispatcher->QueryState(SID_ATTR_FILL_USE_SLIDE_BACKGROUND, pItem); + // FillUseSlideBackground is only available in Impress + if (state == SfxItemState::DISABLED) + { + setFillStyle(*pStyleItem); + } + else + { + pDispatcher->ExecuteList(SID_ATTR_FILL_USE_SLIDE_BACKGROUND, SfxCallMode::RECORD, + std::initializer_list<SfxPoolItem const*>{ &rItem, pStyleItem }); + } } void AreaPropertyPanel::setFillFloatTransparence(const XFillFloatTransparenceItem& rItem) commit dbd89ccc4fd989f12d42ebcb68aa56ab969e84bd Author: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> AuthorDate: Mon Sep 19 14:10:39 2022 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Tue Sep 20 17:31:17 2022 +0200 tdf#150802 Fix setting gradient from Sidebar Regression from adc536e9efc77690df62177aa722f9252bdbf96b Change-Id: I37db76373a3b9b4a1084e830233561abc4b1e6d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140151 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> (cherry picked from commit c112e426bff4bdf2317363a534495498b0aa215a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140158 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index 6dec785c4067..cd3a484e7bb0 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -466,26 +466,63 @@ void AreaPropertyPanelBase::FillStyleChanged(bool bUpdateModel) mxMTRAngle->set_sensitive(true); mxLbFillAttr->clear(); - const SvxGradientListItem* pItem = pSh->GetItem(SID_GRADIENT_LIST); - - if (0 < pItem->GetGradientList()->Count()) + if (bUpdateModel) { - const XGradient aGradient = pItem->GetGradientList()->GetGradient(0)->GetGradient(); - const OUString aName = pItem->GetGradientList()->GetGradient(0)->GetName(); - const XFillGradientItem aXFillGradientItem(aName, aGradient); + mxLbFillAttr->hide(); + mxToolBoxColor->hide(); + mxBmpImport->hide(); - // #i122676# change FillStyle and Gradient in one call - if (bUpdateModel) + const SvxGradientListItem* pItem = pSh->GetItem(SID_GRADIENT_LIST); + if (pItem->GetGradientList()->Count() > 0) { + const XGradient aGradient + = pItem->GetGradientList()->GetGradient(0)->GetGradient(); + const OUString aName = pItem->GetGradientList()->GetGradient(0)->GetName(); + const XFillGradientItem aXFillGradientItem(aName, aGradient); + + // #i122676# change FillStyle and Gradient in one call XFillStyleItem aXFillStyleItem(drawing::FillStyle_GRADIENT); setFillStyleAndGradient(&aXFillStyleItem, aXFillGradientItem); - } - mxLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); - mxLbFillGradTo->SelectEntry(aGradient.GetEndColor()); + mxLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); + mxLbFillGradTo->SelectEntry(aGradient.GetEndColor()); - mxMTRAngle->set_value(toDegrees(aGradient.GetAngle()), FieldUnit::DEGREE); - css::awt::GradientStyle eXGS = aGradient.GetGradientStyle(); - mxGradientStyle->set_active(sal::static_int_cast<sal_Int32>(eXGS)); + mxMTRAngle->set_value(toDegrees(aGradient.GetAngle()), FieldUnit::DEGREE); + css::awt::GradientStyle eXGS = aGradient.GetGradientStyle(); + mxGradientStyle->set_active(sal::static_int_cast<sal_Int32>(eXGS)); + } + } + else + { + if (pSh && pSh->GetItem(SID_GRADIENT_LIST)) + { + SvxFillAttrBox::Fill(*mxLbFillAttr, + pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList()); + mxLbFillGradTo->SetNoSelection(); + mxLbFillGradFrom->SetNoSelection(); + if (mpFillGradientItem) + { + const OUString aString(mpFillGradientItem->GetName()); + mxLbFillAttr->set_active_text(aString); + const XGradient aGradient = mpFillGradientItem->GetGradientValue(); + mxLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); + mxLbFillGradTo->SelectEntry(aGradient.GetEndColor()); + mxGradientStyle->set_active( + sal::static_int_cast<sal_Int32>(aGradient.GetGradientStyle())); + if (mxGradientStyle->get_active() == sal_Int32(GradientStyle::Radial)) + mxMTRAngle->set_sensitive(false); + else + mxMTRAngle->set_value(toDegrees(aGradient.GetAngle()), + FieldUnit::DEGREE); + } + else + { + mxLbFillAttr->set_active(-1); + } + } + else + { + mxLbFillAttr->set_active(-1); + } } break; }