editeng/source/editeng/impedit.hxx | 2 +- editeng/source/editeng/impedit3.cxx | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
New commits: commit 9260fcd78ac7a8df87244521990805bd39df81ea Author: Caolán McNamara <[email protected]> AuthorDate: Wed Jan 21 11:22:17 2026 +0000 Commit: Adolfo Jayme Barrientos <[email protected]> CommitDate: Fri Jan 23 07:50:09 2026 +0100 background color should start initialized to COL_AUTO Change-Id: I09ad8f22f7ea6236d4a0b2a842571c32c2d0684b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197743 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <[email protected]> diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index a3d16a3158f8..986444e44357 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4970,7 +4970,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 e0ecd933786861afb8f479c621a052a1f29ab997 Author: Pranam Lashkari <[email protected]> AuthorDate: Fri Jan 2 02:43:25 2026 +0530 Commit: Adolfo Jayme Barrientos <[email protected]> CommitDate: Fri Jan 23 07:49:53 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/+/197742 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <[email protected]> diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 8dd95542981a..9c3e6a7524e1 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -833,7 +833,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 c2ba71f5cceb..a3d16a3158f8 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -3122,7 +3122,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 { @@ -4966,11 +4966,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)
