sc/inc/patattr.hxx                     |   50 +++++++++++++---
 sc/qa/unit/helper/qahelper.cxx         |   26 ++++----
 sc/qa/unit/subsequent_export_test4.cxx |    4 -
 sc/qa/unit/ucalc.cxx                   |    2 
 sc/qa/unit/uicalc/uicalc.cxx           |   10 +--
 sc/qa/unit/uicalc/uicalc2.cxx          |   10 +--
 sc/source/core/data/column2.cxx        |    6 -
 sc/source/core/data/global.cxx         |    2 
 sc/source/core/data/patattr.cxx        |  103 +++++++++++++++++++--------------
 sc/source/core/tool/editutil.cxx       |    2 
 sc/source/core/tool/interpr1.cxx       |    4 -
 sc/source/filter/excel/xecontent.cxx   |    8 +-
 sc/source/filter/excel/xehelper.cxx    |   23 ++++---
 sc/source/filter/excel/xestyle.cxx     |   16 ++---
 sc/source/filter/excel/xlstyle.cxx     |   18 ++---
 sc/source/filter/inc/xestyle.hxx       |   18 ++---
 sc/source/filter/inc/xlstyle.hxx       |    8 +-
 sc/source/ui/cctrl/dpcontrol.cxx       |    5 -
 sc/source/ui/docshell/docsh3.cxx       |    4 -
 sc/source/ui/vba/vbarange.cxx          |    4 -
 sc/source/ui/view/cellsh1.cxx          |    8 +-
 sc/source/ui/view/gridwin4.cxx         |    6 -
 sc/source/ui/view/output2.cxx          |   12 +--
 sc/source/ui/view/printfun.cxx         |    8 +-
 24 files changed, 210 insertions(+), 147 deletions(-)

New commits:
commit 3537cef02c25c2c2459d7900eed13eeec533b7ae
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Tue May 16 22:10:10 2023 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Thu Jun 22 02:21:15 2023 +0200

    sc: factor out color from setting vcl::Font from a ItemSet
    
    vcl::Font color parameter is deprecated so we need to handle the
    color separately from font data. This refactors GetFont into 2
    separate functions - fillFontOnly and fillColor, where fillFont
    now does the same as previously GetFont function did.
    All GetFont calls have been changed depending on if we need only
    the font data or also color - where the color is now treated in
    a different call. There are a couple of calls where fillFont was
    used, because to change that needs a more complex refactoring.
    
    Change-Id: I0a2ce50a0cb28d196fcff87e1e80099a2bb60a9e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151858
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 49cae62994b4..ba15cfb1dd27 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -92,23 +92,55 @@ public:
     SvxCellOrientation      GetCellOrientation( const SfxItemSet* pCondSet = 
nullptr ) const;
 
     /** Static helper function to fill a font object from the passed item set. 
*/
-    static void             GetFont( vcl::Font& rFont, const SfxItemSet& 
rItemSet,
+    static void fillFontOnly(vcl::Font& rFont, const SfxItemSet& rItemSet,
+                                        const OutputDevice* pOutDev = nullptr,
+                                        const Fraction* pScale = nullptr,
+                                        const SfxItemSet* pCondSet = nullptr,
+                                        SvtScriptType nScript = 
SvtScriptType::NONE);
+
+    static void fillFont( vcl::Font& rFont, const SfxItemSet& rItemSet,
                                         ScAutoFontColorMode eAutoMode,
                                         const OutputDevice* pOutDev = nullptr,
                                         const Fraction* pScale = nullptr,
                                         const SfxItemSet* pCondSet = nullptr,
                                         SvtScriptType nScript = 
SvtScriptType::NONE, const Color* pBackConfigColor = nullptr,
-                                        const Color* pTextConfigColor = 
nullptr );
+                                        const Color* pTextConfigColor = 
nullptr);
+
+    static void fillColor(Color& rColor, const SfxItemSet& rItemSet, 
ScAutoFontColorMode eAutoMode, const SfxItemSet* pCondSet = nullptr,
+                            const Color* pBackConfigColor = nullptr, const 
Color* pTextConfigColor = nullptr);
+
 
     static ScDxfFont        GetDxfFont(const SfxItemSet& rSet, SvtScriptType 
nScript);
+
+    void fillColor(Color& rColor,
+                    ScAutoFontColorMode eAutoMode,
+                    const SfxItemSet* pCondSet = nullptr,
+                    const Color* pBackConfigColor = nullptr,
+                    const Color* pTextConfigColor = nullptr) const
+    {
+        fillColor(rColor, GetItemSet(), eAutoMode, pCondSet, pBackConfigColor, 
pTextConfigColor);
+    }
+
+    void fillFontOnly(vcl::Font& rFont,
+                    const OutputDevice* pOutDev = nullptr,
+                    const Fraction* pScale = nullptr,
+                    const SfxItemSet* pCondSet = nullptr,
+                    SvtScriptType nScript = SvtScriptType::NONE) const
+    {
+        fillFontOnly(rFont, GetItemSet(), pOutDev, pScale, pCondSet, nScript);
+    }
+
     /** Fills a font object from the own item set. */
-    void                    GetFont( vcl::Font& rFont, ScAutoFontColorMode 
eAutoMode,
-                                     const OutputDevice* pOutDev = nullptr,
-                                     const Fraction* pScale = nullptr,
-                                     const SfxItemSet* pCondSet = nullptr,
-                                     SvtScriptType nScript = 
SvtScriptType::NONE,
-                                     const Color* pBackConfigColor = nullptr,
-                                     const Color* pTextConfigColor = nullptr ) 
const;
+    void fillFont(vcl::Font& rFont, ScAutoFontColorMode eAutoMode,
+                    const OutputDevice* pOutDev = nullptr,
+                    const Fraction* pScale = nullptr,
+                    const SfxItemSet* pCondSet = nullptr,
+                    SvtScriptType nScript = SvtScriptType::NONE,
+                    const Color* pBackConfigColor = nullptr,
+                    const Color* pTextConfigColor = nullptr) const
+    {
+        fillFont(rFont, GetItemSet(), eAutoMode, pOutDev, pScale, pCondSet, 
nScript, pBackConfigColor, pTextConfigColor);
+    }
 
     /** Converts all Calc items contained in rSrcSet to edit engine items and 
puts them into rEditSet. */
     static void             FillToEditItemSet( SfxItemSet& rEditSet, const 
SfxItemSet& rSrcSet, const SfxItemSet* pCondSet = nullptr );
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index b5236da1f89e..efb2e68c4fbc 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -176,32 +176,36 @@ void ScModelTestBase::testFormats(ScDocument* 
pDoc,std::u16string_view sFormat)
     //test Sheet2
     const ScPatternAttr* pPattern = pDoc->GetPattern(0, 0, 1);
     vcl::Font aFont;
