From 037493635fa4e48ec4e7cc8ec8d76ca1f55cd1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sat, 8 Feb 2020 17:10:31 +0000 Subject: [PATCH] Resolves: tdf#130486 setting distributed results that justified cannot be set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If80c935b7e33b5c7146eb562daf2303688160653 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88270 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- cui/source/tabpages/align.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index b015a93d819c..0488870a775e 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -84,16 +84,19 @@ void lcl_MaybeResetAlignToDistro( } } -void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, sal_uInt16 nWhichJM, const weld::ComboBox& rLB, sal_uInt16 nListPos) +void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, const SfxItemSet& rOldSet, sal_uInt16 nWhichJM, const weld::ComboBox& rLB, sal_uInt16 nListPos) { SvxCellJustifyMethod eJM = SvxCellJustifyMethod::Auto; if (rLB.get_active() == nListPos) eJM = SvxCellJustifyMethod::Distribute; // tdf#129300 If it would create no change, don't force it - const SvxJustifyMethodItem& rOldItem = static_cast(rSet.Get(nWhichJM)); + const SvxJustifyMethodItem& rOldItem = static_cast(rOldSet.Get(nWhichJM)); if (rOldItem.GetValue() == eJM) + { + rSet.InvalidateItem(nWhichJM); return; + } SvxJustifyMethodItem aItem(eJM, nWhichJM); rSet.Put(aItem); @@ -371,12 +374,12 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet ) // Special treatment for distributed alignment; we need to set the justify // method to 'distribute' to distinguish from the normal justification. sal_uInt16 nWhichHorJM = GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD); - lcl_SetJustifyMethodToItemSet(*rSet, nWhichHorJM, *m_xLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED); + lcl_SetJustifyMethodToItemSet(*rSet, rOldSet, nWhichHorJM, *m_xLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED); if (!bChanged) bChanged = HasAlignmentChanged(*rSet, nWhichHorJM); sal_uInt16 nWhichVerJM = GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD); - lcl_SetJustifyMethodToItemSet(*rSet, nWhichVerJM, *m_xLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED); + lcl_SetJustifyMethodToItemSet(*rSet, rOldSet, nWhichVerJM, *m_xLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED); if (!bChanged) bChanged = HasAlignmentChanged(*rSet, nWhichVerJM);