editeng/source/editeng/impedit3.cxx | 8 ++++---- sc/source/core/data/patattr.cxx | 17 +---------------- sw/source/core/txtnode/fntcache.cxx | 14 +++++++++----- 3 files changed, 14 insertions(+), 25 deletions(-)
New commits: commit 8534ad7b7b9aae2520d731cf748ff0aadfe2f0ed Author: Heiko Tietze <tietze.he...@gmail.com> AuthorDate: Thu Jul 4 14:31:09 2024 +0200 Commit: Heiko Tietze <heiko.tie...@documentfoundation.org> CommitDate: Mon Jul 22 13:01:43 2024 +0200 Resolves tdf#159541 - Fix font color must not change depending on background Change-Id: I954c9e3f8502a5243c664ed0bf066fb4c4cb4ccc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169991 Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 66ecfb814774..944f3a1c14a9 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4958,13 +4958,13 @@ Color ImpEditEngine::GetAutoColor() const } else { - aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; + aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR, false).nColor; - if ( GetBackgroundColor() != COL_AUTO ) + if ( aColor == COL_AUTO ) { - if ( GetBackgroundColor().IsDark() && aColor.IsDark() ) + if ( GetBackgroundColor().IsDark() ) aColor = COL_WHITE; - else if ( GetBackgroundColor().IsBright() && aColor.IsBright() ) + else aColor = COL_BLACK; } } diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index da278bd53c30..0bf5cfc6ca41 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -798,22 +798,7 @@ void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const SfxItemS aSysTextColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; } - // select the resulting color - if ( aBackColor.IsDark() && aSysTextColor.IsDark() ) - { - // use white instead of dark on dark - aColor = COL_WHITE; - } - else if ( aBackColor.IsBright() && aSysTextColor.IsBright() ) - { - // use black instead of bright on bright - aColor = COL_BLACK; - } - else - { - // use aSysTextColor (black for ScAutoFontColorMode::Print, from style settings otherwise) - aColor = aSysTextColor; - } + aColor = aSysTextColor; } aComplexColor.setFinalColor(aColor); rComplexColor = aComplexColor; diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 52a9e71dff1d..d52484432791 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -58,6 +58,7 @@ #include <cstdint> #include <memory> #include "justify.hxx" +#include <svtools/colorcfg.hxx> using namespace ::com::sun::star; @@ -2293,11 +2294,14 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont ) } // change painting color depending of dark/bright background - Color aTmpColor( nNewColor ); - if ( pCol->IsDark() && aTmpColor.IsDark() ) - nNewColor = COL_WHITE; - else if ( pCol->IsBright() && aTmpColor.IsBright() ) - nNewColor = COL_BLACK; + if (!pVSh->GetWin() || // ie. IsPrinting, see SwViewShell::GetWin() + svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR, false).nColor == COL_AUTO) // GetFontColor() uses the smart flag + { + if ( pCol->IsDark() ) + nNewColor = COL_WHITE; + else + nNewColor = COL_BLACK; + } } }