-    pPattern->GetFont(aFont,SC_AUTOCOL_RAW);
+    Color aColor;
+
+    pPattern->fillFontOnly(aFont);
+    pPattern->fillColor(aColor, SC_AUTOCOL_RAW);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 10", tools::Long(200), 
aFont.GetFontSize().getHeight());
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("font color should be black", COL_AUTO, 
aFont.GetColor());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("font color should be black", COL_AUTO, 
aColor);
     pPattern = pDoc->GetPattern(0,1,1);
-    pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+    pPattern->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 12", tools::Long(240), 
aFont.GetFontSize().getHeight());
     pPattern = pDoc->GetPattern(0,2,1);
-    pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+    pPattern->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be italic", ITALIC_NORMAL, 
aFont.GetItalic());
     pPattern = pDoc->GetPattern(0,4,1);
-    pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+    pPattern->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
     pPattern = pDoc->GetPattern(1,0,1);
-    pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be blue", COL_BLUE, 
aFont.GetColor());
+    pPattern->fillFontOnly(aFont);
+    pPattern->fillColor(aColor, SC_AUTOCOL_RAW);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be blue", COL_BLUE, aColor);
     pPattern = pDoc->GetPattern(1,1,1);
-    pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+    pPattern->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be striked out with a single 
line", STRIKEOUT_SINGLE, aFont.GetStrikeout());
     //some tests on sheet2 only for ods
     if (sFormat == u"calc8")
     {
         pPattern = pDoc->GetPattern(1,2,1);
-        pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+        pPattern->fillFontOnly(aFont);
         CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be striked out with a double 
line", STRIKEOUT_DOUBLE, aFont.GetStrikeout());
         pPattern = pDoc->GetPattern(1,3,1);
-        pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+        pPattern->fillFontOnly(aFont);
         CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be underlined with a dotted 
line", LINESTYLE_DOTTED, aFont.GetUnderline());
         //check row height import
         //disable for now until we figure out cause of win tinderboxes test 
failures
@@ -222,7 +226,7 @@ void ScModelTestBase::testFormats(ScDocument* 
pDoc,std::u16string_view sFormat)
         CPPUNIT_ASSERT_EQUAL( aKnownGoodStr, aTestStr );
     }
     pPattern = pDoc->GetPattern(1,4,1);
-    Color aColor = pPattern->GetItem(ATTR_BACKGROUND).GetColor();
+    aColor = pPattern->GetItem(ATTR_BACKGROUND).GetColor();
     CPPUNIT_ASSERT_EQUAL_MESSAGE("background color should be green", 
COL_LIGHTGREEN, aColor);
     pPattern = pDoc->GetPattern(2,0,1);
     SvxCellHorJustify eHorJustify = 
pPattern->GetItem(ATTR_HOR_JUSTIFY).GetValue();
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index b34a8fcdadf6..096b1d5603c7 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -1393,13 +1393,13 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testWholeRowBold)
     ScDocument* pDoc = getScDoc();
     CPPUNIT_ASSERT_EQUAL(SCCOL(INITIALCOLCOUNT), 
pDoc->GetAllocatedColumnsCount(0));
     vcl::Font aFont;
-    pDoc->GetPattern(pDoc->MaxCol(), 1, 0)->GetFont(aFont, SC_AUTOCOL_RAW);
+    pDoc->GetPattern(pDoc->MaxCol(), 1, 0)->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
 
     saveAndReload("Calc Office Open XML");
     pDoc = getScDoc();
     CPPUNIT_ASSERT_EQUAL(SCCOL(INITIALCOLCOUNT), 
pDoc->GetAllocatedColumnsCount(0));
-    pDoc->GetPattern(pDoc->MaxCol(), 1, 0)->GetFont(aFont, SC_AUTOCOL_RAW);
+    pDoc->GetPattern(pDoc->MaxCol(), 1, 0)->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
 }
 
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index f966fdecea18..5642654a0d2e 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1244,7 +1244,7 @@ CPPUNIT_TEST_FIXTURE(Test, 
testIteratorsUnallocatedColumnsAttributes)
     CPPUNIT_ASSERT_EQUAL(allocatedColsCount, 
m_pDoc->GetAllocatedColumnsCount(0));
     vcl::Font aFont;
     const ScPatternAttr* pattern = m_pDoc->GetPattern(m_pDoc->MaxCol(), 1, 0);
-    pattern->GetFont(aFont, SC_AUTOCOL_RAW);
+    pattern->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
 
     // Test iterators.
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 89bdeeb1fa6d..d96b78b87136 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -708,7 +708,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124820)
 
     vcl::Font aFont;
     const ScPatternAttr* pPattern = pDoc->GetPattern(1, 1, 0);
-    pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+    pPattern->fillFontOnly(aFont);
 
     // Without the fix in place, this test would have failed here
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be striked out", 
STRIKEOUT_SINGLE,
@@ -1674,7 +1674,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testPasteTransposed)
     CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", 
pDoc->HasNote(ScAddress(0, 0, 0)));
     const ScPatternAttr* pPattern = pDoc->GetPattern(0, 1, 0);
     vcl::Font aFont;
-    pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+    pPattern->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
 
     goToCell("A1:A3");
@@ -1700,7 +1700,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testPasteTransposed)
     CPPUNIT_ASSERT_EQUAL(OUString("Note in A1"), pDoc->GetNote(ScAddress(0, 0, 
0))->GetText());
 
     pPattern = pDoc->GetPattern(1, 0, 0);
-    pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+    pPattern->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
 }
 
@@ -1729,7 +1729,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testPasteAsLink)
     CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", 
pDoc->HasNote(ScAddress(0, 0, 0)));
     const ScPatternAttr* pPattern = pDoc->GetPattern(0, 1, 0);
     vcl::Font aFont;
