include/oox/drawingml/color.hxx        |   10 ++-
 oox/source/drawingml/color.cxx         |   84 +++++++++++++++++++++++++-
 sc/inc/patattr.hxx                     |   50 +++++++++++++---
 sc/inc/unonames.hxx                    |    2 
 sc/qa/extras/scstyleobj.cxx            |   35 ++++++++---
 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/stylesbuffer.hxx  |    3 
 sc/source/filter/inc/xestyle.hxx       |   18 ++---
 sc/source/filter/inc/xlstyle.hxx       |    8 +-
 sc/source/filter/oox/stylesbuffer.cxx  |   17 +++--
 sc/source/ui/cctrl/dpcontrol.cxx       |    5 -
 sc/source/ui/docshell/docsh3.cxx       |    4 -
 sc/source/ui/unoobj/cellsuno.cxx       |   13 ++++
 sc/source/ui/unoobj/styleuno.cxx       |    2 
 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 +-
 test/Library_subsequenttest.mk         |    1 
 test/source/beans/xpropertyset.cxx     |    9 ++
 34 files changed, 368 insertions(+), 165 deletions(-)

New commits:
commit 076ab906e6007b1a2e58e27af30700051a970004
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Tue May 16 22:10:10 2023 +0900
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Jun 22 21:00:34 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>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153447

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 bf8c89d0d125..a8fba640b732 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 80217c811847..a8d6e82c4da0 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -119,7 +119,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();
@@ -1908,8 +1908,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 649ccdd7349e..46d26860976e 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)
         {
commit e44737a9f22537e06e7806b4e1a4c64d21bc0b79
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Thu May 11 19:40:06 2023 +0900
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Jun 22 21:00:26 2023 +0200

    sc: add CharComplexColor and CellBackgroundComplexColor properties
    
    Change-Id: I30153796a39b2aa3648cb107905974ed6f0f3851
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151668
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153446

diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index 4617bcf46700..7a7396a358e4 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -50,6 +50,7 @@ inline constexpr OUStringLiteral SC_UNO_HASDRAWPAGES         
= u"HasDrawPages";
 
 //  CharacterProperties
 inline constexpr OUStringLiteral SC_UNONAME_CCOLOR           = u"CharColor";
+inline constexpr OUStringLiteral SC_UNONAME_CHAR_COMPLEX_COLOR = 
u"CharComplexColor";
 inline constexpr OUStringLiteral SC_UNONAME_CHEIGHT          = u"CharHeight";
 inline constexpr OUStringLiteral SC_UNONAME_CUNDER           = 
u"CharUnderline";
 inline constexpr OUStringLiteral SC_UNONAME_CUNDLCOL         = 
u"CharUnderlineColor";
@@ -97,6 +98,7 @@ inline constexpr OUStringLiteral SC_UNO_CTL_CLOCAL           
= u"CharLocaleCompl
 //  CellProperties
 inline constexpr OUStringLiteral SC_UNONAME_CELLSTYL         = u"CellStyle";
 inline constexpr OUStringLiteral SC_UNONAME_CELLBACK         = 
u"CellBackColor";
+inline constexpr OUStringLiteral SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR = 
u"CellBackgroundComplexColor";
 inline constexpr OUStringLiteral SC_UNONAME_CELLTRAN         = 
u"IsCellBackgroundTransparent";
 inline constexpr OUStringLiteral SC_UNONAME_CELLPRO          = 
u"CellProtection";
 inline constexpr OUStringLiteral SC_UNONAME_CELLHJUS         = u"HoriJustify";
diff --git a/sc/qa/extras/scstyleobj.cxx b/sc/qa/extras/scstyleobj.cxx
index 7b8ca77c03ab..813a59db944b 100644
--- a/sc/qa/extras/scstyleobj.cxx
+++ b/sc/qa/extras/scstyleobj.cxx
@@ -59,15 +59,32 @@ public:
 ScStyleObj::ScStyleObj()
     : UnoApiTest("/sc/qa/extras/testdocuments")
     , XNamed("ScStyleObj")
-    , XPropertySet({
-          "BottomBorder",          "BottomBorder2",     "CellProtection", 
"CharLocale",
-          "CharLocaleAsian",       "CharLocaleComplex", "CharPosture",    
"CharPostureAsian",
-          "CharPostureComplex",    "DiagonalBLTR",      "DiagonalBLTR2",  
"DiagonalTLBR",
-          "DiagonalTLBR2",         "HoriJustify",       "LeftBorder",     
"LeftBorder2",
-          "NumberFormat",          "Orientation",       "RightBorder",    
"RightBorder2",
-          "ShadowFormat",          "TableBorder",       "TopBorder",      
"TopBorder2",
-          "UserDefinedAttributes",
-      })
+    , XPropertySet({ "BottomBorder",
+                     "BottomBorder2",
+                     "CellProtection",
+                     "CharLocale",
+                     "CharLocaleAsian",
+                     "CharLocaleComplex",
+                     "CharPosture",
+                     "CharPostureAsian",
+                     "CharPostureComplex",
+                     "DiagonalBLTR",
+                     "DiagonalBLTR2",
+                     "DiagonalTLBR",
+                     "DiagonalTLBR2",
+                     "HoriJustify",
+                     "LeftBorder",
+                     "LeftBorder2",
+                     "NumberFormat",
+                     "Orientation",
+                     "RightBorder",
+                     "RightBorder2",
+                     "ShadowFormat",
+                     "TableBorder",
+                     "TopBorder",
+                     "TopBorder2",
+                     "UserDefinedAttributes",
+                     "CellBackgroundComplexColor" })
 {
 }
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 3dc012c0acd1..59112f39008a 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -65,6 +65,7 @@
 #include <com/sun/star/text/WritingMode2.hpp>
 #include <com/sun/star/text/textfield/Type.hpp>
 #include <com/sun/star/sheet/XConditionalFormats.hpp>
+#include <com/sun/star/util/XComplexColor.hpp>
 
 #include <autoform.hxx>
 #include <cellvalue.hxx>
@@ -156,9 +157,11 @@ static const SfxItemPropertySet* lcl_GetCellsPropertySet()
         { SC_UNONAME_BOTTBORDER,ATTR_BORDER,       
::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
         { SC_UNONAME_BOTTBORDER2,ATTR_BORDER,      
::cppu::UnoType<table::BorderLine2>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
         { SC_UNONAME_CELLBACK, ATTR_BACKGROUND,    
cppu::UnoType<sal_Int32>::get(),            0, MID_BACK_COLOR },
+        { SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, ATTR_BACKGROUND, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         { SC_UNONAME_CELLPRO,  ATTR_PROTECTION,    
cppu::UnoType<util::CellProtection>::get(), 0, 0 },
         { SC_UNONAME_CELLSTYL, 
SC_WID_UNO_CELLSTYL,cppu::UnoType<OUString>::get(),        0, 0 },
         { SC_UNONAME_CCOLOR,   ATTR_FONT_COLOR,    
cppu::UnoType<sal_Int32>::get(),            0, 0 },
+        { SC_UNONAME_CHAR_COMPLEX_COLOR,   ATTR_FONT_COLOR, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         { SC_UNONAME_COUTL,    ATTR_FONT_CONTOUR,  cppu::UnoType<bool>::get(), 
                 0, 0 },
         { SC_UNONAME_CCROSS,   
ATTR_FONT_CROSSEDOUT,cppu::UnoType<bool>::get(),                 0, 
MID_CROSSED_OUT },
         { SC_UNONAME_CEMPHAS,  
ATTR_FONT_EMPHASISMARK,cppu::UnoType<sal_Int16>::get(),         0, MID_EMPHASIS 
},
@@ -265,9 +268,11 @@ static const SfxItemPropertySet* lcl_GetRangePropertySet()
         { SC_UNONAME_BOTTBORDER,ATTR_BORDER,       
::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
         { SC_UNONAME_BOTTBORDER2,ATTR_BORDER,      
::cppu::UnoType<table::BorderLine2>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
         { SC_UNONAME_CELLBACK, ATTR_BACKGROUND,    
cppu::UnoType<sal_Int32>::get(),            0, MID_BACK_COLOR },
+        { SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, ATTR_BACKGROUND, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         { SC_UNONAME_CELLPRO,  ATTR_PROTECTION,    
cppu::UnoType<util::CellProtection>::get(), 0, 0 },
         { SC_UNONAME_CELLSTYL, 
SC_WID_UNO_CELLSTYL,cppu::UnoType<OUString>::get(),        0, 0 },
         { SC_UNONAME_CCOLOR,   ATTR_FONT_COLOR,    
cppu::UnoType<sal_Int32>::get(),            0, 0 },
+        { SC_UNONAME_CHAR_COMPLEX_COLOR,   ATTR_FONT_COLOR, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         { SC_UNONAME_COUTL,    ATTR_FONT_CONTOUR,  cppu::UnoType<bool>::get(), 
                 0, 0 },
         { SC_UNONAME_CCROSS,   
ATTR_FONT_CROSSEDOUT,cppu::UnoType<bool>::get(),                 0, 
MID_CROSSED_OUT },
         { SC_UNONAME_CEMPHAS,  
ATTR_FONT_EMPHASISMARK,cppu::UnoType<sal_Int16>::get(),         0, MID_EMPHASIS 
},
@@ -375,9 +380,11 @@ static const SfxItemPropertySet* lcl_GetCellPropertySet()
         { SC_UNONAME_BOTTBORDER,ATTR_BORDER,       
::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
         { SC_UNONAME_BOTTBORDER2,ATTR_BORDER,      
::cppu::UnoType<table::BorderLine2>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
         { SC_UNONAME_CELLBACK, ATTR_BACKGROUND,    
cppu::UnoType<sal_Int32>::get(),            0, MID_BACK_COLOR },
+        { SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, ATTR_BACKGROUND, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         { SC_UNONAME_CELLPRO,  ATTR_PROTECTION,    
cppu::UnoType<util::CellProtection>::get(), 0, 0 },
         { SC_UNONAME_CELLSTYL, 
SC_WID_UNO_CELLSTYL,cppu::UnoType<OUString>::get(),        0, 0 },
         { SC_UNONAME_CCOLOR,   ATTR_FONT_COLOR,    
cppu::UnoType<sal_Int32>::get(),            0, 0 },
+        { SC_UNONAME_CHAR_COMPLEX_COLOR,   ATTR_FONT_COLOR, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         { SC_UNONAME_COUTL,    ATTR_FONT_CONTOUR,  cppu::UnoType<bool>::get(), 
                 0, 0 },
         { SC_UNONAME_CCROSS,   
ATTR_FONT_CROSSEDOUT,cppu::UnoType<bool>::get(),                 0, 
MID_CROSSED_OUT },
         { SC_UNONAME_CEMPHAS,  
ATTR_FONT_EMPHASISMARK,cppu::UnoType<sal_Int16>::get(),         0, MID_EMPHASIS 
},
@@ -491,9 +498,11 @@ static const SfxItemPropertySet* lcl_GetColumnPropertySet()
         { SC_UNONAME_BOTTBORDER,ATTR_BORDER,       
::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
         { SC_UNONAME_BOTTBORDER2,ATTR_BORDER,      
::cppu::UnoType<table::BorderLine2>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
         { SC_UNONAME_CELLBACK, ATTR_BACKGROUND,    
cppu::UnoType<sal_Int32>::get(),            0, MID_BACK_COLOR },
+        { SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, ATTR_BACKGROUND, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         { SC_UNONAME_CELLPRO,  ATTR_PROTECTION,    
cppu::UnoType<util::CellProtection>::get(), 0, 0 },
         { SC_UNONAME_CELLSTYL, 
SC_WID_UNO_CELLSTYL,cppu::UnoType<OUString>::get(),        0, 0 },
         { SC_UNONAME_CCOLOR,   ATTR_FONT_COLOR,    
cppu::UnoType<sal_Int32>::get(),            0, 0 },
+        { SC_UNONAME_CHAR_COMPLEX_COLOR,   ATTR_FONT_COLOR, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         { SC_UNONAME_COUTL,    ATTR_FONT_CONTOUR,  cppu::UnoType<bool>::get(), 
                 0, 0 },
         { SC_UNONAME_CCROSS,   
ATTR_FONT_CROSSEDOUT,cppu::UnoType<bool>::get(),                 0, 
MID_CROSSED_OUT },
         { SC_UNONAME_CEMPHAS,  
ATTR_FONT_EMPHASISMARK,cppu::UnoType<sal_Int16>::get(),         0, MID_EMPHASIS 
},
@@ -602,9 +611,11 @@ static const SfxItemPropertySet* lcl_GetRowPropertySet()
         { SC_UNONAME_BOTTBORDER,ATTR_BORDER,       
::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
         { SC_UNONAME_BOTTBORDER2,ATTR_BORDER,      
::cppu::UnoType<table::BorderLine2>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
         { SC_UNONAME_CELLBACK, ATTR_BACKGROUND,    
cppu::UnoType<sal_Int32>::get(),            0, MID_BACK_COLOR },
+        { SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, ATTR_BACKGROUND, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         { SC_UNONAME_CELLPRO,  ATTR_PROTECTION,    
cppu::UnoType<util::CellProtection>::get(), 0, 0 },
         { SC_UNONAME_CELLSTYL, 
SC_WID_UNO_CELLSTYL,cppu::UnoType<OUString>::get(),        0, 0 },
         { SC_UNONAME_CCOLOR,   ATTR_FONT_COLOR,    
cppu::UnoType<sal_Int32>::get(),            0, 0 },
+        { SC_UNONAME_CHAR_COMPLEX_COLOR,   ATTR_FONT_COLOR, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         { SC_UNONAME_COUTL,    ATTR_FONT_CONTOUR,  cppu::UnoType<bool>::get(), 
                 0, 0 },
         { SC_UNONAME_CCROSS,   
ATTR_FONT_CROSSEDOUT,cppu::UnoType<bool>::get(),                 0, 
MID_CROSSED_OUT },
         { SC_UNONAME_CEMPHAS,  
ATTR_FONT_EMPHASISMARK,cppu::UnoType<sal_Int16>::get(),         0, MID_EMPHASIS 
},
@@ -716,9 +727,11 @@ static const SfxItemPropertySet* lcl_GetSheetPropertySet()
         { SC_UNONAME_BOTTBORDER,ATTR_BORDER,       
::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
         { SC_UNONAME_BOTTBORDER2,ATTR_BORDER,      
::cppu::UnoType<table::BorderLine2>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
         { SC_UNONAME_CELLBACK, ATTR_BACKGROUND,    
cppu::UnoType<sal_Int32>::get(),            0, MID_BACK_COLOR },
+        { SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, ATTR_BACKGROUND, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         { SC_UNONAME_CELLPRO,  ATTR_PROTECTION,    
cppu::UnoType<util::CellProtection>::get(), 0, 0 },
         { SC_UNONAME_CELLSTYL, 
SC_WID_UNO_CELLSTYL,cppu::UnoType<OUString>::get(),        0, 0 },
         { SC_UNONAME_CCOLOR,   ATTR_FONT_COLOR,    
cppu::UnoType<sal_Int32>::get(),            0, 0 },
+        { SC_UNONAME_CHAR_COMPLEX_COLOR,   ATTR_FONT_COLOR, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         { SC_UNONAME_COUTL,    ATTR_FONT_CONTOUR,  cppu::UnoType<bool>::get(), 
                 0, 0 },
         { SC_UNONAME_CCROSS,   
ATTR_FONT_CROSSEDOUT,cppu::UnoType<bool>::get(),                 0, 
MID_CROSSED_OUT },
         { SC_UNONAME_CEMPHAS,  
ATTR_FONT_EMPHASISMARK,cppu::UnoType<sal_Int16>::get(),         0, MID_EMPHASIS 
},
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index a97c12e3dec5..f4e506240d18 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -110,8 +110,10 @@ static const SfxItemPropertySet* lcl_GetCellStyleSet()
         {SC_UNONAME_BOTTBORDER,ATTR_BORDER,       
::cppu::UnoType<table::BorderLine>::get(),        0, BOTTOM_BORDER | 
CONVERT_TWIPS },
         {SC_UNONAME_BOTTBORDER2,ATTR_BORDER,       
::cppu::UnoType<table::BorderLine2>::get(),        0, BOTTOM_BORDER | 
CONVERT_TWIPS },
         {SC_UNONAME_CELLBACK, ATTR_BACKGROUND,    
::cppu::UnoType<sal_Int32>::get(),            0, MID_BACK_COLOR },
+        {SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, ATTR_BACKGROUND, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         {SC_UNONAME_CELLPRO,  ATTR_PROTECTION,    
::cppu::UnoType<util::CellProtection>::get(), 0, 0 },
         {SC_UNONAME_CCOLOR,   ATTR_FONT_COLOR,    
::cppu::UnoType<sal_Int32>::get(),            0, 0 },
+        {SC_UNONAME_CHAR_COMPLEX_COLOR,   ATTR_FONT_COLOR, 
cppu::UnoType<css::util::XComplexColor>::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
         {SC_UNONAME_COUTL,    ATTR_FONT_CONTOUR,  cppu::UnoType<bool>::get(),  
          0, 0 },
         {SC_UNONAME_CCROSS,   ATTR_FONT_CROSSEDOUT,cppu::UnoType<bool>::get(), 
          0, MID_CROSSED_OUT },
         {SC_UNONAME_CEMPHAS,  
ATTR_FONT_EMPHASISMARK,cppu::UnoType<sal_Int16>::get(),         0, MID_EMPHASIS 
},
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 7323f7312d93..91f4a1d8e86b 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -34,6 +34,7 @@ $(eval $(call gb_Library_use_libraries,subsequenttest,\
        utl \
        unotest \
        vcl \
+       docmodel \
 ))
 
 $(eval $(call gb_Library_use_externals,subsequenttest,\
diff --git a/test/source/beans/xpropertyset.cxx 
b/test/source/beans/xpropertyset.cxx
index 00c3378106d9..038b1e5733b6 100644
--- a/test/source/beans/xpropertyset.cxx
+++ b/test/source/beans/xpropertyset.cxx
@@ -17,12 +17,14 @@
 #include <com/sun/star/beans/XVetoableChangeListener.hpp>
 #include <com/sun/star/lang/EventObject.hpp>
 #include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/XComplexColor.hpp>
 
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/uno/Type.h>
 
 #include <cppuhelper/implbase.hxx>
+#include <docmodel/uno/UnoComplexColor.hxx>
 #include <rtl/ref.hxx>
 
 #include <cppunit/TestAssert.h>
@@ -242,6 +244,13 @@ bool XPropertySet::isPropertyValueChangeable(const 
OUString& rName)
             aDT.Year += 1;
             xPropSet->setPropertyValue(rName, Any(aDT));
         }
+        else if (type == 
cppu::UnoType<uno::Reference<util::XComplexColor>>::get())
+        {
+            auto xComplexColor = 
any.get<uno::Reference<util::XComplexColor>>();
+            auto aComplexColor = 
model::color::getFromXComplexColor(xComplexColor);
+            xPropSet->setPropertyValue(rName,
+                                       
Any(model::color::createXComplexColor(aComplexColor)));
+        }
         else
         {
             std::cout << "Unknown type:\n"
commit d2393c68262d09d50b5900e2d76e80bca2a1826f
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri May 12 23:21:22 2023 +0900
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Jun 22 21:00:19 2023 +0200

    sc: OOXML import of theme colors for char and background colors
    
    Change-Id: I8209238927bb425e8e306352f1fa78d63378f005
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151707
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153445

diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
index 245e655d7c78..ea02ef8a03e4 100644
--- a/include/oox/drawingml/color.hxx
+++ b/include/oox/drawingml/color.hxx
@@ -37,6 +37,7 @@ namespace oox { class GraphicHelper; }
 namespace oox::drawingml
 {
 
+model::ThemeColorType schemeTokenToThemeColorType(sal_uInt32 nToken);
 model::ThemeColorType schemeNameToThemeColorType(OUString const& rSchemeName);
 
 class OOX_DLLPUBLIC Color
@@ -107,6 +108,13 @@ public:
     sal_Int16           getLumMod() const;
     sal_Int16           getLumOff() const;
 
+    model::ThemeColorType getThemeColorType() const
+    {
+        return meThemeColorType;
+    }
+
+    model::ComplexColor createComplexColor(const GraphicHelper& 
rGraphicHelper, sal_Int16 nPhClrTheme) const;
+
     /** Returns the unaltered list of transformations for interoperability 
purposes */
     const css::uno::Sequence< css::beans::PropertyValue >& 
getTransformations() const { return maInteropTransformations;}
 
@@ -160,8 +168,8 @@ private:
     mutable sal_Int32   mnC2;           /// Green, green%, saturation, or 
system default RGB.
     mutable sal_Int32   mnC3;           /// Blue, blue%, or luminance.
     sal_Int32           mnAlpha;        /// Alpha value (color opacity).
-
     OUString            msSchemeName;   /// Scheme name from the a:schemeClr 
element for interoperability purposes
+    model::ThemeColorType meThemeColorType;
     css::uno::Sequence< css::beans::PropertyValue >
                         maInteropTransformations;   /// Unaltered list of 
transformations for interoperability purposes
 };
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 91543b3ef123..d13e29839227 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -209,7 +209,7 @@ void lclOffValue( sal_Int32& ornValue, sal_Int32 nOff, 
sal_Int32 nMax = MAX_PERC
     ornValue = getLimitedValue< sal_Int32, sal_Int32 >( ornValue + nOff, 0, 
nMax );
 }
 
-constexpr frozen::unordered_map<std::u16string_view, model::ThemeColorType, 
26> aSchemeColorNameToIndex
+constexpr frozen::unordered_map<std::u16string_view, model::ThemeColorType, 
26> constSchemeColorNameToIndex
 {
     { u"dk1", model::ThemeColorType::Dark1 },
     { u"lt1", model::ThemeColorType::Light1 },
@@ -239,12 +239,51 @@ constexpr frozen::unordered_map<std::u16string_view, 
model::ThemeColorType, 26>
     { u"followedHyperlink", model::ThemeColorType::FollowedHyperlink }
 };
 
+constexpr frozen::unordered_map<sal_Int32, model::ThemeColorType, 26> 
constThemeColorTokenMap
+{
+    { XML_dk1, model::ThemeColorType::Dark1 },
+    { XML_lt1, model::ThemeColorType::Light1 },
+    { XML_dk2, model::ThemeColorType::Dark2 },
+    { XML_lt2, model::ThemeColorType::Light2 },
+    { XML_accent1, model::ThemeColorType::Accent1 },
+    { XML_accent2, model::ThemeColorType::Accent2 },
+    { XML_accent3, model::ThemeColorType::Accent3 },
+    { XML_accent4, model::ThemeColorType::Accent4 },
+    { XML_accent5, model::ThemeColorType::Accent5 },
+    { XML_accent6, model::ThemeColorType::Accent6 },
+    { XML_hlink, model::ThemeColorType::Hyperlink },
+    { XML_folHlink, model::ThemeColorType::FollowedHyperlink },
+    { XML_tx1, model::ThemeColorType::Dark1 },
+    { XML_bg1, model::ThemeColorType::Light1 },
+    { XML_tx2, model::ThemeColorType::Dark2 },
+    { XML_bg2, model::ThemeColorType::Light2 },
+    { XML_dark1, model::ThemeColorType::Dark1 },
+    { XML_light1, model::ThemeColorType::Light1 },
+    { XML_dark2, model::ThemeColorType::Dark2 },
+    { XML_light2, model::ThemeColorType::Light2 },
+    { XML_text1, model::ThemeColorType::Dark1 },
+    { XML_background1, model::ThemeColorType::Light1 },
+    { XML_text2, model::ThemeColorType::Dark2 },
+    { XML_background2, model::ThemeColorType::Light2 },
+    { XML_hyperlink, model::ThemeColorType::Hyperlink },
+    { XML_followedHyperlink, model::ThemeColorType::FollowedHyperlink },
+};
+
 } // end anonymous namespace
 
 model::ThemeColorType schemeNameToThemeColorType(OUString const& rSchemeName)
 {
-    auto aIterator = aSchemeColorNameToIndex.find(rSchemeName);
-    if (aIterator == aSchemeColorNameToIndex.end())
+    auto aIterator = constSchemeColorNameToIndex.find(rSchemeName);
+    if (aIterator == constSchemeColorNameToIndex.end())
+        return model::ThemeColorType::Unknown;
+    else
+        return aIterator->second;
+}
+
+model::ThemeColorType schemeTokenToThemeColorType(sal_uInt32 nToken)
+{
+    auto aIterator = constThemeColorTokenMap.find(nToken);
+    if (aIterator == constThemeColorTokenMap.end())
         return model::ThemeColorType::Unknown;
     else
         return aIterator->second;
@@ -346,6 +385,8 @@ void Color::setSchemeClr( sal_Int32 nToken )
     OSL_ENSURE( nToken != XML_TOKEN_INVALID, "Color::setSchemeClr - invalid 
color token" );
     meMode = (nToken == XML_phClr) ? COLOR_PH : COLOR_SCHEME;
     mnC1 = nToken;
+    if (meMode == COLOR_SCHEME)
+        meThemeColorType = schemeTokenToThemeColorType(nToken);
 }
 
 void Color::setPaletteClr( sal_Int32 nPaletteIdx )
@@ -779,6 +820,43 @@ sal_Int16 Color::getSchemeColorIndex() const
     return sal_Int16(eThemeType);
 }
 
+model::ComplexColor Color::createComplexColor(const GraphicHelper& 
/*rGraphicHelper*/, sal_Int16 nPhClrTheme) const
+{
+    model::ComplexColor aNewComplexColor;
+    if (meMode == COLOR_PH)
+    {
+        auto eTheme = model::convertToThemeColorType(nPhClrTheme);
+        aNewComplexColor.setSchemeColor(eTheme);
+    }
+    else if (meMode == COLOR_SCHEME)
+    {
+        auto eTheme = getThemeColorType();
+        aNewComplexColor.setSchemeColor(eTheme);
+    }
+    else
+    {
+        // TODO
+        return aNewComplexColor;
+    }
+
+    if (getLumMod() != 10000)
+        aNewComplexColor.addTransformation({model::TransformationType::LumMod, 
getLumMod()});
+
+    if (getLumOff() != 0)
+        aNewComplexColor.addTransformation({model::TransformationType::LumOff, 
getLumOff()});
+
+    if (getTintOrShade() > 0)
+    {
+        aNewComplexColor.addTransformation({model::TransformationType::Tint, 
getTintOrShade()});
+    }
+    else if (getTintOrShade() < 0)
+    {
+        sal_Int16 nShade = o3tl::narrowing<sal_Int16>(-getTintOrShade());
+        aNewComplexColor.addTransformation({model::TransformationType::Shade, 
nShade});
+    }
+    return aNewComplexColor;
+}
+
 // private --------------------------------------------------------------------
 
 void Color::setResolvedRgb( ::Color nRgb ) const
diff --git a/sc/source/filter/inc/stylesbuffer.hxx 
b/sc/source/filter/inc/stylesbuffer.hxx
index a687a14d3b31..4e10670a0176 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -32,6 +32,7 @@
 #include "numberformatsbuffer.hxx"
 #include <editeng/svxenum.hxx>
 #include <editeng/frmdir.hxx>
+#include <docmodel/color/ComplexColor.hxx>
 #include <attarray.hxx>
 #include <vector>
 
@@ -194,6 +195,7 @@ struct ApiFontData
     ApiScriptFontName        maCmplxFont;        /// Font name for complex 
scripts.
     css::awt::FontDescriptor maDesc;             /// Font descriptor (height 
in twips, weight in %).
     ::Color                  mnColor;            /// Font color.
+    model::ComplexColor      maComplexColor;     /// Font complex color.
     sal_Int16                mnEscapement;       /// Escapement style.
     sal_Int8                 mnEscapeHeight;     /// Escapement font height.
     bool                     mbOutline;          /// True = outlined 
characters.
@@ -504,6 +506,7 @@ struct GradientFillModel
 struct ApiSolidFillData
 {
     ::Color             mnColor;            /// Fill color.
+    model::ComplexColor maComplexColor;
     ::Color             mnFilterColor;        /// Fill color filtering.
     bool                mbTransparent;      /// True = transparent area.
     bool                mbUsed;             /// True = fill data is valid.
diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 1dbe7e658269..0f205e018992 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -274,8 +274,12 @@ void Color::importColor( const AttributeList& rAttribs )
 {
     // tdf#113271 The order of import color is very important in case of more 
than one color attributes was provided.
     // This order (theme -> rgb -> indexed -> auto) is not documented and was 
gathered experimentally based on MS Excel 2013.
-    if( rAttribs.hasAttribute( XML_theme ) )
-        setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( 
XML_tint, 0.0 ) );
+    if (rAttribs.hasAttribute(XML_theme))
+    {
+        sal_Int32 nTheme = rAttribs.getInteger(XML_theme, -1);
+        double fTint = rAttribs.getDouble(XML_tint, 0.0);
+        setTheme(nTheme , fTint);
+    }
     else if( rAttribs.hasAttribute( XML_rgb ) )
         setRgb( ::Color(ColorTransparency, rAttribs.getIntegerHex( XML_rgb, 
sal_Int32(API_RGB_TRANSPARENT) ) ), rAttribs.getDouble( XML_tint, 0.0 ) );
     else if( rAttribs.hasAttribute( XML_indexed ) )
@@ -745,6 +749,7 @@ void Font::finalizeImport()
             rtl_getTextEncodingFromWindowsCharset( static_cast< sal_uInt8 >( 
maModel.mnCharSet ) ) );
 
     // color, height, weight, slant, strikeout, outline, shadow
+    maApiData.maComplexColor   = 
maModel.maColor.createComplexColor(getBaseFilter().getGraphicHelper(), -1);
     maApiData.mnColor          = maModel.maColor.getColor( 
getBaseFilter().getGraphicHelper() );
     maApiData.maDesc.Height    = static_cast< sal_Int16 >( maModel.mfHeight * 
20.0 );
     maApiData.maDesc.Weight    = maModel.mbBold ? css::awt::FontWeight::BOLD : 
css::awt::FontWeight::NORMAL;
@@ -928,7 +933,7 @@ void Font::fillToItemSet( SfxItemSet& rItemSet, bool 
bEditEngineText, bool bSkip
     // character color
     if( maUsedFlags.mbColorUsed )
     {
-        ScfTools::PutItem( rItemSet,SvxColorItem( maApiData.mnColor, 
bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_COLOR) : ATTR_FONT_COLOR), 
bSkipPoolDefs );
+        ScfTools::PutItem( rItemSet,SvxColorItem( maApiData.mnColor, 
maApiData.maComplexColor, bEditEngineText ? 
static_cast<sal_uInt16>(EE_CHAR_COLOR) : ATTR_FONT_COLOR), bSkipPoolDefs );
     }
     // underline style
     if( maUsedFlags.mbUnderlineUsed )
@@ -1718,7 +1723,7 @@ void Fill::importFgColor( const AttributeList& rAttribs )
     OSL_ENSURE( mxPatternModel, "Fill::importFgColor - missing pattern data" );
     if( mxPatternModel )
     {
-        mxPatternModel->maPatternColor.importColor( rAttribs );
+        mxPatternModel->maPatternColor.importColor(rAttribs);
         mxPatternModel->mbPattColorUsed = true;
     }
 }
@@ -1728,7 +1733,7 @@ void Fill::importBgColor( const AttributeList& rAttribs )
     OSL_ENSURE( mxPatternModel, "Fill::importBgColor - missing pattern data" );
     if( mxPatternModel )
     {
-        mxPatternModel->maFillColor.importColor( rAttribs );
+        mxPatternModel->maFillColor.importColor(rAttribs);
         mxPatternModel->mbFillColorUsed = true;
     }
 }
@@ -1891,6 +1896,7 @@ void Fill::finalizeImport()
             ::Color nFillColor = rModel.maFillColor.getColor( rGraphicHelper, 
nWinColor );
 
             maApiData.mnColor = lclGetMixedColor( nPattColor, nFillColor, 
nAlpha );
+            maApiData.maComplexColor = 
rModel.maPatternColor.createComplexColor(rGraphicHelper, -1);
             maApiData.mnFilterColor = lclGetMixedColor( nFiltPattColor, 
nFillColor, nAlpha );
             maApiData.mbTransparent = false;
         }
@@ -1926,6 +1932,7 @@ void Fill::fillToItemSet( SfxItemSet& rItemSet, bool 
bSkipPoolDefs ) const
     else
     {
         aBrushItem.SetColor( maApiData.mnColor  );
+        aBrushItem.setComplexColor(maApiData.maComplexColor);
         aBrushItem.SetFiltColor( maApiData.mnFilterColor  );
     }
     ScfTools::PutItem( rItemSet, aBrushItem, bSkipPoolDefs );

Reply via email to