Kaydet (Commit) 8593cd23 authored tarafından Noel Grandin's avatar Noel Grandin

remove unused ValueSetWithTextControl::ControlType enum

since we only ever use the TextText enumerator

Change-Id: Idfb96ad6ea3461e886439df33695be2d8dcebef9
Reviewed-on: https://gerrit.libreoffice.org/34211Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 93837254
......@@ -38,19 +38,8 @@ namespace svx { namespace sidebar {
class SVX_DLLPUBLIC ValueSetWithTextControl : public ValueSet
{
public:
// control type of specialized <ValueSet>:
// - image + text
// - text + text
enum class ControlType
{
ImageText,
TextText
};
ValueSetWithTextControl(Window* pParent, WinBits nBits);
// add item for control type TEXT_TEXT
// if control type does not match TEXT_TEXT no item is added.
void AddItem(
const OUString& rItemText,
const OUString& rItemText2 );
......@@ -67,8 +56,6 @@ private:
};
typedef ::std::vector< ValueSetWithTextItem > tItemList;
const ControlType meControlType;
tItemList maItems;
};
......
......@@ -32,7 +32,6 @@ namespace svx { namespace sidebar {
ValueSetWithTextControl::ValueSetWithTextControl(Window* pParent, WinBits nBits)
: ValueSet( pParent, nBits )
, meControlType( svx::sidebar::ValueSetWithTextControl::ControlType::TextText )
{
SetColCount();
}
......@@ -42,11 +41,6 @@ void ValueSetWithTextControl::AddItem(
const OUString& rItemText,
const OUString& rItemText2 )
{
if ( meControlType != ControlType::TextText )
{
return;
}
ValueSetWithTextItem aItem;
aItem.maItemText = rItemText;
aItem.maItemText2 = rItemText2;
......@@ -65,7 +59,6 @@ void ValueSetWithTextControl::UserDraw( const UserDrawEvent& rUDEvt )
const sal_uInt16 nItemId = rUDEvt.GetItemId();
const long nRectHeight = aRect.GetHeight();
const Point aBLPos = aRect.TopLeft();
vcl::Font aFont(OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, MsLangId::getSystemLanguage(), GetDefaultFontFlags::OnlyOne));
{
......@@ -90,50 +83,27 @@ void ValueSetWithTextControl::UserDraw( const UserDrawEvent& rUDEvt )
pDev->DrawRect(aRect);
}
//draw image + text resp. text + text
Image* pImage = nullptr;
if ( GetSelectItemId() == nItemId )
{
aFont.SetColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_HighlightText ) );
pImage = &maItems[nItemId-1].maSelectedItemImage;
}
else
{
aFont.SetColor( GetSettings().GetStyleSettings().GetFieldTextColor() );
pImage = &maItems[nItemId-1].maItemImage;
}
Rectangle aStrRect = aRect;
aStrRect.Top() += nRectHeight/4;
aStrRect.Bottom() -= nRectHeight/4;
switch ( meControlType )
{
case ControlType::ImageText:
{
Point aImgStart(
aBLPos.X() + 4,
aBLPos.Y() + ( ( nRectHeight - pImage->GetSizePixel().Height() ) / 2 ) );
pDev->DrawImage( aImgStart, *pImage );
aStrRect.Left() += pImage->GetSizePixel().Width() + 12;
pDev->SetFont(aFont);
pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText, DrawTextFlags::EndEllipsis);
}
break;
case ControlType::TextText:
{
const long nRectWidth = aRect.GetWidth();
aStrRect.Left() += 8;
aStrRect.Right() -= (nRectWidth*2)/3;
pDev->SetFont(aFont);
pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText, DrawTextFlags::EndEllipsis);
aStrRect.Left() += nRectWidth/3;
aStrRect.Right() += (nRectWidth*2)/3;
pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText2, DrawTextFlags::EndEllipsis);
}
break;
}
const long nRectWidth = aRect.GetWidth();
aStrRect.Left() += 8;
aStrRect.Right() -= (nRectWidth*2)/3;
pDev->SetFont(aFont);
pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText, DrawTextFlags::EndEllipsis);
aStrRect.Left() += nRectWidth/3;
aStrRect.Right() += (nRectWidth*2)/3;
pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText2, DrawTextFlags::EndEllipsis);
}
Invalidate( aRect );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment