[Libreoffice-commits] core.git: include/svx svx/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Feb 14 06:00:34 UTC 2017


 include/svx/sidebar/ValueSetWithTextControl.hxx      |   13 -----
 svx/source/sidebar/tools/ValueSetWithTextControl.cxx |   46 +++----------------
 2 files changed, 8 insertions(+), 51 deletions(-)

New commits:
commit 8593cd238cd049ecf9036833d5c83aad23082e26
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Feb 13 14:38:41 2017 +0200

    remove unused ValueSetWithTextControl::ControlType enum
    
    since we only ever use the TextText enumerator
    
    Change-Id: Idfb96ad6ea3461e886439df33695be2d8dcebef9
    Reviewed-on: https://gerrit.libreoffice.org/34211
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/sidebar/ValueSetWithTextControl.hxx b/include/svx/sidebar/ValueSetWithTextControl.hxx
index 619c77a..d21ccce 100644
--- a/include/svx/sidebar/ValueSetWithTextControl.hxx
+++ b/include/svx/sidebar/ValueSetWithTextControl.hxx
@@ -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;
 };
 
diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
index 1d8f887..7f18341 100644
--- a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
+++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
@@ -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 );


More information about the Libreoffice-commits mailing list