1*8dcb2a10SAndre Fischer /************************************************************** 2*8dcb2a10SAndre Fischer * 3*8dcb2a10SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 4*8dcb2a10SAndre Fischer * or more contributor license agreements. See the NOTICE file 5*8dcb2a10SAndre Fischer * distributed with this work for additional information 6*8dcb2a10SAndre Fischer * regarding copyright ownership. The ASF licenses this file 7*8dcb2a10SAndre Fischer * to you under the Apache License, Version 2.0 (the 8*8dcb2a10SAndre Fischer * "License"); you may not use this file except in compliance 9*8dcb2a10SAndre Fischer * with the License. You may obtain a copy of the License at 10*8dcb2a10SAndre Fischer * 11*8dcb2a10SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 12*8dcb2a10SAndre Fischer * 13*8dcb2a10SAndre Fischer * Unless required by applicable law or agreed to in writing, 14*8dcb2a10SAndre Fischer * software distributed under the License is distributed on an 15*8dcb2a10SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*8dcb2a10SAndre Fischer * KIND, either express or implied. See the License for the 17*8dcb2a10SAndre Fischer * specific language governing permissions and limitations 18*8dcb2a10SAndre Fischer * under the License. 19*8dcb2a10SAndre Fischer * 20*8dcb2a10SAndre Fischer *************************************************************/ 21*8dcb2a10SAndre Fischer 22*8dcb2a10SAndre Fischer #include "LineStyleValueSet.hxx" 23*8dcb2a10SAndre Fischer 24*8dcb2a10SAndre Fischer #include <i18npool/mslangid.hxx> 25*8dcb2a10SAndre Fischer 26*8dcb2a10SAndre Fischer 27*8dcb2a10SAndre Fischer namespace svx { namespace sidebar { 28*8dcb2a10SAndre Fischer 29*8dcb2a10SAndre Fischer LineStyleValueSet::LineStyleValueSet ( 30*8dcb2a10SAndre Fischer Window* pParent, 31*8dcb2a10SAndre Fischer const ResId& rResId) 32*8dcb2a10SAndre Fischer : ValueSet( pParent, rResId ), 33*8dcb2a10SAndre Fischer pVDev(NULL), 34*8dcb2a10SAndre Fischer mbSelectFirst(true) 35*8dcb2a10SAndre Fischer { 36*8dcb2a10SAndre Fischer SetColCount( 1 ); 37*8dcb2a10SAndre Fischer } 38*8dcb2a10SAndre Fischer 39*8dcb2a10SAndre Fischer 40*8dcb2a10SAndre Fischer 41*8dcb2a10SAndre Fischer 42*8dcb2a10SAndre Fischer LineStyleValueSet::~LineStyleValueSet (void) 43*8dcb2a10SAndre Fischer { 44*8dcb2a10SAndre Fischer delete pVDev; 45*8dcb2a10SAndre Fischer } 46*8dcb2a10SAndre Fischer 47*8dcb2a10SAndre Fischer 48*8dcb2a10SAndre Fischer 49*8dcb2a10SAndre Fischer 50*8dcb2a10SAndre Fischer void LineStyleValueSet::SetFirstString(XubString str) 51*8dcb2a10SAndre Fischer { 52*8dcb2a10SAndre Fischer strNone = str; 53*8dcb2a10SAndre Fischer } 54*8dcb2a10SAndre Fischer 55*8dcb2a10SAndre Fischer 56*8dcb2a10SAndre Fischer 57*8dcb2a10SAndre Fischer 58*8dcb2a10SAndre Fischer void LineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt ) 59*8dcb2a10SAndre Fischer { 60*8dcb2a10SAndre Fischer Rectangle aRect = rUDEvt.GetRect(); 61*8dcb2a10SAndre Fischer OutputDevice* pDev = rUDEvt.GetDevice(); 62*8dcb2a10SAndre Fischer sal_uInt16 nItemId = rUDEvt.GetItemId(); 63*8dcb2a10SAndre Fischer 64*8dcb2a10SAndre Fischer long nRectHeight = aRect.GetHeight(); 65*8dcb2a10SAndre Fischer long nRectWidth = aRect.GetWidth(); 66*8dcb2a10SAndre Fischer Point aBLPos = aRect.TopLeft(); 67*8dcb2a10SAndre Fischer if(nItemId == 1) 68*8dcb2a10SAndre Fischer { 69*8dcb2a10SAndre Fischer const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 70*8dcb2a10SAndre Fischer Color aOldFillColor = pDev->GetFillColor(); 71*8dcb2a10SAndre Fischer const Color aTextColor = rStyleSettings.GetFieldTextColor(); 72*8dcb2a10SAndre Fischer 73*8dcb2a10SAndre Fischer //draw back 74*8dcb2a10SAndre Fischer if( mbSelectFirst ) 75*8dcb2a10SAndre Fischer { 76*8dcb2a10SAndre Fischer Color aBackColor(50,107,197); 77*8dcb2a10SAndre Fischer Rectangle aBackRect = aRect; 78*8dcb2a10SAndre Fischer aBackRect.Top() += 3; 79*8dcb2a10SAndre Fischer aBackRect.Bottom() -= 2; 80*8dcb2a10SAndre Fischer pDev->SetFillColor(aBackColor); 81*8dcb2a10SAndre Fischer pDev->DrawRect(aBackRect); 82*8dcb2a10SAndre Fischer } 83*8dcb2a10SAndre Fischer else 84*8dcb2a10SAndre Fischer { 85*8dcb2a10SAndre Fischer pDev->SetFillColor( COL_TRANSPARENT ); 86*8dcb2a10SAndre Fischer pDev->DrawRect(aRect); 87*8dcb2a10SAndre Fischer } 88*8dcb2a10SAndre Fischer pDev->SetFillColor(aOldFillColor); 89*8dcb2a10SAndre Fischer 90*8dcb2a10SAndre Fischer //draw text 91*8dcb2a10SAndre Fischer Font aOldFont = pDev->GetFont(); 92*8dcb2a10SAndre Fischer Color aOldColor = pDev->GetLineColor(); 93*8dcb2a10SAndre Fischer Font aFont(OutputDevice::GetDefaultFont( 94*8dcb2a10SAndre Fischer DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); 95*8dcb2a10SAndre Fischer Size aSize = aFont.GetSize(); 96*8dcb2a10SAndre Fischer aSize.Height() = nRectHeight*3/5; 97*8dcb2a10SAndre Fischer if( mbSelectFirst ) 98*8dcb2a10SAndre Fischer aFont.SetColor(COL_WHITE); 99*8dcb2a10SAndre Fischer else 100*8dcb2a10SAndre Fischer //aFont.SetColor(COL_BLACK); 101*8dcb2a10SAndre Fischer aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast 102*8dcb2a10SAndre Fischer aFont.SetFillColor(COL_BLUE); 103*8dcb2a10SAndre Fischer aFont.SetSize( aSize ); 104*8dcb2a10SAndre Fischer pDev->SetFont(aFont); 105*8dcb2a10SAndre Fischer // String sText("None", 9, RTL_TEXTENCODING_ASCII_US); 106*8dcb2a10SAndre Fischer 107*8dcb2a10SAndre Fischer // Point aStart(aBLPos.X() + 8 , aBLPos.Y() + nRectHeight/6); 108*8dcb2a10SAndre Fischer Rectangle aStrRect = aRect; 109*8dcb2a10SAndre Fischer aStrRect.Top() += nRectHeight/6; 110*8dcb2a10SAndre Fischer aStrRect.Bottom() -= nRectHeight/6; 111*8dcb2a10SAndre Fischer aStrRect.Left() += 8; 112*8dcb2a10SAndre Fischer pDev->DrawText(aStrRect, strNone, TEXT_DRAW_ENDELLIPSIS); 113*8dcb2a10SAndre Fischer 114*8dcb2a10SAndre Fischer pDev->SetFont(aOldFont); 115*8dcb2a10SAndre Fischer pDev->SetLineColor(aOldColor); 116*8dcb2a10SAndre Fischer 117*8dcb2a10SAndre Fischer 118*8dcb2a10SAndre Fischer } 119*8dcb2a10SAndre Fischer Invalidate( aRect ); 120*8dcb2a10SAndre Fischer } 121*8dcb2a10SAndre Fischer 122*8dcb2a10SAndre Fischer 123*8dcb2a10SAndre Fischer 124*8dcb2a10SAndre Fischer 125*8dcb2a10SAndre Fischer void LineStyleValueSet::SetFirstSelect(bool bSel) 126*8dcb2a10SAndre Fischer { 127*8dcb2a10SAndre Fischer mbSelectFirst = bSel; 128*8dcb2a10SAndre Fischer } 129*8dcb2a10SAndre Fischer 130*8dcb2a10SAndre Fischer 131*8dcb2a10SAndre Fischer 132*8dcb2a10SAndre Fischer } } // end of namespace svx::sidebar 133