summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-21 15:18:13 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-08-21 19:31:38 +0200
commitd2e57b17af2fb5719009c290db3fd9ef81e78c67 (patch)
tree4b050c7166a24c01fd9a3e8758cd1a2ef8f7f534 /cui
parent6e64e2e2d23e8a776f6e7fe53f45f18145f80bda (diff)
Resolves: tdf#135128 should get the old attr, not the default attr
so we retain the original shadow distance if its not changed but the color is. Use GetOldAttr which is intended for that. Change-Id: I2d4b5a5b035c94cd8f2cc8f73bd239fab85b945f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101147 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/tabpages/border.cxx56
1 files changed, 22 insertions, 34 deletions
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index eb72e3417a42..8dc87e8409bd 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -846,59 +846,45 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::TLBR))
{
- sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_TLBR);
- if (const SfxPoolItem* pItem = rCoreAttrs->GetItem(nBorderDiagId))
- {
- SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(pItem));
- aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::TLBR));
- rCoreAttrs->Put(aLineItem);
- bAttrsChanged = true;
- }
+ SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(GetOldItem(*rCoreAttrs, SID_ATTR_BORDER_DIAG_TLBR)));
+ aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::TLBR));
+ rCoreAttrs->Put(aLineItem);
+ bAttrsChanged = true;
}
if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::BLTR))
{
- sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_BLTR);
- if (const SfxPoolItem* pItem = rCoreAttrs->GetItem(nBorderDiagId))
- {
- SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(pItem));
- aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::BLTR));
- rCoreAttrs->Put(aLineItem);
- bAttrsChanged = true;
- }
+ SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(GetOldItem(*rCoreAttrs, SID_ATTR_BORDER_DIAG_BLTR)));
+ aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::BLTR));
+ rCoreAttrs->Put(aLineItem);
+ bAttrsChanged = true;
}
if (m_xShadowControls && m_xShadowControls->get_value_changed_from_saved())
{
- sal_uInt16 nShadowId = pPool->GetWhich(mnShadowSlot);
- if (const SfxPoolItem* pItem = rCoreAttrs->GetItem(nShadowId))
- {
- const SvxShadowItem& rOldShadowItem = *static_cast<const SvxShadowItem*>(pItem);
- rCoreAttrs->Put(m_xShadowControls->GetControlValue(rOldShadowItem));
- bAttrsChanged = true;
- }
+ const SvxShadowItem& rOldShadowItem = *static_cast<const SvxShadowItem*>(GetOldItem(*rCoreAttrs, mnShadowSlot));
+ rCoreAttrs->Put(m_xShadowControls->GetControlValue(rOldShadowItem));
+ bAttrsChanged = true;
}
if (m_xMarginControls && m_xMarginControls->get_value_changed_from_saved())
{
- sal_uInt16 nAlignMarginId = pPool->GetWhich(SID_ATTR_ALIGN_MARGIN);
- if (const SfxPoolItem* pItem = rCoreAttrs->GetItem(nAlignMarginId))
- {
- const SvxMarginItem& rOldMarginItem = *static_cast<const SvxMarginItem*>(pItem);
- rCoreAttrs->Put(m_xMarginControls->GetControlValue(rOldMarginItem));
- bAttrsChanged = true;
- }
+ const SvxMarginItem& rOldMarginItem = *static_cast<const SvxMarginItem*>(GetOldItem(*rCoreAttrs, SID_ATTR_ALIGN_MARGIN));
+ rCoreAttrs->Put(m_xMarginControls->GetControlValue(rOldMarginItem));
+ bAttrsChanged = true;
}
if (m_xMergeAdjacentBordersCB->get_state_changed_from_saved())
{
- sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhich(SID_SW_COLLAPSING_BORDERS);
auto nState = m_xMergeAdjacentBordersCB->get_state();
if (nState == TRISTATE_INDET)
+ {
+ sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhich(SID_SW_COLLAPSING_BORDERS);
rCoreAttrs->ClearItem(nMergeAdjacentBordersId);
+ }
else
{
- std::unique_ptr<SfxBoolItem> xNewItem(static_cast<SfxBoolItem*>(rCoreAttrs->Get(nMergeAdjacentBordersId).Clone()));
+ std::unique_ptr<SfxBoolItem> xNewItem(static_cast<SfxBoolItem*>(GetOldItem(*rCoreAttrs, SID_SW_COLLAPSING_BORDERS)->Clone()));
xNewItem->SetValue(static_cast<bool>(nState));
rCoreAttrs->Put(std::move(xNewItem));
}
@@ -907,13 +893,15 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
if (m_xMergeWithNextCB->get_state_changed_from_saved())
{
- sal_uInt16 nMergeWithNextId = pPool->GetWhich(SID_ATTR_BORDER_CONNECT);
auto nState = m_xMergeWithNextCB->get_state();
if (nState == TRISTATE_INDET)
+ {
+ sal_uInt16 nMergeWithNextId = pPool->GetWhich(SID_ATTR_BORDER_CONNECT);
rCoreAttrs->ClearItem(nMergeWithNextId);
+ }
else
{
- std::unique_ptr<SfxBoolItem> xNewItem(static_cast<SfxBoolItem*>(rCoreAttrs->Get(nMergeWithNextId).Clone()));
+ std::unique_ptr<SfxBoolItem> xNewItem(static_cast<SfxBoolItem*>(GetOldItem(*rCoreAttrs, SID_ATTR_BORDER_CONNECT)->Clone()));
xNewItem->SetValue(static_cast<bool>(nState));
rCoreAttrs->Put(std::move(xNewItem));
}