sc/source/ui/cctrl/dpcontrol.cxx | 56 +++++++++++++-------------------------- 1 file changed, 20 insertions(+), 36 deletions(-)
New commits: commit 2eb67678d93ede4c4031412b9d3b900ab2c34a71 Author: Heiko Tietze <[email protected]> AuthorDate: Tue Sep 16 16:37:08 2025 +0200 Commit: Heiko Tietze <[email protected]> CommitDate: Wed Sep 24 09:54:53 2025 +0200 Resolves tdf#163017 - More appealing design for AutoFilter button Change-Id: Idbe560429a6c9842f66f7584db393230ff102235 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191038 Reviewed-by: Adolfo Jayme Barrientos <[email protected]> Tested-by: Jenkins Reviewed-by: Heiko Tietze <[email protected]> diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx index 068ee78c44cd..ad585ea092a4 100644 --- a/sc/source/ui/cctrl/dpcontrol.cxx +++ b/sc/source/ui/cctrl/dpcontrol.cxx @@ -219,49 +219,33 @@ void ScDPFieldButton::drawPopupButton() Size aSize; getPopupBoundingBox(aPos, aSize); - float fScaleFactor = mpOutDev->GetDPIScaleFactor(); - - // Button background color - Color aFaceColor = mrStyle.GetFaceColor(); - Color aBackgroundColor - = mbHasHiddenMember ? mrStyle.GetHighlightColor() - : mbPopupPressed ? mrStyle.GetShadowColor() : aFaceColor; - - // Button line color - mpOutDev->SetLineColor(mrStyle.GetLabelTextColor()); - // If the document background is light and face color is dark, use ShadowColor instead Color aDocColor = svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; - if (aDocColor.IsBright() && aFaceColor.IsDark()) - mpOutDev->SetLineColor(mrStyle.GetShadowColor()); + Color aAccentColor = svtools::ColorConfig().GetColorValue(svtools::ACCENTCOLOR).nColor; + + Color aBackgroundColor = mbPopupPressed ? mrStyle.GetFaceColor() + : mbHasHiddenMember ? aAccentColor + : aDocColor; mpOutDev->SetFillColor(aBackgroundColor); + mpOutDev->SetLineColor(); mpOutDev->DrawRect(tools::Rectangle(aPos, aSize)); - // the arrowhead - Color aArrowColor = mbHasHiddenMember ? mrStyle.GetHighlightTextColor() : mrStyle.GetButtonTextColor(); - // FIXME: HACK: The following DrawPolygon draws twice in lok rtl mode for some reason. - // => one at the correct location with fill (possibly no outline) - // => and the other at an x offset with outline and without fill - // eg. Replacing this with a DrawRect() does not have any such problems. - comphelper::LibreOfficeKit::isActive() ? mpOutDev->SetLineColor() : mpOutDev->SetLineColor(aArrowColor); - mpOutDev->SetFillColor(aArrowColor); + const double nVDist = aSize.Height() / 4; + const double nHDist = aSize.Width() / 10; + const double fZoom = static_cast<double>(maZoomY); - Point aCenter(aPos.X() + (aSize.Width() / 2), aPos.Y() + (aSize.Height() / 2)); - - Size aArrowSize(4 * fScaleFactor, 2 * fScaleFactor); - - tools::Polygon aPoly(3); - aPoly.SetPoint(Point(aCenter.X() - aArrowSize.Width(), aCenter.Y() - aArrowSize.Height()), 0); - aPoly.SetPoint(Point(aCenter.X() + aArrowSize.Width(), aCenter.Y() - aArrowSize.Height()), 1); - aPoly.SetPoint(Point(aCenter.X(), aCenter.Y() + aArrowSize.Height()), 2); - mpOutDev->DrawPolygon(aPoly); - - if (mbHasHiddenMember) + aBackgroundColor = mbPopupPressed ? mrStyle.GetButtonTextColor() + : mbHasHiddenMember ? aDocColor + : aAccentColor; + mpOutDev->SetFillColor(aBackgroundColor); + for (int i = 0; i < 3; i++) { - // tiny little box to display in presence of hidden member(s). - Point aBoxPos(aPos.X() + aSize.Width() - 5 * fScaleFactor, aPos.Y() + aSize.Height() - 5 * fScaleFactor); - Size aBoxSize(3 * fScaleFactor, 3 * fScaleFactor); - mpOutDev->DrawRect(tools::Rectangle(aBoxPos, aBoxSize)); + tools::Rectangle aRect; + aRect.SetTop(aPos.Y() + nVDist * (i + 1)); + aRect.SetBottom(aPos.Y() + nVDist * (i + 1) + fZoom); + aRect.SetLeft(aPos.X() + nHDist + i * 3 * fZoom); + aRect.SetRight(aPos.X() + aSize.Width() - nHDist - i * 3 * fZoom); + mpOutDev->DrawRect(aRect); } }
