2007-07-09 10:56:41 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|
*
|
2008-04-10 18:13:45 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:13:45 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:13:45 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:13:45 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
|
* only, as published by the Free Software Foundation.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:13:45 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:13:45 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
|
* for a copy of the LGPLv3 License.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
|
|
|
|
************************************************************************/
|
|
|
|
|
#include "precompiled_reportdesign.hxx"
|
|
|
|
|
#include "EndMarker.hxx"
|
|
|
|
|
#include "ColorChanger.hxx"
|
2008-08-19 09:16:39 +00:00
|
|
|
#include "SectionWindow.hxx"
|
2007-07-09 10:56:41 +00:00
|
|
|
#include "helpids.hrc"
|
|
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
|
#include <vcl/gradient.hxx>
|
|
|
|
|
#include <vcl/lineinfo.hxx>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define CORNER_SPACE 5
|
|
|
|
|
//=====================================================================
|
|
|
|
|
namespace rptui
|
|
|
|
|
{
|
|
|
|
|
//=====================================================================
|
|
|
|
|
DBG_NAME( rpt_OEndMarker )
|
|
|
|
|
OEndMarker::OEndMarker(Window* _pParent ,const ::rtl::OUString& _sColorEntry)
|
|
|
|
|
: OColorListener(_pParent,_sColorEntry)
|
|
|
|
|
{
|
|
|
|
|
DBG_CTOR( rpt_OEndMarker,NULL);
|
2008-01-29 12:50:43 +00:00
|
|
|
SetUniqueId(HID_RPT_ENDMARKER);
|
2007-07-09 10:56:41 +00:00
|
|
|
ImplInitSettings();
|
2008-08-19 09:16:39 +00:00
|
|
|
SetPaintTransparent(TRUE);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
OEndMarker::~OEndMarker()
|
|
|
|
|
{
|
|
|
|
|
DBG_DTOR( rpt_OEndMarker,NULL);
|
|
|
|
|
}
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
void OEndMarker::Paint( const Rectangle& /*rRect*/ )
|
|
|
|
|
{
|
2008-08-19 09:16:39 +00:00
|
|
|
Fraction aCornerSpace(long(CORNER_SPACE));
|
|
|
|
|
aCornerSpace *= GetMapMode().GetScaleX();
|
|
|
|
|
const long nCornerSpace = aCornerSpace;
|
|
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
Size aSize = GetSizePixel();
|
2008-08-19 09:16:39 +00:00
|
|
|
aSize.Width() += nCornerSpace;
|
|
|
|
|
Rectangle aWholeRect(Point(-nCornerSpace,0),aSize);
|
2007-07-09 10:56:41 +00:00
|
|
|
PolyPolygon aPoly;
|
2008-08-19 09:16:39 +00:00
|
|
|
aPoly.Insert(Polygon(aWholeRect,nCornerSpace,nCornerSpace));
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
|
Color aStartColor(m_nColor);
|
|
|
|
|
aStartColor.IncreaseLuminance(10);
|
|
|
|
|
USHORT nHue = 0;
|
|
|
|
|
USHORT nSat = 0;
|
|
|
|
|
USHORT nBri = 0;
|
|
|
|
|
aStartColor.RGBtoHSB(nHue, nSat, nBri);
|
|
|
|
|
nSat += 40;
|
|
|
|
|
Color aEndColor(Color::HSBtoRGB(nHue, nSat, nBri));
|
|
|
|
|
Gradient aGradient(GRADIENT_LINEAR,aStartColor,aEndColor);
|
|
|
|
|
aGradient.SetSteps(static_cast<USHORT>(aSize.Height()));
|
|
|
|
|
|
2008-08-19 09:16:39 +00:00
|
|
|
DrawGradient(PixelToLogic(aPoly) ,aGradient);
|
2007-07-09 10:56:41 +00:00
|
|
|
if ( m_bMarked )
|
|
|
|
|
{
|
2008-08-19 09:16:39 +00:00
|
|
|
Rectangle aRect( Point(-nCornerSpace,nCornerSpace),
|
|
|
|
|
Size(aSize.Width()- nCornerSpace,aSize.Height() - nCornerSpace- nCornerSpace));
|
2007-07-09 10:56:41 +00:00
|
|
|
ColorChanger aColors( this, COL_WHITE, COL_WHITE );
|
2008-08-19 09:16:39 +00:00
|
|
|
DrawPolyLine(Polygon(PixelToLogic(aRect)),LineInfo(LINE_SOLID,2));
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
void OEndMarker::ImplInitSettings()
|
|
|
|
|
{
|
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() );
|
|
|
|
|
}
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
// =======================================================================
|
|
|
|
|
}
|
|
|
|
|
// =======================================================================
|