diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2022-06-16 08:52:13 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2022-06-22 16:54:21 +0200 |
commit | ecfb133598df609037263e06949acbbf520622b3 (patch) | |
tree | 929b760023fb25b5eb0ba7b9de4d278279af30ab /svx | |
parent | 1f820cd30b3014c72f6711d80679faa8488ffcda (diff) |
tdf#128150 Adapt sidebar to new "use slide background" property
Change-Id: Idce049a7498f98b0079c708236cfeff7fddd6e95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135963
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/sdi/svx.sdi | 16 | ||||
-rw-r--r-- | svx/source/sidebar/area/AreaPropertyPanel.cxx | 9 | ||||
-rw-r--r-- | svx/source/sidebar/area/AreaPropertyPanel.hxx | 3 | ||||
-rw-r--r-- | svx/source/sidebar/area/AreaPropertyPanelBase.cxx | 52 | ||||
-rw-r--r-- | svx/source/tbxctrls/itemwin.cxx | 1 | ||||
-rw-r--r-- | svx/source/xoutdev/xpool.cxx | 1 |
6 files changed, 81 insertions, 1 deletions
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index de7ef9914b4c..0336b6c2d101 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -11769,7 +11769,23 @@ SfxBoolItem PrepareMailExport SID_MAIL_PREPAREEXPORT GroupId = SfxGroupId::Explorer; ] +/* TODO: SfxBoolItem or XFillUseSlideBackgroundItem ? */ +SfxBoolItem FillUseSlideBackground SID_ATTR_FILL_USE_SLIDE_BACKGROUND +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = FALSE, + MenuConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = SfxGroupId::Format; +] SfxUInt16Item FillTransparence SID_ATTR_FILL_TRANSPARENCE [ diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx index b4d22f6823ab..1bcbdac19e1e 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -46,6 +46,7 @@ AreaPropertyPanel::AreaPropertyPanel( maPatternListControl(SID_PATTERN_LIST, *pBindings, *this), maFillTransparenceController(SID_ATTR_FILL_TRANSPARENCE, *pBindings, *this), maFillFloatTransparenceController(SID_ATTR_FILL_FLOATTRANSPARENCE, *pBindings, *this), + maFillUseSlideBackgroundController(SID_ATTR_FILL_USE_SLIDE_BACKGROUND, *pBindings, *this), mpBindings(pBindings) { } @@ -86,6 +87,14 @@ void AreaPropertyPanel::setFillTransparence(const XFillTransparenceItem& rItem) SfxCallMode::RECORD, { &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 }); +} + void AreaPropertyPanel::setFillFloatTransparence(const XFillFloatTransparenceItem& rItem) { GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_FLOATTRANSPARENCE, diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx b/svx/source/sidebar/area/AreaPropertyPanel.hxx index ec7c1223d108..6c398e6ac077 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.hxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx @@ -30,6 +30,7 @@ class XFillFloatTransparenceItem; class XFillTransparenceItem; +class XFillUseSlideBackgroundItem; class XFillStyleItem; class XFillGradientItem; class XFillColorItem; @@ -59,6 +60,7 @@ public: virtual ~AreaPropertyPanel() override; virtual void setFillTransparence(const XFillTransparenceItem& rItem) override; + virtual void setFillUseBackground(const XFillStyleItem* pStyleItem, const XFillUseSlideBackgroundItem& rItem) override; virtual void setFillFloatTransparence(const XFillFloatTransparenceItem& rItem) override; virtual void setFillStyle(const XFillStyleItem& rItem) override; virtual void setFillStyleAndColor(const XFillStyleItem* pStyleItem, const XFillColorItem& aColorItem) override; @@ -78,6 +80,7 @@ private: ::sfx2::sidebar::ControllerItem maPatternListControl; ::sfx2::sidebar::ControllerItem maFillTransparenceController; ::sfx2::sidebar::ControllerItem maFillFloatTransparenceController; + ::sfx2::sidebar::ControllerItem maFillUseSlideBackgroundController; SfxBindings* mpBindings; }; diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index baaf3c4b5189..801970514854 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -25,6 +25,7 @@ #include <sfx2/objsh.hxx> #include <svx/xfltrit.hxx> #include <svx/xflftrit.hxx> +#include <svx/xfilluseslidebackgrounditem.hxx> #include <svx/xtable.hxx> #include <sfx2/sidebar/Panel.hxx> #include <sfx2/opengrf.hxx> @@ -49,7 +50,8 @@ enum eFillStyle GRADIENT, HATCH, BITMAP, - PATTERN + PATTERN, + USE_BACKGROUND }; } @@ -421,6 +423,22 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, weld::ComboBox&, void) setFillStyleAndBitmap(&aXFillStyleItem, aXFillBitmapItem); break; } + case USE_BACKGROUND: + { + mxLbFillAttr->show(); + mxLbFillGradFrom->hide(); + mxLbFillGradTo->hide(); + mxGradientStyle->hide(); + mxMTRAngle->hide(); + mxToolBoxColor->hide(); + mxBmpImport->hide(); + mxLbFillAttr->set_sensitive(false); + + const XFillStyleItem aXFillStyleItem(drawing::FillStyle_NONE); + const XFillUseSlideBackgroundItem aXFillUseSlideBackgroundItem(true); + setFillUseBackground(&aXFillStyleItem, aXFillUseSlideBackgroundItem); + break; + } } meLastXFS = static_cast<sal_uInt16>(nPos); @@ -972,6 +990,35 @@ void AreaPropertyPanelBase::updateFillBitmap(bool bDisabled, bool bDefaultOrSet, m_pPanel->TriggerDeckLayouting(); } +void AreaPropertyPanelBase::updateFillUseBackground(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState) +{ + if (bDisabled) + { + mpUseSlideBackgroundItem.reset(); + return; + } + + if (bDefaultOrSet) + { + if (pState) + { + const XFillUseSlideBackgroundItem* pItem = static_cast<const XFillUseSlideBackgroundItem*>(pState); + // When XFillUseSlideBackgroundItem is true, select "Use Background Fill". When false, select "None" + int nPos = pItem->GetValue() ? 6 : 0; + mxLbFillType->set_active(nPos); + mpUseSlideBackgroundItem.reset(pItem->Clone()); + } + else + { + mpUseSlideBackgroundItem.reset(); + } + } + else + { + mpUseSlideBackgroundItem.reset(); + } +} + void AreaPropertyPanelBase::NotifyItemUpdate( sal_uInt16 nSID, SfxItemState eState, @@ -1004,6 +1051,9 @@ void AreaPropertyPanelBase::NotifyItemUpdate( case SID_ATTR_FILL_BITMAP: updateFillBitmap(bDisabled, bDefaultOrSet, pState); break; + case SID_ATTR_FILL_USE_SLIDE_BACKGROUND: + updateFillUseBackground(bDisabled, bDefaultOrSet, pState); + break; case SID_GRADIENT_LIST: { if(bDefault) diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index 130fba5ae014..1a9b6d3bcf53 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -180,6 +180,7 @@ void SvxFillTypeBox::Fill(weld::ComboBox& rListBox) rListBox.append_text(SvxResId(RID_SVXSTR_HATCH)); rListBox.append_text(SvxResId(RID_SVXSTR_BITMAP)); rListBox.append_text(SvxResId(RID_SVXSTR_PATTERN)); + rListBox.append_text(SvxResId(RID_SVXSTR_USE_BACKGROUND)); rListBox.thaw(); diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx index 771b79ac4991..b3e044e83696 100644 --- a/svx/source/xoutdev/xpool.cxx +++ b/svx/source/xoutdev/xpool.cxx @@ -182,6 +182,7 @@ XOutdevItemPool::XOutdevItemPool(SfxItemPool* _pMaster) mpLocalItemInfos[XATTR_FORMTXTHIDEFORM -XATTR_START]._nSID = SID_FORMTEXT_HIDEFORM; // associate new slots for panels with known items + mpLocalItemInfos[XATTR_FILLUSESLIDEBACKGROUND - XATTR_START]._nSID = SID_ATTR_FILL_USE_SLIDE_BACKGROUND; mpLocalItemInfos[XATTR_FILLTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_TRANSPARENCE; mpLocalItemInfos[XATTR_FILLFLOATTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_FLOATTRANSPARENCE; mpLocalItemInfos[XATTR_LINETRANSPARENCE - XATTR_START]._nSID = SID_ATTR_LINE_TRANSPARENCE; |