From 2734d2e058182a34c576e558138d84358c69ca5a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 13 Oct 2022 10:41:25 +0100 Subject: tdf#150622 use high contrast selection fg/bg colors for text selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit with SettingsForSelection SettingsText -> HighlightTextColor SettingsFill -> HighlightColor SettingsLine -> HighlightColor Change-Id: Iaac5834ce0f8b3f1b89376711b564773cfd0bfe3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141287 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/source/outdev/gradient.cxx | 7 ++++++- vcl/source/rendercontext/drawmode.cxx | 30 ++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 7 deletions(-) (limited to 'vcl') diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx index bd19cd50a40c..707ca47d960a 100644 --- a/vcl/source/outdev/gradient.cxx +++ b/vcl/source/outdev/gradient.cxx @@ -617,7 +617,12 @@ Color OutputDevice::GetSingleColorGradientFill() else if ( mnDrawMode & DrawModeFlags::WhiteGradient ) aColor = COL_WHITE; else if ( mnDrawMode & DrawModeFlags::SettingsGradient ) - aColor = GetSettings().GetStyleSettings().GetWindowColor(); + { + if (mnDrawMode & DrawModeFlags::SettingsForSelection) + aColor = GetSettings().GetStyleSettings().GetHighlightColor(); + else + aColor = GetSettings().GetStyleSettings().GetWindowColor(); + } return aColor; } diff --git a/vcl/source/rendercontext/drawmode.cxx b/vcl/source/rendercontext/drawmode.cxx index fe0a1660acd5..9819be3fa866 100644 --- a/vcl/source/rendercontext/drawmode.cxx +++ b/vcl/source/rendercontext/drawmode.cxx @@ -53,7 +53,10 @@ Color GetLineColor(Color const& rColor, DrawModeFlags nDrawMode, } else if (nDrawMode & DrawModeFlags::SettingsLine) { - aColor = rStyleSettings.GetWindowTextColor(); + if (nDrawMode & DrawModeFlags::SettingsForSelection) + aColor = rStyleSettings.GetHighlightColor(); + else + aColor = rStyleSettings.GetWindowTextColor(); } } } @@ -91,7 +94,10 @@ Color GetFillColor(Color const& rColor, DrawModeFlags nDrawMode, } else if (nDrawMode & DrawModeFlags::SettingsFill) { - aColor = rStyleSettings.GetWindowColor(); + if (nDrawMode & DrawModeFlags::SettingsForSelection) + aColor = rStyleSettings.GetHighlightColor(); + else + aColor = rStyleSettings.GetWindowColor(); } } } @@ -119,7 +125,10 @@ Color GetHatchColor(Color const& rColor, DrawModeFlags nDrawMode, } else if (nDrawMode & DrawModeFlags::SettingsLine) { - aColor = rStyleSettings.GetWindowTextColor(); + if (nDrawMode & DrawModeFlags::SettingsForSelection) + aColor = rStyleSettings.GetHighlightColor(); + else + aColor = rStyleSettings.GetWindowTextColor(); } return aColor; @@ -149,7 +158,10 @@ Color GetTextColor(Color const& rColor, DrawModeFlags nDrawMode, } else if (nDrawMode & DrawModeFlags::SettingsText) { - aColor = rStyleSettings.GetWindowTextColor(); + if (nDrawMode & DrawModeFlags::SettingsForSelection) + aColor = rStyleSettings.GetHighlightTextColor(); + else + aColor = rStyleSettings.GetWindowTextColor(); } } @@ -183,7 +195,10 @@ vcl::Font GetFont(vcl::Font const& rFont, DrawModeFlags nDrawMode, } else if (nDrawMode & DrawModeFlags::SettingsText) { - aTextColor = rStyleSettings.GetWindowTextColor(); + if (nDrawMode & DrawModeFlags::SettingsForSelection) + aTextColor = rStyleSettings.GetHighlightTextColor(); + else + aTextColor = rStyleSettings.GetWindowTextColor(); } aFont.SetColor(aTextColor); @@ -207,7 +222,10 @@ vcl::Font GetFont(vcl::Font const& rFont, DrawModeFlags nDrawMode, } else if (nDrawMode & DrawModeFlags::SettingsFill) { - aTextFillColor = rStyleSettings.GetWindowColor(); + if (nDrawMode & DrawModeFlags::SettingsForSelection) + aTextFillColor = rStyleSettings.GetHighlightColor(); + else + aTextFillColor = rStyleSettings.GetWindowColor(); } else if (nDrawMode & DrawModeFlags::NoFill) { -- cgit