diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-07-05 14:59:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-07-06 11:08:43 +0200 |
commit | e8be539b0eba0ec1e4cbea0b4464ff4945fdacb1 (patch) | |
tree | da9d352575ddbf4f73bdd4ad86cb5da25e9e3552 | |
parent | 62127bb799178dfe91ab005db0aad732b85ac1a1 (diff) |
ScAutoFontColorMode::Black is unused
since
commit 3537cef02c25c2c2459d7900eed13eeec533b7ae
Author: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Date: Tue May 16 22:10:10 2023 +0900
sc: factor out color from setting vcl::Font from a ItemSet
Change-Id: Ia8781d69ed4969eb9617c96c6991cc39ce162e49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154061
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sc/inc/patattr.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/patattr.cxx | 131 |
2 files changed, 62 insertions, 70 deletions
diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index cc37c335cfc0..eacb69fd640b 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -43,7 +43,6 @@ enum class ScRotateDir : sal_uInt8; enum class ScAutoFontColorMode { 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) diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index d3a9de543d3a..e2cd22a390c6 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -461,89 +461,82 @@ void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const SfxItemS || eAutoMode == ScAutoFontColorMode::IgnoreFont || eAutoMode == ScAutoFontColorMode::IgnoreAll) { - if (eAutoMode == ScAutoFontColorMode::Black) + // get background color from conditional or own set + Color aBackColor; + if ( pCondSet ) { - aColor = COL_BLACK; + const SvxBrushItem* pItem = pCondSet->GetItemIfSet(ATTR_BACKGROUND); + if (!pItem) + pItem = &rItemSet.Get(ATTR_BACKGROUND); + aBackColor = pItem->GetColor(); } else { - // get background color from conditional or own set - Color aBackColor; - if ( pCondSet ) - { - 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 == ScAutoFontColorMode::IgnoreBack - || eAutoMode == ScAutoFontColorMode::IgnoreAll) + // if background color attribute is transparent, use window color for brightness comparisons + if (aBackColor == COL_TRANSPARENT + || eAutoMode == ScAutoFontColorMode::IgnoreBack + || eAutoMode == ScAutoFontColorMode::IgnoreAll) + { + if (!comphelper::LibreOfficeKit::isActive()) { - if (!comphelper::LibreOfficeKit::isActive()) + if ( eAutoMode == ScAutoFontColorMode::Print ) + aBackColor = COL_WHITE; + else if ( pBackConfigColor ) { - if ( eAutoMode == ScAutoFontColorMode::Print ) - aBackColor = COL_WHITE; - else if ( pBackConfigColor ) - { - // pBackConfigColor can be used to avoid repeated lookup of the configured color - aBackColor = *pBackConfigColor; - } - else - aBackColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; + // pBackConfigColor can be used to avoid repeated lookup of the configured color + aBackColor = *pBackConfigColor; } else - { - // Get document color from current view instead - SfxViewShell* pSfxViewShell = SfxViewShell::Current(); - ScTabViewShell* pViewShell = dynamic_cast<ScTabViewShell*>(pSfxViewShell); - if (pViewShell) - { - const ScViewData& pViewData = pViewShell->GetViewData(); - const ScViewOptions& aViewOptions = pViewData.GetOptions(); - aBackColor = aViewOptions.GetDocColor(); - } - } - } - - // get system text color for comparison - Color aSysTextColor; - if (eAutoMode == ScAutoFontColorMode::Print) - { - aSysTextColor = COL_BLACK; - } - else if (pTextConfigColor) - { - // pTextConfigColor can be used to avoid repeated lookup of the configured color - aSysTextColor = *pTextConfigColor; + aBackColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; } else { - aSysTextColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; + // Get document color from current view instead + SfxViewShell* pSfxViewShell = SfxViewShell::Current(); + ScTabViewShell* pViewShell = dynamic_cast<ScTabViewShell*>(pSfxViewShell); + if (pViewShell) + { + const ScViewData& pViewData = pViewShell->GetViewData(); + const ScViewOptions& aViewOptions = pViewData.GetOptions(); + aBackColor = aViewOptions.GetDocColor(); + } } + } - // select the resulting color - if ( aBackColor.IsDark() && aSysTextColor.IsDark() ) - { - // use white instead of dark on dark - aColor = COL_WHITE; - } - else if ( aBackColor.IsBright() && aSysTextColor.IsBright() ) - { - // use black instead of bright on bright - aColor = COL_BLACK; - } - else - { - // use aSysTextColor (black for ScAutoFontColorMode::Print, from style settings otherwise) - aColor = aSysTextColor; - } + // get system text color for comparison + Color aSysTextColor; + if (eAutoMode == ScAutoFontColorMode::Print) + { + aSysTextColor = COL_BLACK; + } + else if (pTextConfigColor) + { + // pTextConfigColor can be used to avoid repeated lookup of the configured color + aSysTextColor = *pTextConfigColor; + } + else + { + aSysTextColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; + } + + // select the resulting color + if ( aBackColor.IsDark() && aSysTextColor.IsDark() ) + { + // use white instead of dark on dark + aColor = COL_WHITE; + } + else if ( aBackColor.IsBright() && aSysTextColor.IsBright() ) + { + // use black instead of bright on bright + aColor = COL_BLACK; + } + else + { + // use aSysTextColor (black for ScAutoFontColorMode::Print, from style settings otherwise) + aColor = aSysTextColor; } } aComplexColor.setFinalColor(aColor); |