svtools: Drop ValueSetItemType::ImageAndText and related logic

Prio to

    Change-Id: I0d2f691eecfac013bc8ad3e506484d958d18ce0a
    Author: Michael Weghorn <m.weghorn@posteo.de>
    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 <m.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn
2026-10-07 17:52:40 +02:00
parent cd6d8538d0
commit 4909fb2b4c
2 changed files with 3 additions and 34 deletions
-1
View File
@@ -32,7 +32,6 @@ enum class ValueSetItemType
{
None,
Image,
ImageAndText,
Color,
UserDraw
};
+2 -32
View File
@@ -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,8 +1278,6 @@ 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);
DrawImageFlags nImageStyle = DrawImageFlags::NONE;
@@ -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()) );
}