sc/source/core/data/patattr.cxx |   27 +++------------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

New commits:
commit 5a1c372ec772f7600792deef044b7f5f21a116b6
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Wed Sep 4 13:54:58 2024 +0200
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Sep 4 14:37:51 2024 +0200

    sc: check only background color for automatic font color
    
    problem:
    when setting font color only background color matters.
    there are dark, bright and other types of color so better to keep 
conditions simple
    
    Change-Id: I513f97a281a8625cbe7781a10d2a2427c9b6be2f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172867
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 32905201def9..17ca87c1159b 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -445,7 +445,7 @@ void ScPatternAttr::fillFontOnly(
     rFont.SetTransparent( true );
 }
 
-void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const 
SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode, const SfxItemSet* 
pCondSet, const Color* pBackConfigColor, const Color* pTextConfigColor)
+void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const 
SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode, const SfxItemSet* 
pCondSet, const Color* pBackConfigColor, const Color* /*pTextConfigColor*/)
 {
     model::ComplexColor aComplexColor;
 
@@ -519,38 +519,17 @@ void ScPatternAttr::fillColor(model::ComplexColor& 
rComplexColor, const SfxItemS
             }
         }
 
-        //  get system text color for comparison
-        Color aSysTextColor;
-        if (eAutoMode == ScAutoFontColorMode::Print)
-        {
-            aSysTextColor = COL_BLACK;
-        }
-        else if (pTextConfigColor)
-        {
-            // pTextConfigColor can be used to avoid repeated lookup of the 
configured color
-            aSysTextColor = *pTextConfigColor;
-        }
-        else
-        {
-            aSysTextColor = 
SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
-        }
-
         //  select the resulting color
-        if ( aBackColor.IsDark() && aSysTextColor.IsDark() )
+        if ( aBackColor.IsDark() )
         {
             //  use white instead of dark on dark
             aColor = COL_WHITE;
         }
-        else if ( aBackColor.IsBright() && aSysTextColor.IsBright() )
+        else
         {
             //  use black instead of bright on bright
             aColor = COL_BLACK;
         }
-        else
-        {
-            //  use aSysTextColor (black for ScAutoFontColorMode::Print, from 
style settings otherwise)
-            aColor = aSysTextColor;
-        }
     }
     aComplexColor.setFinalColor(aColor);
     rComplexColor = aComplexColor;

Reply via email to