2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2004-03-18 09:38:44 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 08:57:01 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2008-04-11 08:57:01 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2008-04-11 08:57:01 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2008-04-11 08:57:01 +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.
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2008-04-11 08:57:01 +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).
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2008-04-11 08:57:01 +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.
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _VCLCANVAS_TOOLS_HXX
|
|
|
|
#define _VCLCANVAS_TOOLS_HXX
|
|
|
|
|
|
|
|
#include <osl/mutex.hxx>
|
2010-10-16 03:20:00 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2004-03-18 09:38:44 +00:00
|
|
|
|
2005-11-02 12:01:43 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
2004-03-18 09:38:44 +00:00
|
|
|
#include <vcl/outdev.hxx>
|
2010-10-16 03:20:00 -05:00
|
|
|
#include <vcl/solarmutex.hxx>
|
2004-03-18 09:38:44 +00:00
|
|
|
|
2004-11-26 16:13:19 +00:00
|
|
|
#include <basegfx/polygon/b2dpolypolygon.hxx>
|
|
|
|
|
2004-03-18 09:38:44 +00:00
|
|
|
#include <com/sun/star/uno/Reference.hxx>
|
|
|
|
#include <com/sun/star/uno/Sequence.hxx>
|
2004-11-26 16:13:19 +00:00
|
|
|
|
|
|
|
#include <canvas/vclwrapper.hxx>
|
|
|
|
#include "outdevprovider.hxx"
|
|
|
|
|
|
|
|
|
|
|
|
class OutputDevice;
|
|
|
|
class Point;
|
|
|
|
class Size;
|
|
|
|
|
2004-03-18 09:38:44 +00:00
|
|
|
namespace basegfx
|
|
|
|
{
|
|
|
|
namespace matrix
|
|
|
|
{
|
|
|
|
class B2DHomMatrix;
|
|
|
|
}
|
|
|
|
namespace vector
|
|
|
|
{
|
|
|
|
class B2DVector;
|
|
|
|
}
|
|
|
|
namespace point
|
|
|
|
{
|
|
|
|
class B2DPoint;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace com { namespace sun { namespace star { namespace awt
|
|
|
|
{
|
|
|
|
struct Point;
|
|
|
|
struct Size;
|
|
|
|
struct Rectangle;
|
|
|
|
} } } }
|
|
|
|
|
|
|
|
namespace com { namespace sun { namespace star { namespace drawing
|
|
|
|
{
|
|
|
|
struct HomogenMatrix3;
|
|
|
|
} } } }
|
|
|
|
|
2005-03-10 10:59:36 +00:00
|
|
|
namespace com { namespace sun { namespace star { namespace geometry
|
2004-03-18 09:38:44 +00:00
|
|
|
{
|
|
|
|
struct RealPoint2D;
|
|
|
|
struct RealSize2D;
|
|
|
|
struct RealRectangle2D;
|
2005-03-10 10:59:36 +00:00
|
|
|
} } } }
|
2004-11-26 16:13:19 +00:00
|
|
|
|
2005-03-10 10:59:36 +00:00
|
|
|
namespace com { namespace sun { namespace star { namespace rendering
|
2004-11-26 16:13:19 +00:00
|
|
|
{
|
2004-03-18 09:38:44 +00:00
|
|
|
struct RenderState;
|
|
|
|
struct ViewState;
|
|
|
|
class XCanvas;
|
|
|
|
class XBitmap;
|
|
|
|
class XPolyPolygon2D;
|
2005-03-10 10:59:36 +00:00
|
|
|
} } } }
|
2004-03-18 09:38:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace vclcanvas
|
|
|
|
{
|
|
|
|
namespace tools
|
|
|
|
{
|
|
|
|
::BitmapEx
|
|
|
|
bitmapExFromXBitmap( const ::com::sun::star::uno::Reference<
|
2005-03-10 10:59:36 +00:00
|
|
|
::com::sun::star::rendering::XBitmap >& );
|
2004-03-18 09:38:44 +00:00
|
|
|
|
2004-11-26 16:13:19 +00:00
|
|
|
/** Setup VCL font and output position
|
|
|
|
|
|
|
|
@returns false, if no text output should happen
|
|
|
|
*/
|
|
|
|
bool setupFontTransform( ::Point& o_rPoint,
|
|
|
|
::Font& io_rVCLFont,
|
2005-03-10 10:59:36 +00:00
|
|
|
const ::com::sun::star::rendering::ViewState& viewState,
|
|
|
|
const ::com::sun::star::rendering::RenderState& renderState,
|
2004-11-26 16:13:19 +00:00
|
|
|
::OutputDevice& rOutDev );
|
2004-03-18 09:38:44 +00:00
|
|
|
|
2005-11-02 12:01:43 +00:00
|
|
|
/** Predicate, to determine whether polygon is actually an axis-aligned rectangle
|
2005-03-30 06:37:56 +00:00
|
|
|
|
2005-11-02 12:01:43 +00:00
|
|
|
@return true, if the polygon is a rectangle.
|
2005-03-30 06:37:56 +00:00
|
|
|
*/
|
2005-11-02 12:01:43 +00:00
|
|
|
bool isRectangle( const PolyPolygon& rPolyPoly );
|
2005-03-30 06:37:56 +00:00
|
|
|
|
2004-03-18 09:38:44 +00:00
|
|
|
|
|
|
|
// Little helper to encapsulate locking into policy class
|
|
|
|
class LocalGuard
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LocalGuard() :
|
2010-10-16 03:20:00 -05:00
|
|
|
aSolarGuard()
|
2004-03-18 09:38:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-11-26 16:13:19 +00:00
|
|
|
/// To be compatible with CanvasBase mutex concept
|
|
|
|
LocalGuard( const ::osl::Mutex& ) :
|
2010-10-16 03:20:00 -05:00
|
|
|
aSolarGuard()
|
2004-11-26 16:13:19 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-03-18 09:38:44 +00:00
|
|
|
private:
|
2010-10-16 03:20:00 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2004-03-18 09:38:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class OutDevStateKeeper
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit OutDevStateKeeper( OutputDevice& rOutDev ) :
|
2004-11-26 16:13:19 +00:00
|
|
|
mpOutDev( &rOutDev ),
|
|
|
|
mbMappingWasEnabled( mpOutDev->IsMapModeEnabled() )
|
|
|
|
{
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
explicit OutDevStateKeeper( const OutDevProviderSharedPtr& rOutDev ) :
|
|
|
|
mpOutDev( rOutDev.get() ? &(rOutDev->getOutDev()) : NULL ),
|
|
|
|
mbMappingWasEnabled( mpOutDev ? mpOutDev->IsMapModeEnabled() : false )
|
2004-03-18 09:38:44 +00:00
|
|
|
{
|
2004-11-26 16:13:19 +00:00
|
|
|
init();
|
2004-03-18 09:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
~OutDevStateKeeper()
|
|
|
|
{
|
2004-11-26 16:13:19 +00:00
|
|
|
if( mpOutDev )
|
|
|
|
{
|
|
|
|
mpOutDev->EnableMapMode( mbMappingWasEnabled );
|
|
|
|
mpOutDev->Pop();
|
|
|
|
}
|
2004-03-18 09:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2004-11-26 16:13:19 +00:00
|
|
|
void init()
|
|
|
|
{
|
|
|
|
if( mpOutDev )
|
|
|
|
{
|
|
|
|
mpOutDev->Push();
|
2011-01-10 13:00:11 +01:00
|
|
|
mpOutDev->EnableMapMode(sal_False);
|
2004-11-26 16:13:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OutputDevice* mpOutDev;
|
|
|
|
const bool mbMappingWasEnabled;
|
2004-03-18 09:38:44 +00:00
|
|
|
};
|
|
|
|
|
2005-03-10 10:59:36 +00:00
|
|
|
::Point mapRealPoint2D( const ::com::sun::star::geometry::RealPoint2D& rPoint,
|
|
|
|
const ::com::sun::star::rendering::ViewState& rViewState,
|
|
|
|
const ::com::sun::star::rendering::RenderState& rRenderState );
|
2004-03-18 09:38:44 +00:00
|
|
|
|
2004-11-26 16:13:19 +00:00
|
|
|
::PolyPolygon mapPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly,
|
2005-03-10 10:59:36 +00:00
|
|
|
const ::com::sun::star::rendering::ViewState& rViewState,
|
|
|
|
const ::com::sun::star::rendering::RenderState& rRenderState );
|
2004-03-18 09:38:44 +00:00
|
|
|
|
2004-11-26 16:13:19 +00:00
|
|
|
enum ModulationMode
|
|
|
|
{
|
|
|
|
MODULATE_NONE,
|
|
|
|
MODULATE_WITH_DEVICECOLOR
|
|
|
|
};
|
|
|
|
|
2005-03-30 06:37:56 +00:00
|
|
|
::BitmapEx transformBitmap( const BitmapEx& rBitmap,
|
|
|
|
const ::basegfx::B2DHomMatrix& rTransform,
|
|
|
|
const ::com::sun::star::uno::Sequence< double >& rDeviceColor,
|
|
|
|
ModulationMode eModulationMode );
|
2004-03-18 09:38:44 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _VCLCANVAS_TOOLS_HXX */
|
2010-10-14 08:27:31 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|