summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-03-29 17:18:53 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-03-30 07:53:47 +0000
commit84f78392249c3749801acf238a99fda95311e01f (patch)
treeabbe46da08311c17d223c4d53f4c11db694bf458 /cui
parent92ddc0409c8d3276183afdee543d28e1c307c2c7 (diff)
Related: tdf#106080 support a 'none' color in search by format
so we can show the initial no-color selected state differently than the automatic color default color Change-Id: Ib3020e507b1555cb446c2b501f60b67222dc115c Reviewed-on: https://gerrit.libreoffice.org/35863 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/inc/chardlg.hxx3
-rw-r--r--cui/source/tabpages/chardlg.cxx33
2 files changed, 30 insertions, 6 deletions
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index b24a431e2ce5..1b99b60cc5ff 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -175,6 +175,7 @@ private:
static const sal_uInt16 pEffectsRanges[];
bool m_bOrigFontColor;
bool m_bNewFontColor;
+ bool m_bEnableNoneFontColor;
Color m_aOrigFontColor;
VclPtr<FixedText> m_pFontColorFT;
VclPtr<SvxColorListBox> m_pFontColorLB;
@@ -219,6 +220,8 @@ private:
void SetCaseMap_Impl( SvxCaseMap eCaseMap );
void ResetColor_Impl( const SfxItemSet& rSet );
bool FillItemSetColor_Impl( SfxItemSet& rSet );
+ Color GetPreviewFontColor(const Color& rColor) const;
+ void EnableNoneFontColor();
void SelectHdl_Impl(ListBox*);
DECL_LINK(SelectListBoxHdl_Impl, ListBox&, void);
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index a126b3234d08..b8448130ed87 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1336,6 +1336,7 @@ SvxCharEffectsPage::SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet&
: SvxCharBasePage(pParent, "EffectsPage", "cui/ui/effectspage.ui", rInSet)
, m_bOrigFontColor(false)
, m_bNewFontColor(false)
+ , m_bEnableNoneFontColor(false)
{
get(m_pFontColorFT, "fontcolorft");
get(m_pFontColorLB, "fontcolorlb");
@@ -1368,6 +1369,21 @@ SvxCharEffectsPage::SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet&
Initialize();
}
+void SvxCharEffectsPage::EnableNoneFontColor()
+{
+ m_pFontColorLB->SetSlotId(SID_ATTR_CHAR_COLOR, true);
+ m_bEnableNoneFontColor = true;
+}
+
+Color SvxCharEffectsPage::GetPreviewFontColor(const Color& rColor) const
+{
+ if (rColor.GetColor() == COL_AUTO)
+ return Color(COL_BLACK);
+ if (m_bEnableNoneFontColor && rColor.GetColor() == COL_NONE_COLOR)
+ return Color(COL_BLACK);
+ return rColor;
+}
+
SvxCharEffectsPage::~SvxCharEffectsPage()
{
disposeOnce();
@@ -1468,9 +1484,9 @@ void SvxCharEffectsPage::UpdatePreview_Impl()
SvxFont& rCTLFont = GetPreviewCTLFont();
const Color& rSelectedColor = m_pFontColorLB->GetSelectEntryColor();
- rFont.SetColor(rSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : rSelectedColor);
- rCJKFont.SetColor(rSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : rSelectedColor);
- rCTLFont.SetColor(rSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : rSelectedColor);
+ rFont.SetColor(GetPreviewFontColor(rSelectedColor));
+ rCJKFont.SetColor(GetPreviewFontColor(rSelectedColor));
+ rCTLFont.SetColor(GetPreviewFontColor(rSelectedColor));
sal_Int32 nPos = m_pUnderlineLB->GetSelectEntryPos();
FontLineStyle eUnderline = (FontLineStyle)reinterpret_cast<sal_uLong>(m_pUnderlineLB->GetEntryData( nPos ));
@@ -1572,6 +1588,9 @@ void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet )
break;
case SfxItemState::DONTCARE:
+ //Related: tdf#106080 if there is no font color, then allow "none"
+ //as a color so the listbox can display that state.
+ EnableNoneFontColor();
m_pFontColorLB->SetNoSelection();
break;
@@ -1584,9 +1603,9 @@ void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet )
const SvxColorItem& rItem = static_cast<const SvxColorItem&>(rSet.Get( nWhich ));
Color aColor = rItem.GetValue();
- rFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor );
- rCJKFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor );
- rCTLFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor );
+ rFont.SetColor(GetPreviewFontColor(aColor));
+ rCJKFont.SetColor(GetPreviewFontColor(aColor));
+ rCTLFont.SetColor(GetPreviewFontColor(aColor));
m_pPreviewWin->Invalidate();
@@ -1613,6 +1632,8 @@ bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet )
aSelectedColor = m_pFontColorLB->GetSelectEntryColor();
if (m_bOrigFontColor)
bChanged = aSelectedColor != m_aOrigFontColor;
+ if (m_bEnableNoneFontColor && bChanged && aSelectedColor == COL_NONE_COLOR)
+ bChanged = false;
}
if (bChanged)