bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / sidebar / line / LineStyleValueSet.cxx
blob41abbc4ee8fd01a3cf12136a9094a0fb0c621325
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 #include "LineStyleValueSet.hxx"
20 #include <i18nlangtag/mslangid.hxx>
23 namespace svx { namespace sidebar {
25 LineStyleValueSet::LineStyleValueSet (
26 Window* pParent,
27 const ResId& rResId)
28 : ValueSet( pParent, rResId ),
29 pVDev(NULL),
30 mbSelectFirst(true)
32 SetColCount( 1 );
38 LineStyleValueSet::~LineStyleValueSet (void)
40 delete pVDev;
46 void LineStyleValueSet::SetFirstString(XubString str)
48 strNone = str;
54 void LineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt )
56 Rectangle aRect = rUDEvt.GetRect();
57 OutputDevice* pDev = rUDEvt.GetDevice();
58 sal_uInt16 nItemId = rUDEvt.GetItemId();
60 long nRectHeight = aRect.GetHeight();
61 //Point aBLPos = aRect.TopLeft();
62 if(nItemId == 1)
64 Color aOldFillColor = pDev->GetFillColor();
66 //draw back
67 if( mbSelectFirst )
69 Color aBackColor(50,107,197);
70 Rectangle aBackRect = aRect;
71 aBackRect.Top() += 3;
72 aBackRect.Bottom() -= 2;
73 pDev->SetFillColor(aBackColor);
74 pDev->DrawRect(aBackRect);
76 else
78 pDev->SetFillColor( COL_TRANSPARENT );
79 pDev->DrawRect(aRect);
81 pDev->SetFillColor(aOldFillColor);
83 //draw text
84 Font aOldFont = pDev->GetFont();
85 Color aOldColor = pDev->GetLineColor();
86 Font aFont(OutputDevice::GetDefaultFont(
87 DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
88 Size aSize = aFont.GetSize();
89 aSize.Height() = nRectHeight*3/5;
90 if( mbSelectFirst )
91 aFont.SetColor(COL_WHITE);
92 else
93 //aFont.SetColor(COL_BLACK);
94 aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast
95 aFont.SetFillColor(COL_BLUE);
96 aFont.SetSize( aSize );
97 pDev->SetFont(aFont);
98 // String sText("None", 9, RTL_TEXTENCODING_ASCII_US);
100 // Point aStart(aBLPos.X() + 8 , aBLPos.Y() + nRectHeight/6);
101 Rectangle aStrRect = aRect;
102 aStrRect.Top() += nRectHeight/6;
103 aStrRect.Bottom() -= nRectHeight/6;
104 aStrRect.Left() += 8;
105 pDev->DrawText(aStrRect, strNone, TEXT_DRAW_ENDELLIPSIS);
107 pDev->SetFont(aOldFont);
108 pDev->SetLineColor(aOldColor);
112 Invalidate( aRect );
118 void LineStyleValueSet::SetFirstSelect(bool bSel)
120 mbSelectFirst = bSel;
125 } } // end of namespace svx::sidebar
127 // eof