From ce595857702734203a498fe4754ce990b17c5cb0 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 21 Aug 2020 15:18:13 +0100 Subject: 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/+/101148 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos --- cui/source/tabpages/border.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'cui') diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 82f9b6c3e0ab..8dc87e8409bd 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -846,8 +846,7 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::TLBR)) { - sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_TLBR); - SvxLineItem aLineItem(*static_cast(rCoreAttrs->GetItem(nBorderDiagId))); + SvxLineItem aLineItem(*static_cast(GetOldItem(*rCoreAttrs, SID_ATTR_BORDER_DIAG_TLBR))); aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::TLBR)); rCoreAttrs->Put(aLineItem); bAttrsChanged = true; @@ -855,8 +854,7 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::BLTR)) { - sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_BLTR); - SvxLineItem aLineItem(*static_cast(rCoreAttrs->GetItem(nBorderDiagId))); + SvxLineItem aLineItem(*static_cast(GetOldItem(*rCoreAttrs, SID_ATTR_BORDER_DIAG_BLTR))); aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::BLTR)); rCoreAttrs->Put(aLineItem); bAttrsChanged = true; @@ -864,29 +862,29 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) if (m_xShadowControls && m_xShadowControls->get_value_changed_from_saved()) { - sal_uInt16 nShadowId = pPool->GetWhich(mnShadowSlot); - const SvxShadowItem& rOldShadowItem = *static_cast(rCoreAttrs->GetItem(nShadowId)); + const SvxShadowItem& rOldShadowItem = *static_cast(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); - const SvxMarginItem& rOldMarginItem = *static_cast(rCoreAttrs->GetItem(nAlignMarginId)); + const SvxMarginItem& rOldMarginItem = *static_cast(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 xNewItem(static_cast(rCoreAttrs->Get(nMergeAdjacentBordersId).Clone())); + std::unique_ptr xNewItem(static_cast(GetOldItem(*rCoreAttrs, SID_SW_COLLAPSING_BORDERS)->Clone())); xNewItem->SetValue(static_cast(nState)); rCoreAttrs->Put(std::move(xNewItem)); } @@ -895,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 xNewItem(static_cast(rCoreAttrs->Get(nMergeWithNextId).Clone())); + std::unique_ptr xNewItem(static_cast(GetOldItem(*rCoreAttrs, SID_ATTR_BORDER_CONNECT)->Clone())); xNewItem->SetValue(static_cast(nState)); rCoreAttrs->Put(std::move(xNewItem)); } -- cgit