18dcb2a10SAndre Fischer /**************************************************************
28dcb2a10SAndre Fischer  *
38dcb2a10SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
48dcb2a10SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
58dcb2a10SAndre Fischer  * distributed with this work for additional information
68dcb2a10SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
78dcb2a10SAndre Fischer  * to you under the Apache License, Version 2.0 (the
88dcb2a10SAndre Fischer  * "License"); you may not use this file except in compliance
98dcb2a10SAndre Fischer  * with the License.  You may obtain a copy of the License at
108dcb2a10SAndre Fischer  *
118dcb2a10SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
128dcb2a10SAndre Fischer  *
138dcb2a10SAndre Fischer  * Unless required by applicable law or agreed to in writing,
148dcb2a10SAndre Fischer  * software distributed under the License is distributed on an
158dcb2a10SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
168dcb2a10SAndre Fischer  * KIND, either express or implied.  See the License for the
178dcb2a10SAndre Fischer  * specific language governing permissions and limitations
188dcb2a10SAndre Fischer  * under the License.
198dcb2a10SAndre Fischer  *
208dcb2a10SAndre Fischer  *************************************************************/
218dcb2a10SAndre Fischer 
228dcb2a10SAndre Fischer #include "LineStyleValueSet.hxx"
238dcb2a10SAndre Fischer 
248dcb2a10SAndre Fischer #include <i18npool/mslangid.hxx>
258dcb2a10SAndre Fischer 
268dcb2a10SAndre Fischer 
278dcb2a10SAndre Fischer namespace svx { namespace sidebar {
288dcb2a10SAndre Fischer 
LineStyleValueSet(Window * pParent,const ResId & rResId)298dcb2a10SAndre Fischer LineStyleValueSet::LineStyleValueSet (
308dcb2a10SAndre Fischer     Window* pParent,
318dcb2a10SAndre Fischer     const ResId& rResId)
328dcb2a10SAndre Fischer     : ValueSet( pParent, rResId ),
338dcb2a10SAndre Fischer       pVDev(NULL),
348dcb2a10SAndre Fischer       mbSelectFirst(true)
358dcb2a10SAndre Fischer {
368dcb2a10SAndre Fischer 	SetColCount( 1 );
378dcb2a10SAndre Fischer }
388dcb2a10SAndre Fischer 
398dcb2a10SAndre Fischer 
408dcb2a10SAndre Fischer 
418dcb2a10SAndre Fischer 
~LineStyleValueSet(void)428dcb2a10SAndre Fischer LineStyleValueSet::~LineStyleValueSet (void)
438dcb2a10SAndre Fischer {
448dcb2a10SAndre Fischer 	delete pVDev;
458dcb2a10SAndre Fischer }
468dcb2a10SAndre Fischer 
478dcb2a10SAndre Fischer 
488dcb2a10SAndre Fischer 
498dcb2a10SAndre Fischer 
SetFirstString(XubString str)508dcb2a10SAndre Fischer void LineStyleValueSet::SetFirstString(XubString str)
518dcb2a10SAndre Fischer {
528dcb2a10SAndre Fischer 	strNone = str;
538dcb2a10SAndre Fischer }
548dcb2a10SAndre Fischer 
558dcb2a10SAndre Fischer 
568dcb2a10SAndre Fischer 
578dcb2a10SAndre Fischer 
UserDraw(const UserDrawEvent & rUDEvt)588dcb2a10SAndre Fischer void  LineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt )
598dcb2a10SAndre Fischer {
608dcb2a10SAndre Fischer 	Rectangle aRect = rUDEvt.GetRect();
618dcb2a10SAndre Fischer 	OutputDevice*  pDev = rUDEvt.GetDevice();
628dcb2a10SAndre Fischer 	sal_uInt16	nItemId = rUDEvt.GetItemId();
638dcb2a10SAndre Fischer 
648dcb2a10SAndre Fischer 	long nRectHeight = aRect.GetHeight();
65*10534d9fSPavel Janík 	// long nRectWidth = aRect.GetWidth();
668dcb2a10SAndre Fischer 	Point aBLPos = aRect.TopLeft();
678dcb2a10SAndre Fischer 	if(nItemId == 1)
688dcb2a10SAndre Fischer 	{
698dcb2a10SAndre Fischer 		const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
708dcb2a10SAndre Fischer 		Color aOldFillColor = pDev->GetFillColor();
718dcb2a10SAndre Fischer 		const Color aTextColor = rStyleSettings.GetFieldTextColor();
728dcb2a10SAndre Fischer 
738dcb2a10SAndre Fischer 		//draw back
748dcb2a10SAndre Fischer 		if( mbSelectFirst )
758dcb2a10SAndre Fischer 		{
768dcb2a10SAndre Fischer 			Color aBackColor(50,107,197);
778dcb2a10SAndre Fischer 			Rectangle aBackRect = aRect;
788dcb2a10SAndre Fischer 			aBackRect.Top() += 3;
798dcb2a10SAndre Fischer 			aBackRect.Bottom() -= 2;
808dcb2a10SAndre Fischer 			pDev->SetFillColor(aBackColor);
818dcb2a10SAndre Fischer 			pDev->DrawRect(aBackRect);
828dcb2a10SAndre Fischer 		}
838dcb2a10SAndre Fischer 		else
848dcb2a10SAndre Fischer 		{
858dcb2a10SAndre Fischer 			pDev->SetFillColor( COL_TRANSPARENT );
868dcb2a10SAndre Fischer 			pDev->DrawRect(aRect);
878dcb2a10SAndre Fischer 		}
888dcb2a10SAndre Fischer 		pDev->SetFillColor(aOldFillColor);
898dcb2a10SAndre Fischer 
908dcb2a10SAndre Fischer 		//draw text
918dcb2a10SAndre Fischer 		Font aOldFont = pDev->GetFont();
928dcb2a10SAndre Fischer 		Color aOldColor = pDev->GetLineColor();
938dcb2a10SAndre Fischer 		Font aFont(OutputDevice::GetDefaultFont(
948dcb2a10SAndre Fischer 					DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
958dcb2a10SAndre Fischer 		Size aSize = aFont.GetSize();
968dcb2a10SAndre Fischer 		aSize.Height() = nRectHeight*3/5;
978dcb2a10SAndre Fischer 		if( mbSelectFirst )
988dcb2a10SAndre Fischer 			aFont.SetColor(COL_WHITE);
998dcb2a10SAndre Fischer 		else
1008dcb2a10SAndre Fischer 			//aFont.SetColor(COL_BLACK);
1018dcb2a10SAndre Fischer 			aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast
1028dcb2a10SAndre Fischer 		aFont.SetFillColor(COL_BLUE);
1038dcb2a10SAndre Fischer 		aFont.SetSize( aSize );
1048dcb2a10SAndre Fischer 		pDev->SetFont(aFont);
1058dcb2a10SAndre Fischer //		String sText("None", 9, RTL_TEXTENCODING_ASCII_US);
1068dcb2a10SAndre Fischer 
1078dcb2a10SAndre Fischer 	//	Point aStart(aBLPos.X() + 8 , aBLPos.Y() + nRectHeight/6);
1088dcb2a10SAndre Fischer 		Rectangle aStrRect = aRect;
1098dcb2a10SAndre Fischer 		aStrRect.Top() += nRectHeight/6;
1108dcb2a10SAndre Fischer 		aStrRect.Bottom() -= nRectHeight/6;
1118dcb2a10SAndre Fischer 		aStrRect.Left() += 8;
1128dcb2a10SAndre Fischer 		pDev->DrawText(aStrRect, strNone, TEXT_DRAW_ENDELLIPSIS);
1138dcb2a10SAndre Fischer 
1148dcb2a10SAndre Fischer 		pDev->SetFont(aOldFont);
1158dcb2a10SAndre Fischer 		pDev->SetLineColor(aOldColor);
1168dcb2a10SAndre Fischer 
1178dcb2a10SAndre Fischer 
1188dcb2a10SAndre Fischer 	}
1198dcb2a10SAndre Fischer 	Invalidate( aRect );
1208dcb2a10SAndre Fischer }
1218dcb2a10SAndre Fischer 
1228dcb2a10SAndre Fischer 
1238dcb2a10SAndre Fischer 
1248dcb2a10SAndre Fischer 
SetFirstSelect(bool bSel)1258dcb2a10SAndre Fischer void  LineStyleValueSet::SetFirstSelect(bool bSel)
1268dcb2a10SAndre Fischer {
1278dcb2a10SAndre Fischer 	mbSelectFirst = bSel;
1288dcb2a10SAndre Fischer }
1298dcb2a10SAndre Fischer 
1308dcb2a10SAndre Fischer 
1318dcb2a10SAndre Fischer 
1328dcb2a10SAndre Fischer } } // end of namespace svx::sidebar
1334e8031e0SArmin Le Grand 
1344e8031e0SArmin Le Grand // eof
135