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 #include "precompiled_reportdesign.hxx" 28 #include "EndMarker.hxx" 29 #include "ColorChanger.hxx" 30 #include "SectionWindow.hxx" 31 #include "helpids.hrc" 32 #include <vcl/svapp.hxx> 33 #include <vcl/gradient.hxx> 34 #include <vcl/lineinfo.hxx> 35 36 37 #define CORNER_SPACE 5 38 //===================================================================== 39 namespace rptui 40 { 41 //===================================================================== 42 DBG_NAME( rpt_OEndMarker ) 43 OEndMarker::OEndMarker(Window* _pParent ,const ::rtl::OUString& _sColorEntry) 44 : OColorListener(_pParent,_sColorEntry) 45 { 46 DBG_CTOR( rpt_OEndMarker,NULL); 47 SetUniqueId(HID_RPT_ENDMARKER); 48 ImplInitSettings(); 49 } 50 // ----------------------------------------------------------------------------- 51 OEndMarker::~OEndMarker() 52 { 53 DBG_DTOR( rpt_OEndMarker,NULL); 54 } 55 // ----------------------------------------------------------------------------- 56 void OEndMarker::Paint( const Rectangle& /*rRect*/ ) 57 { 58 Fraction aCornerSpace(long(CORNER_SPACE)); 59 aCornerSpace *= GetMapMode().GetScaleX(); 60 const long nCornerSpace = aCornerSpace; 61 62 Size aSize = GetSizePixel(); 63 aSize.Width() += nCornerSpace; 64 Rectangle aWholeRect(Point(-nCornerSpace,0),aSize); 65 PolyPolygon aPoly; 66 aPoly.Insert(Polygon(aWholeRect,nCornerSpace,nCornerSpace)); 67 68 Color aStartColor(m_nColor); 69 aStartColor.IncreaseLuminance(10); 70 sal_uInt16 nHue = 0; 71 sal_uInt16 nSat = 0; 72 sal_uInt16 nBri = 0; 73 aStartColor.RGBtoHSB(nHue, nSat, nBri); 74 nSat += 40; 75 Color aEndColor(Color::HSBtoRGB(nHue, nSat, nBri)); 76 Gradient aGradient(GRADIENT_LINEAR,aStartColor,aEndColor); 77 aGradient.SetSteps(static_cast<sal_uInt16>(aSize.Height())); 78 79 DrawGradient(PixelToLogic(aPoly) ,aGradient); 80 if ( m_bMarked ) 81 { 82 Rectangle aRect( Point(-nCornerSpace,nCornerSpace), 83 Size(aSize.Width()- nCornerSpace,aSize.Height() - nCornerSpace- nCornerSpace)); 84 ColorChanger aColors( this, COL_WHITE, COL_WHITE ); 85 DrawPolyLine(Polygon(PixelToLogic(aRect)),LineInfo(LINE_SOLID,2)); 86 } 87 } 88 // ----------------------------------------------------------------------- 89 void OEndMarker::ImplInitSettings() 90 { 91 EnableChildTransparentMode( sal_True ); 92 SetParentClipMode( PARENTCLIPMODE_NOCLIP ); 93 SetPaintTransparent( sal_True ); 94 95 SetBackground( Wallpaper( svtools::ColorConfig().GetColorValue(::svtools::APPBACKGROUND).nColor) ); 96 SetFillColor( Application::GetSettings().GetStyleSettings().GetShadowColor() ); 97 } 98 // ----------------------------------------------------------------------- 99 void OEndMarker::MouseButtonDown( const MouseEvent& rMEvt ) 100 { 101 if ( !rMEvt.IsLeft() && !rMEvt.IsRight()) 102 return; 103 static_cast<OSectionWindow*>(GetParent())->showProperties(); 104 } 105 // ======================================================================= 106 } 107 // ======================================================================= 108