1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #include "EndMarker.hxx"
20 #include "ColorChanger.hxx"
21 #include "SectionWindow.hxx"
22 #include "helpids.hrc"
23 #include <vcl/svapp.hxx>
24 #include <vcl/gradient.hxx>
25 #include <vcl/lineinfo.hxx>
28 #define CORNER_SPACE 5
29 //=====================================================================
32 //=====================================================================
33 DBG_NAME( rpt_OEndMarker
)
34 OEndMarker::OEndMarker(Window
* _pParent
,const OUString
& _sColorEntry
)
35 : OColorListener(_pParent
,_sColorEntry
)
37 DBG_CTOR( rpt_OEndMarker
,NULL
);
38 SetUniqueId(HID_RPT_ENDMARKER
);
41 // -----------------------------------------------------------------------------
42 OEndMarker::~OEndMarker()
44 DBG_DTOR( rpt_OEndMarker
,NULL
);
46 // -----------------------------------------------------------------------------
47 void OEndMarker::Paint( const Rectangle
& /*rRect*/ )
49 Fraction
aCornerSpace(long(CORNER_SPACE
));
50 aCornerSpace
*= GetMapMode().GetScaleX();
51 const long nCornerSpace
= aCornerSpace
;
53 Size aSize
= GetSizePixel();
54 aSize
.Width() += nCornerSpace
;
55 Rectangle
aWholeRect(Point(-nCornerSpace
,0),aSize
);
57 aPoly
.Insert(Polygon(aWholeRect
,nCornerSpace
,nCornerSpace
));
59 Color
aStartColor(m_nColor
);
60 aStartColor
.IncreaseLuminance(10);
64 aStartColor
.RGBtoHSB(nHue
, nSat
, nBri
);
66 Color
aEndColor(Color::HSBtoRGB(nHue
, nSat
, nBri
));
67 Gradient
aGradient(GradientStyle_LINEAR
,aStartColor
,aEndColor
);
68 aGradient
.SetSteps(static_cast<sal_uInt16
>(aSize
.Height()));
70 DrawGradient(PixelToLogic(aPoly
) ,aGradient
);
73 Rectangle
aRect( Point(-nCornerSpace
,nCornerSpace
),
74 Size(aSize
.Width()- nCornerSpace
,aSize
.Height() - nCornerSpace
- nCornerSpace
));
75 ColorChanger
aColors( this, COL_WHITE
, COL_WHITE
);
76 DrawPolyLine(Polygon(PixelToLogic(aRect
)),LineInfo(LINE_SOLID
,2));
79 // -----------------------------------------------------------------------
80 void OEndMarker::ImplInitSettings()
82 EnableChildTransparentMode( sal_True
);
83 SetParentClipMode( PARENTCLIPMODE_NOCLIP
);
84 SetPaintTransparent( sal_True
);
86 SetBackground( Wallpaper( svtools::ColorConfig().GetColorValue(::svtools::APPBACKGROUND
).nColor
) );
87 SetFillColor( Application::GetSettings().GetStyleSettings().GetShadowColor() );
89 // -----------------------------------------------------------------------
90 void OEndMarker::MouseButtonDown( const MouseEvent
& rMEvt
)
92 if ( !rMEvt
.IsLeft() && !rMEvt
.IsRight())
94 static_cast<OSectionWindow
*>(GetParent())->showProperties();
96 // =======================================================================
98 // =======================================================================
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */