From a66e2231c15321835e34469edb748947d6de3464 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 11 May 2022 12:38:25 +0100 Subject: tdf#148730 set current widow/orphan state even if do not split para is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ibdb6a830ad502cf04598ce9cd1c232ad6d9d8ade Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134166 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- cui/source/tabpages/paragrph.cxx | 81 ++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 41 deletions(-) (limited to 'cui') diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index 32146becdf75..14a43480caa5 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -1779,55 +1779,54 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) else { m_xKeepTogetherBox->set_state(TRISTATE_FALSE); - - // widows and orphans + // default widows and orphans to enabled m_xWidowBox->set_sensitive(true); - _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS ); - SfxItemState eTmpState = rSet->GetItemState( _nWhich ); - - if ( eTmpState >= SfxItemState::DEFAULT ) - { - const SvxWidowsItem& rWidow = - static_cast(rSet->Get( _nWhich )); - aWidowState.bTriStateEnabled = false; - const sal_uInt16 nLines = rWidow.GetValue(); + m_xOrphanBox->set_sensitive(true); + } - bool _bEnable = nLines > 0; - m_xWidowRowNo->set_value(m_xWidowRowNo->normalize(nLines)); - m_xWidowBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE); - m_xWidowRowNo->set_sensitive(_bEnable); - //m_xWidowRowLabel->set_sensitive(_bEnable); + // widows and orphans + _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS ); + SfxItemState eTmpState = rSet->GetItemState( _nWhich ); - } - else if ( SfxItemState::DONTCARE == eTmpState ) - m_xWidowBox->set_state( TRISTATE_INDET ); - else - m_xWidowBox->set_sensitive(false); + if ( eTmpState >= SfxItemState::DEFAULT ) + { + const SvxWidowsItem& rWidow = + static_cast(rSet->Get( _nWhich )); + aWidowState.bTriStateEnabled = false; + const sal_uInt16 nLines = rWidow.GetValue(); + + bool _bEnable = nLines > 0; + m_xWidowRowNo->set_value(m_xWidowRowNo->normalize(nLines)); + m_xWidowBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE); + m_xWidowRowNo->set_sensitive(_bEnable); + } + else if ( SfxItemState::DONTCARE == eTmpState ) + m_xWidowBox->set_state( TRISTATE_INDET ); + else + m_xWidowBox->set_sensitive(false); - m_xOrphanBox->set_sensitive(true); - _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS ); - eTmpState = rSet->GetItemState( _nWhich ); + _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS ); + eTmpState = rSet->GetItemState( _nWhich ); - if ( eTmpState >= SfxItemState::DEFAULT ) - { - const SvxOrphansItem& rOrphan = - static_cast(rSet->Get( _nWhich )); - const sal_uInt16 nLines = rOrphan.GetValue(); - aOrphanState.bTriStateEnabled = false; + if ( eTmpState >= SfxItemState::DEFAULT ) + { + const SvxOrphansItem& rOrphan = + static_cast(rSet->Get( _nWhich )); + const sal_uInt16 nLines = rOrphan.GetValue(); + aOrphanState.bTriStateEnabled = false; - bool _bEnable = nLines > 0; - m_xOrphanBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE); - m_xOrphanRowNo->set_value(m_xOrphanRowNo->normalize(nLines)); - m_xOrphanRowNo->set_sensitive(_bEnable); - m_xOrphanRowLabel->set_sensitive(_bEnable); + bool _bEnable = nLines > 0; + m_xOrphanBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE); + m_xOrphanRowNo->set_value(m_xOrphanRowNo->normalize(nLines)); + m_xOrphanRowNo->set_sensitive(_bEnable); + m_xOrphanRowLabel->set_sensitive(_bEnable); - } - else if ( SfxItemState::DONTCARE == eTmpState ) - m_xOrphanBox->set_state(TRISTATE_INDET); - else - m_xOrphanBox->set_sensitive(false); - aOrphanState.eState = m_xOrphanBox->get_state(); } + else if ( SfxItemState::DONTCARE == eTmpState ) + m_xOrphanBox->set_state(TRISTATE_INDET); + else + m_xOrphanBox->set_sensitive(false); + aOrphanState.eState = m_xOrphanBox->get_state(); } else if ( SfxItemState::DONTCARE == eItemState ) m_xKeepTogetherBox->set_state(TRISTATE_INDET); -- cgit