sc/source/ui/pagedlg/tphfedit.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit 695dc7484afd2af9c88b3d1032a6a4bbadecaefa
Author:     Heiko Tietze <tietze.he...@gmail.com>
AuthorDate: Mon Aug 29 15:16:17 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Sep 7 08:26:30 2022 +0200

    Resolves tdf#145159 - Use display colors in Header/Footer dialog
    
    Change-Id: Ia19babe3603f653fa631f3d138b43103a553e944
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138998
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139412
    Tested-by: Jenkins

diff --git a/sc/source/ui/pagedlg/tphfedit.cxx 
b/sc/source/ui/pagedlg/tphfedit.cxx
index c71c67b0842b..fa5209850b07 100644
--- a/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/sc/source/ui/pagedlg/tphfedit.cxx
@@ -23,6 +23,7 @@
 #include <editeng/editobj.hxx>
 #include <editeng/editview.hxx>
 #include <editeng/adjustitem.hxx>
+#include <editeng/colritem.hxx>
 #include <editeng/fhgtitem.hxx>
 #include <sfx2/objsh.hxx>
 #include <sfx2/sfxdlg.hxx>
@@ -87,6 +88,10 @@ void ScEditWindow::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
     if (mbRTL)
         
m_xEditEngine->SetDefaultHorizontalTextDirection(EEHorizontalTextDirection::R2L);
 
+    Color aBgColor = 
svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
+    rDevice.SetBackground(aBgColor);
+    m_xEditView->SetBackgroundColor(aBgColor);
+
     auto tmpAcc = mxAcc.get();
     if (!tmpAcc)
         return;
@@ -145,6 +150,13 @@ void ScEditWindow::SetFont( const ScPatternAttr& rPattern )
     pSet->Put( 
rPattern.GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT) );
     pSet->Put( 
rPattern.GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) );
     pSet->Put( 
rPattern.GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) );
+    // font color used, suitable header/footer background color set in 
ScEditWindow::SetDrawingArea
+    Color aFgColor = svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR, 
false).nColor;
+    if (aFgColor == COL_AUTO) {
+        Color aBgColor = 
svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
+        aFgColor = aBgColor.IsDark() ? COL_WHITE : COL_BLACK;
+    }
+    pSet->Put(SvxColorItem(aFgColor, EE_CHAR_COLOR));
     if (mbRTL)
         pSet->Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
     GetEditEngine()->SetDefaults( std::move(pSet) );

Reply via email to