-    pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+    pPattern->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
 
     goToCell("A1:A3");
@@ -1752,7 +1752,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testPasteAsLink)
     CPPUNIT_ASSERT_MESSAGE("There should be no note on C1", 
!pDoc->HasNote(ScAddress(2, 0, 0)));
 
     pPattern = pDoc->GetPattern(2, 1, 0);
-    pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+    pPattern->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be normal (cell attributes 
should not be copied)",
                                  WEIGHT_NORMAL, aFont.GetWeight());
 }
diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx
index 69db567f305c..3be123de219d 100644
--- a/sc/qa/unit/uicalc/uicalc2.cxx
+++ b/sc/qa/unit/uicalc/uicalc2.cxx
@@ -1218,16 +1218,16 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, 
testUnallocatedColumnsAttributes)
     // That shouldn't need allocating more columns, just changing the default 
attribute.
     CPPUNIT_ASSERT_EQUAL(INITIALCOLCOUNT, pDoc->GetAllocatedColumnsCount(0));
     vcl::Font aFont;
-    pDoc->GetPattern(pDoc->MaxCol(), 0, 0)->GetFont(aFont, SC_AUTOCOL_RAW);
+    pDoc->GetPattern(pDoc->MaxCol(), 0, 0)->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
 
     goToCell("A2:CV2"); // first 100 cells in row 2
     dispatchCommand(mxComponent, ".uno:Bold", {});
     // These need to be explicitly allocated.
     CPPUNIT_ASSERT_EQUAL(SCCOL(100), pDoc->GetAllocatedColumnsCount(0));
-    pDoc->GetPattern(99, 1, 0)->GetFont(aFont, SC_AUTOCOL_RAW);
+    pDoc->GetPattern(99, 1, 0)->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
-    pDoc->GetPattern(100, 1, 0)->GetFont(aFont, SC_AUTOCOL_RAW);
+    pDoc->GetPattern(100, 1, 0)->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should not be bold", WEIGHT_NORMAL, 
aFont.GetWeight());
 
     goToCell("CW3:" + pDoc->MaxColAsString() + "3"); // All but first 100 
cells in row 3.
@@ -1235,9 +1235,9 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, 
testUnallocatedColumnsAttributes)
     // First 100 columns need to be allocated to not be bold, the rest should 
be handled
     // by the default attribute.
     CPPUNIT_ASSERT_EQUAL(SCCOL(100), pDoc->GetAllocatedColumnsCount(0));
-    pDoc->GetPattern(99, 2, 0)->GetFont(aFont, SC_AUTOCOL_RAW);
+    pDoc->GetPattern(99, 2, 0)->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should not be bold", WEIGHT_NORMAL, 
aFont.GetWeight());
-    pDoc->GetPattern(100, 2, 0)->GetFont(aFont, SC_AUTOCOL_RAW);
+    pDoc->GetPattern(100, 2, 0)->fillFontOnly(aFont);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
 }
 
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 5a4ca1bb2340..38cfe9d9ee41 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -284,7 +284,7 @@ tools::Long ScColumn::GetNeededSize(
         Fraction aFontZoom = ( eOrient == SvxCellOrientation::Standard ) ? 
rZoomX : rZoomY;
         vcl::Font aFont;
         // font color doesn't matter here
-        pPattern->GetFont( aFont, SC_AUTOCOL_BLACK, pDev, &aFontZoom, 
pCondSet, nScript );
+        pPattern->fillFontOnly(aFont, pDev, &aFontZoom, pCondSet, nScript);
         pDev->SetFont(aFont);
     }
 
@@ -755,8 +755,8 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
         const ScPatternAttr* pPattern = GetPattern( nRow );
         vcl::Font aFont;
         // font color doesn't matter here
-        pPattern->GetFont( aFont, SC_AUTOCOL_BLACK, pDev, &rZoomX );
-        pDev->SetFont( aFont );
+        pPattern->fillFontOnly(aFont, pDev, &rZoomX);
+        pDev->SetFont(aFont);
         const SvxMarginItem* pMargin = &pPattern->GetItem(ATTR_MARGIN);
         tools::Long nMargin = static_cast<tools::Long>( 
pMargin->GetLeftMargin() * nPPTX ) +
                         static_cast<tools::Long>( pMargin->GetRightMargin() * 
nPPTX );
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 02167599e926..459798d1f26f 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -516,7 +516,7 @@ void ScGlobal::InitTextHeight(const SfxItemPool* pPool)
     ScopedVclPtrInstance< VirtualDevice > pVirtWindow( *pDefaultDev );
     pVirtWindow->SetMapMode(MapMode(MapUnit::MapPixel));
     vcl::Font aDefFont;
-    rPattern.GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // Font color 
doesn't matter here
+    rPattern.fillFontOnly(aDefFont, pVirtWindow); // Font color doesn't matter 
here
     pVirtWindow->SetFont(aDefFont);
     sal_uInt16 nTest = static_cast<sal_uInt16>(
         pVirtWindow->PixelToLogic(Size(0, pVirtWindow->GetTextHeight()), 
MapMode(MapUnit::MapTwip)).Height());
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 96abc6676cba..25900b7ac099 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -246,11 +246,26 @@ void getFontIDsByScriptType(SvtScriptType nScript,
 
 }
 
