sc/inc/patattr.hxx                   |   16 ++++++++--------
 sc/qa/unit/helper/qahelper.cxx       |    4 ++--
 sc/source/core/data/patattr.cxx      |   18 +++++++++---------
 sc/source/filter/excel/xecontent.cxx |    2 +-
 sc/source/filter/excel/xehelper.cxx  |    6 +++---
 sc/source/filter/excel/xestyle.cxx   |    2 +-
 sc/source/ui/view/output2.cxx        |    6 +++---
 sc/source/ui/view/printfun.cxx       |    4 ++--
 8 files changed, 29 insertions(+), 29 deletions(-)

New commits:
commit f55792eed4d2e0f6891a2bdd8639f8e962d95c5b
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Jun 25 15:41:37 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jun 26 07:53:06 2023 +0200

    convert ScAutoFontColorMode to scoped enum
    
    Change-Id: Id34bac78719943bd4c4cbfa60e0cb86b4ca570f2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153562
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 4d7df0c6ac23..1df3a31d6fac 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -39,15 +39,15 @@ enum class ScRotateDir : sal_uInt8;
 
 ///  how to treat COL_AUTO in GetFont:
 
-enum ScAutoFontColorMode
+enum class ScAutoFontColorMode
 {
-    SC_AUTOCOL_RAW,         ///< COL_AUTO is returned
-    SC_AUTOCOL_BLACK,       ///< always use black
-    SC_AUTOCOL_PRINT,       ///< black or white, depending on background
-    SC_AUTOCOL_DISPLAY,     ///< from style settings, or black/white if needed
-    SC_AUTOCOL_IGNOREFONT,  ///< like DISPLAY, but ignore stored font color 
(assume COL_AUTO)
-    SC_AUTOCOL_IGNOREBACK,  ///< like DISPLAY, but ignore stored background 
color (use configured color)
-    SC_AUTOCOL_IGNOREALL    ///< like DISPLAY, but ignore stored font and 
background colors
+    Raw,         ///< COL_AUTO is returned
+    Black,       ///< always use black
+    Print,       ///< black or white, depending on background
+    Display,     ///< from style settings, or black/white if needed
+    IgnoreFont,  ///< like DISPLAY, but ignore stored font color (assume 
COL_AUTO)
+    IgnoreBack,  ///< like DISPLAY, but ignore stored background color (use 
configured color)
+    IgnoreAll    ///< like DISPLAY, but ignore stored font and background 
colors
 };
 
 class SC_DLLPUBLIC ScPatternAttr final : public SfxSetItem
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index efb2e68c4fbc..890a330f147d 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -179,7 +179,7 @@ void ScModelTestBase::testFormats(ScDocument* 
pDoc,std::u16string_view sFormat)
     Color aColor;
 
     pPattern->fillFontOnly(aFont);
-    pPattern->fillColor(aColor, SC_AUTOCOL_RAW);
+    pPattern->fillColor(aColor, ScAutoFontColorMode::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, 
aColor);
     pPattern = pDoc->GetPattern(0,1,1);
@@ -193,7 +193,7 @@ void ScModelTestBase::testFormats(ScDocument* 
pDoc,std::u16string_view sFormat)
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
     pPattern = pDoc->GetPattern(1,0,1);
     pPattern->fillFontOnly(aFont);
