editeng/source/editeng/impedit.hxx  |    2 +-
 editeng/source/editeng/impedit3.cxx |   10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 58757c482e9ef9629b32cdcd1c9cc1a0d92c5ffe
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Jan 21 11:22:17 2026 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Thu Jan 22 00:12:29 2026 +0100

    background color should start initialized to COL_AUTO
    
    Change-Id: I09ad8f22f7ea6236d4a0b2a842571c32c2d0684b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197740
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index b17a76116a34..86bef4d7ed6f 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -4755,7 +4755,7 @@ Color ImpEditEngine::GetAutoColor(const SvxFont* pFont) 
const
 {
     Color aColor;
 
-    Color aBackgroundColor;
+    Color aBackgroundColor(COL_AUTO);
     if (pFont) //check for char background color
         aBackgroundColor = pFont->GetFillColor();
     if (aBackgroundColor == COL_AUTO) // check for aother background (i.e: 
cell color)
commit 4e621549867bbc6f08d6d4b3507d20c8f653b8e9
Author:     Pranam Lashkari <[email protected]>
AuthorDate: Fri Jan 2 02:43:25 2026 +0530
Commit:     Caolán McNamara <[email protected]>
CommitDate: Thu Jan 22 00:12:22 2026 +0100

    editeng: for automatic font color also check char background
    
    problem:
    in automatic color we only check doc color and background color(i.e: cell 
color)
    text can also have highlight color which also should be taken
    in cosideration when chosing automatic color
    
    Change-Id: I3689baa5cc95bc8d3b855251ae92c91a82102db3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196403
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196604
    (cherry picked from commit c1e5d16513b663b86d62a3eeceda2c0c6cf0b23c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197739

diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index aba08ab2f2ba..cd381cadc6f9 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -832,7 +832,7 @@ private:
 
     tools::Long                CalcVertLineSpacing(Point& rStartPos) const;
 
-    Color               GetAutoColor() const;
+    Color               GetAutoColor(const SvxFont* pFonts = nullptr) const;
     void EnableAutoColor( bool b ) { mbUseAutoColor = b; }
     bool IsAutoColorEnabled() const { return mbUseAutoColor; }
     void ForceAutoColor( bool b ) { mbForceAutoColor = b; }
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index b37d067ebe72..b17a76116a34 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3036,7 +3036,7 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, 
sal_Int32 nPos, SvxFont& rFo
         if ( IsAutoColorEnabled() && !bPrinting && !bPDFExporting)
         {
             // Never use WindowTextColor on the printer
-            rFont.SetColor( GetAutoColor() );
+            rFont.SetColor(GetAutoColor(&rFont));
         }
         else
         {
@@ -4751,11 +4751,15 @@ static bool hasColorContrast(const Color& rColor, const 
Color& rBackgroundColor)
     return false;
 }
 
-Color ImpEditEngine::GetAutoColor() const
+Color ImpEditEngine::GetAutoColor(const SvxFont* pFont) const
 {
     Color aColor;
 
-    Color aBackgroundColor = GetBackgroundColor();
+    Color aBackgroundColor;
+    if (pFont) //check for char background color
+        aBackgroundColor = pFont->GetFillColor();
+    if (aBackgroundColor == COL_AUTO) // check for aother background (i.e: 
cell color)
+        aBackgroundColor = GetBackgroundColor();
 
     const SfxViewShell* pKitSh = comphelper::LibreOfficeKit::isActive() ? 
SfxViewShell::Current() : nullptr;
     if (pKitSh)

Reply via email to