cui/source/tabpages/paragrph.cxx |   81 +++++++++++++++++++--------------------
 1 file changed, 40 insertions(+), 41 deletions(-)

New commits:
commit a66e2231c15321835e34469edb748947d6de3464
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed May 11 12:38:25 2022 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed May 11 16:20:00 2022 +0200

    tdf#148730 set current widow/orphan state even if do not split para is set
    
    Change-Id: Ibdb6a830ad502cf04598ce9cd1c232ad6d9d8ade
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134166
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

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<const SvxWidowsItem&>(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<const SvxWidowsItem&>(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<const SvxOrphansItem&>(rSet->Get( _nWhich ));
-                const sal_uInt16 nLines = rOrphan.GetValue();
-                aOrphanState.bTriStateEnabled = false;
+        if ( eTmpState >= SfxItemState::DEFAULT )
+        {
+            const SvxOrphansItem& rOrphan =
+                static_cast<const SvxOrphansItem&>(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);

Reply via email to