[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - cui/source cui/uiconfig

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 9 08:39:55 UTC 2019


 cui/source/inc/paragrph.hxx      |   30 +++++++++++
 cui/source/tabpages/paragrph.cxx |  104 ++++++++++++++++++++++++++++++++++-----
 cui/uiconfig/ui/textflowpage.ui  |    3 +
 3 files changed, 126 insertions(+), 11 deletions(-)

New commits:
commit 99ec13e699ff2788db7c8eda7d9c41c1faa3d94d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Mar 25 13:30:07 2019 +0000
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Tue Apr 9 10:39:32 2019 +0200

    Resolves: tdf#123550 allow returning to TRISTATE_INDET
    
    Change-Id: I3e4b18c0b3217e010c80fbddccebd547ee29253a
    Reviewed-on: https://gerrit.libreoffice.org/69675
    Tested-by: Jenkins
    Tested-by: Xisco Faulí <xiscofauli at libreoffice.org>
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index bbcb7b3d3f68..183dbba699dc 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -184,6 +184,18 @@ public:
     virtual void            PageCreated(const SfxAllItemSet& aSet) override;
 };
 
+struct TriStateEnabled
+{
+    TriState eState;
+    bool bTriStateEnabled;
+    TriStateEnabled()
+        : eState(TRISTATE_INDET)
+        , bTriStateEnabled(true)
+    {
+    }
+    void ButtonToggled(weld::ToggleButton& rToggle);
+};
+
 // class SvxExtParagraphTabPage ------------------------------------------
 /*
     [Description]
@@ -223,6 +235,15 @@ protected:
 private:
     SvxExtParagraphTabPage(TabPageParent pParent, const SfxItemSet& rSet);
 
+    TriStateEnabled aHyphenState;
+    TriStateEnabled aPageBreakState;
+    TriStateEnabled aApplyCollState;
+    TriStateEnabled aPageNumState;
+    TriStateEnabled aKeepTogetherState;
+    TriStateEnabled aKeepParaState;
+    TriStateEnabled aOrphanState;
+    TriStateEnabled aWidowState;
+
     bool                bPageBreak;
     bool                bHtmlMode;
     sal_uInt16          nStdPos;
@@ -260,6 +281,14 @@ private:
     std::unique_ptr<weld::SpinButton> m_xWidowRowNo;
     std::unique_ptr<weld::Label> m_xWidowRowLabel;
 
+    void HyphenClickHdl();
+    void PageNumBoxClickHdl();
+    void ApplyCollClickHdl();
+    void PageBreakHdl();
+    void KeepTogetherHdl();
+    void OrphanHdl();
+    void WidowHdl();
+
     DECL_LINK(PageBreakHdl_Impl, weld::ToggleButton&, void);
     DECL_LINK(KeepTogetherHdl_Impl, weld::ToggleButton&, void);
     DECL_LINK(WidowHdl_Impl, weld::ToggleButton&, void);
@@ -269,6 +298,7 @@ private:
     DECL_LINK(PageBreakPosHdl_Impl, weld::ComboBox&, void);
     DECL_LINK(PageBreakTypeHdl_Impl, weld::ComboBox&, void);
     DECL_LINK(PageNumBoxClickHdl_Impl, weld::ToggleButton&, void);
+    DECL_LINK(KeepParaBoxClickHdl_Impl, weld::ToggleButton&, void);
 
     virtual void            PageCreated(const SfxAllItemSet& aSet) override;
 };
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index f522b62b95d1..a8d9d8ab6003 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -1573,6 +1573,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
     {
         const SvxHyphenZoneItem& rHyphen =
             static_cast<const SvxHyphenZoneItem&>(rSet->Get( _nWhich ));
+        aHyphenState.bTriStateEnabled = false;
 
         bIsHyphen = rHyphen.IsHyphen();
         m_xHyphenBox->set_state(bIsHyphen ? TRISTATE_TRUE : TRISTATE_FALSE);
@@ -1599,6 +1600,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
     {
         case SfxItemState::SET:
         {
+            aPageNumState.bTriStateEnabled = false;
             m_xPageNumBox->set_state(TRISTATE_TRUE);
             SfxUInt16Item const*const pItem(rSet->GetItem<SfxUInt16Item>(_nWhich));
             const sal_uInt16 nPageNum(pItem->GetValue());
@@ -1607,6 +1609,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
         }
         case SfxItemState::DONTCARE:
         {
+            aPageNumState.bTriStateEnabled = true;
             m_xPageNumBox->set_state(TRISTATE_INDET);
             break;
         }
@@ -1614,6 +1617,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
         case SfxItemState::DEFAULT:
         case SfxItemState::DISABLED:
         {
+            aPageNumState.bTriStateEnabled = false;
             m_xPageNumBox->set_state(TRISTATE_FALSE);
             break;
         }
@@ -1631,6 +1635,8 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
 
         if ( eItemState >= SfxItemState::SET )
         {
+            aApplyCollState.bTriStateEnabled = false;
+
             const SvxPageModelItem& rModel =
                 static_cast<const SvxPageModelItem&>(rSet->Get( _nWhich ));
             const OUString& aStr( rModel.GetValue() );
@@ -1642,6 +1648,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
                 bIsPageModel = true;
 
                 m_xPageBreakBox->set_sensitive(true);
+                aPageBreakState.bTriStateEnabled = false;
                 m_xBreakTypeFT->set_sensitive(true);
                 m_xBreakTypeLB->set_sensitive(true);
                 m_xBreakPositionFT->set_sensitive(true);
@@ -1662,6 +1669,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
         }
         else if ( SfxItemState::DONTCARE == eItemState )
         {
+            aApplyCollState.bTriStateEnabled = true;
             m_xApplyCollBtn->set_state(TRISTATE_INDET);
             m_xApplyCollBox->set_active(-1);
         }
@@ -1688,6 +1696,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
                 // PageBreak not via CTRL-RETURN,
                 // then CheckBox can be freed
                 m_xPageBreakBox->set_sensitive(true);
+                aPageBreakState.bTriStateEnabled = false;
                 m_xBreakTypeFT->set_sensitive(true);
                 m_xBreakTypeLB->set_sensitive(true);
                 m_xBreakPositionFT->set_sensitive(true);
@@ -1743,7 +1752,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
         }
 
         PageBreakPosHdl_Impl(*m_xBreakPositionLB);
-        PageBreakHdl_Impl(*m_xPageBreakBox);
+        PageBreakHdl();
     }
 
     _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
@@ -1751,6 +1760,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
 
     if ( eItemState >= SfxItemState::DEFAULT )
     {
+        aKeepParaState.bTriStateEnabled = false;
         const SvxFormatKeepItem& rKeep =
             static_cast<const SvxFormatKeepItem&>(rSet->Get( _nWhich ));
 
@@ -1771,6 +1781,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
     {
         const SvxFormatSplitItem& rSplit =
             static_cast<const SvxFormatSplitItem&>(rSet->Get( _nWhich ));
+        aKeepTogetherState.bTriStateEnabled = false;
 
         if ( !rSplit.GetValue() )
             m_xKeepTogetherBox->set_state(TRISTATE_TRUE);
@@ -1787,6 +1798,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
             {
                 const SvxWidowsItem& rWidow =
                     static_cast<const SvxWidowsItem&>(rSet->Get( _nWhich ));
+                aWidowState.bTriStateEnabled = false;
                 const sal_uInt16 nLines = rWidow.GetValue();
 
                 bool _bEnable = nLines > 0;
@@ -1810,6 +1822,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
                 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);
@@ -1822,6 +1835,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
                 m_xOrphanBox->set_state(TRISTATE_INDET);
             else
                 m_xOrphanBox->set_sensitive(false);
+            aOrphanState.eState = m_xOrphanBox->get_state();
         }
     }
     else if ( SfxItemState::DONTCARE == eItemState )
@@ -1830,9 +1844,9 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
         m_xKeepTogetherBox->set_sensitive(false);
 
     // so that everything is enabled correctly
-    KeepTogetherHdl_Impl(*m_xKeepTogetherBox);
-    WidowHdl_Impl(*m_xWidowBox);
-    OrphanHdl_Impl(*m_xOrphanBox);
+    KeepTogetherHdl();
+    WidowHdl();
+    OrphanHdl();
     ChangesApplied();
 }
 void SvxExtParagraphTabPage::ChangesApplied()
@@ -1921,6 +1935,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(TabPageParent pParent, const SfxI
     m_xBreakTypeLB->connect_changed(LINK(this, SvxExtParagraphTabPage, PageBreakTypeHdl_Impl));
     m_xBreakPositionLB->connect_changed(LINK(this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl));
     m_xPageNumBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl));
+    m_xKeepParaBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl));
 
     SfxObjectShell* pSh = SfxObjectShell::Current();
     if ( pSh )
@@ -1963,7 +1978,7 @@ SvxExtParagraphTabPage::~SvxExtParagraphTabPage()
 {
 }
 
-IMPL_LINK_NOARG(SvxExtParagraphTabPage, PageBreakHdl_Impl, weld::ToggleButton&, void)
+void SvxExtParagraphTabPage::PageBreakHdl()
 {
     switch (m_xPageBreakBox->get_state())
     {
@@ -2003,14 +2018,26 @@ IMPL_LINK_NOARG(SvxExtParagraphTabPage, PageBreakHdl_Impl, weld::ToggleButton&,
     }
 }
 
-IMPL_LINK_NOARG(SvxExtParagraphTabPage, KeepTogetherHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK(SvxExtParagraphTabPage, PageBreakHdl_Impl, weld::ToggleButton&, rToggle, void)
+{
+    aPageBreakState.ButtonToggled(rToggle);
+    PageBreakHdl();
+}
+
+void SvxExtParagraphTabPage::KeepTogetherHdl()
 {
     bool bEnable = m_xKeepTogetherBox->get_state() == TRISTATE_FALSE;
     m_xWidowBox->set_sensitive(bEnable);
     m_xOrphanBox->set_sensitive(bEnable);
 }
 
-IMPL_LINK_NOARG(SvxExtParagraphTabPage, WidowHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK(SvxExtParagraphTabPage, KeepTogetherHdl_Impl, weld::ToggleButton&, rToggle, void)
+{
+    aKeepTogetherState.ButtonToggled(rToggle);
+    KeepTogetherHdl();
+}
+
+void SvxExtParagraphTabPage::WidowHdl()
 {
     switch (m_xWidowBox->get_state())
     {
@@ -2030,7 +2057,39 @@ IMPL_LINK_NOARG(SvxExtParagraphTabPage, WidowHdl_Impl, weld::ToggleButton&, void
     }
 }
 
-IMPL_LINK_NOARG(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK(SvxExtParagraphTabPage, WidowHdl_Impl, weld::ToggleButton&, rToggle, void)
+{
+    aWidowState.ButtonToggled(rToggle);
+    WidowHdl();
+}
+
+void TriStateEnabled::ButtonToggled(weld::ToggleButton& rToggle)
+{
+    if (bTriStateEnabled)
+    {
+        switch (eState)
+        {
+            case TRISTATE_INDET:
+                rToggle.set_state(TRISTATE_FALSE);
+                break;
+            case TRISTATE_TRUE:
+                rToggle.set_state(TRISTATE_INDET);
+                break;
+            case TRISTATE_FALSE:
+                rToggle.set_state(TRISTATE_TRUE);
+                break;
+        }
+    }
+    eState = rToggle.get_state();
+}
+
+IMPL_LINK(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::ToggleButton&, rToggle, void)
+{
+    aOrphanState.ButtonToggled(rToggle);
+    OrphanHdl();
+}
+
+void SvxExtParagraphTabPage::OrphanHdl()
 {
     switch (m_xOrphanBox->get_state())
     {
@@ -2051,7 +2110,7 @@ IMPL_LINK_NOARG(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::ToggleButton&, voi
     }
 }
 
-IMPL_LINK_NOARG(SvxExtParagraphTabPage, HyphenClickHdl_Impl, weld::ToggleButton&, void)
+void SvxExtParagraphTabPage::HyphenClickHdl()
 {
     bool bEnable = m_xHyphenBox->get_state() == TRISTATE_TRUE;
     m_xBeforeText->set_sensitive(bEnable);
@@ -2063,7 +2122,13 @@ IMPL_LINK_NOARG(SvxExtParagraphTabPage, HyphenClickHdl_Impl, weld::ToggleButton&
     m_xHyphenBox->set_state(bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
 }
 
-IMPL_LINK_NOARG(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK(SvxExtParagraphTabPage, HyphenClickHdl_Impl, weld::ToggleButton&, rToggle, void)
+{
+    aHyphenState.ButtonToggled(rToggle);
+    HyphenClickHdl();
+}
+
+void SvxExtParagraphTabPage::ApplyCollClickHdl()
 {
     bool bEnable = false;
     if (m_xApplyCollBtn->get_state() == TRISTATE_TRUE && m_xApplyCollBox->get_count())
@@ -2083,6 +2148,12 @@ IMPL_LINK_NOARG(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, weld::ToggleButt
     }
 }
 
+IMPL_LINK(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, weld::ToggleButton&, rToggle, void)
+{
+    aApplyCollState.ButtonToggled(rToggle);
+    ApplyCollClickHdl();
+}
+
 IMPL_LINK(SvxExtParagraphTabPage, PageBreakPosHdl_Impl, weld::ComboBox&, rListBox, void)
 {
     if (0 == rListBox.get_active())
@@ -2124,11 +2195,22 @@ IMPL_LINK(SvxExtParagraphTabPage, PageBreakTypeHdl_Impl, weld::ComboBox&, rListB
         PageBreakPosHdl_Impl(*m_xBreakPositionLB);
 }
 
-IMPL_LINK_NOARG(SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl, weld::ToggleButton&, void)
+void SvxExtParagraphTabPage::PageNumBoxClickHdl()
 {
     m_xPagenumEdit->set_sensitive(m_xPageNumBox->get_state() == TRISTATE_TRUE);
 }
 
+IMPL_LINK(SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl, weld::ToggleButton&, rToggle, void)
+{
+    aPageNumState.ButtonToggled(rToggle);
+    PageNumBoxClickHdl();
+}
+
+IMPL_LINK(SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl, weld::ToggleButton&, rToggle, void)
+{
+    aKeepParaState.ButtonToggled(rToggle);
+}
+
 void SvxExtParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
 {
     const SfxBoolItem* pDisablePageBreakItem = aSet.GetItem<SfxBoolItem>(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK, false);
diff --git a/cui/uiconfig/ui/textflowpage.ui b/cui/uiconfig/ui/textflowpage.ui
index 717590916352..8610e863564e 100644
--- a/cui/uiconfig/ui/textflowpage.ui
+++ b/cui/uiconfig/ui/textflowpage.ui
@@ -23,18 +23,21 @@
   <object class="GtkAdjustment" id="adjustment4">
     <property name="lower">2</property>
     <property name="upper">9</property>
+    <property name="value">2</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="adjustment5">
     <property name="lower">2</property>
     <property name="upper">9</property>
+    <property name="value">2</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="adjustment6">
     <property name="lower">2</property>
     <property name="upper">9</property>
+    <property name="value">2</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>


More information about the Libreoffice-commits mailing list