-void ScPatternAttr::GetFont(
+void ScPatternAttr::fillFont(
         vcl::Font& rFont, const SfxItemSet& rItemSet, ScAutoFontColorMode 
eAutoMode,
         const OutputDevice* pOutDev, const Fraction* pScale,
         const SfxItemSet* pCondSet, SvtScriptType nScript,
-        const Color* pBackConfigColor, const Color* pTextConfigColor )
+        const Color* pBackConfigColor, const Color* pTextConfigColor)
+{
+    Color aColor;
+
+    //  determine effective font color
+    ScPatternAttr::fillFontOnly(rFont, rItemSet, pOutDev, pScale, pCondSet, 
nScript);
+    ScPatternAttr::fillColor(aColor, rItemSet, eAutoMode, pCondSet, 
pBackConfigColor, pTextConfigColor);
+
+    //  set font effects
+    rFont.SetColor(aColor);
+}
+
+void ScPatternAttr::fillFontOnly(
+        vcl::Font& rFont, const SfxItemSet& rItemSet,
+        const OutputDevice* pOutDev, const Fraction* pScale,
+        const SfxItemSet* pCondSet, SvtScriptType nScript)
 {
     // Read items
 
@@ -266,7 +281,6 @@ void ScPatternAttr::GetFont(
     bool bShadow;
     FontEmphasisMark eEmphasis;
     FontRelief eRelief;
-    Color aColor;
     LanguageType eLang;
 
     TypedWhichId<SvxFontItem> nFontId(0);
@@ -276,7 +290,7 @@ void ScPatternAttr::GetFont(
     TypedWhichId<SvxLanguageItem> nLangId(0);
     getFontIDsByScriptType(nScript, nFontId, nHeightId, nWeightId, nPostureId, 
nLangId);
 
-    if ( pCondSet )
+    if (pCondSet)
     {
         pFontAttr = pCondSet->GetItemIfSet( nFontId );
         if ( !pFontAttr )
@@ -337,11 +351,6 @@ void ScPatternAttr::GetFont(
             pCharReliefItem = &rItemSet.Get( ATTR_FONT_RELIEF );
         eRelief = pCharReliefItem->GetValue();
 
-        const SvxColorItem* pColorItem = pCondSet->GetItemIfSet( 
ATTR_FONT_COLOR );
-        if ( !pColorItem )
-            pColorItem = &rItemSet.Get( ATTR_FONT_COLOR );
-        aColor = pColorItem->GetValue();
-
         const SvxLanguageItem* pLanguageItem = pCondSet->GetItemIfSet( nLangId 
);
         if ( !pLanguageItem )
             pLanguageItem = &rItemSet.Get( nLangId );
@@ -361,7 +370,6 @@ void ScPatternAttr::GetFont(
         bShadow = rItemSet.Get( ATTR_FONT_SHADOWED ).GetValue();
         eEmphasis = rItemSet.Get( ATTR_FONT_EMPHASISMARK ).GetEmphasisMark();
         eRelief = rItemSet.Get( ATTR_FONT_RELIEF ).GetValue();
-        aColor = rItemSet.Get( ATTR_FONT_COLOR ).GetValue();
         // for graphite language features
         eLang = rItemSet.Get( nLangId ).GetLanguage();
     }
@@ -409,10 +417,39 @@ void ScPatternAttr::GetFont(
         rFont.SetFontSize( Size( 0, static_cast<tools::Long>(nFontHeight) ) );
     }
 
-    //  determine effective font color
+    //  set font effects
+    rFont.SetWeight( eWeight );
+    rFont.SetItalic( eItalic );
+    rFont.SetUnderline( eUnder );
+    rFont.SetOverline( eOver );
+    rFont.SetWordLineMode( bWordLine );
+    rFont.SetStrikeout( eStrike );
+    rFont.SetOutline( bOutline );
+    rFont.SetShadow( bShadow );
+    rFont.SetEmphasisMark( eEmphasis );
+    rFont.SetRelief( eRelief );
+    rFont.SetTransparent( true );
+}
+
+void ScPatternAttr::fillColor(Color& rColor, const SfxItemSet& rItemSet, 
ScAutoFontColorMode eAutoMode, const SfxItemSet* pCondSet, const Color* 
pBackConfigColor, const Color* pTextConfigColor)
+{
+    Color aColor = COL_TRANSPARENT;
+
+    SvxColorItem const* pColorItem = nullptr;
+
+    if (pCondSet)
+        pColorItem = pCondSet->GetItemIfSet(ATTR_FONT_COLOR);
+
+    if (!pColorItem)
+        pColorItem = &rItemSet.Get(ATTR_FONT_COLOR);
+
+    if (pColorItem)
+        aColor = pColorItem->GetValue();
+
 
-    if ( ( aColor == COL_AUTO && eAutoMode != SC_AUTOCOL_RAW ) ||
-            eAutoMode == SC_AUTOCOL_IGNOREFONT || eAutoMode == 
SC_AUTOCOL_IGNOREALL )
+    if ((aColor == COL_AUTO && eAutoMode != SC_AUTOCOL_RAW)
+        || eAutoMode == SC_AUTOCOL_IGNOREFONT
+        || eAutoMode == SC_AUTOCOL_IGNOREALL)
     {
         if ( eAutoMode == SC_AUTOCOL_BLACK )
             aColor = COL_BLACK;
@@ -422,17 +459,20 @@ void ScPatternAttr::GetFont(
             Color aBackColor;
             if ( pCondSet )
             {
-                const SvxBrushItem* pItem = pCondSet->GetItemIfSet( 
ATTR_BACKGROUND );
-                if ( !pItem )
-                    pItem = &rItemSet.Get( ATTR_BACKGROUND );
+                const SvxBrushItem* pItem = 
pCondSet->GetItemIfSet(ATTR_BACKGROUND);
+                if (!pItem)
+                    pItem = &rItemSet.Get(ATTR_BACKGROUND);
                 aBackColor = pItem->GetColor();
             }
             else
-                aBackColor = rItemSet.Get( ATTR_BACKGROUND ).GetColor();
+            {
+                aBackColor = rItemSet.Get(ATTR_BACKGROUND).GetColor();
+            }
 
             //  if background color attribute is transparent, use window color 
for brightness comparisons
-            if ( aBackColor == COL_TRANSPARENT ||
-                    eAutoMode == SC_AUTOCOL_IGNOREBACK || eAutoMode == 
SC_AUTOCOL_IGNOREALL )
+            if (aBackColor == COL_TRANSPARENT
+                || eAutoMode == SC_AUTOCOL_IGNOREBACK
+                || eAutoMode == SC_AUTOCOL_IGNOREALL)
             {
                 if (!comphelper::LibreOfficeKit::isActive())
                 {
@@ -470,7 +510,9 @@ void ScPatternAttr::GetFont(
                 aSysTextColor = *pTextConfigColor;
             }
             else
+            {
                 aSysTextColor = 
SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
+            }
 
             //  select the resulting color
             if ( aBackColor.IsDark() && aSysTextColor.IsDark() )
@@ -491,28 +533,7 @@ void ScPatternAttr::GetFont(
         }
     }
 
-    //  set font effects
-    rFont.SetWeight( eWeight );
-    rFont.SetItalic( eItalic );
-    rFont.SetUnderline( eUnder );
-    rFont.SetOverline( eOver );
-    rFont.SetWordLineMode( bWordLine );
-    rFont.SetStrikeout( eStrike );
-    rFont.SetOutline( bOutline );
-    rFont.SetShadow( bShadow );
-    rFont.SetEmphasisMark( eEmphasis );
-    rFont.SetRelief( eRelief );
-    rFont.SetColor( aColor );
-    rFont.SetTransparent( true );
-}
-
-void ScPatternAttr::GetFont(
-        vcl::Font& rFont, ScAutoFontColorMode eAutoMode,
-        const OutputDevice* pOutDev, const Fraction* pScale,
-        const SfxItemSet* pCondSet, SvtScriptType nScript,
-        const Color* pBackConfigColor, const Color* pTextConfigColor ) const
-{
-    GetFont( rFont, GetItemSet(), eAutoMode, pOutDev, pScale, pCondSet, 
nScript, pBackConfigColor, pTextConfigColor );
+    rColor = aColor;
 }
 
 ScDxfFont ScPatternAttr::GetDxfFont(const SfxItemSet& rItemSet, SvtScriptType 
nScript)
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index 43d903f60529..ce703b0f6a84 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -425,7 +425,7 @@ tools::Rectangle ScEditUtil::GetEditArea( const 
ScPatternAttr* pPattern, bool bF
         {                                   // empty cell
             vcl::Font aFont;
             // font color doesn't matter here
-            pPattern->GetFont( aFont, SC_AUTOCOL_BLACK, pDev, &aZoomY );
+            pPattern->fillFontOnly(aFont, pDev, &aZoomY );
             pDev->SetFont(aFont);
             nTextHeight = pDev->GetTextHeight() + nTopMargin + nBottomMargin;
         }
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index fc7fe021702c..fa0c56d5257f 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2415,8 +2415,8 @@ void ScInterpreter::ScCell()
 
             pPrinter->SetMapMode(MapMode(MapUnit::MapTwip));
             // font color doesn't matter here
-            mrDoc.GetDefPattern()->GetFont( aDefFont, SC_AUTOCOL_BLACK, 
pPrinter );
-            pPrinter->SetFont( aDefFont );
+            mrDoc.GetDefPattern()->fillFontOnly(aDefFont, pPrinter);
+            pPrinter->SetFont(aDefFont);
             tools::Long nZeroWidth = pPrinter->GetTextWidth( OUString( '0' ) );
             assert(nZeroWidth != 0);
             pPrinter->SetFont( aOldFont );
diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index 25a9afffdfd1..15141c161628 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -668,9 +668,11 @@ XclExpCFImpl::XclExpCFImpl( const XclExpRoot& rRoot, const 
ScCondFormatEntry& rF
         if( mbFontUsed )
         {
             vcl::Font aFont;
-            ScPatternAttr::GetFont( aFont, rItemSet, SC_AUTOCOL_RAW );
-            maFontData.FillFromVclFont( aFont );
-            mnFontColorId = GetPalette().InsertColor( maFontData.maColor, 
EXC_COLOR_CELLTEXT );
+            ::Color aColor;
+            ScPatternAttr::fillFontOnly(aFont, rItemSet);
+            ScPatternAttr::fillColor(aColor, rItemSet, SC_AUTOCOL_RAW);
+            maFontData.FillFromVclFont(aFont, aColor);
+            mnFontColorId = GetPalette().InsertColor(maFontData.maColor, 
EXC_COLOR_CELLTEXT);
         }
 
         // border
diff --git a/sc/source/filter/excel/xehelper.cxx 
b/sc/source/filter/excel/xehelper.cxx
index 997c1b2c507d..14fafd8a42ba 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -388,7 +388,9 @@ XclExpStringRef lclCreateFormattedString(
             nScript = nLastScript;
 
         // construct font from current text portion
-        SvxFont aFont( XclExpFontHelper::GetFontFromItemSet( rRoot, rItemSet, 
nScript ) );
+        SvxFont aFont(XclExpFontHelper::GetFontFromItemSet(rRoot, rItemSet, 
nScript));
+        Color aColor;
+        ScPatternAttr::fillColor(aColor, rItemSet, SC_AUTOCOL_RAW);
 
         // Excel start position of this portion
         sal_Int32 nXclPortionStart = xString->Len();
@@ -397,7 +399,7 @@ XclExpStringRef lclCreateFormattedString(
         if( nXclPortionStart < xString->Len() )
         {
             // insert font into buffer
-            sal_uInt16 nFontIdx = rFontBuffer.Insert( aFont, 
EXC_COLOR_CELLTEXT );
+            sal_uInt16 nFontIdx = rFontBuffer.Insert(aFont, aColor, 
EXC_COLOR_CELLTEXT);
             // insert font index into format run vector
             xString->AppendFormat( nXclPortionStart, nFontIdx );
         }
@@ -500,17 +502,20 @@ XclExpStringRef lclCreateFormattedString(
                 sal_Int16 nScript = xBreakIt->getScriptType( aXclPortionText, 
0 );
                 if( nScript == ApiScriptType::WEAK )
                     nScript = nLastScript;
-                SvxFont aFont( XclExpFontHelper::GetFontFromItemSet( rRoot, 
aItemSet, nScript ) );
+                SvxFont aFont( XclExpFontHelper::GetFontFromItemSet(rRoot, 
aItemSet, nScript));
+                Color aColor;
+                ScPatternAttr::fillColor(aColor, aItemSet, SC_AUTOCOL_RAW);
+
                 nLastScript = nScript;
 
                 // add escapement
                 aFont.SetEscapement( nEsc );
                 // modify automatic font color for hyperlinks
-                if( bIsHyperlink && aItemSet.Get( ATTR_FONT_COLOR ).GetValue() 
== COL_AUTO)
-                    aFont.SetColor( COL_LIGHTBLUE );
+                if (bIsHyperlink && aItemSet.Get(ATTR_FONT_COLOR).GetValue() 
== COL_AUTO)
+                    aColor = COL_LIGHTBLUE;
 
                 // insert font into buffer
-                sal_uInt16 nFontIdx = rFontBuffer.Insert( aFont, 
EXC_COLOR_CELLTEXT );
+                sal_uInt16 nFontIdx = rFontBuffer.Insert(aFont, aColor, 
EXC_COLOR_CELLTEXT);
                 // insert font index into format run vector
                 xString->AppendFormat( nXclPortionStart, nFontIdx );
             }
@@ -726,10 +731,12 @@ void XclExpHFConverter::AppendPortion( const 
EditTextObject* pTextObj, sal_Unico
 // --- font attributes ---
 
                 vcl::Font aFont;
+                Color aColor;
                 aItemSet.ClearItem();
                 SfxItemSet aEditSet( mrEE.GetAttribs( aSel ) );
                 ScPatternAttr::GetFromEditItemSet( aItemSet, aEditSet );
-                ScPatternAttr::GetFont( aFont, aItemSet, SC_AUTOCOL_RAW );
+                ScPatternAttr::fillFontOnly(aFont, aItemSet);
+                ScPatternAttr::fillColor(aColor, aItemSet, SC_AUTOCOL_RAW);
 
                 // font name and style
                 aNewData.maName = XclTools::GetXclFontName( 
aFont.GetFamilyName() );
@@ -782,7 +789,7 @@ void XclExpHFConverter::AppendPortion( const 
EditTextObject* pTextObj, sal_Unico
                 }
 
                 // font color
-                aNewData.maColor = aFont.GetColor();
+                aNewData.maColor = aColor;
                 if ( !aFontData.maColor.IsRGBEqual( aNewData.maColor ) )
                 {
                     aParaText.append("&K" + aNewData.maColor.AsRGBHexString());
diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index 3e335a50110c..33c2f2db8987 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -892,7 +892,7 @@ vcl::Font XclExpFontHelper::GetFontFromItemSet( const 
XclExpRoot& rRoot, const S
 
     // fill the font object
     vcl::Font aFont;
-    ScPatternAttr::GetFont( aFont, rItemSet, SC_AUTOCOL_RAW, nullptr, nullptr, 
nullptr, nScScript );
+    ScPatternAttr::fillFontOnly(aFont, rItemSet, nullptr, nullptr, nullptr, 
nScScript);
     return aFont;
 }
 
@@ -1222,18 +1222,18 @@ sal_uInt16 XclExpFontBuffer::Insert(
     return static_cast< sal_uInt16 >( nPos );
 }
 
-sal_uInt16 XclExpFontBuffer::Insert(
-        const SvxFont& rFont, XclExpColorType eColorType )
+sal_uInt16 XclExpFontBuffer::Insert(const SvxFont& rFont, Color const& rColor, 
XclExpColorType eColorType )
 {
-    return Insert( XclFontData( rFont ), eColorType );
+    return Insert(XclFontData(rFont, rColor), eColorType);
 }
 
-sal_uInt16 XclExpFontBuffer::Insert( const SfxItemSet& rItemSet,
-        sal_Int16 nScript, XclExpColorType eColorType, bool bAppFont )
+sal_uInt16 XclExpFontBuffer::Insert(const SfxItemSet& rItemSet, sal_Int16 
nScript, XclExpColorType eColorType, bool bAppFont )
 {
     // #i17050# script type now provided by caller
-    vcl::Font aFont = XclExpFontHelper::GetFontFromItemSet( GetRoot(), 
rItemSet, nScript );
-    return Insert( XclFontData( aFont ), eColorType, bAppFont );
+    vcl::Font aFont = XclExpFontHelper::GetFontFromItemSet(GetRoot(), 
rItemSet, nScript);
+    Color aColor;
+    ScPatternAttr::fillColor(aColor, rItemSet, SC_AUTOCOL_RAW);
+    return Insert(XclFontData(aFont, aColor), eColorType, bAppFont );
 }
 
 void XclExpFontBuffer::Save( XclExpStream& rStrm )
diff --git a/sc/source/filter/excel/xlstyle.cxx 
b/sc/source/filter/excel/xlstyle.cxx
index ae4a6f1f6f37..f42d30edc574 100644
--- a/sc/source/filter/excel/xlstyle.cxx
+++ b/sc/source/filter/excel/xlstyle.cxx
@@ -174,15 +174,15 @@ XclFontData::XclFontData()
     Clear();
 }
 
-XclFontData::XclFontData( const vcl::Font& rFont )
+XclFontData::XclFontData(const vcl::Font& rFont, Color const& rColor)
 {
     Clear();
-    FillFromVclFont( rFont );
+    FillFromVclFont(rFont, rColor);
 }
 
-XclFontData::XclFontData( const SvxFont& rFont )
+XclFontData::XclFontData(const SvxFont& rFont, Color const& rColor)
 {
-    FillFromSvxFont( rFont );
+    FillFromSvxFont(rFont, rColor);
 }
 
 void XclFontData::Clear()
@@ -199,11 +199,11 @@ void XclFontData::Clear()
     mbItalic = mbStrikeout = mbOutline = mbShadow = false;
 }
 
-void XclFontData::FillFromVclFont( const vcl::Font& rFont )
+void XclFontData::FillFromVclFont(const vcl::Font& rFont, Color const& rColor)
 {
     maName = XclTools::GetXclFontName( rFont.GetFamilyName() );   // 
substitute with MS fonts
     maStyle.clear();
-    maColor = rFont.GetColor();
+    maColor = rColor;
     SetScUnderline( rFont.GetUnderline() );
     mnEscapem = EXC_FONTESC_NONE;
     SetScHeight( rFont.GetFontSize().Height() );
@@ -216,10 +216,10 @@ void XclFontData::FillFromVclFont( const vcl::Font& rFont 
)
     mbShadow = rFont.IsShadow();
 }
 
-void XclFontData::FillFromSvxFont( const SvxFont& rFont )
+void XclFontData::FillFromSvxFont(const SvxFont& rFont, Color const& rColor)
 {
-    FillFromVclFont( rFont );
-    SetScEscapement( rFont.GetEscapement() );
+    FillFromVclFont(rFont, rColor);
+    SetScEscapement(rFont.GetEscapement());
 }
 
 // *** conversion of VCL/SVX constants *** ------------------------------------
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index 8c3493d352f3..bd72f8aa5552 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -217,18 +217,15 @@ public:
     /** Inserts a new font with the passed font data into the buffer if not 
present.
         @param bAppFont  true = Sets the application font; false = Inserts a 
new font.
         @return  The resulting Excel font index. */
-    sal_uInt16          Insert( const XclFontData& rFontData,
-                            XclExpColorType eColorType, bool bAppFont = false 
);
+    sal_uInt16          Insert(const XclFontData& rFontData, XclExpColorType 
eColorType, bool bAppFont = false );
     /** Inserts the SvxFont into the buffer if not present, e.g. where 
escapements are used.
         @return  The resulting Excel font index. */
-    sal_uInt16          Insert( const SvxFont& rFont,
-                            XclExpColorType eColorType );
+    sal_uInt16          Insert(const SvxFont& rFont, Color const& rColor, 
XclExpColorType eColorType);
     /** Inserts the font contained in the passed item set into the buffer, if 
not present.
         @param nScript  The script type of the font properties to be used.
         @param bAppFont  true = Sets the application font; false = Inserts a 
new font.
         @return  The resulting Excel font index. */
-    sal_uInt16          Insert( const SfxItemSet& rItemSet, sal_Int16 nScript,
-                            XclExpColorType eColorType, bool bAppFont );
+    sal_uInt16          Insert(const SfxItemSet& rItemSet, sal_Int16 nScript, 
XclExpColorType eColorType, bool bAppFont);
 
     /** Writes all FONT records contained in this buffer. */
     virtual void        Save( XclExpStream& rStrm ) override;
@@ -372,13 +369,14 @@ struct XclExpCellBorder : public XclCellBorder
     @descr  Provides functions to fill from item sets and to fill to Excel 
record data. */
 struct XclExpCellArea : public XclCellArea
 {
-    sal_uInt32          mnForeColorId;  /// Foreground color ID.
-    sal_uInt32          mnBackColorId;  /// Background color ID.
+    sal_uInt32 mnForeColorId;  /// Foreground color ID.
+    sal_uInt32 mnBackColorId;  /// Background color ID.
+
     Color maForeColor; // Actual foreground color
     Color maBackColor; // Actual background color
 
-    explicit            XclExpCellArea();
-    explicit            XclExpCellArea(Color aForeColor, Color aBackColor);
+    explicit XclExpCellArea();
+    explicit XclExpCellArea(Color aForeColor, Color aBackColor);
 
     /** Fills the area attributes from the passed item set.
         @return  true = At least one area item is set. */
diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx
index 098d2d3346b8..d1faabc51ae6 100644
--- a/sc/source/filter/inc/xlstyle.hxx
+++ b/sc/source/filter/inc/xlstyle.hxx
@@ -299,16 +299,16 @@ struct XclFontData
     /** Constructs an empty font data structure. */
     explicit            XclFontData();
     /** Constructs a font data structure and fills it with the passed font 
attributes (except color). */
-    explicit            XclFontData( const vcl::Font& rFont );
+    explicit            XclFontData(const vcl::Font& rFont, Color const& 
aColor);
     /** As directly above but also fills in the escapement member. */
-    explicit            XclFontData( const SvxFont& rFont );
+    explicit            XclFontData(const SvxFont& rFont, Color const& aColor);
 
     /** Resets all members to default (empty) values. */
     void                Clear();
     /** Fills all members (except color and escapement) from the passed font. 
*/
-    void                FillFromVclFont( const vcl::Font& rFont );
+    void                FillFromVclFont(const vcl::Font& rFont, Color const& 
rColor);
     /** Fills all members (except color) from the passed SVX font. */
-    void                FillFromSvxFont( const SvxFont& rFont );
+    void                FillFromSvxFont(const SvxFont& rFont, Color const& 
rColor);
 
 // *** conversion of VCL/SVX constants *** ------------------------------------
 
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 34eea011ee05..cbb1aaa456c8 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -138,9 +138,8 @@ void ScDPFieldButton::draw()
         {
             //  use ScPatternAttr::GetFont only for font size
             vcl::Font aAttrFont;
-            mpDoc->GetPool()->GetDefaultItem(ATTR_PATTERN).
-                GetFont( aAttrFont, SC_AUTOCOL_BLACK, mpOutDev, &maZoomY );
-            aTextFont.SetFontSize( aAttrFont.GetFontSize() );
+            
mpDoc->GetPool()->GetDefaultItem(ATTR_PATTERN).fillFontOnly(aAttrFont, 
mpOutDev, &maZoomY);
+            aTextFont.SetFontSize(aAttrFont.GetFontSize());
         }
         mpOutDev->SetFont(aTextFont);
         mpOutDev->SetTextColor(mpStyle->GetButtonTextColor());
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 5d3cd076f623..789737e5f824 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -378,7 +378,7 @@ void ScDocShell::CalcOutputFactor()
     vcl::Font aOldFont = pRefDev->GetFont();
 
     pRefDev->SetMapMode(MapMode(MapUnit::MapPixel));
-    pPattern->GetFont(aDefFont, SC_AUTOCOL_BLACK, pRefDev); // font color 
doesn't matter here
+    pPattern->fillFontOnly(aDefFont, pRefDev); // font color doesn't matter 
here
     pRefDev->SetFont(aDefFont);
     nPrinterWidth = 
pRefDev->PixelToLogic(Size(pRefDev->GetTextWidth(aTestString), 0), 
MapMode(MapUnit::Map100thMM)).Width();
     pRefDev->SetFont(aOldFont);
@@ -386,7 +386,7 @@ void ScDocShell::CalcOutputFactor()
 
     ScopedVclPtrInstance< VirtualDevice > pVirtWindow( 
*Application::GetDefaultDevice() );
     pVirtWindow->SetMapMode(MapMode(MapUnit::MapPixel));
-    pPattern->GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow);    // font 
color doesn't matter here
+    pPattern->fillFontOnly(aDefFont, pVirtWindow); // font color doesn't 
matter here
     pVirtWindow->SetFont(aDefFont);
     double nWindowWidth = pVirtWindow->GetTextWidth(aTestString) / 
ScGlobal::nScreenPPTX;
     nWindowWidth = o3tl::convert(nWindowWidth, o3tl::Length::twip, 
o3tl::Length::mm100);
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 089e92f8c948..913b05ceffc9 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -3834,8 +3834,8 @@ static double getDefaultCharWidth( ScDocShell* pDocShell )
     OutputDevice* pRefDevice = rDoc.GetRefDevice();
     ScPatternAttr* pAttr = rDoc.GetDefPattern();
     vcl::Font aDefFont;
-    pAttr->GetFont( aDefFont, SC_AUTOCOL_BLACK, pRefDevice );
-    pRefDevice->SetFont( aDefFont );
+    pAttr->fillFontOnly(aDefFont, pRefDevice);
+    pRefDevice->SetFont(aDefFont);
     tools::Long nCharWidth = pRefDevice->GetTextWidth( OUString( '0' ) );      
  // 1/100th mm
     return o3tl::convert<double>(nCharWidth, o3tl::Length::mm100, 
o3tl::Length::pt);
 }
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index c44cb95e77c9..b35796ff0c2e 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2643,7 +2643,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 if ( !aChars.isEmpty() )
                 {
                     vcl::Font aFont;
-                    pTabViewShell->GetSelectionPattern()->GetFont( aFont, 
SC_AUTOCOL_BLACK, nullptr, nullptr, nullptr,
+                    pTabViewShell->GetSelectionPattern()->fillFontOnly(aFont, 
nullptr, nullptr, nullptr,
                                                                 
pTabViewShell->GetSelectionScriptType() );
                     if ( !aFontName.isEmpty() )
                         aFont = vcl::Font( aFontName, Size(1,1) );
@@ -2657,9 +2657,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 SvxAbstractDialogFactory* pFact = 
SvxAbstractDialogFactory::Create();
 
                 // font color doesn't matter here
-                vcl::Font         aCurFont;
-                pTabViewShell->GetSelectionPattern()->GetFont( aCurFont, 
SC_AUTOCOL_BLACK, nullptr, nullptr, nullptr,
-                                                                
pTabViewShell->GetSelectionScriptType() );
+                vcl::Font aCurFont;
+                pTabViewShell->GetSelectionPattern()->fillFontOnly(aCurFont, 
nullptr, nullptr, nullptr,
+                                                                
pTabViewShell->GetSelectionScriptType());
 
                 SfxAllItemSet aSet( GetPool() );
                 aSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 83cffbd44b2f..bc2521531a37 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -120,7 +120,7 @@ static void lcl_DrawOneFrame( vcl::RenderContext* pDev, 
const tools::Rectangle&
     //  use ScPatternAttr::GetFont only for font size
     vcl::Font aAttrFont;
     rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN).
-                                    
GetFont(aAttrFont,SC_AUTOCOL_BLACK,pDev,&rZoomY);
+                                    fillFontOnly(aAttrFont, pDev, &rZoomY);
 
     //  everything else from application font
     vcl::Font aAppFont = pDev->GetSettings().GetStyleSettings().GetAppFont();
@@ -1914,8 +1914,8 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, 
SCCOL nX2, SCROW nY2,
     if ( nPageScript == SvtScriptType::LATIN )
     {
         //  use single font and call DrawText directly
-        rDefPattern.GetFont( aFont, SC_AUTOCOL_BLACK );
-        aFont.SetColor( COL_LIGHTGRAY );
+        rDefPattern.fillFontOnly(aFont);
+        aFont.SetColor(COL_LIGHTGRAY);
         //  font size is set as needed
     }
     else
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index fe8d06684517..d8dfb064e605 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -249,7 +249,8 @@ void ScDrawStringsVars::SetShrinkScale( tools::Long nScale, 
SvtScriptType nScrip
     if ( !bPixelToLogic )
         aFraction *= pOutput->aZoomY;
     vcl::Font aTmpFont;
-    pPattern->GetFont( aTmpFont, SC_AUTOCOL_RAW, pFmtDevice, &aFraction, 
pCondSet, nScript );
+    pPattern->fillFontOnly(aTmpFont, pFmtDevice, &aFraction, pCondSet, 
nScript);
+    // only need font height
     tools::Long nNewHeight = aTmpFont.GetFontHeight();
     if ( nNewHeight > 0 )
         aFont.SetFontHeight( nNewHeight );
@@ -331,12 +332,11 @@ void ScDrawStringsVars::SetPattern(
     else
         eColorMode = SC_AUTOCOL_PRINT;
 
-    if ( bPixelToLogic )
-        pPattern->GetFont( aFont, eColorMode, pFmtDevice, nullptr, pCondSet, 
nScript,
-                            &aBackConfigColor, &aTextConfigColor );
+    if (bPixelToLogic)
+        pPattern->fillFont(aFont, eColorMode, pFmtDevice, nullptr, pCondSet, 
nScript, &aBackConfigColor, &aTextConfigColor);
     else
-        pPattern->GetFont( aFont, eColorMode, pFmtDevice, &pOutput->aZoomY, 
pCondSet, nScript,
-                            &aBackConfigColor, &aTextConfigColor );
+        pPattern->fillFont(aFont, eColorMode, pFmtDevice, &pOutput->aZoomY, 
pCondSet, nScript, &aBackConfigColor, &aTextConfigColor );
+
     aFont.SetAlignment(ALIGN_BASELINE);
 
     // orientation
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 73eb7430ba71..9eb44e02c70b 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -1908,8 +1908,8 @@ tools::Long ScPrintFunc::DoNotes( tools::Long nNoteStart, 
bool bDoPrint, ScPrevi
 
     vcl::Font aMarkFont;
     ScAutoFontColorMode eColorMode = bUseStyleColor ? SC_AUTOCOL_DISPLAY : 
SC_AUTOCOL_PRINT;
-    rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN).GetFont( aMarkFont, 
eColorMode );
-    pDev->SetFont( aMarkFont );
+    rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN).fillFont(aMarkFont, 
eColorMode);
+    pDev->SetFont(aMarkFont);
     tools::Long nMarkLen = pDev->GetTextWidth("GW99999:");
     // without Space-Char, because it rarely arrives there
 
@@ -2323,8 +2323,8 @@ void ScPrintFunc::PrintPage( tools::Long nPageNo, SCCOL 
nX1, SCROW nY1, SCCOL nX
         ScPatternAttr aPattern( rDoc.GetPool() );
         vcl::Font aFont;
         ScAutoFontColorMode eColorMode = bUseStyleColor ? SC_AUTOCOL_DISPLAY : 
SC_AUTOCOL_PRINT;
-        aPattern.GetFont( aFont, eColorMode, pDev );
-        pDev->SetFont( aFont );
+        aPattern.fillFont(aFont, eColorMode, pDev);
+        pDev->SetFont(aFont);
 
         if (bDoRepCol)
         {

Reply via email to