-    pPattern->fillColor(aColor, SC_AUTOCOL_RAW);
+    pPattern->fillColor(aColor, ScAutoFontColorMode::Raw);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be blue", COL_BLUE, aColor);
     pPattern = pDoc->GetPattern(1,1,1);
     pPattern->fillFontOnly(aFont);
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 199d41ab25f1..1bb2e50daf4d 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -448,11 +448,11 @@ void ScPatternAttr::fillColor(Color& rColor, const 
SfxItemSet& rItemSet, ScAutoF
         aColor = pColorItem->GetValue();
 
 
-    if ((aColor == COL_AUTO && eAutoMode != SC_AUTOCOL_RAW)
-        || eAutoMode == SC_AUTOCOL_IGNOREFONT
-        || eAutoMode == SC_AUTOCOL_IGNOREALL)
+    if ((aColor == COL_AUTO && eAutoMode != ScAutoFontColorMode::Raw)
+        || eAutoMode == ScAutoFontColorMode::IgnoreFont
+        || eAutoMode == ScAutoFontColorMode::IgnoreAll)
     {
-        if ( eAutoMode == SC_AUTOCOL_BLACK )
+        if ( eAutoMode == ScAutoFontColorMode::Black )
             aColor = COL_BLACK;
         else
         {
@@ -472,12 +472,12 @@ void ScPatternAttr::fillColor(Color& rColor, const 
SfxItemSet& rItemSet, ScAutoF
 
             //  if background color attribute is transparent, use window color 
for brightness comparisons
             if (aBackColor == COL_TRANSPARENT
-                || eAutoMode == SC_AUTOCOL_IGNOREBACK
-                || eAutoMode == SC_AUTOCOL_IGNOREALL)
+                || eAutoMode == ScAutoFontColorMode::IgnoreBack
+                || eAutoMode == ScAutoFontColorMode::IgnoreAll)
             {
                 if (!comphelper::LibreOfficeKit::isActive())
                 {
-                    if ( eAutoMode == SC_AUTOCOL_PRINT )
+                    if ( eAutoMode == ScAutoFontColorMode::Print )
                         aBackColor = COL_WHITE;
                     else if ( pBackConfigColor )
                     {
@@ -503,7 +503,7 @@ void ScPatternAttr::fillColor(Color& rColor, const 
SfxItemSet& rItemSet, ScAutoF
 
             //  get system text color for comparison
             Color aSysTextColor;
-            if ( eAutoMode == SC_AUTOCOL_PRINT )
+            if ( eAutoMode == ScAutoFontColorMode::Print )
                 aSysTextColor = COL_BLACK;
             else if ( pTextConfigColor )
             {
@@ -528,7 +528,7 @@ void ScPatternAttr::fillColor(Color& rColor, const 
SfxItemSet& rItemSet, ScAutoF
             }
             else
             {
-                //  use aSysTextColor (black for SC_AUTOCOL_PRINT, from style 
settings otherwise)
+                //  use aSysTextColor (black for ScAutoFontColorMode::Print, 
from style settings otherwise)
                 aColor = aSysTextColor;
             }
         }
diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index 15141c161628..47114264a50e 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -670,7 +670,7 @@ XclExpCFImpl::XclExpCFImpl( const XclExpRoot& rRoot, const 
ScCondFormatEntry& rF
             vcl::Font aFont;
             ::Color aColor;
             ScPatternAttr::fillFontOnly(aFont, rItemSet);
-            ScPatternAttr::fillColor(aColor, rItemSet, SC_AUTOCOL_RAW);
+            ScPatternAttr::fillColor(aColor, rItemSet, 
ScAutoFontColorMode::Raw);
             maFontData.FillFromVclFont(aFont, aColor);
             mnFontColorId = GetPalette().InsertColor(maFontData.maColor, 
EXC_COLOR_CELLTEXT);
         }
diff --git a/sc/source/filter/excel/xehelper.cxx 
b/sc/source/filter/excel/xehelper.cxx
index 14fafd8a42ba..e9390f8ce6f5 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -390,7 +390,7 @@ XclExpStringRef lclCreateFormattedString(
         // construct font from current text portion
         SvxFont aFont(XclExpFontHelper::GetFontFromItemSet(rRoot, rItemSet, 
nScript));
         Color aColor;
-        ScPatternAttr::fillColor(aColor, rItemSet, SC_AUTOCOL_RAW);
+        ScPatternAttr::fillColor(aColor, rItemSet, ScAutoFontColorMode::Raw);
 
         // Excel start position of this portion
         sal_Int32 nXclPortionStart = xString->Len();
@@ -504,7 +504,7 @@ XclExpStringRef lclCreateFormattedString(
                     nScript = nLastScript;
                 SvxFont aFont( XclExpFontHelper::GetFontFromItemSet(rRoot, 
aItemSet, nScript));
                 Color aColor;
-                ScPatternAttr::fillColor(aColor, aItemSet, SC_AUTOCOL_RAW);
+                ScPatternAttr::fillColor(aColor, aItemSet, 
ScAutoFontColorMode::Raw);
 
                 nLastScript = nScript;
 
@@ -736,7 +736,7 @@ void XclExpHFConverter::AppendPortion( const 
EditTextObject* pTextObj, sal_Unico
                 SfxItemSet aEditSet( mrEE.GetAttribs( aSel ) );
                 ScPatternAttr::GetFromEditItemSet( aItemSet, aEditSet );
                 ScPatternAttr::fillFontOnly(aFont, aItemSet);
-                ScPatternAttr::fillColor(aColor, aItemSet, SC_AUTOCOL_RAW);
+                ScPatternAttr::fillColor(aColor, aItemSet, 
ScAutoFontColorMode::Raw);
 
                 // font name and style
                 aNewData.maName = XclTools::GetXclFontName( 
aFont.GetFamilyName() );
diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index 998cad5bb723..43b9ac5e23c2 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1232,7 +1232,7 @@ sal_uInt16 XclExpFontBuffer::Insert(const SfxItemSet& 
rItemSet, sal_Int16 nScrip
     // #i17050# script type now provided by caller
     vcl::Font aFont = XclExpFontHelper::GetFontFromItemSet(GetRoot(), 
rItemSet, nScript);
     Color aColor;
-    ScPatternAttr::fillColor(aColor, rItemSet, SC_AUTOCOL_RAW);
+    ScPatternAttr::fillColor(aColor, rItemSet, ScAutoFontColorMode::Raw);
     return Insert(XclFontData(aFont, aColor), eColorType, bAppFont );
 }
 
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index d8dfb064e605..07876568cb9a 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -325,12 +325,12 @@ void ScDrawStringsVars::SetPattern(
     if ( pOutput->mbUseStyleColor )
     {
         if ( pOutput->mbForceAutoColor )
-            eColorMode = bCellContrast ? SC_AUTOCOL_IGNOREALL : 
SC_AUTOCOL_IGNOREFONT;
+            eColorMode = bCellContrast ? ScAutoFontColorMode::IgnoreAll : 
ScAutoFontColorMode::IgnoreFont;
         else
-            eColorMode = bCellContrast ? SC_AUTOCOL_IGNOREBACK : 
SC_AUTOCOL_DISPLAY;
+            eColorMode = bCellContrast ? ScAutoFontColorMode::IgnoreBack : 
ScAutoFontColorMode::Display;
     }
     else
-        eColorMode = SC_AUTOCOL_PRINT;
+        eColorMode = ScAutoFontColorMode::Print;
 
     if (bPixelToLogic)
         pPattern->fillFont(aFont, eColorMode, pFmtDevice, nullptr, pCondSet, 
nScript, &aBackConfigColor, &aTextConfigColor);
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 9eb44e02c70b..a61520875238 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -1907,7 +1907,7 @@ tools::Long ScPrintFunc::DoNotes( tools::Long nNoteStart, 
bool bDoPrint, ScPrevi
     pEditEngine->SetDefaults( *pEditDefaults );
 
     vcl::Font aMarkFont;
-    ScAutoFontColorMode eColorMode = bUseStyleColor ? SC_AUTOCOL_DISPLAY : 
SC_AUTOCOL_PRINT;
+    ScAutoFontColorMode eColorMode = bUseStyleColor ? 
ScAutoFontColorMode::Display : ScAutoFontColorMode::Print;
     rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN).fillFont(aMarkFont, 
eColorMode);
     pDev->SetFont(aMarkFont);
     tools::Long nMarkLen = pDev->GetTextWidth("GW99999:");
@@ -2322,7 +2322,7 @@ 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;
+        ScAutoFontColorMode eColorMode = bUseStyleColor ? 
ScAutoFontColorMode::Display : ScAutoFontColorMode::Print;
         aPattern.fillFont(aFont, eColorMode, pDev);
         pDev->SetFont(aFont);
 

Reply via email to