svx/source/dialog/fntctrl.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
New commits: commit fa62e63d6b75aac80dd23520351de11c5a0c9ea4 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Jan 18 21:19:26 2023 +0000 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Thu Jan 19 09:51:08 2023 +0000 tdf#153088 format cells example text black on dark background with application colors, scheme: LibreOffice Dark enabled Change-Id: I465c97bf21b66c0122b59296d0c114bf115910ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145726 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index de39993061fd..255d8ab8d9d9 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -475,8 +475,12 @@ static void SetPrevFontEscapement(SvxFont& rFont, sal_uInt8 nProp, sal_uInt8 nEs void SvxFontPrevWindow::ApplySettings(vcl::RenderContext& rRenderContext) { - rRenderContext.SetTextColor( svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); - rRenderContext.SetBackground( svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor ); + Color aBgColor = svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; + Color aFgColor = svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR, false).nColor; + if (aFgColor == COL_AUTO) + aFgColor = aBgColor.IsDark() ? COL_WHITE : COL_BLACK; + rRenderContext.SetBackground(aBgColor); + rRenderContext.SetTextColor(aFgColor); } void SvxFontPrevWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) @@ -583,6 +587,7 @@ void SvxFontPrevWindow::Paint(vcl::RenderContext& rRenderContext, const tools::R rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip)); ApplySettings(rRenderContext); + rRenderContext.Erase(); Printer* pPrinter = pImpl->mpPrinter; const SvxFont& rFont = pImpl->maFont; @@ -985,8 +990,12 @@ void SvxFontPrevWindow::SetFromItemSet(const SfxItemSet &rSet, bool bPreviewBack if( GetWhich( rSet, SID_ATTR_BRUSH, nWhich ) ) { const SvxBrushItem& rBrush = static_cast<const SvxBrushItem&>( rSet.Get( nWhich ) ); - if( GPOS_NONE == rBrush.GetGraphicPos() ) - pImpl->mxBackColor = rBrush.GetColor(); + if (GPOS_NONE == rBrush.GetGraphicPos()) + { + const Color& rBrushColor = rBrush.GetColor(); + if (rBrushColor != COL_TRANSPARENT) + pImpl->mxBackColor = rBrush.GetColor(); + } } }