Update ooo320-m1
[ooovba.git] / reportdesign / source / ui / report / EndMarker.cxx
blob639eee0e99b0cff4e89d614cba01353841f00862
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: EndMarker.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include "precompiled_reportdesign.hxx"
31 #include "EndMarker.hxx"
32 #include "ColorChanger.hxx"
33 #include "SectionWindow.hxx"
34 #include "helpids.hrc"
35 #include <vcl/svapp.hxx>
36 #include <vcl/gradient.hxx>
37 #include <vcl/lineinfo.hxx>
40 #define CORNER_SPACE 5
41 //=====================================================================
42 namespace rptui
44 //=====================================================================
45 DBG_NAME( rpt_OEndMarker )
46 OEndMarker::OEndMarker(Window* _pParent ,const ::rtl::OUString& _sColorEntry)
47 : OColorListener(_pParent,_sColorEntry)
49 DBG_CTOR( rpt_OEndMarker,NULL);
50 SetUniqueId(HID_RPT_ENDMARKER);
51 ImplInitSettings();
52 SetPaintTransparent(TRUE);
54 // -----------------------------------------------------------------------------
55 OEndMarker::~OEndMarker()
57 DBG_DTOR( rpt_OEndMarker,NULL);
59 // -----------------------------------------------------------------------------
60 void OEndMarker::Paint( const Rectangle& /*rRect*/ )
62 Fraction aCornerSpace(long(CORNER_SPACE));
63 aCornerSpace *= GetMapMode().GetScaleX();
64 const long nCornerSpace = aCornerSpace;
66 Size aSize = GetSizePixel();
67 aSize.Width() += nCornerSpace;
68 Rectangle aWholeRect(Point(-nCornerSpace,0),aSize);
69 PolyPolygon aPoly;
70 aPoly.Insert(Polygon(aWholeRect,nCornerSpace,nCornerSpace));
72 Color aStartColor(m_nColor);
73 aStartColor.IncreaseLuminance(10);
74 USHORT nHue = 0;
75 USHORT nSat = 0;
76 USHORT nBri = 0;
77 aStartColor.RGBtoHSB(nHue, nSat, nBri);
78 nSat += 40;
79 Color aEndColor(Color::HSBtoRGB(nHue, nSat, nBri));
80 Gradient aGradient(GRADIENT_LINEAR,aStartColor,aEndColor);
81 aGradient.SetSteps(static_cast<USHORT>(aSize.Height()));
83 DrawGradient(PixelToLogic(aPoly) ,aGradient);
84 if ( m_bMarked )
86 Rectangle aRect( Point(-nCornerSpace,nCornerSpace),
87 Size(aSize.Width()- nCornerSpace,aSize.Height() - nCornerSpace- nCornerSpace));
88 ColorChanger aColors( this, COL_WHITE, COL_WHITE );
89 DrawPolyLine(Polygon(PixelToLogic(aRect)),LineInfo(LINE_SOLID,2));
92 // -----------------------------------------------------------------------
93 void OEndMarker::ImplInitSettings()
95 SetBackground( Wallpaper( svtools::ColorConfig().GetColorValue(::svtools::APPBACKGROUND).nColor) );
96 SetFillColor( Application::GetSettings().GetStyleSettings().GetShadowColor() );
98 // -----------------------------------------------------------------------
99 void OEndMarker::MouseButtonDown( const MouseEvent& rMEvt )
101 if ( !rMEvt.IsLeft() && !rMEvt.IsRight())
102 return;
103 static_cast<OSectionWindow*>(GetParent())->showProperties();
105 // =======================================================================
107 // =======================================================================