From 4909fb2b4c52c31b34d4ebe25ae8b86130cbc061 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 6 Oct 2026 17:30:24 +0200 Subject: [PATCH] svtools: Drop ValueSetItemType::ImageAndText and related logic Prio to Change-Id: I0d2f691eecfac013bc8ad3e506484d958d18ce0a Author: Michael Weghorn Date: Tue Oct 6 17:22:54 2026 +0200 svtools: Drop always false ValueSet::InsertItem bLegend param , the only place where the type would have been set was in ValueSet::InsertItem, but the method was never called in a way that caused that code path being used. Now that that was dropped from ValueSet::InsertItem, also drop the remaining logic from the ValueSet implementation. This also means that the `rRenderContext` param for ValueSet::ImplFormatItem becomes unused. Dropping it and related cleanup will be done in an upcoming commit. Change-Id: I3593630b4758d0547264c0ed63fec7ac111ccfd7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211910 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- svtools/source/control/valueimp.hxx | 1 - svtools/source/control/valueset.cxx | 36 +++-------------------------- 2 files changed, 3 insertions(+), 34 deletions(-) diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx index 921c83d2ba53..e0104d69ad77 100644 --- a/svtools/source/control/valueimp.hxx +++ b/svtools/source/control/valueimp.hxx @@ -32,7 +32,6 @@ enum class ValueSetItemType { None, Image, - ImageAndText, Color, UserDraw }; diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 0ce64a382b3e..a0b406e97ac7 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1218,7 +1218,7 @@ void ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext, const tools::R } } -void ValueSet::ImplFormatItem(vcl::RenderContext const& rRenderContext, ValueSetItem& rItem, +void ValueSet::ImplFormatItem(vcl::RenderContext const&, ValueSetItem& rItem, tools::Rectangle aRect) { WinBits nStyle = GetStyle(); @@ -1278,9 +1278,7 @@ void ValueSet::ImplFormatItem(vcl::RenderContext const& rRenderContext, ValueSet Size aRectSize = aRect.GetSize(); Point aPos(aRect.Left(), aRect.Top()); aPos.AdjustX((aRectSize.Width() - aImageSize.Width()) / 2 ); - - if (rItem.meType != ValueSetItemType::ImageAndText) - aPos.AdjustY((aRectSize.Height() - aImageSize.Height()) / 2 ); + aPos.AdjustY((aRectSize.Height() - aImageSize.Height()) / 2); DrawImageFlags nImageStyle = DrawImageFlags::NONE; if (!IsEnabled()) @@ -1295,25 +1293,6 @@ void ValueSet::ImplFormatItem(vcl::RenderContext const& rRenderContext, ValueSet } else maVirDev->DrawImage(aPos, rItem.maImage, nImageStyle); - - if (rItem.meType == ValueSetItemType::ImageAndText) - { - maVirDev->SetFont(rRenderContext.GetFont()); - maVirDev->SetTextColor((nStyle & WB_MENUSTYLEVALUESET) ? rStyleSettings.GetMenuTextColor() : rStyleSettings.GetWindowTextColor()); - maVirDev->SetTextFillColor(); - - tools::Long nTxtWidth = maVirDev->GetTextWidth(rItem.maText); - - if (nTxtWidth > aRect.GetWidth()) - maVirDev->SetClipRegion(vcl::Region(aRect)); - - maVirDev->DrawText(Point(aRect.Left() + (aRect.GetWidth() - nTxtWidth) / 2, - aRect.Bottom() - maVirDev->GetTextHeight()), - rItem.maText); - - if (nTxtWidth > aRect.GetWidth()) - maVirDev->SetClipRegion(); - } } } @@ -1670,22 +1649,13 @@ Size ValueSet::GetLargestItemSize() if (!pItem->mbVisible) continue; - if (pItem->meType != ValueSetItemType::Image && - pItem->meType != ValueSetItemType::ImageAndText) + if (pItem->meType != ValueSetItemType::Image) { // handle determining an optimal size for this case continue; } Size aSize = pItem->maImage.GetSizePixel(); - if (pItem->meType == ValueSetItemType::ImageAndText) - { - aSize.AdjustHeight(3 * NAME_LINE_HEIGHT + - maVirDev->GetTextHeight() ); - aSize.setWidth( std::max(aSize.Width(), - maVirDev->GetTextWidth(pItem->maText) + NAME_OFFSET) ); - } - aLargestItem.setWidth( std::max(aLargestItem.Width(), aSize.Width()) ); aLargestItem.setHeight( std::max(aLargestItem.Height(), aSize.Height()) ); }