PageRenderTime 408ms CodeModel.GetById 16ms app.highlight 365ms RepoModel.GetById 1ms app.codeStats 1ms

/OOO330_m20/vcl/source/window/decoview.cxx

https://bitbucket.org/tora/ooo-enum-attribute-packed-experiment-ooo330_m20-vcl
C++ | 1388 lines | 1226 code | 102 blank | 60 comment | 186 complexity | 0d18300bca1e76e07c23bd45ea70a9fc MD5 | raw file
   1/*************************************************************************
   2 *
   3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 * 
   5 * Copyright 2000, 2010 Oracle and/or its affiliates.
   6 *
   7 * OpenOffice.org - a multi-platform office productivity suite
   8 *
   9 * This file is part of OpenOffice.org.
  10 *
  11 * OpenOffice.org is free software: you can redistribute it and/or modify
  12 * it under the terms of the GNU Lesser General Public License version 3
  13 * only, as published by the Free Software Foundation.
  14 *
  15 * OpenOffice.org is distributed in the hope that it will be useful,
  16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18 * GNU Lesser General Public License version 3 for more details
  19 * (a copy is included in the LICENSE file that accompanied this code).
  20 *
  21 * You should have received a copy of the GNU Lesser General Public License
  22 * version 3 along with OpenOffice.org.  If not, see
  23 * <http://www.openoffice.org/license.html>
  24 * for a copy of the LGPLv3 License.
  25 *
  26 ************************************************************************/
  27
  28// MARKER(update_precomp.py): autogen include statement, do not remove
  29#include "precompiled_vcl.hxx"
  30#include <vcl/settings.hxx>
  31#include <tools/poly.hxx>
  32#include <vcl/outdev.hxx>
  33#include <vcl/bmpacc.hxx>
  34#include <vcl/decoview.hxx>
  35#include <vcl/window.hxx>
  36#include <vcl/ctrl.hxx>
  37
  38// =======================================================================
  39
  40#define BUTTON_DRAW_FLATTEST	(BUTTON_DRAW_FLAT | 			\
  41								 BUTTON_DRAW_PRESSED |			\
  42								 BUTTON_DRAW_CHECKED |			\
  43								 BUTTON_DRAW_HIGHLIGHT)
  44
  45// =======================================================================
  46
  47void ImplDrawOS2Symbol( OutputDevice* pDev, const Rectangle& rRect,
  48						USHORT nStyle, BOOL bClose )
  49{
  50	DecorationView			aView( pDev );
  51	const StyleSettings&	rStyleSettings = pDev->GetSettings().GetStyleSettings();
  52	Rectangle				aRect = rRect;
  53	Color					aColor1;
  54	Color					aColor2;
  55
  56	pDev->SetFillColor();
  57
  58	if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
  59	{
  60		aColor1 = rStyleSettings.GetShadowColor();
  61		aColor2 = rStyleSettings.GetLightColor();
  62	}
  63	else
  64	{
  65		aColor1 = rStyleSettings.GetLightColor();
  66		aColor2 = rStyleSettings.GetShadowColor();
  67	}
  68	aView.DrawFrame( aRect, aColor1, aColor2 );
  69
  70	aRect.Left()	+= 2;
  71	aRect.Top() 	+= 2;
  72	aRect.Right()	-= 2;
  73	aRect.Bottom()	-= 2;
  74
  75	if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
  76		pDev->SetLineColor( rStyleSettings.GetLightColor() );
  77	else
  78		pDev->SetLineColor( rStyleSettings.GetShadowColor() );
  79	if ( bClose )
  80	{
  81		pDev->DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom()-2 ) );
  82		pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right()-2, aRect.Top() ) );
  83		pDev->DrawLine( Point( aRect.Left()+2, aRect.Bottom()-1 ),
  84						Point( aRect.Right()-1, aRect.Top()+2 ) );
  85	}
  86	else
  87	{
  88		pDev->DrawLine( aRect.TopLeft(), aRect.BottomLeft() );
  89		pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right()-1, aRect.Top() ) );
  90	}
  91
  92	if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
  93		pDev->SetLineColor( rStyleSettings.GetShadowColor() );
  94	else
  95		pDev->SetLineColor( rStyleSettings.GetLightColor() );
  96	if ( bClose )
  97	{
  98		pDev->DrawLine( Point( aRect.Right(), aRect.Top()+2 ), aRect.BottomRight() );
  99		pDev->DrawLine( Point( aRect.Left()+2, aRect.Bottom() ), aRect.BottomRight() );
 100		pDev->DrawLine( Point( aRect.Right()-2, aRect.Top()+1 ),
 101						Point( aRect.Left()+1, aRect.Bottom()-2 ) );
 102	}
 103	else
 104	{
 105		pDev->DrawLine( aRect.TopRight(), aRect.BottomRight() );
 106		pDev->DrawLine( Point( aRect.Left()+1, aRect.Bottom() ), aRect.BottomRight() );
 107	}
 108}
 109
 110// =======================================================================
 111
 112static void ImplDrawSymbol( OutputDevice* pDev, const Rectangle& rRect,
 113							SymbolType eType  )
 114{
 115	// Groessen vorberechnen
 116	long	nMin	= Min( rRect.GetWidth(), rRect.GetHeight() );
 117	long	nSize	= nMin;
 118
 119	if ( nMin & 0x01 )
 120		nMin--;
 121	Point	aCenter = rRect.Center();
 122	long	nCenterX = aCenter.X();
 123	long	nCenterY = aCenter.Y();
 124	long	n2 = nMin / 2;
 125	long	n4 = nMin / 4;
 126	long	nLeft;
 127	long	nTop;
 128	long	nRight;
 129	long	nBottom;
 130	long	nTemp;
 131	long	i;
 132
 133	switch ( eType )
 134	{
 135		case SYMBOL_ARROW_UP:
 136			{
 137			if ( !(nMin & 0x01) )
 138			{
 139				n2--;
 140				n4--;
 141			}
 142			nTop = nCenterY-n2;
 143			nBottom = nCenterY;
 144			pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
 145			i = 1;
 146			while ( i <= n2 )
 147			{
 148				nTop++;
 149				nTemp = nCenterX-i;
 150				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 151				nTemp = nCenterX+i;
 152				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 153				i++;
 154			}
 155			pDev->DrawRect( Rectangle( nCenterX-n4, nBottom,
 156									   nCenterX+n4, nBottom+n2 ) );
 157			}
 158			break;
 159
 160		case SYMBOL_ARROW_DOWN:
 161			{
 162			if ( !(nMin & 0x01) )
 163			{
 164				n2--;
 165				n4--;
 166			}
 167			nTop = nCenterY;
 168			nBottom = nCenterY+n2;
 169			pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
 170			i = 1;
 171			while ( i <= n2 )
 172			{
 173				nBottom--;
 174				nTemp = nCenterX-i;
 175				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 176				nTemp = nCenterX+i;
 177				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 178				i++;
 179			}
 180			pDev->DrawRect( Rectangle( nCenterX-n4, nTop-n2,
 181									   nCenterX+n4, nTop ) );
 182			}
 183			break;
 184
 185		case SYMBOL_ARROW_LEFT:
 186			{
 187			if ( !(nMin & 0x01) )
 188			{
 189				n2--;
 190				n4--;
 191			}
 192			nLeft = nCenterX-n2;
 193			nRight = nCenterX;
 194			pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
 195			i = 1;
 196			while ( i <= n2 )
 197			{
 198				nLeft++;
 199				nTemp = nCenterY-i;
 200				pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
 201				nTemp = nCenterY+i;
 202				pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
 203				i++;
 204			}
 205			pDev->DrawRect( Rectangle( nRight, nCenterY-n4,
 206									   nRight+n2, nCenterY+n4 ) );
 207			}
 208			break;
 209
 210		case SYMBOL_ARROW_RIGHT:
 211			{
 212			if ( !(nMin & 0x01) )
 213			{
 214				n2--;
 215				n4--;
 216			}
 217			nLeft = nCenterX;
 218			nRight = nCenterX+n2;
 219			pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
 220			i = 1;
 221			while ( i <= n2 )
 222			{
 223				nRight--;
 224				nTemp = nCenterY-i;
 225				pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
 226				nTemp = nCenterY+i;
 227				pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
 228				i++;
 229			}
 230			pDev->DrawRect( Rectangle( nLeft-n2, nCenterY-n4,
 231									   nLeft, nCenterY+n4 ) );
 232			}
 233			break;
 234
 235
 236		case SYMBOL_SPIN_UP:
 237			{
 238			if ( !(nMin & 0x01) )
 239				n2--;
 240			nTop = nCenterY-n4;
 241			nBottom = nTop+n2;
 242			pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
 243			i = 1;
 244			while ( i <= n2 )
 245			{
 246				nTop++;
 247				nTemp = nCenterX-i;
 248				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 249				nTemp = nCenterX+i;
 250				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 251				i++;
 252			}
 253			}
 254			break;
 255
 256		case SYMBOL_SPIN_DOWN:
 257			{
 258			if ( !(nMin & 0x01) )
 259				n2--;
 260			nTop = nCenterY-n4;
 261			nBottom = nTop+n2;
 262			pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
 263			i = 1;
 264			while ( i <= n2 )
 265			{
 266				nBottom--;
 267				nTemp = nCenterX-i;
 268				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 269				nTemp = nCenterX+i;
 270				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 271				i++;
 272			}
 273			}
 274			break;
 275
 276		case SYMBOL_SPIN_LEFT:
 277		case SYMBOL_FIRST:
 278		case SYMBOL_PREV:
 279		case SYMBOL_REVERSEPLAY:
 280			{
 281			if ( !(nMin & 0x01) )
 282				n2--;
 283			nLeft = nCenterX-n4;
 284			if ( eType == SYMBOL_FIRST )
 285				nLeft++;
 286			nRight = nLeft+n2;
 287			pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
 288			i = 1;
 289			while ( i <= n2 )
 290			{
 291				nLeft++;
 292				nTemp = nCenterY-i;
 293				pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
 294				nTemp = nCenterY+i;
 295				pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
 296				i++;
 297			}
 298			if ( eType == SYMBOL_FIRST )
 299			{
 300				pDev->DrawRect( Rectangle( nCenterX-n4-1, nCenterY-n2,
 301										   nCenterX-n4-1, nCenterY+n2 ) );
 302			}
 303			}
 304			break;
 305
 306		case SYMBOL_SPIN_RIGHT:
 307		case SYMBOL_LAST:
 308		case SYMBOL_NEXT:
 309		case SYMBOL_PLAY:
 310			{
 311			if ( !(nMin & 0x01) )
 312				n2--;
 313			nLeft = nCenterX-n4;
 314			if ( eType == SYMBOL_LAST )
 315				nLeft--;
 316			nRight = nLeft+n2;
 317			pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
 318			i = 1;
 319			while ( i <= n2 )
 320			{
 321				nRight--;
 322				nTemp = nCenterY-i;
 323				pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
 324				nTemp = nCenterY+i;
 325				pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
 326				i++;
 327			}
 328			if ( eType == SYMBOL_LAST )
 329			{
 330				pDev->DrawRect( Rectangle( nCenterX+n4+1, nCenterY-n2,
 331										   nCenterX+n4+1, nCenterY+n2 ) );
 332			}
 333			}
 334			break;
 335
 336		case SYMBOL_PAGEUP:
 337		case SYMBOL_PAGEDOWN:
 338		{
 339			if ( !( nSize & 0x01 ))
 340			{
 341				// An even rectangle size means we have to use a smaller size for 
 342				// our arrows as we want to use one pixel for the spearhead! Otherwise 
 343				// it will be clipped!
 344				nCenterX++;
 345				n2 = ( nMin-1 ) / 2;
 346				n4 = ( nMin-1 ) / 4;
 347			}
 348
 349			nTop = nCenterY-n2;
 350			nBottom = nCenterY-1;
 351			pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
 352			pDev->DrawRect( Rectangle( nCenterX, nTop+n2+1, nCenterX, nBottom+n2+1 ) );
 353			i = 1;
 354			while ( i < n2 )
 355			{
 356				( eType == SYMBOL_PAGEUP ) ? nTop++ : nBottom--;
 357				nTemp = nCenterX-i;
 358				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 359				pDev->DrawRect( Rectangle( nTemp, nTop+n2+1, nTemp, nBottom+n2+1 ) );
 360				nTemp = nCenterX+i;
 361				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 362				pDev->DrawRect( Rectangle( nTemp, nTop+n2+1, nTemp, nBottom+n2+1 ) );
 363				i++;
 364			}
 365		}
 366		break;
 367
 368		case SYMBOL_RADIOCHECKMARK:
 369		case SYMBOL_RECORD:
 370		{
 371			const long			nExt = ( n2 << 1 ) + 1;
 372			Bitmap				aBmp( Size( nExt, nExt ), 1 );
 373			BitmapWriteAccess*	pWAcc = aBmp.AcquireWriteAccess();
 374
 375			if( pWAcc )
 376			{
 377				const Color aWhite( COL_WHITE );
 378				const Color aBlack( COL_BLACK );
 379
 380				pWAcc->Erase( aWhite );
 381				pWAcc->SetLineColor( aBlack );
 382				pWAcc->SetFillColor( aBlack );
 383				pWAcc->DrawPolygon( Polygon( Point( n2, n2 ), n2, n2 ) );
 384				aBmp.ReleaseAccess( pWAcc );
 385				pDev->DrawMask( Point( nCenterX - n2, nCenterY - n2 ), aBmp, pDev->GetFillColor() );
 386			}
 387			else
 388				pDev->DrawPolygon( Polygon( Point( nCenterX, nCenterY ), n2, n2 ) );
 389		}
 390		break;
 391
 392		case SYMBOL_STOP:
 393			{
 394			nLeft = nCenterX-n2;
 395			nRight = nCenterX+n2;
 396			nTop = nCenterY-n2;
 397			nBottom = nCenterY+n2;
 398			pDev->DrawRect( Rectangle( nLeft, nTop, nRight, nBottom ) );
 399			}
 400			break;
 401
 402		case SYMBOL_PAUSE:
 403			{
 404			nLeft = nCenterX-n2;
 405			nRight = nCenterX+n2-1;
 406			nTop = nCenterY-n2;
 407			nBottom = nCenterY+n2;
 408			pDev->DrawRect( Rectangle( nLeft, nTop, nCenterX-2, nBottom ) );
 409			pDev->DrawRect( Rectangle( nCenterX+1, nTop, nRight, nBottom ) );
 410			}
 411			break;
 412
 413		case SYMBOL_WINDSTART:
 414		case SYMBOL_WINDBACKWARD:
 415			{
 416			nLeft = nCenterX-n2+1;
 417			nRight = nCenterX;
 418			pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
 419			pDev->DrawRect( Rectangle( nLeft+n2, nCenterY, nRight+n2, nCenterY ) );
 420			i = 1;
 421			while ( i < n2 )
 422			{
 423				nLeft++;
 424				nTemp = nCenterY-i;
 425				pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
 426				pDev->DrawRect( Rectangle( nLeft+n2, nTemp, nRight+n2, nTemp ) );
 427				nTemp = nCenterY+i;
 428				pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
 429				pDev->DrawRect( Rectangle( nLeft+n2, nTemp, nRight+n2, nTemp ) );
 430				i++;
 431			}
 432			if ( eType == SYMBOL_WINDSTART )
 433			{
 434				pDev->DrawRect( Rectangle( nCenterX-n2, nCenterY-n2,
 435										   nCenterX-n2, nCenterY+n2 ) );
 436			}
 437			}
 438			break;
 439
 440		case SYMBOL_WINDEND:
 441		case SYMBOL_WINDFORWARD:
 442			{
 443			nLeft = nCenterX-n2;
 444			nRight = nCenterX-1;
 445			pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
 446			pDev->DrawRect( Rectangle( nLeft+n2, nCenterY, nRight+n2, nCenterY ) );
 447			i = 1;
 448			while ( i < n2 )
 449			{
 450				nRight--;
 451				nTemp = nCenterY-i;
 452				pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
 453				pDev->DrawRect( Rectangle( nLeft+n2, nTemp, nRight+n2, nTemp ) );
 454				nTemp = nCenterY+i;
 455				pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
 456				pDev->DrawRect( Rectangle( nLeft+n2, nTemp, nRight+n2, nTemp ) );
 457				i++;
 458			}
 459			if ( eType == SYMBOL_WINDEND )
 460			{
 461				pDev->DrawRect( Rectangle( nCenterX+n2, nCenterY-n2,
 462										   nCenterX+n2, nCenterY+n2 ) );
 463			}
 464			}
 465			break;
 466
 467		case SYMBOL_CLOSE:
 468			{
 469			Size aRectSize( 2, 1 );
 470			if ( nMin < 8 )
 471				aRectSize.Width() = 1;
 472			else if ( nMin > 20 )
 473				aRectSize.Width() = nMin/10;
 474			nLeft	= nCenterX-n2+1;
 475			nTop	= nCenterY-n2+1;
 476			nBottom = nCenterY-n2+nMin-aRectSize.Width()+1;
 477			i = 0;
 478			while ( i < nMin-aRectSize.Width()+1 )
 479			{
 480				pDev->DrawRect( Rectangle( Point( nLeft+i, nTop+i ), aRectSize ) );
 481				pDev->DrawRect( Rectangle( Point( nLeft+i, nBottom-i ), aRectSize ) );
 482				i++;
 483			}
 484			}
 485			break;
 486
 487		case SYMBOL_ROLLUP:
 488		case SYMBOL_ROLLDOWN:
 489			{
 490			Rectangle aRect( nCenterX-n2, nCenterY-n2,
 491							 nCenterX+n2, nCenterY-n2+1 );
 492			pDev->DrawRect( aRect );
 493			if ( eType == SYMBOL_ROLLDOWN )
 494			{
 495				Rectangle aTempRect = aRect;
 496				aTempRect.Bottom() = nCenterY+n2;
 497				aTempRect.Right() = aRect.Left();
 498				pDev->DrawRect( aTempRect );
 499				aTempRect.Left() = aRect.Right();
 500				aTempRect.Right() = aRect.Right();
 501				pDev->DrawRect( aTempRect );
 502				aTempRect.Top() = aTempRect.Bottom();
 503				aTempRect.Left() = aRect.Left();
 504				pDev->DrawRect( aTempRect );
 505			}
 506			}
 507			break;
 508		case SYMBOL_CHECKMARK:
 509			{
 510                // #106953# never mirror checkmarks
 511                BOOL bRTL = pDev->ImplHasMirroredGraphics() && pDev->IsRTLEnabled();
 512                Point aPos1( bRTL ? rRect.Right() : rRect.Left(),
 513                    rRect.Bottom() - rRect.GetHeight() / 3 );
 514                Point aPos2( bRTL ? rRect.Right() - rRect.GetWidth()/3 : rRect.Left() + rRect.GetWidth()/3,
 515                    rRect.Bottom() );
 516                Point aPos3( bRTL ? rRect.TopLeft() : rRect.TopRight() );
 517				Size aRectSize( 1, 2 );
 518				long nStepsY = aPos2.Y()-aPos1.Y();
 519				long nX = aPos1.X();
 520				long nY = aPos1.Y();
 521				long n;
 522				for ( n = 0; n <= nStepsY; n++ )
 523				{
 524                    if( bRTL )
 525                        nX--;
 526					pDev->DrawRect( Rectangle( Point( nX, nY++ ), aRectSize ) );
 527                    if( !bRTL )
 528					    nX++;
 529				}
 530				nStepsY = aPos2.Y()-aPos3.Y();
 531				nX = aPos2.X();
 532				nY = aPos2.Y();
 533				for ( n = 0; n <= nStepsY; n++ )
 534				{
 535                    if( bRTL )
 536					    if ( --nX < rRect.Left() )
 537						    break;
 538					pDev->DrawRect( Rectangle( Point( nX, nY-- ), aRectSize ) );
 539                    if( !bRTL )
 540					    if ( ++nX > rRect.Right() )
 541						    break;
 542				}
 543			}
 544			break;
 545
 546		case SYMBOL_SPIN_UPDOWN:
 547			{
 548			nTop = nCenterY-n2-1;
 549			nBottom = nTop+n2;
 550			pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
 551			i = 1;
 552			while ( i <= n2 )
 553			{
 554				nTop++;
 555				nTemp = nCenterX-i;
 556				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 557				nTemp = nCenterX+i;
 558				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 559				i++;
 560			}
 561			nTop = nCenterY+1;
 562			nBottom = nTop+n2;
 563			pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
 564			i = 1;
 565			while ( i <= n2 )
 566			{
 567				nBottom--;
 568				nTemp = nCenterX-i;
 569				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 570				nTemp = nCenterX+i;
 571				pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
 572				i++;
 573			}
 574			}
 575			break;
 576
 577
 578		case SYMBOL_FLOAT:
 579			{
 580			Rectangle aRect( nCenterX-n2, nCenterY-n2+3,
 581							 nCenterX+n2-2, nCenterY-n2+4 );
 582			pDev->DrawRect( aRect );
 583			Rectangle aTempRect = aRect;
 584			aTempRect.Bottom() = nCenterY+n2;
 585			aTempRect.Right() = aRect.Left();
 586			pDev->DrawRect( aTempRect );
 587			aTempRect.Left() = aRect.Right();
 588			aTempRect.Right() = aRect.Right();
 589			pDev->DrawRect( aTempRect );
 590			aTempRect.Top() = aTempRect.Bottom();
 591			aTempRect.Left() = aRect.Left();
 592			pDev->DrawRect( aTempRect );
 593			aRect = Rectangle( nCenterX-n2+2, nCenterY-n2,
 594							 nCenterX+n2, nCenterY-n2+1 );
 595			pDev->DrawRect( aRect );
 596			aTempRect = aRect;
 597			aTempRect.Bottom() = nCenterY+n2-3;
 598			aTempRect.Right() = aRect.Left();
 599			pDev->DrawRect( aTempRect );
 600			aTempRect.Left() = aRect.Right();
 601			aTempRect.Right() = aRect.Right();
 602			pDev->DrawRect( aTempRect );
 603			aTempRect.Top() = aTempRect.Bottom();
 604			aTempRect.Left() = aRect.Left();
 605			pDev->DrawRect( aTempRect );
 606			}
 607			break;
 608		case SYMBOL_DOCK:
 609			{
 610			Rectangle aRect( nCenterX-n2, nCenterY-n2,
 611							 nCenterX+n2, nCenterY-n2 );
 612			pDev->DrawRect( aRect );
 613			Rectangle aTempRect = aRect;
 614			aTempRect.Bottom() = nCenterY+n2;
 615			aTempRect.Right() = aRect.Left();
 616			pDev->DrawRect( aTempRect );
 617			aTempRect.Left() = aRect.Right();
 618			aTempRect.Right() = aRect.Right();
 619			pDev->DrawRect( aTempRect );
 620			aTempRect.Top() = aTempRect.Bottom();
 621			aTempRect.Left() = aRect.Left();
 622			pDev->DrawRect( aTempRect );
 623			}
 624			break;
 625		case SYMBOL_HIDE:
 626			{
 627			long nExtra = nMin / 8;
 628			Rectangle aRect( nCenterX-n2+nExtra, nCenterY+n2-1,
 629							 nCenterX+n2-nExtra, nCenterY+n2 );
 630			pDev->DrawRect( aRect );
 631			}
 632			break;
 633
 634		case SYMBOL_OS2CLOSE:
 635			{
 636			Rectangle aRect( nCenterX-n2, nCenterY-n2,
 637							 nCenterX+n2, nCenterY+n2 );
 638			ImplDrawOS2Symbol( pDev, aRect, 0, TRUE );
 639			}
 640			break;
 641
 642		case SYMBOL_OS2FLOAT:
 643			{
 644			Rectangle aRect( nCenterX-n2+4, nCenterY-n2+4,
 645							 nCenterX+n2-4, nCenterY+n2-3 );
 646			ImplDrawOS2Symbol( pDev, aRect, 0, FALSE );
 647			DecorationView aDecoView( pDev );
 648			Rectangle aRect2( nCenterX-n2, nCenterY-n2,
 649							  nCenterX-n2+2, nCenterY+n2 );
 650			aDecoView.DrawFrame( aRect2,
 651								 pDev->GetSettings().GetStyleSettings().GetLightColor(),
 652								 pDev->GetSettings().GetStyleSettings().GetShadowColor() );
 653			Rectangle aRect3( nCenterX+n2-2, nCenterY-n2,
 654							  nCenterX+n2, nCenterY+n2 );
 655			aDecoView.DrawFrame( aRect3,
 656								 pDev->GetSettings().GetStyleSettings().GetLightColor(),
 657								 pDev->GetSettings().GetStyleSettings().GetShadowColor() );
 658			}
 659			break;
 660
 661		case SYMBOL_OS2HIDE:
 662			{
 663			Rectangle aRect( nCenterX-n2+3, nCenterY-n2+3,
 664							 nCenterX+n2-3, nCenterY+n2-3 );
 665			ImplDrawOS2Symbol( pDev, aRect, 0, FALSE );
 666			}
 667			break;
 668	}
 669}
 670
 671// -----------------------------------------------------------------------
 672
 673void DecorationView::DrawSymbol( const Rectangle& rRect, SymbolType eType,
 674								 const Color& rColor, USHORT nStyle )
 675{
 676	const StyleSettings&	rStyleSettings	= mpOutDev->GetSettings().GetStyleSettings();
 677	Rectangle				aRect			= mpOutDev->LogicToPixel( rRect );
 678	Color					aOldLineColor	= mpOutDev->GetLineColor();
 679	Color					aOldFillColor	= mpOutDev->GetFillColor();
 680	BOOL					bOldMapMode 	= mpOutDev->IsMapModeEnabled();
 681	mpOutDev->SetLineColor();
 682	mpOutDev->SetFillColor( rColor );
 683	mpOutDev->EnableMapMode( FALSE );
 684
 685	if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ||
 686		 (mpOutDev->GetOutDevType() == OUTDEV_PRINTER) )
 687		nStyle |= BUTTON_DRAW_MONO;
 688
 689	if ( nStyle & SYMBOL_DRAW_MONO )
 690	{
 691		if ( nStyle & SYMBOL_DRAW_DISABLE )
 692			mpOutDev->SetFillColor( Color( COL_GRAY ) );
 693		else
 694			mpOutDev->SetFillColor( Color( COL_BLACK ) );
 695	}
 696	else
 697	{
 698		if ( nStyle & SYMBOL_DRAW_DISABLE )
 699		{
 700			// Als Embosed ausgeben
 701			mpOutDev->SetFillColor( rStyleSettings.GetLightColor() );
 702			Rectangle aTempRect = aRect;
 703			aTempRect.Move( 1, 1 );
 704			ImplDrawSymbol( mpOutDev, aTempRect, eType );
 705			mpOutDev->SetFillColor( rStyleSettings.GetShadowColor() );
 706		}
 707		else
 708			mpOutDev->SetFillColor( rColor );
 709	}
 710
 711	ImplDrawSymbol( mpOutDev, aRect, eType );
 712
 713	mpOutDev->SetLineColor( aOldLineColor );
 714	mpOutDev->SetFillColor( aOldFillColor );
 715	mpOutDev->EnableMapMode( bOldMapMode );
 716}
 717
 718// =======================================================================
 719
 720void DecorationView::DrawFrame( const Rectangle& rRect,
 721								const Color& rLeftTopColor,
 722								const Color& rRightBottomColor )
 723{
 724	Rectangle	aRect			= mpOutDev->LogicToPixel( rRect );
 725	Color		aOldLineColor	= mpOutDev->GetLineColor();
 726	Color		aOldFillColor	= mpOutDev->GetFillColor();
 727	BOOL		bOldMapMode 	= mpOutDev->IsMapModeEnabled();
 728	mpOutDev->EnableMapMode( FALSE );
 729	mpOutDev->SetLineColor();
 730	mpOutDev->ImplDraw2ColorFrame( aRect, rLeftTopColor, rRightBottomColor );
 731	mpOutDev->SetLineColor( aOldLineColor );
 732	mpOutDev->SetFillColor( aOldFillColor );
 733	mpOutDev->EnableMapMode( bOldMapMode );
 734}
 735
 736// =======================================================================
 737
 738void DecorationView::DrawHighlightFrame( const Rectangle& rRect,
 739										 USHORT nStyle )
 740{
 741	const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
 742	Color aLightColor = rStyleSettings.GetLightColor();
 743	Color aShadowColor = rStyleSettings.GetShadowColor();
 744
 745	if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ||
 746		 (mpOutDev->GetOutDevType() == OUTDEV_PRINTER) )
 747	{
 748		aLightColor = Color( COL_BLACK );
 749		aShadowColor = Color( COL_BLACK );
 750	}
 751	else if ( nStyle & FRAME_HIGHLIGHT_TESTBACKGROUND )
 752	{
 753		Wallpaper aBackground = mpOutDev->GetBackground();
 754		if ( aBackground.IsBitmap() || aBackground.IsGradient() )
 755		{
 756			aLightColor = rStyleSettings.GetFaceColor();
 757			aShadowColor = Color( COL_BLACK );
 758		}
 759		else
 760		{
 761			Color aBackColor = aBackground.GetColor();
 762			if ( (aLightColor.GetColorError( aBackColor ) < 32) ||
 763				 (aShadowColor.GetColorError( aBackColor ) < 32) )
 764			{
 765				aLightColor = Color( COL_WHITE );
 766				aShadowColor = Color( COL_BLACK );
 767
 768				if ( aLightColor.GetColorError( aBackColor ) < 32 )
 769					aLightColor.DecreaseLuminance( 64 );
 770				if ( aShadowColor.GetColorError( aBackColor ) < 32 )
 771					aShadowColor.IncreaseLuminance( 64 );
 772			}
 773		}
 774	}
 775
 776	if ( (nStyle & FRAME_HIGHLIGHT_STYLE) == FRAME_HIGHLIGHT_IN )
 777	{
 778		Color aTempColor = aLightColor;
 779		aLightColor = aShadowColor;
 780		aShadowColor = aTempColor;
 781	}
 782
 783	DrawFrame( rRect, aLightColor, aShadowColor );
 784}
 785
 786// =======================================================================
 787
 788static void ImplDrawDPILineRect( OutputDevice* pDev, Rectangle& rRect,
 789								 const Color* pColor, BOOL bRound = FALSE )
 790{
 791	long nLineWidth = pDev->ImplGetDPIX()/300;
 792	long nLineHeight = pDev->ImplGetDPIY()/300;
 793	if ( !nLineWidth )
 794		nLineWidth = 1;
 795	if ( !nLineHeight )
 796		nLineHeight = 1;
 797
 798	if ( pColor )
 799	{
 800		if ( (nLineWidth == 1) && (nLineHeight == 1) )
 801		{
 802			pDev->SetLineColor( *pColor );
 803			pDev->SetFillColor();
 804            if( bRound )
 805            {
 806			    pDev->DrawLine( Point( rRect.Left()+1, rRect.Top()), Point( rRect.Right()-1, rRect.Top()) );
 807			    pDev->DrawLine( Point( rRect.Left()+1, rRect.Bottom()), Point( rRect.Right()-1, rRect.Bottom()) );
 808			    pDev->DrawLine( Point( rRect.Left(), rRect.Top()+1), Point( rRect.Left(), rRect.Bottom()-1) );
 809			    pDev->DrawLine( Point( rRect.Right(), rRect.Top()+1), Point( rRect.Right(), rRect.Bottom()-1) );
 810            }
 811            else
 812			    pDev->DrawRect( rRect );
 813		}
 814		else
 815		{
 816			long nWidth = rRect.GetWidth();
 817			long nHeight = rRect.GetHeight();
 818			pDev->SetLineColor();
 819			pDev->SetFillColor( *pColor );
 820			pDev->DrawRect( Rectangle( rRect.TopLeft(), Size( nWidth, nLineHeight ) ) );
 821			pDev->DrawRect( Rectangle( rRect.TopLeft(), Size( nLineWidth, nHeight ) ) );
 822			pDev->DrawRect( Rectangle( Point( rRect.Left(), rRect.Bottom()-nLineHeight ),
 823									   Size( nWidth, nLineHeight ) ) );
 824			pDev->DrawRect( Rectangle( Point( rRect.Right()-nLineWidth, rRect.Top() ),
 825									   Size( nLineWidth, nHeight ) ) );
 826		}
 827	}
 828
 829	rRect.Left()	+= nLineWidth;
 830	rRect.Top() 	+= nLineHeight;
 831	rRect.Right()	-= nLineWidth;
 832	rRect.Bottom()	-= nLineHeight;
 833}
 834
 835// =======================================================================
 836
 837static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
 838						   const StyleSettings& rStyleSettings, USHORT nStyle )
 839{
 840    // mask menu style
 841    BOOL bMenuStyle = (nStyle & FRAME_DRAW_MENU) ? TRUE : FALSE;
 842    nStyle &= ~FRAME_DRAW_MENU;
 843
 844    Window *pWin = NULL;
 845    if( pDev->GetOutDevType() == OUTDEV_WINDOW )
 846        pWin = (Window*) pDev;
 847
 848    // UseFlatBorders disables 3D style for all frames except menus
 849    // menus may use different border colors (eg on XP)
 850    // normal frames will be drawn using the shadow color 
 851    // whereas window frame borders will use black
 852    BOOL bFlatBorders = ( !bMenuStyle && rStyleSettings.GetUseFlatBorders() );
 853
 854    // no flat borders for standard VCL controls (ie formcontrols that keep their classic look)
 855    // will not affect frame windows (like dropdowns)
 856    if( bFlatBorders && pWin && pWin->GetType() == WINDOW_BORDERWINDOW && (pWin != pWin->ImplGetFrameWindow()) )
 857    {
 858        // check for formcontrol, i.e., a control without NWF enabled
 859        Control *pControl = dynamic_cast< Control* >( pWin->GetWindow( WINDOW_CLIENT ) );
 860        if( pControl && pControl->IsNativeWidgetEnabled() )
 861            bFlatBorders = TRUE;
 862        else
 863            bFlatBorders = FALSE;
 864    }
 865
 866    // no round corners for window frame borders
 867    BOOL bRound = (bFlatBorders && !(nStyle & FRAME_DRAW_WINDOWBORDER));
 868
 869	if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ||
 870		 (pDev->GetOutDevType() == OUTDEV_PRINTER) ||
 871         bFlatBorders )
 872		nStyle |= FRAME_DRAW_MONO;
 873
 874	if ( nStyle & FRAME_DRAW_NODRAW )
 875	{
 876        USHORT nValueStyle = bMenuStyle ? nStyle | FRAME_DRAW_MENU : nStyle;
 877        if( pWin->GetType() == WINDOW_BORDERWINDOW )
 878            nValueStyle |= FRAME_DRAW_BORDERWINDOWBORDER;
 879        ImplControlValue aControlValue( nValueStyle );
 880		Rectangle aBound, aContent;
 881		Rectangle aNatRgn( rRect );
 882		if(pWin && pWin->GetNativeControlRegion(CTRL_FRAME, PART_BORDER,
 883			aNatRgn, 0, aControlValue, rtl::OUString(), aBound, aContent) )
 884		{
 885			rRect = aContent;
 886		}
 887		else if ( nStyle & FRAME_DRAW_MONO )
 888			ImplDrawDPILineRect( pDev, rRect, NULL, bRound );
 889		else
 890		{
 891			USHORT nFrameStyle = nStyle & FRAME_DRAW_STYLE;
 892
 893			if ( nFrameStyle == FRAME_DRAW_GROUP )
 894			{
 895				rRect.Left()	+= 2;
 896				rRect.Top() 	+= 2;
 897				rRect.Right()	-= 2;
 898				rRect.Bottom()	-= 2;
 899			}
 900			else if ( (nFrameStyle == FRAME_DRAW_IN) ||
 901					  (nFrameStyle == FRAME_DRAW_OUT) )
 902			{
 903				rRect.Left()++;
 904				rRect.Top()++;
 905				rRect.Right()--;
 906				rRect.Bottom()--;
 907			}
 908			else // FRAME_DRAW_DOUBLEIN || FRAME_DRAW_DOUBLEOUT
 909			{
 910				rRect.Left()	+= 2;
 911				rRect.Top() 	+= 2;
 912				rRect.Right()	-= 2;
 913				rRect.Bottom()	-= 2;
 914			}
 915		}
 916	}
 917	else
 918	{
 919		if( pWin && pWin->IsNativeControlSupported(CTRL_FRAME, PART_BORDER) )
 920        {
 921            USHORT nValueStyle = bMenuStyle ? nStyle | FRAME_DRAW_MENU : nStyle;
 922            if( pWin->GetType() == WINDOW_BORDERWINDOW )
 923                nValueStyle |= FRAME_DRAW_BORDERWINDOWBORDER;
 924            ImplControlValue aControlValue( nValueStyle );
 925            Rectangle aBound, aContent;
 926            Rectangle aNatRgn( rRect );
 927            if(	pWin->GetNativeControlRegion(CTRL_FRAME, PART_BORDER,
 928				aNatRgn, 0, aControlValue, rtl::OUString(), aBound, aContent) ) 
 929            {
 930                if( pWin->DrawNativeControl( CTRL_FRAME, PART_BORDER, aContent, CTRL_STATE_ENABLED,
 931                             aControlValue, rtl::OUString()) )
 932                {
 933                    rRect = aContent;
 934                    return;
 935                }
 936            }
 937        }
 938
 939        if ( nStyle & FRAME_DRAW_MONO )
 940        {
 941            Color aColor = bRound ? rStyleSettings.GetShadowColor()
 942                                  : pDev->GetSettings().GetStyleSettings().GetMonoColor();
 943            // when the MonoColor wasn't set, check face color
 944            if (
 945                (bRound && aColor.IsDark()) ||
 946                (
 947                  (aColor == Color(COL_BLACK)) &&
 948                  (pDev->GetSettings().GetStyleSettings().GetFaceColor().IsDark())
 949                )
 950               )
 951            {
 952                aColor = Color( COL_WHITE );
 953            }
 954            ImplDrawDPILineRect( pDev, rRect, &aColor, bRound );
 955        }
 956		else
 957		{
 958			USHORT nFrameStyle = nStyle & FRAME_DRAW_STYLE;
 959			if ( nFrameStyle == FRAME_DRAW_GROUP )
 960			{
 961				pDev->SetFillColor();
 962				pDev->SetLineColor( rStyleSettings.GetLightColor() );
 963				rRect.Top()++;
 964				rRect.Left()++;
 965				pDev->DrawRect( rRect );
 966				rRect.Top()--;
 967				rRect.Left()--;
 968				pDev->SetLineColor( rStyleSettings.GetShadowColor() );
 969				rRect.Right()--;
 970				rRect.Bottom()--;
 971				pDev->DrawRect( rRect );
 972				rRect.Right()++;
 973				rRect.Bottom()++;
 974			}
 975			else
 976			{
 977				pDev->SetLineColor();
 978
 979				if ( (nFrameStyle == FRAME_DRAW_IN) ||
 980					 (nFrameStyle == FRAME_DRAW_OUT) )
 981				{
 982					if ( nFrameStyle == FRAME_DRAW_IN )
 983					{
 984						pDev->ImplDraw2ColorFrame( rRect,
 985												   rStyleSettings.GetShadowColor(),
 986												   rStyleSettings.GetLightColor() );
 987					}
 988					else
 989					{
 990						pDev->ImplDraw2ColorFrame( rRect,
 991												   rStyleSettings.GetLightColor(),
 992												   rStyleSettings.GetShadowColor() );
 993					}
 994
 995					rRect.Left()++;
 996					rRect.Top()++;
 997					rRect.Right()--;
 998					rRect.Bottom()--;
 999				}
1000				else // FRAME_DRAW_DOUBLEIN || FRAME_DRAW_DOUBLEOUT
1001				{
1002					if ( nFrameStyle == FRAME_DRAW_DOUBLEIN )
1003					{
1004                        if( bFlatBorders ) // no 3d effect
1005                            pDev->ImplDraw2ColorFrame( rRect,
1006												    rStyleSettings.GetShadowColor(),
1007												    rStyleSettings.GetShadowColor() );
1008                        else
1009						    pDev->ImplDraw2ColorFrame( rRect,
1010												    rStyleSettings.GetShadowColor(),
1011												    rStyleSettings.GetLightColor() );
1012					}
1013					else
1014					{
1015                        if( bMenuStyle )
1016						    pDev->ImplDraw2ColorFrame( rRect,
1017                                                   rStyleSettings.GetMenuBorderColor(),
1018												   rStyleSettings.GetDarkShadowColor() );
1019                        else
1020						    pDev->ImplDraw2ColorFrame( rRect,
1021                                                   bFlatBorders ? // no 3d effect
1022                                                   rStyleSettings.GetDarkShadowColor() :
1023												   rStyleSettings.GetLightBorderColor(),
1024												   rStyleSettings.GetDarkShadowColor() );
1025                                                   
1026					}
1027
1028					rRect.Left()++;
1029					rRect.Top()++;
1030					rRect.Right()--;
1031					rRect.Bottom()--;
1032
1033                    BOOL bDrawn = TRUE;
1034					if ( nFrameStyle == FRAME_DRAW_DOUBLEIN )
1035					{
1036                        if( bFlatBorders ) // no 3d effect
1037						    pDev->ImplDraw2ColorFrame( rRect,
1038												    rStyleSettings.GetFaceColor(),
1039												    rStyleSettings.GetFaceColor() );
1040                        else
1041						    pDev->ImplDraw2ColorFrame( rRect,
1042												    rStyleSettings.GetDarkShadowColor(),
1043												    rStyleSettings.GetLightBorderColor() );
1044					}
1045					else
1046					{
1047                        // flat menues have no shadow border
1048                        if( !bMenuStyle || !rStyleSettings.GetUseFlatMenues() )
1049						    pDev->ImplDraw2ColorFrame( rRect,
1050												    rStyleSettings.GetLightColor(),
1051												    rStyleSettings.GetShadowColor() );
1052                        else
1053                            bDrawn = FALSE;
1054					}
1055                    if( bDrawn )
1056                    {
1057					    rRect.Left()++;
1058					    rRect.Top()++;
1059					    rRect.Right()--;
1060					    rRect.Bottom()--;
1061                    }
1062				}
1063			}
1064		}
1065	}
1066}
1067
1068// -----------------------------------------------------------------------
1069
1070Rectangle DecorationView::DrawFrame( const Rectangle& rRect, USHORT nStyle )
1071{
1072	Rectangle	aRect = rRect;
1073	BOOL		bOldMap = mpOutDev->IsMapModeEnabled();
1074	if ( bOldMap )
1075	{
1076		aRect = mpOutDev->LogicToPixel( aRect );
1077		mpOutDev->EnableMapMode( FALSE );
1078	}
1079
1080	if ( !rRect.IsEmpty() )
1081	{
1082		if ( nStyle & FRAME_DRAW_NODRAW )
1083			 ImplDrawFrame( mpOutDev, aRect, mpOutDev->GetSettings().GetStyleSettings(), nStyle );
1084		else
1085		{
1086			 Color maOldLineColor  = mpOutDev->GetLineColor();
1087			 Color maOldFillColor  = mpOutDev->GetFillColor();
1088			 ImplDrawFrame( mpOutDev, aRect, mpOutDev->GetSettings().GetStyleSettings(), nStyle );
1089			 mpOutDev->SetLineColor( maOldLineColor );
1090			 mpOutDev->SetFillColor( maOldFillColor );
1091		}
1092	}
1093
1094	if ( bOldMap )
1095	{
1096		mpOutDev->EnableMapMode( bOldMap );
1097		aRect = mpOutDev->PixelToLogic( aRect );
1098	}
1099
1100	return aRect;
1101}
1102
1103// =======================================================================
1104
1105static void ImplDrawButton( OutputDevice* pDev, Rectangle& rRect,
1106							const StyleSettings& rStyleSettings, USHORT nStyle )
1107{
1108	Rectangle aFillRect = rRect;
1109
1110	if ( nStyle & BUTTON_DRAW_MONO )
1111	{
1112		if ( !(nStyle & BUTTON_DRAW_NODRAW) )
1113		{
1114			Color aBlackColor( COL_BLACK );
1115
1116			if ( nStyle & BUTTON_DRAW_DEFAULT )
1117				ImplDrawDPILineRect( pDev, aFillRect, &aBlackColor );
1118
1119			ImplDrawDPILineRect( pDev, aFillRect, &aBlackColor );
1120
1121			Size aBrdSize( 1, 1 );
1122			if ( pDev->GetOutDevType() == OUTDEV_PRINTER )
1123			{
1124				MapMode aResMapMode( MAP_100TH_MM );
1125				aBrdSize = pDev->LogicToPixel( Size( 20, 20 ), aResMapMode );
1126				if ( !aBrdSize.Width() )
1127					aBrdSize.Width() = 1;
1128				if ( !aBrdSize.Height() )
1129					aBrdSize.Height() = 1;
1130			}
1131			pDev->SetLineColor();
1132			pDev->SetFillColor( aBlackColor );
1133			Rectangle aRect1;
1134			Rectangle aRect2;
1135			aRect1.Left()	= aFillRect.Left();
1136			aRect1.Right()	= aFillRect.Right(),
1137			aRect2.Top()	= aFillRect.Top();
1138			aRect2.Bottom() = aFillRect.Bottom();
1139			if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
1140			{
1141				aRect1.Top()	= aFillRect.Top();
1142				aRect1.Bottom() = aBrdSize.Height()-1;
1143				aRect2.Left()	= aFillRect.Left();
1144				aRect2.Right()	= aFillRect.Left()+aBrdSize.Width()-1;
1145				aFillRect.Left() += aBrdSize.Width();
1146				aFillRect.Top()  += aBrdSize.Height();
1147			}
1148			else
1149			{
1150				aRect1.Top()	= aFillRect.Bottom()-aBrdSize.Height()+1;
1151				aRect1.Bottom() = aFillRect.Bottom();
1152				aRect2.Left()	= aFillRect.Right()-aBrdSize.Width()+1;
1153				aRect2.Right()	= aFillRect.Right(),
1154				aFillRect.Right()  -= aBrdSize.Width();
1155				aFillRect.Bottom() -= aBrdSize.Height();
1156			}
1157			pDev->DrawRect( aRect1 );
1158			pDev->DrawRect( aRect2 );
1159		}
1160	}
1161	else
1162	{
1163		if ( !(nStyle & BUTTON_DRAW_NODRAW) )
1164		{
1165			if ( nStyle & BUTTON_DRAW_DEFAULT )
1166			{
1167				Color aDefBtnColor = rStyleSettings.GetDarkShadowColor();
1168				ImplDrawDPILineRect( pDev, aFillRect, &aDefBtnColor );
1169			}
1170		}
1171
1172		if ( !(nStyle & BUTTON_DRAW_NODRAW) )
1173		{
1174			pDev->SetLineColor();
1175			if ( nStyle & BUTTON_DRAW_NOLEFTLIGHTBORDER )
1176			{
1177				pDev->SetFillColor( rStyleSettings.GetLightBorderColor() );
1178				pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Top(),
1179										   aFillRect.Left(), aFillRect.Bottom() ) );
1180				aFillRect.Left()++;
1181			}
1182			if ( (nStyle & BUTTON_DRAW_NOTOPLIGHTBORDER) &&
1183				 !(nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED)) )
1184			{
1185				pDev->SetFillColor( rStyleSettings.GetLightBorderColor() );
1186				pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Top(),
1187										   aFillRect.Right(), aFillRect.Top() ) );
1188				aFillRect.Top()++;
1189			}
1190			if ( (( (nStyle & BUTTON_DRAW_NOBOTTOMSHADOWBORDER) | BUTTON_DRAW_FLAT) == (BUTTON_DRAW_NOBOTTOMSHADOWBORDER | BUTTON_DRAW_FLAT)) &&
1191				 !(nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED | BUTTON_DRAW_HIGHLIGHT)) )
1192			{
1193				pDev->SetFillColor( rStyleSettings.GetDarkShadowColor() );
1194				pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Bottom(),
1195										   aFillRect.Right(), aFillRect.Bottom() ) );
1196				aFillRect.Bottom()--;
1197			}
1198
1199			Color aColor1;
1200			Color aColor2;
1201			if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
1202			{
1203				aColor1 = rStyleSettings.GetDarkShadowColor();
1204				aColor2 = rStyleSettings.GetLightColor();
1205			}
1206			else
1207			{
1208				if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
1209					aColor1 = rStyleSettings.GetLightBorderColor();
1210				else
1211					aColor1 = rStyleSettings.GetLightColor();
1212				if ( (nStyle & BUTTON_DRAW_FLATTEST) == BUTTON_DRAW_FLAT )
1213					aColor2 = rStyleSettings.GetShadowColor();
1214				else
1215					aColor2 = rStyleSettings.GetDarkShadowColor();
1216			}
1217			pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
1218			aFillRect.Left()++;
1219			aFillRect.Top()++;
1220			aFillRect.Right()--;
1221			aFillRect.Bottom()--;
1222
1223			if ( !((nStyle & BUTTON_DRAW_FLATTEST) == BUTTON_DRAW_FLAT) )
1224			{
1225				if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
1226				{
1227					aColor1 = rStyleSettings.GetShadowColor();
1228					aColor2 = rStyleSettings.GetLightBorderColor();
1229				}
1230				else
1231				{
1232					if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
1233						aColor1 = rStyleSettings.GetLightColor();
1234					else
1235						aColor1 = rStyleSettings.GetLightBorderColor();
1236					aColor2 = rStyleSettings.GetShadowColor();
1237				}
1238				pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
1239				aFillRect.Left()++;
1240				aFillRect.Top()++;
1241				aFillRect.Right()--;
1242				aFillRect.Bottom()--;
1243			}
1244		}
1245	}
1246
1247	if ( !(nStyle & (BUTTON_DRAW_NOFILL | BUTTON_DRAW_NODRAW)) )
1248	{
1249		pDev->SetLineColor();
1250		if ( nStyle & BUTTON_DRAW_MONO )
1251		{
1252			// Hack: Auf Druckern wollen wir im MonoChrom-Modus trotzdem
1253			// erstmal graue Buttons haben
1254			if ( pDev->GetOutDevType() == OUTDEV_PRINTER )
1255				pDev->SetFillColor( Color( COL_LIGHTGRAY ) );
1256			else
1257				pDev->SetFillColor( Color( COL_WHITE ) );
1258		}
1259		else
1260		{
1261			if ( nStyle & (BUTTON_DRAW_CHECKED | BUTTON_DRAW_DONTKNOW) )
1262				pDev->SetFillColor( rStyleSettings.GetCheckedColor() );
1263			else
1264				pDev->SetFillColor( rStyleSettings.GetFaceColor() );
1265		}
1266		pDev->DrawRect( aFillRect );
1267	}
1268
1269	// Ein Border freilassen, der jedoch bei Default-Darstellung
1270	// mitbenutzt wird
1271	rRect.Left()++;
1272	rRect.Top()++;
1273	rRect.Right()--;
1274	rRect.Bottom()--;
1275
1276	if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
1277	{
1278		rRect.Left()++;
1279		rRect.Top()++;
1280	}
1281	else if ( nStyle & BUTTON_DRAW_NOLEFTLIGHTBORDER )
1282		rRect.Left()++;
1283
1284	if ( nStyle & BUTTON_DRAW_PRESSED )
1285	{
1286		if ( (rRect.GetHeight() > 10) && (rRect.GetWidth() > 10) )
1287		{
1288			rRect.Left()	+= 4;
1289			rRect.Top() 	+= 4;
1290			rRect.Right()	-= 1;
1291			rRect.Bottom()	-= 1;
1292		}
1293		else
1294		{
1295			rRect.Left()	+= 3;
1296			rRect.Top() 	+= 3;
1297			rRect.Right()	-= 2;
1298			rRect.Bottom()	-= 2;
1299		}
1300	}
1301	else if ( nStyle & BUTTON_DRAW_CHECKED )
1302	{
1303		rRect.Left()	+= 3;
1304		rRect.Top() 	+= 3;
1305		rRect.Right()	-= 2;
1306		rRect.Bottom()	-= 2;
1307	}
1308	else
1309	{
1310		rRect.Left()	+= 2;
1311		rRect.Top() 	+= 2;
1312		rRect.Right()	-= 3;
1313		rRect.Bottom()	-= 3;
1314	}
1315}
1316
1317// -----------------------------------------------------------------------
1318
1319Rectangle DecorationView::DrawButton( const Rectangle& rRect, USHORT nStyle )
1320{
1321	Rectangle	aRect = rRect;
1322	BOOL		bOldMap = mpOutDev->IsMapModeEnabled();
1323	if ( bOldMap )
1324	{
1325		aRect = mpOutDev->LogicToPixel( aRect );
1326		mpOutDev->EnableMapMode( FALSE );
1327	}
1328
1329	if ( !rRect.IsEmpty() )
1330	{
1331		const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
1332
1333		if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
1334			nStyle |= BUTTON_DRAW_MONO;
1335
1336		if ( nStyle & BUTTON_DRAW_NODRAW )
1337			 ImplDrawButton( mpOutDev, aRect, rStyleSettings, nStyle );
1338		else
1339		{
1340			 Color maOldLineColor  = mpOutDev->GetLineColor();
1341			 Color maOldFillColor  = mpOutDev->GetFillColor();
1342			 ImplDrawButton( mpOutDev, aRect, rStyleSettings, nStyle );
1343			 mpOutDev->SetLineColor( maOldLineColor );
1344			 mpOutDev->SetFillColor( maOldFillColor );
1345		}
1346	}
1347
1348	if ( bOldMap )
1349	{
1350		mpOutDev->EnableMapMode( bOldMap );
1351		aRect = mpOutDev->PixelToLogic( aRect );
1352	}
1353
1354	return aRect;
1355}
1356
1357// -----------------------------------------------------------------------
1358
1359void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, bool bVertical )
1360{
1361    Point aStart( rStart ), aStop( rStop );
1362    const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
1363
1364    mpOutDev->Push( PUSH_LINECOLOR );
1365    if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
1366        mpOutDev->SetLineColor( Color( COL_BLACK ) );
1367    else
1368        mpOutDev->SetLineColor( rStyleSettings.GetShadowColor() );
1369    
1370    mpOutDev->DrawLine( aStart, aStop );
1371    if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
1372    {
1373        mpOutDev->SetLineColor( rStyleSettings.GetLightColor() );
1374        if( bVertical )
1375        {
1376            aStart.X()++;
1377            aStop.X()++;
1378        }
1379        else
1380        {
1381            aStart.Y()++;
1382            aStop.Y()++;
1383        }
1384        mpOutDev->DrawLine( aStart, aStop );
1385    }
1386    mpOutDev->Pop();
1387}
1388