editeng/source/editeng/impedit.hxx | 2 +- editeng/source/editeng/impedit3.cxx | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
New commits: commit 2347353749b097a581a5433b04d74502991b471f Author: Pranam Lashkari <[email protected]> AuthorDate: Fri Jan 2 02:43:25 2026 +0530 Commit: Christian Lohmaier <[email protected]> CommitDate: Mon Jan 26 12:16:12 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 Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197918 Reviewed-by: Adolfo Jayme Barrientos <[email protected]> Tested-by: Christian Lohmaier <[email protected]> Reviewed-by: Christian Lohmaier <[email protected]> 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)
