cui/source/inc/align.hxx      |   12 +++++++++-
 cui/source/tabpages/align.cxx |   48 ++++++++++++++++++++++++++++++++++--------
 2 files changed, 50 insertions(+), 10 deletions(-)

New commits:
commit 23ccf16e9e86ecc64367f41f4df695d0a6926d72
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri May 17 17:09:16 2019 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue May 21 12:52:16 2019 +0200

    Resolves: tdf#124467 enable wrap text to return to TRISTATE_INDET
    
    Change-Id: Ie956560885fd9bb9e7367018a2f6e37a26c3c6af
    Reviewed-on: https://gerrit.libreoffice.org/72495
    Tested-by: Xisco Faulí <xiscofa...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx
index 1f5257e9d2c1..12dbcd5ab649 100644
--- a/cui/source/inc/align.hxx
+++ b/cui/source/inc/align.hxx
@@ -76,9 +76,19 @@ private:
     bool                HasAlignmentChanged( const SfxItemSet& rNew, 
sal_uInt16 nWhich ) const;
 
     DECL_LINK(UpdateEnableHdl, weld::ComboBox&, void);
-    DECL_LINK(UpdateEnableClickHdl, weld::ToggleButton&, void);
+    DECL_LINK(StackedClickHdl, weld::ToggleButton&, void);
+    DECL_LINK(AsianModeClickHdl, weld::ToggleButton&, void);
+    DECL_LINK(WrapClickHdl, weld::ToggleButton&, void);
+    DECL_LINK(HyphenClickHdl, weld::ToggleButton&, void);
+    DECL_LINK(ShrinkClickHdl, weld::ToggleButton&, void);
 
 private:
+    weld::TriStateEnabled m_aStackedState;
+    weld::TriStateEnabled m_aAsianModeState;
+    weld::TriStateEnabled m_aWrapState;
+    weld::TriStateEnabled m_aHyphenState;
+    weld::TriStateEnabled m_aShrinkState;
+
     SvxDialControl m_aCtrlDial;
     SvtValueSet m_aVsRefEdge;
 
diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index 57e23b0bba46..b278de9951be 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -141,8 +141,12 @@ AlignmentTabPage::AlignmentTabPage(TabPageParent pParent, 
const SfxItemSet& rCor
     InitVsRefEgde();
 
     m_xLbHorAlign->connect_changed(LINK(this, AlignmentTabPage, 
UpdateEnableHdl));
-    m_xBtnWrap->connect_toggled(LINK(this, AlignmentTabPage, 
UpdateEnableClickHdl));
-    m_xCbStacked->connect_toggled(LINK(this, AlignmentTabPage, 
UpdateEnableClickHdl));
+
+    m_xCbStacked->connect_toggled(LINK(this, AlignmentTabPage, 
StackedClickHdl));
+    m_xCbAsianMode->connect_toggled(LINK(this, AlignmentTabPage, 
AsianModeClickHdl));
+    m_xBtnWrap->connect_toggled(LINK(this, AlignmentTabPage, WrapClickHdl));
+    m_xBtnHyphen->connect_toggled(LINK(this, AlignmentTabPage, 
HyphenClickHdl));
+    m_xBtnShrink->connect_toggled(LINK(this, AlignmentTabPage, 
ShrinkClickHdl));
 
     // Asian vertical mode
     m_xCbAsianMode->show(SvtCJKOptions().IsVerticalTextEnabled());
@@ -320,26 +324,30 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
 
 namespace
 {
-    void ResetBool(sal_uInt16 nWhich, const SfxItemSet* pSet, 
weld::CheckButton& rBtn)
+    void ResetBool(sal_uInt16 nWhich, const SfxItemSet* pSet, 
weld::CheckButton& rBtn, weld::TriStateEnabled& rTriState)
     {
         SfxItemState eState = pSet->GetItemState(nWhich);
         switch (eState)
         {
             case SfxItemState::UNKNOWN:
                 rBtn.hide();
+                rTriState.bTriStateEnabled = false;
                 break;
             case SfxItemState::DISABLED:
             case SfxItemState::READONLY:
                 rBtn.set_sensitive(false);
+                rTriState.bTriStateEnabled = false;
                 break;
             case SfxItemState::DONTCARE:
                 rBtn.set_state(TRISTATE_INDET);
+                rTriState.bTriStateEnabled = true;
                 break;
             case SfxItemState::DEFAULT:
             case SfxItemState::SET:
             {
                 const SfxBoolItem& rItem = static_cast<const 
SfxBoolItem&>(pSet->Get(nWhich));
                 rBtn.set_state(static_cast<TriState>(rItem.GetValue()));
+                rTriState.bTriStateEnabled = false;
                 break;
             }
         }
@@ -351,11 +359,11 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
 {
     SfxTabPage::Reset(pCoreAttrs);
 
-    ResetBool(GetWhich(SID_ATTR_ALIGN_STACKED), pCoreAttrs, *m_xCbStacked);
-    ResetBool(GetWhich(SID_ATTR_ALIGN_ASIANVERTICAL), pCoreAttrs, 
*m_xCbAsianMode);
-    ResetBool(GetWhich(SID_ATTR_ALIGN_LINEBREAK), pCoreAttrs, *m_xBtnWrap);
-    ResetBool(GetWhich(SID_ATTR_ALIGN_HYPHENATION), pCoreAttrs, *m_xBtnHyphen);
-    ResetBool(GetWhich(SID_ATTR_ALIGN_SHRINKTOFIT), pCoreAttrs, *m_xBtnShrink);
+    ResetBool(GetWhich(SID_ATTR_ALIGN_STACKED), pCoreAttrs, *m_xCbStacked, 
m_aStackedState);
+    ResetBool(GetWhich(SID_ATTR_ALIGN_ASIANVERTICAL), pCoreAttrs, 
*m_xCbAsianMode, m_aAsianModeState);
+    ResetBool(GetWhich(SID_ATTR_ALIGN_LINEBREAK), pCoreAttrs, *m_xBtnWrap, 
m_aWrapState);
+    ResetBool(GetWhich(SID_ATTR_ALIGN_HYPHENATION), pCoreAttrs, *m_xBtnHyphen, 
m_aHyphenState);
+    ResetBool(GetWhich(SID_ATTR_ALIGN_SHRINKTOFIT), pCoreAttrs, *m_xBtnShrink, 
m_aShrinkState);
 
     sal_uInt16 nWhich = GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY);
     SfxItemState eState = pCoreAttrs->GetItemState(nWhich);
@@ -681,11 +689,33 @@ bool AlignmentTabPage::HasAlignmentChanged( const 
SfxItemSet& rNew, sal_uInt16 n
     return eMethodOld != eMethodNew;
 }
 
-IMPL_LINK_NOARG(AlignmentTabPage, UpdateEnableClickHdl, weld::ToggleButton&, 
void)
+IMPL_LINK(AlignmentTabPage, StackedClickHdl, weld::ToggleButton&, rToggle, 
void)
+{
+    m_aStackedState.ButtonToggled(rToggle);
+    UpdateEnableControls();
+}
+
+IMPL_LINK(AlignmentTabPage, AsianModeClickHdl, weld::ToggleButton&, rToggle, 
void)
+{
+    m_aAsianModeState.ButtonToggled(rToggle);
+}
+
+IMPL_LINK(AlignmentTabPage, WrapClickHdl, weld::ToggleButton&, rToggle, void)
 {
+    m_aWrapState.ButtonToggled(rToggle);
     UpdateEnableControls();
 }
 
+IMPL_LINK(AlignmentTabPage, HyphenClickHdl, weld::ToggleButton&, rToggle, void)
+{
+    m_aHyphenState.ButtonToggled(rToggle);
+}
+
+IMPL_LINK(AlignmentTabPage, ShrinkClickHdl, weld::ToggleButton&, rToggle, void)
+{
+    m_aShrinkState.ButtonToggled(rToggle);
+}
+
 IMPL_LINK_NOARG(AlignmentTabPage, UpdateEnableHdl, weld::ComboBox&, void)
 {
     UpdateEnableControls();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to