2010-10-12 15:59:03 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-21 14:30:25 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2017-10-23 22:34:20 +02:00
|
|
|
#include <EndMarker.hxx>
|
|
|
|
#include <ColorChanger.hxx>
|
|
|
|
#include <SectionWindow.hxx>
|
2014-01-02 23:52:37 +01:00
|
|
|
|
|
|
|
#include <vcl/settings.hxx>
|
2007-07-09 10:56:41 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <vcl/gradient.hxx>
|
|
|
|
#include <vcl/lineinfo.hxx>
|
2018-12-26 01:11:42 +01:00
|
|
|
#include <vcl/event.hxx>
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define CORNER_SPACE 5
|
2014-02-25 19:49:46 +01:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
namespace rptui
|
|
|
|
{
|
2014-02-25 19:49:46 +01:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
OEndMarker::OEndMarker(vcl::Window* _pParent ,const OUString& _sColorEntry)
|
2016-05-25 13:42:16 +01:00
|
|
|
: OColorListener(_pParent, _sColorEntry)
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
ImplInitSettings();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
OEndMarker::~OEndMarker()
|
|
|
|
{
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-03-30 20:27:55 +02:00
|
|
|
void OEndMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2014-10-23 17:41:47 +02:00
|
|
|
Fraction aCornerSpace(long(CORNER_SPACE));
|
2015-05-18 11:42:51 +09:00
|
|
|
aCornerSpace *= rRenderContext.GetMapMode().GetScaleX();
|
2017-09-13 10:20:59 +02:00
|
|
|
const long nCornerSpace = long(aCornerSpace);
|
2008-08-19 09:16:39 +00:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
Size aSize = GetSizePixel();
|
2018-02-16 08:32:14 +02:00
|
|
|
aSize.AdjustWidth(nCornerSpace );
|
2017-03-30 20:27:55 +02:00
|
|
|
tools::Rectangle aWholeRect(Point(-nCornerSpace,0),aSize);
|
2014-09-28 07:51:19 +02:00
|
|
|
tools::PolyPolygon aPoly;
|
2015-08-16 16:45:12 -05:00
|
|
|
aPoly.Insert( tools::Polygon(aWholeRect,nCornerSpace,nCornerSpace));
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
Color aStartColor(m_nColor);
|
|
|
|
aStartColor.IncreaseLuminance(10);
|
2011-01-14 17:40:56 +01:00
|
|
|
sal_uInt16 nHue = 0;
|
|
|
|
sal_uInt16 nSat = 0;
|
|
|
|
sal_uInt16 nBri = 0;
|
2007-07-09 10:56:41 +00:00
|
|
|
aStartColor.RGBtoHSB(nHue, nSat, nBri);
|
|
|
|
nSat += 40;
|
|
|
|
Color aEndColor(Color::HSBtoRGB(nHue, nSat, nBri));
|
2016-09-02 10:53:14 +02:00
|
|
|
Gradient aGradient(GradientStyle::Linear, aStartColor, aEndColor);
|
2011-01-14 17:40:56 +01:00
|
|
|
aGradient.SetSteps(static_cast<sal_uInt16>(aSize.Height()));
|
2007-07-09 10:56:41 +00:00
|
|
|
|
2015-05-18 11:42:51 +09:00
|
|
|
rRenderContext.DrawGradient(PixelToLogic(aPoly), aGradient);
|
|
|
|
if (m_bMarked)
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2017-03-30 20:27:55 +02:00
|
|
|
tools::Rectangle aRect(Point(-nCornerSpace, nCornerSpace),
|
2015-05-18 11:42:51 +09:00
|
|
|
Size(aSize.Width() - nCornerSpace,
|
|
|
|
aSize.Height() - nCornerSpace - nCornerSpace));
|
|
|
|
ColorChanger aColors(this, COL_WHITE, COL_WHITE);
|
2016-09-02 08:36:23 +02:00
|
|
|
rRenderContext.DrawPolyLine( tools::Polygon(PixelToLogic(aRect)), LineInfo(LineStyle::Solid, 2));
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
void OEndMarker::ImplInitSettings()
|
|
|
|
{
|
2015-08-12 15:10:26 +02:00
|
|
|
EnableChildTransparentMode();
|
2015-05-27 16:09:43 +02:00
|
|
|
SetParentClipMode( ParentClipMode::NoClip );
|
2014-02-21 12:53:51 +01:00
|
|
|
SetPaintTransparent( true );
|
2011-02-01 13:42:47 +01:00
|
|
|
|
2008-08-19 09:16:39 +00:00
|
|
|
SetBackground( Wallpaper( svtools::ColorConfig().GetColorValue(::svtools::APPBACKGROUND).nColor) );
|
2007-07-09 10:56:41 +00:00
|
|
|
SetFillColor( Application::GetSettings().GetStyleSettings().GetShadowColor() );
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
void OEndMarker::MouseButtonDown( const MouseEvent& rMEvt )
|
|
|
|
{
|
|
|
|
if ( !rMEvt.IsLeft() && !rMEvt.IsRight())
|
|
|
|
return;
|
2008-08-19 09:16:39 +00:00
|
|
|
static_cast<OSectionWindow*>(GetParent())->showProperties();
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
2014-02-25 19:49:46 +01:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
2014-02-25 19:49:46 +01:00
|
|
|
|
2010-10-12 15:59:03 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|