summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-25 13:53:46 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-08-26 13:16:19 +0200
commit9adb750c0066cda6f534e8e9430de5b236f4b2bd (patch)
tree851d337a2a4a1377d90285578a593317680af052
parenttdf#132160 sw_redlinehide: more pathological redline problems (diff)
downloadcore-9adb750c0066cda6f534e8e9430de5b236f4b2bd.tar.gz
core-9adb750c0066cda6f534e8e9430de5b236f4b2bd.zip
tdf#127802 support tristate for hidden/unhidden text
Change-Id: I9a8ad72ae3ee45ac2521e662b17d3d22d98aa055 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101331 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/inc/chardlg.hxx11
-rw-r--r--cui/source/tabpages/chardlg.cxx77
2 files changed, 69 insertions, 19 deletions
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index 9e4419d4406e..bbd1dff4dab9 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -169,6 +169,12 @@ private:
sal_uInt16 m_nHtmlMode;
bool m_bUnderlineColorDisabled;
+ weld::TriStateEnabled m_aOutlineState;
+ weld::TriStateEnabled m_aShadowState;
+ weld::TriStateEnabled m_aBlinkingState;
+ weld::TriStateEnabled m_aHiddenState;
+ weld::TriStateEnabled m_aIndividualWordsState;
+
std::unique_ptr<weld::Label> m_xFontColorFT;
std::unique_ptr<ColorListBox> m_xFontColorLB;
std::unique_ptr<weld::Label> m_xEffectsFT;
@@ -203,8 +209,11 @@ private:
void SelectHdl_Impl(const weld::ComboBox*);
DECL_LINK(SelectListBoxHdl_Impl, weld::ComboBox&, void);
+ DECL_LINK(OutlineBtnClickHdl, weld::ToggleButton&, void);
+ DECL_LINK(ShadowBtnClickHdl, weld::ToggleButton&, void);
+ DECL_LINK(BlinkingBtnClickHdl, weld::ToggleButton&, void);
+ DECL_LINK(HiddenBtnClickHdl, weld::ToggleButton&, void);
DECL_LINK(CbClickHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(TristClickHdl_Impl, weld::ToggleButton&, void);
DECL_LINK(UpdatePreview_Impl, weld::ComboBox&, void);
DECL_LINK(ColorBoxSelectHdl_Impl, ColorListBox&, void);
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index d7dca728de87..c541df780999 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1416,10 +1416,11 @@ void SvxCharEffectsPage::Initialize()
m_xEffectsLB->set_active( 0 );
+ m_xHiddenBtn->connect_toggled(LINK(this, SvxCharEffectsPage, HiddenBtnClickHdl));
m_xIndividualWordsBtn->connect_toggled(LINK(this, SvxCharEffectsPage, CbClickHdl_Impl));
- Link<weld::ToggleButton&,void> aLink2 = LINK(this, SvxCharEffectsPage, TristClickHdl_Impl);
- m_xOutlineBtn->connect_toggled(aLink2);
- m_xShadowBtn->connect_toggled(aLink2);
+ m_xOutlineBtn->connect_toggled(LINK(this, SvxCharEffectsPage, OutlineBtnClickHdl));
+ m_xShadowBtn->connect_toggled(LINK(this, SvxCharEffectsPage, ShadowBtnClickHdl));
+ m_xBlinkingBtn->connect_toggled(LINK(this, SvxCharEffectsPage, BlinkingBtnClickHdl));
if ( !SvtLanguageOptions().IsAsianTypographyEnabled() )
{
@@ -1495,7 +1496,7 @@ void SvxCharEffectsPage::UpdatePreview_Impl()
rCTLFont.SetCaseMap( eCaps == SvxCaseMap::SmallCaps ? SvxCaseMap::NotMapped : eCaps );
}
- bool bWordLine = m_xIndividualWordsBtn->get_active();
+ bool bWordLine = StateToAttr( m_xIndividualWordsBtn->get_state() );
rFont.SetWordLineMode( bWordLine );
rCJKFont.SetWordLineMode( bWordLine );
rCTLFont.SetWordLineMode( bWordLine );
@@ -1645,13 +1646,10 @@ IMPL_LINK_NOARG(SvxCharEffectsPage, UpdatePreview_Impl, weld::ComboBox&, void)
UpdatePreview_Impl();
}
-IMPL_LINK_NOARG(SvxCharEffectsPage, CbClickHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK(SvxCharEffectsPage, CbClickHdl_Impl, weld::ToggleButton&, rToggle, void)
{
+ m_aIndividualWordsState.ButtonToggled(rToggle);
UpdatePreview_Impl();
-}
-
-IMPL_LINK_NOARG(SvxCharEffectsPage, TristClickHdl_Impl, weld::ToggleButton&, void)
-{
UpdatePreview_Impl();
}
@@ -1802,15 +1800,18 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
switch ( eState )
{
case SfxItemState::UNKNOWN:
+ m_aIndividualWordsState.bTriStateEnabled = false;
m_xIndividualWordsBtn->hide();
break;
case SfxItemState::DISABLED:
case SfxItemState::READONLY:
+ m_aIndividualWordsState.bTriStateEnabled = false;
m_xIndividualWordsBtn->set_sensitive(false);
break;
case SfxItemState::DONTCARE:
+ m_aIndividualWordsState.bTriStateEnabled = true;
m_xIndividualWordsBtn->set_state( TRISTATE_INDET );
break;
@@ -1822,6 +1823,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
rCJKFont.SetWordLineMode( rItem.GetValue() );
rCTLFont.SetWordLineMode( rItem.GetValue() );
+ m_aIndividualWordsState.bTriStateEnabled = false;
m_xIndividualWordsBtn->set_active(rItem.GetValue());
m_xIndividualWordsBtn->set_sensitive(bEnable);
break;
@@ -1936,15 +1938,18 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
switch ( eState )
{
case SfxItemState::UNKNOWN:
+ m_aOutlineState.bTriStateEnabled = false;
m_xOutlineBtn->hide();
break;
case SfxItemState::DISABLED:
case SfxItemState::READONLY:
+ m_aOutlineState.bTriStateEnabled = false;
m_xOutlineBtn->set_sensitive(false);
break;
case SfxItemState::DONTCARE:
+ m_aOutlineState.bTriStateEnabled = true;
m_xOutlineBtn->set_state(TRISTATE_INDET);
break;
@@ -1952,6 +1957,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
case SfxItemState::SET:
{
const SvxContourItem& rItem = static_cast<const SvxContourItem&>(rSet->Get( nWhich ));
+ m_aOutlineState.bTriStateEnabled = false;
m_xOutlineBtn->set_state(static_cast<TriState>(rItem.GetValue()));
break;
}
@@ -1964,15 +1970,18 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
switch ( eState )
{
case SfxItemState::UNKNOWN:
+ m_aShadowState.bTriStateEnabled = false;
m_xShadowBtn->hide();
break;
case SfxItemState::DISABLED:
case SfxItemState::READONLY:
+ m_aShadowState.bTriStateEnabled = false;
m_xShadowBtn->set_sensitive(false);
break;
case SfxItemState::DONTCARE:
+ m_aShadowState.bTriStateEnabled = true;
m_xShadowBtn->set_state( TRISTATE_INDET );
break;
@@ -1980,6 +1989,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
case SfxItemState::SET:
{
const SvxShadowedItem& rItem = static_cast<const SvxShadowedItem&>(rSet->Get( nWhich ));
+ m_aShadowState.bTriStateEnabled = false;
m_xShadowBtn->set_state( static_cast<TriState>(rItem.GetValue()) );
break;
}
@@ -1992,15 +2002,18 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
switch ( eState )
{
case SfxItemState::UNKNOWN:
+ m_aBlinkingState.bTriStateEnabled = false;
m_xBlinkingBtn->hide();
break;
case SfxItemState::DISABLED:
case SfxItemState::READONLY:
+ m_aBlinkingState.bTriStateEnabled = false;
m_xBlinkingBtn->set_sensitive(false);
break;
case SfxItemState::DONTCARE:
+ m_aBlinkingState.bTriStateEnabled = true;
m_xBlinkingBtn->set_state( TRISTATE_INDET );
break;
@@ -2008,6 +2021,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
case SfxItemState::SET:
{
const SvxBlinkItem& rItem = static_cast<const SvxBlinkItem&>(rSet->Get( nWhich ));
+ m_aBlinkingState.bTriStateEnabled = false;
m_xBlinkingBtn->set_state( static_cast<TriState>(rItem.GetValue()) );
break;
}
@@ -2019,15 +2033,18 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
switch ( eState )
{
case SfxItemState::UNKNOWN:
+ m_aHiddenState.bTriStateEnabled = false;
m_xHiddenBtn->hide();
break;
case SfxItemState::DISABLED:
case SfxItemState::READONLY:
+ m_aHiddenState.bTriStateEnabled = false;
m_xHiddenBtn->set_sensitive(false);
break;
case SfxItemState::DONTCARE:
+ m_aHiddenState.bTriStateEnabled = true;
m_xHiddenBtn->set_state(TRISTATE_INDET);
break;
@@ -2035,6 +2052,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
case SfxItemState::SET:
{
const SvxCharHiddenItem& rItem = static_cast<const SvxCharHiddenItem&>(rSet->Get( nWhich ));
+ m_aHiddenState.bTriStateEnabled = false;
m_xHiddenBtn->set_state(static_cast<TriState>(rItem.GetValue()));
break;
}
@@ -2050,6 +2068,28 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
ChangesApplied();
}
+IMPL_LINK(SvxCharEffectsPage, HiddenBtnClickHdl, weld::ToggleButton&, rToggle, void)
+{
+ m_aHiddenState.ButtonToggled(rToggle);
+}
+
+IMPL_LINK(SvxCharEffectsPage, OutlineBtnClickHdl, weld::ToggleButton&, rToggle, void)
+{
+ m_aOutlineState.ButtonToggled(rToggle);
+ UpdatePreview_Impl();
+}
+
+IMPL_LINK(SvxCharEffectsPage, ShadowBtnClickHdl, weld::ToggleButton&, rToggle, void)
+{
+ m_aShadowState.ButtonToggled(rToggle);
+ UpdatePreview_Impl();
+}
+
+IMPL_LINK(SvxCharEffectsPage, BlinkingBtnClickHdl, weld::ToggleButton&, rToggle, void)
+{
+ m_aBlinkingState.ButtonToggled(rToggle);
+}
+
void SvxCharEffectsPage::ChangesApplied()
{
m_xUnderlineLB->save_value();
@@ -2173,23 +2213,26 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
bChanged = true;
// Individual words
+ const SfxItemSet* pExampleSet = GetDialogExampleSet();
nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE );
pOld = GetOldItem( *rSet, SID_ATTR_CHAR_WORDLINEMODE );
+ TriState eState = m_xIndividualWordsBtn->get_state();
+ const SfxPoolItem* pItem;
if ( pOld )
{
const SvxWordLineModeItem& rItem = *static_cast<const SvxWordLineModeItem*>(pOld);
- if ( rItem.GetValue() == m_xIndividualWordsBtn->get_active() )
+ if ( rItem.GetValue() == StateToAttr( eState ) && m_xIndividualWordsBtn->get_saved_state() == eState )
bChanged = false;
}
- if ( rOldSet.GetItemState( nWhich ) == SfxItemState::DONTCARE &&
- ! m_xIndividualWordsBtn->get_state_changed_from_saved() )
- bChanged = false;
+ if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET &&
+ !StateToAttr( eState ) && static_cast<const SvxWordLineModeItem*>(pItem)->GetValue() )
+ bChanged = true;
- if ( bChanged )
+ if ( bChanged && eState != TRISTATE_INDET )
{
- rSet->Put( SvxWordLineModeItem( m_xIndividualWordsBtn->get_active(), nWhich ) );
+ rSet->Put( SvxWordLineModeItem( StateToAttr( eState ), nWhich ) );
bModified = true;
}
else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
@@ -2282,11 +2325,9 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
}
// Outline
- const SfxItemSet* pExampleSet = GetDialogExampleSet();
nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR );
pOld = GetOldItem( *rSet, SID_ATTR_CHAR_CONTOUR );
- TriState eState = m_xOutlineBtn->get_state();
- const SfxPoolItem* pItem;
+ eState = m_xOutlineBtn->get_state();
if ( pOld )
{