sc/source/ui/miscdlgs/autofmt.cxx        |    4 +++-
 svtools/source/control/scriptedtext.cxx  |    6 ++++--
 sw/source/ui/table/autoformatpreview.cxx |    4 +++-
 3 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 5b2238ce779c44378f0a86e498eda39f50df3542
Author:     Heiko Tietze <tietze.he...@gmail.com>
AuthorDate: Thu Mar 24 08:40:24 2022 +0100
Commit:     Heiko Tietze <heiko.tie...@documentfoundation.org>
CommitDate: Thu Mar 24 15:36:03 2022 +0100

    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.tie...@documentfoundation.org>

diff --git a/sc/source/ui/miscdlgs/autofmt.cxx 
b/sc/source/ui/miscdlgs/autofmt.cxx
index 375294c05358..877c412a5966 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 fc7e3e8a703e..18c6445b95e5 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 ed101b60a81c..2a2318252c9f 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);
 

Reply via email to