diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-01-18 21:19:26 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-01-18 23:24:31 +0000 |
commit | cf734427550f1a42f8ac669378719a1cad617bbb (patch) | |
tree | fbf53b687551af60dc5e082f65f6489d4972ed9a /svx | |
parent | 6bf8ffbf90e701073a65e88ce4de26e40a24a07a (diff) |
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/+/145758
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/fntctrl.cxx | 17 |
1 files changed, 13 insertions, 4 deletions
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(); + } } } |