1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: impltools.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _VCLCANVAS_TOOLS_HXX
32 #define _VCLCANVAS_TOOLS_HXX
34 #include <osl/mutex.hxx>
35 #include <vos/mutex.hxx>
37 #include <vcl/svapp.hxx>
38 #include <vcl/outdev.hxx>
40 #include <basegfx/polygon/b2dpolypolygon.hxx>
42 #include <com/sun/star/uno/Reference.hxx>
43 #include <com/sun/star/uno/Sequence.hxx>
45 #include <canvas/vclwrapper.hxx>
46 #include "outdevprovider.hxx"
69 namespace com
{ namespace sun
{ namespace star
{ namespace awt
76 namespace com
{ namespace sun
{ namespace star
{ namespace drawing
78 struct HomogenMatrix3
;
81 namespace com
{ namespace sun
{ namespace star
{ namespace geometry
85 struct RealRectangle2D
;
88 namespace com
{ namespace sun
{ namespace star
{ namespace rendering
103 bitmapExFromXBitmap( const ::com::sun::star::uno::Reference
<
104 ::com::sun::star::rendering::XBitmap
>& );
106 /** Setup VCL font and output position
108 @returns false, if no text output should happen
110 bool setupFontTransform( ::Point
& o_rPoint
,
112 const ::com::sun::star::rendering::ViewState
& viewState
,
113 const ::com::sun::star::rendering::RenderState
& renderState
,
114 ::OutputDevice
& rOutDev
);
116 /** Predicate, to determine whether polygon is actually an axis-aligned rectangle
118 @return true, if the polygon is a rectangle.
120 bool isRectangle( const PolyPolygon
& rPolyPoly
);
123 // Little helper to encapsulate locking into policy class
128 aGuard( Application::GetSolarMutex() )
132 /// To be compatible with CanvasBase mutex concept
133 LocalGuard( const ::osl::Mutex
& ) :
134 aGuard( Application::GetSolarMutex() )
139 ::vos::OGuard aGuard
;
142 class OutDevStateKeeper
145 explicit OutDevStateKeeper( OutputDevice
& rOutDev
) :
146 mpOutDev( &rOutDev
),
147 mbMappingWasEnabled( mpOutDev
->IsMapModeEnabled() )
152 explicit OutDevStateKeeper( const OutDevProviderSharedPtr
& rOutDev
) :
153 mpOutDev( rOutDev
.get() ? &(rOutDev
->getOutDev()) : NULL
),
154 mbMappingWasEnabled( mpOutDev
? mpOutDev
->IsMapModeEnabled() : false )
163 mpOutDev
->EnableMapMode( mbMappingWasEnabled
);
174 mpOutDev
->EnableMapMode(FALSE
);
178 OutputDevice
* mpOutDev
;
179 const bool mbMappingWasEnabled
;
182 ::Point
mapRealPoint2D( const ::com::sun::star::geometry::RealPoint2D
& rPoint
,
183 const ::com::sun::star::rendering::ViewState
& rViewState
,
184 const ::com::sun::star::rendering::RenderState
& rRenderState
);
186 ::PolyPolygon
mapPolyPolygon( const ::basegfx::B2DPolyPolygon
& rPoly
,
187 const ::com::sun::star::rendering::ViewState
& rViewState
,
188 const ::com::sun::star::rendering::RenderState
& rRenderState
);
193 MODULATE_WITH_DEVICECOLOR
196 ::BitmapEx
transformBitmap( const BitmapEx
& rBitmap
,
197 const ::basegfx::B2DHomMatrix
& rTransform
,
198 const ::com::sun::star::uno::Sequence
< double >& rDeviceColor
,
199 ModulationMode eModulationMode
);
204 #endif /* _VCLCANVAS_TOOLS_HXX */