lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / reportdesign / source / ui / report / EndMarker.cxx
blob0e763fce8c24b081ab4dcd566276e941b77291fd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
23 #include <vcl/settings.hxx>
24 #include <vcl/svapp.hxx>
25 #include <vcl/gradient.hxx>
26 #include <vcl/lineinfo.hxx>
29 #define CORNER_SPACE 5
31 namespace rptui
34 OEndMarker::OEndMarker(vcl::Window* _pParent ,const OUString& _sColorEntry)
35 : OColorListener(_pParent, _sColorEntry)
37 ImplInitSettings();
40 OEndMarker::~OEndMarker()
44 void OEndMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
46 Fraction aCornerSpace(long(CORNER_SPACE));
47 aCornerSpace *= rRenderContext.GetMapMode().GetScaleX();
48 const long nCornerSpace = long(aCornerSpace);
50 Size aSize = GetSizePixel();
51 aSize.AdjustWidth(nCornerSpace );
52 tools::Rectangle aWholeRect(Point(-nCornerSpace,0),aSize);
53 tools::PolyPolygon aPoly;
54 aPoly.Insert( tools::Polygon(aWholeRect,nCornerSpace,nCornerSpace));
56 Color aStartColor(m_nColor);
57 aStartColor.IncreaseLuminance(10);
58 sal_uInt16 nHue = 0;
59 sal_uInt16 nSat = 0;
60 sal_uInt16 nBri = 0;
61 aStartColor.RGBtoHSB(nHue, nSat, nBri);
62 nSat += 40;
63 Color aEndColor(Color::HSBtoRGB(nHue, nSat, nBri));
64 Gradient aGradient(GradientStyle::Linear, aStartColor, aEndColor);
65 aGradient.SetSteps(static_cast<sal_uInt16>(aSize.Height()));
67 rRenderContext.DrawGradient(PixelToLogic(aPoly), aGradient);
68 if (m_bMarked)
70 tools::Rectangle aRect(Point(-nCornerSpace, nCornerSpace),
71 Size(aSize.Width() - nCornerSpace,
72 aSize.Height() - nCornerSpace - nCornerSpace));
73 ColorChanger aColors(this, COL_WHITE, COL_WHITE);
74 rRenderContext.DrawPolyLine( tools::Polygon(PixelToLogic(aRect)), LineInfo(LineStyle::Solid, 2));
78 void OEndMarker::ImplInitSettings()
80 EnableChildTransparentMode();
81 SetParentClipMode( ParentClipMode::NoClip );
82 SetPaintTransparent( true );
84 SetBackground( Wallpaper( svtools::ColorConfig().GetColorValue(::svtools::APPBACKGROUND).nColor) );
85 SetFillColor( Application::GetSettings().GetStyleSettings().GetShadowColor() );
88 void OEndMarker::MouseButtonDown( const MouseEvent& rMEvt )
90 if ( !rMEvt.IsLeft() && !rMEvt.IsRight())
91 return;
92 static_cast<OSectionWindow*>(GetParent())->showProperties();
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */