[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 24 12:21:50 UTC 2021
sc/source/core/data/column3.cxx | 14 ++++++++++----
sc/source/core/data/table3.cxx | 16 +++++++++++++++-
2 files changed, 25 insertions(+), 5 deletions(-)
New commits:
commit 2391d8073624004e0cd657ab07ff947f6a9ef0c7
Author: Samuel Mehrbrodt <samuel.mehrbrodt at allotropia.de>
AuthorDate: Tue Aug 31 10:49:51 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Sep 24 14:21:14 2021 +0200
tdf#142579 Consider cond. format background colors in color filter
In addition to color scale, consider background colors set by a
conditional style.
Change-Id: I203c4a5ae87aa7b47c2caafcac703b0a0c1a677c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121474
Tested-by: Samuel Mehrbrodt <samuel.mehrbrodt at allotropia.de>
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt at allotropia.de>
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122467
Tested-by: Jenkins
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 6532996d7b71..9f9c697e709e 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2435,9 +2435,12 @@ class FilterEntriesHandler
// Colors
ScAddress aPos(rColumn.GetCol(), nRow, rColumn.GetTab());
- // Text color
+ Color backgroundColor;
+ bool bHasConditionalBackgroundColor = false;
+
Color textColor;
bool bHasConditionalTextColor = false;
+ // Check text & background color from cond. formatting
const ScPatternAttr* pPattern
= mrColumn.GetDoc().GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
if (pPattern)
@@ -2449,8 +2452,13 @@ class FilterEntriesHandler
const SvxColorItem* pColor = &pPattern->GetItem(ATTR_FONT_COLOR, pCondSet);
textColor = pColor->GetValue();
bHasConditionalTextColor = true;
+
+ const SvxBrushItem* pBackgroundColor = &pPattern->GetItem(ATTR_BACKGROUND, pCondSet);
+ backgroundColor = pBackgroundColor->GetColor();
+ bHasConditionalBackgroundColor = true;
}
}
+
if (!bHasConditionalTextColor)
{
const SvxColorItem* pColor = rColumn.GetDoc().GetAttr(aPos, ATTR_FONT_COLOR);
@@ -2459,9 +2467,7 @@ class FilterEntriesHandler
if (textColor != COL_AUTO)
mrFilterEntries.addTextColor(textColor);
- // Background color
- Color backgroundColor;
- bool bHasConditionalBackgroundColor = false;
+ // Color scale needs a different handling
ScConditionalFormat* pCondFormat
= rColumn.GetDoc().GetCondFormat(aPos.Col(), aPos.Row(), aPos.Tab());
if (pCondFormat)
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 553223c685e9..554b69b90203 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2850,9 +2850,23 @@ public:
{
ScAddress aPos(nCol, nRow, nTab);
Color color;
+
// Background color can be set via conditional formatting - check that first
- ScConditionalFormat* pCondFormat = mrDoc.GetCondFormat(nCol, nRow, nTab);
bool bHasConditionalColor = false;
+ const ScPatternAttr* pPattern = mrDoc.GetPattern(nCol, nRow, nTab);
+ if (pPattern)
+ {
+ if (!pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty())
+ {
+ const SfxItemSet* pCondSet
+ = mrDoc.GetCondResult(nCol, nRow, nTab);
+ const SvxBrushItem* pBackgroundColor = &pPattern->GetItem(ATTR_BACKGROUND, pCondSet);
+ color = pBackgroundColor->GetColor();
+ bHasConditionalColor = true;
+ }
+ }
+
+ ScConditionalFormat* pCondFormat = mrDoc.GetCondFormat(nCol, nRow, nTab);
if (pCondFormat)
{
for (size_t i = 0; i < pCondFormat->size(); i++)
More information about the Libreoffice-commits
mailing list