From 397519e8d8bcfaf37d4535afe91a426bd462f57a Mon Sep 17 00:00:00 2001 From: Andreas Heinisch Date: Fri, 18 Sep 2026 13:52:05 +0200 Subject: [PATCH] tdf#82008 - Index the widget arrays by row and not by query entry Change-Id: I53933c26f92b050562bdbdb58b2806e44e8d0971 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211147 Tested-by: Jenkins Reviewed-by: Andreas Heinisch --- sc/source/ui/dbgui/filtdlg.cxx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 5c772ab23116..d24867cbe278 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -1051,31 +1051,29 @@ IMPL_LINK(ScFilterDlg, LbSelectHdl, weld::ComboBox&, rLb, void) else if (&rLb == m_xLbColor1.get() || &rLb == m_xLbColor2.get() || &rLb == m_xLbColor3.get() || &rLb == m_xLbColor4.get()) { - sal_uInt16 nQ = 0; - if (&rLb == m_xLbColor1.get()) + // Index the widget arrays by the visible row and not by the query entry + sal_uInt16 nRow = 0; + if (&rLb == m_xLbColor2.get()) { - nQ = nOffset; - } - else if (&rLb == m_xLbColor2.get()) - { - nQ = 1 + nOffset; + nRow = 1; } else if (&rLb == m_xLbColor3.get()) { - nQ = 2 + nOffset; + nRow = 2; } else if (&rLb == m_xLbColor4.get()) { - nQ = 3 + nOffset; + nRow = 3; } + const sal_uInt16 nQ = nRow + nOffset; ScQueryEntry& aEntry = theQueryData.GetEntry(nQ); - Color aColor = Color::STRtoRGB(maColorLbArr[nQ]->get_active_id()); - if (maCondLbArr[nQ]->get_active_text() == aStrFontColor) + Color aColor = Color::STRtoRGB(rLb.get_active_id()); + if (maCondLbArr[nRow]->get_active_text() == aStrFontColor) { aEntry.SetQueryByTextColor(aColor); } - else if (maCondLbArr[nQ]->get_active_text() == aStrBackgroundColor) + else if (maCondLbArr[nRow]->get_active_text() == aStrBackgroundColor) { aEntry.SetQueryByBackgroundColor(aColor); }