2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 11:06:58 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 11:06:58 +00:00
|
|
|
* $RCSfile: outdev5.cxx,v $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2006-09-17 11:07:28 +00:00
|
|
|
* $Revision: 1.9 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2006-09-17 11:07:28 +00:00
|
|
|
* last change: $Author: obo $ $Date: 2006-09-17 12:07:28 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 11:06:58 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 11:06:58 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 11:06:58 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 11:06:58 +00:00
|
|
|
* This library 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 for more details.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 11:06:58 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 11:07:28 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_vcl.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <tools/ref.hxx>
|
|
|
|
#ifndef _SV_SVSYS_HXX
|
|
|
|
#include <svsys.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SV_SALGDI_HXX
|
|
|
|
#include <salgdi.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _DEBUG_HXX
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SV_SVDATA_HXX
|
|
|
|
#include <svdata.hxx>
|
|
|
|
#endif
|
2004-01-06 12:51:01 +00:00
|
|
|
#ifndef _TL_POLY_HXX
|
2003-03-27 16:59:30 +00:00
|
|
|
#include <tools/poly.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#endif
|
|
|
|
#ifndef _SV_METAACT_HXX
|
|
|
|
#include <metaact.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_GDIMTF_HXX
|
|
|
|
#include <gdimtf.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_OUTDATA_HXX
|
|
|
|
#include <outdata.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_OUTDEV_H
|
|
|
|
#include <outdev.h>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_OUTDEV_HXX
|
|
|
|
#include <outdev.hxx>
|
|
|
|
#endif
|
2003-11-24 16:33:31 +00:00
|
|
|
#ifndef _SV_VIRDEV_HXX
|
|
|
|
#include <virdev.hxx>
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
2006-06-19 18:28:50 +00:00
|
|
|
DBG_NAMEEX( OutputDevice )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
|
|
|
void OutputDevice::DrawRect( const Rectangle& rRect,
|
|
|
|
ULONG nHorzRound, ULONG nVertRound )
|
|
|
|
{
|
|
|
|
DBG_TRACE( "OutputDevice::DrawRoundRect()" );
|
|
|
|
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
|
|
|
|
|
|
|
|
if ( mpMetaFile )
|
|
|
|
mpMetaFile->AddAction( new MetaRoundRectAction( rRect, nHorzRound, nVertRound ) );
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
|
2000-09-18 16:07:07 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
const Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
|
|
|
|
|
|
|
|
if ( aRect.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
nHorzRound = ImplLogicWidthToDevicePixel( nHorzRound );
|
|
|
|
nVertRound = ImplLogicHeightToDevicePixel( nVertRound );
|
|
|
|
|
|
|
|
// we need a graphics
|
|
|
|
if ( !mpGraphics )
|
|
|
|
{
|
|
|
|
if ( !ImplGetGraphics() )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mbInitClipRegion )
|
|
|
|
ImplInitClipRegion();
|
|
|
|
if ( mbOutputClipped )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( mbInitLineColor )
|
|
|
|
ImplInitLineColor();
|
|
|
|
if ( mbInitFillColor )
|
|
|
|
ImplInitFillColor();
|
|
|
|
|
|
|
|
if ( !nHorzRound && !nVertRound )
|
2002-08-29 14:42:38 +00:00
|
|
|
mpGraphics->DrawRect( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), this );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
const Polygon aRoundRectPoly( aRect, nHorzRound, nVertRound );
|
|
|
|
|
|
|
|
if ( aRoundRectPoly.GetSize() >= 2 )
|
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
const SalPoint* pPtAry = (const SalPoint*) aRoundRectPoly.GetConstPointAry();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( !mbFillColor )
|
2002-08-29 14:42:38 +00:00
|
|
|
mpGraphics->DrawPolyLine( aRoundRectPoly.GetSize(), pPtAry, this );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2002-08-29 14:42:38 +00:00
|
|
|
mpGraphics->DrawPolygon( aRoundRectPoly.GetSize(), pPtAry, this );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-24 16:33:31 +00:00
|
|
|
|
|
|
|
if( mpAlphaVDev )
|
|
|
|
mpAlphaVDev->DrawRect( rRect, nHorzRound, nVertRound );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void OutputDevice::DrawEllipse( const Rectangle& rRect )
|
|
|
|
{
|
|
|
|
DBG_TRACE( "OutputDevice::DrawEllipse()" );
|
|
|
|
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
|
|
|
|
|
|
|
|
if ( mpMetaFile )
|
|
|
|
mpMetaFile->AddAction( new MetaEllipseAction( rRect ) );
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
|
2000-09-18 16:07:07 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
|
|
|
|
if ( aRect.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// we need a graphics
|
|
|
|
if ( !mpGraphics )
|
|
|
|
{
|
|
|
|
if ( !ImplGetGraphics() )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mbInitClipRegion )
|
|
|
|
ImplInitClipRegion();
|
|
|
|
if ( mbOutputClipped )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( mbInitLineColor )
|
|
|
|
ImplInitLineColor();
|
|
|
|
|
|
|
|
Polygon aRectPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
|
|
|
|
if ( aRectPoly.GetSize() >= 2 )
|
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
const SalPoint* pPtAry = (const SalPoint*)aRectPoly.GetConstPointAry();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !mbFillColor )
|
2002-08-29 14:42:38 +00:00
|
|
|
mpGraphics->DrawPolyLine( aRectPoly.GetSize(), pPtAry, this );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( mbInitFillColor )
|
|
|
|
ImplInitFillColor();
|
2002-08-29 14:42:38 +00:00
|
|
|
mpGraphics->DrawPolygon( aRectPoly.GetSize(), pPtAry, this );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-24 16:33:31 +00:00
|
|
|
|
|
|
|
if( mpAlphaVDev )
|
|
|
|
mpAlphaVDev->DrawEllipse( rRect );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void OutputDevice::DrawArc( const Rectangle& rRect,
|
|
|
|
const Point& rStartPt, const Point& rEndPt )
|
|
|
|
{
|
|
|
|
DBG_TRACE( "OutputDevice::DrawArc()" );
|
|
|
|
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
|
|
|
|
|
|
|
|
if ( mpMetaFile )
|
|
|
|
mpMetaFile->AddAction( new MetaArcAction( rRect, rStartPt, rEndPt ) );
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
if ( !IsDeviceOutputNecessary() || !mbLineColor || ImplIsRecordLayout() )
|
2000-09-18 16:07:07 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
|
|
|
|
if ( aRect.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// we need a graphics
|
|
|
|
if ( !mpGraphics )
|
|
|
|
{
|
|
|
|
if ( !ImplGetGraphics() )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mbInitClipRegion )
|
|
|
|
ImplInitClipRegion();
|
|
|
|
if ( mbOutputClipped )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( mbInitLineColor )
|
|
|
|
ImplInitLineColor();
|
|
|
|
|
|
|
|
const Point aStart( ImplLogicToDevicePixel( rStartPt ) );
|
|
|
|
const Point aEnd( ImplLogicToDevicePixel( rEndPt ) );
|
|
|
|
Polygon aArcPoly( aRect, aStart, aEnd, POLY_ARC );
|
|
|
|
|
|
|
|
if ( aArcPoly.GetSize() >= 2 )
|
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
const SalPoint* pPtAry = (const SalPoint*)aArcPoly.GetConstPointAry();
|
2002-08-29 14:42:38 +00:00
|
|
|
mpGraphics->DrawPolyLine( aArcPoly.GetSize(), pPtAry, this );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2003-11-24 16:33:31 +00:00
|
|
|
|
|
|
|
if( mpAlphaVDev )
|
|
|
|
mpAlphaVDev->DrawArc( rRect, rStartPt, rEndPt );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void OutputDevice::DrawPie( const Rectangle& rRect,
|
|
|
|
const Point& rStartPt, const Point& rEndPt )
|
|
|
|
{
|
|
|
|
DBG_TRACE( "OutputDevice::DrawPie()" );
|
|
|
|
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
|
|
|
|
|
|
|
|
if ( mpMetaFile )
|
|
|
|
mpMetaFile->AddAction( new MetaPieAction( rRect, rStartPt, rEndPt ) );
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
|
2000-09-18 16:07:07 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
|
|
|
|
if ( aRect.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// we need a graphics
|
|
|
|
if ( !mpGraphics )
|
|
|
|
{
|
|
|
|
if ( !ImplGetGraphics() )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mbInitClipRegion )
|
|
|
|
ImplInitClipRegion();
|
|
|
|
if ( mbOutputClipped )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( mbInitLineColor )
|
|
|
|
ImplInitLineColor();
|
|
|
|
|
|
|
|
const Point aStart( ImplLogicToDevicePixel( rStartPt ) );
|
|
|
|
const Point aEnd( ImplLogicToDevicePixel( rEndPt ) );
|
|
|
|
Polygon aPiePoly( aRect, aStart, aEnd, POLY_PIE );
|
|
|
|
|
|
|
|
if ( aPiePoly.GetSize() >= 2 )
|
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
const SalPoint* pPtAry = (const SalPoint*)aPiePoly.GetConstPointAry();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !mbFillColor )
|
2002-08-29 14:42:38 +00:00
|
|
|
mpGraphics->DrawPolyLine( aPiePoly.GetSize(), pPtAry, this );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( mbInitFillColor )
|
|
|
|
ImplInitFillColor();
|
2002-08-29 14:42:38 +00:00
|
|
|
mpGraphics->DrawPolygon( aPiePoly.GetSize(), pPtAry, this );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-24 16:33:31 +00:00
|
|
|
|
|
|
|
if( mpAlphaVDev )
|
|
|
|
mpAlphaVDev->DrawPie( rRect, rStartPt, rEndPt );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void OutputDevice::DrawChord( const Rectangle& rRect,
|
|
|
|
const Point& rStartPt, const Point& rEndPt )
|
|
|
|
{
|
|
|
|
DBG_TRACE( "OutputDevice::DrawChord()" );
|
|
|
|
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
|
|
|
|
|
|
|
|
if ( mpMetaFile )
|
|
|
|
mpMetaFile->AddAction( new MetaChordAction( rRect, rStartPt, rEndPt ) );
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
|
2000-09-18 16:07:07 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
|
|
|
|
if ( aRect.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// we need a graphics
|
|
|
|
if ( !mpGraphics )
|
|
|
|
{
|
|
|
|
if ( !ImplGetGraphics() )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mbInitClipRegion )
|
|
|
|
ImplInitClipRegion();
|
|
|
|
if ( mbOutputClipped )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( mbInitLineColor )
|
|
|
|
ImplInitLineColor();
|
|
|
|
|
|
|
|
const Point aStart( ImplLogicToDevicePixel( rStartPt ) );
|
|
|
|
const Point aEnd( ImplLogicToDevicePixel( rEndPt ) );
|
|
|
|
Polygon aChordPoly( aRect, aStart, aEnd, POLY_CHORD );
|
|
|
|
|
|
|
|
if ( aChordPoly.GetSize() >= 2 )
|
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
const SalPoint* pPtAry = (const SalPoint*)aChordPoly.GetConstPointAry();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !mbFillColor )
|
2002-08-29 14:42:38 +00:00
|
|
|
mpGraphics->DrawPolyLine( aChordPoly.GetSize(), pPtAry, this );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( mbInitFillColor )
|
|
|
|
ImplInitFillColor();
|
2002-08-29 14:42:38 +00:00
|
|
|
mpGraphics->DrawPolygon( aChordPoly.GetSize(), pPtAry, this );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-24 16:33:31 +00:00
|
|
|
|
|
|
|
if( mpAlphaVDev )
|
|
|
|
mpAlphaVDev->DrawChord( rRect, rStartPt, rEndPt );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|