Resolves tdf#140439 - AutoFormat Table preview not using DOCCOLOR
WYSIWYG preview should use the actual document color instead
the dialog/window background
Change-Id: Ifff07b2f754ed88cb7e60e0494092e266d3c7cf1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132023
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index 375294c..877c412 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -50,6 +50,8 @@
#include <scresid.hxx>
#include <document.hxx>
#include <viewdata.hxx>
#include <svtools/colorcfg.hxx>
#include <scmod.hxx>
#define FRAME_OFFSET 4
@@ -497,7 +499,7 @@ void ScAutoFmtPreview::DoPaint(vcl::RenderContext& rRenderContext)
Size aWndSize(GetOutputSizePixel());
vcl::Font aFont(aVD->GetFont());
Color aBackCol(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor());
const Color& aBackCol = SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor;
tools::Rectangle aRect(Point(), aWndSize);
aFont.SetTransparent( true );
diff --git a/svtools/source/control/scriptedtext.cxx b/svtools/source/control/scriptedtext.cxx
index fc7e3e8..18c6445 100644
--- a/svtools/source/control/scriptedtext.cxx
+++ b/svtools/source/control/scriptedtext.cxx
@@ -262,8 +262,10 @@ void SvtScriptedTextHelper_Impl::DrawText( const Point& _rPos )
{
nNextPos = maPosVec[ nPosVecIndex++ ];
nScript = maScriptVec[ nVecIndex ];
SetOutDevFont( nScript );
vcl::Font aFont = GetFont( nScript );
mrOutDevice.SetFont( aFont );
if (aFont.GetColor() == COL_AUTO)
mrOutDevice.SetTextColor( mrOutDevice.GetFillColor().IsDark() ? COL_WHITE : COL_BLACK);
mrOutDevice.DrawText( aCurrPos, maText, nThisPos, nNextPos - nThisPos );
aCurrPos.AdjustX(maWidthVec[ nVecIndex++ ] );
aCurrPos.AdjustX(mrOutDevice.GetTextHeight() / 5 ); // add 20% of font height as portion spacing
diff --git a/sw/source/ui/table/autoformatpreview.cxx b/sw/source/ui/table/autoformatpreview.cxx
index ed101b6..2a23182 100644
--- a/sw/source/ui/table/autoformatpreview.cxx
+++ b/sw/source/ui/table/autoformatpreview.cxx
@@ -36,6 +36,8 @@
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/processor2d/processor2dtools.hxx>
#include <strings.hrc>
#include <svtools/colorcfg.hxx>
#include <swmodule.hxx>
#include <autoformatpreview.hxx>
@@ -442,7 +444,7 @@ void AutoFormatPreview::Paint(vcl::RenderContext& rRenderContext, const tools::R
rRenderContext.SetFont(aFont);
rRenderContext.SetLineColor();
const Color& rWinColor = rRenderContext.GetSettings().GetStyleSettings().GetWindowColor();
const Color& rWinColor = SW_MOD()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor;
rRenderContext.SetBackground(Wallpaper(rWinColor));
rRenderContext.SetFillColor(rWinColor);