summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-25 13:53:46 +0100
committerAndras Timar <andras.timar@collabora.com>2020-08-31 07:17:56 +0200
commit76dbda52f9ab3de03681bfbc85e536e9fcaa553e (patch)
treeb80a4ed811fc1509490cee3ee78468f39bf73940 /cui
parentf3f00457ade56962af0de0499822750c15d96a03 (diff)
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>
Diffstat (limited to 'cui')
-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 da382112af6f..bf22fc1fb64c 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_xFontTransparencyFT;
@@ -205,8 +211,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);
DECL_LINK(ModifyFontTransparencyHdl_Impl, weld::MetricSpinButton&, void);
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 3d4f85b7d199..b6f44959b409 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1422,10 +1422,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() )
{
@@ -1501,7 +1502,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 );
@@ -1671,13 +1672,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();
}
@@ -1833,15 +1831,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;
@@ -1853,6 +1854,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;
@@ -1967,15 +1969,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;
@@ -1983,6 +1988,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;
}
@@ -1995,15 +2001,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;
@@ -2011,6 +2020,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;
}
@@ -2023,15 +2033,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;
@@ -2039,6 +2052,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;
}
@@ -2050,15 +2064,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;
@@ -2066,6 +2083,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;
}
@@ -2081,6 +2099,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();
@@ -2205,23 +2245,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 ) )
@@ -2314,11 +2357,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 )
{